Computer Systems Week 8: 3-bit – The Display Amanda Oddie
2 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
3 What we shall do today Mnemonics and binary The ASCII Character Set The 3-bit display Switching from pixel mode to character mode
4 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
5 Mnemonics MnemonicBrief meaning 000STPhalt 001LDDload accumulator direct 010LDIload accumulator immediate 011STDstore accumulator direct 100ADDadd to accumulator 101SUBsubtract from accumulator 110JMPjump to next instruction 111JEZjump to next instruction if contents of accumulator is zero
6 A 3-bit instruction in binary STP 001LDD 010LDI 011STD 100ADD 101SUB 110JMP 111JEZ op-code is 010. The mnemonic is LDI
7 A 3-bit instruction in binary STP 001LDD 010LDI 011STD 100ADD 101SUB 110JMP 111JEZ This represents the number to be copied into the accumulator. It is in the form of a binary number
8 Decimal and Binary numbers 357 in decimal is interpreted as: i.e. three(3) 100s and five (5) 10s and seven(7) units
9 Decimal and Binary numbers in binary is interpreted as: i.e. zero 16s plus one 8 plus one 4 plus one 2 plus one unit =
10 A simple program What will end up in the AC ? Remember: First 3 digits are the OP-CODE, last 5 digits are the OPERAND! Try it on the exercise handout
11 A simple program What will end up in the AC ? LDI 10 STD 20 ADD 20 STD 30 SUB 20 STP Much easier, that ’ s why mnemonics were developed Accumulator ends up with 10
12 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
13 Graphics hardware 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 Display Program
14 Scanning the display Full screen scan every 10 milliseconds (Refresh rate)
15 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.
16 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.
17 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
18 A simple program What will be displayed?
19 Confused? Let’s convert the decimal 255 to binary
20 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
21
22 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
23 Character Mode Characters in computers are represented by numbers The number is based on the ASCII codes ASCII – American Standard Code for Information Interchange
24 ASCII Codes ‘A’ has ASCII Code 65 ‘a’ has ASCII Code 65
25 What happens here? 0 LDI 1 1 STD 26 2 LDD 6 3 STD 18 4 STP
26 Outcome 0 LDI 1 1 STD 26 2 LDD 6 3 STD 18 4 STP
27 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
28 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
29 A little more complex Try it on the exercise sheet
30 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
31 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
32 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
33 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
34 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
35 Question – What will be displayed?
36 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!
37 3-bit is not so complicated?
38 Any Questions?