Assembly lesson 1

in programming •  7 years ago  (edited)

Lesson 1.

Subject: Generally what is inside computer.

For details how computer parts interact witch each other we will back. Simplest computer is Turing machine. In short words is just long (infinite long) tape, and head on it.
Head can move freely in two directions and modify tape, based on program written on tape. Sounds impossible?

And here you are wrong.
The computer on which you are reading this post also has a very long "tape" and "head". RAM memory is that "tape" and CPU is "head". That's it we have simplest computer. But we also need Input and Output circuit to communicate with it for:

  • Input Data
  • Output Data
  • Input Programs

Even before the first computer was built, Von Neumannproposed that it would be good if the memory of the code and data was in one place. This is the solution that reigns in general purpose computers like PC, Laptops,Smartphones, Smart TV and so on.

It gives us a lot of flexibility, we can write a simple code to grind large amounts of data or a large code that operates on small amounts of data. This solution is not without flaws.The processor is pretty stupid, and that it just read data or code is decided by context. To make you realize this show you one byte from memory, for simplicity let's assume that it's Intel x86:

0x61H

What it mean?

If CPU expect data it is a "a" or "POPA" command, that puts all the registers on the processor stack, if CPU expect the command.
As you probably see, building a processor that still has to "think" whether we are talking about data or code may be difficult.

Another approach is presented by Harvard architecture. Here we honor a very early construction built just at Harvard University. This computer had a completely different data memory, which was on the relays and the code memory built on the punched tape .
The width of the data in both directories is different. This organization has many advantages:

  • You can simultaneously get data and code from 2 separate memory.
  • More security than the Von Neumann Architecture

You are probably curious why the Harvard is safer. The point is that during the execution of the program, the memory in which it is stored is read-only, which effectively prevents buffer overflow attacks, and other uses that data entered by the user can be treated as code to be processed.

Harvard architecture is used where memory flexibility is not necessary. Usually with that architecture we will meet in microcontrollers like ATmega (Arduino part).

On this I wanted to finish my first lesson. What you should remember is that the computer consists of 3 things:

  1. Processor
  2. Memory (separate for code and data or shared)
  3. Inputs / outputs

I hope this is understandable.
I ask you for your comments and questions if something is incomprehensible.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Congratulations @wytrzeszcz! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

Award for the number of comments

Click on any badge to view your own Board of Honnor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

If you want to support the SteemitBoard project, your upvote for this notification is welcome!