Hi,
what about:
;_______________________________________________________________________________
; variable/data section
;_______________________________________________________________________________
MY_EXTENDED_RAM: SECTION
xa ds.b 1 ; input variable
xb ds.b 1 ; input variable
xc ds.b 1 ; result
ov_f ds.b 1 ; overflow flag for multiplication; result is > 255
z_f ds.b 1 ; zero flag for multiplication
;_______________________________________________________________________________
MyCode: SECTION ; code section
;_______________________________________________________________________________
main: ; routine is called after power on reset
Entry:
;_______________________________________________________________________________
LDS #$F00 ; set STACK; reset status: RAM is placed 800~FFF
;-------------------
MOVB #0,xa ; innitialize variables to be multiplied
MOVB #0,xb ;
MAINLOOP:
LDAA xa ; prepare parameteres for sending to function
LDAB xb
XGDX ; X<=>D; as you wrote you store a,b in X
JSR multiply
INC xa ; modify inputs
INC xb
JMP MAINLOOP ;
;_______________________________________________________________________________
multiply:
CLR z_f ; clear flags
CLR ov_f
XGDX ; X<=>D
MUL ; multiply
STD xc ; store result
; test result for given conditions and set flags
TBEQ D,zero ; result is zero -> go to "zero" for processing
TBNE A,overflow ; result>255 -> go to "overflow" for processing
RTS ; return
zero:
MOVB #1,z_f ; set ctm's zero flag
RTS
overflow:
MOVB #1,ov_f ; set ctm's overflow flag
RTS
;_______________________________________________________________________________
Best regards,
Ladislav