Serial Fix

Fixes a typo with getc_nb, removes the RTC tick code (since we know it
works now and it is clogging up the screen), read characters in a loop
instead of just once.
This commit is contained in:
Byron Lathi
2023-11-28 23:23:31 -08:00
parent fd9ccdbce4
commit e73d8db74c
2 changed files with 10 additions and 10 deletions

View File

@@ -9,7 +9,7 @@
.export _serial_init
.export _serial_handle_irq
.export _serial_putc, _serial_puts, _serial_getc, _serial_get_nb
.export _serial_putc, _serial_puts, _serial_getc, _serial_getc_nb
.zeropage
@@ -39,8 +39,8 @@ UART_STATUS = UART + 1
; Get the character and store it.
.proc _serial_handle_irq
lda UART_RXB
sta last_char
ora #$80 ; set msb
sta last_char
jsr _send_eoi
rti
.endproc
@@ -58,7 +58,7 @@ L1: lda last_char
; Serial Port Get Character Non-Blocking
; return last character, even if it has already been read.
; If the character is new, we still clear the new flag.
.proc _serial_get_nb
.proc _serial_getc_nb
lda last_char
bpl L1
and #$7f

View File

@@ -8,7 +8,7 @@
void handle_rtc_interrupt() {
// cputs("In IRQ interrupt!\n");
cputc('A');
// cputc('A');
send_eoi();
asm volatile ("rti");
}
@@ -40,12 +40,12 @@ int main() {
serial_puts("Hello from serial!\n");
c = serial_getc();
serial_puts("Got a character!: ");
serial_putc(c);
while(1);
while(1) {
c = serial_getc();
serial_puts("Got a character!: ");
serial_putc(c);
serial_putc('\n');
}
return 0;
}