RosettaCodeData/Task/Function-definition/6502-Assembly/function-definition-1.6502

9 lines
318 B
Plaintext

MULTIPLY: STX MULN ; 6502 has no "acc += xreg" instruction,
TXA ; so use a memory address
MULLOOP: DEY
CLC ; remember to clear the carry flag before
ADC MULN ; doing addition or subtraction
CPY #$01
BNE MULLOOP
RTS