# Simply Assembly Program Questions

Discussion in 'OT Technology' started by n9e9o9, Feb 12, 2004.

1. ### n9e9o9lolOT Supporter

Joined:
Aug 26, 2003
Messages:
5,083
0
Location:
ATX
Hi!

I could use some help with making this basic Assembly program for my intro comp class (Ive had little exp wit programming). These are the instructions:

"Assume that memory locations 79 and 80 are preset with the values 0 and 1 respectively (this will help you). Write in *Little Man Language a program that will read in two numbers and will output a 0 if they are equal and a 1 if they are not."

*Note: the Little Man Computer is Java applet from this website... http://www.cs.yorku.ca/~peterc/simulator/simulator.html

Some of the functions I can only use:
STOP
STORE
SUBTRACT
PRINT
BRANCH
BRANCHZ
BRANCHP

So far this is what I have:

01 STORE 13
02 PRINT
04 STORE 14
05 PRINT

I'm not sure where to go with this.......how do equate two numbers when you can only store one number in the register?

Thanks for any help.

2. ### AstroCode Monkey

Joined:
Mar 18, 2000
Messages:
2,047
0
Location:
Cleveland Ohio
3. ### EkriirkEZika XenuOT Supporter

Joined:
Jan 11, 2004
Messages:
14,799
0
Location:
Dublin & San Francisco, CA
Child's play.
Assuming BranchZ X means "goto X if the last math instruction resulted in 0"
Use subtranction to compare the numbers A & B

I'm guessing this pseudo machine LOADs X into an "internal register", then the math routines use that number in conjunction with the second number for that instruction

like to display the addition of what is in location 13 and 14 would work like
PRINT

if A-B is 0 then they are equal, branchz to a spot where you can Print 0
otherwise print 1 and terminate

Last edited: Feb 12, 2004
4. ### n9e9o9lolOT Supporter

Joined:
Aug 26, 2003
Messages:
5,083
0
Location:
ATX
ok how do u print a 1? i got the BRANCHZ part down but not sure how to display the one.....

Joined:
Jan 11, 2004
Messages:
14,799