Both stages print hello

This commit is contained in:
Alex Kotov 2022-01-27 04:16:14 +05:00
parent dc5e6be490
commit 9bd22a2f57
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
3 changed files with 25 additions and 15 deletions

View File

@ -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)

View File

@ -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

View File

@ -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