Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SET 0 10 //sets address 0 (the first memory slot) to 10
- SET *0 1 //*0 gets the value at 0, which is 10, so this sets memory slot 10 to 1
- ADD 10 1 //explicitly set to act on the tenth memory slot, adds 1 to it
- Variable/Address/Memory slot 0 is now 10, and 10 is 2.
- All the values inbetween 1-9 are still uninitalized.
- -----------------------------------
- SET 0 1 //sets 0 to 1
- SET *0 2 //sets 1 to 2 (*0 is a refence to 1)
- SET **0 3 //sets 2 to 3 (*0 is a reference to one (*1), and *1 is a reference to 2)
- 0 is 1
- 1 is 2
- 2 is 3
- -----------------------------------
- SET 0 0
- LABEL LOOP
- ADD 0 1
- IF_LESSTHAN 0 10
- JUMP LOOP
- END
- SET 1 1
- Initalizes variable 0 as 0.
- Adds 1 to it and loops 10 times until variable 0 is not less than 10.
- Then sets variable 1 to 1.
- -----------------------------------
- SET 0 0
- LABEL START
- ADD 0 1
- SET *0 5
- IF_LESSTHAN 0 10
- JUMP LOOP
- END
- Initalizes 0 as 0.
- Adds one to 0 and then sets the variable at the integer stored at 0 to 5.
- 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