Allow swapping driver ID between the BIOS disk and XTMax.
This commit is contained in:
@@ -19,7 +19,7 @@ unsigned char BOOTROM[] = {
|
||||
4, 184, 51, 231, 232, 56, 4, 251, 94, 90, 89, 88, 7, 203, 85, 86,
|
||||
128, 250, 128, 116, 57, 137, 197, 137, 214, 156, 14, 184, 47, 225, 80, 156,
|
||||
186, 132, 2, 237, 80, 186, 134, 2, 237, 80, 137, 232, 137, 242, 207, 156,
|
||||
80, 137, 232, 128, 252, 8, 117, 18, 137, 240, 60, 128, 114, 12, 6, 184,
|
||||
80, 137, 240, 60, 128, 114, 19, 137, 232, 128, 252, 8, 117, 12, 6, 184,
|
||||
64, 0, 142, 192, 38, 138, 22, 117, 0, 7, 88, 157, 235, 58, 128, 252,
|
||||
21, 126, 5, 232, 113, 0, 235, 34, 128, 252, 1, 116, 10, 128, 252, 21,
|
||||
116, 5, 190, 122, 225, 235, 3, 190, 136, 225, 86, 137, 222, 136, 227, 48,
|
||||
@@ -127,4 +127,4 @@ unsigned char BOOTROM[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 177};
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 176};
|
||||
@@ -25,6 +25,14 @@ cpu 8086 ; ensure we remain compatible with 8086
|
||||
;
|
||||
%define DISK_NUMBER FIXED_DISK_0
|
||||
|
||||
%if DISK_NUMBER == FIXED_DISK_0
|
||||
;
|
||||
; Whether we are going to rename the BIOS's 1st disk to be the second disk.
|
||||
; This is useful to allow booting from the second disk.
|
||||
;
|
||||
;%define TAKE_OVER_FIXED_DISK_0
|
||||
%endif
|
||||
|
||||
;
|
||||
; Whether we will try/force using our own bootstrap code instead of falling back to BASIC.
|
||||
;
|
||||
@@ -178,6 +186,13 @@ entry:
|
||||
mov ax, newline
|
||||
call print_string
|
||||
|
||||
;
|
||||
; Move fixed disk 0 to fixed disk 1.
|
||||
;
|
||||
%ifdef TAKE_OVER_FIXED_DISK_0
|
||||
call swap_fixed_disk_parameters_tables
|
||||
%endif
|
||||
|
||||
;
|
||||
; Install our fixed disk parameter table.
|
||||
; For the 1st disk, it is stored in the interrupt vector table, at vector 41h.
|
||||
@@ -283,6 +298,13 @@ int13h_entry:
|
||||
; This is not an operation for the SD Card. Forward to the BIOS INT 13h handler.
|
||||
;
|
||||
.forward_to_bios:
|
||||
%ifdef TAKE_OVER_FIXED_DISK_0
|
||||
cmp dl, 0x80+FIXED_DISK_1 ; is this the other fixed drive?
|
||||
jne .no_fixed_disk_take_over
|
||||
mov dl, 0x80+FIXED_DISK_0
|
||||
call swap_fixed_disk_parameters_tables
|
||||
.no_fixed_disk_take_over:
|
||||
%endif
|
||||
mov TEMP0, ax ; save ax
|
||||
mov TEMP1, dx ; save dx
|
||||
pushf ; setup for iret from INT 13h handler
|
||||
@@ -314,12 +336,16 @@ int13h_entry:
|
||||
.return_from_int13h:
|
||||
pushf
|
||||
push ax
|
||||
mov ax, TEMP0 ; original ax
|
||||
cmp ah, 0x08 ; is read parameters?
|
||||
jne .skip_update_hdnum
|
||||
mov ax, TEMP1 ; original dx
|
||||
cmp al, 0x80 ; is fixed fixed?
|
||||
jb .skip_update_hdnum
|
||||
%ifdef TAKE_OVER_FIXED_DISK_0
|
||||
mov dl, 0x80+FIXED_DISK_1
|
||||
call swap_fixed_disk_parameters_tables
|
||||
%endif
|
||||
mov ax, TEMP0 ; original ax
|
||||
cmp ah, 0x08 ; is read parameters?
|
||||
jne .skip_update_hdnum
|
||||
push es
|
||||
mov ax, 0x40 ; BIOS data area
|
||||
mov es, ax
|
||||
@@ -990,6 +1016,25 @@ int18h_entry:
|
||||
jmp .loop
|
||||
%endif
|
||||
|
||||
%ifdef TAKE_OVER_FIXED_DISK_0
|
||||
swap_fixed_disk_parameters_tables:
|
||||
push es
|
||||
push ax
|
||||
push bx
|
||||
xor ax, ax
|
||||
mov es, ax
|
||||
mov ax, es:[(0x41+FIXED_DISK_0*5)*4+2]
|
||||
xchg es:[(0x41+FIXED_DISK_1*5)*4+2], ax
|
||||
mov es:[(0x41+FIXED_DISK_0*5)*4+2], ax
|
||||
mov ax, es:[(0x41+FIXED_DISK_0*5)*4]
|
||||
xchg es:[(0x41+FIXED_DISK_1*5)*4], ax
|
||||
mov es:[(0x41+FIXED_DISK_0*5)*4], ax
|
||||
pop bx
|
||||
pop ax
|
||||
pop es
|
||||
ret
|
||||
%endif
|
||||
|
||||
;
|
||||
; Compute LBA address based on CHS address
|
||||
; in: CH = cylinder number (low 8 bits)
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
mov di, 0xbbcc
|
||||
mov bp, 0xddee
|
||||
|
||||
mov dl, 0x80
|
||||
mov dl, 0x81
|
||||
mov ah, 0x08
|
||||
|
||||
;mov bx, buf_write
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
call do_int13h
|
||||
|
||||
mov dl, 0x80
|
||||
mov dl, 0x81
|
||||
mov ah, 0x02
|
||||
|
||||
mov bx, ds
|
||||
@@ -145,6 +145,11 @@ fake_int13h_entry:
|
||||
mov al, ah
|
||||
xor ah, ah
|
||||
call print_hex
|
||||
mov ax, drive_msg
|
||||
call print_string
|
||||
mov ax, dx
|
||||
xor ah, ah
|
||||
call print_hex
|
||||
mov ax, newline
|
||||
call print_string
|
||||
pop ax
|
||||
@@ -162,6 +167,7 @@ buf_write db 1, 2, 3, 4, 5, 6, 7, 8
|
||||
buf_read times 1024 db 0
|
||||
|
||||
fake_handler_msg db 'BIOS INT13h Function ', 0
|
||||
drive_msg db ' Drive ', 0
|
||||
test_success_msg db 'Call succeeded ', 0
|
||||
test_failed_msg db 'Call failed ', 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user