It is a homework and I'm stuck here. Any help is appreciated.
I'm trying to print odd numbers up to a user input value (say 6 or 7). I have the following code which kind of does what I want but not exactly.
Here is my code:
org 100
input /ask for input
store num /store the input as num
load one
store oddnum /store 1 as odd number
output /print odd number, prints 1
oddloop, load oddnum /start of loop
add two /adds 2 in previous odd number value
store oddnum /stores the new odd number
output /prints odd number
load num /loads user input
subt oddnum /input value minus current odd number value
skipcond 000 /skips next line if value is negative
jump oddloop /jumps to loop
halt /end program
zero, dec 0
one, dec 1
two, dec 2
num, dec 0
oddnum, dec 0
if the user input is 7; it prints
1 3 5 7 9
here, expected output is 1 3 5 7
if the user input is 6; it prints
1 3 5 7
here, expected output is 1 3 5