Hi!
Part three:
- small code clean and tune.
--- Begin Message ---
diff -ruNp old/drivers/floppy.asm new/drivers/floppy.asm
--- old/drivers/floppy.asm 2004-06-08 20:10:34.000000000 +0000
+++ new/drivers/floppy.asm 2004-06-08 20:35:36.000000000 +0000
@@ -54,7 +54,7 @@ FL_RESET:
; int ASMPASCAL fl_diskchanged(UBYTE drive);
;
; Read disk change line status.
-; returns 1 if disk has changed, 0 if not, 0xFFFF if error.
+; returns 1 if disk has changed, 0 if not, 0xFF if error.
;
global FL_DISKCHANGED
@@ -67,18 +67,14 @@ FL_DISKCHANGED:
mov ah,16h ; read change status type
xor si,si ; RBIL: avoid crash on AT&T 6300
int 13h
+ pop si
- mov al,1
- jnc fl_dc_ret1 ; cy==1 is error or disk has changed
-
- cmp ah,6 ; ah=6: disk has changed
- je fl_dc_ret
- dec ax ; 0xFF on error
-
-fl_dc_ret1: dec ax
-fl_dc_ret: cbw
- pop si
- ret
+ sbb al,al ; CF=0 (disk has not changed)
+ jnc ret_AH_0 ; ...return 0
+ cmp ah,6 ; ah!=6 (error)
+ jne ret_AH_0 ; ...return 0xFF
+ mov al,1 ; ah=6 (disk has changed)
+ jmp short ret_AH_0 ; ...return 1
;
; int ASMPASCAL fl_read (UBYTE drive, WORD head, WORD track, WORD sector, WORD
count, void FAR *buffer);
@@ -172,7 +168,8 @@ FL_LBA_READWRITE:
;
global FL_READKEY
-FL_READKEY: xor ah, ah
+FL_READKEY:
+ mov ah,0
int 16h
ret
@@ -190,6 +187,7 @@ FL_SETDISKTYPE:
int 13h
ret_AH:
mov al,ah ; place error code into al
+ret_AH_0:
mov ah,0
ret
--- End Message ---