Advertisement
Guest User

Untitled

a guest
Sep 30th, 2013
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. SET 0 10 //sets address 0 (the first memory slot) to 10
  2. SET *0 1 //*0 gets the value at 0, which is 10, so this sets memory slot 10 to 1
  3. ADD 10 1 //explicitly set to act on the tenth memory slot, adds 1 to it
  4.  
  5. Variable/Address/Memory slot 0 is now 10, and 10 is 2.
  6. All the values inbetween 1-9 are still uninitalized.
  7.  
  8. -----------------------------------
  9.  
  10. SET 0 1 //sets 0 to 1
  11. SET *0 2 //sets 1 to 2 (*0 is a refence to 1)
  12. SET **0 3 //sets 2 to 3 (*0 is a reference to one (*1), and *1 is a reference to 2)
  13.  
  14. 0 is 1
  15. 1 is 2
  16. 2 is 3
  17.  
  18. -----------------------------------
  19.  
  20. SET 0 0
  21. LABEL LOOP
  22. ADD 0 1
  23. IF_LESSTHAN 0 10
  24. JUMP LOOP
  25. END
  26. SET 1 1
  27.  
  28. Initalizes variable 0 as 0.
  29. Adds 1 to it and loops 10 times until variable 0 is not less than 10.
  30. Then sets variable 1 to 1.
  31.  
  32. -----------------------------------
  33.  
  34. SET 0 0
  35. LABEL START
  36. ADD 0 1
  37. SET *0 5
  38. IF_LESSTHAN 0 10
  39. JUMP LOOP
  40. END
  41.  
  42. Initalizes 0 as 0.
  43. Adds one to 0 and then sets the variable at the integer stored at 0 to 5.
  44. After the program has run, 0 should be 10, and variables 1-10 should all be 5.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement