Chapter 1 - Chapter1 Programming ComputersareStoopid...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
Chapter 1 Programming
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Computers are Stoopid • A computer is just a machine • It only does what we tell it to do • Even if it seems to act intelligently, (which  is rare anyway) it just means somebody  wrote a really good program.
Background image of page 2
Why Computers are Stoopid At the most basic level, the brain (CPU) of a computer  can perform one very simple task at a time, such as  adding or subtracting two numbers. Here’s how you tell the computer to add  a  to  b  and put  the result in  c  (using generic assembly code): load @a, r5 load @b, r6 add r5, r6, r7 store r7, @c
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Explanation • The program data is stored in memory at  the locations @a, @b and @c. • The CPU must fetch  a  and  b , add them  together and then store the result to  c . • Each of these actions takes one  instruction to the CPU.
Background image of page 4
But Wait. . . It Gets Worse! Early programmers didn’t even have the luxury of 
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 16

Chapter 1 - Chapter1 Programming ComputersareStoopid...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online