1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-07 23:29:39 +00:00
cc65/libsrc/geos-common/conio/gotoxy.s
Oliver Schmidt 13482984ca Introduced internal gotoxy that pops both parameters.
About all CONIO functions offering a <...>xy variant call
  popa
  _gotoxy

By providing an internal gotoxy variant that starts with a popa all those CONIO function can be shortened by 3 bytes. As soon as program calls more than one CONIO function this means an overall code size reduction.
2016-06-05 14:58:38 +02:00

48 lines
855 B
ArmAsm

;
; Maciej 'YTM/Elysium' Witkowiak
;
; 27.10.2001
; 06.03.2002
; void gotox (unsigned char x);
; void gotoy (unsigned char y);
; void gotoxy (unsigned char x, unsigned char y);
.export _gotox, _gotoy, gotoxy, _gotoxy, fixcursor
.import popa
.importzp cursor_x, cursor_y, cursor_c, cursor_r
.include "jumptab.inc"
_gotox:
sta cursor_c
jmp fixcursor
_gotoy:
sta cursor_r
jmp fixcursor
gotoxy:
jsr popa
_gotoxy:
sta cursor_r
jsr popa
sta cursor_c
; convert 8x8 x/y coordinates to GEOS hires
fixcursor:
lda cursor_c
sta cursor_x
lda #0
sta cursor_x+1
ldx #cursor_x
ldy #3
jsr DShiftLeft
lda cursor_r
asl a
asl a
asl a
sta cursor_y
rts