AppleIIAsm-Collection/disks/disk3_arrays/T.ADIM81.MIN
nathanriggs 795dc18833 0.2.0 updates: Arrays
- Some major bugfixes
- more compact commenting
- added required.lib, mac and hooks
- changed array get routines to copy appropriate element to memory address designated as "return"
- created .min versions of each file that has no comments to save space in large projects
- reordered catalog alphabetically
2018-12-12 14:29:06 -05:00

92 lines
1.6 KiB
Plaintext

SKP 10
ADIM81
PLA
STA RETADR
PLA
STA RETADR+1
PLA
STA :ESIZE
STA :ESZBAK
PLA
STA :ASIZE
STA :ASZBAK
PLA
STA ADDR1
PLA
STA ADDR1+1
LDY #0
LDA #0
STY SCRATCH
BEQ :ENTLP
:DOADD
CLC
ADC :ASIZE
TAX
TYA
ADC SCRATCH
TAY
TXA
:LP
ASL :ASIZE
ROL SCRATCH
:ENTLP
LSR :ESIZE
BCS :DOADD
BNE :LP
CLC
INX
INX
BCC :NOINY
INY
:NOINY
STX :MSIZE
STY :MSIZE+1
LDA #0
LDX :MSIZE+1
BEQ :PART
LDY #0
:FULL
STA (ADDR1),Y
INY
BNE :FULL
INC ADDR1+1
DEX
BNE :FULL
:PART
LDX :MSIZE
BEQ :MFEXIT
LDY #0
:PARTLP
STA (ADDR1),Y
INY
DEX
BNE :PARTLP
:MFEXIT
LDY #0
LDA :ASZBAK
STA (ADDR1),Y
INY
LDA :ESZBAK
STA (ADDR1),Y
LDA RETADR+1
PHA
LDA RETADR
PHA
LDY ADDR1
LDX ADDR1+1
LDA :ASZBAK
LDA :MSIZE
STA RETURN
LDA :MSIZE+1
STA RETURN+1
LDA #2
STA RETLEN
RTS
:MSIZE DS 2
:ASIZE DS 1
:ESIZE DS 1
:ASZBAK DS 1
:ESZBAK DS 1
SKP 10