|
;------------------- SUBROUTINES ------------------
;------------------ Binary Square ----------------- |
|
SQUARE: | LD | X,#MULTKANDLO | |
| LD | B,#MULTKATORLO | |
| LD | A,[X+] | |
| X | A,[B+] | |
| LD | A,[X+] | |
| X | A,[B+] | |
|
;-------------- Binary Multiplication ------------- |
|
MULTIPLY: | LD | B,#PRODUCTLO | |
| CLR | A | |
| X | A,[B+] | |
| CLR | A | |
| X | A,[B+] | |
| LD | TEMPCNT1,#011 | |
MULT2: | LD | B,#PRODUCTHI | |
| LD | TEMPCNT2,#4 | |
| RC | | |
MULT3: | LD | A,[B] | ;Shift 4 Productbytes |
| RRC | A | |
| X | A,[B-] | |
| DRSZ | TEMPCNT2 | |
| JP | MULT3 | |
| IFNC | | |
| JP | MULT5 | |
| LD | X,#MULTKANDLO | |
| LD | B,#PRODUCTLO | |
| LD | TEMPCNT2,#2 | |
| RC | | |
MULT4: | LD | A,[X+] | |
| ADC | A,[B] | |
| X | A,[B+] | |
| DRSZ | TEMPCNT2 | |
| JP | MULT4 | |
MULT5: | DRSZ | TEMPCNT1 | |
| JP | MULT2 | |
| RET | | |
| | | |
| | | |
|
|