mirror of
https://github.com/tailix/loadwarka.git
synced 2024-11-18 13:54:56 -05:00
Save and restore disk number
This commit is contained in:
parent
1cef081aed
commit
a49f858112
2 changed files with 13 additions and 5 deletions
|
@ -5,6 +5,11 @@
|
||||||
#define STACK_BASE 0x2000
|
#define STACK_BASE 0x2000
|
||||||
|
|
||||||
.code16
|
.code16
|
||||||
|
.global disk_number
|
||||||
|
.global restore_disk_number
|
||||||
|
|
||||||
|
.section .data
|
||||||
|
disk_number: .byte 0
|
||||||
|
|
||||||
.section .header
|
.section .header
|
||||||
ljmp $0, $init
|
ljmp $0, $init
|
||||||
|
@ -21,4 +26,11 @@ init:
|
||||||
mov %ax, %fs
|
mov %ax, %fs
|
||||||
mov %ax, %gs
|
mov %ax, %gs
|
||||||
mov $STACK_BASE, %sp
|
mov $STACK_BASE, %sp
|
||||||
|
mov %dl, disk_number
|
||||||
ljmp $0, $_start
|
ljmp $0, $_start
|
||||||
|
|
||||||
|
.section .text
|
||||||
|
restore_disk_number:
|
||||||
|
mov $disk_number, %bx
|
||||||
|
mov (%bx), %dl
|
||||||
|
ret
|
||||||
|
|
|
@ -18,13 +18,8 @@ parenth: .string " ("
|
||||||
of: .string " of "
|
of: .string " of "
|
||||||
to_address: .string ") to address "
|
to_address: .string ") to address "
|
||||||
|
|
||||||
.section .data
|
|
||||||
disk: .byte 0
|
|
||||||
|
|
||||||
.section .text
|
.section .text
|
||||||
_start:
|
_start:
|
||||||
mov %dl, disk
|
|
||||||
|
|
||||||
mov $hello, %si
|
mov $hello, %si
|
||||||
call print_str
|
call print_str
|
||||||
|
|
||||||
|
@ -107,6 +102,7 @@ read_loop:
|
||||||
jmp read_loop
|
jmp read_loop
|
||||||
|
|
||||||
finish:
|
finish:
|
||||||
|
call restore_disk_number
|
||||||
ljmp $0, $STAGE2_BASE
|
ljmp $0, $STAGE2_BASE
|
||||||
ljmp $0, $hang
|
ljmp $0, $hang
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue