fork of PCE focusing on macplus, supporting DaynaPort SCSI network emulation
1/*****************************************************************************
2 * pce *
3 *****************************************************************************/
4
5/*****************************************************************************
6 * File name: src/utils/pri/delete.c *
7 * Created: 2013-12-19 by Hampa Hug <hampa@hampa.ch> *
8 * Copyright: (C) 2013 Hampa Hug <hampa@hampa.ch> *
9 *****************************************************************************/
10
11/*****************************************************************************
12 * This program is free software. You can redistribute it and / or modify it *
13 * under the terms of the GNU General Public License version 2 as published *
14 * by the Free Software Foundation. *
15 * *
16 * This program is distributed in the hope that it will be useful, but *
17 * WITHOUT ANY WARRANTY, without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General *
19 * Public License for more details. *
20 *****************************************************************************/
21
22
23#include "main.h"
24
25#include <stdio.h>
26#include <string.h>
27
28#include <drivers/pri/pri.h>
29
30
31static
32int pri_delete_track_cb (pri_img_t *img, pri_trk_t *trk, unsigned long c, unsigned long h, void *opaque)
33{
34 pri_img_del_track (img, c, h);
35
36 return (0);
37}
38
39int pri_delete_tracks (pri_img_t *img)
40{
41 return (pri_for_all_tracks (img, pri_delete_track_cb, NULL));
42}
43
44
45int pri_double_step (pri_img_t *img, int even)
46{
47 unsigned c, cn;
48 pri_cyl_t *cyl;
49
50 cn = pri_img_get_cyl_cnt (img);
51
52 for (c = 0; c < cn; c++) {
53 cyl = pri_img_rmv_cylinder (img, c);
54
55 if (((c & 1) && even) || (((c & 1) == 0) && !even)) {
56 pri_cyl_del (cyl);
57 }
58 else {
59 pri_img_set_cylinder (img, cyl, c / 2);
60 }
61 }
62
63 return (0);
64}