I'm trying to do a simple multiplication with Marie to do (a * b) * (c * d). I'm able to do it by making a new subroutine for every multiplication step, but I want to try and use JnS to just use a single subroutine. Heres my chunk of code
Clear
Store result
Input
Output
Store a
Load a
Skipcond 800
Jump negres
Input
Output
Store b
Load b
Skipcond 800
Jump negres
Input
Output
Store c
Load c
Skipcond 800
Jump negres
Input
Output
Store d
Load d
Skipcond 800
Jump negres
Load a
Store X
Load b
Store Y
JnS loop
Load zoop
Store X
Load zoop
Store Y
Load result
Store Y
Load c
Store X
JnS loop
Load zoop
Store X
Load zoop
Store Y
Load result
Store Y
Load d
Store X
JnS loop
Jump halt
loop, Load zoop
Load result
Add Y
Store result
Load X
Subt one
Store X
Skipcond 400
Jump loop
Load zoop
JumpI loop
negres, Load zoop
Store result
Jump halt
halt, Load result
Output
Halt
a, DEC 0
b, DEC 0
c, DEC 0
d, DEC 0
zoop, DEC 0
X, DEC 0
Y, DEC 0
one, DEC 1
result, DEC 0
The issue lies in the first time I call loop, it goes through the first iteration, passes the Skipcond then jumps back out of the subroutine to the instruction after where it was called.
This is my first time using JnS, so any help would be greatly appriciated!