mirror of
https://github.com/nathanriggs/AppleIIAsm-Collection.git
synced 2024-12-02 12:52:03 +00:00
c8cac53c5e
Massive updates that changes the way most subroutines are handled. Major bugfixes, various utilities added, started higher-level libraries.
123 lines
2.3 KiB
Plaintext
123 lines
2.3 KiB
Plaintext
APUT161
|
|
PLA
|
|
STA RETADR
|
|
PLA
|
|
STA RETADR+1
|
|
PLA
|
|
STA :AIDX
|
|
STA :IDX
|
|
PLA
|
|
STA :AIDX+1
|
|
STA SCRATCH
|
|
PLA
|
|
STA ADDR4 ; ARRAY ADDRESS
|
|
|
|
|
|
PLA
|
|
STA ADDR4+1
|
|
PLA
|
|
STA ADDR3
|
|
|
|
PLA
|
|
STA ADDR3+1
|
|
LDY #0
|
|
LDA (ADDR4),Y
|
|
STA :ASIZE
|
|
LDY #1
|
|
LDA (ADDR4),Y
|
|
STA :ASIZE+1
|
|
INY
|
|
LDA (ADDR4),Y
|
|
STA :ESIZE
|
|
STA :ESIZEBAK
|
|
LDA ERRCTRL
|
|
CMP #1
|
|
BEQ :CHKERR
|
|
JMP :ERREND
|
|
:CHKERR
|
|
LDA :IDX+1
|
|
CMP :ASIZE+1
|
|
BCS :OVFHI
|
|
JMP :ERREND
|
|
:OVFHI
|
|
LDA :IDX
|
|
CMP :ASIZE
|
|
BCS :OVF
|
|
JMP :ERREND
|
|
:OVF
|
|
_ERR #:E_SID;#:E_OVF1;#:E_DUMP;#:ESIZE;#9
|
|
:ERREND
|
|
LDY #0
|
|
LDA #0
|
|
BEQ :ENTLPA
|
|
:DOADD
|
|
CLC
|
|
ADC :AIDX
|
|
TAX
|
|
TYA
|
|
ADC SCRATCH
|
|
TAY
|
|
TXA
|
|
:LPA
|
|
ASL :AIDX
|
|
ROL SCRATCH
|
|
:ENTLPA
|
|
LSR :ESIZE
|
|
BCS :DOADD
|
|
BNE :LPA
|
|
STX :IDX
|
|
STY :IDX+1
|
|
CLC
|
|
LDA #3
|
|
ADC :IDX
|
|
STA :RES
|
|
BCS :ADDHI
|
|
JMP :XADD
|
|
:ADDHI
|
|
LDA #1
|
|
ADC :IDX+1
|
|
STA :IDX+1
|
|
:XADD
|
|
LDA :IDX+1
|
|
STA :RES+1
|
|
CLC
|
|
LDA :RES
|
|
ADC ADDR4
|
|
STA :RES
|
|
BCS :ADD1HI
|
|
JMP :XADD2
|
|
:ADD1HI
|
|
INC :RES+1
|
|
:XADD2
|
|
LDA :RES+1
|
|
ADC ADDR4+1
|
|
STA :RES+1
|
|
STA ADDR2+1
|
|
LDA :RES
|
|
STA ADDR2
|
|
LDY #0
|
|
:LP
|
|
LDA (ADDR3),Y
|
|
STA (ADDR2),Y
|
|
INY
|
|
CPY :ESIZEBAK
|
|
BNE :LP
|
|
LDA RETADR+1
|
|
PHA
|
|
LDA RETADR
|
|
PHA
|
|
LDX ADDR2+1
|
|
LDY ADDR2
|
|
LDA :ESIZE
|
|
RTS
|
|
:ESIZE DS 1
|
|
:ESIZEBAK DS 1
|
|
:ASIZE DS 2
|
|
:AIDX DS 2
|
|
:IDX DS 2
|
|
:RES DS 2
|
|
:E_SID ASC "APUT161 (PUT161 MACRO),",00
|
|
:E_DUMP ASC "DUMPING :ESIZE(1) :ESIZEBAK(1) :ASIZE(2)"
|
|
ASC ":AIDX(2) :IDX(2) :RES(2)",00
|
|
:E_OVF1 ASC "OUT OF BOUNDS! INDEX > ARRAY LENGTH",00
|