mirror of https://github.com/tailix/loadwarka.git
Fix reading of sectors
This commit is contained in:
parent
dda55b3972
commit
969201e229
|
@ -89,39 +89,47 @@ main:
|
||||||
inc %ax
|
inc %ax
|
||||||
no_rem:
|
no_rem:
|
||||||
|
|
||||||
// AX - number of sectors
|
|
||||||
push %ax
|
push %ax
|
||||||
call print_number_of_sectors
|
call print_number_of_sectors
|
||||||
pop %ax
|
pop %cx
|
||||||
// BX - address
|
|
||||||
mov $STAGE2_BASE, %bx
|
mov $STAGE2_BASE, %bx
|
||||||
|
mov $2, %ax
|
||||||
|
|
||||||
|
// AX - number of sector to read
|
||||||
|
// BX - address
|
||||||
|
// CX - total number of sectors
|
||||||
read_loop:
|
read_loop:
|
||||||
add $512, %bx
|
add $512, %bx
|
||||||
dec %ax
|
inc %ax
|
||||||
test %ax, %ax
|
|
||||||
|
test %ax, %cx
|
||||||
jz finish
|
jz finish
|
||||||
|
|
||||||
push %ax
|
push %ax
|
||||||
push %bx
|
push %bx
|
||||||
|
push %cx
|
||||||
|
|
||||||
mov $STAGE1_ADDR(reading_sector), %si
|
mov $STAGE1_ADDR(reading_sector), %si
|
||||||
call print_str
|
call print_str
|
||||||
|
|
||||||
|
pop %cx
|
||||||
pop %bx
|
pop %bx
|
||||||
pop %ax
|
pop %ax
|
||||||
push %ax
|
push %ax
|
||||||
push %bx
|
push %bx
|
||||||
|
push %cx
|
||||||
|
|
||||||
call print_number
|
call print_number
|
||||||
|
|
||||||
mov $STAGE1_ADDR(to_address), %si
|
mov $STAGE1_ADDR(to_address), %si
|
||||||
call print_str
|
call print_str
|
||||||
|
|
||||||
|
pop %cx
|
||||||
pop %bx
|
pop %bx
|
||||||
pop %ax
|
pop %ax
|
||||||
push %ax
|
push %ax
|
||||||
push %bx
|
push %bx
|
||||||
|
push %cx
|
||||||
|
|
||||||
mov %bx, %ax
|
mov %bx, %ax
|
||||||
call print_number
|
call print_number
|
||||||
|
@ -129,11 +137,13 @@ read_loop:
|
||||||
mov $STAGE1_ADDR(newline), %si
|
mov $STAGE1_ADDR(newline), %si
|
||||||
call print_str
|
call print_str
|
||||||
|
|
||||||
|
pop %cx
|
||||||
pop %bx
|
pop %bx
|
||||||
pop %ax
|
pop %ax
|
||||||
|
|
||||||
push %ax
|
push %ax
|
||||||
push %bx
|
push %bx
|
||||||
|
push %cx
|
||||||
|
|
||||||
mov %al, %cl // Cylinder and sector
|
mov %al, %cl // Cylinder and sector
|
||||||
mov $0x02, %ah
|
mov $0x02, %ah
|
||||||
mov $1, %al // Sectors count
|
mov $1, %al // Sectors count
|
||||||
|
@ -141,9 +151,10 @@ read_loop:
|
||||||
mov $0, %ch // Cylinder
|
mov $0, %ch // Cylinder
|
||||||
mov $0, %dh // Head
|
mov $0, %dh // Head
|
||||||
int $0x13
|
int $0x13
|
||||||
|
|
||||||
|
pop %cx
|
||||||
pop %bx
|
pop %bx
|
||||||
pop %ax
|
pop %ax
|
||||||
|
|
||||||
jmp read_loop
|
jmp read_loop
|
||||||
|
|
||||||
finish:
|
finish:
|
||||||
|
|
Loading…
Reference in New Issue