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,34 +27,42 @@ video programmers are undoubtedly familiar with the following code to
multiply AX times 80 (the width in bytes of the bitmap in most PC
display modes):
SHL AX,1 ;*2
SH LAX,1 ;*4
SH LAX,1 ;*8
SH LAX,1 ;*16
MO VBX,AX
SH LAX,1 ;*32
SH LAX,1 ;*64
ADD AX,BX ;*80
```nasm
SHL AX,1 ;*2
SH LAX,1 ;*4
SH LAX,1 ;*8
SH LAX,1 ;*16
MO VBX,AX
SH LAX,1 ;*32
SH LAX,1 ;*64
ADD AX,BX ;*80
```
Using **LEA** on the 386, the above could be reduced to
LEA EAX,[EAX*2] ;*2
LEA EAX,[EAX*8] ;*16
LEA EAX,[EAX+EAX*4] ;*80
```nasm
LEA EAX,[EAX*2] ;*2
LEA EAX,[EAX*8] ;*16
LEA EAX,[EAX+EAX*4] ;*80
```
which still isn't as fast as using a lookup table like
MOV EAX,MultiplesOf80Table[EAX*4]
```nasm
MOV EAX,MultiplesOf80Table[EAX*4]
```
but is close and takes a great deal less space.
Of course, on the 386, the shift and add version could also be reduced
to this considerably more efficient code:
SH LAX,4 ;*16
MOV BX,AX
SHL AX,2 ;*64
ADD AX,BX ;*80
```nasm
SH LAX,4 ;*16
MOV BX,AX
SHL AX,2 ;*64
ADD AX,BX ;*80
```
#### Speeding Up Multiplication {#Heading5}