Add INT13h handling for SD Card.
This commit is contained in:
committed by
Ted Fried
parent
d2f95788e5
commit
1e800f94c5
139
XTMax/Drivers/BootROM/utils.inc
Normal file
139
XTMax/Drivers/BootROM/utils.inc
Normal file
@@ -0,0 +1,139 @@
|
||||
;
|
||||
; Display a string.
|
||||
; in: AX = string pointer
|
||||
; out: AX = <TRASH>
|
||||
;
|
||||
print_string:
|
||||
pushf
|
||||
push ds
|
||||
push bx
|
||||
push si
|
||||
mov si, ax
|
||||
%ifndef AS_COM_PROGRAM
|
||||
mov ax, ROM_SEGMENT
|
||||
mov ds, ax
|
||||
%endif
|
||||
mov ah, 0xe
|
||||
xor bx, bx
|
||||
cld
|
||||
.loop:
|
||||
lodsb
|
||||
or al, al
|
||||
jz .done
|
||||
int 0x10
|
||||
jmp .loop
|
||||
.done:
|
||||
pop si
|
||||
pop bx
|
||||
pop ds
|
||||
popf
|
||||
ret
|
||||
|
||||
;
|
||||
; Display a 16-bit value in hex.
|
||||
; in: AX = value
|
||||
; out: AX = <TRASH>
|
||||
;
|
||||
print_hex:
|
||||
pushf
|
||||
push ds
|
||||
push bx
|
||||
push cx
|
||||
push dx
|
||||
push si
|
||||
mov dx, ax
|
||||
%ifndef AS_COM_PROGRAM
|
||||
mov ax, ROM_SEGMENT
|
||||
mov ds, ax
|
||||
%endif
|
||||
xor bx, bx
|
||||
cld
|
||||
.nibble1:
|
||||
mov si, dx
|
||||
mov cl, 12
|
||||
shr si, cl
|
||||
and si, 0xf
|
||||
mov al, [hex_map+si]
|
||||
mov ah, 0xe
|
||||
int 0x10
|
||||
.nibble2:
|
||||
mov si, dx
|
||||
mov cl, 8
|
||||
shr si, cl
|
||||
and si, 0xf
|
||||
mov al, [hex_map+si]
|
||||
mov ah, 0xe
|
||||
int 0x10
|
||||
.nibble3:
|
||||
mov si, dx
|
||||
mov cl, 4
|
||||
shr si, cl
|
||||
and si, 0xf
|
||||
mov al, [hex_map+si]
|
||||
mov ah, 0xe
|
||||
int 0x10
|
||||
.nibble4:
|
||||
mov si, dx
|
||||
and si, 0xf
|
||||
mov al, [hex_map+si]
|
||||
mov ah, 0xe
|
||||
int 0x10
|
||||
pop si
|
||||
pop dx
|
||||
pop cx
|
||||
pop bx
|
||||
pop ds
|
||||
popf
|
||||
ret
|
||||
|
||||
hex_map db '0123456789ABCDEF'
|
||||
|
||||
%if %isdef(EXTRA_DEBUG) || %isdef(AS_COM_PROGRAM)
|
||||
dump_regs:
|
||||
push ax
|
||||
mov ax, registers_msg
|
||||
call print_string
|
||||
pop ax
|
||||
push ax
|
||||
call print_hex
|
||||
mov ax, space
|
||||
call print_string
|
||||
mov ax, bx
|
||||
call print_hex
|
||||
mov ax, space
|
||||
call print_string
|
||||
mov ax, cx
|
||||
call print_hex
|
||||
mov ax, space
|
||||
call print_string
|
||||
mov ax, dx
|
||||
call print_hex
|
||||
mov ax, space
|
||||
call print_string
|
||||
mov ax, ds
|
||||
call print_hex
|
||||
mov ax, space
|
||||
call print_string
|
||||
mov ax, si
|
||||
call print_hex
|
||||
mov ax, space
|
||||
call print_string
|
||||
mov ax, es
|
||||
call print_hex
|
||||
mov ax, space
|
||||
call print_string
|
||||
mov ax, di
|
||||
call print_hex
|
||||
mov ax, space
|
||||
call print_string
|
||||
mov ax, bp
|
||||
call print_hex
|
||||
mov ax, space
|
||||
call print_string
|
||||
mov ax, newline
|
||||
call print_string
|
||||
pop ax
|
||||
ret
|
||||
|
||||
registers_msg db ' AX BX CX DX DS SI ES DI BP', 0xD, 0xA, 0
|
||||
%endif
|
||||
Reference in New Issue
Block a user