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.
This commit is contained in:
Oliver Schmidt 2016-06-05 14:58:38 +02:00
parent d670998814
commit 13482984ca
50 changed files with 120 additions and 152 deletions

View File

@ -6,12 +6,11 @@
;
.export _cclearxy, _cclear
.import popa, _gotoxy, chlinedirect
.import gotoxy, chlinedirect
_cclearxy:
pha ; Save the length
jsr popa ; Get y
jsr _gotoxy ; Call this one, will pop params
jsr gotoxy ; Call this one, will pop params
pla ; Restore the length and run into _cclear
_cclear:

View File

@ -6,15 +6,14 @@
;
.export _chlinexy, _chline, chlinedirect
.import popa, _gotoxy, cputdirect
.import gotoxy, cputdirect
.include "zeropage.inc"
.include "apple2.inc"
_chlinexy:
pha ; Save the length
jsr popa ; Get y
jsr _gotoxy ; Call this one, will pop params
jsr gotoxy ; Call this one, will pop params
pla ; Restore the length and run into _chline
_chline:

View File

@ -10,7 +10,7 @@
.endif
.export _cputcxy, _cputc
.export cputdirect, newline, putchar
.import popa, _gotoxy, VTABZ
.import gotoxy, VTABZ
.include "apple2.inc"
@ -29,9 +29,8 @@ initconio:
_cputcxy:
pha ; Save C
jsr popa ; Get Y
jsr _gotoxy
pla ; Restore C
jsr gotoxy ; Call this one, will pop params
pla ; Restore C and run into _cputc
_cputc:
cmp #$0D ; Test for \r = carrage return

View File

@ -6,14 +6,13 @@
;
.export _cvlinexy, _cvline, cvlinedirect
.import popa, _gotoxy, putchar, newline
.import gotoxy, putchar, newline
.include "zeropage.inc"
_cvlinexy:
pha ; Save the length
jsr popa ; Get y
jsr _gotoxy ; Call this one, will pop params
jsr gotoxy ; Call this one, will pop params
pla ; Restore the length and run into _cvline
_cvline:

View File

@ -5,11 +5,14 @@
; void __fastcall__ gotox (unsigned char x);
;
.export _gotoxy, _gotox
.export gotoxy, _gotoxy, _gotox
.import popa, VTABZ
.include "apple2.inc"
gotoxy:
jsr popa ; Get Y
_gotoxy:
clc
adc WNDTOP

View File

@ -6,13 +6,12 @@
;
.export _cclearxy, _cclear
.import popa, _gotoxy, cputdirect
.import gotoxy, cputdirect
.importzp tmp1
_cclearxy:
pha ; Save the length
jsr popa ; Get y
jsr _gotoxy ; Call this one, will pop params
jsr gotoxy ; Call this one, will pop params
pla ; Restore the length and run into _cclear
_cclear:

View File

@ -6,7 +6,7 @@
;
.export _chlinexy, _chline
.import popa, _gotoxy, cputdirect, setcursor
.import gotoxy, cputdirect, setcursor
.importzp tmp1
.ifdef __ATARI5200__
@ -17,8 +17,7 @@ CHRCODE = $12+64
_chlinexy:
pha ; Save the length
jsr popa ; Get y
jsr _gotoxy ; Call this one, will pop params
jsr gotoxy ; Call this one, will pop params
pla ; Restore the length
_chline:

View File

@ -7,7 +7,7 @@
.export _cputcxy, _cputc
.export plot, cputdirect, putchar
.import popa, _gotoxy, mul40
.import gotoxy, mul40
.importzp tmp4,ptr4
.import _revflag,setcursor
@ -15,8 +15,7 @@
_cputcxy:
pha ; Save C
jsr popa ; Get Y
jsr _gotoxy ; Set cursor, drop x
jsr gotoxy ; Set cursor, drop x and y
pla ; Restore C
_cputc:

View File

@ -7,7 +7,7 @@
.include "atari.inc"
.export _cvlinexy, _cvline
.import popa, _gotoxy, putchar, setcursor
.import gotoxy, putchar, setcursor
.importzp tmp1
.ifdef __ATARI5200__
@ -18,8 +18,7 @@ CHRCODE = $7C ; Vertical bar
_cvlinexy:
pha ; Save the length
jsr popa ; Get y
jsr _gotoxy ; Call this one, will pop params
jsr gotoxy ; Call this one, will pop params
pla ; Restore the length and run into _cvline
_cvline:

View File

@ -6,14 +6,17 @@
.include "atari.inc"
.export _gotoxy
.export gotoxy, _gotoxy
.import popa
.import setcursor
gotoxy:
jsr popa ; Get Y
_gotoxy: ; Set the cursor position
sta ROWCRS ; Set Y
jsr popa ; Get X
sta COLCRS ; Set X
lda #0
sta COLCRS+1 ;
sta COLCRS+1
jmp setcursor

View File

@ -10,7 +10,7 @@
.export _cputcxy, _cputc
.export plot, cputdirect, putchar
.import popa, _gotoxy, mul20
.import gotoxy, mul20
.importzp ptr4
.import setcursor
@ -21,8 +21,7 @@ screen_setup = screen_setup_20x24
_cputcxy:
pha ; Save C
jsr popa ; Get Y
jsr _gotoxy ; Set cursor, drop x
jsr gotoxy ; Set cursor, drop x and y
pla ; Restore C
_cputc:

View File

@ -6,10 +6,13 @@
.include "atari5200.inc"
.export _gotoxy
.export gotoxy, _gotoxy
.import popa
.import setcursor
gotoxy:
jsr popa ; Get Y
_gotoxy: ; Set the cursor position
sta ROWCRS_5200 ; Set Y
jsr popa ; Get X

View File

@ -8,7 +8,7 @@
.export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot
.import popa, _gotoxy
.import gotoxy
.import PLOT
.include "c128.inc"
@ -21,8 +21,7 @@ newline = NEWLINE
_cputcxy:
pha ; Save C
jsr popa ; Get Y
jsr _gotoxy ; Set cursor, drop x
jsr gotoxy ; Set cursor, drop x and y
pla ; Restore C
; Plot a character - also used as internal function

View File

@ -7,7 +7,7 @@
.export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot
.import popa, _gotoxy
.import gotoxy
.import PLOT
.include "plus4.inc"
@ -15,8 +15,7 @@
_cputcxy:
pha ; Save C
jsr popa ; Get Y
jsr _gotoxy ; Set cursor, drop x
jsr gotoxy ; Set cursor, drop x and y
pla ; Restore C
; Plot a character - also used as internal function

View File

@ -7,7 +7,7 @@
.export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot
.import popa, _gotoxy
.import gotoxy
.import PLOT
.include "c64.inc"
@ -15,8 +15,7 @@
_cputcxy:
pha ; Save C
jsr popa ; Get Y
jsr _gotoxy ; Set cursor, drop x
jsr gotoxy ; Set cursor, drop x and y
pla ; Restore C
; Plot a character - also used as internal function

View File

@ -12,7 +12,7 @@
.export soft80_newline, soft80_plot
.export soft80_checkchar
.import popa, _gotoxy
.import gotoxy
.import soft80_kplot
.import soft80_internal_bgcolor, soft80_internal_cellcolor
@ -25,8 +25,7 @@
soft80_cputcxy:
pha ; Save C
jsr popa ; Get Y
jsr _gotoxy ; Set cursor, drop x
jsr gotoxy ; Set cursor, drop x and y
pla ; Restore C
; Plot a character - also used as internal function

View File

@ -11,7 +11,7 @@
.export soft80mono_cputdirect, soft80mono_putchar
.export soft80mono_newline, soft80mono_plot
.import popa, _gotoxy
.import gotoxy
.import soft80mono_kplot
.import soft80mono_internal_bgcolor, soft80mono_internal_cellcolor
@ -24,8 +24,7 @@
soft80mono_cputcxy:
pha ; Save C
jsr popa ; Get Y
jsr _gotoxy ; Set cursor, drop x
jsr gotoxy ; Set cursor, drop x and y
pla ; Restore C
; Plot a character - also used as internal function

View File

@ -6,13 +6,12 @@
;
.export _cclearxy, _cclear
.import popa, _gotoxy, cputdirect
.import gotoxy, cputdirect
.importzp tmp1
_cclearxy:
pha ; Save the length
jsr popa ; Get y
jsr _gotoxy ; Call this one, will pop params
jsr gotoxy ; Call this one, will pop params
pla ; Restore the length and run into _cclear
_cclear:
@ -24,7 +23,3 @@ L1: lda #$20 ; Blank - screen code
dec tmp1
bne L1
L9: rts

View File

@ -6,13 +6,12 @@
;
.export _chlinexy, _chline
.import popa, _gotoxy, cputdirect
.import gotoxy, cputdirect
.importzp tmp1, chlinechar
_chlinexy:
pha ; Save the length
jsr popa ; Get y
jsr _gotoxy ; Call this one, will pop params
jsr gotoxy ; Call this one, will pop params
pla ; Restore the length
_chline:
@ -24,7 +23,3 @@ L1: lda #chlinechar ; Horizontal line, screen code
dec tmp1
bne L1
L9: rts

View File

@ -6,13 +6,12 @@
;
.export _cvlinexy, _cvline
.import popa, _gotoxy, putchar, newline
.import gotoxy, putchar, newline
.importzp tmp1, cvlinechar
_cvlinexy:
pha ; Save the length
jsr popa ; Get y
jsr _gotoxy ; Call this one, will pop params
jsr gotoxy ; Call this one, will pop params
pla ; Restore the length and run into _cvline
_cvline:
@ -25,6 +24,3 @@ L1: lda #cvlinechar ; Vertical bar
dec tmp1
bne L1
L9: rts

View File

@ -4,10 +4,13 @@
; void gotoxy (unsigned char x, unsigned char y);
;
.export _gotoxy
.export gotoxy, _gotoxy
.import popa, plot
.importzp CURS_X, CURS_Y
gotoxy:
jsr popa ; Get Y
_gotoxy:
sta CURS_Y ; Set Y
jsr popa ; Get X

View File

@ -8,7 +8,7 @@
.export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot
.import popa, _gotoxy
.import gotoxy
.import __VIDRAM_START__
.import CURS_X: zp, CURS_Y: zp, CHARCOLOR: zp, RVS: zp
.import SCREEN_PTR: zp, CRAM_PTR: zp
@ -22,8 +22,7 @@
_cputcxy:
pha ; Save C
jsr popa ; Get Y
jsr _gotoxy ; Set cursor, drop x
jsr gotoxy ; Set cursor, drop x and y
pla ; Restore C
; Plot a character - also used as internal function

View File

@ -9,8 +9,7 @@
.export newline, plot
.destructor setsyscursor
.import _gotoxy
.import popa
.import gotoxy
.import PLOT
.import ktmp: zp, crtc: zp, CURS_X: zp, CURS_Y: zp, RVS: zp
@ -21,8 +20,7 @@
_cputcxy:
pha ; Save C
jsr popa ; Get Y
jsr _gotoxy ; Set cursor, drop x
jsr gotoxy ; Set cursor, drop x and y
pla ; Restore C
; Plot a character - also used as internal function

View File

@ -6,14 +6,13 @@
;
.export _cputsxy, _cputs
.import popa, _gotoxy, _cputc
.import gotoxy, _cputc
.importzp ptr1, tmp1
_cputsxy:
sta ptr1 ; Save s for later
stx ptr1+1
jsr popa ; Get Y
jsr _gotoxy ; Set cursor, pop x
jsr gotoxy ; Set cursor, pop x and y
jmp L0 ; Same as cputs...
_cputs: sta ptr1 ; Save s

View File

@ -6,15 +6,14 @@
;
.export _chlinexy, _chline
.import popa, _gotoxy, cputdirect
.import gotoxy, cputdirect
.importzp tmp1
.include "gamate.inc"
_chlinexy:
pha ; Save the length
jsr popa ; Get y
jsr _gotoxy ; Call this one, will pop params
jsr gotoxy ; Call this one, will pop params
pla ; Restore the length
_chline:

View File

@ -5,7 +5,7 @@
.export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot
.import popa, _gotoxy
.import gotoxy
.import PLOT
.import xsize
.import fontdata
@ -19,8 +19,7 @@
_cputcxy:
pha ; Save C
jsr popa ; Get Y
jsr _gotoxy ; Set cursor, drop x
jsr gotoxy ; Set cursor, drop x and y
pla ; Restore C
; Plot a character - also used as internal function

View File

@ -6,15 +6,14 @@
;
.export _cvlinexy, _cvline
.import popa, _gotoxy, putchar, newline
.import gotoxy, putchar, newline
.importzp tmp1
.include "gamate.inc"
_cvlinexy:
pha ; Save the length
jsr popa ; Get y
jsr _gotoxy ; Call this one, will pop params
jsr gotoxy ; Call this one, will pop params
pla ; Restore the length and run into _cvline
_cvline:

View File

@ -2,12 +2,15 @@
; void gotoxy (unsigned char x, unsigned char y);
;
.export _gotoxy
.export gotoxy, _gotoxy
.import popa, plot
.include "gamate.inc"
.include "extzp.inc"
gotoxy:
jsr popa ; Get X
_gotoxy:
sta CURS_Y ; Set Y
jsr popa ; Get X

View File

@ -7,7 +7,7 @@
; void cclear (unsigned char length);
.export _cclearxy, _cclear
.import popa, _gotoxy, fixcursor
.import gotoxy, fixcursor
.importzp cursor_x, cursor_y, cursor_c
.include "jumptab.inc"
@ -15,8 +15,7 @@
_cclearxy:
pha ; Save the length
jsr popa ; Get y
jsr _gotoxy ; Call this one, will pop params
jsr gotoxy ; Call this one, will pop params
pla ; Restore the length
_cclear:

View File

@ -7,7 +7,7 @@
; void chline (unsigned char length);
.export _chlinexy, _chline
.import popa, _gotoxy, fixcursor
.import gotoxy, fixcursor
.importzp cursor_x, cursor_y, cursor_c
.include "jumptab.inc"
@ -15,8 +15,7 @@
_chlinexy:
pha ; Save the length
jsr popa ; Get y
jsr _gotoxy ; Call this one, will pop params
jsr gotoxy ; Call this one, will pop params
pla ; Restore the length
_chline:

View File

@ -23,8 +23,7 @@
; UPLINE = ?, KEY_UPARROW = GOTOY, ...
.export _cputcxy, _cputc
.import _gotoxy, fixcursor
.import popa
.import gotoxy, fixcursor
.import xsize,ysize
.importzp cursor_x, cursor_y, cursor_c, cursor_r
@ -34,8 +33,7 @@
_cputcxy:
pha ; Save C
jsr popa ; Get Y
jsr _gotoxy ; Set cursor, drop x
jsr gotoxy ; Set cursor, drop x and y
pla ; Restore C
; Plot a character - also used as internal function

View File

@ -7,7 +7,7 @@
; void cvline (unsigned char length);
.export _cvlinexy, _cvline
.import popa, _gotoxy, fixcursor
.import gotoxy, fixcursor
.importzp cursor_x, cursor_y, cursor_r
.include "jumptab.inc"
@ -15,8 +15,7 @@
_cvlinexy:
pha ; Save the length
jsr popa ; Get y
jsr _gotoxy ; Call this one, will pop params
jsr gotoxy ; Call this one, will pop params
pla ; Restore the length
_cvline:

View File

@ -8,7 +8,7 @@
; void gotoy (unsigned char y);
; void gotoxy (unsigned char x, unsigned char y);
.export _gotox, _gotoy, _gotoxy, fixcursor
.export _gotox, _gotoy, gotoxy, _gotoxy, fixcursor
.import popa
.importzp cursor_x, cursor_y, cursor_c, cursor_r
@ -22,6 +22,9 @@ _gotoy:
sta cursor_r
jmp fixcursor
gotoxy:
jsr popa
_gotoxy:
sta cursor_r
jsr popa

View File

@ -6,13 +6,12 @@
;
.export _cclearxy, _cclear
.import popa, _gotoxy, cputdirect
.import gotoxy, cputdirect
.importzp tmp1
_cclearxy:
pha ; Save the length
jsr popa ; Get y
jsr _gotoxy ; Call this one, will pop params
jsr gotoxy ; Call this one, will pop params
pla ; Restore the length and run into _cclear
_cclear:

View File

@ -6,15 +6,14 @@
;
.export _chlinexy, _chline
.import popa, _gotoxy, cputdirect
.import gotoxy, cputdirect
.importzp tmp1
.include "nes.inc"
_chlinexy:
pha ; Save the length
jsr popa ; Get y
jsr _gotoxy ; Call this one, will pop params
jsr gotoxy ; Call this one, will pop params
pla ; Restore the length
_chline:

View File

@ -9,7 +9,7 @@
.export _cputcxy, _cputc, cputdirect, putchar
.export newline
.constructor initconio
.import popa, _gotoxy
.import gotoxy
.import ppuinit, paletteinit, ppubuf_put
.import setcursor
@ -23,8 +23,7 @@
_cputcxy:
pha ; Save C
jsr popa ; Get Y
jsr _gotoxy ; Set cursor, drop x
jsr gotoxy ; Set cursor, drop x and y
pla ; Restore C
; Plot a character - also used as internal function

View File

@ -6,15 +6,14 @@
;
.export _cvlinexy, _cvline
.import popa, _gotoxy, putchar, newline
.import gotoxy, putchar, newline
.importzp tmp1
.include "nes.inc"
_cvlinexy:
pha ; Save the length
jsr popa ; Get y
jsr _gotoxy ; Call this one, will pop params
jsr gotoxy ; Call this one, will pop params
pla ; Restore the length and run into _cvline
_cvline:

View File

@ -4,21 +4,19 @@
; void gotoxy (unsigned char x, unsigned char y);
;
.export _gotoxy
.export gotoxy, _gotoxy
.import setcursor
.import popa
.include "nes.inc"
.proc _gotoxy
gotoxy:
jsr popa ; Get Y
_gotoxy:
sta CURS_Y ; Set Y
jsr popa ; Get X
sta CURS_X ; Set X
tay
ldx CURS_Y
jmp setcursor ; Set the cursor position
.endproc

View File

@ -9,13 +9,12 @@
;
.export _cclearxy, _cclear
.import popa, _gotoxy, cputdirect
.import gotoxy, cputdirect
.importzp tmp1
_cclearxy:
pha ; Save the length
jsr popa ; Get y
jsr _gotoxy ; Call this one, will pop params
jsr gotoxy ; Call this one, will pop params
pla ; Restore the length and run into _cclear
_cclear:

View File

@ -9,13 +9,12 @@
;
.export _chlinexy, _chline
.import popa, _gotoxy, cputdirect
.import gotoxy, cputdirect
.importzp tmp1
_chlinexy:
pha ; Save the length
jsr popa ; Get y
jsr _gotoxy ; Call this one, will pop params
jsr gotoxy ; Call this one, will pop params
pla ; Restore the length
_chline:

View File

@ -8,13 +8,12 @@
;
.export _cvlinexy, _cvline
.import popa, _gotoxy, putchar, newline
.import gotoxy, putchar, newline
.importzp tmp1
_cvlinexy:
pha ; Save the length
jsr popa ; Get y
jsr _gotoxy ; Call this one, will pop params
jsr gotoxy ; Call this one, will pop params
pla ; Restore the length and run into _cvline
_cvline:

View File

@ -6,10 +6,13 @@
;
; void gotoxy (unsigned char x, unsigned char y);
;
.export _gotoxy
.export gotoxy, _gotoxy
.import popa, plot
.include "extzp.inc"
gotoxy:
jsr popa ; Get Y
_gotoxy:
sta CURS_Y ; Set Y
jsr popa ; Get X

View File

@ -73,8 +73,7 @@ ScrollLength = (ScrHeight - 1) * ScrollDist
_cputcxy:
pha ; Save C
jsr popa ; Get Y
jsr _gotoxy ; Set cursor, drop x
jsr gotoxy ; Set cursor, drop x and y
pla ; Restore C
; Plot a character - also used as internal function
@ -157,7 +156,7 @@ putchar:
.macro osi_screen_funcs ScrBase, ScrRamSize, ScrFirstChar, \
ScrWidth, ScrHeight, ScrollDist
.import popa, _gotoxy
.import gotoxy
.import _memmove, _memset, pushax
.importzp ptr1

View File

@ -6,15 +6,14 @@
;
.export _chlinexy, _chline
.import popa, _gotoxy, cputdirect
.import gotoxy, cputdirect
.importzp tmp1
.include "pce.inc"
_chlinexy:
pha ; Save the length
jsr popa ; Get y
jsr _gotoxy ; Call this one, will pop params
jsr gotoxy ; Call this one, will pop params
pla ; Restore the length
_chline:

View File

@ -5,7 +5,7 @@
.export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot
.import popa, _gotoxy
.import gotoxy
.import PLOT
.import xsize
@ -16,8 +16,7 @@
_cputcxy:
pha ; Save C
jsr popa ; Get Y
jsr _gotoxy ; Set cursor, drop x
jsr gotoxy ; Set cursor, drop x and y
pla ; Restore C
; Plot a character - also used as internal function

View File

@ -6,15 +6,14 @@
;
.export _cvlinexy, _cvline
.import popa, _gotoxy, putchar, newline
.import gotoxy, putchar, newline
.importzp tmp1
.include "pce.inc"
_cvlinexy:
pha ; Save the length
jsr popa ; Get y
jsr _gotoxy ; Call this one, will pop params
jsr gotoxy ; Call this one, will pop params
pla ; Restore the length and run into _cvline
_cvline:

View File

@ -2,12 +2,15 @@
; void gotoxy (unsigned char x, unsigned char y);
;
.export _gotoxy
.export gotoxy, _gotoxy
.import popa, plot
.include "pce.inc"
.include "extzp.inc"
gotoxy:
jsr popa ; Get Y
_gotoxy:
sta CURS_Y ; Set Y
jsr popa ; Get X

View File

@ -7,14 +7,13 @@
.export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot
.import popa, _gotoxy
.import gotoxy
.include "pet.inc"
_cputcxy:
pha ; Save C
jsr popa ; Get Y
jsr _gotoxy ; Set cursor, drop x
jsr gotoxy ; Set cursor, drop x and y
pla ; Restore C
; Plot a character - also used as internal function

View File

@ -7,7 +7,7 @@
.export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot
.import popa, _gotoxy
.import gotoxy
.import PLOT
.include "plus4.inc"
@ -15,8 +15,7 @@
_cputcxy:
pha ; Save C
jsr popa ; Get Y
jsr _gotoxy ; Set cursor, drop x
jsr gotoxy ; Set cursor, drop x and y
pla ; Restore C
; Plot a character - also used as internal function

View File

@ -7,7 +7,7 @@
.export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot
.import popa, _gotoxy
.import gotoxy
.import PLOT
.include "vic20.inc"
@ -15,8 +15,7 @@
_cputcxy:
pha ; Save C
jsr popa ; Get Y
jsr _gotoxy ; Set cursor, drop x
jsr gotoxy ; Set cursor, drop x and y
pla ; Restore C
; Plot a character - also used as internal function