mirror of
https://github.com/nathanriggs/AppleIIAsm-Collection.git
synced 2024-11-27 12:49:27 +00:00
795dc18833
- 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
267 lines
4.9 KiB
Plaintext
267 lines
4.9 KiB
Plaintext
JMP ARRAYS82X
|
|
********************************
|
|
DIM82
|
|
PLA
|
|
STA RETADR
|
|
PLA
|
|
STA RETADR+1
|
|
PLA
|
|
STA :MCAND
|
|
PLA
|
|
STA :AYSIZE
|
|
STA :AYBAK
|
|
PLA
|
|
STA :AXSIZE
|
|
STA :AXBAK
|
|
PLA
|
|
STA ADDR1
|
|
PLA
|
|
STA ADDR1+1
|
|
LDA #0
|
|
STA :MCAND+1
|
|
LDA #0
|
|
TAY
|
|
STY SCRATCH
|
|
BEQ :ENTLP
|
|
:DOADD
|
|
CLC
|
|
ADC :AXSIZE
|
|
TAX
|
|
TYA
|
|
ADC SCRATCH
|
|
TAY
|
|
TXA
|
|
:LP
|
|
ASL :AXSIZE
|
|
ROL SCRATCH
|
|
:ENTLP
|
|
LSR :AYSIZE
|
|
BCS :DOADD
|
|
BNE :LP
|
|
STX :MLIER
|
|
STY :MLIER+1
|
|
LDA #0
|
|
STA :PROD
|
|
STA :PROD+1
|
|
STA :PROD+2
|
|
STA :PROD+3
|
|
LDX #$10
|
|
:SHIFTR LSR :MLIER+1
|
|
ROR :MLIER
|
|
BCC :ROTR
|
|
LDA :PROD+2
|
|
CLC
|
|
ADC :MCAND
|
|
STA :PROD+2
|
|
LDA :PROD+3
|
|
ADC :MCAND+1
|
|
:ROTR
|
|
ROR
|
|
STA :PROD+3
|
|
ROR :PROD+2
|
|
ROR :PROD+1
|
|
ROR :PROD
|
|
DEX
|
|
BNE :SHIFTR
|
|
CLC
|
|
INC :PROD
|
|
INC :PROD
|
|
INC :PROD
|
|
BCC :NOCAR
|
|
INC :PROD+1
|
|
:NOCAR
|
|
LDA #$00
|
|
LDX :PROD+1
|
|
BEQ :PART
|
|
LDY #0
|
|
:FULL
|
|
STA (ADDR1),Y
|
|
INY
|
|
BNE :FULL
|
|
INC ADDR1+1
|
|
DEX
|
|
BNE :FULL
|
|
:PART
|
|
LDX :PROD
|
|
BEQ :MFEXIT
|
|
LDY #0
|
|
:PARTLP
|
|
STA (ADDR1),Y
|
|
INY
|
|
DEX
|
|
BNE :PARTLP
|
|
:MFEXIT
|
|
LDY #0
|
|
LDA :AXBAK
|
|
STA (ADDR1),Y
|
|
INY
|
|
LDA :AYBAK
|
|
STA (ADDR1),Y
|
|
INY
|
|
LDA :MCAND
|
|
STA (ADDR1),Y
|
|
LDA RETADR+1
|
|
PHA
|
|
LDA RETADR
|
|
PHA
|
|
LDY ADDR1
|
|
LDX ADDR1+1
|
|
LDA :PROD
|
|
STA RETURN
|
|
LDA :PROD+1
|
|
STA RETURN+1
|
|
LDA :PROD+2
|
|
STA RETURN+2
|
|
LDA :PROD+3
|
|
STA RETURN+3
|
|
LDA #4
|
|
STA RETLEN
|
|
LDA :MCAND
|
|
RTS
|
|
:PROD DS 4
|
|
:AXSIZE DS 1
|
|
:AYSIZE DS 1
|
|
:AXBAK DS 1
|
|
:AYBAK DS 1
|
|
:MLIER DS 2
|
|
:MCAND DS 2
|
|
********************************
|
|
AGET82
|
|
PLA
|
|
STA RETADR
|
|
PLA
|
|
STA RETADR+1
|
|
PLA
|
|
STA :YIDX
|
|
PLA
|
|
STA :XIDX
|
|
PLA
|
|
STA ADDR1
|
|
PLA
|
|
STA ADDR1+1
|
|
LDY #2
|
|
LDA (ADDR1),Y
|
|
STA :MCAND
|
|
LDA #0
|
|
STA :MCAND+1
|
|
LDA #0
|
|
TAY
|
|
STY SCRATCH
|
|
BEQ :ENTLP
|
|
:DOADD
|
|
CLC
|
|
ADC :XIDX
|
|
TAX
|
|
TYA
|
|
ADC SCRATCH
|
|
TAY
|
|
TXA
|
|
:LP
|
|
ASL :XIDX
|
|
ROL SCRATCH
|
|
:ENTLP
|
|
LSR :YIDX
|
|
BCS :DOADD
|
|
BNE :LP
|
|
STX :MLIER
|
|
STY :MLIER+1
|
|
LDA #0
|
|
STA :PROD+2
|
|
STA :PROD+3
|
|
LDX #$10
|
|
:SHIFTR LSR :MLIER+1
|
|
ROR :MLIER
|
|
BCC :ROTR
|
|
LDA :PROD+2
|
|
CLC
|
|
ADC :MCAND
|
|
STA :PROD+2
|
|
LDA :PROD+3
|
|
ADC :MCAND+1
|
|
:ROTR
|
|
ROR
|
|
STA :PROD+3
|
|
ROR :PROD+2
|
|
ROR :PROD+1
|
|
ROR :PROD
|
|
DEX
|
|
BNE :SHIFTR
|
|
CLC
|
|
INC :PROD
|
|
INC :PROD
|
|
INC :PROD
|
|
BCC :NOCAR
|
|
INC :PROD+1
|
|
:NOCAR
|
|
CLC
|
|
LDA :PROD
|
|
ADC ADDR1
|
|
STA :PROD
|
|
LDA :PROD+1
|
|
ADC ADDR1+1
|
|
STA :PROD+1
|
|
LDY :PROD
|
|
LDX :PROD+1
|
|
LDA RETADR+1
|
|
PHA
|
|
LDA RETADR
|
|
PHA
|
|
RTS
|
|
:XIDX DS 2
|
|
:YIDX DS 2
|
|
:PROD DS 4
|
|
:MLIER DS 2
|
|
:MCAND DS 2
|
|
********************************
|
|
APUT82
|
|
PLA
|
|
STA :RETADR
|
|
PLA
|
|
STA :RETADR+1
|
|
PLA
|
|
STA :YIDX
|
|
PLA
|
|
STA :XIDX
|
|
PLA
|
|
STA ADDR4
|
|
PLA
|
|
STA ADDR4+1
|
|
PLA
|
|
STA ADDR3
|
|
PLA
|
|
STA ADDR3+1
|
|
LDA ADDR4+1
|
|
PHA
|
|
LDA ADDR4
|
|
PHA
|
|
LDA :XIDX
|
|
PHA
|
|
LDA :YIDX
|
|
PHA
|
|
JSR AGET82
|
|
STY ADDR2
|
|
STX ADDR2+1
|
|
LDY #2
|
|
LDA (ADDR4),Y
|
|
STA :ESIZE
|
|
LDY #0
|
|
:CLP
|
|
LDA (ADDR3),Y
|
|
STA (ADDR2),Y
|
|
INY
|
|
CPY :ESIZE
|
|
BNE :CLP
|
|
LDA :RETADR+1
|
|
PHA
|
|
LDA :RETADR
|
|
PHA
|
|
LDX ADDR2+1
|
|
LDY ADDR2
|
|
LDA :ESIZE
|
|
RTS
|
|
:RETADR DS 2
|
|
:ESIZE DS 1
|
|
:XIDX DS 1
|
|
:YIDX DS 1
|
|
ARRAYS82X
|