mirror of https://github.com/tailix/loadwarka.git
Both stages print hello
This commit is contained in:
parent
dc5e6be490
commit
9bd22a2f57
|
@ -6,11 +6,3 @@
|
|||
|
||||
#define STAGE1_ADDR(x) (DIST(x) + STAGE1_BASE)
|
||||
#define STAGE2_ADDR(x) (DIST(x) + STAGE2_BASE)
|
||||
|
||||
#define STAGE1_START \
|
||||
_start: \
|
||||
ljmp $0, $STAGE1_ADDR(main)
|
||||
|
||||
#define STAGE2_START \
|
||||
_start: \
|
||||
ljmp $0, $STAGE2_ADDR(main)
|
||||
|
|
|
@ -26,9 +26,11 @@
|
|||
.code16
|
||||
.global _start
|
||||
.section .text
|
||||
STAGE1_START
|
||||
_start:
|
||||
ljmp $0, $STAGE1_ADDR(main)
|
||||
|
||||
disk: .byte 0
|
||||
hello: .string "Hello stage 1!\r\n"
|
||||
|
||||
main:
|
||||
cli
|
||||
|
@ -51,9 +53,28 @@ main:
|
|||
mov $STAGE2_BASE, %bx /* Address */
|
||||
int $0x13
|
||||
|
||||
mov $STAGE1_ADDR(hello), %si
|
||||
call print_str
|
||||
|
||||
ljmp $0, $STAGE2_BASE
|
||||
|
||||
hang:
|
||||
cli
|
||||
hlt
|
||||
jmp hang
|
||||
|
||||
do_ret:
|
||||
ret
|
||||
|
||||
print_char:
|
||||
mov $0x0E, %ah
|
||||
mov $0x0001, %bx
|
||||
int $0x10
|
||||
jmp do_ret
|
||||
|
||||
print_str:
|
||||
lodsb
|
||||
test %al, %al
|
||||
jz do_ret
|
||||
call print_char
|
||||
jmp print_str
|
||||
|
|
|
@ -26,17 +26,14 @@
|
|||
.code16
|
||||
.global _start
|
||||
.section .text
|
||||
STAGE2_START
|
||||
_start:
|
||||
ljmp $0, $STAGE2_ADDR(main)
|
||||
|
||||
hello: .string "Hello, World!\r\n"
|
||||
hello: .string "Hello stage 2!\r\n"
|
||||
|
||||
main:
|
||||
mov $STAGE2_ADDR(hello), %si
|
||||
call print_str
|
||||
mov $STAGE2_ADDR(hello), %si
|
||||
call print_str
|
||||
mov $STAGE2_ADDR(hello), %si
|
||||
call print_str
|
||||
|
||||
hang:
|
||||
cli
|
||||
|
|
Loading…
Reference in New Issue