Print to COM1 port
This commit is contained in:
parent
1015d79280
commit
f157f82657
1 changed files with 26 additions and 1 deletions
27
lboot.S
27
lboot.S
|
|
@ -11,6 +11,8 @@ _start: cli
|
||||||
xor %ax, %ax
|
xor %ax, %ax
|
||||||
mov %ax, %ds
|
mov %ax, %ds
|
||||||
|
|
||||||
|
call init_com1
|
||||||
|
|
||||||
mov $msg_start, %si
|
mov $msg_start, %si
|
||||||
call print
|
call print
|
||||||
|
|
||||||
|
|
@ -27,6 +29,20 @@ _start: cli
|
||||||
1: hlt
|
1: hlt
|
||||||
jmp 1b
|
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
|
enable_a20: // TODO more thorough implementation
|
||||||
inb $0x92, %al
|
inb $0x92, %al
|
||||||
or $2, %al
|
or $2, %al
|
||||||
|
|
@ -53,9 +69,18 @@ unreal: push %ds
|
||||||
|
|
||||||
print: xor %bx, %bx
|
print: xor %bx, %bx
|
||||||
|
|
||||||
1: lodsb
|
1: mov $COM1+5, %dx
|
||||||
|
inb %dx, %al
|
||||||
|
test $0x20, %al
|
||||||
|
jz 1b
|
||||||
|
|
||||||
|
lodsb
|
||||||
or %al, %al
|
or %al, %al
|
||||||
jz 2f
|
jz 2f
|
||||||
|
|
||||||
|
mov $COM1, %dx
|
||||||
|
outb %al, %dx
|
||||||
|
|
||||||
mov $0x0E, %ah
|
mov $0x0E, %ah
|
||||||
int $0x10
|
int $0x10
|
||||||
jmp 1b
|
jmp 1b
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue