Print to COM1 port

This commit is contained in:
Thomas Oltmann 2025-07-04 16:17:38 +02:00
parent 1015d79280
commit f157f82657

27
lboot.S
View file

@ -11,6 +11,8 @@ _start: cli
xor %ax, %ax
mov %ax, %ds
call init_com1
mov $msg_start, %si
call print
@ -27,6 +29,20 @@ _start: cli
1: hlt
jmp 1b
.set COM1, 0x3F8
.macro com1_write offset=0, byte
mov $COM1+\offset, %dx
mov $\byte, %al
outb %al, %dx
.endm
init_com1: com1_write 1, 0x00 // clear interrupts
com1_write 3, 0x80 // set DLAB to 1
com1_write 0, 0x0C // 9600 baud rate
com1_write 1, 0x00
com1_write 3, 0x07 // 8 bit data + 1 parity bit
ret
enable_a20: // TODO more thorough implementation
inb $0x92, %al
or $2, %al
@ -53,9 +69,18 @@ unreal: push %ds
print: xor %bx, %bx
1: lodsb
1: mov $COM1+5, %dx
inb %dx, %al
test $0x20, %al
jz 1b
lodsb
or %al, %al
jz 2f
mov $COM1, %dx
outb %al, %dx
mov $0x0E, %ah
int $0x10
jmp 1b