commit
5162407cef
1 changed files with 52 additions and 52 deletions
|
|
@ -163,34 +163,34 @@ presented in Chapter K on the companion CD-ROM.
|
|||
; in when ZTimerOn was called.
|
||||
;
|
||||
|
||||
Code segment word public ‘CODE'
|
||||
assumecs: Code, ds:nothing
|
||||
Code segment word public 'CODE'
|
||||
assume cs:Code, ds:nothing
|
||||
public ZTimerOn, ZTimerOff, ZTimerReport
|
||||
|
||||
;
|
||||
; Base address of the 8253 timer chip.
|
||||
;
|
||||
BASE_8253equ40h
|
||||
BASE_8253 equ 40h
|
||||
;
|
||||
; The address of the timer 0 count registers in the 8253.
|
||||
;
|
||||
TIMER_0_8253 equBASE_8253 + 0
|
||||
TIMER_0_8253 equ BASE_8253 + 0
|
||||
;
|
||||
; The address of the mode register in the 8253.
|
||||
;
|
||||
MODE_8253 equBASE_8253 + 3
|
||||
MODE_8253 equ BASE_8253 + 3
|
||||
;
|
||||
; The address of Operation Command Word 3 in the 8259 Programmable
|
||||
; Interrupt Controller (PIC) (write only, and writable only when
|
||||
; bit 4 of the byte written to this address is 0 and bit 3 is 1).
|
||||
;
|
||||
OCW3 equ20h
|
||||
OCW3 equ 20h
|
||||
;
|
||||
; The address of the Interrupt Request register in the 8259 PIC
|
||||
; (read only, and readable only when bit 1 of OCW3 = 1 and bit 0
|
||||
; of OCW3 = 0).
|
||||
;
|
||||
IRR equ20h
|
||||
IRR equ 20h
|
||||
;
|
||||
; Macro to emulate a POPF instruction in order to fix the bug in some
|
||||
; 80286 chips which allows interrupts to occur during a POPF even when
|
||||
|
|
@ -220,7 +220,7 @@ OriginalFlags db ? ; storage for upper byte of
|
|||
; ZTimerOn called
|
||||
TimedCount dw ? ; timer 0 count when the timer
|
||||
; is stopped
|
||||
ReferenceCount dw ; number of counts required to
|
||||
ReferenceCount dw ? ; number of counts required to
|
||||
; execute timer overhead code
|
||||
OverflowFlag db ? ; used to indicate whether the
|
||||
; timer overflowed during the
|
||||
|
|
@ -229,28 +229,28 @@ OverflowFlag db ? ; used to indicate whether the
|
|||
; String printed to report results.
|
||||
;
|
||||
OutputStr label byte
|
||||
db 0dh, 0ah, ‘Timed count: ‘, 5 dup (?)
|
||||
ASCIICountEnd labelbyte
|
||||
db ‘ microseconds', 0dh, 0ah
|
||||
db ‘$'
|
||||
db 0dh, 0ah, 'Timed count: ', 5 dup (?)
|
||||
ASCIICountEnd label byte
|
||||
db ' microseconds', 0dh, 0ah
|
||||
db '$'
|
||||
;
|
||||
; String printed to report timer overflow.
|
||||
;
|
||||
OverflowStr label byte
|
||||
db 0dh, 0ah
|
||||
db ‘****************************************************'
|
||||
db '****************************************************'
|
||||
db 0dh, 0ah
|
||||
db ‘* The timer overflowed, so the interval timed was *'
|
||||
db '* The timer overflowed, so the interval timed was *'
|
||||
db 0dh, 0ah
|
||||
db ‘* too long for the precision timer to measure. *'
|
||||
db '* too long for the precision timer to measure. *'
|
||||
db 0dh, 0ah
|
||||
db ‘* Please perform the timing test again with the *'
|
||||
db0dh, 0ah
|
||||
db ‘* long-period timer. *'
|
||||
db '* Please perform the timing test again with the *'
|
||||
db 0dh, 0ah
|
||||
db ‘****************************************************'
|
||||
db '* long-period timer. *'
|
||||
db 0dh, 0ah
|
||||
db ‘$'
|
||||
db '****************************************************'
|
||||
db 0dh, 0ah
|
||||
db '$'
|
||||
|
||||
; ********************************************************************
|
||||
; * Routine called to start timing. *
|
||||
|
|
@ -418,7 +418,7 @@ ZTimerOff endp
|
|||
; Called by ZTimerOff to start timer for overhead measurements.
|
||||
;
|
||||
|
||||
ReferenceZTimerOnproc near
|
||||
ReferenceZTimerOn proc near
|
||||
;
|
||||
; Save the context of the program being timed.
|
||||
;
|
||||
|
|
@ -445,7 +445,7 @@ ReferenceZTimerOnproc near
|
|||
pop ax
|
||||
ret
|
||||
|
||||
ReferenceZTimerOnendp
|
||||
ReferenceZTimerOn endp
|
||||
|
||||
;
|
||||
; Called by ZTimerOff to stop timer and add result to ReferenceCount
|
||||
|
|
@ -488,7 +488,7 @@ ReferenceZTimerOff endp
|
|||
; * Routine called to report timing results. *
|
||||
; ********************************************************************
|
||||
|
||||
ZTimerReport procnear
|
||||
ZTimerReport proc near
|
||||
|
||||
pushf
|
||||
push ax
|
||||
|
|
@ -913,13 +913,13 @@ and should contain calls to `ZTimerOn` and `ZTimerOff` .
|
|||
;
|
||||
; By Michael Abrash
|
||||
;
|
||||
mystack segment para stack ‘STACK'
|
||||
mystack segment para stack 'STACK'
|
||||
db 512 dup(?)
|
||||
mystack ends
|
||||
;
|
||||
Code segment para public ‘CODE'
|
||||
Code segment para public 'CODE'
|
||||
assume cs:Code, ds:Code
|
||||
extrnZTimerOn:near, ZTimerOff:near, ZTimerReport:near
|
||||
extrn ZTimerOn:near, ZTimerOff:near, ZTimerReport:near
|
||||
Start proc near
|
||||
push cs
|
||||
pop ds ; set DS to point to the code segment,
|
||||
|
|
@ -1932,14 +1932,14 @@ timing.
|
|||
;
|
||||
; By Michael Abrash
|
||||
;
|
||||
mystack segment para stack ‘STACK'
|
||||
mystack segment para stack 'STACK'
|
||||
db 512 dup(?)
|
||||
mystack ends
|
||||
;
|
||||
Code segment para public ‘CODE'
|
||||
Code segment para public 'CODE'
|
||||
assume cs:Code, ds:Code
|
||||
extrn ZTimerOn:near, ZTimerOff:near, ZTimerReport:near
|
||||
Startproc near
|
||||
Start proc near
|
||||
push cs
|
||||
pop ds ;point DS to the code segment,
|
||||
; so data as well as code can easily
|
||||
|
|
@ -2075,23 +2075,23 @@ the precision Zen timer to handle on the 8088.
|
|||
; Note: takes about ten minutes to assemble on a slow PC if
|
||||
;you are using MASM
|
||||
;
|
||||
jmpSkip;jump around defined data
|
||||
jmp Skip ;jump around defined data
|
||||
;
|
||||
MemVardb?
|
||||
MemVar db ?
|
||||
;
|
||||
Skip:
|
||||
;
|
||||
; Start timing.
|
||||
;
|
||||
callZTimerOn
|
||||
call ZTimerOn
|
||||
;
|
||||
rept20000
|
||||
moval,[MemVar]
|
||||
endm
|
||||
rept 20000
|
||||
mov al,[MemVar]
|
||||
endm
|
||||
;
|
||||
; Stop timing.
|
||||
;
|
||||
callZTimerOff
|
||||
call ZTimerOff
|
||||
```
|
||||
|
||||
When LZTIME.BAT is run on a PC with the following command line (assuming
|
||||
|
|
|
|||
Loading…
Reference in a new issue