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.
180 lines
3.7 KiB
Plaintext
180 lines
3.7 KiB
Plaintext
AGET162
|
|
PLA
|
|
STA RETADR
|
|
PLA
|
|
STA RETADR+1
|
|
PLA
|
|
STA :YIDX
|
|
PLA
|
|
STA :YIDX+1
|
|
PLA
|
|
STA :XIDX
|
|
PLA
|
|
STA :XIDX+1
|
|
PLA
|
|
STA ADDR4
|
|
PLA
|
|
STA ADDR4+1
|
|
LDY #4
|
|
LDA (ADDR4),Y
|
|
STA :ESIZE
|
|
LDY #0
|
|
LDA (ADDR4),Y
|
|
STA :XLEN
|
|
LDY #1
|
|
LDA (ADDR4),Y
|
|
STA :XLEN+1
|
|
LDY #2
|
|
LDA (ADDR4),Y
|
|
STA :YLEN
|
|
LDY #3
|
|
LDA (ADDR4),Y
|
|
STA :YLEN+1
|
|
LDY #0
|
|
LDA ERRCTRL
|
|
CMP #1
|
|
BEQ :CHKERR
|
|
JMP :ERREND
|
|
:CHKERR
|
|
LDA :XIDX
|
|
CMP :XLEN
|
|
BCC :ECONT1
|
|
LDA :XIDX+1
|
|
CMP :XLEN+1
|
|
BEQ :ECONT1
|
|
BCC :ECONT1
|
|
_ERR #:E_SID;#:E_XOVF;#:E_DUMP;#:ESIZE;#20
|
|
:ECONT1
|
|
LDA :YIDX
|
|
CMP :YLEN
|
|
BCC :ECONT2
|
|
LDA :YIDX+1
|
|
CMP :YLEN+1
|
|
BEQ :ECONT2
|
|
BCC :ECONT2
|
|
_ERR #:E_SID;#:E_YOVF;#:E_DUMP;#:ESIZE;#20
|
|
:ECONT2
|
|
:ERREND
|
|
LDA :YIDX
|
|
STA :MLIER
|
|
LDA :YIDX+1
|
|
STA :MLIER+1
|
|
LDA :YLEN
|
|
STA :MCAND
|
|
LDA :YLEN+1
|
|
STA :MCAND+1
|
|
LDA #00
|
|
STA :PROD
|
|
STA :PROD+1
|
|
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 :PROD
|
|
STA :PBAK
|
|
LDA :PROD+1
|
|
STA :PBAK+1
|
|
LDA :XIDX
|
|
STA :MLIER
|
|
LDA :XIDX+1
|
|
STA :MLIER+1
|
|
LDA :ESIZE
|
|
STA :MCAND
|
|
LDA #0
|
|
STA :MCAND+1
|
|
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 :PBAK
|
|
STA :PROD
|
|
LDA :PROD+1
|
|
ADC :PBAK+1
|
|
STA :PROD+1
|
|
CLC
|
|
LDA :PROD
|
|
ADC #5
|
|
STA :PROD
|
|
BCC :ADD3D
|
|
INC :PROD+1
|
|
:ADD3D
|
|
CLC
|
|
LDA :PROD
|
|
ADC ADDR4
|
|
STA :PROD
|
|
STA ADDR2
|
|
LDA :PROD+1
|
|
ADC ADDR4+1
|
|
STA :PROD+1
|
|
STA ADDR2+1
|
|
LDY #0
|
|
LDX #0
|
|
:CLP
|
|
LDA (ADDR2),Y
|
|
STA RETURN,Y
|
|
INY
|
|
CPY :ESIZE
|
|
BNE :CLP
|
|
LDA :ESIZE
|
|
STA RETLEN
|
|
LDA RETADR+1
|
|
PHA
|
|
LDA RETADR
|
|
PHA
|
|
LDX ADDR2+1
|
|
LDY ADDR2
|
|
LDA :ESIZE
|
|
RTS
|
|
:ESIZE DS 2
|
|
:XIDX DS 2
|
|
:YIDX DS 2
|
|
:MCAND DS 2
|
|
:MLIER DS 2
|
|
:PROD DS 4
|
|
:PBAK DS 2
|
|
:XLEN DS 2
|
|
:YLEN DS 2
|
|
:E_SID ASC "AGET162 (GET162 MACRO)",00
|
|
:E_DUMP ASC ":ESIZE(2) XIDX(2) YIDX(2) MCAND(2) "
|
|
ASC "MCAND(2) MLIER(2) PROD(4) PBAK(2) "
|
|
ASC "XLEN(2) YLEN(2)",00
|
|
:E_XOVF ASC "OUT OF BOUNDS! X > MAXIMUM",00
|
|
:E_YOVF ASC "OUT OF BOUNDS! Y > MAX",00
|