mirror of
https://github.com/RevCurtisP/C02.git
synced 2024-09-26 22:57:09 +00:00
Updates to STDDEF module
This commit is contained in:
parent
9dc0c5bbb8
commit
7840c5f091
@ -62,6 +62,11 @@ SETSRC: STX SRCPTR ;Store Source Pointer
|
|||||||
LDY #$00 ;Initialize Index Into String
|
LDY #$00 ;Initialize Index Into String
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
|
;Set List Pointer
|
||||||
|
SETLST: STX LSTPTR
|
||||||
|
STY LSTPTR+1
|
||||||
|
RTS
|
||||||
|
|
||||||
;Retrieve System Buffer Address
|
;Retrieve System Buffer Address
|
||||||
GETBFR: LDX #<SYSBFR
|
GETBFR: LDX #<SYSBFR
|
||||||
LDY #>SYSBFR
|
LDY #>SYSBFR
|
||||||
@ -80,6 +85,16 @@ GETSRC: LDX SRCPTR
|
|||||||
CLV ;Clear Overflow Flag for BVC
|
CLV ;Clear Overflow Flag for BVC
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
|
;Retrieve String List Pointer
|
||||||
|
GETLST: LDX LSTPTR
|
||||||
|
LDY LSTPTR+1
|
||||||
|
RTS
|
||||||
|
|
||||||
|
;Add Byte A to Word YX
|
||||||
|
ADDAYX: JSR SAVRXY; ;Store X,Y in TEMP1, TEMP2
|
||||||
|
TAX ;Set Y,X to 0,A
|
||||||
|
LDY #0 ;and Execute ADDTXY
|
||||||
|
|
||||||
;Add TEMP1,TEMP2 to X,Y
|
;Add TEMP1,TEMP2 to X,Y
|
||||||
ADDTXY: TXA
|
ADDTXY: TXA
|
||||||
CLC
|
CLC
|
||||||
@ -90,6 +105,11 @@ ADDTXY: TXA
|
|||||||
TAY
|
TAY
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
|
;Add Byte A to Word YX
|
||||||
|
SUBAYX: STA TEMP1 ;Set LSB to A
|
||||||
|
LDA #0 ; MSB to 0
|
||||||
|
STA TEMP2 ;and Execute SUBTXY
|
||||||
|
|
||||||
;Subtract TEMP1,TEMP2 from X,Y
|
;Subtract TEMP1,TEMP2 from X,Y
|
||||||
SUBTXY: TXA
|
SUBTXY: TXA
|
||||||
SEC
|
SEC
|
||||||
@ -100,6 +120,20 @@ SUBTXY: TXA
|
|||||||
TAY
|
TAY
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
|
|
||||||
|
;Subtract X,Y from TEMP1, TEMP2
|
||||||
|
;NOT CURRENTLY USED ANYWHERE
|
||||||
|
;SUBXYT: LDA TEMP1 ;Get TEMP1
|
||||||
|
; STX TEMP1 ;
|
||||||
|
; SEC ;
|
||||||
|
; SBC TEMP1 ;Subtract X
|
||||||
|
; TAX ;and Store in X
|
||||||
|
; LDA TEMP2 ;Get TEMP2
|
||||||
|
; STY TEMP2
|
||||||
|
; SBC TEMP2 ;Subtract Y
|
||||||
|
; TAY ;and Store in Y
|
||||||
|
; RTS
|
||||||
|
|
||||||
;Decrement X,Y Register Pair
|
;Decrement X,Y Register Pair
|
||||||
DECRXY: CPY #0
|
DECRXY: CPY #0
|
||||||
BNE .SKIP
|
BNE .SKIP
|
||||||
@ -132,6 +166,12 @@ SETSBP: LDA SYSBFP ;Load Position in Buffer
|
|||||||
BMI .RETURN ;If Greater than 127, Return
|
BMI .RETURN ;If Greater than 127, Return
|
||||||
JSR SETSRB ;Set Source Pointer to Buffer Address
|
JSR SETSRB ;Set Source Pointer to Buffer Address
|
||||||
|
|
||||||
|
;Add Accumulator to Zero Page Word
|
||||||
|
;Args: A = Bytre to Add
|
||||||
|
; X = Address of Zero Page Word
|
||||||
|
ADDZPA: LDY #0 ;Set MSB to 0
|
||||||
|
BEQ .ADDZPX ;and add Accumulator
|
||||||
|
|
||||||
;Add Accumulator to Source Address
|
;Add Accumulator to Source Address
|
||||||
ADDSRA: TAX ;Move Accumulator to Argument LSB
|
ADDSRA: TAX ;Move Accumulator to Argument LSB
|
||||||
LDY #0 ;Clear Argument MSB
|
LDY #0 ;Clear Argument MSB
|
||||||
@ -144,12 +184,12 @@ ADDSRC: LDA #SRCPTR ;Set Index and Drop into ADDZPW
|
|||||||
;Add to Zero Page Word
|
;Add to Zero Page Word
|
||||||
;Args: A = Address of Zero Page Word
|
;Args: A = Address of Zero Page Word
|
||||||
; Y,X = MSB,LSB of Integer to Add
|
; Y,X = MSB,LSB of Integer to Add
|
||||||
;Affects: A
|
;Affects: A,X,C,N,Z
|
||||||
ADDZPW: STA TEMP3 ;Save Zero Page Address
|
ADDZPW: CLC ;Clear Carry
|
||||||
|
ADCZPW: STA TEMP3 ;Save Zero Page Address
|
||||||
TXA ;Move Argument LSB to Accumulator
|
TXA ;Move Argument LSB to Accumulator
|
||||||
LDX TEMP3 ;Set Index to Zero Page Address
|
LDX TEMP3 ;Set Index to Zero Page Address
|
||||||
CLC ;Clear Carry
|
.ADDZPX ADC 0,X ;Add Argument LSB to Target LSB
|
||||||
ADC 0,X ;Add Argument LSB to Target LSB
|
|
||||||
STA 0,X ;and Save Result
|
STA 0,X ;and Save Result
|
||||||
TYA ;Move Argument MSB to Accumulator
|
TYA ;Move Argument MSB to Accumulator
|
||||||
ADC 1,X ;Add Argument MSB to Target MSB
|
ADC 1,X ;Add Argument MSB to Target MSB
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
* functions used in libraries. */
|
* functions used in libraries. */
|
||||||
|
|
||||||
/* Constant Definitions */
|
/* Constant Definitions */
|
||||||
|
#define STRSIZ 128
|
||||||
#define TRUE $FF
|
#define TRUE $FF
|
||||||
#define FALSE $00
|
#define FALSE $00
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user