mirror of
https://github.com/nathanriggs/AppleIIAsm-Collection.git
synced 2024-11-30 15:49:55 +00:00
133 lines
3.1 KiB
Plaintext
133 lines
3.1 KiB
Plaintext
|
*
|
||
|
*``````````````````````````````*
|
||
|
* APUT82 :: PUT DATA INTO ELEM *
|
||
|
*- -*
|
||
|
* THIS PUTS DATA FROM ONE ADDR *
|
||
|
* INTO THE ADDRESS OF AN ARRAY *
|
||
|
* WITH THE INDEX OF X,Y. *
|
||
|
*- -*
|
||
|
* CLOBBERS: *
|
||
|
* *
|
||
|
* FLAGS: ????---- REG: AXYM *
|
||
|
*- -*
|
||
|
* CYCLES: ??? *
|
||
|
* SIZE: *
|
||
|
*- -*
|
||
|
* USAGE: *
|
||
|
* *
|
||
|
* LDA #>$300 ; SOURCE DATA *
|
||
|
* PHA *
|
||
|
* LDA #<$300 *
|
||
|
* PHA *
|
||
|
* LDA #>$3A0 ; DEST ARRAY *
|
||
|
* PHA *
|
||
|
* LDA #<$3A0 *
|
||
|
* PHA *
|
||
|
* LDA #2 ; ELEM X INDEX *
|
||
|
* PHA *
|
||
|
* LDA #3 ; ELEM Y INDEX *
|
||
|
* PHA *
|
||
|
* JSR APUT82 *
|
||
|
*- -*
|
||
|
* ENTRY *
|
||
|
* *
|
||
|
* TOP OF STACK *
|
||
|
* *
|
||
|
* LOW BYTE OF RETURN ADDRESS *
|
||
|
* HI BYTE OF RETURN ADDRESS *
|
||
|
* ELEMENT Y INDEX *
|
||
|
* ELEMENT X INDEX *
|
||
|
* LOW BYTE OF DESTINATION ADDR *
|
||
|
* HI BYTE OF DESTINATION ADDR *
|
||
|
* LO BYTE OF SOURCE ADDRESS *
|
||
|
* HI BYTE OF SOURCE ADDRESS *
|
||
|
*- -*
|
||
|
* EXIT *
|
||
|
* *
|
||
|
* TOP OF STACK *
|
||
|
* *
|
||
|
* LOW BYTE OF RETURN ADDRESS *
|
||
|
* HI BYTE OF RETURN ADDRESS *
|
||
|
* *
|
||
|
* Y = LOBYTE ELEMENT ADDRESS *
|
||
|
* X = HIBYTE ELEMENT ADDRESS *
|
||
|
* A = ELEMENT BYTE LENGTH *
|
||
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||
|
*
|
||
|
APUT82
|
||
|
*
|
||
|
** SAVE RETURN ADDRESS
|
||
|
*
|
||
|
PLA
|
||
|
STA :RETADR ; LOCAL BECAUSE OF
|
||
|
PLA ; CALLING AGET82
|
||
|
STA :RETADR+1
|
||
|
*
|
||
|
** GET PARAMETERS
|
||
|
*
|
||
|
PLA
|
||
|
STA :YIDX ; Y INDEX
|
||
|
PLA
|
||
|
STA :XIDX ; X INDEX
|
||
|
PLA
|
||
|
STA ADDR4 ; ADDRESS OF ARRAY
|
||
|
PLA
|
||
|
STA ADDR4+1
|
||
|
PLA
|
||
|
STA ADDR3 ; ADDRESS OF DATA
|
||
|
PLA ; TO BE COPIED
|
||
|
STA ADDR3+1
|
||
|
*
|
||
|
** NOW RUN AGET82 TO GET PROPER ADDRESS
|
||
|
*
|
||
|
LDA ADDR4+1 ; ARRAY ADDRESS
|
||
|
PHA
|
||
|
LDA ADDR4
|
||
|
PHA
|
||
|
LDA :XIDX ; X INDEX
|
||
|
PHA
|
||
|
LDA :YIDX ; Y INDEX
|
||
|
PHA
|
||
|
JSR AGET82
|
||
|
STY ADDR2 ; STORE ADDRESS OF INDEX
|
||
|
STX ADDR2+1 ; IN ZERO PAGE
|
||
|
*
|
||
|
** GET ARRAY ELEMENT SIZE
|
||
|
*
|
||
|
LDY #2
|
||
|
LDA (ADDR4),Y
|
||
|
STA :ESIZE
|
||
|
LDY #0
|
||
|
*
|
||
|
** COPY FROM SRC ADDR TO DEST ADDR
|
||
|
*
|
||
|
:CLP
|
||
|
LDA (ADDR3),Y
|
||
|
STA (ADDR2),Y
|
||
|
INY
|
||
|
CPY :ESIZE
|
||
|
BNE :CLP
|
||
|
*
|
||
|
** RESTORE RETURN ADDRESS
|
||
|
*
|
||
|
LDA :RETADR+1
|
||
|
PHA
|
||
|
LDA :RETADR
|
||
|
PHA
|
||
|
*
|
||
|
** RETURN ELEMENT ADDRESS AND SIZE
|
||
|
*
|
||
|
LDX ADDR2+1
|
||
|
LDY ADDR2
|
||
|
LDA :ESIZE
|
||
|
*
|
||
|
RTS
|
||
|
*
|
||
|
** DATA
|
||
|
*
|
||
|
:RETADR DS 2
|
||
|
:ESIZE DS 1
|
||
|
:XIDX DS 1
|
||
|
:YIDX DS 1
|
||
|
*
|