2018-12-21 21:47:01 +00:00
|
|
|
MULT16
|
|
|
|
PLA
|
|
|
|
STA RETADR
|
|
|
|
PLA
|
|
|
|
STA RETADR+1
|
|
|
|
PLA
|
|
|
|
STA :MLIER
|
|
|
|
PLA
|
|
|
|
STA :MLIER+1
|
|
|
|
PLA
|
|
|
|
STA :MCAND
|
|
|
|
PLA
|
|
|
|
STA :MCAND+1
|
|
|
|
LDA #0
|
2019-01-21 03:03:35 +00:00
|
|
|
STA :HPROD ; ZERO HIGH WORD
|
2018-12-21 21:47:01 +00:00
|
|
|
STA :HPROD+1
|
2019-01-21 03:03:35 +00:00
|
|
|
LDX #17 ; # OF BITS IN MPLIER
|
|
|
|
; PLUS 1. EXTRA LOOP IS
|
|
|
|
; TO MOVE LAST CARRY INTO
|
|
|
|
; THE PRODUCT.
|
|
|
|
CLC ; CLEAR CARRY FOR 1ST TIME
|
|
|
|
; THROUGH LOOP.
|
2018-12-21 21:47:01 +00:00
|
|
|
:MULLP
|
|
|
|
ROR :HPROD+1
|
|
|
|
ROR :HPROD
|
|
|
|
ROR :MLIER+1
|
|
|
|
ROR :MLIER
|
2019-01-21 03:03:35 +00:00
|
|
|
BCC :DECCNT ; BR IF NEXT BIT OF
|
|
|
|
CLC ; NEXT BIT=1 SO ADD MCAND
|
2018-12-21 21:47:01 +00:00
|
|
|
LDA :MCAND
|
|
|
|
ADC :HPROD
|
|
|
|
STA :HPROD
|
|
|
|
LDA :MCAND+1
|
|
|
|
ADC :HPROD+1
|
2019-01-21 03:03:35 +00:00
|
|
|
STA :HPROD+1 ; CARRY = OVERFLOW
|
2018-12-21 21:47:01 +00:00
|
|
|
:DECCNT
|
|
|
|
DEX
|
2019-01-21 03:03:35 +00:00
|
|
|
BNE :MULLP ; CONTINUE UNTIL DONE
|
|
|
|
LDY :HPROD ; LOW BYTE OF HIGH WORD
|
|
|
|
LDX :HPROD+1 ; HIGH BYTE OF HIGH WORD
|
2018-12-21 21:47:01 +00:00
|
|
|
LDA :MLIER+1
|
|
|
|
TAX
|
|
|
|
STX RETURN+1
|
|
|
|
LDA :MLIER
|
|
|
|
TAY
|
|
|
|
STY RETURN
|
|
|
|
LDA :HPROD
|
|
|
|
STA RETURN+2
|
|
|
|
LDA #2
|
|
|
|
STA RETLEN
|
|
|
|
LDA RETADR+1
|
|
|
|
PHA
|
|
|
|
LDA RETADR
|
|
|
|
PHA
|
2019-01-21 03:03:35 +00:00
|
|
|
LDA :HPROD ;24BIT
|
2018-12-21 21:47:01 +00:00
|
|
|
RTS
|
|
|
|
:MCAND DS 3
|
|
|
|
:MLIER DS 3
|
|
|
|
:HPROD DS 2
|