home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Best Objectech Shareware Selections
/
UNTITLED.iso
/
boss
/
util
/
misc
/
009
/
ccnew.asm
< prev
next >
Wrap
Assembly Source File
|
1993-06-07
|
41KB
|
740 lines
PAGE ,120
.386p ; 80386 code will be used
.387 ; need coprocessor, too
JMPS EQU <JMP SHORT> ; declare jumps as short
JES EQU <JE SHORT> ; since near jumps (+/- 32K)
JBS EQU <JB SHORT> ; are default in 386 mode
JNZS EQU <JNZ SHORT> ; and these cannot execute
JCS EQU <JC SHORT> ; on the older CPUs
JZS EQU <JZ SHORT>
JNES EQU <JNE SHORT>
JAES EQU <JAE SHORT>
JBES EQU <JBE SHORT>
JAS EQU <JA SHORT>
cpu_i8088 EQU 1
cpu_i8086 EQU 2
cpu_V20 EQU 3
cpu_V30 EQU 4
cpu_i188 EQU 5
cpu_i186 EQU 6
cpu_i286 EQU 7
cpu_i386 EQU 8
cpu_i386sx EQU 9
cpu_ct38600 EQU 10
cpu_ct38600sx EQU 11
cpu_486dlc EQU 12
cpu_486slc EQU 13
cpu_RapidCAD EQU 14
cpu_i486 EQU 15
cpu_i486SX EQU 16
cpu_pentium EQU 17
ndp_NoCopro EQU 0
ndp_Emul EQU 1
ndp_i8087 EQU 2
ndp_i80C187 EQU 3
ndp_i80287 EQU 4
ndp_i287XL EQU 5
ndp_i387 EQU 6
ndp_i387sx EQU 7
ndp_2C87 EQU 8
ndp_3C87 EQU 10
ndp_3C87sx EQU 11
ndp_82S87 EQU 12
ndp_83D87 EQU 14
ndp_83S87 EQU 15
ndp_83C87 EQU 16
ndp_83C87s EQU 17
ndp_38700 EQU 18
ndp_38700sx EQU 19
ndp_i387DX EQU 20
ndp_RapidCAD EQU 21
ndp_i486 EQU 22
ndp_82S87p EQU 23
ndp_387plus EQU 25
ndp_83S87p EQU 26
ndp_emc87 EQU 27
ndp_pentium EQU 28
STRT_TIM MACRO
MOV AL, 0B4h ; timer 2 is
OUT 43h, AL ; programmed as a rate generator
XOR AL, AL ; load zero
OUT 42h, AL ; reset
OUT 42h, AL ; timer 2
ENDM
STOP_TIM MACRO
MOV AL, 80h ; timer 2
OUT 43h, AL ; immediately latched
IN AL, 42h ; read LSB
MOV BL, AL ; save LSB
IN AL, 42h ; read MSB
MOV BH, AL ; save MSB
NEG BX ; negate for timer count
ENDM
CODE SEGMENT BYTE USE16 PUBLIC 'CODE'
ASSUME CS:CODE
PUBLIC SpeedTest
; declare parameters
Debug_Flag EQU [BP+24] ; <> 0, if debugging output desired
Ext_Flag EQU [BP+22] ; zero, if no extended memory
EMS_Flag EQU [BP+20] ; zero, if no expanded memory
BufferPtr EQU [BP+16] ; buffer for EMS u. EXT test
EMS_Base EQU [BP+12] ; address of EMS-frame
ScreenPtr EQU [BP+8] ; start address of video memory
ResultPtr EQU [BP+4] ; pointer to result struct
; declare local variables
Stat EQU [BP-2] ; mem for 80x87 status word
Ctrl EQU [BP-4] ; mem for 80x87 control word
GDT EQU [BP-52] ; mem for global descriptor table
SystemStat EQU [BP-53] ; mem for system status
SaveCtrl EQU [BP-55] ; original 80x87 control word
; declare result record
CPU_NDP_TYP EQU [SI]
AAMTime EQU [SI+2]
MovEvenTime EQU [SI+6]
BIOSWrTime EQU [SI+8]
MovByteTime EQU [SI+10]
MovEMSTime EQU [SI+12]
MovExtTime EQU [SI+14]
ScrFillTime EQU [SI+16]
Dummy2 EQU [SI+18]
i87Time EQU [SI+20]
i287Time EQU [SI+22]
MovDblTime EQU [SI+24]
SpeedTest PROC NEAR
PUSH BP ; save caller's frame pointer
MOV BP, SP ; make new frame pointer
SUB SP, 55 ; alloc mem for local variables
PUSH DS ; save Turbo Pascal's data segment
PUSHF ; save original flag setting
$inittimer: CLI ; disable interrupts
CLD ; auto increment for string operations
IN AL, 61h ; port B - system control
MOV [SystemStat], AL ; save system status
AND AL, 11111101b ; clear speaker bit (disable speaker)
OR AL, 1 ; turn on bit for timer 2 (enable it)
CMP AL, [SystemStat] ; system already configured correctly ?
JES $aam ; no need to configure it
OUT 61h, AL ; reconfigure system (tmr 2 on,spk off)
$aam: CMP WORD PTR Debug_Flag,0; debugging output desired ?
JNZS $aam1 ; no
MOV AH, 9 ; #9, print string
PUSH CS ; load
POP DS ; address of
MOV DX, OFFSET CS:$dbg2 ; debugging message
INT 21h ; call DOS, print debugging message
JMPS $aam1 ; skip message text
$dbg2 DB 'About to perform AAM speed test', 0Dh, 0Ah ,'$'
$aam1: STRT_TIM ; start timer 2
REPT 200
AAM ; execute 200 AAMs
ENDM
STOP_TIM ; elapsed time of timer 2 in BX
LDS SI, ResultPtr ; pointer to result struct
MOV [AAMTime], BX ; save time for AAMs
$begin_test:CMP WORD PTR Debug_Flag,0; debugging output desired ?
JNZS $cpu_ndptst ; nope
MOV AH, 9 ; #9, print string
PUSH CS ; load
POP DS ; address of
MOV DX, OFFSET CS:$dbg1 ; debugging message
INT 21h ; call DOS, print debugging message
JMPS $cpu_ndptst ; skip message text
$dbg1 DB 'About to perform CPU and NDP test', 0Dh, 0Ah ,'$'
$cpu_ndptst:LDS SI, ResultPtr ; pointer to result struct
FNSTCW [SaveCtrl] ; save original NDP ctrl word
PUSH SP ; test updating
POP AX ; of stackpointer
CMP AX, SP ; stackpointer updated before push ?
JES $286_386 ; no, must be 286, 386 or 486
MOV AX, 1 ; try to shift
MOV CL, 33 ; accu 33 times
SHL AX, CL ; shift count masked off ?
JNZS $186_188 ; yes, must be 186 or 188
PUSHA ; PUSHA executed on 88/86 as JMP $+2
STC ; carry set if V20 or V30
JCS $V20_V30 ; yes, must be V20 or V30
PUSHF ; save flags
POP AX ; pop flags into AX
AND AH, 00FH ; clear bits 12-15 of flag register
PUSH AX ; put new flags in stack
POPF ; pop into flag register
PUSHF ; put flags on stack
POP AX ; get flags
AND AH, 0F0H ; test if all bits
CMP AH, 0F0H ; in highest nibble set
JES $88_86 ; all bits in highest nibble set
XOR DL, DL ; failed all tests, unknown CPU
JMPS $copro_test ; go and test NDP
$8