From 151e57e9bed8e61e4c287f017558688f11eb5b73 Mon Sep 17 00:00:00 2001 From: "matthias@arch" Date: Sat, 9 Dec 2023 23:33:15 +0100 Subject: [PATCH] fix setline --- system/lcd.s65 | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/system/lcd.s65 b/system/lcd.s65 index b6a63b5..90015df 100644 --- a/system/lcd.s65 +++ b/system/lcd.s65 @@ -152,14 +152,33 @@ charcount: .res 1 ;; @returns A: the cursor position ;;******************************************************************************** .proc set_position - cmp #$40 - bge @invalid - sta charcount pha + cmp #$60 + bge @invalid + cmp #$50 + bge @line4 + cmp #$40 + bge @line2 + cmp #$20 + bge @invalid + cmp #$10 + bge @line3 + bra @set +; @line1: ; starts at $00, charcount at $00 +@line2: ; starts at $40, charcount at $10 + sbc #$30 ; carry is already set + bra @set +@line3: ; starts at $10, charcount at $20 + add #$10 + bra @set +@line4: ; starts at $50, charcount at $30 + sbc #$20 +@set: + sta charcount + pla ora #lcd::CMD_SET_ADDRESS jsr _cmd - pla -@rts: + and #(<~lcd::CMD_SET_ADDRESS) ; return original argument rts @invalid: lda $14 @@ -167,7 +186,7 @@ charcount: .res 1 lda #(lcd::CMD_SET_ADDRESS | (lcd::LINE2 + 4)) jsr _cmd lda #(lcd::LINE2 + 4) - bra @rts + rts .endproc