Discuss Scratch

rishi272011
Scratcher
100 posts

Help with How Computers work

On the Hardware side, I know that Computers use logic gates and logic to execute programs in Machine Language from their ROM.
On the Software side, I know up to Assemblers and Assembly Language which ‘assembles’ into machine specific Binary.

My questions:
  • What connects the two?
  • Is the assembled code directly stored in the ROM?
  • What about the OS? What about the executables (like EXEs)? Aren't they stored in the RAM? Does the architecture matter?
  • Where is the firmware stored?

My apologies if this sounds too complex or difficult to explain. Please provide places I can learn more about these points.

Last edited by rishi272011 (Aug. 10, 2024 14:50:14)

miteswell
Scratcher
5 posts

Help with How Computers work

pendowncansomeonegivemeanIdeaforanadvancedscratchproject:D
setyto12

Last edited by miteswell (Aug. 10, 2024 12:23:56)

speakerset
Scratcher
16 posts

Help with How Computers work

Look at assembly language, it is the most bare-bones language their is, below it is just 1’s and 0’s
gilbert_given_189
Scratcher
1000+ posts

Help with How Computers work

rishi272011 wrote:

What connects the two?
See memory-mapped I/O and port-mapped I/O. Each computer does it differently, but the main gist is that there are specific memory addresses that could be read/written by the CPU that correspond to hardware I/O.

rishi272011 wrote:

Is the assembled code directly stored in the ROM?
Not necessarily. Assembled code can also run in RAM (in fact, this is the most common way to run assemblies nowadays with the existence of OSes and their dynamic loading).
It's just back when computers distribute software with cartridges, the computer program is stored in ROM, since that's the only effective long-term storage they have, aside from software on disk/tape which has to be loaded to RAM first before being run.

rishi272011 wrote:

What about the OS? What about the executables (like EXEs)? Aren't they stored in the RAM?
This differs from one computer to another. Most old microcomputers have their OS (or something like it) built-in in ROM, while others had none of such, requiring the firmware to load it from disk to RAM to be executed by the CPU. (Or sometimes, the firmware loads a program to help booting into the OS, usually called a bootloader or a boot manager.)
Executables files are always run in RAM. (the data is not usually directly accessible by the CPU, exceptions to that are called execute in place)

rishi272011 wrote:

Does the architecture matter?
Yes. Each CPU has a different instruction set, executable formats comes in many forms, and there's also different standards on what the registers are being used for in different OSes. All of those make a slightly different and (almost always) incompatible formats.

rishi272011 wrote:

Where is the firmware stored?
Most likely in ROM or EEPROM if you want to flash your own firmware (which is a thing people do).

Last edited by gilbert_given_189 (Aug. 14, 2024 06:56:26)

rishi272011
Scratcher
100 posts

Help with How Computers work

gilbert_given_189 wrote:

main quote
Thank you very much!
10goto10
Scratcher
500+ posts

Help with How Computers work

Very old computers had switches on their front panels where you could hand-load your assembled program and then start that program at a specific address. So, at one time, people connected the two (executing a program and machine language programs).

An upgrade was made to the design of computers that allowed the computer to start executing a program stored in ROM when it was turned on or restarted. It then might start reading data from a disk drive location and then jump to a memory location in it’s RAM where that disk data was stored. I found this very old topic on another site http://www.retrotechnology.com/pdp11/pdp8i_boot.html


Wikipedia says “ Early Intel processors started at physical address 000FFFF0h”. https://en.wikipedia.org/wiki/BIOS#System_startup


rishi272011 wrote:

  • … What about the executables (like EXEs)? Aren't they stored in the RAM? Does the architecture matter?
After an executable is loaded into RAM it is data that is interpreted as instructions by either the logic gates in the computer or by another program that is interpreting it. Linux scripts are often called ‘executables’. Here is a much longer answer that I think might help https://stackoverflow.com/questions/59826292/where-is-the-difference-between-binaries-and-executables-in-the-context-of-a

Except people don’t say that a CPU ‘ interprets ’ the machine language code stored in its RAM. The term I remember is ‘decode’. The CPU decodes the contents of a memory location starting with the opcode (like add, complement the accumulator, jump to location, disable interrupts, so on).

Good luck with your study. I’m using an iPad which does not have a disk drive and would not know what to do with machine language for a PC so architecture does matter.


novice27b
Scratcher
1000+ posts

Help with How Computers work

gilbert_given_189 wrote:

This is a really great answer!
blubby4
Scratcher
100+ posts

Help with How Computers work

gilbert_given_189 wrote:

Executables files are always run in RAM (the data is not even directly accessible by the CPU)
This is generally true, however note that it isn't always the case, see here
Mr_rudy
Scratcher
100+ posts

Help with How Computers work

rishi272011 wrote:

On the Hardware side, I know that Computers use logic gates and logic to execute programs in Machine Language from their ROM.
On the Software side, I know up to Assemblers and Assembly Language which ‘assembles’ into machine specific Binary.

My questions:
  • What connects the two?
  • Is the assembled code directly stored in the ROM?
  • What about the OS? What about the executables (like EXEs)? Aren't they stored in the RAM? Does the architecture matter?
  • Where is the firmware stored?

My apologies if this sounds too complex or difficult to explain. Please provide places I can learn more about these points.
i would recommend getting a Ben Eater 6502 kit here, you will learn a lot
blubby4
Scratcher
100+ posts

Help with How Computers work

Mr_rudy wrote:

rishi272011 wrote:

i would recommend getting a Ben Eater 6502 kit here, you will learn a lot
You don't even need to get the kit, I learned a lot watching the videos of him making the breadboard computer a while back

Powered by DjangoBB