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

@ -21,17 +21,19 @@ registers into one 32-bit register much more useful.
**LISTING 13.6 L13-6.ASM**
mov cx,[initialskip]
bswap ecx ;put skip value in upper half of ECX
mov cx,100 ;put loop count in CX
looptop:
:
bswap ecx ;make skip value word accessible in CX
add bx,cx ;skip BX ahead
inc cx ;set next skip value
bswap ecx ;put loop count in CX
dec cx ;count down loop
jnz looptop
```nasm
mov cx,[initialskip]
bswap ecx ;put skip value in upper half of ECX
mov cx,100 ;put loop count in CX
looptop:
:
bswap ecx ;make skip value word accessible in CX
add bx,cx ;skip BX ahead
inc cx ;set next skip value
bswap ecx ;put loop count in CX
dec cx ;count down loop
jnz looptop
```
### Pushing and Popping Memory {#Heading5}
@ -44,12 +46,16 @@ contrast, loading a memory location into a register takes only one
cycle, and pushing a register takes just 1 more cycle, for a total of
two cycles. Therefore,
mov ax,[bx]
push ax
```nasm
mov ax,[bx]
push ax
```
is twice as fast as
push word ptr [bx]
```nasm
push word ptr [bx]
```
and the only cost is that the previous contents of AX are destroyed.
@ -98,9 +104,11 @@ disassembly in a debugger or by having the assembler generate a listing
file. You could then insert the n-bit version of **SHL AX,1** in your
code as follows:
mov ax,1
db 0c1h, 0e0h, 001h
mov dx,ax
```nasm
mov ax,1
db 0c1h, 0e0h, 001h
mov dx,ax
```
At the end of this sequence, DX will contain 2, and the fast n-bit
version of **SHL AX,1** will have executed. If you use this approach,