Load into memory before printing

This commit is contained in:
Robbe Van Herck 2019-12-28 14:41:19 +01:00
parent 024d6c5075
commit 443b96171f
No known key found for this signature in database
GPG key ID: A66F76F7B81BD784

View file

@ -89,11 +89,11 @@ mov bl, ah
call .puthex call .puthex
.reset_disk_no_error: .reset_disk_no_error:
push byte 0 mov cx, 1 ; start at sector 1
.read_disk_loop: mov bx, 0x8000 ; write to 0x8000
pop cx push bx
inc cl
push cx push cx
.read_disk_loop:
; Read sector dl into memory ; Read sector dl into memory
mov ah, 0x02 mov ah, 0x02
@ -102,7 +102,6 @@ mov ch, 0x00 ; cylinder number, low 8 bits
; mov cl, 0x01 ; cylinder number, high 2 bits + sector number (6 bits) ; mov cl, 0x01 ; cylinder number, high 2 bits + sector number (6 bits)
mov dh, 0x00 ; head number mov dh, 0x00 ; head number
mov dl, DISK_ID ; drive number mov dl, DISK_ID ; drive number
mov bx, .data ; data buffer
int 0x13 int 0x13
jc .read_disk_error jc .read_disk_error
@ -112,16 +111,22 @@ mov bl, ah
call .puthex call .puthex
.read_disk_no_error: .read_disk_no_error:
; print string pop cx
mov bx, .data pop bx
call .puts inc cl ; next sector
add bx, 512 ; add 512 to data start so we don't overwrite sectors
push bx
push cx
jmp .read_disk_loop jmp .read_disk_loop
.read_disk_error: .read_disk_error:
.end: .end:
hlt hlt
.data: ; print string
mov bx, 0x8000
call .puts
; print padding nullbytes ; print padding nullbytes
times 510 - ($ - $$) db 0 times 510 - ($ - $$) db 0