|

JavaMatlabPhpHtmlJavaScriptCSSC#Delphi 1


Linux Unix AutoCAD 3D Access Orcad

: ,

. : CPU, , / (. E). .


CPU

I/O

25 MHz 80386 (A)

35972

24576

47292

25 MHz 80386 (B)

35972

24576

49154

20 MHz 80386

44958

30112

59990

12 MHz 80286

3544

41018

46646

. .

, , , . 4. (A) (B) , / ( 0Ch, DMA). , / ( ), CPU .

#pragma inline
#include <stdio.h>
#include <stdlib.h>
#include <dos.h>
#include <alloc.h>

#define INSTRUCTIONS (16*1024u)

void init_timer_channel( unsigned char channel )
{
asm pushf
asm cli
asm mov al, channel
asm ror al, 1
asm ror al, 1
asm or al, 36h
asm out 43h, al
asm mov dx, 40h
asm add dl, channel
asm jmp $+2
asm jmp $+2
asm xor al, al
asm out dx, al
asm jmp $+2
asm jmp $+2
asm out dx, al
asm popf
}

unsigned
read_sound_timer( void )
{
/*
* ! This function should not change any register except AX !
*/
asm mov al, 80h
asm out 43h, al
asm jmp $+2
asm jmp $+2
asm in al, 42h
asm jmp $+2
asm mov ah, al
asm in al, 42h
asm xchg ah, al
asm neg ax
return _AX ;
}

#define disable_count() (outportb(0x61,inportb(0x61)&(unsigned char)~1))
#define enable_count() (outportb(0x61,inportb(0x61)|(unsigned char)1))

void instruction_fill( char far *buf, unsigned cnt, char instr[ 2 ] )
{
while( cnt-- > 0 ){
*buf++ = instr[ 0 ] ;
*buf++ = instr[ 1 ] ;
}
*buf++ = 0xCB ; /* retf */
}

unsigned
measure( char far *routine )
{
unsigned time ;

init_timer_channel( 2 ) ;
disable_count() ;
asm push cs
asm lea ax, ret_point
asm push ax
asm les bx, routine
asm push es
asm push bx
asm xor dx, dx
asm mov bx, 1
asm cli
enable_count() ;
asm mov ax, bx
asm retf
asm ret_point label near
disable_count() ;
time = read_sound_timer() ;
asm sti
return time ;
}

int
main( int argc, char *argv[] )
{
char far *buf ;
unsigned idle_time ;
unsigned CPU_mark, mem_mark, DMA_mark ;

if( ( buf = farmalloc( INSTRUCTIONS * 2 + 1 ) ) == NULL ){
perror( "No memory" ) ;
return -1 ;
}
instruction_fill( buf, 0, NULL ) ;
idle_time = measure( buf ) ;
instruction_fill( buf, INSTRUCTIONS, "\xF7\xF3" ) ;
CPU_mark = measure( buf ) - idle_time ; /* div bx */
instruction_fill( buf, INSTRUCTIONS, "\xC4\x07" ) ;
mem_mark = measure( buf ) - idle_time ; /* les ax, [bx] */
instruction_fill( buf, INSTRUCTIONS, "\xE6\x0C" ) ;
DMA_mark = measure( buf ) - idle_time ; /* out 0Ch, al */
printf( "Idle time = %u\n", idle_time ) ;
printf( "CPU mark = %u\n", CPU_mark ) ;
printf( "Memory mark = %u\n", mem_mark ) ;
printf( "DMA mark = %u\n", DMA_mark ) ;
return 0 ;
}

 

, . , , .
:

  • , BIOS;
  • ;
  • ;
  • .

, Intel 8086, Intel 80286 , ; ; BIOS IBM PC/XT. , .

, ( ), . , CMOS .

, , BIOS'a (- VIRUS ELENINATOR, Krypton-3 . .). , , BIOS'a, BIOS'a. , .

; BIOS
; BIOS F000:FFF5 8
; / / , : , , . . .
; BIOS
d date db 8 dup (0)
. . .
mov ax , 0F00h
mov es , ax
mov bx , 0FFF5h
xor di , di
m: mov ax , es : [ bx ]
mov b_date [ di ] , ax
add di , 2
add bx , 8
cmp di , 8
jne m
;
mov dx , offset b_date
mov ah , 09h
int 21h

; .
mov ax , 0410h
mov es , ax
mov bx , 0
mov ax , es : [ bx ]
;

;

; 0
; 1
; 2-3 RAM
; 4-5
; 6-7
; 8 DMA
; 9-11 RS232 ⠠
; 12
; 14-15

 

, - . " . ( ) ().

: 15963






php mysql



C


 


, ? Google !

 
 

© life-prog.ru .