diff options
author | hpa <hpa> | 2001-12-15 07:09:26 +0000 |
---|---|---|
committer | hpa <hpa> | 2001-12-15 07:09:26 +0000 |
commit | 91d13691ed844772bc3e71da9295744f30e9b739 (patch) | |
tree | 6f2cbbf2720e422fca65429329aae479918bb65a | |
parent | 624495b348f4c32a81d47b3d7597a619fe7ca2f3 (diff) | |
download | syslinux-91d13691ed844772bc3e71da9295744f30e9b739.tar.gz |
Preserve DL except for the rather few calls for which DL is part of the
return value. This is required for DOS not to go ballistic.
-rw-r--r-- | memdisk/memdisk.asm | 48 |
1 files changed, 38 insertions, 10 deletions
diff --git a/memdisk/memdisk.asm b/memdisk/memdisk.asm index c18545a5..220db475 100644 --- a/memdisk/memdisk.asm +++ b/memdisk/memdisk.asm @@ -74,8 +74,18 @@ Pointers: dw Int13Start dw TotalSize Int13Start: + ; Swap stack + mov [cs:Stack],esp + mov [cs:SavedAX],ax + mov ax,ss + mov [cs:Stack+4],ax + mov ax,cs + mov ss,ax + mov sp,[cs:MyStack] + ; See if DL points to our class of device (FD, HD) push dx + push dx xor dl,[cs:DriveNo] pop dx js .nomatch ; If SF=0, we have a class match here @@ -84,23 +94,41 @@ Int13Start: jb .nomatch ; Drive < Our drive dec dl ; Drive > Our drive, adjust drive # .nomatch: - jmp far [cs:OldInt13] + mov ax,[cs:SavedAX] + pushf + call far [cs:OldInt13] + pushf + push bp + mov bp,sp + cmp byte [cs:SavedAX+1],08h + je .norestoredl + cmp byte [cs:SavedAX+1],15h + jne .restoredl + test byte [bp+4],80h ; Hard disk? + jnz .norestoredl +.restoredl: + mov dl,[bp+4] +.norestoredl: + push ax + push ebx + push ds + mov ax,[bp+2] ; Flags + lds ebx,[cs:Stack] + mov [bx+4],al ; Arithmetric flags + pop ds + pop ebx + pop ax + pop bp + lss esp,[cs:Stack] + iret .our_drive: - ; Swap stack - mov [cs:Stack],esp - mov [cs:SavedAX],ax - mov ax,ss - mov [cs:Stack+4],ax - mov ax,cs - mov ss,ax - mov sp,[cs:MyStack] + ; Set up standard entry frame push ds push es mov ds,ax mov es,ax mov ax,[SavedAX] - pushad mov bp,sp ; Point BP to the entry stack frame TRACER 'F' |