Output of file : FAST.ASM contained in archive : SPCWAR.ZIP
; Low level, speedy routines for SPACEWAR
; --- Dan Moore
; includes crude magn/phase extraction, inverse square, & multiplication
; compile under Turbo Assembler

IDEAL
DOSSEG
MODEL small

CODESEG

; procedure to multiply a signed int (-16383 to 16383) by a fraction
; in the interval (-1.00,1.00). +/-32767 corresponds to +/-1.00.
;

PUBLIC _Umul
PROC _Umul near
_Umul:
push bp
mov bp,sp
mov ax,[bp+04]
mul [word ptr bp+06]
and ax,8000H
jz @@10
inc dx
@@10:
mov ax,dx
pop bp
ret
ENDP _Umul

PUBLIC _mul
PROC _mul near
_mul:
push bp
mov bp,sp
mov ax,[bp+04]
imul [word ptr bp+06]
and ax,8000H
jz @@10
inc dx
@@10:
mov ax,dx
pop bp
ret
ENDP _mul

;---------------

CODESEG

; given signed displacements x and y, this procedure approximates the
; the value |x+j*y| and gives a phase (0x0000-0xFFFF) corresponding to
; the arctangent of y/x

PUBLIC _magphz
PROC _magphz near
_magphz:
push bp
mov bp,sp
mov [X+0],0
mov [X+2],0

mov cx,[bp+4] ;==xcoord
or cx,cx
jge @@10
neg cx
inc [byte ptr X] ;X[0]=sign(x)
@@10:
inc cx
mov [X+4],cx ;X[4]=abs(x)
mov dx,[bp+6] ;==ycoord
or dx,dx
jge @@20
neg dx
inc [byte ptr X+1] ;X[1]=sign(y)
@@20:
inc dx
mov [X+6],dx ;X[6]=abs(y)
cmp dx,cx
jl @@30 ; if dx (y) >= cx (x)
xchg dx,cx ; X[2]=1
mov ax,[X+4]
xchg ax,[X+6]
xchg ax,[X+4]
inc [byte ptr X+2] ; {swap x,y}
@@30:
cmp dx,cx
jne @@35
inc cx
@@35:
xor ax,ax
div cx ;divide y/x
mov [X+10],ax
cmp ax,6a09h
jae @@sec
mov ax,[coefs]
mul [X+4]
mov [X+8],dx
mov ax,[coefs+2]
mul [X+6]
jmp @@40
@@sec:
mov ax,[coefs+4]
mul [X+4]
mov [X+8],dx
mov ax,[coefs+6]
mul [X+6]
@@40:
;========
calc_phz:
mov ax,64
mul [X+10]
inc dx
and dx,0fffeh
mov bx,dx
mov ax,[atn_tab+bx]
mov cl,[byte ptr X+2]
or cl,cl
je @@110
mov cx,16384
sub cx,ax
mov ax,cx
@@110:
mov cl,[byte ptr X+0]
or cl,cl
je @@120
mov cx,32768
sub cx,ax
mov ax,cx
@@120:
mov cl,[byte ptr X+1]
or cl,cl
je @@130
neg ax
@@130:
mov dx,[X+8]
pop bp
ret
ENDP _magphz

DATASEG

LABEL coefs word
dw 0FD78h, 03268h, 0d6e2h, 08f98h

LABEL atn_tab word
dw 0000, 0325, 0651, 0974, 1297, 1616, 1933, 2246
dw 2555, 2859, 3159, 3453, 3741, 4024, 4301, 4571
dw 4835, 5093, 5344, 5588, 5826, 6057, 6281, 6500
dw 6711, 6917, 7116, 7309, 7497, 7679, 7855, 8026, 8192

UDATASEG

PUBLIC X
LABEL X word
DW 7 dup (?)

;---------------

CODESEG

; given a positive integer (0x0000-0xfffe) calculates an inverse square
;
;
PUBLIC _invsqr
PROC _invsqr near
_invsqr:
push bp
mov bp,sp
mov ax,[bp+4]
mov cl,8
shr ax,cl
mul ax
jne @@05
sub ax,1
@@05:
mov bx,ax
xor dx,dx
mov ax,0ffffh
div bx

cmp ax,[bp+6]
jna @@10
mov ax,[bp+6]
@@10:
pop bp
ret
ENDP _invsqr

END

3 Responses to “Category : A Collection of Games for DOS and WindowsArchive   : SPCWAR.ZIPFilename : FAST.ASM”

1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/