;Note: if you do X*0, where X is other than 0, it will glitch. ;multiplication 8-bit-------------------------------------------------------------- !scratch_ram = $00 ;>scratch ram to use. !input_value = $0DBF ;\can be ram addresses: "$xx" or specific values: "#$xx". !multiply_by = #$05 ;/>value should not be #$00 !output_value = $0DBF ;>should be only ram (unless you change this code) LDA !input_value ;\save value to memory. STA !scratch_ram ;/ LDY !multiply_by-1 ;>how many times to repeatly add. (if using long ;address, use "LDA !multiply_by-1 : TAY" instead). - CLC : ADC !scratch_ram ;>use memory to repeatly add. DEY ;>"consume" number of times being added. BNE - ;>if number of repeats not 0, then loop. STA !output_value ;multiplication 16-bit------------------------------------------------------------- !scratch_ram = $00 ;>[2 bytes] scratch ram to use. !input_value = $13E6 ;>can be ram addresses: "$xx" or specific values: "#$xxxx", !multiply_by = #$0005 ;>should be only specific value greater than #$0000 !output_value = $13E6 ;>should be only ram (unless you change this code) REP #$30 LDA !input_value STA !scratch_ram LDY !multiply_by-1 - CLC : ADC !scratch_ram DEY BNE - STA !output_value SEP #$30