1
0
mirror of https://github.com/cc65/cc65.git synced 2024-11-19 06:31:31 +00:00
cc65/libsrc/telestrat/gotoxy.s

61 lines
1.3 KiB
ArmAsm
Raw Normal View History

;
; 2017-02-25, jede <jede@oric.org>
; 2017-06-15, Greg King
;
; void gotoxy (unsigned char x, unsigned char y);
;
2019-07-07 20:02:48 +00:00
.export gotoxy, _gotoxy, update_adscr
2019-07-06 08:16:57 +00:00
2019-07-17 19:48:53 +00:00
.import popa, OLD_CHARCOLOR, OLD_BGCOLOR
2017-02-25 20:32:06 +00:00
.include "telestrat.inc"
gotoxy: jsr popa ; Get Y
2017-02-25 20:32:06 +00:00
.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.
2019-07-10 19:44:07 +00:00
2019-07-17 19:48:53 +00:00
sta SCRY
2019-07-17 20:53:49 +00:00
2019-07-10 19:44:07 +00:00
2019-07-17 19:48:53 +00:00
jsr popa
sta SCRX
; Update adress video ram position when SCRY is modified (update_adscr)
; Fall through
2019-07-17 19:48:53 +00:00
.endproc
2019-07-17 19:48:53 +00:00
.proc update_adscr
; Force to set again color if cursor moves
; $FF is used because we know that it's impossible to have this value with a color
; It prevents a bug : If bgcolor or textcolor is set to black for example with no char displays,
; next cputsxy will not set the attribute if y coordinate changes
lda #$FF
sta OLD_CHARCOLOR
sta OLD_BGCOLOR
lda #<SCREEN
sta ADSCRL
lda #>SCREEN
sta ADSCRH
ldy SCRY
beq out
loop:
2019-07-17 19:48:53 +00:00
lda ADSCRL
clc
adc #SCREEN_XSIZE
2019-07-17 19:48:53 +00:00
bcc skip
inc ADSCRH
skip:
2019-07-17 19:48:53 +00:00
sta ADSCRL
dey
bne loop
2019-07-06 08:16:57 +00:00
out:
2019-07-17 19:48:53 +00:00
rts
2019-07-07 20:02:48 +00:00
.endproc