From c95ed4b8b5e3aa0313f19789333b63c6aaa2d2df Mon Sep 17 00:00:00 2001 From: IrgendwerA8 Date: Sun, 20 May 2018 15:30:18 +0200 Subject: [PATCH] Added "popptr1" which is of common use to save some bytes. --- libsrc/apple2/devicedir.s | 6 ++--- libsrc/apple2/extra/iobuf-0800.s | 6 ++--- libsrc/apple2/lseek.s | 6 ++--- libsrc/apple2/rwcommon.s | 6 ++--- libsrc/atari/dio_stc.s | 6 ++--- libsrc/atari/siocall.s | 6 ++--- libsrc/atmos/read.s | 6 ++--- libsrc/atmos/write.s | 6 ++--- libsrc/cbm/c_save.s | 6 ++--- libsrc/cbm/sysrename.s | 8 +++---- libsrc/common/_swap.s | 8 +++---- libsrc/common/getcwd.s | 8 +++---- libsrc/common/longjmp.s | 8 +++---- libsrc/common/memchr.s | 9 ++++---- libsrc/common/memcmp.s | 8 +++---- libsrc/common/memcpy.s | 9 ++++---- libsrc/common/strcmp.s | 8 +++---- libsrc/common/stricmp.s | 8 +++---- libsrc/common/strncat.s | 6 ++--- libsrc/common/strncmp.s | 8 +++---- libsrc/common/strncpy.s | 6 ++--- libsrc/common/strnicmp.s | 8 +++---- libsrc/common/strpbrk.s | 8 +++---- libsrc/common/strstr.s | 8 +++---- libsrc/conio/vcprintf.s | 6 ++--- libsrc/dbg/dbgsupp.s | 6 ++--- libsrc/geos-common/drivers/fio_module.s | 6 ++--- libsrc/pce/memcpy.s | 8 +++---- libsrc/runtime/popptr1.s | 29 +++++++++++++++++++++++++ libsrc/runtime/steaxspi.s | 6 ++--- libsrc/telestrat/write.s | 6 ++--- libsrc/tgi/tgi_bar.s | 6 ++--- libsrc/tgi/tgi_popxy.s | 7 ++---- libsrc/zlib/adler32.s | 6 ++--- libsrc/zlib/crc32.s | 6 ++--- 35 files changed, 113 insertions(+), 151 deletions(-) create mode 100644 libsrc/runtime/popptr1.s diff --git a/libsrc/apple2/devicedir.s b/libsrc/apple2/devicedir.s index dea2ba8c5..de6bad5f2 100644 --- a/libsrc/apple2/devicedir.s +++ b/libsrc/apple2/devicedir.s @@ -5,7 +5,7 @@ ; .export _getdevicedir - .import popax, popa + .import popptr1, popa .include "zeropage.inc" .include "errno.inc" @@ -17,9 +17,7 @@ _getdevicedir: stx ptr2+1 ; Save buf - jsr popax - sta ptr1 - stx ptr1+1 + jsr popptr1 ; Set buf sta mliparam + MLI::ON_LINE::DATA_BUFFER diff --git a/libsrc/apple2/extra/iobuf-0800.s b/libsrc/apple2/extra/iobuf-0800.s index 0ad7a751f..c7a9dae2e 100644 --- a/libsrc/apple2/extra/iobuf-0800.s +++ b/libsrc/apple2/extra/iobuf-0800.s @@ -8,7 +8,7 @@ .constructor initiobuf .export iobuf_alloc, iobuf_free .import __STARTUP_RUN__ - .import incsp2, popax + .import incsp2, popptr1 .include "zeropage.inc" .include "errno.inc" @@ -41,9 +41,7 @@ initiobuf: iobuf_alloc: ; Get and save "memptr" jsr incsp2 - jsr popax - sta ptr1 - stx ptr1+1 + jsr popptr1 ; Search table for free entry ldx #$00 diff --git a/libsrc/apple2/lseek.s b/libsrc/apple2/lseek.s index 73f4136be..22bcbee30 100644 --- a/libsrc/apple2/lseek.s +++ b/libsrc/apple2/lseek.s @@ -5,7 +5,7 @@ ; .export _lseek - .import popax + .import popax, popptr1 .include "zeropage.inc" .include "errno.inc" @@ -18,9 +18,7 @@ _lseek: stx tmp2 ; Get and save offset - jsr popax - sta ptr1 - stx ptr1+1 + jsr popptr1 jsr popax sta ptr2 diff --git a/libsrc/apple2/rwcommon.s b/libsrc/apple2/rwcommon.s index 3180a875d..e5fd9ae90 100644 --- a/libsrc/apple2/rwcommon.s +++ b/libsrc/apple2/rwcommon.s @@ -3,7 +3,7 @@ ; .export rwprolog, rwcommon, rwepilog - .import popax + .import popax, popptr1 .include "zeropage.inc" .include "errno.inc" @@ -17,9 +17,7 @@ rwprolog: stx ptr2+1 ; Get and save buf - jsr popax - sta ptr1 - stx ptr1+1 + jsr popptr1 ; Get and process fd jsr popax diff --git a/libsrc/atari/dio_stc.s b/libsrc/atari/dio_stc.s index 52b3af4a6..70dd16088 100644 --- a/libsrc/atari/dio_stc.s +++ b/libsrc/atari/dio_stc.s @@ -17,16 +17,14 @@ .export _dio_log_to_phys .include "atari.inc" .importzp ptr1,ptr2,ptr3 - .import popax,__oserror + .import popax, popptr1, __oserror .proc _dio_log_to_phys sta ptr2 stx ptr2+1 ; pointer to output structure - jsr popax - sta ptr1 - stx ptr1+1 ; save pointer to input data + jsr popptr1 ; save pointer to input data jsr popax sta ptr3 diff --git a/libsrc/atari/siocall.s b/libsrc/atari/siocall.s index 3db37753f..0465a6a3e 100644 --- a/libsrc/atari/siocall.s +++ b/libsrc/atari/siocall.s @@ -16,7 +16,7 @@ .export __sio_call .include "atari.inc" - .import popa,popax + .import popa, popax, popptr1 .import sectsizetab,__oserror .importzp ptr1 @@ -31,9 +31,7 @@ sta DAUX1 ; set sector # stx DAUX2 - jsr popax - sta ptr1 - stx ptr1+1 + jsr popptr1 ldy #sst_flag lda (ptr1),y diff --git a/libsrc/atmos/read.s b/libsrc/atmos/read.s index c44dc8584..83aa8024e 100644 --- a/libsrc/atmos/read.s +++ b/libsrc/atmos/read.s @@ -9,7 +9,7 @@ .export _read .constructor initstdin - .import popax + .import popax, popptr1 .importzp ptr1, ptr2, ptr3 .forceimport disable_caps @@ -26,9 +26,7 @@ eor #$FF sta ptr2+1 ; Remember -count-1 - jsr popax ; get buf - sta ptr1 - stx ptr1+1 + jsr popptr1 ; get buf jsr popax ; get fd and discard L1: inc ptr2 diff --git a/libsrc/atmos/write.s b/libsrc/atmos/write.s index c6399f2bf..7865b5698 100644 --- a/libsrc/atmos/write.s +++ b/libsrc/atmos/write.s @@ -7,7 +7,7 @@ ; .export _write - .import popax + .import popax, popptr1 .importzp ptr1, ptr2, ptr3, tmp1 .include "atmos.inc" @@ -23,9 +23,7 @@ eor #$FF sta ptr2+1 ; Remember -count-1 - jsr popax ; get buf - sta ptr1 - stx ptr1+1 + jsr popptr1 ; get buf jsr popax ; get fd and discard L1: inc ptr2 bne L2 diff --git a/libsrc/cbm/c_save.s b/libsrc/cbm/c_save.s index dfdb7df42..0597e9401 100644 --- a/libsrc/cbm/c_save.s +++ b/libsrc/cbm/c_save.s @@ -6,16 +6,14 @@ .export _cbm_k_save .import SAVE - .import popax + .import popptr1 .importzp ptr1, tmp1 _cbm_k_save: sta tmp1 ; store end address stx tmp1+1 - jsr popax ; pop start address - sta ptr1 - stx ptr1+1 + jsr popptr1 ; pop start address lda #ptr1 ldx tmp1 ldy tmp1+1 diff --git a/libsrc/cbm/sysrename.s b/libsrc/cbm/sysrename.s index 86cb37011..f79bf720a 100644 --- a/libsrc/cbm/sysrename.s +++ b/libsrc/cbm/sysrename.s @@ -9,7 +9,7 @@ .import fnparse, fnadd, fnparsename .import opencmdchannel, closecmdchannel .import writefndiskcmd, readdiskerror - .import popax + .import popptr1 .import fncmd, fnunit .importzp ptr1 @@ -26,10 +26,8 @@ lda #'=' jsr fnadd - jsr popax - sta ptr1 - stx ptr1+1 - ldy #0 + jsr popptr1 + ; ldy #0 Y=0 guaranteed by popptr1 jsr fnparsename ; Parse second filename bne done diff --git a/libsrc/common/_swap.s b/libsrc/common/_swap.s index a16aecc52..9ad771de1 100644 --- a/libsrc/common/_swap.s +++ b/libsrc/common/_swap.s @@ -5,7 +5,7 @@ ; .export __swap - .import popax + .import popax, popptr1 .importzp ptr1, ptr2, ptr3 @@ -19,13 +19,11 @@ __swap: eor #$FF sta ptr2 stx ptr2+1 - jsr popax ; Get p - sta ptr1 - stx ptr1+1 + jsr popptr1 ; Get p ; Prepare for swap - ldy #$00 + ; ldy #$00 is guaranteed by popptr1 ; Swap loop diff --git a/libsrc/common/getcwd.s b/libsrc/common/getcwd.s index b3cfbefcf..c14df63a1 100644 --- a/libsrc/common/getcwd.s +++ b/libsrc/common/getcwd.s @@ -6,7 +6,7 @@ .export _getcwd - .import popax + .import popptr1 .import __cwd .importzp ptr1, ptr2 @@ -25,13 +25,11 @@ eor #$FF sta ptr2+1 - jsr popax ; Get buf - sta ptr1 - stx ptr1+1 ; Save buf + jsr popptr1 ; Get buf to ptr1 ; Copy __cwd to the given buffer checking the length - ldy #$00 + ; ldy #$00 is guaranteed by popptr10 loop: inc ptr2 bne @L1 inc ptr2+1 diff --git a/libsrc/common/longjmp.s b/libsrc/common/longjmp.s index e9bac42e6..91606a442 100644 --- a/libsrc/common/longjmp.s +++ b/libsrc/common/longjmp.s @@ -6,7 +6,7 @@ ; .export _longjmp - .import popax + .import popptr1 .importzp sp, ptr1, ptr2 _longjmp: @@ -16,10 +16,8 @@ _longjmp: bne @L1 inc ptr2 ; 0 is illegal, according to the standard ... ; ... and, must be replaced by 1 -@L1: jsr popax ; get buf - sta ptr1 - stx ptr1+1 - ldy #0 +@L1: jsr popptr1 ; get buf + ; ldy #0 is guaranteed by popptr1 ; Get the old parameter stack diff --git a/libsrc/common/memchr.s b/libsrc/common/memchr.s index 1b60cbf73..de39a04f9 100644 --- a/libsrc/common/memchr.s +++ b/libsrc/common/memchr.s @@ -5,7 +5,7 @@ ; .export _memchr - .import popax, return0 + .import popax, popptr1 return0 .importzp ptr1, ptr2 @@ -18,11 +18,10 @@ sta ptr2+1 ; Save ones complement of n jsr popax ; get c pha - jsr popax ; get p - sta ptr1 - stx ptr1+1 - ldy #$00 + jsr popptr1 ; get p + + ; ldy #$00 is guaranteed by popptr1 pla ; Get c ldx ptr2 ; Use X as low counter byte diff --git a/libsrc/common/memcmp.s b/libsrc/common/memcmp.s index 25628127a..93a2c28dc 100644 --- a/libsrc/common/memcmp.s +++ b/libsrc/common/memcmp.s @@ -5,7 +5,7 @@ ; .export _memcmp - .import popax, return0 + .import popax, popptr1, return0 .importzp ptr1, ptr2, ptr3 _memcmp: @@ -24,14 +24,12 @@ _memcmp: jsr popax ; Get p2 sta ptr2 stx ptr2+1 - jsr popax ; Get p1 - sta ptr1 - stx ptr1+1 + jsr popptr1 ; Get p1 ; Loop initialization + ;ldy #$00 ; Initialize pointer (Y=0 guaranteed by popptr1) ldx ptr3 ; Load low counter byte into X - ldy #$00 ; Initialize pointer ; Head of compare loop: Test for the end condition diff --git a/libsrc/common/memcpy.s b/libsrc/common/memcpy.s index c0c5e56d0..1ee53be07 100644 --- a/libsrc/common/memcpy.s +++ b/libsrc/common/memcpy.s @@ -11,7 +11,7 @@ ; .export _memcpy, memcpy_upwards, memcpy_getparams - .import popax + .import popax, popptr1 .importzp sp, ptr1, ptr2, ptr3 ; ---------------------------------------------------------------------- @@ -64,12 +64,11 @@ memcpy_getparams: ; IMPORTANT! Function has to leave with Y=0! sta ptr3 stx ptr3+1 ; save n to ptr3 - jsr popax - sta ptr1 - stx ptr1+1 ; save src to ptr1 + jsr popptr1 ; save src to ptr1 ; save dest to ptr2 - ldy #1 ; (direct stack access is three cycles faster + iny ; Y=0 guaranteed by popptr1, we need '1' here... + ; (direct stack access is three cycles faster ; (total cycle count with return)) lda (sp),y tax diff --git a/libsrc/common/strcmp.s b/libsrc/common/strcmp.s index 189ce8fa7..8939163b1 100644 --- a/libsrc/common/strcmp.s +++ b/libsrc/common/strcmp.s @@ -5,16 +5,14 @@ ; .export _strcmp - .import popax + .import popptr1 .importzp ptr1, ptr2 _strcmp: sta ptr2 ; Save s2 stx ptr2+1 - jsr popax ; Get s1 - sta ptr1 - stx ptr1+1 - ldy #0 + jsr popptr1 ; Get s1 + ;ldy #0 ; Y=0 guaranteed by popptr1 loop: lda (ptr1),y cmp (ptr2),y diff --git a/libsrc/common/stricmp.s b/libsrc/common/stricmp.s index 501d0b625..384e78e31 100644 --- a/libsrc/common/stricmp.s +++ b/libsrc/common/stricmp.s @@ -6,7 +6,7 @@ ; .export _stricmp, _strcasecmp - .import popax + .import popptr1 .import __ctype .importzp ptr1, ptr2, tmp1 @@ -16,10 +16,8 @@ _stricmp: _strcasecmp: sta ptr2 ; Save s2 stx ptr2+1 - jsr popax ; get s1 - sta ptr1 - stx ptr1+1 - ldy #0 + jsr popptr1 ; get s1 + ; ldy #0 ; Y=0 guaranteed by popptr1 loop: lda (ptr2),y ; get char from second string tax diff --git a/libsrc/common/strncat.s b/libsrc/common/strncat.s index 457e39e25..caa6804fc 100644 --- a/libsrc/common/strncat.s +++ b/libsrc/common/strncat.s @@ -6,7 +6,7 @@ ; .export _strncat - .import popax + .import popax, popptr1 .importzp ptr1, ptr2, ptr3, tmp1, tmp2 .macpack cpu @@ -17,9 +17,7 @@ _strncat: eor #$FF sta tmp2 - jsr popax ; get src - sta ptr1 - stx ptr1+1 + jsr popptr1 ; get src jsr popax ; get dest sta ptr3 ; remember for function return diff --git a/libsrc/common/strncmp.s b/libsrc/common/strncmp.s index 1035e15b8..bff1f0911 100644 --- a/libsrc/common/strncmp.s +++ b/libsrc/common/strncmp.s @@ -5,7 +5,7 @@ ; .export _strncmp - .import popax + .import popax, popptr1 .importzp ptr1, ptr2, ptr3 @@ -28,13 +28,11 @@ _strncmp: jsr popax ; get s2 sta ptr2 stx ptr2+1 - jsr popax ; get s1 - sta ptr1 - stx ptr1+1 + jsr popptr1 ; get s1 ; Loop setup - ldy #0 + ;ldy #0 Y=0 guaranteed by popptr1 ; Start of compare loop. Check the counter. diff --git a/libsrc/common/strncpy.s b/libsrc/common/strncpy.s index 042f9e28b..e6cafd990 100644 --- a/libsrc/common/strncpy.s +++ b/libsrc/common/strncpy.s @@ -5,7 +5,7 @@ ; .export _strncpy - .import popax + .import popptr1 .importzp ptr1, ptr2, tmp1, tmp2, tmp3 .proc _strncpy @@ -16,9 +16,7 @@ eor #$FF sta tmp2 ; Store -size - 1 - jsr popax ; get src - sta ptr1 - stx ptr1+1 + jsr popptr1 ; get src jsr popax ; get dest sta ptr2 stx ptr2+1 diff --git a/libsrc/common/strnicmp.s b/libsrc/common/strnicmp.s index b1f973e3a..6a5de09e4 100644 --- a/libsrc/common/strnicmp.s +++ b/libsrc/common/strnicmp.s @@ -7,7 +7,7 @@ ; .export _strnicmp, _strncasecmp - .import popax, __ctype + .import popax, popptr1, __ctype .importzp ptr1, ptr2, ptr3, tmp1 .include "ctype.inc" @@ -32,13 +32,11 @@ _strncasecmp: jsr popax ; get s2 sta ptr2 stx ptr2+1 - jsr popax ; get s1 - sta ptr1 - stx ptr1+1 + jsr popptr1 ; get s1 ; Loop setup - ldy #0 + ; ldy #0 Y=0 guaranteed by popptr1 ; Start of compare loop. Check the counter. diff --git a/libsrc/common/strpbrk.s b/libsrc/common/strpbrk.s index 5d1482913..afe90ecab 100644 --- a/libsrc/common/strpbrk.s +++ b/libsrc/common/strpbrk.s @@ -5,17 +5,15 @@ ; .export _strpbrk - .import popax, return0 + .import popax, popptr1, return0 .importzp ptr1, ptr2, tmp1, tmp2, tmp3 _strpbrk: jsr popax ; get s2 sta ptr2 stx ptr2+1 - jsr popax ; get s1 - sta ptr1 - stx ptr1+1 - ldy #$00 + jsr popptr1 ; get s1 + ; ldy #$00 Y=0 guaranteed by popptr1 L1: lda (ptr1),y ; get next char from s1 beq L9 ; jump if done diff --git a/libsrc/common/strstr.s b/libsrc/common/strstr.s index 55e2def03..84f633245 100644 --- a/libsrc/common/strstr.s +++ b/libsrc/common/strstr.s @@ -5,7 +5,7 @@ ; .export _strstr - .import popax + .import popptr1 .importzp ptr1, ptr2, ptr3, ptr4, tmp1 _strstr: @@ -13,13 +13,11 @@ _strstr: stx ptr2+1 sta ptr4 ; Setup temp copy for later - jsr popax ; Get haystack - sta ptr1 - stx ptr1+1 ; Save haystack + jsr popptr1 ; Get haystack to ptr1 ; If needle is empty, return haystack - ldy #$00 + ; ldy #$00 Y=0 guaranteed by popptr1 lda (ptr2),y ; Get first byte of needle beq @Found ; Needle is empty --> we're done diff --git a/libsrc/conio/vcprintf.s b/libsrc/conio/vcprintf.s index 06eab4421..3a9ddf9d7 100644 --- a/libsrc/conio/vcprintf.s +++ b/libsrc/conio/vcprintf.s @@ -5,7 +5,7 @@ ; .export _vcprintf - .import pushax, popax + .import pushax, popax, popptr1 .import __printf, _cputc .importzp sp, ptr1, ptr2, ptr3, tmp1 @@ -54,9 +54,7 @@ out: jsr popax ; count eor #$FF sta outdesc+7 - jsr popax ; buf - sta ptr1 - stx ptr1+1 + jsr popptr1 ; buf jsr popax ; d sta ptr3 diff --git a/libsrc/dbg/dbgsupp.s b/libsrc/dbg/dbgsupp.s index 9f044c728..07ab9e25a 100644 --- a/libsrc/dbg/dbgsupp.s +++ b/libsrc/dbg/dbgsupp.s @@ -6,7 +6,7 @@ .export _DbgInit .export _DbgSP, _DbgCS, _DbgHI - .import popax, return0, _DbgEntry, _set_brk, _end_brk + .import popptr1, return0, _DbgEntry, _set_brk, _end_brk .import _DbgBreaks .import _brk_pc .import __ZP_START__ ; Linker generated @@ -170,9 +170,7 @@ L12: ldy #1 ; Force != 0 .export _DbgIsBreak _DbgIsBreak: - jsr popax ; Get address - sta ptr1 - stx ptr1+1 + jsr popptr1 ; Get address ldx #0 L20: lda _DbgBreaks+3,x ; Get bk_use beq L21 ; Jump if not set diff --git a/libsrc/geos-common/drivers/fio_module.s b/libsrc/geos-common/drivers/fio_module.s index b757e6bd8..e655f0cec 100644 --- a/libsrc/geos-common/drivers/fio_module.s +++ b/libsrc/geos-common/drivers/fio_module.s @@ -13,7 +13,7 @@ FILEDES = 3 ; first free to use file descriptor .importzp ptr1, ptr2, ptr3, tmp1 - .import addysp, popax + .import addysp, popax, poptr1 .import __oserror .import _FindFile, _ReadByte .export _open, _close, _read @@ -37,9 +37,7 @@ _open: @parmok: jsr popax ; Get flags sta tmp1 - jsr popax ; Get name - sta ptr1 - stx ptr1+1 + jsr popptr1 ; Get name lda filedesc ; is there a file already open? bne @alreadyopen diff --git a/libsrc/pce/memcpy.s b/libsrc/pce/memcpy.s index 14977dee0..98db6a964 100644 --- a/libsrc/pce/memcpy.s +++ b/libsrc/pce/memcpy.s @@ -17,7 +17,7 @@ .export _memcpy .export memcpy_increment, memcpy_transfer, memcpy_getparams - .import incsp2, popax + .import incsp2, popax, popptr1 .importzp sp, ptr1, ptr2, ptr3 @@ -81,13 +81,11 @@ memcpy_getparams: jsr incsp2 ; drop src address jmp popax ; get pointer; return it as result -@L1: jsr popax - sta ptr1 - stx ptr1+1 ; save src +@L1: jsr popptr1 ; save src ; (Direct stack access is six cycles faster [total cycle count].) - ldy #1 ; save dest + iny ; (Y=0 by popptr1, need '1' here) save dest lda (sp),y ; get high byte tax lda (sp) ; get low byte diff --git a/libsrc/runtime/popptr1.s b/libsrc/runtime/popptr1.s new file mode 100644 index 000000000..64da308a8 --- /dev/null +++ b/libsrc/runtime/popptr1.s @@ -0,0 +1,29 @@ +; +; Christian Kruger, 20-May-2018 +; +; CC65 runtime: Pop registers on stack to ptr1 or ptr2 and ptr1. +; X is untouched, low byte in A, Y is defined to be 0! + + .export popptr1 + .import incsp2 + .importzp sp, ptr1 + + .macpack cpu + +.proc popptr1 ; 14 bytes, + + ldy #1 + lda (sp),y ; get hi byte + sta ptr+1 ; into ptr hi + dey ; note: apply even for 65C02 to have Y=0 at exit! +.if (.cpu .bitand ::CPU_ISET_65SC02) + lda (sp) ; get lo byte +.else + lda (sp),y ; get lo byte +.endif + sta ptr1 ; to ptr lo + + jmp incsp2 +.endproc + + diff --git a/libsrc/runtime/steaxspi.s b/libsrc/runtime/steaxspi.s index b85725050..9686e5c35 100644 --- a/libsrc/runtime/steaxspi.s +++ b/libsrc/runtime/steaxspi.s @@ -6,7 +6,7 @@ .export steaxspidx - .import popax + .import popptr1 .importzp sreg, ptr1, tmp1, tmp2, tmp3 @@ -15,9 +15,7 @@ sta tmp1 stx tmp2 sty tmp3 - jsr popax ; get the pointer - sta ptr1 - stx ptr1+1 + jsr popptr1 ; get the pointer ldy tmp3 lda tmp1 sta (ptr1),y diff --git a/libsrc/telestrat/write.s b/libsrc/telestrat/write.s index 8c2bc08f7..30eac9532 100644 --- a/libsrc/telestrat/write.s +++ b/libsrc/telestrat/write.s @@ -2,7 +2,7 @@ ; jede jede@oric.org 2017-01-22 .export _write - .import popax + .import popax, popptr1 .importzp ptr1, ptr2, ptr3, tmp1 .include "telestrat.inc" @@ -19,9 +19,7 @@ eor #$FF sta ptr2+1 ; Remember -count-1 - jsr popax ; get buf - sta ptr1 - stx ptr1+1 + jsr popptr1 ; get buf jsr popax ; get fd and discard ; if fd=0001 then it stdout diff --git a/libsrc/tgi/tgi_bar.s b/libsrc/tgi/tgi_bar.s index 476f9d7a4..0e424c1f0 100644 --- a/libsrc/tgi/tgi_bar.s +++ b/libsrc/tgi/tgi_bar.s @@ -8,7 +8,7 @@ .include "tgi-kernel.inc" .importzp ptr1, ptr2, ptr3, ptr4 - .import popax + .import popax, popptr1 .proc _tgi_bar @@ -24,9 +24,7 @@ sta ptr2 ; Y1 stx ptr2+1 - jsr popax - sta ptr1 ; X1 - stx ptr1+1 + jsr popptr1 ; X1 ; Make sure X1 is less than X2. Swap both if not. diff --git a/libsrc/tgi/tgi_popxy.s b/libsrc/tgi/tgi_popxy.s index 55b259dab..40655d413 100644 --- a/libsrc/tgi/tgi_popxy.s +++ b/libsrc/tgi/tgi_popxy.s @@ -6,17 +6,14 @@ .include "tgi-kernel.inc" - .import popax + .import popptr1 .importzp ptr1, ptr2 .proc tgi_popxy sta ptr2 ; Y stx ptr2+1 - jsr popax - sta ptr1 ; X - stx ptr1+1 - rts + jmp popptr1 ; X .endproc diff --git a/libsrc/zlib/adler32.s b/libsrc/zlib/adler32.s index e54e25e77..ccfe2f167 100644 --- a/libsrc/zlib/adler32.s +++ b/libsrc/zlib/adler32.s @@ -7,7 +7,7 @@ .export _adler32 - .import incsp2, incsp4, popax, popeax + .import incsp2, incsp4, popptr1, popeax .importzp sreg, ptr1, ptr2, tmp1 BASE = 65521 ; largest prime smaller than 65536 @@ -20,9 +20,7 @@ _adler32: @L1: sta ptr2 stx ptr2+1 ; ptr1 = buf - jsr popax - sta ptr1 - stx ptr1+1 + jsr popptr1 ; if (buf == NULL) return 1L; ora ptr1+1 beq @L0 diff --git a/libsrc/zlib/crc32.s b/libsrc/zlib/crc32.s index 26955dbed..7f06dd383 100644 --- a/libsrc/zlib/crc32.s +++ b/libsrc/zlib/crc32.s @@ -7,7 +7,7 @@ .export _crc32 - .import compleax, incsp2, incsp4, popax, popeax + .import compleax, incsp2, incsp4, popptr1, popeax .importzp sreg, ptr1, ptr2, tmp1, tmp2 POLYNOMIAL = $EDB88320 @@ -67,9 +67,7 @@ _crc32: @L1: sta ptr2 stx ptr2+1 ; ptr1 = buf - jsr popax - sta ptr1 - stx ptr1+1 + jsr popptr1 ; if (buf == NULL) return 0; ora ptr1+1 beq @L0 -- 2.39.5