Merge branch 'cc65:master' into master

This commit is contained in:
rumbledethumps
2025-09-15 20:57:21 -07:00
committed by GitHub
460 changed files with 7356 additions and 3335 deletions

View File

@@ -5,6 +5,8 @@
; void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);
; void __fastcall__ cputc (char c);
;
; Important note: The implementation of cputs() relies on the cputc() function
; not clobbering ptr1. Beware when rewriting or changing this function!
.import COUT
.export _cputcxy, _cputc, newline, putchar,putchardirect

View File

@@ -4,6 +4,8 @@
; void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);
; void __fastcall__ cputc (char c);
;
; Important note: The implementation of cputs() relies on the cputc() function
; not clobbering ptr1. Beware when rewriting or changing this function!
.constructor initconio
.export _cputcxy, _cputc
@@ -18,8 +20,6 @@
.include "zeropage.inc"
.include "apple2.inc"
.macpack cpu
.segment "ONCE"
initconio:

View File

@@ -0,0 +1,78 @@
;
; Colin Leroy-Mira, 2025 <colin@colino.net>
;
; int __fastcall__ file_set_type(const char *pathname, unsigned char type);
; int __fastcall__ file_set_auxtype(const char *pathname, unsigned int auxtype);
;
.export _file_set_type, _file_set_auxtype
.import pushname, popname, mli_file_info_direct
.import popa, popax
.include "zeropage.inc"
.include "errno.inc"
.include "mli.inc"
new_value = ptr2 ; ptr1 is used by pushname
mod_flag = tmp1
UPDATE_TYPE = $00
UPDATE_AUXTYPE = $80
_file_set_type:
sta new_value
ldy #UPDATE_TYPE
beq mli_update
_file_set_auxtype:
sta new_value
stx new_value+1
ldy #UPDATE_AUXTYPE
mli_update:
sty mod_flag
; Get pathname
jsr popax
jsr pushname
bne oserr
; ProDOS 8 TechRef, 4.4.4: You should use
; the GET_FILE_INFO call to read a files
; attributes into a parameter list, modify
; them as needed, and then use the same
; parameter list for the SET_FILE_INFO call.
jsr mli_file_info_direct
; Bail if we could not get the information.
bcs cleanup
; Update type if needed
bit mod_flag
bmi :+
lda new_value
sta mliparam + MLI::INFO::FILE_TYPE
jmp set_info
: ; Otherwise update auxtype
lda new_value
sta mliparam + MLI::INFO::AUX_TYPE
lda new_value+1
sta mliparam + MLI::INFO::AUX_TYPE+1
set_info:
; Set file information
lda #SET_INFO_CALL
ldx #SET_INFO_COUNT
jsr callmli
cleanup:
php ; Save return status
jsr popname ; Preserves A
plp
bcs oserr
rts
oserr:
jsr ___mappederrno
sec
rts

View File

@@ -6,7 +6,6 @@
.export _lseek
.import popax, popptr1
.macpack cpu
.include "zeropage.inc"
.include "errno.inc"

View File

@@ -20,6 +20,9 @@ DESTROY_COUNT = 1
RENAME_CALL = $C2
RENAME_COUNT = 2
SET_INFO_CALL = $C3
SET_INFO_COUNT = 7
GET_INFO_CALL = $C4
GET_INFO_COUNT = $A

View File

@@ -26,7 +26,6 @@
.include "ser-error.inc"
.macpack module
.macpack cpu
; ------------------------------------------------------------------------
; Header. Includes jump table

View File

@@ -4,6 +4,8 @@
; void cputcxy (unsigned char x, unsigned char y, char c);
; void cputc (char c);
;
; Important note: The implementation of cputs() relies on the cputc() function
; not clobbering ptr1. Beware when rewriting or changing this function!
.export _cputcxy, _cputc
.export plot, cputdirect, putchar

View File

@@ -5,6 +5,8 @@
; void cputcxy (unsigned char x, unsigned char y, char c);
; void cputc (char c);
;
; Important note: The implementation of cputs() relies on the cputc() function
; not clobbering ptr1. Beware when rewriting or changing this function!
.include "atari5200.inc"

View File

@@ -4,6 +4,8 @@
; void cputcxy (unsigned char x, unsigned char y, char c);
; void cputc (char c);
;
; Important note: The implementation of cputs() relies on the cputc() function
; not clobbering ptr1. Beware when rewriting or changing this function!
.export _cputc
.import gotox, gotoy, pusha0

View File

@@ -5,6 +5,8 @@
; void cputcxy (unsigned char x, unsigned char y, char c);
; void cputc (char c);
;
; Important note: The implementation of cputs() relies on the cputc() function
; not clobbering ptr1. Beware when rewriting or changing this function!
.export _cputcxy, _cputc
.export setscrptr, cputdirect, putchar

View File

@@ -5,6 +5,8 @@
; void cputcxy (unsigned char x, unsigned char y, char c);
; void cputc (char c);
;
; Important note: The implementation of cputs() relies on the cputc() function
; not clobbering ptr1. Beware when rewriting or changing this function!
.export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot

View File

@@ -9,7 +9,6 @@
.import push0, callmain
.import RESTOR, BSOUT, CLRCH
.import __MAIN_START__, __MAIN_SIZE__, __STACKSIZE__
.importzp ST
.include "zeropage.inc"
.include "c128.inc"
@@ -65,6 +64,15 @@ L1: lda c_sp,x
jsr initlib
; Disable the BASIC part of the IRQ handler. It would usually (once per frame)
; copy the VIC shadow register, move sprites, play music. This would only get
; in the way, so we turn it off.
lda INIT_STATUS
sta initsave
and #$fe
sta INIT_STATUS
; Set the bank for the file name to our execution bank. We must do this
; *after* calling the constructors because some of them might depend on
; the original value of this register.
@@ -89,10 +97,15 @@ L2: lda zpsave,x
dex
bpl L2
; Enable the BASIC interrupt again
lda initsave
sta INIT_STATUS
; Place the program return code into BASIC's status variable.
pla
sta ST
sta STATUS
; Reset the stack and the memory configuration.
@@ -116,5 +129,6 @@ zpsave: .res zpspace
.bss
spsave: .res 1
mmusave:.res 1
spsave: .res 1
mmusave: .res 1
initsave: .res 1

View File

@@ -1,5 +1,15 @@
;
; Oliver Schmidt, 2012-09-30
; Stefan Haubenthal, 2023-01-16
;
.exportzp ST := $90 ; IEC status byte
.export initst
.include "c128.inc"
.proc initst
lda #$00
sta STATUS
rts
.endproc

View File

@@ -10,9 +10,9 @@
.import initlib, donelib
.import callmain, zerobss
.import MEMTOP, RESTOR, BSOUT, CLRCH
.importzp ST
.include "zeropage.inc"
.include "c16.inc"
; ------------------------------------------------------------------------
; Startup code
@@ -76,7 +76,7 @@ L2: lda zpsave,x
; Store the return code into BASIC's status variable.
pla
sta ST
sta STATUS
; Restore the stack pointer.

View File

@@ -4,6 +4,8 @@
; void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);
; void __fastcall__ cputc (char c);
;
; Important note: The implementation of cputs() relies on the cputc() function
; not clobbering ptr1. Beware when rewriting or changing this function!
.export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot

View File

@@ -10,9 +10,9 @@
.import BSOUT
.import __MAIN_START__, __MAIN_SIZE__ ; Linker generated
.import __STACKSIZE__ ; from configure file
.importzp ST
.include "zeropage.inc"
.include "c64.inc"
; ------------------------------------------------------------------------
@@ -62,7 +62,7 @@ L2: lda zpsave,x
; Place the program return code into BASIC's status variable.
pla
sta ST
sta STATUS
; Restore the system stuff.

View File

@@ -1,5 +1,15 @@
;
; Oliver Schmidt, 2012-09-30
; Stefan Haubenthal, 2023-01-16
;
.exportzp ST := $90 ; IEC status byte
.export initst
.include "c64.inc"
.proc initst
lda #$00
sta STATUS
rts
.endproc

View File

@@ -4,6 +4,8 @@
; void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);
; void __fastcall__ cputc (char c);
;
; Important note: The implementation of cputs() relies on the cputc() function
; not clobbering ptr1. Beware when rewriting or changing this function!
.export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot

View File

@@ -1,5 +1,15 @@
;
; Oliver Schmidt, 2012-09-30
; Stefan Haubenthal, 2023-01-16
;
.exportzp ST := $90 ; IEC status byte
.export initst
.include "c65.inc"
.proc initst
lda #$00
sta STATUS
rts
.endproc

View File

@@ -9,14 +9,13 @@
.importzp sreg
.include "cbm.inc"
.macpack cpu
.proc _clock
; Some accelerator adaptors have CMOS ICs.
.if (.cpu & ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_STZ)
stz sreg + 1
.else
lda #$00 ; Byte 3 always is zero

View File

@@ -10,7 +10,8 @@
.import isdisk
.import opencmdchannel
.import closecmdchannel
.importzp ST
.import initst
.import READST
.importzp tmp2
;------------------------------------------------------------------------------
@@ -33,26 +34,25 @@ next: inx
; interpret a non-disk as a no-op while we need to interpret it
; as an error here
jsr isdisk
jsr isdisk ; carry clear if the unit number in X is a disk
bcs next
; [open|close]cmdchannel don't call into the Kernal at all if they
; only [in|de]crement the reference count of the shared cmdchannel
; so we need to explicitly initialize ST here
lda #$00
sta ST
stx tmp2 ; further calls my use X
stx tmp2
jsr initst
ldx tmp2 ; get unit number back
jsr opencmdchannel
ldx tmp2
ldx tmp2 ; get unit number back
jsr closecmdchannel
ldx tmp2
; As we had to reference ST above anyway we can as well do so
; here too (instead of calling READST)
ldx tmp2 ; get unit number back
lda ST
jsr READST ; preserves X, returns A and Flags
; Either the Kernal calls above were successful or there was
; already a cmdchannel to the device open - which is a pretty

View File

@@ -4,6 +4,8 @@
; void cputcxy (unsigned char x, unsigned char y, char c);
; void cputc (char c);
;
; Important note: The implementation of cputs() relies on the cputc() function
; not clobbering ptr1. Beware when rewriting or changing this function!
.export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot

View File

@@ -16,11 +16,9 @@
jsr sys_bank
sty ktmp ; Save Y register
ldy #$9C ; STATUS
ldy #STATUS
lda (sysp0),y ; Load STATUS from system bank
ldy ktmp
jmp restore_bank ; Will set condition codes on A
.endproc

View File

@@ -22,7 +22,7 @@
sty ktmp
txa
ldy #$90 ; FNAM
ldy #FNAM
sta (sysp0),y
lda ktmp
@@ -33,13 +33,10 @@
ldy #$92 ; FNAM_SEG
sta (sysp0),y
ldy #$9D ; FNAM_LEN
ldy #FNAM_LEN
pla
sta (sysp0),y
ldy ktmp
jmp restore_bank
.endproc

21
libsrc/cbm510/status.s Normal file
View File

@@ -0,0 +1,21 @@
;
; Stefan Haubenthal, 2023-01-16
;
.export initst
.include "extzp.inc"
.include "cbm510.inc"
.proc initst
ldx IndReg
ldy #$0F
sty IndReg ; Switch to the system bank
ldy #STATUS
lda #$00 ; Initialize value
sta (sysp0),y
stx IndReg
rts
.endproc

View File

@@ -4,6 +4,8 @@
; void cputcxy (unsigned char x, unsigned char y, char c);
; void cputc (char c);
;
; Important note: The implementation of cputs() relies on the cputc() function
; not clobbering ptr1. Beware when rewriting or changing this function!
.export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot

View File

@@ -394,7 +394,7 @@ _exit: pha ; Save the return code
; Place the program return code into BASIC's status variable.
pla
ldy #$9C ; ST
ldy #STATUS
sta (sysp0),y
; Set up the welcome code at the stack bottom in the system bank.

View File

@@ -11,16 +11,14 @@
.include "cbm610.inc"
; preserves X and Y, returns status in A and in status flags
.proc READST
jsr sys_bank
sty ktmp ; Save Y register
ldy #$9C ; STATUS
ldy #STATUS
lda (sysp0),y ; Load STATUS from system bank
ldy ktmp
jmp restore_bank ; Will set condition codes on A
.endproc

View File

@@ -22,7 +22,7 @@
sty ktmp
txa
ldy #$90 ; FNAM
ldy #FNAM
sta (sysp0),y
lda ktmp
@@ -30,14 +30,13 @@
sta (sysp0),y
lda ExecReg ; Assume name is always in this segment
ldy #$92 ; FNAM_SEG
ldy #FNAM_SEG
sta (sysp0),y
ldy #$9D ; FNAM_LEN
ldy #FNAM_LEN
pla
sta (sysp0),y
ldy ktmp
jmp restore_bank
.endproc

21
libsrc/cbm610/status.s Normal file
View File

@@ -0,0 +1,21 @@
;
; Stefan Haubenthal, 2023-01-16
;
.export initst
.include "extzp.inc"
.include "cbm610.inc"
.proc initst
ldx IndReg
ldy #$0F
sty IndReg ; Switch to the system bank
ldy #STATUS
lda #$00 ; Initialize value
sta (sysp0),y
stx IndReg
rts
.endproc

View File

@@ -7,8 +7,6 @@
.include "errno.inc"
.macpack cpu
; ----------------------------------------------------------------------------
; int __fastcall__ __directerrno (unsigned char code);
; /* Set errno to a specific error code, clear __oserror, and return -1. Used
@@ -18,7 +16,7 @@
___directerrno:
jsr ___seterrno ; Set errno (returns with .A = 0)
sta ___oserror ; Clear ___oserror
.if (.cpu .bitand CPU_ISET_65SC02)
.if .cap(CPU_HAS_INA)
dec a
.else
lda #$FF ; Return -1

View File

@@ -12,7 +12,6 @@
.include "_heap.inc"
.macpack generic
.macpack cpu
;-----------------------------------------------------------------------------
; Code
@@ -39,7 +38,7 @@ ___heapblocksize:
ldy #usedblock::size+1
lda (ptr2),y
tax
.if (.cpu .bitand CPU_ISET_65SC02)
.if .cap(CPU_HAS_ZPIND)
lda (ptr2)
.else
dey

View File

@@ -8,7 +8,6 @@
.include "errno.inc"
.macpack generic
.macpack cpu
; ----------------------------------------------------------------------------
; int __fastcall__ __mappederrno (unsigned char code);
@@ -24,7 +23,7 @@ ___mappederrno:
bze ok ; Branch if no
jsr ___osmaperrno ; Map OS error into errno code
jsr ___seterrno ; Save in errno (returns with .A = 0)
.if (.cpu .bitand CPU_ISET_65SC02)
.if .cap(CPU_HAS_INA)
dec a
.else
lda #$FF ; Return -1 if error

View File

@@ -13,7 +13,6 @@
.import _strlower, _strlen
.macpack generic
.macpack cpu
; ----------------------------------------------------------------------------
; We will store variables into the register bank in the zeropage. Define
@@ -38,7 +37,7 @@ FCount = ptr2
GetFormatChar:
ldy #0
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_ZPIND)
lda (Format)
.else
lda (Format),y
@@ -115,7 +114,7 @@ GetIntArg:
lda (ArgList),y
tax
dey
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_ZPIND)
lda (ArgList)
.else
lda (ArgList),y
@@ -274,7 +273,7 @@ Save: lda regbank,y
; Initialize the output counter in the output descriptor to zero
lda #0
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_ZPIND)
sta (OutData)
ldy #$01
sta (OutData),y
@@ -353,7 +352,7 @@ MainLoop:
sta (c_sp),y
dey
lda FCount
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_ZPIND)
sta (c_sp)
.else
sta (c_sp),y
@@ -570,7 +569,7 @@ CheckCount:
jsr GetIntArg
sta ptr1
stx ptr1+1 ; Get user supplied pointer
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_ZPIND)
lda (OutData) ; Low byte of OutData->ccount
sta (ptr1)
ldy #1

View File

@@ -16,8 +16,6 @@
.include "time.inc"
.macpack cpu
__time_t_to_tm:
; Divide number of seconds since epoch, in ptr1:sreg,
; by 86400 to get the number of days since epoch, and
@@ -80,7 +78,7 @@ __time_t_to_tm:
; Zero the two high bytes of the divisor and the high byte
; of the dividend.
.if .cpu .bitand CPU_ISET_65SC02
.if .cap(CPU_HAS_STZ)
stz ptr4
stz ptr4+1
stz sreg+1

View File

@@ -9,8 +9,6 @@
.importzp ptr1
.include "time.inc"
.macpack cpu
; ------------------------------------------------------------------------
; Special values
@@ -24,7 +22,7 @@ MAX_BUF_LEN = 38
_asctime:
; Backup timep
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_PUSHXY)
pha
phx
.else
@@ -48,7 +46,7 @@ _asctime:
jsr pushax
; Restore timep
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_PUSHXY)
plx
pla
.else

View File

@@ -10,8 +10,6 @@
.include "errno.inc"
.macpack cpu
; ---------------------------------------------------------------------------
.proc _atexit
@@ -41,7 +39,7 @@
jsr ___seterrno
ldx #$FF ; Return -1
txa
rts
Exit: rts
.endproc
@@ -54,7 +52,7 @@
.proc doatexit
ldy exitfunc_index ; Get index
beq @L9 ; Jump if done
beq _atexit::Exit ; Jump if done
dey
lda exitfunc_table,y
tax
@@ -62,14 +60,12 @@
lda exitfunc_table,y
sty exitfunc_index
jsr callax ; Call the function
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_BRA8)
bra doatexit
.else
jmp doatexit ; Next one
.endif
@L9: rts
.endproc

View File

@@ -12,8 +12,6 @@
.include "stdio.inc"
.include "_file.inc"
.macpack cpu
_fgetc:
sta ptr1
stx ptr1+1
@@ -22,7 +20,7 @@ _fgetc:
jsr checkferror
bne ret_eof
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_BITIMM)
bit #_FPUSHBACK ; Check for pushed back char
beq do_read
.else

View File

@@ -14,12 +14,10 @@
.include "stdio.inc"
.include "_file.inc"
.macpack cpu
terminate_ptr:
lda #$00
tax
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_ZPIND)
sta (ptr4)
.else
tay
@@ -41,7 +39,7 @@ _fgets:
sta buf
stx buf+1
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_STZ)
stz didread
.else
lda #$00 ; We have read nothing yet
@@ -79,7 +77,7 @@ read_loop:
ldy #$01
sty didread ; We read at least one char
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_ZPIND)
sta (ptr4)
.else
dey

View File

@@ -20,7 +20,6 @@
.include "_file.inc"
.macpack generic
.macpack cpu
; ------------------------------------------------------------------------
; Code
@@ -48,7 +47,7 @@
ldy #_FILE::f_flags
lda (file),y
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_BITIMM)
bit #_FOPEN ; Is the file open?
.else
and #_FOPEN ; Is the file open?
@@ -57,7 +56,7 @@
; Check if the stream is in an error state
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_BITIMM)
bit #_FERROR
.else
lda (file),y ; get file->f_flags again
@@ -74,17 +73,15 @@
; Remember if we have a pushed back character and reset the flag.
@L2: .if (.cpu .bitand ::CPU_ISET_65SC02)
@L2: .if .cap(CPU_HAS_BITIMM)
ldx #$00
bit #_FPUSHBACK
beq @L3
.else
tax ; X = 0
lda (file),y
and #_FPUSHBACK
.endif
beq @L3
.if (.not .cpu .bitand ::CPU_ISET_65SC02)
lda (file),y
.endif
and #<~_FPUSHBACK
@@ -135,7 +132,7 @@
; Copy the buffer pointer into ptr1, and increment the pointer value passed
; to read() by one, so read() starts to store data at buf+1.
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_ZPIND)
lda (c_sp)
sta ptr1
add #1
@@ -159,7 +156,7 @@
ldy #_FILE::f_pushback
lda (file),y
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_ZPIND)
sta (ptr1) ; *buf = file->f_pushback;
.else
ldy #0

View File

@@ -16,8 +16,6 @@
.include "errno.inc"
.include "_file.inc"
.macpack cpu
; ------------------------------------------------------------------------
; Code
@@ -34,7 +32,7 @@
ldy #_FILE::f_flags
lda (ptr1),y
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_BITIMM)
bit #_FOPEN
.else
and #_FOPEN ; Is the file open?
@@ -50,7 +48,7 @@
; Check if the stream is in an error state
@L2: .if (.not .cpu .bitand ::CPU_ISET_65SC02)
@L2: .if .not .cap(CPU_HAS_BITIMM)
lda (ptr1),y ; get file->f_flags again
.endif
and #_FERROR

View File

@@ -29,7 +29,7 @@ int optopt; /* character checked for validity */
char *optarg; /* argument associated with option */
#define tell(s) fputs(*argv,stderr);fputs(s,stderr); \
fputc(optopt,stderr);fputc('\n',stderr);return(BADCH);
fputc(optopt,stderr);fputc('\n',stderr);return(BADCH)
int __fastcall__ getopt (int argc, char* const* argv, const char* optstring)
/* Get option letter from argument vector */

View File

@@ -10,8 +10,6 @@
.import __hextab, __longminstr
.importzp sreg, ptr1, ptr2, ptr3, tmp1
.macpack cpu
.code
;
@@ -64,7 +62,7 @@ L2: txa ; get high byte
bpl ultoa
lda #'-'
.if (.cpu .bitand CPU_ISET_65SC02)
.if .cap(CPU_HAS_ZPIND)
sta (ptr2)
.else
ldy #0

View File

@@ -8,7 +8,6 @@
.export _strcat
.import popax
.importzp ptr1, ptr2, tmp3
.macpack cpu
_strcat:
sta ptr1 ; Save src
@@ -16,7 +15,7 @@ _strcat:
jsr popax ; Get dest
sta tmp3 ; Remember for function return
tay
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_STZ)
stz ptr2
.else
lda #0

View File

@@ -8,14 +8,13 @@
.export _strchr
.import popax
.importzp ptr1, tmp1
.macpack cpu
_strchr:
sta tmp1 ; Save c
jsr popax ; get s
tay ; low byte of pointer to y
stx ptr1+1
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_STZ)
stz ptr1
.else
lda #0

View File

@@ -12,8 +12,6 @@
.import _strlen_ptr4, _malloc, _memcpy, pushax
.export _strdup
.macpack cpu
_strdup:
; Get length (and store source in ptr4)
sta ptr4
@@ -22,7 +20,7 @@ _strdup:
jsr _strlen_ptr4 ; strlen may increment
; Add null byte for terminator
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_INA)
inc a
.else
clc

View File

@@ -10,7 +10,6 @@
.export _strlen, _strlen_ptr4
.importzp ptr4
.macpack cpu
_strlen:
sta ptr4 ; Save s

View File

@@ -8,64 +8,63 @@
.export _strncat
.import popax, popptr1
.importzp ptr1, ptr2, ptr3, tmp1, tmp2
.macpack cpu
_strncat:
inx
stx tmp2
tax
inx
stx tmp1 ; save count with each byte incremented separately
inx
stx tmp2
tax
inx
stx tmp1 ; save count with each byte incremented separately
jsr popptr1 ; get src
jsr popptr1 ; get src
jsr popax ; get dest
sta ptr3 ; remember for function return
stx ptr3+1
stx ptr2+1
tay ; low byte as offset in Y
.if (.cpu .bitand ::CPU_ISET_65SC02)
stz ptr2
jsr popax ; get dest
sta ptr3 ; remember for function return
stx ptr3+1
stx ptr2+1
tay ; low byte as offset in Y
.if .cap(CPU_HAS_STZ)
stz ptr2
.else
ldx #0
stx ptr2 ; destination on page boundary
ldx #0
stx ptr2 ; destination on page boundary
.endif
; find end of dest
L1: lda (ptr2),y
beq L2
iny
bne L1
inc ptr2+1
bne L1
L1: lda (ptr2),y
beq L2
iny
bne L1
inc ptr2+1
bne L1
; end found, apply offset to dest ptr and reset y
L2: sty ptr2
L2: sty ptr2
; copy src. We've put the ones complement of the count into the counter, so
; we'll increment the counter on top of the loop
L3: ldy #0
ldx tmp1 ; low counter byte
L3: ldy #0
ldx tmp1 ; low counter byte
L4: dex
bne L5
dec tmp2
beq L6 ; jump if done
L5: lda (ptr1),y
sta (ptr2),y
beq L7
iny
bne L4
inc ptr1+1
inc ptr2+1
bne L4
L4: dex
bne L5
dec tmp2
beq L6 ; jump if done
L5: lda (ptr1),y
sta (ptr2),y
beq L7
iny
bne L4
inc ptr1+1
inc ptr2+1
bne L4
; done, set the trailing zero and return pointer to dest
L6: lda #0
sta (ptr2),y
L7: lda ptr3
ldx ptr3+1
rts
L6: lda #0
sta (ptr2),y
L7: lda ptr3
ldx ptr3+1
rts

53
libsrc/common/strndup.s Normal file
View File

@@ -0,0 +1,53 @@
;
; Colin Leroy-Mira, 03.07.2025
;
; char* __fastcall__ strndup (const char* S, size_t maxlen);
;
.importzp tmp1, tmp2, ptr2
.import _strncpy, _strlen, _malloc
.import pushax, popax, incsp2, incax1, swapstk
.import ___errno
.export _strndup
.include "errno.inc"
.proc _strndup
sta tmp1 ; Remember maxlen
stx tmp1+1
jsr popax ; Get string
jsr pushax ; Keep it in TOS
jsr _strlen ; Get string length,
cpx tmp1+1 ; Compare to max,
bcc alloc
bne :+
cmp tmp1
bcc alloc
: lda tmp1 ; Use maxlen if shorter
ldx tmp1+1
alloc: jsr incax1 ; Add 1 for terminator
jsr _malloc ; Allocate output
cpx #$00 ; Check allocation
beq errmem
jsr swapstk ; Put dest in TOS and get string back
jsr pushax ; Put src in TOS
lda tmp1 ; Get length for strncpy
ldx tmp1+1
jsr _strncpy ; Copy
pha ; Terminate
lda #$00
sta (ptr2),y
pla
rts
errmem: ldy #ENOMEM
sty ___errno
jmp incsp2 ; Pop string and return
.endproc

View File

@@ -8,13 +8,12 @@
.export _cputsxy, _cputs
.import gotoxy, _cputc
.importzp ptr1, tmp1
.macpack cpu
_cputsxy:
sta ptr1 ; Save s for later
stx ptr1+1
jsr gotoxy ; Set cursor, pop x and y
.if (.cpu .bitand CPU_ISET_65SC02)
.if .cap(CPU_HAS_BRA8)
bra L0 ; Same as cputs...
.else
jmp L0 ; Same as cputs...
@@ -23,8 +22,12 @@ _cputsxy:
_cputs: sta ptr1 ; Save s
stx ptr1+1
; Important note: The implementation below relies on the _cputc() function not
; clobbering ptr1. This might not be the case when rewriting this function so
; beware!
L0:
.if (.cpu .bitand CPU_ISET_65SC02)
.if .cap(CPU_HAS_ZPIND)
lda (ptr1) ; (5)
.else
ldy #0 ; (2)

View File

@@ -10,8 +10,6 @@
.import screensize
.importzp ptr1, ptr2
.macpack cpu
.proc _screensize
sta ptr2 ; Store the y pointer
@@ -20,7 +18,7 @@
jsr screensize ; Get screensize into X/Y
tya ; Get Y size into A
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_ZPIND)
sta (ptr2)
txa
sta (ptr1)

View File

@@ -10,7 +10,6 @@
.importzp c_sp, ptr1, ptr2, ptr3, tmp1
.macpack generic
.macpack cpu
.data
@@ -74,7 +73,7 @@ out: jsr popax ; count
; Loop outputting characters
.if (.cpu .bitand CPU_ISET_65SC02)
.if .cap(CPU_HAS_ZPIND, CPU_HAS_BRA8)
@L1: dec outdesc+6
beq @L4

View File

@@ -5,6 +5,8 @@
; void cputcxy (unsigned char x, unsigned char y, char c);
; void cputc (char c);
;
; Important note: The implementation of cputs() relies on the cputc() function
; not clobbering ptr1. Beware when rewriting or changing this function!
.export _cputcxy, _cputc, cputdirect, putchar
.export newline

View File

@@ -4,6 +4,8 @@
; void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);
; void __fastcall__ cputc (char c);
;
; Important note: The implementation of cputs() relies on the cputc() function
; not clobbering ptr1. Beware when rewriting or changing this function!
.export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot

View File

@@ -332,7 +332,7 @@ BreakPoint DbgBreaks [MAX_USERBREAKS+2];
BreakPoint* DbgGetBreakSlot (void);
/* Search for a free breakpoint slot. Return a pointer to the slot or 0 */
BreakPoint* DbgIsBreak (unsigned Addr);
BreakPoint* __cdecl__ DbgIsBreak (unsigned Addr);
/* Check if there is a user breakpoint at the given address, if so, return
** a pointer to the slot, else return 0.
*/

View File

@@ -2,6 +2,8 @@
; void cputcxy (unsigned char x, unsigned char y, char c);
; void cputc (char c);
;
; Important note: The implementation of cputs() relies on the cputc() function
; not clobbering ptr1. Beware when rewriting or changing this function!
.export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot

View File

@@ -21,6 +21,9 @@
; note that there are conflicts between control characters and keyboard:
; HOME = KEY_ENTER, KEY_HOME = REV_ON,
; UPLINE = ?, KEY_UPARROW = GOTOY, ...
;
; Important note: The implementation of cputs() relies on the cputc() function
; not clobbering ptr1. Beware when rewriting or changing this function!
.export _cputcxy, _cputc
.import gotoxy, fixcursor

View File

@@ -4,6 +4,8 @@
; void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);
; void __fastcall__ cputc (char c);
;
; Important note: The implementation of cputs() relies on the cputc() function
; not clobbering ptr1. Beware when rewriting or changing this function!
.export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot

View File

@@ -1,5 +1,15 @@
;
; Oliver Schmidt, 2012-09-30
; Stefan Haubenthal, 2023-01-16
;
.exportzp ST := $90 ; IEC status byte
.export initst
.include "mega65.inc"
.proc initst
lda #$00
sta STATUS
rts
.endproc

View File

@@ -5,6 +5,8 @@
; void cputcxy (unsigned char x, unsigned char y, char c);
; void cputc (char c);
;
; Important note: The implementation of cputs() relies on the cputc() function
; not clobbering ptr1. Beware when rewriting or changing this function!
.export _cputcxy, _cputc, cputdirect, putchar
.export newline

View File

@@ -2,6 +2,8 @@
; void cputcxy (unsigned char x, unsigned char y, char c);
; void cputc (char c);
;
; Important note: The implementation of cputs() relies on the cputc() function
; not clobbering ptr1. Beware when rewriting or changing this function!
.export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot

View File

@@ -6,12 +6,12 @@
;
.export checkst
.importzp ST
.include "pet.inc"
.proc checkst
lda ST
lda STATUS
beq @L1
lda #5 ; ### Device not present
sec

View File

@@ -4,6 +4,8 @@
; void cputcxy (unsigned char x, unsigned char y, char c);
; void cputc (char c);
;
; Important note: The implementation of cputs() relies on the cputc() function
; not clobbering ptr1. Beware when rewriting or changing this function!
.export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot

View File

@@ -8,7 +8,6 @@
.import zerobss, push0
.import callmain
.import CLRCH, BSOUT
.importzp ST
.include "zeropage.inc"
.include "pet.inc"
@@ -80,7 +79,7 @@ L2: lda zpsave,x
; Store the program return code into BASIC's status variable.
pla
sta ST
sta STATUS
; Restore the stack pointer.

View File

@@ -5,14 +5,12 @@
;
.export READST
.importzp ST
.include "pet.inc"
.proc READST
lda ST
lda STATUS
rts
.endproc

View File

@@ -1,5 +1,15 @@
;
; Oliver Schmidt, 2012-09-30
; Stefan Haubenthal, 2023-01-16
;
.exportzp ST := $96 ; IEC status byte
.export initst
.include "pet.inc"
.proc initst
lda #$00
sta STATUS
rts
.endproc

View File

@@ -4,6 +4,8 @@
; void cputcxy (unsigned char x, unsigned char y, char c);
; void cputc (char c);
;
; Important note: The implementation of cputs() relies on the cputc() function
; not clobbering ptr1. Beware when rewriting or changing this function!
.export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot

View File

@@ -10,7 +10,6 @@
.import callmain, zerobss
.import __INTERRUPTOR_COUNT__
.import __HIMEM__ ; Linker generated
.importzp ST
.include "zeropage.inc"
.include "plus4.inc"
@@ -121,7 +120,7 @@ L2: lda zpsave,x
; Place the program return code into BASIC's status variable.
pla
sta ST
sta STATUS
; Restore the stack pointer.

View File

@@ -7,12 +7,11 @@
.export READST
.include "plus4.inc"
.importzp ST
; Read the status byte from the zero page instead of banking in the ROM
.proc READST
lda ST ; Load status
lda STATUS ; Load status
rts ; Return to caller
.endproc

View File

@@ -1,5 +1,15 @@
;
; Oliver Schmidt, 2012-09-30
; Stefan Haubenthal, 2023-01-16
;
.exportzp ST := $90 ; IEC status byte
.export initst
.include "plus4.inc"
.proc initst
lda #$00
sta STATUS
rts
.endproc

View File

@@ -11,14 +11,12 @@
.export tosadda0, tosaddax
.importzp c_sp, tmp1
.macpack cpu
tosadda0:
ldx #0
tosaddax:
clc ; (2)
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_ZPIND)
adc (c_sp) ; (7)
tay ; (9)

View File

@@ -8,12 +8,10 @@
.import addysp1
.importzp c_sp, ptr4
.macpack cpu
tosanda0:
ldx #$00
tosandax:
.if (.cpu .bitand CPU_ISET_65SC02)
.if .cap(CPU_HAS_ZPIND)
and (c_sp) ; 65SC02 version, saves 2 cycles and 1 byte
ldy #1
.else

View File

@@ -18,8 +18,6 @@
.import __CONSTRUCTOR_TABLE__, __CONSTRUCTOR_COUNT__
.import __DESTRUCTOR_TABLE__, __DESTRUCTOR_COUNT__
.macpack cpu
; --------------------------------------------------------------------------
; Initialize library modules

View File

@@ -7,11 +7,10 @@
.export incax1
.macpack generic
.macpack cpu
.proc incax1
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_INA)
ina ; 65C02 version
bne @L9
.else

View File

@@ -7,8 +7,6 @@
.export popax, incsp2
.importzp c_sp
.macpack cpu
; Pop a/x from stack. This function will run directly into incsp2
.proc popax
@@ -16,7 +14,7 @@
ldy #1
lda (c_sp),y ; get hi byte
tax ; into x
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_ZPIND)
lda (c_sp) ; get lo byte
.else
dey

View File

@@ -8,8 +8,6 @@
.import addysp1
.importzp c_sp, sreg, tmp1
.macpack cpu
; EAX = TOS + EAX
tosadd0ax:
@@ -19,7 +17,7 @@ tosadd0ax:
tosaddeax:
clc
.if (.cpu .bitand CPU_ISET_65SC02)
.if .cap(CPU_HAS_ZPIND)
adc (c_sp) ; 65SC02 version - saves 2 cycles
ldy #1
.else

View File

@@ -11,8 +11,6 @@
.export laddeq1, laddeqa, laddeq
.importzp sreg, ptr1, tmp1
.macpack cpu
laddeq1:
lda #$01
@@ -24,7 +22,7 @@ laddeqa:
laddeq: sty ptr1+1 ; Store high byte of address
clc
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_ZPIND)
adc (ptr1)
sta (ptr1)
ldy #$01 ; Address byte 1

View File

@@ -9,10 +9,8 @@
.import addysp1
.importzp c_sp, sreg, tmp1
.macpack cpu
tosand0ax:
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_STZ)
stz sreg
stz sreg+1
.else
@@ -22,7 +20,7 @@ tosand0ax:
.endif
tosandeax:
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_ZPIND)
and (c_sp) ; byte 0
ldy #1
.else

View File

@@ -7,8 +7,6 @@
.export ldau00sp, ldau0ysp
.importzp c_sp, ptr1
.macpack cpu
ldau00sp:
ldy #1
ldau0ysp:
@@ -18,7 +16,7 @@ ldau0ysp:
lda (c_sp),y
sta ptr1
ldx #0
.if (.cpu .bitand CPU_ISET_65SC02)
.if .cap(CPU_HAS_ZPIND)
lda (ptr1) ; Save one cycle for the C02
.else
lda (ptr1,x)

20
libsrc/runtime/ldptr1sp.s Normal file
View File

@@ -0,0 +1,20 @@
;
; Colin Leroy-Mira, 2025-07-26
;
; CC65 runtime: Load ptr1 from offset in stack
;
.export ldptr10sp, ldptr1ysp
.importzp c_sp, ptr1
; Beware: The optimizer knows about the value in Y after return!
ldptr10sp:
ldy #1
ldptr1ysp:
lda (c_sp),y ; get high byte
sta ptr1+1 ; and save it
dey ; point to lo byte
lda (c_sp),y ; load low byte
sta ptr1
rts

View File

@@ -14,8 +14,6 @@
.import addysp
.importzp c_sp
.macpack cpu
leave00:
lda #0
leave0: ldx #0
@@ -28,7 +26,7 @@ leavey0:
leavey:
jsr addysp ; drop stack frame
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_ZPIND)
leave: tay ; save A a sec
lda (c_sp) ; that's the pushed arg size

View File

@@ -11,10 +11,8 @@
.import poplsargs, udiv32, negeax
.importzp sreg, ptr1, ptr2, tmp1, tmp3, tmp4
.macpack cpu
tosmod0ax:
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_STZ)
stz sreg
stz sreg+1
.else

View File

@@ -9,11 +9,9 @@
.import addysp1
.importzp c_sp, sreg, tmp1, tmp2, tmp3, tmp4, ptr1, ptr3, ptr4
.macpack cpu
tosmul0ax:
tosumul0ax:
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_STZ)
stz sreg
stz sreg+1
.else
@@ -26,7 +24,7 @@ tosmuleax:
tosumuleax:
mul32: sta ptr1
stx ptr1+1 ; op2 now in ptr1/sreg
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_ZPIND)
lda (c_sp)
ldy #1
.else

View File

@@ -9,10 +9,8 @@
.import addysp1
.importzp c_sp, sreg, tmp1
.macpack cpu
tosor0ax:
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_STZ)
stz sreg
stz sreg+1
.else
@@ -22,7 +20,7 @@ tosor0ax:
.endif
tosoreax:
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_ZPIND)
ora (c_sp)
ldy #1
.else

View File

@@ -9,8 +9,6 @@
.import incsp4
.importzp c_sp, sreg
.macpack cpu
popeax: ldy #3
lda (c_sp),y
sta sreg+1
@@ -20,7 +18,7 @@ popeax: ldy #3
dey
lda (c_sp),y
tax
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_ZPIND)
lda (c_sp)
.else
dey

View File

@@ -12,13 +12,11 @@
.import decsp4
.importzp c_sp, sreg
.macpack cpu
pushl0:
lda #0
tax
push0ax:
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_STZ)
stz sreg
stz sreg+1
.else
@@ -39,7 +37,7 @@ pusheax:
txa
sta (c_sp),y
pla
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_ZPIND)
sta (c_sp)
.else
dey

View File

@@ -12,10 +12,8 @@
.import addysp1
.importzp c_sp, sreg, tmp1
.macpack cpu
tosrsub0ax:
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_STZ)
stz sreg
stz sreg+1
.else
@@ -26,7 +24,7 @@ tosrsub0ax:
tosrsubeax:
sec
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_ZPIND)
sbc (c_sp)
ldy #1
.else

View File

@@ -11,10 +11,8 @@
.import addysp1
.importzp c_sp, sreg
.macpack cpu
tossub0ax:
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_STZ)
stz sreg
stz sreg+1
.else
@@ -26,7 +24,7 @@ tossub0ax:
tossubeax:
sec
eor #$FF
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_ZPIND)
adc (c_sp) ; 65SC02 version - saves 2 cycles
ldy #1
.else

View File

@@ -11,8 +11,6 @@
.export lsubeq1, lsubeqa, lsubeq
.importzp sreg, ptr1
.macpack cpu
lsubeq1:
lda #$01
@@ -25,7 +23,7 @@ lsubeq: sty ptr1+1 ; Store high byte of address
sec
eor #$FF
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_ZPIND)
adc (ptr1) ; Subtract byte 0
sta (ptr1)
ldy #$01 ; Address byte 1

View File

@@ -9,10 +9,8 @@
.import addysp1
.importzp c_sp, sreg, tmp3, tmp4, ptr1, ptr2, ptr3, ptr4
.macpack cpu
tosudiv0ax:
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_STZ)
stz sreg
stz sreg+1
.else
@@ -38,7 +36,7 @@ getlop: sta ptr3 ; Put right operand in place
lda sreg+1
sta ptr4+1
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_ZPIND)
lda (c_sp)
ldy #1
.else

View File

@@ -9,10 +9,8 @@
.import getlop, udiv32
.importzp sreg, tmp3, tmp4, ptr2
.macpack cpu
tosumod0ax:
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_STZ)
stz sreg
stz sreg+1
.else

View File

@@ -9,10 +9,8 @@
.import addysp1
.importzp c_sp, sreg, tmp1
.macpack cpu
tosxor0ax:
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_STZ)
stz sreg
stz sreg+1
.else
@@ -22,7 +20,7 @@ tosxor0ax:
.endif
tosxoreax:
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_ZPIND)
eor (c_sp) ; byte 0
ldy #1
.else

View File

@@ -9,12 +9,10 @@
.import addysp1
.importzp c_sp, tmp1
.macpack cpu
tosora0:
ldx #$00
tosorax:
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_ZPIND)
ora (c_sp)
ldy #1
.else

View File

@@ -7,11 +7,9 @@
.export popa
.importzp c_sp
.macpack cpu
.proc popa
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_ZPIND)
lda (c_sp)
.else
ldy #0 ; (2)

View File

@@ -8,14 +8,12 @@
.import incsp2
.importzp c_sp, ptr1
.macpack cpu
.proc popptr1 ; 14 bytes (four usages = at least 2 bytes saved)
ldy #1
lda (c_sp),y ; get hi byte
sta ptr1+1 ; into ptr hi
dey ; dey even for for 65C02 here to have Y=0 at exit!
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_ZPIND)
lda (c_sp) ; get lo byte
.else
lda (c_sp),y ; get lo byte

View File

@@ -8,14 +8,12 @@
.import incsp2
.importzp c_sp, sreg
.macpack cpu
popsreg:
pha ; save A
ldy #1
lda (c_sp),y ; get hi byte
sta sreg+1 ; store it
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_ZPIND)
lda (c_sp) ; get lo byte
.else
dey

View File

@@ -7,8 +7,6 @@
.export pusha0sp, pushaysp, pusha
.importzp c_sp
.macpack cpu
; Beware: The optimizer knows about this function!
pusha0sp:

View File

@@ -7,8 +7,6 @@
.export push0, pusha0, pushax
.importzp c_sp
.macpack cpu
push0: lda #0
pusha0: ldx #0
@@ -31,7 +29,7 @@ pusha0: ldx #0
sta (c_sp),y ; (27)
pla ; (31)
dey ; (33)
.if (.cpu .bitand ::CPU_ISET_65SC02)
.if .cap(CPU_HAS_ZPIND)
sta (c_sp) ; (37)
.else
sta (c_sp),y ; (38)

View File

@@ -8,8 +8,6 @@
.import pushax
.importzp ptr1
.macpack cpu
pushbidx:
sty ptr1
clc
@@ -19,7 +17,7 @@ pushbidx:
pushb: sta ptr1
stx ptr1+1
ldx #0 ; Load index/high byte
.if (.cpu .bitand CPU_ISET_65SC02)
.if .cap(CPU_HAS_ZPIND)
lda (ptr1) ; Save one cycle for the C02
.else
lda (ptr1,x)

View File

@@ -9,8 +9,6 @@
.import addysp1
.importzp c_sp, tmp1
.macpack cpu
;
; AX = AX - TOS
;
@@ -19,7 +17,7 @@ tosrsuba0:
ldx #0
tosrsubax:
sec
.if (.cpu .bitand CPU_ISET_65SC02)
.if .cap(CPU_HAS_ZPIND)
sbc (c_sp)
ldy #1
.else

Some files were not shown because too many files have changed in this diff Show More