mirror of
https://github.com/nathanriggs/AppleIIAsm-Collection.git
synced 2024-11-27 12:49:27 +00:00
875dd80998
- fixed a bunch of bugs - separated common and stdio libraries - commenting upgrades - created min versions of each library
279 lines
6.0 KiB
Plaintext
279 lines
6.0 KiB
Plaintext
*``````````````````````````````*
|
|
* ZSAVE :: SAVE 0-PAGE FREE *
|
|
*- -*
|
|
* STORES THE VALUES IN THE *
|
|
* LITTLE FREE SPACE ON THE *
|
|
* ZERO PAGE AT AN ALTERNATE *
|
|
* MEMORY LOCATION TO BE *
|
|
* RETRIEVED AND RESTORED AT A *
|
|
* LATER POINT. *
|
|
*- -*
|
|
* CLOBBERS: *
|
|
* *
|
|
* FLAGS: ????---- REG: AXYM *
|
|
*- -*
|
|
* CYCLES: ??? *
|
|
* SIZE: *
|
|
*- -*
|
|
* USAGE: *
|
|
* *
|
|
* LDA #>$6A00 *
|
|
* PHA *
|
|
* LDA #<$6A00 *
|
|
* PHA *
|
|
* JSR ZSAVE *
|
|
*- -*
|
|
* ENTRY *
|
|
* *
|
|
* TOP OF STACK *
|
|
* *
|
|
* LOW BYTE OF RETURN ADDRESS *
|
|
* HI BYTE OF RETURN ADDRESS *
|
|
* LOW BYTE OF DESTINATION *
|
|
* HIGH BYTE OF DESTINATION *
|
|
*- -*
|
|
* EXIT *
|
|
* *
|
|
* TOP OF STACK *
|
|
* *
|
|
* LOW BYTE OF RETURN ADDRESS *
|
|
* HI BYTE OF RETURN ADDRESS *
|
|
* *
|
|
* Y = TRASH *
|
|
* X = TRASH *
|
|
* A = LOW BYTE OF RET ADDR *
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
*
|
|
ZSAVE
|
|
*
|
|
** LOAD ADDR1 ZERO PAGE AREA FIRST,
|
|
** SINCE WE'LL BE USING THAT
|
|
*
|
|
** NOTE THAT THIS SHOULD ALWAYS BE
|
|
** $06 AND $07, OR ELSE CODE WILL
|
|
** HAVE TO CHANGE.
|
|
*
|
|
LDX ADDR1
|
|
LDY ADDR1+1
|
|
*
|
|
** SAVE RETURN ADDRESS
|
|
*
|
|
PLA
|
|
STA :RETADR
|
|
PLA
|
|
STA :RETADR+1
|
|
*
|
|
** GET PARAMETERS
|
|
*
|
|
PLA
|
|
STA ADDR1
|
|
PLA
|
|
STA ADDR1+1
|
|
*
|
|
** COPY ZERO PAGE TO SPECIFIED
|
|
** NON-ZERO LOCATION (ONLY THE
|
|
** FREE ONES..)
|
|
*
|
|
TYA ; STORE ADDR1 VALS
|
|
LDY #1 ; FIRST
|
|
STA (ADDR1),Y
|
|
LDY #0
|
|
TXA
|
|
STA (ADDR1),Y
|
|
LDY #2
|
|
LDA $08
|
|
STA (ADDR1),Y
|
|
INY
|
|
LDA $09
|
|
STA (ADDR1),Y
|
|
INY
|
|
LDA $19
|
|
STA (ADDR1),Y
|
|
INY
|
|
LDA $1E
|
|
STA (ADDR1),Y
|
|
INY
|
|
LDA $E3
|
|
STA (ADDR1),Y
|
|
INY
|
|
LDA $EB
|
|
STA (ADDR1),Y
|
|
INY
|
|
LDA $EC
|
|
STA (ADDR1),Y
|
|
INY
|
|
LDA $ED
|
|
STA (ADDR1),Y
|
|
INY
|
|
LDA $EE
|
|
STA (ADDR1),Y
|
|
INY
|
|
LDA $EF
|
|
STA (ADDR1),Y
|
|
INY
|
|
LDA $FA
|
|
STA (ADDR1),Y
|
|
INY
|
|
LDA $FB
|
|
STA (ADDR1),Y
|
|
INY
|
|
LDA $FC
|
|
STA (ADDR1),Y
|
|
INY
|
|
LDA $FD
|
|
STA (ADDR1),Y
|
|
INY
|
|
LDA $FE
|
|
STA (ADDR1),Y
|
|
INY
|
|
LDA $FF
|
|
STA (ADDR1),Y
|
|
*
|
|
** RESTORE RETURN ADDRESS
|
|
*
|
|
LDA :RETADR+1
|
|
PHA
|
|
LDA :RETADR
|
|
PHA
|
|
*
|
|
RTS
|
|
*
|
|
** DATA
|
|
*
|
|
:RETADR DS 2
|
|
*
|
|
*``````````````````````````````*
|
|
* ZLOAD :: RESTORE 0-PAGE FREE *
|
|
*- -*
|
|
* RESTORES PREVIOUSLY SAVED *
|
|
* ZERO PAGE VALUES FROM *
|
|
* HIGHER MEMORY LOCATION. *
|
|
* CLOBBERS: *
|
|
* *
|
|
* FLAGS: ????---- REG: AXYM *
|
|
*- -*
|
|
* CYCLES: ??? *
|
|
* SIZE: *
|
|
*- -*
|
|
* USAGE: *
|
|
* *
|
|
* LDA #>$6A00 *
|
|
* PHA *
|
|
* LDA #<$6A00 *
|
|
* PHA *
|
|
* JSR ZLOAD *
|
|
*- -*
|
|
* ENTRY *
|
|
* *
|
|
* TOP OF STACK *
|
|
* *
|
|
* LOW BYTE OF RETURN ADDRESS *
|
|
* HI BYTE OF RETURN ADDRESS *
|
|
* LOW BYTE OF SOURCE *
|
|
* HIGH BYTE OF SOURCE *
|
|
*- -*
|
|
* EXIT *
|
|
* *
|
|
* TOP OF STACK *
|
|
* *
|
|
* LOW BYTE OF RETURN ADDRESS *
|
|
* HI BYTE OF RETURN ADDRESS *
|
|
* *
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
*
|
|
ZLOAD
|
|
*
|
|
** SAVE RETURN ADDRESS
|
|
*
|
|
PLA
|
|
STA :RETADR
|
|
PLA
|
|
STA :RETADR+1
|
|
*
|
|
** GET PARAMETERS
|
|
*
|
|
PLA
|
|
STA ADDR1
|
|
PLA
|
|
STA ADDR1+1
|
|
*
|
|
** COPY ZERO PAGE TO SPECIFIED
|
|
** NON-ZERO LOCATION (ONLY THE
|
|
** FREE ONES..)
|
|
*
|
|
LDY #2 ; START 2 AHEAD
|
|
LDA (ADDR1),Y ; AND PUT ADDR1
|
|
STA $08 ; AREA LAST
|
|
INY
|
|
LDA (ADDR1),Y
|
|
STA $09
|
|
INY
|
|
LDA (ADDR1),Y
|
|
STA $19
|
|
INY
|
|
LDA (ADDR1),Y
|
|
STA $1E
|
|
INY
|
|
LDA (ADDR1),Y
|
|
STA $E3
|
|
INY
|
|
LDA (ADDR1),Y
|
|
STA $EB
|
|
INY
|
|
LDA (ADDR1),Y
|
|
STA $EC
|
|
INY
|
|
LDA (ADDR1),Y
|
|
STA $ED
|
|
INY
|
|
LDA (ADDR1),Y
|
|
STA $EE
|
|
INY
|
|
LDA (ADDR1),Y
|
|
STA $EF
|
|
INY
|
|
LDA (ADDR1),Y
|
|
STA $FA
|
|
INY
|
|
LDA (ADDR1),Y
|
|
STA $FB
|
|
INY
|
|
LDA (ADDR1),Y
|
|
STA $FC
|
|
INY
|
|
LDA (ADDR1),Y
|
|
STA $FD
|
|
INY
|
|
LDA (ADDR1),Y
|
|
STA $FE
|
|
INY
|
|
LDA (ADDR1),Y
|
|
STA $FF
|
|
*
|
|
** NOW GET ZERO PAGE VALUES
|
|
** FOR SPACE OCCUPIED BY ADDR; RETURN IN X,Y
|
|
*
|
|
LDY #0
|
|
LDA (ADDR1),Y
|
|
TAX
|
|
LDA (ADDR1+1),Y
|
|
TAY
|
|
STX ADDR1
|
|
STY ADDR1+1
|
|
*
|
|
** RESTORE RETURN ADDRESS
|
|
*
|
|
LDA :RETADR+1
|
|
PHA
|
|
LDA :RETADR
|
|
PHA
|
|
*
|
|
RTS
|
|
*
|
|
** DATA
|
|
*
|
|
:RETADR DS 2
|
|
*
|
|
*
|
|
COMMONX RTS
|