Fix more bugs
This commit is contained in:
@@ -85,7 +85,7 @@ L1: rts
|
||||
ldy #$00 ; initialize y to 0
|
||||
L1: lda (ptr1),y ; load character from string
|
||||
beq L2 ; Quit if NULL
|
||||
jsr _uart_txb_block ; send character (does not change y or ptr1)
|
||||
jsr _serial_putc ; send character (does not change y or ptr1)
|
||||
iny ; increment y
|
||||
bne L1 ; If Y == 0, increment high byte of pointer
|
||||
inc ptr1+1
|
||||
|
||||
@@ -23,7 +23,7 @@ terminal_buf: .res 128
|
||||
.proc _terminal_read
|
||||
cmp #$00 ; Check that nbytes is > 0 and < 128
|
||||
beq FAIL
|
||||
cmp #$80
|
||||
cmp #$81
|
||||
bge FAIL
|
||||
sta tmp1 ; Store nbytes in tmp1
|
||||
|
||||
@@ -44,8 +44,9 @@ LOOP: cpy tmp1
|
||||
jsr _serial_getc
|
||||
sta terminal_buf,y
|
||||
|
||||
cmp #$0a ; If newline, do something
|
||||
cmp #$0d ; If newline, do something
|
||||
bne L2
|
||||
lda #$0a ; hacky serial, we want $0a, not $0d
|
||||
jsr _serial_putc
|
||||
bra END
|
||||
|
||||
@@ -61,7 +62,7 @@ L2: cmp #$08 ; Handle backspace
|
||||
bra LOOP
|
||||
|
||||
L3: lda terminal_buf,y ; Normal character
|
||||
sta (tmp1),y
|
||||
sta (ptr1),y
|
||||
jsr _serial_putc
|
||||
iny
|
||||
bra LOOP
|
||||
|
||||
@@ -20,26 +20,25 @@ void handle_rtc_interrupt() {
|
||||
char buf[128];
|
||||
|
||||
int main() {
|
||||
|
||||
cputs("Kernel\n");
|
||||
|
||||
cputs("Init Mapper\n");
|
||||
// cputs("Init Mapper\n");
|
||||
init_mapper();
|
||||
|
||||
cputs("Initialize Interrupts\n");
|
||||
// cputs("Initialize Interrupts\n");
|
||||
init_interrupts();
|
||||
|
||||
cputs("Initialize Interrupt Controller\n");
|
||||
// cputs("Initialize Interrupt Controller\n");
|
||||
init_interrupt_controller();
|
||||
|
||||
cputs("Initialize RTC\n");
|
||||
// cputs("Initialize RTC\n");
|
||||
init_rtc();
|
||||
|
||||
register_irq(&handle_rtc_interrupt, 0);
|
||||
|
||||
asm volatile("cli");
|
||||
|
||||
cputs("Initialize Serial\n");
|
||||
// cputs("Initialize Serial\n");
|
||||
serial_init();
|
||||
|
||||
serial_puts("Hello from serial!\n");
|
||||
@@ -48,9 +47,13 @@ int main() {
|
||||
terminal_write(0, "Terminal Write\n", 15);
|
||||
|
||||
while(1) {
|
||||
terminal_read(0, buf, 128);
|
||||
if (terminal_read(0, buf, 128)) {
|
||||
cprintf("Fail\n");
|
||||
break;
|
||||
}
|
||||
terminal_write(0, "Got: ", 5);
|
||||
terminal_write(0, buf, strlen(buf));
|
||||
terminal_write(0, "\n", 1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user