Use backtick code blocks for syntax highlighting

This commit is contained in:
James Gregory 2013-12-31 11:38:48 +11:00
commit f658bfbb40
203 changed files with 26546 additions and 25801 deletions

View file

@ -27,45 +27,49 @@ Or can we?
**LISTING 58.3 L58-3.ASM**
; Inner loop to draw a single texture-mapped vertical column,
; rather than a horizontal scanline. Maxed-out 16-bit version.
;
; At this point:
; AX = source pointer increment to advance one in Y
; ECX = fractional Y advance in lower 15 bits of CX,
; fractional X advance in high word of ECX, bit
; 15 set to 0
```nasm
; Inner loop to draw a single texture-mapped vertical column,
; rather than a horizontal scanline. Maxed-out 16-bit version.
;
; At this point:
; AX = source pointer increment to advance one in Y
; ECX = fractional Y advance in lower 15 bits of CX,
; fractional X advance in high word of ECX, bit
; 15 set to 0
```
![**Figure 58.7**  *Final method for advancing source texture pointer.*](images/58-07.jpg)
; EDX = fractional source texture Y coordinate in lower
; 15 bits of CX, fractional source texture X coord
; in high word of ECX, bit 15 set to 0
; SI = sum of integral X & Y source pointer advances
; DS:DI = initial destination pointer
; SS:BP = initial source texture pointer
```nasm
; EDX = fractional source texture Y coordinate in lower
; 15 bits of CX, fractional source texture X coord
; in high word of ECX, bit 15 set to 0
; SI = sum of integral X & Y source pointer advances
; DS:DI = initial destination pointer
; SS:BP = initial source texture pointer
SCANOFFSET=0
SCANOFFSET=0
REPT LOOP_UNROLL
REPT LOOP_UNROLL
mov bl,[bp] ;get texture pixel
mov [di+SCANOFFSET],bl ;set screen pixel
mov bl,[bp] ;get texture pixel
mov [di+SCANOFFSET],bl ;set screen pixel
add edx,ecx ;advance frac Y in DX,
; frac X in high word of EDX
adc bp,si ;advance source pointer by integral
; X & Y amount, also accounting for
; carry from X fractional addition
test dh,80h ;carry from Y fractional addition?
jz @F ;no
add bp,ax ;yes, advance Y by one
and dh,not 80h ;reset the Y fractional carry bit
@@:
add edx,ecx ;advance frac Y in DX,
; frac X in high word of EDX
adc bp,si ;advance source pointer by integral
; X & Y amount, also accounting for
; carry from X fractional addition
test dh,80h ;carry from Y fractional addition?
jz @F ;no
add bp,ax ;yes, advance Y by one
and dh,not 80h ;reset the Y fractional carry bit
@@:
SCANOFFSET = SCANOFFSET + SCANWIDTH
SCANOFFSET = SCANOFFSET + SCANWIDTH
ENDM
ENDM
```
#### Don't Stop Thinking about Those Cycles {#Heading7}