From 288a89ad0530abee1c0d6270db2edabde95ebe72 Mon Sep 17 00:00:00 2001 From: "matthias@arch" Date: Fri, 22 Dec 2023 02:17:58 +0100 Subject: [PATCH] wip --- spicode.s65 | 25 +++++++-------- system/irq_handler.s65 | 72 +++++++++++++++++++++--------------------- 2 files changed, 48 insertions(+), 49 deletions(-) diff --git a/spicode.s65 b/spicode.s65 index c759579..b43754c 100644 --- a/spicode.s65 +++ b/spicode.s65 @@ -133,8 +133,8 @@ kbinit: irq_on_shift_reg: - lda #'{' - jsr lcd::print_char + ; lda #'{' + ; jsr lcd::print_char lda kb::KB_IO + IO::SR sta key_read stz kb::KB_IO + IO::SR @@ -147,7 +147,6 @@ irq_on_shift_reg: sta kb::KB_IO + IO::IER ; start timer lda #1 - lda #$10 ; todo remove sta kb::KB_IO + IO::T2CH ; lda #'}' ; jsr lcd::print_char @@ -184,31 +183,31 @@ irq_on_timer: rol ; rotate carry into byte, rotate startbit into carry ; TODO byte is inverted, maybe consider wasting 256 bytes for a bit reverse lookup table? sta keycode - jsr lcd::print_char - stz key_read stz key_read+1 - lda #'>' - jsr lcd::print_char + Strf "kc:%x", out_str, keycode + PrintNC out_str rts key_read: .res 2 keycode: .res 1 kb_irq1: - lda #'!' - jsr lcd::print_char + ; lda #'!' + ; jsr lcd::print_char jsr irq_on_shift_reg - lda #':' - jsr lcd::print_char + ; lda #':' + ; jsr lcd::print_char rts .byte '=' kb_irq2: - lda #'?' - jsr lcd::print_char + ; lda #'?' + ; jsr lcd::print_char jsr irq_on_timer lda #';' jsr lcd::print_char rts .byte '@' +out_str: .res 40 + diff --git a/system/irq_handler.s65 b/system/irq_handler.s65 index 19d3831..005af9e 100644 --- a/system/irq_handler.s65 +++ b/system/irq_handler.s65 @@ -1,43 +1,43 @@ -.include "irq_handler.h65" -.bss +; .include "irq_handler.h65" +; .bss -.code +; .code -.proc register_via_handler -.endproc +; .proc register_via_handler +; .endproc -.proc remove_via_handler -.endproc +; .proc remove_via_handler +; .endproc -.proc main_handler - Print "Unknown IRQ" - rti -.endproc +; .proc main_handler +; Print "Unknown IRQ" +; rti +; .endproc -.zeropage -tmp: .res 1 +; .zeropage +; tmp: .res 1 -.macro VIAHandler via_addr, via_handlers_table - lda via_addr + IO::IFR - sta tmp - bbr7 tmp,@rts ; irq - bbs0 tmp,@ca2 - bbs1 tmp,@ca1 - bbs2 tmp,@sr - bbs3 tmp,@cb2 - bbs4 tmp,@cb1 - bbs5 tmp,@t2 - bbs6 tmp,@t1 - ; TODO error, one should have been true - stp -@rts: - rts -@ca2: jmp (via_handlers_table) -@ca1: jmp (via_handlers_table+2) -@sr: jmp (via_handlers_table+4) -@cb2: jmp (via_handlers_table+6) -@cb1: jmp (via_handlers_table+8) -@t2: jmp (via_handlers_table+10) -@t1: jmp (via_handlers_table+12) -.endmacro +; .macro VIAHandler via_addr, via_handlers_table +; lda via_addr + IO::IFR +; sta tmp +; bbr7 tmp,@rts ; irq +; bbs0 tmp,@ca2 +; bbs1 tmp,@ca1 +; bbs2 tmp,@sr +; bbs3 tmp,@cb2 +; bbs4 tmp,@cb1 +; bbs5 tmp,@t2 +; bbs6 tmp,@t1 +; ; TODO error, one should have been true +; stp +; @rts: +; rts +; @ca2: jmp (via_handlers_table) +; @ca1: jmp (via_handlers_table+2) +; @sr: jmp (via_handlers_table+4) +; @cb2: jmp (via_handlers_table+6) +; @cb1: jmp (via_handlers_table+8) +; @t2: jmp (via_handlers_table+10) +; @t1: jmp (via_handlers_table+12) +; .endmacro