Change bold code snippets to inline code blocks
This commit is contained in:
parent
f658bfbb40
commit
3c76d884ef
185 changed files with 1772 additions and 1772 deletions
20
24-03.md
20
24-03.md
|
|
@ -70,7 +70,7 @@ only because it is necessary to perform a read to load the latches, and
|
|||
there is no way to read without placing a value in a register. This is a
|
||||
bit of a nuisance, since it means that the value of some 8-bit register
|
||||
must be destroyed. Under certain circumstances, a single logical
|
||||
instruction such as **XOR** or **AND** can be used to perform both the
|
||||
instruction such as `XOR` or `AND` can be used to perform both the
|
||||
read to load the latches and then write to modify display memory without
|
||||
affecting any CPU registers, as we'll see later on.
|
||||
|
||||
|
|
@ -84,7 +84,7 @@ display mode. The great virtue of the BIOS write string function in the
|
|||
case of the VGA is that it provides an uncomplicated way to get text on
|
||||
the screen reliably in any mode and color, over any background.
|
||||
|
||||
The expression used to load DX in the **TEXT\_UP** macro in the sample
|
||||
The expression used to load DX in the `TEXT_UP` macro in the sample
|
||||
program may seem strange, but it's a convenient way to save a byte of
|
||||
program code and a few cycles of execution time. DX is being loaded with
|
||||
a word value that's composed of two independent immediate byte values.
|
||||
|
|
@ -96,8 +96,8 @@ MOV DH,VALUE2
|
|||
```
|
||||
which requires four instruction bytes. By shifting the value destined
|
||||
for the high byte into the high byte with MASM's shift-left operator,
|
||||
**SHL** (\*100H would work also), and then logically combining the
|
||||
values with MASM's **OR** operator (or the **ADD** operator), both
|
||||
`SHL` (\*100H would work also), and then logically combining the
|
||||
values with MASM's `OR` operator (or the `ADD` operator), both
|
||||
halves of DX can be loaded with a single instruction, as in
|
||||
|
||||
```nasm
|
||||
|
|
@ -106,7 +106,7 @@ MOV DX,(VALUE2 SHL 8) OR VALUE1
|
|||
|
||||
which takes only three bytes and is faster, being a single instruction.
|
||||
(Note, though, that in 32-bit protected mode, there's a size and
|
||||
performance penalty for 16-bit instructions such as the **MOV** above;
|
||||
performance penalty for 16-bit instructions such as the `MOV` above;
|
||||
see the first part of this book for details.) As shown, a macro is an
|
||||
ideal place to use this technique; the macro invocation can refer to two
|
||||
separate byte values, making matters easier for the programmer, while
|
||||
|
|
@ -114,21 +114,21 @@ the macro itself can combine the values into a single word-sized
|
|||
constant.
|
||||
|
||||
> 
|
||||
> A minor optimization tip illustrated in the listing is the use of **INC
|
||||
> AX** and **DEC AX** in the **DrawVerticalBox** subroutine when only AL
|
||||
> A minor optimization tip illustrated in the listing is the use of `INC
|
||||
> AX` and `DEC AX` in the `DrawVerticalBox` subroutine when only AL
|
||||
> actually needs to be modified. Word-sized register increment and
|
||||
> decrement instructions (or dword-sized instructions in 32-bit protected
|
||||
> mode) are only one byte long, while byte-size register increment and
|
||||
> decrement instructions are two bytes long. Consequently, when size
|
||||
> counts, it is worth using a whole 16-bit (or 32-bit) register instead of
|
||||
> the low 8 bits of that register for **INC** and **DEC**—if you don't
|
||||
> the low 8 bits of that register for `INC` and `DEC`—if you don't
|
||||
> need the upper portion of the register for any other purpose, or if you
|
||||
> can be sure that the **INC** or **DEC** won't affect the upper part of
|
||||
> can be sure that the `INC` or `DEC` won't affect the upper part of
|
||||
> the register.
|
||||
|
||||
The latches and ALUs are central to high-performance VGA code, since
|
||||
they allow programs to process across all four memory planes without a
|
||||
series of **OUT**s and read/write operations. It is not always easy to
|
||||
series of `OUT`s and read/write operations. It is not always easy to
|
||||
arrange a program to exploit this power, however, because the ALUs are
|
||||
far more limited than a CPU. In many instances, however, additional
|
||||
hardware in the VGA, including the bit mask, the set/reset features, and
|
||||
|
|
|
|||
Loading…
Reference in a new issue