From: Kevin O'Connor Date: Sat, 7 Feb 2009 16:25:29 +0000 (-0500) Subject: More floppy code cleanups. X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=a3b612ef3ccac08da026f1fc79b0fa6fe646df23;p=seabios.git More floppy code cleanups. Reorganize code slightly to improve readability. --- diff --git a/src/biosvar.h b/src/biosvar.h index 28f956f..369f4ea 100644 --- a/src/biosvar.h +++ b/src/biosvar.h @@ -99,8 +99,7 @@ struct bios_data_area_s { u8 floppy_harddisk_info; // 40:90 u8 floppy_media_state[4]; - u8 floppy_track0; - u8 floppy_track1; + u8 floppy_track[2]; u8 kbd_mode; u8 kbd_led; u32 ptr_user_wait_complete_flag; diff --git a/src/floppy.c b/src/floppy.c index 3096315..28f2f6b 100644 --- a/src/floppy.c +++ b/src/floppy.c @@ -99,25 +99,24 @@ floppy_drive_setup() enable_hwirq(6, entry_0e); } -static inline void -set_diskette_current_cyl(u8 drive, u8 cyl) +#define floppy_ret(regs, code) \ + __floppy_ret((regs), (code) | (__LINE__ << 8), __func__) + +void +__floppy_ret(struct bregs *regs, u32 linecode, const char *fname) { - if (drive) - SET_BDA(floppy_track1, cyl); + u8 code = linecode; + SET_BDA(floppy_last_status, code); + if (code) + __set_code_fail(regs, linecode, fname); else - SET_BDA(floppy_track0, cyl); + set_code_success(regs); } -static u16 -floppy_media_known(u8 drive) -{ - if (!(GET_BDA(floppy_recalibration_status) & (1< 1 || !GET_GLOBAL(FloppyTypes[drive])) { - // XXX - return type doesn't match floppy_ret(regs, DISK_RET_ETIMEOUT); return -1; } - // see if media in drive, and type is known - if (floppy_media_known(drive) == 0 && floppy_media_sense(drive) == 0) { + if ((GET_BDA(floppy_recalibration_status) & (1<