___--------====TUTORIAL====--------___ TYPE 'RUN' TO RUN THE CODE 1. COMMANDS: write text add 1 1 sub 2 1 mul 4 4 div 4 2 push sr spc lpc pop ; THIS IS A COMMENT. COMMENTS START WITH ';' clrsc Function commands: RP 5 :function write test jmp function the RP will say how many times we will allow this function to loop. the ":function" is defining a new function with the name 'function'. The write command is just the code inside of the function. the jmp function will go to the function. So the result would be it printing "test" 5 times. 2. THE RAM SYSTEM: If you are familiar with lists in scratch, thats what the RAM is. To start, there is a variable that will always have whatever was the answer to the last equation. For example, if I added the numbers 4 and 7 together like this: add 4 7 The variable will be set to 11 (or 4 + 7). If after that, i did another equation like this one: mul 3 4 it will override the last answer and replace it with the new answer 12. In order to save the answers, you have to use the push command. What this will do is take the variable with the answer, and add it to RAM. so if I ran this code: add 1 2 push sub 5 3 push the ram would look like this: 3 2 Then we can access the ram in many ways. 1. If we want to print a variable in the ram. We could run code like this: pop add 5 3 push write R_1 the result would be 8 in the console. The command 'pop' will clear anything in the RAM. we can also add 2 different parts of the ram together like this: add R_1 R_2 which will add the first and second item in the RAM. another command is the 'sr' command which can be used like this: sr 1 5 now this will take the first item in the RAM, and set it to the number 5. If we wanted to set it to another part of the ram, it would look llike: sr 1 R_3 which will set RAM item 1 to RAM item 3. The first command 'write' will allow you to write something to the screen. for example, if I do: write hello it will print to the console "hello". EXTRA FUNCTIONS NOT MENTIONED: 'clrsc' - this clears the screen. 'spc 81' - this sets a cloud variable to the value 81 in this example. 'lpc' - this takes the cloud variable and then loads it to our equation variable where we can push it into ram. so a full program may look like this: clrsc pop add 1 0 push write R_1 RP 8 :loop mul R_1 2 pop push clrsc write R_1 jmp loop That was probably really confusing, I'm bad at explaining. Just play around with it and you will catch on how to use it.
This project was made by me and my idea. This was made to get people who use scratch to be a bit familiar with the coding in text world. In this example, I've made a super simple and different version of the programming language "Assembly". Assembly is one of the more complicated language as its the closest to machine code and is actually used to make your Operating System boot. If you were making an OS, you would start with assembly. I will be making more of theme mini-programming-languages in the near future so stay tuned for that! Next one will either be python, java, or C. Reply with which one you would like! I will probably go with python. I might update this in the future.