rename home

This commit is contained in:
matthias@arch 2023-12-08 00:02:22 +01:00
parent c85d849ee3
commit 81feb2306c
2 changed files with 62 additions and 37 deletions

View File

@ -2,6 +2,7 @@
.code .code
.macro DEBUG_LED_OFF nr .macro DEBUG_LED_OFF nr
pha
lda IO1 + IO::RA lda IO1 + IO::RA
.if nr = 0 .if nr = 0
and #%11111110 and #%11111110
@ -9,9 +10,11 @@
and #%11111101 and #%11111101
.endif .endif
sta IO1 + IO::RA sta IO1 + IO::RA
pla
.endmacro .endmacro
.macro DEBUG_LED_ON nr .macro DEBUG_LED_ON nr
pha
lda IO1 + IO::RA lda IO1 + IO::RA
.if nr = 0 .if nr = 0
ora #%00000001 ora #%00000001
@ -19,6 +22,7 @@
ora #%00000010 ora #%00000010
.endif .endif
sta IO1 + IO::RA sta IO1 + IO::RA
pla
.endmacro .endmacro
;******************************************************************************** ;********************************************************************************
@ -37,6 +41,7 @@ SPI_IO = IO2
; Printer ; Printer
.include "programs/printer.s65" .include "programs/printer.s65"
.include "programs/print_slow.s65" .include "programs/print_slow.s65"
.include "programs/spi-menu.s65"
; Digital Humidity and Temerature Sensor ; Digital Humidity and Temerature Sensor
; .include "dht.s65" ; .include "dht.s65"
@ -61,8 +66,8 @@ irq:
lda IO2+IO::IFR lda IO2+IO::IFR
sta IRQ_VAR sta IRQ_VAR
bbr7 IRQ_VAR,@irq_return bbr7 IRQ_VAR,@irq_return
bbs1 IRQ_VAR,@irq_keypad ; check CB1
bbs2 IRQ_VAR,@irq_spi_p ; check SR bbs2 IRQ_VAR,@irq_spi_p ; check SR
bbs1 IRQ_VAR,@irq_keypad ; check CA1
; this should never be reached ; this should never be reached
jsr lcd_clear jsr lcd_clear
Print str_irq_unknown Print str_irq_unknown
@ -75,7 +80,7 @@ irq:
jsr kp_read_on_irq jsr kp_read_on_irq
bra @irq_return bra @irq_return
@irq_spi_p: @irq_spi_p:
jsr spi_p_read jsr spi_p::read
bra @irq_return bra @irq_return
; @irq_dht: ; @irq_dht:
; lda IO1 + IO::T1CL ;T1L2 ; clear interrupt flag ; lda IO1 + IO::T1CL ;T1L2 ; clear interrupt flag
@ -89,14 +94,15 @@ irq:
reset: reset:
jsr lcd_init jsr lcd_init
; TODO debug stuff
stz IO2 + IO::DDRB
lda #$ff lda #$ff
sta IO1 + IO::DDRA sta IO1 + IO::DDRA
DEBUG_LED_OFF 0 DEBUG_LED_OFF 0
DEBUG_LED_OFF 1 DEBUG_LED_OFF 1
jsr kp_init
jsr spi_p_init jsr kp_init
; ; INIT DHT ; ; INIT DHT
@ -112,48 +118,61 @@ reset:
; enable interrupts ; enable interrupts
cli cli
bra home
.proc return_home
Print message_menu
.endproc
.proc home .proc home
jsr rb_keypad_read Print message_menu
beq home ; jsr rb_keypad_read
@loop:
lda _KP_DEBUG_VAL
beq @loop
; TODO debug
sta 0
stz _KP_DEBUG_VAL
lda 0
; beq home ; beq home
cmp #'A' cmp #'A'
jeq printer jeq printer
cmp #'B' cmp #'B'
jeq SPI_CODE_START jeq spi_menu::spi_menu
; jeq dht_request
cmp #'C' cmp #'C'
jeq print_1 jeq print_1
cmp #'D' cmp #'D'
jeq print_2 jeq print_2
cmp #'0' cmp #'1'
bne @l1 beq @debug0_on
DEBUG_LED_OFF 0 cmp #'2'
jmp home beq @debug0_off
@l1: cmp #'4'
cmp #'#' beq @debug1_on
bne @l2 cmp #'5'
DEBUG_LED_ON 0 beq @debug1_off
jmp home cmp #'7'
@l2: beq @print_rb
cmp #'8'
bne @l3
DEBUG_LED_OFF 1
jmp home
@l3:
cmp #'9'
bne @l4
DEBUG_LED_ON 1
jmp home
@l4:
cmp #'*' ; print home menu again if not visible (message 1 and 2 jmp to home) cmp #'*' ; print home menu again if not visible (message 1 and 2 jmp to home)
jeq return_home beq home
jmp @loop
jmp home @debug0_off:
DEBUG_LED_OFF 0
jmp @loop
@debug0_on:
DEBUG_LED_ON 0
jmp @loop
@debug1_off:
DEBUG_LED_OFF 1
jmp @loop
@debug1_on:
DEBUG_LED_ON 1
jmp @loop
@print_rb:
jsr lcd_clear
Print str_io2
lda IO2 + IO::RB
jsr lcd_char
lda #'''
jsr lcd_char
jmp @loop
.endproc .endproc
@ -181,13 +200,19 @@ message_2:
message_menu: message_menu:
.byte "<A> Printer " .byte "<A> Printer "
; .byte "<B> Temperatur " ; .byte "<B> Temperatur "
.byte "<B> Run from SPI" .byte "<B> SPI-Menu "
.byte "<C> Text 1 " .byte "<C> Text 1 "
.asciiz "<D> Text 2 " .asciiz "<D> Text 2 "
str_spi_begin:
.asciiz "---BEGIN SPI---"
str_spi_start:
.asciiz "---START SPI---"
str_irq: str_irq:
.asciiz "IRQ detected! " .asciiz "IRQ detected! "
str_irq_unknown: str_irq_unknown:
.asciiz "Unknown IRQ src!" .asciiz "Unknown IRQ src!"
str_io2:
.asciiz "IO2::RB='"
;******************************************************************************** ;********************************************************************************
; reset vector ; reset vector

View File

@ -10,7 +10,7 @@ printer:
jsr rb_keypad_read jsr rb_keypad_read
beq @printer_loop beq @printer_loop
cmp #'*' cmp #'*'
jeq return_home jeq home
jsr lcd_char jsr lcd_char
bra @printer_loop bra @printer_loop
.endif ; guard .endif ; guard