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
28
44-04.md
28
44-04.md
|
|
@ -74,10 +74,12 @@ way back in Chapter 24.) So, for example, if write mode 3 is enabled and
|
|||
the Set/Reset register is set to 1 (blue), then the following sequence
|
||||
of operations:
|
||||
|
||||
mov dx,0a000h
|
||||
mov es,dx
|
||||
mov al,es:[0]
|
||||
mov byte ptr es:[0],0f0h
|
||||
```nasm
|
||||
mov dx,0a000h
|
||||
mov es,dx
|
||||
mov al,es:[0]
|
||||
mov byte ptr es:[0],0f0h
|
||||
```
|
||||
|
||||
will change the first 4 pixels on the screen (the left nibble of the
|
||||
byte at offset 0 in display memory) to blue, and will leave the next 4
|
||||
|
|
@ -88,10 +90,12 @@ display memory is not particularly efficient on some processors. In
|
|||
Listing 44.2, I instead use **XCHG**, which reads and then writes a
|
||||
memory location in a single operation, as in:
|
||||
|
||||
mov dx,0a000h
|
||||
mov es,dx
|
||||
mov al,0f0h
|
||||
xchg es:[0],al
|
||||
```nasm
|
||||
mov dx,0a000h
|
||||
mov es,dx
|
||||
mov al,0f0h
|
||||
xchg es:[0],al
|
||||
```
|
||||
|
||||
Again, the actual value that's read is irrelevant. In general, the
|
||||
**XCHG** approach is more compact than two **MOV**s, and is faster on
|
||||
|
|
@ -103,9 +107,11 @@ information in display memory at that byte needs to be preserved; a
|
|||
simple write of 0FFH (to draw all bits) will set all 8 pixels to the
|
||||
set/reset color:
|
||||
|
||||
mov dx,0a000h
|
||||
mov es,dx
|
||||
mov byte ptr es:[di],0ffh
|
||||
```nasm
|
||||
mov dx,0a000h
|
||||
mov es,dx
|
||||
mov byte ptr es:[di],0ffh
|
||||
```
|
||||
|
||||
> 
|
||||
> If you're familiar with VGA programming, you're no doubt aware that
|
||||
|
|
|
|||
Loading…
Reference in a new issue