380 likes | 456 Views
Computer Systems 2009-2010. Week 8: 3-bit – The Display Amanda Oddie. What we did last time. STD 30 sends to printer LDD 31 gets data from keyboard We can load programs from hard disc We can read a data file with LDD 29. What we shall do today. Mnemonics and binary
E N D
Computer Systems2009-2010 Week 8: 3-bit – The Display Amanda Oddie
What we did last time • STD 30 sends to printer • LDD 31 gets data from keyboard • We can load programs from hard disc • We can read a data file with LDD 29
What we shall do today • Mnemonics and binary • The ASCII Character Set • The 3-bit display • Switching from pixel mode to character mode
Mnemonics • So far all our instructions have been written as Mnemonics. • Mnemonics are easier for humans to understand • 3-bit is able to understand mnemonics but real computers can only understand binary • they need a special program called an assembler to translate the mnemonics into binary
op-code is 010. The mnemonic is LDI A 3-bit instruction in binary 0 1 0 0 1 1 1 1
A 3-bit instruction in binary 0 1 0 0 1 1 1 1 This represents the number to be copied into the accumulator. It is in the form of a binary number
Decimal and Binary numbers • 357 in decimal is interpreted as: • i.e. three(3) 100s and five (5) 10s and seven(7) units
Decimal and Binary numbers • 0 1 1 1 1 in binary is interpreted as: • i.e. zero 16s plus one 8 plus one 4 plus one 2 plus one unit = 15
A simple program • What will end up in the AC ? 01001010 01110100 10010100 01111110 10110100 00000000 Remember: First 3 digits are the OP-CODE, last 5 digits are the OPERAND! Try it on the exercise handout
A simple program • What will end up in the AC ? 01001010 01110100 10010100 01111110 10110100 00000000 Much easier, that’s why mnemonics were developed LDI 10 STD 20 ADD 20 STD 30 SUB 20 STP Accumulator ends up with 10
Memory mapped locations • Locations 18 – 25 are mapped directly to the display device • Location 26 is also connected to the display device. It determines the screen mode
Data structure corresponding to the array of pixels in the monitor • Stored in main memory or video adapter • Scans the frame buffer • Activates corresponding pixels on monitor Graphics hardware Program Display
Scanning the display • Full screen scan every 10 milliseconds • (Refresh rate)
The Display • A display is made up of an array of dots that are either lit or unlit. • The dots are called pixels, which is derived from the phrase picture elements. • The image on the typical display is made up from at least tens of thousands of such pixels.
The Display • The closer together the pixels are, the sharper the image on screen. • The distance between pixels on a computer monitor screen is called its dot pitch and is measured in millimeters. • Most monitors have a dot pitch of 0.28 mm or less.
3-bit display • The 3-bit display is made up of 64 dots • 8 pixels across • 8 lines down • Each line is at a separate memory address starting at location 18 • A binary 1 will signify to light the pixel • A binary 0 will not light the pixel
A simple program • What will be displayed?
Confused? Let’s convert the decimal 255 to binary.
A simple program LDD 10 STD 18 STD 19 STD 20 STD 21 STD 22 STD 23 STD 24 STD 25 STP Question: What will be displayed? Memory Address 10 contains the value 255
Character Mode • Memory Address 26 is reserved for display mode • If the value in this address changes from empty or 0 then the display will switch to character mode • Each memory address from 18 – 25 now represents one line of text with positions for 8 characters • the first letter appears in location 18, the second in location 19, the third in location 20 and so forth
Character Mode • Characters in computers are represented by numbers • The number is based on the ASCII codes • ASCII – American Standard Code for Information Interchange
‘A’ has ASCII Code 65 ‘a’ has ASCII Code 65 ASCII Codes
What happens here? 0 LDI 1 1 STD 26 2 LDD 6 3 STD 18 4 STP 5 6 65
Outcome 0 LDI 1 1 STD 26 2 LDD 6 3 STD 18 4 STP 5 6 65
What exactly happens? • 1 is copied into the accumulator • 1 is copied from the accumulator to location 26 • this sets the display to character mode • 65 is copied from location 16 into the accumulator • 65 is copied from the accumulator to location 18 • Location 18 is mapped to the display unit which is now in character mode so it will display the character representation for 65 which is A 0 LDI 1 1 STD 26 2 LDD 6 3 STD 18 4 STP 5 6 65
A little more complex 0 LDI 1 1 STD 26 2 LDD 9 3 STD 18 4 ADD 26 5 STD 19 6 ADD 26 7 STD 20 8 STP 9 65
A little more complex Try it on the exercise sheet
Outcome 0 LDI 1 1 STD 26 2 LDD 9 3 STD 18 4 ADD 26 5 STD 19 6 ADD 26 7 STD 20 8 STP 9 65
What about now? 0 LDI 1 1 STD 26 2 LDD 8 3 STD 18 4 SUB 26 5 JEZ 7 6 JMP 3 7 STP 8 65
Outcome after a number of iterations 0 LDI 1 1 STD 26 2 LDD 8 3 STD 18 4 SUB 26 5 JEZ 7 6 JMP 3 7 STP 8 65
Final outcome 0 LDI 1 1 STD 26 2 LDD 8 3 STD 18 4 SUB 26 5 JEZ 7 6 JMP 3 7 STP 8 65
Last Week • Last week we looked at the hard disk and data files • Data files could contain numbers that represent text • Remember location 29 is mapped to the disk buffer
Next Week! • The final lecture on 3-bit • Focuses on 3-bit and networking • Network Status • Network Data • Frame Buffer • Destination Address • and so forth!