serial ports, echo vga output over COM2

This commit is contained in:
Benji Dial 2019-12-26 14:04:41 -05:00
parent 336cfa313d
commit ef72082b2d
3 changed files with 66 additions and 10 deletions

View file

@ -18,12 +18,71 @@
global send_byte
global read_byte
section .text
;COM1: COM2: COM3: COM4:
;0x03f8, 0x02f8, 0x03e8, 0x02e8
send_byte:;void send_byte(uint8_t value, uint8_t port)
;TODO
push ebp
mov ebp, esp
mov cl, byte [ebp + 8] ;value
xor edx, edx
mov dl, byte [ebp + 12];port
test dl, 0xfc
jnz .leave
xchg ebx, edx
shl bl, 1
mov ax, word [ebx + com_ports]
mov ebx, edx
mov dx, ax
or dx, 5
.check_ready:
in al, dx
test al, 0x20
jz .check_ready
and dx, 0xfff8
mov al, cl
out dx, al
.leave:
leave
ret
read_byte:;uint8_t read_byte(uint8_t port)
;TODO
push ebp
mov ebp, esp
xor eax, eax
xor edx, edx
mov dl, byte [ebp + 8];port
test dl, 0xfc
jnz .leave
xchg ebx, edx
shl bl, 1
mov cx, word [ebx + com_ports]
mov ebx, edx
mov dx, cx
or dx, 5
.check_ready:
in al, dx
test al, 0x01
jz .check_ready
and dx, 0xfff8
in al, dx
.leave:
leave
ret
section .rodata
com_ports dw 0x03f8, 0x02f8, 0x03e8, 0x02e8

View file

@ -29,10 +29,7 @@ enum serials {
COM4 = 3
};
/*
Commenting out so I don't accidentally call garbage while these are unimplemented.
void send_byte(uint8_t value, uint8_t port);
uint8_t read_byte(uint8_t port);
*/
#endif

View file

@ -43,7 +43,7 @@ void scroll(void) {
}
void put_char(uint8_t ch) {
//send_byte(ch, COM2);
send_byte(ch, COM2);
switch (ch) {
case '\b':
if (cursor_pos)