Use backtick code blocks for syntax highlighting
This commit is contained in:
parent
8ed9dea394
commit
f658bfbb40
203 changed files with 26546 additions and 25801 deletions
132
03-06.md
132
03-06.md
|
|
@ -25,72 +25,76 @@ and "link" with "tlink" in Listing 3.4. The same is true of Listing
|
|||
|
||||
**LISTING 3.4 PZTIME.BAT**
|
||||
|
||||
echo off
|
||||
rem
|
||||
rem *** Listing 3.4 ***
|
||||
rem
|
||||
rem ***************************************************************
|
||||
rem * Batch file PZTIME.BAT, which builds and runs the precision *
|
||||
rem * Zen timer program PZTEST.EXE to time the code named as the *
|
||||
rem * command-line parameter. Listing 3.1 must be named *
|
||||
rem * PZTIMER.ASM, and Listing 3.2 must be named PZTEST.ASM. To *
|
||||
rem * time the code in LST3-3, you'd type the DOS command: *
|
||||
rem * *
|
||||
rem * pztime lst3-3 *
|
||||
rem * *
|
||||
rem * Note that MASM and LINK must be in the current directory or *
|
||||
rem * on the current path in order for this batch file to work. *
|
||||
rem * *
|
||||
rem * This batch file can be speeded up by assembling PZTIMER.ASM *
|
||||
rem * once, then removing the lines: *
|
||||
rem * *
|
||||
rem * masm pztimer; *
|
||||
rem * if errorlevel 1 goto errorend *
|
||||
rem * *
|
||||
rem * from this file. *
|
||||
rem * *
|
||||
rem * By Michael Abrash *
|
||||
rem ***************************************************************
|
||||
rem
|
||||
rem Make sure a file to test was specified.
|
||||
rem
|
||||
if not x%1==x goto ckexist
|
||||
echo ***************************************************************
|
||||
echo * Please specify a file to test. *
|
||||
echo ***************************************************************
|
||||
goto end
|
||||
rem
|
||||
rem Make sure the file exists.
|
||||
rem
|
||||
:ckexist
|
||||
if exist %1 goto docopy
|
||||
echo ***************************************************************
|
||||
echo * The specified file, "%1," doesn't exist. *
|
||||
echo ***************************************************************
|
||||
goto end
|
||||
rem
|
||||
rem copy the file to measure to TESTCODE.
|
||||
rem
|
||||
:docopy
|
||||
copy %1 testcode
|
||||
masm pztest;
|
||||
if errorlevel 1 goto errorend
|
||||
masm pztimer;
|
||||
if errorlevel 1 goto errorend
|
||||
link pztest+pztimer;
|
||||
if errorlevel 1 goto errorend
|
||||
pztest
|
||||
goto end
|
||||
:errorend
|
||||
echo ***************************************************************
|
||||
echo * An error occurred while building the precision Zen timer. *
|
||||
echo ***************************************************************
|
||||
:end
|
||||
```bat
|
||||
echo off
|
||||
rem
|
||||
rem *** Listing 3.4 ***
|
||||
rem
|
||||
rem ***************************************************************
|
||||
rem * Batch file PZTIME.BAT, which builds and runs the precision *
|
||||
rem * Zen timer program PZTEST.EXE to time the code named as the *
|
||||
rem * command-line parameter. Listing 3.1 must be named *
|
||||
rem * PZTIMER.ASM, and Listing 3.2 must be named PZTEST.ASM. To *
|
||||
rem * time the code in LST3-3, you'd type the DOS command: *
|
||||
rem * *
|
||||
rem * pztime lst3-3 *
|
||||
rem * *
|
||||
rem * Note that MASM and LINK must be in the current directory or *
|
||||
rem * on the current path in order for this batch file to work. *
|
||||
rem * *
|
||||
rem * This batch file can be speeded up by assembling PZTIMER.ASM *
|
||||
rem * once, then removing the lines: *
|
||||
rem * *
|
||||
rem * masm pztimer; *
|
||||
rem * if errorlevel 1 goto errorend *
|
||||
rem * *
|
||||
rem * from this file. *
|
||||
rem * *
|
||||
rem * By Michael Abrash *
|
||||
rem ***************************************************************
|
||||
rem
|
||||
rem Make sure a file to test was specified.
|
||||
rem
|
||||
if not x%1==x goto ckexist
|
||||
echo ***************************************************************
|
||||
echo * Please specify a file to test. *
|
||||
echo ***************************************************************
|
||||
goto end
|
||||
rem
|
||||
rem Make sure the file exists.
|
||||
rem
|
||||
:ckexist
|
||||
if exist %1 goto docopy
|
||||
echo ***************************************************************
|
||||
echo * The specified file, "%1," doesn't exist. *
|
||||
echo ***************************************************************
|
||||
goto end
|
||||
rem
|
||||
rem copy the file to measure to TESTCODE.
|
||||
rem
|
||||
:docopy
|
||||
copy %1 testcode
|
||||
masm pztest;
|
||||
if errorlevel 1 goto errorend
|
||||
masm pztimer;
|
||||
if errorlevel 1 goto errorend
|
||||
link pztest+pztimer;
|
||||
if errorlevel 1 goto errorend
|
||||
pztest
|
||||
goto end
|
||||
:errorend
|
||||
echo ***************************************************************
|
||||
echo * An error occurred while building the precision Zen timer. *
|
||||
echo ***************************************************************
|
||||
:end
|
||||
```
|
||||
|
||||
Assuming that Listing 3.3 is named LST3-3.ASM and Listing 3.4 is named
|
||||
PZTIME.BAT, the code in Listing 3.3 would be timed with the command:
|
||||
|
||||
pztime LST3-3.ASM
|
||||
```sh
|
||||
pztime LST3-3.ASM
|
||||
```
|
||||
|
||||
which performs all assembly and linking, and reports the execution time
|
||||
of the code in Listing 3.3.
|
||||
|
|
@ -116,7 +120,9 @@ In order to perform any of the timing tests in this book, enter Listing
|
|||
and enter Listing 3.4 and name it PZTIME.BAT. Then simply enter the
|
||||
listing you wish to run into the file *filename* and enter the command:
|
||||
|
||||
pztime <filename>
|
||||
```sh
|
||||
pztime <filename>
|
||||
```
|
||||
|
||||
In fact, that's exactly how I timed each of the listings in this book.
|
||||
Code fragments you write yourself can be timed in just the same way. If
|
||||
|
|
|
|||
Loading…
Reference in a new issue