0

I am totally lost when it comes to assembly language. My teacher just decided one day at the end of this semester to give us a programming assignment in assembly language and has barely taught us anything. I have to use five subroutines: main, add, subtract, multiply, divide and cannot use any global variables (no .BLOCK variables). main should read in the two values and pass them as parameters to the other 4 subroutines. My addition and subtraction work fine, but multiplication and division i have no idea on. I am still pretty confused on stacks and haven't been able to find much info on them in this format of assembly language. Any help would be appreciated.

```
BR main
;ADD METHOD
param1: .EQUATE 6
param2: .EQUATE 4
sum1: .EQUATE 0
add: SUBSP 2,i
LDA param1,s
ADDA param2,s
STA sum1,s
DECO sum1,s
CHARO '\n',i
RET2
;SUBTRACT METHOD
param3: .EQUATE 6
param4: .EQUATE 4
sum2: .EQUATE 0
subtract: SUBSP 2,i
LDA param3,s
SUBA param4,s
STA sum2,s
DECO sum2,s
CHARO '\n',i
RET2
;MULTIPLY METHOD
param5: .EQUATE 6
param6: .EQUATE 4
sum3: .EQUATE 0
multiply: SUBSP 2,i
LDA param5,s
ASLA ;no idea if this is what is supposed to be used to multiply or not
STA sum3,s
DECO sum3,s
CHARO '\n',i
RET2
;DIVIDE METHOD ;need to find quotient AND remainder
param7: .EQUATE 6
param8: .EQUATE 4
;MAIN METHOD
num1: .EQUATE 2
num2: .EQUATE 0
main:SUBSP 2,i
STRO msg1,d
DECI num1,s
STRO msg2,d
DECI num2,s
DECO num1,s
CHARO ' ',i
CHARO '+',i
CHARO ' ',i
DECO num2,s
CHARO ' ',i
CHARO '=',i
CHARO ' ',i
CALL add
DECO num1,s
CHARO ' ',i
CHARO '-',i
CHARO ' ',i
DECO num2,s
CHARO ' ',i
CHARO '=',i
CHARO ' ',i
CALL subtract
DECO num1,s
CHARO ' ',i
CHARO '*',i
CHARO ' ',i
DECO num2,s
CHARO ' ',i
CHARO '=',i
CHARO ' ',i
CALL multiply
ADDSP 2,i
STOP
msg1:.ASCII "Please enter the first positive value (0 to quit): \x00"
msg2:.ASCII "Please enter the second positive value (0 to quit): \x00"
.END
```

*Edited
by neighbordave*: n/a