1
0
mirror of https://github.com/cc65/cc65.git synced 2024-11-04 17:04:58 +00:00
cc65/libsrc/telestrat/gotoxy.s
2019-07-21 14:11:51 -04:00

55 lines
1.2 KiB
ArmAsm

;
; 2017-02-25, jede <jede@oric.org>
; 2017-06-15, Greg King
;
; void gotoxy (unsigned char x, unsigned char y);
;
.export gotoxy, _gotoxy, _update_adscr
.import popa,CHARCOLOR_CHANGE,BGCOLOR_CHANGE
.include "telestrat.inc"
gotoxy: jsr popa ; Get Y
.proc _gotoxy
; This function moves only the display cursor; it does not move the prompt position.
; In telemon, there is a position for the prompt, and another for the cursor.
sta SCRY
jsr popa
sta SCRX
jsr _update_adscr ; Update adress video ram position when SCRY et SCRX are modified
; Force to put again attribute when it moves on the screen
lda #$01
sta CHARCOLOR_CHANGE
sta BGCOLOR_CHANGE
rts
.endproc
.proc _update_adscr
lda #<SCREEN
sta ADSCRL
lda #>SCREEN
sta ADSCRL+1
ldy SCRY
beq out
loop:
lda ADSCRL
clc
adc #$28
bcc skip
inc ADSCRH
skip:
sta ADSCRL
dey
bne loop
out:
rts
.endproc