Title: What is System Programming?
1Lecture 22
2Keyboard writing Protocol
- Wait till input buffer is full
- Write on buffer
- Wait till output buffer is full
- Check the acknowledgement byte
- Repeat the process if it was previously
unsuccessful.
3Command for writing Typematic rate
0xF3 Means Typematic rate will be sent in the
next byte.
4Keyboard LEDs
LED Status byte
2 1 0
Scroll Lock
Num Lock
Caps Lock
LED Control byte 0xED
5include ltdos.hgt include ltconio.hgt char st
80 int SendKbdRate(unsigned char data , int
maxtry) unsigned char ch do do chinport(0
x64) while (ch0x02) outport(0x60,da
ta) do ch inport(0x64) while
(ch0x01)
6 if (ch0xfa) puts("success\n") break
maxtry maxtry - 1 while (maxtry !
0) if (maxtry0) return 1 else return
0
7void main () //clrscr() SendKbdRate(0xf3,3) Se
ndKbdRate(0x7f,3) gets(st) SendKbdRate(0xf3,3)
SendKbdRate(0,3) gets(st)
8include ltbios.hgt include ltdos.hgt char st
80 unsigned char far kbd (unsigned
char far ) 0x00400017 int SendKbdRate(unsigned
char data , int maxtry) unsigned char
ch do do chinport(0x64) while
(ch0x02) outport(0x60,data)
9 do ch inport(0x64) while
(ch0x01) chinport(0x60) if (ch0xfa)
puts("success\n") break maxtry maxtry
- 1 while (maxtry ! 0) if
(maxtry0) return 1 else return 0
10void main () //clrscr() SendKbdRate(0xed,3) Se
ndKbdRate(0x7,3) puts("Enter a string
") gets(st) kbd(kbd )0x70 puts("Enter a
string ") gets(st)
11DMA Controller
Main Memory
I/O
Processor
DMA
12DMA Interfacing