use masked writes for RA

This commit is contained in:
matthias@arch 2023-12-31 01:56:42 +01:00
parent de098dd9c6
commit b65a0249a5

View File

@ -22,9 +22,9 @@ charcount: .res 1
lda #$ff ; RB 0-7 output
sta lcd::LCD_IO+IO::DDRB
MaskedWrite lcd::LCD_IO+IO::DDRA, #(lcd::RS | lcd::RW | lcd::E), #lcd::RA_MASK
; lda #(lcd::RS | lcd::RW | lcd::E) ; RA 5-7 output
; sta lcd::LCD_IO+IO::DDRA
lda lcd::LCD_IO+IO::DDRA
ora #(lcd::RS | lcd::RW | lcd::E)
sta lcd::LCD_IO+IO::DDRA
; init lcd
lda #lcd::CMD_FUNCTION_SET
@ -176,19 +176,24 @@ charcount: .res 1
.proc _wait_nbusy
pha
stz lcd::LCD_IO + IO::DDRB ; set IO1-IO + IO::RB to input
@lcd_wait_nbusy_loop: ; read the busy flag
; TODO use update_with_mask
lda #lcd::RW
lda lcd::LCD_IO + IO::RA
and #<~lcd::RA_MASK
ora #lcd::RW
sta lcd::LCD_IO + IO::RA
lda #(lcd::RW | lcd::E)
@lcd_wait_nbusy_loop: ; read the busy flag
; set E low, then high
lda lcd::LCD_IO + IO::RA
and #<~lcd::E
sta lcd::LCD_IO + IO::RA
ora #lcd::E
sta lcd::LCD_IO + IO::RA
lda lcd::LCD_IO + IO::RB
bmi @lcd_wait_nbusy_loop ; msb set
; and #%10000000 ; and updates zero flag, if not set retry
; bne @lcd_wait_nbusy_loop
lda #%00000000 ; TODO dont overwrite 0-4
lda lcd::LCD_IO + IO::RA
and #<~lcd::RA_MASK
sta lcd::LCD_IO + IO::RA
lda #%11111111 ; set IO1-IO + IO::RB to output
sta lcd::LCD_IO + IO::DDRB