From 5289bb871777a6f3b6472f157dfe0aa4fda3cc6e Mon Sep 17 00:00:00 2001 From: Curtis F Kaylor Date: Fri, 22 Mar 2019 20:30:49 -0400 Subject: [PATCH] Added functions to stddef module --- include/stddef.a02 | 17 ++++++++++++++++- include/stddef.h02 | 12 ++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/include/stddef.a02 b/include/stddef.a02 index 4b7982c..f5b7420 100644 --- a/include/stddef.a02 +++ b/include/stddef.a02 @@ -28,7 +28,7 @@ RESRXY: LDX TEMP1 ;Load X Index LDY TEMP2 ;Load Y Index RTS -;Set Destinatioon Pointer to Source Pointer +;Set Destination Pointer to Source Pointer SETDSS: JSR GETSRC ;Get Destination Pointer JMP SETDST ;Store in Source Pointer @@ -62,3 +62,18 @@ GETDST: LDX DSTLO 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 5bc4f6f..b45690f 100644 --- a/include/stddef.h02 +++ b/include/stddef.h02 @@ -6,13 +6,17 @@ #define TRUE $FF #define FALSE $00 +/* Get Buffer Pointer * + * Returns: Y,X=Buffer address */ +char getdst(); + /* Get Destination Pointer * * Returns: Y,X=Destination address */ -void getdst(); +char getdst(); /* Get Source Pointer * * Returns: Y,X=Source address */ -void getsrc(); +char getsrc(); /* Retore Destination Pointer */ void resdst(); @@ -38,6 +42,10 @@ void savrxy(); /* Save Source Pointer */ void savsrc(); +/* Set Buffer Pointer * + * Args: &d - Buffer address */ +void setbfr(); + /* Set Destination Pointer to Source Pointer */ void setdss();