0

I am new to assembler, using the 68HC11 processor. I need to multiply two SIGNED 8 bit numbers using the partial product-shift algorithm. Some help in the right direction would be helpful.
Thanks.

1
Contributor
1
Reply
3
Views
6 Years
Discussion Span
Last Post by imanz
0

Here is what I have so far for my code.
SUM EQU $0100 ;Creates a location variable name with llocation $0101
ORG $0101 ;Start where the variables are stored
NUM1 FCB #$0005 ;Stores the value 05 in variable NUM1 at location $0101
NUM2 FCB #$05 ;Stores the value 05 in variable NUM2 at location $0102
Count FCB #$08 ;Decrement counter to check the C-Bit if its set to 1
ORG $C000 ;Start of Program Counter
LDD NUM1 ;Gets NUM1 value from location $0101
LDX #$0000 ;Stores values to be added for the final sum
LDAB Count ;Creates a roll counter that sets and resets the C bit
LDS #$0008
8_Bit JSR Check_C ;Loops until every bit is checked on the value in ACCB

BNE 8_Bit
STAA $0001 ;Stores the result in $0001
SWI ;Stops Execution
Check_C:
LDAA NUM2 ;Checks to see if C bit is set on ACCA
ROLA
BCS Add_Value ;If C bit is set to 1 then
RTS
Add-Value:
Start LDD NUM1 ;Loads the orginal number stored at NUM1
ROL ;Takes the number in D and shifts the bits to the left
DECB
BNE Start
STD $00,X
INX
RTS

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.