Discuss Scratch

ethernetexplorer
Scratcher
100+ posts

How do I create a CPU on Scratch?

I've seen a lot of emulators with CPUs, and I want to create one. I tried looking for a tutorial online but couldn't find anything.
aifewifewf
New Scratcher
8 posts

How do I create a CPU on Scratch?

Understand how the CPU works, then I guess try creating it. You could use other projects as a reference, but make sure to give credit to them.
NuclearKitten64
Scratcher
100+ posts

How do I create a CPU on Scratch?

A cpu is just a processor that solves complicated math to process physics in a game or a calculator app on a computer. The operations blocks are basically the building blocks of a cpu. of course you could make a binary decoder.
PPPDUD
Scratcher
1000+ posts

How do I create a CPU on Scratch?

You should try making your own instruction set and then make an interpreter for that.
ethernetexplorer
Scratcher
100+ posts

How do I create a CPU on Scratch?

PPPDUD wrote:

You should try making your own instruction set and then make an interpreter for that.
I want to create something like this: https://codeguppy.com/code.html?simple_vm/vm1_fibonacci
lgrov44
Scratcher
500+ posts

How do I create a CPU on Scratch?

You need, most of the time, 3 parts:
1. Input Part
2. Thinking Part
3. Output Part

1. The Input Part: The CPU needs to understand the position is such a way that it can compute with that position. An example of this is converting the position into a list or multiple lists. Doing this, you can move onto the next part, the thinking part.

2. Thinking Part: Now, there are a few ways it can calculate what to play next. It could be automatically stored in it for what to do, it could randomly play a move, etc. This is why the Input Part is important.

3. Output Part: It now, after calculating the move to play, play the move it wanted to play. You could do this by placing a piece in a certain position, move a piece to a certain position, convert the list to the position (If you used this method), etc. This is basically how to make a CPU.

Last edited by lgrov44 (Nov. 30, 2022 20:40:34)

PPPDUD
Scratcher
1000+ posts

How do I create a CPU on Scratch?

ethernetexplorer wrote:

PPPDUD wrote:

You should try making your own instruction set and then make an interpreter for that.
I want to create something like this: https://codeguppy.com/code.html?simple_vm/vm1_fibonacci
Oh. In that case, I will be to little use.
ethernetexplorer
Scratcher
100+ posts

How do I create a CPU on Scratch?

lgrov44 wrote:

You need, most of the time, 3 parts:
1. Input Part
2. Thinking Part
3. Output Part

1. The Input Part: The CPU needs to understand the position is such a way that it can compute with that position. An example of this is converting the position into a list or multiple lists. Doing this, you can move onto the next part, the thinking part.

2. Thinking Part: Now, there are a few ways it can calculate what to play next. It could be automatically stored in it for what to do, it could randomly play a move, etc. This is why the Input Part is important.

3. Output Part: It now, after calculating the move to play, play the move it wanted to play. You could do this by placing a piece in a certain position, move a piece to a certain position, convert the list to the position (If you used this method), etc. This is basically how to make a CPU.
I'm not talking about a CPU in a game. I'm talking about emulating basic functions of a CPU inside of a computer
TheCreatorOfUnTV
Scratcher
1000+ posts

How do I create a CPU on Scratch?

Let's go to the basics:
A CPU is just a Boolean calculator, and the basic operations are AND, NOT and OR. You also need to add the ability to GOTO and to set variables. (Note the instructions and variable names are also Booleans)
So, make a Boolean calculator (which is a pretty similar experience to making a regular calculator, except there is a fixed input length and all inputs are integers), and assign certain digits as input and output, and you now have a working CPU.
Icefan13
Scratcher
100+ posts

How do I create a CPU on Scratch?

I wrote some code for a CPU, but apparently it contained ‘unsuitable language’ and thus it couldn't be posted.
BigNate469
Scratcher
1000+ posts

How do I create a CPU on Scratch?

So… you want to create a VM (Virtual Machine, essentially a software “computer” that mimics hardware in a computer) inside a VM (in this case, Scratch) which very well may be inside a VM (depends on browser and OS, but not too uncommon).
i_eat_coffee
Scratcher
1000+ posts

How do I create a CPU on Scratch?

^Y'all, this topic is from 2022
ThisIsTemp1
Scratcher
1000+ posts

How do I create a CPU on Scratch?

i_eat_coffee wrote:

^Y'all, this topic is from 2022

Cheddargirl once said (need source tho) that is isn't necroposting unless the alleged necropost is spam or topic no longer relevant. The bump looks relevant I think(walks through what you need to know to create an CPU) so it is not necroposting i think.
WindowsAdmin
Scratcher
1000+ posts

How do I create a CPU on Scratch?

ThisIsTemp1 wrote:

i_eat_coffee wrote:

^Y'all, this topic is from 2022

Cheddargirl once said (need source tho) that is isn't necroposting unless the alleged necropost is spam or topic no longer relevant. The bump looks relevant I think(walks through what you need to know to create an CPU) so it is not necroposting i think.
But like the guy probably already got the answer, so yeah it’s allowed but why?
TheCreatorOfUnTV
Scratcher
1000+ posts

How do I create a CPU on Scratch?

i_eat_coffee wrote:

^Y'all, this topic is from 2022
DONT TELL ME I'M GOING TO GET BANNED!!!!!!!!!!!!!
donotforgetmycode
Scratcher
1000+ posts

How do I create a CPU on Scratch?

TheCreatorOfUnTV wrote:

i_eat_coffee wrote:

^Y'all, this topic is from 2022
DONT TELL ME I'M GOING TO GET BANNED!!!!!!!!!!!!!
you won't get banned just for posting in an old topic, don't worry
i_eat_coffee
Scratcher
1000+ posts

How do I create a CPU on Scratch?

ThisIsTemp1 wrote:

i_eat_coffee wrote:

^Y'all, this topic is from 2022

Cheddargirl once said (need source tho) that is isn't necroposting unless the alleged necropost is spam or topic no longer relevant. The bump looks relevant I think(walks through what you need to know to create an CPU) so it is not necroposting i think.
don't think that applies to this question because this user already got a few answers, and likely already built it or gave up (??)

Powered by DjangoBB