Merge pull request #13 from dennis714/master

typos
This commit is contained in:
James Gregory 2015-09-15 13:35:09 +10:00
commit 9b1713b961
17 changed files with 105 additions and 105 deletions

View file

@ -350,9 +350,9 @@ ZTimerOff proc near
; timer interrupt. ; timer interrupt.
; ;
mov al,00001010b ; OCW3, set up to read mov al,00001010b ; OCW3, set up to read
out OCW3,al; Int errupt Request register out OCW3,al ; Interrupt Request register
DELAY DELAY
ina l,IRR; read Interrupt Request in al,IRR ; read Interrupt Request
; register ; register
and al,1 ; set AL to 1 if IRQ0 (the and al,1 ; set AL to 1 if IRQ0 (the
; timer interrupt) is pending ; timer interrupt) is pending
@ -1509,7 +1509,7 @@ ZTimerOn proc near
; Restore the context of the program being timed and return to it. ; Restore the context of the program being timed and return to it.
; ;
MPOPF MPOPF
popax pop ax
ret ret
ZTimerOn endp ZTimerOn endp
@ -1674,7 +1674,7 @@ ReferenceZTimerOn proc near
; Restore the context of the program being timed and return to it. ; Restore the context of the program being timed and return to it.
; ;
MPOPF MPOPF
popax pop ax
ret ret
ReferenceZTimerOn endp ReferenceZTimerOn endp

View file

@ -213,13 +213,13 @@ display modes):
```nasm ```nasm
SHL AX,1 ;*2 SHL AX,1 ;*2
SH LAX,1 ;*4 SHL AX,1 ;*4
SH LAX,1 ;*8 SHL AX,1 ;*8
SH LAX,1 ;*16 SHL AX,1 ;*16
MO VBX,AX MOV BX,AX
SH LAX,1 ;*32 SHL AX,1 ;*32
SH LAX,1 ;*64 SHL AX,1 ;*64
ADD AX,BX ;*80 ADD AX,BX ;*80
``` ```
Using `LEA` on the 386, the above could be reduced to Using `LEA` on the 386, the above could be reduced to
@ -242,7 +242,7 @@ Of course, on the 386, the shift and add version could also be reduced
to this considerably more efficient code: to this considerably more efficient code:
```nasm ```nasm
SH LAX,4 ;*16 SHL AX,4 ;*16
MOV BX,AX MOV BX,AX
SHL AX,2 ;*64 SHL AX,2 ;*64
ADD AX,BX ;*80 ADD AX,BX ;*80
@ -766,9 +766,9 @@ _Divprocnear
sub dx,dx ;convert initial divisor word to a 32-bit sub dx,dx ;convert initial divisor word to a 32-bit
;value for DIV ;value for DIV
DivLoop: DivLoop:
lod sw ;get next most significant word of divisor lodsw ;get next most significant word of divisor
div bx div bx
sto sw ;save this word of the quotient stosw ;save this word of the quotient
;DX contains the remainder at this point, ;DX contains the remainder at this point,
; ready to prepend to the next divisor word ; ready to prepend to the next divisor word
loop DivLoop loop DivLoop

View file

@ -1020,7 +1020,7 @@ pushed on the stack will point to the instruction we want to continue
with. The code works out like this: with. The code works out like this:
```nasm ```nasm
jmpshort popfskip jmp short popfskip
popfiret: popfiret:
iret; branches to the instruction after the iret; branches to the instruction after the
; call, popping the word below the address ; call, popping the word below the address
@ -1082,8 +1082,8 @@ an 8088.)
.286 .286
: :
EMULATE_POPFmacro EMULATE_POPFmacro
pushcs push cs
pushoffset $+4 push offset $+4
iret iret
endm endm
``` ```

View file

@ -346,7 +346,7 @@ For example, you'd certainly expect a sequence such as
pop ax pop ax
ret ret
pop ax pop ax
et ret
: :
``` ```

View file

@ -410,7 +410,7 @@ Start proc near
mov al,1 ;blue is color 1 mov al,1 ;blue is color 1
call SelectSetResetColor ;set to draw in blue call SelectSetResetColor ;set to draw in blue
mov ax,VGA_SEGMENT mov ax,VGA_SEGMENT
move s,ax mov es,ax
sub di,di sub di,di
mov cx,7000h mov cx,7000h
rep stosb ;the value written actually doesn't rep stosb ;the value written actually doesn't

View file

@ -262,7 +262,7 @@ RestoreTheScreen:
RestoreLoop: RestoreLoop:
mov dx,SC_INDEX mov dx,SC_INDEX
mov al,MAP_MASK ;set SC Index to Map Mask register mov al,MAP_MASK ;set SC Index to Map Mask register
outdx,al out dx,al
inc dx inc dx
mov cl,[Plane] ;get the # of the plane we want mov cl,[Plane] ;get the # of the plane we want
; to restore ; to restore

View file

@ -810,7 +810,7 @@ RowLoop:
mov cx,LOGICAL_SCREEN_WIDTH/8/4 mov cx,LOGICAL_SCREEN_WIDTH/8/4
;fill 1 scan line ;fill 1 scan line
ColumnLoop: ColumnLoop:
sto sw ;draw part of a diagonal line stosw ;draw part of a diagonal line
mov word ptr es:[di],0 ;make vertical blank spaces so mov word ptr es:[di],0 ;make vertical blank spaces so
; panning effects can be seen easily ; panning effects can be seen easily
inc di inc di
@ -832,7 +832,7 @@ RowLoop2:
mov cx,LOGICAL_SCREEN_WIDTH/8/4 mov cx,LOGICAL_SCREEN_WIDTH/8/4
;fill 1 scan line ;fill 1 scan line
ColumnLoop2: ColumnLoop2:
sto sw ;draw part of a diagonal line stosw ;draw part of a diagonal line
mov word ptr es:[di],0 ;make vertical blank spaces so mov word ptr es:[di],0 ;make vertical blank spaces so
; panning effects can be seen easily ; panning effects can be seen easily
inc di inc di

View file

@ -373,22 +373,22 @@ Set320By400Mode proc near
mov al,MEMORY_MODE mov al,MEMORY_MODE
out dx,al out dx,al
inc dx inc dx
ina l,dx in al,dx
and al,not 08h ;turn off chain 4 and al,not 08h ;turn off chain 4
ora l,04h ;turn off odd/even or al,04h ;turn off odd/even
out dx,al out dx,al
mov dx,GC_INDEX mov dx,GC_INDEX
mov al,GRAPHICS_MODE mov al,GRAPHICS_MODE
out dx,al out dx,al
inc dx inc dx
ina l,dx in al,dx
and al,not 10h ;turn off odd/even and al,not 10h ;turn off odd/even
out dx,al out dx,al
dec dx dec dx
mov al,MISCELLANEOUS mov al,MISCELLANEOUS
out dx,al out dx,al
inc dx inc dx
ina l,dx in al,dx
and al,not 02h ;turn off chain and al,not 02h ;turn off chain
out dx,al out dx,al
; ;
@ -677,14 +677,14 @@ stack ends
; ;
OUT_WORDmacro OUT_WORDmacro
if WORD_OUTS_OK if WORD_OUTS_OK
outdx,ax out dx,ax
else else
out dx,al out dx,al
inc dx inc dx
xch gah,al xchg ah,al
out dx,al out dx,al
dec dx dec dx
xch gah,al xchg ah,al
endif endif
endm endm
; ;
@ -777,22 +777,22 @@ Set320By400Modeprocnear
mov al,MEMORY_MODE mov al,MEMORY_MODE
out dx,al out dx,al
inc dx inc dx
ina l,dx in al,dx
and al,not 08h ;turn off chain 4 and al,not 08h ;turn off chain 4
ora l,04h ;turn off odd/even or al,04h ;turn off odd/even
out dx,al out dx,al
mov dx,GC_INDEX mov dx,GC_INDEX
mov al,GRAPHICS_MODE mov al,GRAPHICS_MODE
out dx,al out dx,al
inc dx inc dx
ina l,dx in al,dx
and al,not 10h ;turn off odd/even and al,not 10h ;turn off odd/even
out dx,al out dx,al
dec dx dec dx
mov al,MISCELLANEOUS mov al,MISCELLANEOUS
out dx,al out dx,al
inc dx inc dx
ina l,dx in al,dx
and al,not 02h ;turn off chain and al,not 02h ;turn off chain
out dx,al out dx,al
; ;
@ -830,7 +830,7 @@ CONSTANT_TO_INDEXED_REGISTER SC_INDEX,MAP_MASK,0fh
mov al,UNDERLINE mov al,UNDERLINE
out dx,al out dx,al
inc dx inc dx
ina l,dx in al,dx
and al,not40h ;turn off doubleword and al,not40h ;turn off doubleword
out dx,al out dx,al
dec dx dec dx

View file

@ -390,7 +390,7 @@ RowLoop:
ColumnLoop: ColumnLoop:
stosb ;draw a pixel stosb ;draw a pixel
add al,1 ;increment the attribute add al,1 ;increment the attribute
ad cal,0 ;if the attribute just turned adc al,0 ;if the attribute just turned
; over to 0, increment it to 1 ; over to 0, increment it to 1
; because we're not going to ; because we're not going to
; cycle DAC location 0, so ; cycle DAC location 0, so

View file

@ -104,7 +104,7 @@ _LineDraw proc near
cld cld
push bp ;preserve caller's stack frame push bp ;preserve caller's stack frame
mov bp,sp ;point to our stack frame mov bp,sp ;point to our stack frame
sub sp, LOCAL_SIZE ;allocate space for local variables sub sp, LOCAL_SIZE ;allocate space for local variables
push si ;preserve C register variables push si ;preserve C register variables
push di push di
push ds ;preserve caller's DS push ds ;preserve caller's DS
@ -115,7 +115,7 @@ _LineDraw proc near
jle LineIsTopToBottom jle LineIsTopToBottom
xchg [bp].YEnd,ax; swap endpoints xchg [bp].YEnd,ax; swap endpoints
mov [bp].YStart,ax mov [bp].YStart,ax
movbx, [bp].XStart mov bx,[bp].XStart
xchg [bp].XEnd,bx xchg [bp].XEnd,bx
mov [bp].XStart,bx mov [bp].XStart,bx
LineIsTopToBottom: LineIsTopToBottom:

View file

@ -718,7 +718,7 @@ DiagonalSkipEntry:
jmp ScanEdgeDone jmp ScanEdgeDone
align 2 align 2
YMajor: YMajor:
pushbp ;preserve stack frame pointer push bp ;preserve stack frame pointer
mov si,[bp+X1] ;starting X coordinate mov si,[bp+X1] ;starting X coordinate
cmp [bp+SkipFirst],1 ;skip the first point? cmp [bp+SkipFirst],1 ;skip the first point?
mov bp,bx ;put Height in BP for error term calcs mov bp,bx ;put Height in BP for error term calcs
@ -734,7 +734,7 @@ YMajorSkipEntry:
YMajorNoAdvance: YMajorNoAdvance:
dec bx ;count off this scan line dec bx ;count off this scan line
jnz YMajorLoop jnz YMajorLoop
popbp ;restore stack frame pointer pop bp ;restore stack frame pointer
ScanEdgeDone: ScanEdgeDone:
cmp [bp+SetXStart],1 ;were we working with XStart field? cmp [bp+SetXStart],1 ;were we working with XStart field?
jz UpdateHLinePtr ;yes, DI points to the next XStart jz UpdateHLinePtr ;yes, DI points to the next XStart

View file

@ -443,7 +443,7 @@ Dataends
; ;
; Macro to output a word value to a port. ; Macro to output a word value to a port.
; ;
OUT_WORDmacro OUT_WORD macro
if WORD_OUTS_OK if WORD_OUTS_OK
out dx,ax out dx,ax
else else
@ -459,9 +459,9 @@ endif
; Macro to output a constant value to an indexed VGA ; Macro to output a constant value to an indexed VGA
; register. ; register.
; ;
CONSTANT_TO_INDEXED_REGISTERmacro ADDRESS, INDEX, VALUE CONSTANT_TO_INDEXED_REGISTER macro ADDRESS, INDEX, VALUE
movdx, ADDRESS mov dx, ADDRESS
movax, (VALUE shl 8) + INDEX mov ax, (VALUE shl 8) + INDEX
OUT_WORD OUT_WORD
endm endm
; ;
@ -704,7 +704,7 @@ DrawObject proc near
mov dx,ax ;# of lines in the image mov dx,ax ;# of lines in the image
lodsw ;# of bytes across the image lodsw ;# of bytes across the image
mov bp,SCREEN_WIDTH mov bp,SCREEN_WIDTH
subbp,ax ;# of bytes to add to the display sub bp,ax ;# of bytes to add to the display
; memory offset after copying a line ; memory offset after copying a line
; of the image to display memory in ; of the image to display memory in
; order to point to the address ; order to point to the address
@ -718,7 +718,7 @@ DrawLoop:
; next line will go in display ; next line will go in display
; memory ; memory
dec dx ;count down the lines of the image dec dx ;count down the lines of the image
jnzDrawLoop jnz DrawLoop
ret ret
DrawObjectendp DrawObjectendp
; ;

View file

@ -447,7 +447,7 @@ DrawRectParms ends
mov dh,RightMask[bx] ;set the right-edge clip mask mov dh,RightMask[bx] ;set the right-edge clip mask
mov bx,LeftX[bp] mov bx,LeftX[bp]
and bx,NOT 7 ;intrapixel address of left edge and bx,NOT 7 ;intrapixel address of left edge
su si,bx sub si,bx
shr si,1 shr si,1
shr si,1 shr si,1
shr si,1 ;# of bytes across spanned by rectangle - 1 shr si,1 ;# of bytes across spanned by rectangle - 1
@ -455,7 +455,7 @@ DrawRectParms ends
and dl,dh ; combine the masks and dl,dh ; combine the masks
MasksSet: MasksSet:
mov bx,BottomY[bp] mov bx,BottomY[bp]
su bx,TopY[bp] ;# of scan lines to fill - 1 sub bx,TopY[bp] ;# of scan lines to fill - 1
FillLoop: FillLoop:
push di ;remember line start offset push di ;remember line start offset
mov al,dl ;left edge clip mask mov al,dl ;left edge clip mask
@ -661,7 +661,7 @@ TextUpDone:
CharUp: ;draws the character in AL at ES:DI CharUp: ;draws the character in AL at ES:DI
lds si,[BIOS8x8Ptr] ;point to the 8x8 font start lds si,[BIOS8x8Ptr] ;point to the 8x8 font start
mov bl,al mov bl,al
su bh,bh sub bh,bh
shl bx,1 shl bx,1
shl bx,1 shl bx,1
shl bx,1 ;*8 to look up character offset in font shl bx,1 ;*8 to look up character offset in font

View file

@ -499,7 +499,7 @@ parms ends
les di,[bp+BufferPtr] les di,[bp+BufferPtr]
mov dx,[bp+RectHeight] mov dx,[bp+RectHeight]
mov bx,[bp+BufferWidth] mov bx,[bp+BufferWidth]
su bx,[bp+RectWidth] ;distance from end of one dest scan sub bx,[bp+RectWidth] ;distance from end of one dest scan
; to start of next ; to start of next
mov al,byte ptr [bp+Color] mov al,byte ptr [bp+Color]
mov ah,al ;double the color for REP STOSW mov ah,al ;double the color for REP STOSW
@ -544,7 +544,7 @@ parms2 ends
mov bx,[bp+Pixels] mov bx,[bp+Pixels]
mov dx,[bp+ImageHeight] mov dx,[bp+ImageHeight]
mov ax,[bp+BufferWidth2] mov ax,[bp+BufferWidth2]
su ax,[bp+ImageWidth] ;distance from end of one dest scan sub ax,[bp+ImageWidth] ;distance from end of one dest scan
mov [bp+BufferWidth2],ax ; to start of next mov [bp+BufferWidth2],ax ; to start of next
RowLoop2: RowLoop2:
mov cx,[bp+ImageWidth] mov cx,[bp+ImageWidth]
@ -556,7 +556,7 @@ ColumnLoop:
mov es:[di],al mov es:[di],al
SkipPixel: SkipPixel:
inc bx ;point to next source pixel inc bx ;point to next source pixel
inc d ;point to next dest pixel inc di ;point to next dest pixel
dec cx dec cx
jnz ColumnLoop jnz ColumnLoop
add di,[bp+BufferWidth2] ;point to next scan to fill add di,[bp+BufferWidth2] ;point to next scan to fill
@ -596,9 +596,9 @@ parms3 ends
lds si,[bp+SrcBufferPtr] lds si,[bp+SrcBufferPtr]
mov dx,[bp+CopyHeight] mov dx,[bp+CopyHeight]
mov bx,[bp+DestBufferWidth] ;distance from end of one dest scan mov bx,[bp+DestBufferWidth] ;distance from end of one dest scan
su bx,[bp+CopyWidth] ; of copy to the next sub bx,[bp+CopyWidth] ; of copy to the next
mov ax,[bp+SrcBufferWidth] ;distance from end of one source scan mov ax,[bp+SrcBufferWidth] ;distance from end of one source scan
su ax,[bp+CopyWidth] ; of copy to the next sub ax,[bp+CopyWidth] ; of copy to the next
RowLoop3: RowLoop3:
mov cx,[bp+CopyWidth] ;# of bytes to copy mov cx,[bp+CopyWidth] ;# of bytes to copy
shr cx,1 shr cx,1

View file

@ -521,7 +521,7 @@ MasksSet:
mov [bp+SourceNextScanOffset],ax mov [bp+SourceNextScanOffset],ax
mov [bp+RectAddrWidth],cx ;remember width in addresses - 1 mov [bp+RectAddrWidth],cx ;remember width in addresses - 1
;----------------------BUG FIX ;----------------------BUG FIX
mov dx,SC_INDEX mov dx,SC_INDEX
mov al,MAP_MASK mov al,MAP_MASK
out dx,al ;point SC Index reg to Map Mask out dx,al ;point SC Index reg to Map Mask
inc dx ;point to SC Data reg inc dx ;point to SC Data reg

View file

@ -174,7 +174,7 @@ else ; !ROUNDING-ON
sub eax,eax sub eax,eax
shrd eax,edx,16 ;position so that result ends up shrd eax,edx,16 ;position so that result ends up
sar edx,16 ; in EAX sar edx,16 ; in EAX
idivdword ptr [bp+Divisor] idiv dword ptr [bp+Divisor]
endif ;ROUNDING-ON endif ;ROUNDING-ON
shld edx,eax,16 ;whole part of result in DX; shld edx,eax,16 ;whole part of result in DX;
; fractional part is already in AX ; fractional part is already in AX
@ -224,9 +224,9 @@ jg MakeInRange
ja Quadrant1 ja Quadrant1
;quadrant 0 ;quadrant 0
shl bx,2 shl bx,2
move ax,CosTable[bx] ;look up sine mov eax,CosTable[bx] ;look up sine
neg bx ;sin(Angle) = cos(90-Angle) neg bx ;sin(Angle) = cos(90-Angle)
move dx,CosTable[bx+90*10*4] ;look up cosine mov edx,CosTable[bx+90*10*4] ;look up cosine
jmp short CSDone jmp short CSDone
align ALIGNMENT align ALIGNMENT
@ -237,7 +237,7 @@ Quadrant1:
mov eax,CosTable[bx] ;look up cosine mov eax,CosTable[bx] ;look up cosine
neg eax ;negative in this quadrant neg eax ;negative in this quadrant
neg bx ;sin(Angle) = cos(90-Angle) neg bx ;sin(Angle) = cos(90-Angle)
move dx,CosTable[bx+90*10*4] ;look up cosine mov edx,CosTable[bx+90*10*4] ;look up cosine
jmp short CSDone jmp short CSDone
align ALIGNMENT align ALIGNMENT
@ -248,11 +248,11 @@ BottomHalf: ;quadrant 2 or 3
ja Quadrant2 ja Quadrant2
;quadrant 3 ;quadrant 3
shl bx, 2 shl bx, 2
mov eax,CosTable[bx] ;look up cosine mov eax,CosTable[bx] ;look up cosine
neg bx ;sin(Angle) = cos(90-Angle) neg bx ;sin(Angle) = cos(90-Angle)
movedx,CosTable[90*10*4+bx] ;look up sine mov edx,CosTable[90*10*4+bx] ;look up sine
nege dx ;negative in this quadrant neg edx ;negative in this quadrant
jmp short CSDone jmp short CSDone
align ALIGNMENT align ALIGNMENT
Quadrant2: Quadrant2:
@ -262,8 +262,8 @@ Quadrant2:
mov eax,CosTable[bx] ;look up cosine mov eax,CosTable[bx] ;look up cosine
neg eax ;negative in this quadrant neg eax ;negative in this quadrant
neg bx ;sin(Angle) = cos(90-Angle) neg bx ;sin(Angle) = cos(90-Angle)
move dx,CosTable[90*10*4+bx] ;look up sine mov edx,CosTable[90*10*4+bx] ;look up sine
nege dx ;negative in this quadrant neg edx ;negative in this quadrant
CSDone: CSDone:
mov bx,[bp].Cos mov bx,[bp].Cos
mov [bx],eax mov [bx],eax
@ -347,9 +347,9 @@ soff=soff+16
doff=doff+4 doff=doff+4
ENDM ENDM
popdi;restore register variables pop di;restore register variables
popsi pop si
popbp;restore stack frame pop bp;restore stack frame
ret ret
-XformVecendp -XformVecendp
;===================================================================== ;=====================================================================
@ -391,7 +391,7 @@ CXparms ends
push bp ;preserve stack frame push bp ;preserve stack frame
mov bp,sp ;set up local stack frame mov bp,sp ;set up local stack frame
push si ;preserve register variables push si ;preserve register variables
pushdi push di
mov bx,[bp].SourceXform2 ;BX points to xform2 matrix mov bx,[bp].SourceXform2 ;BX points to xform2 matrix
mov si,[bp].SourceXform1 ;SI points to xform1 matrix mov si,[bp].SourceXform1 ;SI points to xform1 matrix
@ -407,7 +407,7 @@ coff=0 ;column offset
imul dword ptr [bx+coff];times row 0 entry in column imul dword ptr [bx+coff];times row 0 entry in column
if ROUNDING-ON if ROUNDING-ON
add eax,8000h ;round by adding 2^(-17) add eax,8000h ;round by adding 2^(-17)
adcedx,0;whole part of result is in DX adc edx,0 ;whole part of result is in DX
endif ;ROUNDING-ON endif ;ROUNDING-ON
shrd eax,edx,16 ;shift the result back to 16.16 form shrd eax,edx,16 ;shift the result back to 16.16 form
mov ecx,eax ;set running total mov ecx,eax ;set running total
@ -471,9 +471,9 @@ coff=coff+4 ;point to next col in xform2 & dest
roff=roff+16 ;point to next col in xform2 & dest roff=roff+16 ;point to next col in xform2 & dest
ENDM ENDM
popdi;restore register variables pop di;restore register variables
popsi pop si
popbp;restore stack frame pop bp;restore stack frame
ret ret
-ConcatXformsendp -ConcatXformsendp
end end

View file

@ -203,14 +203,14 @@ _FixedMul endp
; Fixedpoint FixedDiv(Fixedpoint Dividend, Fixedpoint Divisor); ; Fixedpoint FixedDiv(Fixedpoint Dividend, Fixedpoint Divisor);
FDparms struc FDparms struc
dw 2 dup(?) ;return address & pushed BP dw 2 dup(?) ;return address & pushed BP
Dividend dd? Dividend dd ?
Divisor dd? Divisor dd ?
FDparms ends FDparms ends
alignALIGNMENT align ALIGNMENT
public_FixedDiv public _FixedDiv
_FixedDivproc near _FixedDivproc near
pushbp push bp
movbp,sp mov bp,sp
if USE386 if USE386
@ -268,13 +268,13 @@ else ;!USE386
; projection can't be performed for points closer to the viewpoint than Z=1. ; projection can't be performed for points closer to the viewpoint than Z=1.
;figure out signs, so we can use ;figure out signs, so we can use
; unsigned divisions ; unsigned divisions
subcx, cx ;assume both operands positive sub cx,cx ;assume both operands positive
mov ax,word ptr [bp+Dividend+2] mov ax,word ptr [bp+Dividend+2]
and ax,ax;first operand negative? and ax,ax;first operand negative?
jns CheckSecondOperandD ;no jns CheckSecondOperandD ;no
neg ax ;yes, so negate first operand neg ax ;yes, so negate first operand
neg word ptr [bp+Dividend] neg word ptr [bp+Dividend]
sbbax,0 sbb ax,0
inc cx ;mark that first operand is negative inc cx ;mark that first operand is negative
CheckSecondOperandD: CheckSecondOperandD:
mov bx,word ptr [bp+Divisor+2] mov bx,word ptr [bp+Divisor+2]
@ -366,9 +366,9 @@ CheckInRange:
ja Quadrant1 ja Quadrant1
;quadrant 0 ;quadrant 0
shl bx,2 shl bx,2
move ax,CosTable[bx] ;look up sine mov eax,CosTable[bx] ;look up sine
neg bx;sin(Angle) = cos(90-Angle) neg bx;sin(Angle) = cos(90-Angle)
move dx,CosTable[bx+90*10*4] ;look up cosine mov edx,CosTable[bx+90*10*4] ;look up cosine
jmp short CSDone jmp short CSDone
align ALIGNMENT align ALIGNMENT
@ -376,10 +376,10 @@ Quadrant1:
neg bx neg bx
add bx,180*10 ;convert to angle between 0 and 90 add bx,180*10 ;convert to angle between 0 and 90
shl bx,2 shl bx,2
move ax,CosTable[bx] ;look up cosine mov eax,CosTable[bx] ;look up cosine
neg eax ;negative in this quadrant neg eax ;negative in this quadrant
neg bx ;sin(Angle) = cos(90-Angle) neg bx ;sin(Angle) = cos(90-Angle)
move dx,CosTable[bx+90*10*4] ;look up cosine mov edx,CosTable[bx+90*10*4] ;look up cosine
jmp short CSDone jmp short CSDone
align ALIGNMENT align ALIGNMENT
@ -390,9 +390,9 @@ BottomHalf: ;quadrant 2 or 3
ja Quadrant2 ja Quadrant2
;quadrant 3 ;quadrant 3
shl bx,2 shl bx,2
move ax,CosTable[bx] ;look up cosine mov eax,CosTable[bx] ;look up cosine
neg bx;sin(Angle) = cos(90-Angle) neg bx;sin(Angle) = cos(90-Angle)
move dx,CosTable[90*10*4+bx] ;look up sine mov edx,CosTable[90*10*4+bx] ;look up sine
neg edx ;negative in this quadrant neg edx ;negative in this quadrant
jmp short CSDone jmp short CSDone
@ -401,10 +401,10 @@ Quadrant2:
neg bx neg bx
add bx,180*10 ;convert to angle between 0 and 90 add bx,180*10 ;convert to angle between 0 and 90
shl bx,2 shl bx,2
move ax,CosTable[bx] ;look up cosine mov eax,CosTable[bx] ;look up cosine
neg eax ;negative in this quadrant neg eax ;negative in this quadrant
neg bx ;sin(Angle) = cos(90-Angle) neg bx ;sin(Angle) = cos(90-Angle)
move dx,CosTable[90*10*4+bx] ;look up sine mov edx,CosTable[90*10*4+bx] ;look up sine
neg edx ;negative in this quadrant neg edx ;negative in this quadrant
CSDone: CSDone:
mov bx,[bp].Cos mov bx,[bp].Cos
@ -619,9 +619,9 @@ if MUL-ROUNDING-ON
adc edx,0 ;whole part of result is in DX adc edx,0 ;whole part of result is in DX
endif ;MUL-ROUNDING-ON endif ;MUL-ROUNDING-ON
shrd eax,edx,16 ;shift the result back to 16.16 form shrd eax,edx,16 ;shift the result back to 16.16 form
move cx,eax ;set running total mov ecx,eax ;set running total
move ax,[si+soff+4] ;column 1 entry on this row mov eax,[si+soff+4] ;column 1 entry on this row
imul dword ptr [bx+4] ;xform entry times source Y entry imul dword ptr [bx+4] ;xform entry times source Y entry
if MUL-ROUNDING-ON if MUL-ROUNDING-ON
add eax,8000h ;round by adding 2^(-17) add eax,8000h ;round by adding 2^(-17)
@ -630,7 +630,7 @@ endif ;MUL-ROUNDING-ON
shrd eax,edx,16 ;shift the result back to 16.16 form shrd eax,edx,16 ;shift the result back to 16.16 form
add ecx,eax ;running total for this row add ecx,eax ;running total for this row
move ax,[si+soff+8] ;column 2 entry on this row mov eax,[si+soff+8] ;column 2 entry on this row
imul dword ptr [bx+8] ;xform entry times source Z entry imul dword ptr [bx+8] ;xform entry times source Z entry
if MUL-ROUNDING-ON if MUL-ROUNDING-ON
add eax,8000h ;round by adding 2^(-17) add eax,8000h ;round by adding 2^(-17)
@ -759,17 +759,17 @@ coff=0 ;column offset
REPT 3 ;once for each of the first 3 columns, REPT 3 ;once for each of the first 3 columns,
; assuming 0 as the bottom entry (no ; assuming 0 as the bottom entry (no
; translation) ; translation)
move ax,[si+roff] ;column 0 entry on this row mov eax,[si+roff] ;column 0 entry on this row
imul dword ptr [bx+coff] ;times row 0 entry in column imul dword ptr [bx+coff] ;times row 0 entry in column
if MUL-ROUNDING-ON if MUL-ROUNDING-ON
add eax,8000h ;round by adding 2^(-17) add eax,8000h ;round by adding 2^(-17)
adc edx,0 ;whole part of result is in DX adc edx,0 ;whole part of result is in DX
endif ;MUL-ROUNDING-ON endif ;MUL-ROUNDING-ON
shrd eax,edx,16 ;shift the result back to 16.16 form shrd eax,edx,16 ;shift the result back to 16.16 form
move cx,eax ;set running total mov ecx,eax ;set running total
move ax,[si+roff+4] ;column 1 entry on this row mov eax,[si+roff+4] ;column 1 entry on this row
imuld word ptr [bx+coff+16] ;times row 1 entry in col imul dword ptr [bx+coff+16] ;times row 1 entry in col
if MUL-ROUNDING-ON if MUL-ROUNDING-ON
add eax,8000h ;round by adding 2^(-17) add eax,8000h ;round by adding 2^(-17)
adc edx,0 ;whole part of result is in DX adc edx,0 ;whole part of result is in DX
@ -777,8 +777,8 @@ endif ;MUL-ROUNDING-ON
shrd eax,edx,16 ;shift the result back to 16.16 form shrd eax,edx,16 ;shift the result back to 16.16 form
add ecx,eax ;running total add ecx,eax ;running total
move ax,[si+roff+8] ;column 2 entry on this row mov eax,[si+roff+8] ;column 2 entry on this row
imuld word ptr [bx+coff+32] ;times row 2 entry in col imul dword ptr [bx+coff+32] ;times row 2 entry in col
if MUL-ROUNDING-ON if MUL-ROUNDING-ON
add eax,8000h ;round by adding 2^(-17) add eax,8000h ;round by adding 2^(-17)
adc edx,0 ;whole part of result is in DX adc edx,0 ;whole part of result is in DX
@ -792,17 +792,17 @@ coff=coff+4 ;point to next col in xform2 & dest
;now do the fourth column, assuming ;now do the fourth column, assuming
; 1 as the bottom entry, causing ; 1 as the bottom entry, causing
; translation to be performed ; translation to be performed
move ax,[si+roff] ;column 0 entry on this row mov eax,[si+roff] ;column 0 entry on this row
imuld word ptr [bx+coff] ;times row 0 entry in column imul dword ptr [bx+coff] ;times row 0 entry in column
if MUL-ROUNDING-ON if MUL-ROUNDING-ON
add eax,8000h ;round by adding 2^(-17) add eax,8000h ;round by adding 2^(-17)
adc edx,0 ;whole part of result is in DX adc edx,0 ;whole part of result is in DX
endif ;MUL-ROUNDING-ON endif ;MUL-ROUNDING-ON
shrd eax,edx,16 ;shift the result back to 16.16 form shrd eax,edx,16 ;shift the result back to 16.16 form
move cx,eax ;set running total mov ecx,eax ;set running total
move ax,[si+roff+4] ;column 1 entry on this row mov eax,[si+roff+4] ;column 1 entry on this row
imuld word ptr [bx+coff+16] ;times row 1 entry in col imul dword ptr [bx+coff+16] ;times row 1 entry in col
if MUL-ROUNDING-ON if MUL-ROUNDING-ON
add eax,8000h ;round by adding 2^(-17) add eax,8000h ;round by adding 2^(-17)
adc edx,0 ;whole part of result is in DX adc edx,0 ;whole part of result is in DX
@ -810,8 +810,8 @@ endif ;MUL-ROUNDING-ON
shrd eax,edx,16 ;shift the result back to 16.16 form shrd eax,edx,16 ;shift the result back to 16.16 form
add ecx,eax ;running total add ecx,eax ;running total
move ax,[si+roff+8] ;column 2 entry on this row mov eax,[si+roff+8] ;column 2 entry on this row
imuld word ptr [bx+coff+32] ;times row 2 entry in col imul dword ptr [bx+coff+32] ;times row 2 entry in col
if MUL-ROUNDING-ON if MUL-ROUNDING-ON
add eax,8000h ;round by adding 2^(-17) add eax,8000h ;round by adding 2^(-17)
adc edx,0 ;whole part of result is in DX adc edx,0 ;whole part of result is in DX