THIS IS NOT HOW ASSEMBLY WORKS! Look in the notes and credits to read more. Instructions: ADD x - Add x to Value SUB x - Subtract x from Value MUL x - Set Value to the product of Value and x DIV x - Set Value to the quotient of Value by x MOD x - Set Value to the modulus of Value by x PUSH m - Set Memory location m to Value CLEAR - Set Value to 0 MOVE o - Offset all references to Memory locations by o GOTO p - Set Current Line to p EQUAL x p - If x is equal to Value, set Current Line to p GREATER x p - If x is greater than Value, set Current Line to p LESS x p - If x is less than Value, set Current Line to p EXISTS m p - If Memory location m exists, set Current line to p External integration Instructions: CALL s x - Broadcasts the message d:x where d is a one-word string YIELD s x - Broadcast and waits the message d:x where d is a one-word string RECV - Set Value to _value_extern You can use the value of a memory location as an argument by using #x, where x is the line of memory. You can use as many # signs as you want. (e.g. ##1 would reference the value at the memory location of #1) You can put a - symbol before any input to invert it. For example, MOVE -#1 will move the Memory Offset back #1 spaces. You can use VAL to use Value as an argument. You can use HEAD to use Current Line as an argument. All memory locations are unsigned 8-bit integers, meaning they can contain integers between 0-255, with underflow and overflow. The value is an unsigned 32-bit integer, meaning it can contain integers between 0 and 2147483647.
"Why make code fast when you can make it slower and 10 times more impressive?" This is not how assembly works and is a vast simplification of everything that goes into it. Real assembly that low-level software developers use is much more complicated and much more powerful than this "Scratch Assembly." However, this should hopefully give scratchers like yourself an appreciation for how hard it can be to program in assembly code. Q: Don't the external integration instructions allow someone to just write whatever code they want and then call it from Scratch ASM? A: Yes, but they could do that before anyways. By creating a formalized method of doing such a thing, it encourages working within Scratch ASM instead of working primarily outside. Q: Will the user be able to write their own instructions? A: Good question! Once BUFR, YANK, WRITE, and ! are added, this will be possible. Q: What are BUFR, YANK, WRITE, and '!'? A: BUFR will be used as a value for m in any instruction. As an example usage, PUSH BUFR will append the current value to the Buffer variable. YANK as an instruction will clear Buffer. As an input it will use the contents of Buffer as a string for any s argument. WRITE will take in a string and write it at the specified program line. If the specified line is <= 0, it will be appended to the end of the program. '!' is similar to '#' in that it can precede a number. However, ! may only be used at the start of a value, and it converts the value to the standard ascii character of that value. For example, BUFR !#VAL will append 4 bytes to the end of Buffer. Note that while ! does not ignore NULL bytes, Scratch has no way of representing them, along with a number of other special characters. For that reason, they will act as an empty string. Q: When will this be added? A: I don't know, but probably not for a while.