How does memory represent non value operations, and how does and electron gun get varying informatio

Soldato
Joined
17 Jun 2012
Posts
11,259
I get how memory is structured into bits and bytes and 8 bits which can either be 0 or 1 can represent up to 255. So by adding bytes together you can go up to whataver values the cpu is built to deal with. But how do you store say an addition or multiplication in bits and bytes or any other operation such as looping. Or maybe the CPU compiles all operations into values before it stores them in memory, I think this is minicode compiler or something. Basically how does memory work?

I think I can't get out of the abstraction layer and into pure hardware, which is ultimately just a voltage on or off. And for that matter, taking a CRT cathode ray tube, it's rows of pixels with each pixel having three colours and depending of the energy of the electrons hitting each 1/3 of a pixel simultaneously you can build up all the possible colours etc. So how do you tell the electon gun that you want a certain pixel at a certain intensity using the binary principle of on or off, are the voltages from incoming data varied to tell the electron gun this or how does it work?

In other words how do you go from bits and bytes in memory to varying electron energies in the the gun?
 
Soldato
Joined
4 Mar 2010
Posts
5,038
I'm confused too!

The ALU deals with the Maths then the value would be sent down the data bus to the ram.

As for the CRT I'd say there's probably a chip which deals with processing the binary signal.
 
Soldato
OP
Joined
17 Jun 2012
Posts
11,259
It was a bit of a confusing post. I guess what I was saying is, taking a CRT for example, as far as my simplistic idea of how they work is, you have rows of pixels and the electron gun scan down these at about 25 times a second, there must be 3 guns per pixel, RGB etc. So the only info the gun needs is how is what intensity to illuminate each 1/3 of a pixel with.

As you said you have streams of data coming through the bus to the gun. So where is the point where all these bytes of data are actually assigned into coordinates for the guns to know what pixel to shine at what intensity.
 
Man of Honour
Joined
13 Oct 2006
Posts
92,068
CRT don't work like that - the gun typically pans across the screen, moves down a line, pans again, once its gets to the bottom it resets to the top of the screen and repeats again - it doesn't target a specific coordinate instead you have a stream of data and it just takes the next waiting 24 bits of data and paints them to the next pixel it scans to. (In a CRT some digital to analog conversion goes on).

To sync this up data sent to the screen is stored in a buffer the first entry will correspond to top left of the screen the last entry to bottom right, etc. when the gun resets to the top it starts reading from the start of the buffer again.
 
Last edited:
Associate
Joined
14 May 2010
Posts
1,136
Location
Somerset
Good questions. I presume you want an overview of how a computer works?

I like to use the good old ZX Spectrum as an example of this, because it's a relatively simple computer.

The ZX Spectrum had a total of 64K of memory (48K ram, 16K rom). As you know, the memory of the computer is simply a load of 0 or 1 values. The memory can be represented as a 'memory map'. Here's the memory map for the spectrum...

http://wordpress.animatez.co.uk/wp-content/uploads/2012/07/table_spectrum_memory_map.png

So the memory is seperated into blocks. The bits we are interested in are the first block (ROM), second and third block (Screen memory) and the 7th Block (RAM). The ROM is set with data when the Spectrum is created and will always remain even when turned off.

When a spectrum is running, it does two things in parallel:

1) The CPU reads 8 bits of memory from the ROM and acts upon it (more later)
2) The ULA chip takes the contents of the Screen Memory and outputs it to the screen - The screen memory maps exactly to what you see on the screen. A '1' bit would be a turned-on pixel on the screen. A '0' bit would be a turned off pixel. (The ULA also handles other things, such as keyboard input, but that's irrelevant for now)

So the ULA is just dumping the contents of memory to the screen. Something needs to write to this memory to make it display something useful... That's one of the things the CPU is doing.

When running, the CPU goes through the following loop:

1) Read 8 bits of memory from the ROM (starting at the top)
2) Translate these 8 bits into a command
4) Read any extra information it needs for this command
3) Exectute the command
4) Move to the next 8 bits (depending on what the command did).

A list of commands the CPU understand is here - http://www.z80.info/z80syntx.htm

A lot of the commands are responsible for moving data around in memory. This allows the CPU to write information to the Screen Memory, which would result in something being ouputted to the screen. So the CPU could execute a command which writes '10000000' to the first byte of screen memory, and the top-left pixel would turn on.

Other commands exist which allows the programmer to put the CPU into a loop (JP, JR), and to even stop all processing (HALT) which crashes the machine.

When writing a custom program, it is loaded into the RAM area of the memory map and the CPU is told to start reading commands from there instead. Remaining memory in the RAM section can be used to store information the program needs (variables etc).

Modern CPUs are much more complex than this now, but that's a basic overview of how they work.

Hope this helps!
 
Back
Top Bottom