SCRATCH COMPUTER V1.0 (SC1) ---------------------------------------------------------------------------- 1. What is it? The SC1 is a working virtual computer designed for Scratch. It was originally designed as an experiment, but can be used to carry out a number of very simple projects. It's fairly easy to use, but has a lot of features. 2. How to use it? The SC1 has 3 parts: the stack, the memory and the output. These 3 parts can be manipulated via a set of instructions forming the SCLib (for more information, see section 3). - The stack is used to store values, and the one that will be used is always the first. - The memory is used to store long-term values, which can be pushed onto the stack. - Finally, the output displays messages such as errors, warnings or simple values that you decide to print. 3. The SCLib The SCLib (Scratch Computer Library) is the collection of all the blocks and variables created for SC1. They are used to write programs that run on the SC1. ## Variables - stack_size: this variable defines the maximum size of the stack. The default value is 0. - memory_size: this variable defines the maximum size of the memory. The default value is 0. - arg1: this variable represents the first argument passed during instructions, often a stack value. - arg2: this variable works like arg1 but is used to represent the second argument. - retval : the variable which contains the return value - args : the list which contains all the defined arguments ## Instructions - PUSH <value> : pushes the given value onto the stack - POP : removes the value from the top of the stack - ERR <message>: raises an error, printed in the output - WARN <message> : creates a warning, printed in the output - ADD : adds the two values at the top of the stack - SUB : subtracts the two values at the top of the stack - MUL: multiplies the two values at the top of the stack - DIV: divides the two values at the top of the stack - SAVE: passes the value at the top of the stack to memory - LOAD <value>: pushes a value from memory onto the stack OUT: prints the value at the top of the stack in the output IN: requests input from the user and pushes the input value to the top of the stack START: resets all lists in order to start a programme correctly ISEMPTY : check if the stack is empty PEEK : get the value on the top of the stack without removing it NARG : add a new argument RARG : remove an argument 4. Can I make projects and programs for the SC1? Yes, you can contribute to SC1 by adding whatever you like! To do so, follow the steps below: 1. Remix this project 2. Make your own changes 3. In the Notes and Credits section : - Specify the version of SC for which your remix is made - Write down the names of all those who have contributed to helping you - (Optional) Add links to the SC projects that inspired you 4. You can : - Keep your project as it is - Submit it in the SC comments (the correct version) so that it can be added to a future version of SC. To do this: --> Describe and present your changes --> Add a link to your project Your project can be modifications, add-ons or programs for the SC. And a lot of other things! Thank you in advance!
version: 1.0 author: DahroS44 contributors: ... name: Scratch Computer -- NEW UPDATE (1.1) -- 1. What's new in 1.1? New custom blocks: - isempty : check if the stack is empty - peek : get the value on the top of the stack without removing it - narg : add a new argument - rarg : remove an argument New variables and lists : - retval : the return value - args : the list of the defined arguments -- COMMENT RULES -- > Don't advertise > Be kind with others > Please be constructive when you give your opinion Thanks!