* *``````````````````````````````* * MUL8 :: 8BIT MULTIPLY (16BR) * *- -* * MULTIPLY TWO 8BIT NUMBERS TO * * GET 16BIT RESULT. NUMBERS * * MUST BE UNSIGNED. * * * * ORIGINAL AUTHOR IS WHITE * * FLAME, AS SHARED ON * * CODEBASE64. I HAVE MADE SOME * * MINOR ALTERATIONS, BUT NOT * * NEARLY ENOUGH TO CALL IT MY * * OWN. * *- -* * CLOBBERS: * * * * FLAGS: ????---- REG: AXYM * *- -* * CYCLES: ??? * * SIZE: * *- -* * USAGE: * * * * LDA #100 * * PHA * * PDA #200 * * PHA * * JSR MUL8 * *- -* * ENTRY * * * * LOW BYTE OF RETURN ADDRESS * * HIGH BYTE OF RETURN ADDRESS * * SECOND NUM TO BE MULTIPLIED * * FIRST NUM TO BE MULTIPLIED * *- -* * EXIT * * * * Y = HIGH BYTE OF PRODUCT * * X = LOW BYTE OF PRODUCT * * A = LOW BYTE OF PRODUCT * *,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,* * MUL8 * ** GET RETURN ADDRESS * PLA STA :RETADR PLA STA :RETADR+1 * ** GET PARAMETERS * PLA STA :MUL1 PLA STA :MUL2 * ** INIT * LDA #$00 TAX STX :MUL1H BEQ :GOLOOP * :DOADD CLC ADC :MUL1 TAY * TXA ADC :MUL1H TAX TYA * :LP ASL :MUL1 ROL :MUL1H :GOLOOP LSR :MUL2 BCS :DOADD BNE :LP * ** RESTORE RETURN ADDRESS * LDA :RETADR+1 PHA LDA :RETADR PHA * RTS * ** DATA * :MUL1 DS 1 :MUL2 DS 1 :RETADR DS 2 :MUL1H DS 1