AppleIIAsm-Collection/source/d12_applechop/T.MIN.SUB.ADIM162
nathanriggs 9b12b6fd9b HOUSEKEEPING
- getting ready for major changes for 0.6.0.
- be sure to download the 0.5.0 release to ensure proper functionality, as these rountines will not work together in the SRC or BIN folder during the transition
- Beginning to significantly alter documentation
2019-12-17 17:19:24 -05:00

154 lines
3.4 KiB
Plaintext

]PROD EQU VARTAB
]AXSIZE EQU VARTAB+4
]AYSIZE EQU VARTAB+6
]AXBAK EQU VARTAB+8
]AYBAK EQU VARTAB+10
]MLIER EQU VARTAB+12
]MCAND EQU VARTAB+14
]FILL EQU VARTAB+16
]ELEN EQU VARTAB+17
ADIM162
PLA
TAX
PLA
TAY
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 ; LOBYTE
PLA
STA ADDR1+1
STA ADDR4+1
TYA
PHA
TXA
PHA
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
LDA ]PROD+1
ADC #0
STA ]PROD+1
LDA ]FILL
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 (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
LDX 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