mov ax,[SavedAX]
pushad
mov bp,sp ; Point BP to the entry stack frame
+ ; Note: AH == P_AH here
cmp ah,Int13FuncsMax
jae Invalid
xor al,al ; AL = 0 is standard entry condition
mov [LastStatus],ah
and ah,ah
+ lds ebx,[Stack]
+ ; This sets the low byte (the arithmetric flags) of the
+ ; FLAGS on stack to either 00h (no flags) or 01h (CF)
+ ; depending on if AH was zero or not.
+ setnz [bx+4] ; Set CF iff error
popad
pop es
pop ds
lss esp,[cs:Stack]
-
- ; This sets the low byte (the arithmetric flags) of the
- ; FLAGS on stack to either 00h (no flags) or 01h (CF)
- ; depending on if AH was zero or not.
- setnz [esp+4] ; Set CF iff error
iret
Reset:
movzx edi,P_DH ; Head number
movzx eax,word [Heads]
shr cl,6
- xchg cl,ch ; Now CX <- cylinder number
+ xchg cl,ch ; Now (E)CX <- cylinder number
mul ecx ; eax <- Heads*cyl# (edx <- 0)
add eax,edi
mul dword [Sectors]
add eax,ebx
- ; Now eax = LBA
+ ; Now eax = LBA, edx = 0
;
; setup_regs continues...
add edi,ecx ; EDI = address to fetch to
movzx ecx,P_AL ; Sector count
mov esi,eax
- add eax,ecx
- shl esi,SECTORSIZE_LG2
+ add eax,ecx ; LBA of final sector + 1
+ shl esi,SECTORSIZE_LG2 ; LBA -> byte offset
add esi,[DiskBuf] ; Get address in high memory
cmp eax,[DiskSize] ; Check the high mark against limit
ja .overrun
pop ds
mov ecx,20 ; Bytes loaded
int15_success:
- mov byte [bp+12], 02h ; Clear CF
+ mov byte [bp+6], 02h ; Clear CF
pop bp
iret
err86:
- mov byte [bp+12], 03h ; Set CF
+ mov byte [bp+6], 03h ; Set CF
mov ah,86h
pop bp
iret
jna .safe_size
mov ecx,8000h
.safe_size:
- push ecx
+ push ecx ; Transfer size this cycle
mov eax, esi
mov [Mover_src1], si
shr eax, 16
mov si,Mover
mov ah, 87h
int 15h
- pop eax
+ cli ; Some BIOSes enable interrupts on INT 15h
+ pop eax ; Transfer size this cycle
pop ecx
pop edi
pop esi
db 93h ; Access rights
db 00h ; Extended access rights
Mover_dst2: db 0 ; High 8 bits of source addy
+Mover_dummy2: dd 0, 0, 0, 0 ; More space for the BIOS
LastStatus db 0 ; Last return status
DriveType db 0 ; Our drive type (floppies)
MyStack dw 0 ; Offset of stack
- dw 0 ; Padding
; End patch area
driveraddr = stddosmem - total_size;
driveraddr &= ~0x3FF;
- /* Anything beyond the end is for the stack */
- pptr->mystack = (uint16_t)(stddosmem-driveraddr);
-
printf("Old dos memory at 0x%05x (map says 0x%05x), loading at 0x%05x\n",
stddosmem, dos_mem, driveraddr);
driverseg = driveraddr >> 4;
driverptr = driverseg << 16;
+ /* Anything beyond the end is for the stack */
+ pptr->mystack = (uint16_t)(stddosmem-driveraddr);
+
pptr->oldint13 = rdz_32(BIOS_INT13);
pptr->oldint15 = rdz_32(BIOS_INT15);