1
0
mirror of https://github.com/KarolS/millfork.git synced 2024-06-25 19:29:49 +00:00
millfork/include/zp_reg.mfk
2018-12-19 01:10:39 +01:00

46 lines
760 B
Plaintext

#if not(ARCH_6502)
#warn zp_reg module should be used only on 6502-compatible targets
#endif
noinline asm byte __mul_u8u8u8() {
? LDA #0
? JMP __mul_u8u8u8_start
__mul_u8u8u8_add:
? CLC
? ADC __reg.lo
__mul_u8u8u8_loop:
? ASL __reg.lo
__mul_u8u8u8_start:
? LSR __reg.hi
? BCS __mul_u8u8u8_add
? BNE __mul_u8u8u8_loop
? RTS
}
#if ZPREG_SIZE >= 3
noinline asm word __mul_u16u8u16() {
? LDA #0
? TAX
? JMP __mul_u16u8u16_start
__mul_u16u8u16_add:
? CLC
? ADC __reg
? TAY
? TXA
? ADC __reg + 1
? TAX
? TYA
__mul_u16u8u16_loop:
? ASL __reg
? ROL __reg + 1
__mul_u16u8u16_start:
? LSR __reg + 2
? BCS __mul_u16u8u16_add
? BNE __mul_u16u8u16_loop
? RTS
}
#endif