Have not really done much with pasmo for a few weeks as have been working on doing the analysis for project.
Now I try and use one of the subroutines from the Lance L book and I get the program to assemble in pasmo but nothing shows up in fuse (but then the debugging facilities are pitiful in fuse so I am not really sure whats going on..)
I thought you had to put an end statement for pasmo to like it but that seems not to be the case now????
Anyway here is the code that seems not to work. It's a simple subroutine to multiply two 16 bit numbers.
It should exit with the HL register having the result.
I generate the tap file, but when I run it nothing shows up in fuse.
I look at the "debugger" and nothing is showing up at location C350 (50000). Not a sausage. So I am thinking nothing is getting loaded from the tap file? Why was there no error when I did the assembly Its like it silently failed.
Code: Select all
ORG 50000
INCLUDE "MUL16.ASM"
SC6A:
LD HL,-2 ; HL = MULTIPLICAND
LD DE,1023 ; DE = MULTIPLIER
CALL MUL16 ; 16-BIT MULTIPLY
; RESULT OF 1023 * -2 = 0F802H
; REGISTER L = 02H
; H = F8H
JR SC6A
RET
Code: Select all
; MUL16.ASM
; Multiply two 16 bit numbers
;
; Entry Conditions:
; Multiplicand in HL
; Multiplier in DE
;
; Exit Conditions:
; Less significant word of product in HL
;
; Registers Used: AF, BC, DE, HL
; Execution Time: Approx. 865 to 965 cycles.
; Program size: 22 bytes
; Data Memory Required: None
;
; INITALIZE PARTIAL PRODUCT, BIT COUNT
MUL16:
LD C,L ; BC = MULTIPLIER
LD B,H
LD HL,0 ; PRODUCT = 0
LD A,15 ; COUNT = BIT LENGTH -1
; SHIFT-AND-ADD ALGORITHM
; IF MSB OF MULTIPLIER IS 1, ADD MULTIPLICAND TO PARTIAL PRODUCT
; SHIFT PARTIAL PRODUCT, MULTIPLIER LEFT 1 BIT
MLP:
SLA E ; SHIFT MULTIPLIER LEFT 1 BIT
RL D
JR NC,MLP1 ; JUMP IF MSB OF MULTIPLIER = 0
ADD HL,BC ; ADD MULTIPLICAND TO PARTIAL PRODUCT
MLP1:
ADD HL,HL ; SHIFT PARTIAL PRODUCT LEFT
DEC A
JR NZ,MLP ; CONTINUE UNTIL COUNT = 0
; ADD MULTIPLICAND ONE LAST TIME IF MSB OF MULTIPLIER IS 1
OR D ; SIGN FLAG = MSB OF MULTIPLIER
RET P ; EXIT IF MSB OF MULTIPLIER IS 0
ADD HL,BC ; ADD MULTIPLICAND TO PRODUCT
RET