From b701f2477c2f048fbba8416b3aacd57c303b4a0e Mon Sep 17 00:00:00 2001 From: Curtis F Kaylor Date: Sun, 24 Mar 2019 16:29:19 -0400 Subject: [PATCH] Cleaned up module stddef --- doc/stddef.txt | 26 +++++++++++++++++++------- include/stddef.a02 | 16 +--------------- include/stddef.h02 | 40 +++++++++++++++++++++------------------- 3 files changed, 41 insertions(+), 41 deletions(-) diff --git a/doc/stddef.txt b/doc/stddef.txt index 5e699d9..b98e15e 100644 --- a/doc/stddef.txt +++ b/doc/stddef.txt @@ -105,17 +105,29 @@ The following functions are defined: the setdst function, copying temp1 and temp2 to dstlo and dsthi, respectively. + addzpw(z,&n); Adds the 16 bit value &n to the zero page word + with address z. + + Note: Stores the zero page address in temp3. + + adddst(&n); Adds the 16 bit value &n to the destination + pointer. + + Note: Calls the addzpw function, passing dstlo + as the first argument. + + addsrc(&n); Adds the 16 bit value &n to the source pointer. + + Note: Calls the addzpw function, passing srclo + as the first argument. + Note: This library expects the following to be defined: the zero page variables - srclo,srchi: Source pointer - dstlo,dsthi: Destination pointer + srclo,srchi Source pointer + dstlo,dsthi Destination pointer and the transient variables - temp0 Temporary storage - temp1 - temp2 - - + temp0,temp1,temp2 Temporary storage diff --git a/include/stddef.a02 b/include/stddef.a02 index f5b7420..e94ee94 100644 --- a/include/stddef.a02 +++ b/include/stddef.a02 @@ -12,7 +12,7 @@ FALSE EQU $00 ;by some Library Routines SAVDST: JSR GETDST ;Load Destination Pointer JMP SAVRXY ;Save X & Y Registers -;savdst() - Save Destination Pointer +;savsrc() - Save Source Pointer SAVSRC: JSR GETSRC ;Load Destination Pointer JMP SAVRXY ;Save X & Y Registers @@ -63,17 +63,3 @@ GETSRC: LDX SRCLO LDY SRCHI RTS -;Add to Destination Address -ADDDST: LDX #DSTLO ;Set Index - BNE ADDZPW ;and Execute ADDZPW - -;Add to Source Address -ADDSRC: LDX #SRCLO ;Set Index and Drop into ADDZPW - -;Add to Zero Page Word -ADDZPW: CLC ;Clear Carry - ADC 0,X ;Add Argument to LSB - STA 0,X ;and Save Result - BCC ADDZPX ;If Carry - INC 1,X ; Increment MSB -ADDZPX: RTS diff --git a/include/stddef.h02 b/include/stddef.h02 index b45690f..d8ad456 100644 --- a/include/stddef.h02 +++ b/include/stddef.h02 @@ -6,32 +6,33 @@ #define TRUE $FF #define FALSE $00 -/* Get Buffer Pointer * - * Returns: Y,X=Buffer address */ -char getdst(); - /* Get Destination Pointer * * Returns: Y,X=Destination address */ -char getdst(); +int getdst(); /* Get Source Pointer * * Returns: Y,X=Source address */ -char getsrc(); +int getsrc(); -/* Retore Destination Pointer */ -void resdst(); +/* Restore Destination Pointer * + * Returns: Y,X=Destination address */ +int resdst(); -/* Restore A, X, and Y Registers */ -void resreg(); +/* Restore A, X, and Y Registers * + * Returns: A,Y,X=Saved Values */ +char resreg(); -/* Restore X, and Y Registers */ -void resrxy(); +/* Restore X, and Y Registers * + * Returns: Y,X=Saved Values */ +int resrxy(); -/* Retore Source Pointer */ -void ressrc(); +/* Restore Source Pointer * + * Returns: Y,X=Source address */ +int ressrc(); -/* Save Destination Pointer */ -void savdst(); +/* Save Destination Pointer * + * Returns: Y,X=Destination address */ +int savdst(); /* Save A, X, and Y Registers */ void savreg(); @@ -39,15 +40,16 @@ void savreg(); /* Save X, and Y Registers */ void savrxy(); -/* Save Source Pointer */ -void savsrc(); +/* Save Source Pointer * + * Returns: Y,X=Source address */ +int savsrc(); /* Set Buffer Pointer * * Args: &d - Buffer address */ void setbfr(); /* Set Destination Pointer to Source Pointer */ -void setdss(); +int setdss(); /* Set Destination Pointer * * Args: &d - Destination address */