fix setline

This commit is contained in:
matthias@arch 2023-12-09 23:33:15 +01:00
parent 3c09810aa8
commit 151e57e9be

View File

@ -152,14 +152,33 @@ charcount: .res 1
;; @returns A: the cursor position ;; @returns A: the cursor position
;;******************************************************************************** ;;********************************************************************************
.proc set_position .proc set_position
cmp #$40
bge @invalid
sta charcount
pha 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 ora #lcd::CMD_SET_ADDRESS
jsr _cmd jsr _cmd
pla and #(<~lcd::CMD_SET_ADDRESS) ; return original argument
@rts:
rts rts
@invalid: @invalid:
lda $14 lda $14
@ -167,7 +186,7 @@ charcount: .res 1
lda #(lcd::CMD_SET_ADDRESS | (lcd::LINE2 + 4)) lda #(lcd::CMD_SET_ADDRESS | (lcd::LINE2 + 4))
jsr _cmd jsr _cmd
lda #(lcd::LINE2 + 4) lda #(lcd::LINE2 + 4)
bra @rts rts
.endproc .endproc