Relocatable multiplier:
Memory:
0x00 - AX
0x01 - BL
0x02 - BH
0x03 - RL
0x04 - RH
Prog multiplies AX and BL
STIP //safety jump
ADD A, 0x0E //safety jump
JMP A //safety jump
LOD A, 0x02 (A = BH) <-- NEXT
SHL A, 1
LOD B, 0x01 (B = BL)
IF B, 0x80
OR A, 0x01
SHL B, 1
STO B, 0x01
STO A, 0x02
LOD B, 0x00 (B = AX)
SHR B, 1
STO B, 0x00
STIP <-- ENTRY POINT
ADD A, 0x13 (=@END)
LOD B, 0x00 (B = AX)
IFN B, 0xFF
JMP A
ADD A, 0xE8 (=-@NEXT-@END)
IFN B, 0x01
JMP A
LOD B, 0x01 (B = BL) //load variables
LOD A, 0x03 (A = RL)
ADD A, B
STO A, 0x03
LOD B, 0x02
LOD A, 0x04
ADC A, B
STO A, 0x04
STIP
ADD A, 0xE5 (=@NEXT)
JMP A
LOD B, 0x04 <-- END
LOD A, 0x03
OUT A, B
STOP
The job is yours ;)
The computer is fine and very fast but with deco on (you need deco to see the keypad),
the output number becomes invisible.
I think it is to do with the insl taking on the deco colour rather than 'real' colour
of the filt when the cray beams go through the filt at the output.