Miguel
Joined: 16 Jun 2003
Posts: 21
Location: Spain
|
Hello to alls!
This is tasm´s syntax ...
How to convert to fasm´s syntax?
..........
..........
MulBy320 LABEL WORD
I = 0
REPT 204
DW 320*I
I = I + 1
ENDM
..................
..........
Not in that form:
dw 0,320,640,960.......
dw ...............etc,etc
;other example
PIXMAP = 512+32
RED_LEAD= 4
R_BASE= 40
POS_X =127
POS_Y =120
D_ALPHA =44*2
use16
org 100h
BEGIN:
mov ax,13h
int 10h
mov cl,0
PALETE:
mov ax,cx
mov dx,3C8h
out dx,al ; color number
inc dx
shr ax,2
add al,RED_LEAD
out dx,al ; RED
sub al,RED_LEAD
out dx,al ; GREEN
cmp cl,63
cmc
salc
or al,cl
out dx,al
loop PALETE
fninit
fldz ; alpha
mov dl,0DAh
mov bx,TEMP
MAIN :
in al,dx
test al,8
jz MAIN
push si
DRAW :
push word 0A000h
pop es
mov si,dx ; frame buffer -> screen
xor di,di
mov ch,32000/256
rep movsw
mov cl,200
mov di,dx
pop si
push ds
pop es
inc si
fiadd word [bx+D_ALPHA_ADD-TEMP] ; alpha += D_ALPHA
FOR_Y:
mov ax,si ; for(cx=200;cx>0;cx--)
cbw
xor al,ah
shr al,1
add al,R_BASE
cbw ; compute R
mov bx,ax
fild word [bx] ; alpha, r
fld st0
fmul st0,st0 ; alpha, r, r2
fld st2 ; alpha,r,r2,alpha
fsincos ; alpha,r,r2,sin(alpha),cos(alpha)
fmul st0,st3 ; alpha,r,r2,sin(alpha),r.cos(alpha)
fistp word [bx+CENTERX-TEMP] ; alpha,r,r2,sin(alpha)
fmul st0,st2 ; alpha,r,r2,r.sin(alpha)
mov bx,cx
sub word [bx],POS_Y
fiadd word [bx] ; alpha,r,r2,y
fld st0 ; alpha,r,r2,y,y
fmul st0,st0 ; alpha,r,r2,y,y2
fsubp st2,st0 ; alpha,r,r2-y2,y
fld st3 ; alpha,r,r2-y2,y,alpha
fadd st0,st0 ; alpha,r,r2-y2,y,2.alpha
fsincos ; alpha,r,r2-y2,y,sin 2.alpha,cos 2.alpha
fmulp st2,st0 ; alpha,r,r2-y2,y.sy,sx
mov bp,320
FOR_X:
; for(bp=320; bp>0 ;bp--)
mov ax,POS_X
CENTERX = $-2
lea ax,[eax+ebp-POS_X]
mov bx,ax
fild word [bx] ; alpha,r,r2-y2,y.sy,sx,x
fmul st0, st1
fild word [bx] ; alpha,r,r2-y2,y.sy,sx,sx.x,x
fld st0 ; alpha,r,r2-y2,y.sy,sx,sx.x,x,x
fmul st0,st0 ; alpha,r,r2-y2,y.sy,sx,sx.x,x,x2
fsubr st0,st5 ; alpha,r,r2-y2,y.sy,sx,sx.x,x,r2-x2-y2
fist word [bx]
or bx,cx
jns SPHERE
TEXTURE:
fcompp ; FPU: alpha,r,r2-y2,y.sy,sx,sx.x,x,r2-x2-y2
fistp word [bx]
mov ax,bx
shr ax,3
add ax,cx
xor ax,bp
and al,31
NEXT:
stosb
dec bp
jnz FOR_X ; FPU: alpha,r,r2-y2,y.sy,sx
fcompp
fcompp
loop FOR_Y
mov ah,1
int 16h
jz near MAIN
mov ax,3
int 10h
ret
SPHERE:
fsqrt ; alpha,r,r2-y2,y.sy,sx,sx.x,x,z
lea ax,[ecx+4*esi]
fadd st2,st0
fpatan ; alpha,r,r2-y2,y.sy,sx,sx.x,arctg(z/x)
fimul word [bx+DRAW-TEMP]
fistp word [bx] ; alpha,r,r2-y2,y.sy,sx,sx.x
add ax,bx
shl al,2
fadd st0,st1
cbw
xor al,ah
fistp word [di]
shr al,2
shr ah,6
add al,ah
or [di+1],ch
js NEXT
add al,[di]
jmp NEXT
D_ALPHA_ADD dw 44
align 4
TEMP = 512-8
_________________ Hola,Hello...my english is not good..but..
we understand us.....
|