fork of PCE focusing on macplus, supporting DaynaPort SCSI network emulation
1/*****************************************************************************
2 * pce *
3 *****************************************************************************/
4
5/*****************************************************************************
6 * File name: src/utils/pfi/delete.c *
7 * Created: 2013-12-27 by Hampa Hug <hampa@hampa.ch> *
8 * Copyright: (C) 2013-2017 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 <stdlib.h>
26#include <stdio.h>
27#include <string.h>
28
29#include <drivers/pfi/pfi.h>
30
31
32static
33int pfi_delete_track_cb (pfi_img_t *img, pfi_trk_t *trk, unsigned long c, unsigned long h, void *opaque)
34{
35 pfi_img_del_track (img, c, h);
36
37 return (0);
38}
39
40int pfi_delete_tracks (pfi_img_t *img)
41{
42 return (pfi_for_all_tracks (img, pfi_delete_track_cb, NULL));
43}
44
45
46int pfi_double_step (pfi_img_t *img, int even)
47{
48 unsigned c, cn;
49 pfi_cyl_t *cyl;
50
51 cn = pfi_img_get_cyl_cnt (img);
52
53 for (c = 0; c < cn; c++) {
54 cyl = pfi_img_rmv_cylinder (img, c);
55
56 if (((c & 1) && even) || (((c & 1) == 0) && !even)) {
57 pfi_cyl_del (cyl);
58 }
59 else {
60 pfi_img_set_cylinder (img, cyl, c / 2);
61 }
62 }
63
64 return (0);
65}