Algorithms tell processors how to manipulate data, but how do we store algorithms and data in a computer?
2.
The Progression: • we study how data is represented and stored • we study how a processor can manipulate data • we study how to represent algorithms to the computer (a programming language) • we study the algorithms that instruct the processor in the solution of problems
3.
We want to represent human knowledge in a computer • Numbers (this was the goal of the earliest computers) • Words (ideas … humans use written language to represent ideas) • Images • Sounds • Smell • Touch (haptic sense) • Other?
4.
BINARY codes … easier to build devices • ON / OFF(transistor) (capacitor) • CHARGED / UNCHARGED • N-POLE / S-POLE (magnetic disk or tape) • REFLECTED LIGHT / SCATTERED LIGHT (CDROM) • 0 / 1 ... to represent the two states ... no meaning in themselves
Foundations of CS
William J. Taffe
TRANS
12 September 2001
5.
ASCII Code ... binary representation of keyboard • Tables represent char, decimal equivalent TRANS • Can represent all “western” alphabet characters … 8-bit → 256 chars • Handout of the full code • Sometimes only given by 7 bits (7 bits -> 128 chars) • Codes 0..31 represent “nonprintable” ASCII control characters … print “weird” things on the screen TRANS
6.
Uniode … the “modern”, international representational code • 16-bit → 65,536 chars … able to include all alphabets and scripts used today. • Java uses unicode • First 8 bits (256 char) are the same as ASCII
7.
Other Codes • BCD ... Binary Coded Decimal ... just for numbers and capital letters • EBCDIC …Extended Binary Coded Decimal Interchange Code (IBM Mainframes only)
8.
Sequence of events from striking a key (eg. The letter “A” or the number “1”) to storage and use in a computer
Foundations of CS
William J. Taffe
12 September 2001
9.
Binary representation of our decimal numbers Binary 0 = 010 1 = 110 but there is no 2 in binary ... only 1 and 2 Decimal 0 1 2 3 4 etc. 0
Binary ⇔ Decimal Conversions • Examples using concept of place value for binary numbers
Foundations of CS
William J. Taffe
12 September 2001
BINARY is hard on the eyes ... therefore we use decimal or hexadecimal to represent binary ... hex is easier Decimal 00 01 02 ... 09 10 … 14 15 16 17 ... 31 32 33
Memory cells ... bit, nybble, byte, word ... define • Modern cells store one byte
12.
Cell has an address and content ... Post Office analogy TRANS • RAM, ROM, Cache ... follow the post office box analogy
13.
Hard disk, floppy disk TRANS • Tracks and sectors • Floppy disk holds 1.4 MB (high density) 80 char/line X 40 lines/page X 600 pages = • (Our text ... 1,920,000 chars = 1,920,000 bytes = 1,875KB = 1.8 MB • Hard disk holds 10 GB ... or about 6000 text books!
Question? How many textbooks (of the size of our text) would fit on a ZIP disk? 14.
Graphics and Music … Codes are good for much of the work of computers ... except for two things • graphics • music
Foundations of CS
William J. Taffe
12 September 2001
15.
Graphic images CRT TRANS • Scan on monitor TRANS • RGB Guns and Shadow Mask TRANS • Memory stores a value for each RGB point in the Shadow Mask • Memory values are sent to appropriate electron gun which • creates the correct intensity of the electron beam
16.
Representation of Colors TRANS Graphics ... bit maps • 24 SVGA 800 X 600 ... 24 bits (2 colors) … 1.37 MB • floppy disk is 1.4 MB except that we use compression and • storage/compression techniques such as .jpg .gif .bmp .tif
17.
Music … musical sound • sampling and digitization • D -> A converters
18.
Calculations ... codes are not good for addition and other arithmetic operations. Therefore we transform numbers to a different format ... and it is the responsibility of the program to know what format to put things in!
19.
Integer Addition of positive numbers 0+0=0 0+1=1 1+0=1 1 + 1 = 10 reset the place and put one in the next level ... just like 9 + 1 = 10 0100 0110 -----1010
20.
0111 0111 -----1110
1100 0110 -----10010
Never more complex ... because we never add more than two numbers at a time ... explain adding a column.
Negative integers ... various methods to represent negative numbers • Sign-magnitude • Two’s complement
Foundations of CS
William J. Taffe
12 September 2001
21.
Sign-magnitude representation … most significant bit represents the sign ... the other bits represent the number • XYYY = X000 -> X111 => 0..7 • XYYYYYY = X0000000 -> X1111111 => 0 .. 127 • All computers have a largest number • Advantage ... it’s easy • Disadvantage ... arithmetic rules don’t work
22.
To form two's complement • Form number in binary • If it is negative • Take its complement • Add one • If the MSB is 1, the number is negative • Advantage ... arithmetic rules work • Disadvantage ... it’s a bit more complicated to understand • An example -4
23.
Subtractrion of Integer numbers • Not necessary … form negative of second number and add!
24.
Floating Point … real numbers … 2.37 or 5.6X10 • Leave to the course in Computer Hardware
Hex 0 1 2 3 4 5 6 7 8 9 A B C D E F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
Binary Char 00000000 00000001 00000010 Etc. ♥ ♦ ♣ • Etc.
00011111
William J. Taffe
Symbol NULL SOH STX ETX EOT ENQ ACK BEL BS HT LF VT FF CR SO SI DLE DC1 DC2 DC3 DC4 NAK SYN ETB CAN EM ESC FS GS RS US DEL
Meaning Null Start of Heading Start of Text End of Text End of Transmission Enquiry Acknowledge Bell Backspace Horizontal Tab Line Feed Vertical Tab Form Feed Carriage Return Shift Out Shift In Data Link Escape Device Control 1 Device Control 2 Device Control 3 Device Control 4 Negative Acknowledge Synchronous Idle End of Transmission Block Cancel End of Medium Escape File Separator Group Separator Record Separator Unit Separator Delete