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