Basic BIOS-based print function
This commit is contained in:
parent
793fbcd03c
commit
5fee8cbbcf
1 changed files with 30 additions and 5 deletions
35
boot16.S
35
boot16.S
|
|
@ -1,14 +1,39 @@
|
||||||
// vim: et:sw=12:ts=12:sts=12
|
// vim: et:sw=12:ts=12:sts=12
|
||||||
|
|
||||||
.code16
|
|
||||||
.global _start
|
.global _start
|
||||||
.text
|
.text
|
||||||
|
.code16
|
||||||
|
|
||||||
_start:
|
_start:
|
||||||
xor %bx, %bx
|
mov %cs, %ax
|
||||||
mov $0x0E, %ah
|
mov %ax, %ds
|
||||||
mov $'A', %al
|
|
||||||
int $0x10
|
push $message
|
||||||
|
call print
|
||||||
|
add $2, %sp
|
||||||
|
|
||||||
1: hlt
|
1: hlt
|
||||||
jmp 1b
|
jmp 1b
|
||||||
|
|
||||||
|
print: push %bp
|
||||||
|
mov %sp, %bp
|
||||||
|
push %bx
|
||||||
|
push %si
|
||||||
|
|
||||||
|
xor %bx, %bx
|
||||||
|
mov 4(%bp), %si
|
||||||
|
|
||||||
|
1: lodsb
|
||||||
|
or %al, %al
|
||||||
|
jz 2f
|
||||||
|
mov $0x0E, %ah
|
||||||
|
int $0x10
|
||||||
|
jmp 1b
|
||||||
|
|
||||||
|
2: pop %si
|
||||||
|
pop %bx
|
||||||
|
mov %bp, %sp
|
||||||
|
pop %bp
|
||||||
|
ret
|
||||||
|
|
||||||
|
message: .asciz "Hello, World!"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue