Compare commits

..

3 Commits

Author SHA1 Message Date
288a89ad05 wip 2023-12-22 02:17:58 +01:00
1a5fc8cc1b fix skip io1 2023-12-22 02:17:53 +01:00
6c9a8bbc04 fix status updates 2023-12-22 02:17:36 +01:00
4 changed files with 57 additions and 60 deletions

View File

@ -65,7 +65,7 @@ irq:
@irq_io1: @irq_io1:
lda IO1 + IO::IFR lda IO1 + IO::IFR
sta irq_via_ifr sta irq_via_ifr
bbr7 irq_via_ifr,@irq_io1 ; skip bbr7 irq_via_ifr,@irq_io2 ; skip
bbs2 irq_via_ifr,@irq_kb1 ; shit reg -> first 8 bits bbs2 irq_via_ifr,@irq_kb1 ; shit reg -> first 8 bits
bbs5 irq_via_ifr,@irq_kb2 ; timer -> last 3 bits bbs5 irq_via_ifr,@irq_kb2 ; timer -> last 3 bits
@irq_io2: @irq_io2:
@ -82,7 +82,8 @@ irq:
lda #$ff lda #$ff
sta IO1 + IO::IFR sta IO1 + IO::IFR
sta IO2 + IO::IFR sta IO2 + IO::IFR
bra @irq_return rti
; bra @irq_return
@irq_keypad: @irq_keypad:
jsr kp::read_irq jsr kp::read_irq
bra @irq_return bra @irq_return
@ -90,11 +91,11 @@ irq:
jsr spi_p::read jsr spi_p::read
bra @irq_return bra @irq_return
@irq_kb1: @irq_kb1:
Print "$3000" PrintNC "<30>"
jsr $3000 jsr $3000
bra @irq_return bra @irq_return
@irq_kb2: @irq_kb2:
Print "$3100" PrintNC "<31>"
jsr $3100 jsr $3100
bra @irq_return bra @irq_return
; @irq_dht: ; @irq_dht:

View File

@ -32,16 +32,13 @@ status_str: .res 17 ; 16 + null
@check_byte: @check_byte:
lda spi_p::bytes_written lda spi_p::bytes_written
cmp trans_bytes cmp trans_bytes
bne @byte_written beq @read_keypad
@byte_written:
sta trans_bytes
@check_page: @check_page:
lda spi_p::pages_written lda spi_p::pages_written
cmp trans_pages cmp trans_pages
bne @page_written beq @read_keypad
bra @read_keypad
@byte_written:
sta trans_bytes
; bra @print_status
bra @read_keypad
@page_written: @page_written:
sta trans_pages sta trans_pages
bra @print_status bra @print_status

View File

@ -133,8 +133,8 @@ kbinit:
irq_on_shift_reg: irq_on_shift_reg:
lda #'{' ; lda #'{'
jsr lcd::print_char ; jsr lcd::print_char
lda kb::KB_IO + IO::SR lda kb::KB_IO + IO::SR
sta key_read sta key_read
stz kb::KB_IO + IO::SR stz kb::KB_IO + IO::SR
@ -147,7 +147,6 @@ irq_on_shift_reg:
sta kb::KB_IO + IO::IER sta kb::KB_IO + IO::IER
; start timer ; start timer
lda #1 lda #1
lda #$10 ; todo remove
sta kb::KB_IO + IO::T2CH sta kb::KB_IO + IO::T2CH
; lda #'}' ; lda #'}'
; jsr lcd::print_char ; jsr lcd::print_char
@ -184,31 +183,31 @@ irq_on_timer:
rol ; rotate carry into byte, rotate startbit into carry rol ; rotate carry into byte, rotate startbit into carry
; TODO byte is inverted, maybe consider wasting 256 bytes for a bit reverse lookup table? ; TODO byte is inverted, maybe consider wasting 256 bytes for a bit reverse lookup table?
sta keycode sta keycode
jsr lcd::print_char
stz key_read stz key_read
stz key_read+1 stz key_read+1
lda #'>' Strf "kc:%x", out_str, keycode
jsr lcd::print_char PrintNC out_str
rts rts
key_read: .res 2 key_read: .res 2
keycode: .res 1 keycode: .res 1
kb_irq1: kb_irq1:
lda #'!' ; lda #'!'
jsr lcd::print_char ; jsr lcd::print_char
jsr irq_on_shift_reg jsr irq_on_shift_reg
lda #':' ; lda #':'
jsr lcd::print_char ; jsr lcd::print_char
rts rts
.byte '=' .byte '='
kb_irq2: kb_irq2:
lda #'?' ; lda #'?'
jsr lcd::print_char ; jsr lcd::print_char
jsr irq_on_timer jsr irq_on_timer
lda #';' lda #';'
jsr lcd::print_char jsr lcd::print_char
rts rts
.byte '@' .byte '@'
out_str: .res 40

View File

@ -1,43 +1,43 @@
.include "irq_handler.h65" ; .include "irq_handler.h65"
.bss ; .bss
.code ; .code
.proc register_via_handler ; .proc register_via_handler
.endproc ; .endproc
.proc remove_via_handler ; .proc remove_via_handler
.endproc ; .endproc
.proc main_handler ; .proc main_handler
Print "Unknown IRQ" ; Print "Unknown IRQ"
rti ; rti
.endproc ; .endproc
.zeropage ; .zeropage
tmp: .res 1 ; tmp: .res 1
.macro VIAHandler via_addr, via_handlers_table ; .macro VIAHandler via_addr, via_handlers_table
lda via_addr + IO::IFR ; lda via_addr + IO::IFR
sta tmp ; sta tmp
bbr7 tmp,@rts ; irq ; bbr7 tmp,@rts ; irq
bbs0 tmp,@ca2 ; bbs0 tmp,@ca2
bbs1 tmp,@ca1 ; bbs1 tmp,@ca1
bbs2 tmp,@sr ; bbs2 tmp,@sr
bbs3 tmp,@cb2 ; bbs3 tmp,@cb2
bbs4 tmp,@cb1 ; bbs4 tmp,@cb1
bbs5 tmp,@t2 ; bbs5 tmp,@t2
bbs6 tmp,@t1 ; bbs6 tmp,@t1
; TODO error, one should have been true ; ; TODO error, one should have been true
stp ; stp
@rts: ; @rts:
rts ; rts
@ca2: jmp (via_handlers_table) ; @ca2: jmp (via_handlers_table)
@ca1: jmp (via_handlers_table+2) ; @ca1: jmp (via_handlers_table+2)
@sr: jmp (via_handlers_table+4) ; @sr: jmp (via_handlers_table+4)
@cb2: jmp (via_handlers_table+6) ; @cb2: jmp (via_handlers_table+6)
@cb1: jmp (via_handlers_table+8) ; @cb1: jmp (via_handlers_table+8)
@t2: jmp (via_handlers_table+10) ; @t2: jmp (via_handlers_table+10)
@t1: jmp (via_handlers_table+12) ; @t1: jmp (via_handlers_table+12)
.endmacro ; .endmacro