What is System Programming? - PowerPoint PPT Presentation

About This Presentation
Title:

What is System Programming?

Description:

je not_286_386 ;YES -- Not 80386 or 80286 ;-- Test for determining whether 80486, 80386 or 80286 ----- mov dl,p_80286 ; In any case, it's one of the mov ax ... – PowerPoint PPT presentation

Number of Views:38
Avg rating:3.0/5.0
Slides: 16
Provided by: Drfar8
Category:

less

Transcript and Presenter's Notes

Title: What is System Programming?


1
Lecture 21
2
_getproc proc near pushf
Secure flag register contents
push di Determine whether model came
before or after 80286 xor ax,ax
Set AX to 0 push ax
and push onto stack popf
Pop flag register off of stack pushf
Push back onto stack
pop ax and pop off of AX
and ax,0f000h Do not clear the upper
four bits cmp ax,0f000h Are bits
12 - 15 all equal to 1? je not_286_386
YES --gt Not 80386 or 80286
3
-- Test for determining whether 80486, 80386
or 80286 ------ mov dl,p_80286
In any case, it's one of the mov
ax,07000h three processors push ax
Push 07000h onto stack
popf Pop flag register
off pushf and push back
onto the stack pop ax
Pop into AX register and ax,07000h
Mask everything except bits 12-14
je pende Are bits 12 - 14 all
equal to 0? YES --gt It's an 80286 inc
dl No --gt it's either an 80386
or an 80486. First set to 386
4
cli No interrupts now
mov ebx,offset array mov ebx,eax
pushfd pop eax mov first,eax mov
ebx1,eax pushfd pop eax shr
first,18 shr eax,18 and first,1 and
eax,1 cmp first,eax inc dl sti jne
pende
5
pushfd pop eax mov temp, eax mov
eax,1 shl eax,21 push eax popfd pushfd pop
eax shr eax,21 shr temp,21 cmp temp, eax inc
dl je pende jmp pende Test
is ended
6
include "stdafx.h" include ltstdio.hgt include
ltdos.hgt unsigned long int id3 unsigned char
ch'\0' unsigned int steppingid unsigned int
model,family,type1 unsigned int cpcw int
main(int argc, char argv) _asm xor
eax,eax _asm cpuid _asm mov id0, ebx _asm
mov id4, edx _asm mov id8,
ecx printf("s\n ", (char ) (id)) _asm mov
eax,1 _asm cpuid _asm mov ecx,eax _asm AND
eax,0xf _asm mov steppingid,eax _asm mov eax,
ecx
7
_asm shr eax,4 _asm and eax, 0xf _asm mov
model,eax _asm mov eax,ecx _asm shr eax,8 _asm
and eax, 0xf _asm mov family,eax _asm mov
eax,ecx _asm shr eax,12 _asm and eax,
0x3 _asm mov type1, eax printf("\nstepping is
d\n model is d\n Family is d\nType
isd\n", steppingid,model,family,type1)
8
void main _asm finit _asm mov byte ptr
cpcw1, 0 _asm fstcw cpcw if ( (((char )
(cpcw))1)3) puts("Coprocessor
found") else puts ("Coprocessor not
found")
9
_getco proc near mov dx,co_none
mov byte ptr cswait1,NOP_CODE mov
byte ptr cswait2,NOP_CODE wait1 finit
mov byte ptr cpz1,0
wait2 fstcw cpz cmp
byte ptr cpz1,3 jne gcende
-- Coprocessor exists. Test for 8087 --- inc
dx and cpz,0FF7Fh fldcw cpz
fdisi fstcw
cpz test cpz,80h jne
gcende
10
-- Test for 80287/80387 ---- inc dx
finit fld1
fldz fdiv
fld st
fchs fcompp
fstsw cpz mov ah,byte ptr
cpz1 sahf je gcende
inc dx gcende mov
ax,dx ret _getco
endp
11
KeyBoard Interface
60H
Processor
64H
INTR
PIC
IRQ1
Synchronous Data Keyboard
12
Port 64H Status Register
7 6 5 4 3 2 1 0

1 Output Buffer full
1 Parity Error
1 Input Buffer full
1 Time Out Error during input
1 Time Out Error during output
1 Keyboard Active
13
Typematic Rate
7 6 5 4 3 2 1 0

Typematic Rate 11111 2 char/s 11110 2.1
char/s 11101 2.3 char/s 11010 3
char/s 00100
20 char/s 00011 21.8 char/s 00010 24
char/s 00001 26.7 char/s 00000 30 char/s
Delay 00 ¼ Second 01 ½ Second 10 ¼ Second 11
1 Second
14
Sending bytes to the Keyboard
60H
Input from Keyboard
64H
Input buffer full
15
Sending bytes to the Keyboard
60H
From Processor
Later on
Receives 0xFA to indicate successful transmission
64H
Output buffer full
Write a Comment
User Comments (0)
About PowerShow.com