Skip to content

Commit eaf6d0d

Browse files
committed
apple2: Build only the HFE image handler
1 parent 9f673a8 commit eaf6d0d

File tree

3 files changed

+27
-5
lines changed

3 files changed

+27
-5
lines changed

inc/floppy.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,11 @@ static inline unsigned int im_nphys_cyls(struct image *im)
302302
}
303303
static inline bool_t in_da_mode(struct image *im, unsigned int cyl)
304304
{
305+
#if TARGET == TARGET_shugart
305306
return cyl >= max_t(unsigned int, DA_FIRST_CYL, im_nphys_cyls(im));
307+
#else
308+
return FALSE;
309+
#endif
306310
}
307311

308312
extern uint32_t motor_chgrst_exti_mask;

src/image/Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ OBJS += image.o
33

44
OBJS-$(quickdisk) += qd.o
55

6-
ifeq ($(target),apple2)
7-
shugart := y
8-
endif
6+
OBJS-$(apple2) += hfe.o
97

108
OBJS-$(shugart) += adf.o
119
OBJS-$(shugart) += dsk.o

src/image/image.c

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* See the file COPYING for more details, or visit <http://unlicense.org>.
1010
*/
1111

12-
#if TARGET == TARGET_shugart || TARGET == TARGET_apple2
12+
#if TARGET == TARGET_shugart
1313

1414
extern const struct image_handler adf_image_handler;
1515
extern const struct image_handler atr_image_handler;
@@ -68,6 +68,15 @@ const struct image_type image_type[] = {
6868
{ "", NULL }
6969
};
7070

71+
#elif TARGET == TARGET_apple2
72+
73+
extern const struct image_handler hfe_image_handler;
74+
75+
const struct image_type image_type[] = {
76+
{ "hfe", &hfe_image_handler },
77+
{ "", NULL }
78+
};
79+
7180
#elif TARGET == TARGET_quickdisk
7281

7382
extern const struct image_handler qd_image_handler;
@@ -135,7 +144,7 @@ static bool_t try_handler(struct image *im, struct slot *slot,
135144
return handler->open(im);
136145
}
137146

138-
#if TARGET == TARGET_shugart || TARGET == TARGET_apple2
147+
#if TARGET == TARGET_shugart
139148

140149
void image_open(struct image *im, struct slot *slot, DWORD *cltbl)
141150
{
@@ -200,6 +209,17 @@ void image_open(struct image *im, struct slot *slot, DWORD *cltbl)
200209
F_die(FR_BAD_IMAGE);
201210
}
202211

212+
#elif TARGET == TARGET_apple2
213+
214+
void image_open(struct image *im, struct slot *slot, DWORD *cltbl)
215+
{
216+
if (try_handler(im, slot, cltbl, &hfe_image_handler))
217+
return;
218+
219+
/* No handler found: bad image. */
220+
F_die(FR_BAD_IMAGE);
221+
}
222+
203223
#elif TARGET == TARGET_quickdisk
204224

205225
void image_open(struct image *im, struct slot *slot, DWORD *cltbl)

0 commit comments

Comments
 (0)