mirror of
https://github.com/nathanriggs/AppleIIAsm-Collection.git
synced 2024-12-03 03:52:16 +00:00
c8cac53c5e
Massive updates that changes the way most subroutines are handled. Major bugfixes, various utilities added, started higher-level libraries.
186 lines
3.7 KiB
Plaintext
186 lines
3.7 KiB
Plaintext
ADIM162
|
|
PLA
|
|
STA RETADR
|
|
PLA
|
|
STA RETADR+1
|
|
PLA
|
|
STA :FILL
|
|
PLA
|
|
STA :ELEN
|
|
PLA
|
|
STA :AYSIZE
|
|
STA :AYBAK
|
|
STA :MCAND
|
|
PLA
|
|
STA :AYSIZE+1
|
|
STA :AYBAK+1
|
|
STA :MCAND+1
|
|
PLA
|
|
STA :AXSIZE
|
|
STA :AXBAK
|
|
STA :MLIER
|
|
PLA
|
|
STA :AXSIZE+1
|
|
STA :AXBAK+1
|
|
STA :MLIER+1
|
|
PLA
|
|
STA ADDR1
|
|
STA ADDR4
|
|
PLA
|
|
STA ADDR1+1
|
|
STA ADDR4+1
|
|
LDA #0
|
|
STA :PROD+2
|
|
STA :PROD+3
|
|
LDX #$10
|
|
:SHIFT_R
|
|
LSR :MLIER+1
|
|
ROR :MLIER
|
|
BCC :ROT_R
|
|
LDA :PROD+2
|
|
CLC
|
|
ADC :MCAND
|
|
STA :PROD+2
|
|
LDA :PROD+3
|
|
ADC :MCAND+1
|
|
:ROT_R
|
|
ROR
|
|
STA :PROD+3
|
|
ROR :PROD+2
|
|
ROR :PROD+1
|
|
ROR :PROD
|
|
DEX
|
|
BNE :SHIFT_R
|
|
LDA :ELEN
|
|
STA :MCAND
|
|
LDA #0
|
|
STA :MCAND+1
|
|
LDA :PROD
|
|
STA :MLIER
|
|
LDA :PROD+1
|
|
STA :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
|
|
LDA :PROD
|
|
ADC #5
|
|
STA :PROD
|
|
BCC :NOCAR
|
|
INC :PROD+1
|
|
:NOCAR
|
|
LDA ERRCTRL
|
|
CMP #1
|
|
BEQ :CHKERR
|
|
JMP :ERREND
|
|
:CHKERR
|
|
LDA :PROD+2
|
|
CMP #0
|
|
BNE :EMAX
|
|
LDA :PROD+1
|
|
CMP #>ARRMAX
|
|
BCS :CHKCONT
|
|
BEQ :CHKCONT
|
|
JMP :ERREND
|
|
:CHKCONT
|
|
LDA :PROD
|
|
CMP #<ARRMAX
|
|
BCS :EMAX
|
|
BEQ :EMAX
|
|
JMP :ERREND
|
|
:EMAX
|
|
_ERR #:E_SID;#:E_MSG;#:E_DMP;#:PROD;#18
|
|
:ERREND
|
|
LDA :FILL
|
|
LDX :PROD+1
|
|
; GO BEYOND A 16BIT VALUE;
|
|
|
|
|
|
|
|
|
|
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 (ADDR4),Y
|
|
INY
|
|
LDA :AXBAK+1
|
|
STA (ADDR4),Y
|
|
INY
|
|
LDA :AYBAK
|
|
STA (ADDR4),Y
|
|
INY
|
|
LDA :AYBAK+1
|
|
STA (ADDR4),Y
|
|
INY
|
|
LDA :ELEN
|
|
STA (ADDR4),Y
|
|
LDA RETADR+1
|
|
PHA
|
|
LDA RETADR
|
|
PHA
|
|
LDY ADDR4
|
|
LDX ADDR4+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
|
|
RTS
|
|
:PROD DS 4
|
|
:AXSIZE DS 2
|
|
:AYSIZE DS 2
|
|
:AXBAK DS 2
|
|
:AYBAK DS 2
|
|
:MLIER DS 2
|
|
:MCAND DS 2
|
|
:FILL DS 1
|
|
:ELEN DS 1
|
|
:E_SID ASC "ADIM162 (DIM162 MACRO)",00
|
|
:E_DMP ASC ":PROD(4) :AXSIZE(2) :AYSIZE(2)"
|
|
ASC ":AXBAK(2) :AYBAK(2) :MLIER(2)"
|
|
ASC ":MCAND(2) :FILL(1) :ELEN(1)",00
|
|
:E_MSG ASC "ARRAY TOO LARGE!",00
|