flat assembler
Message board for the users of flat assembler.

Index > Main > help to convert this tasm....

Author
Thread Post new topic Reply to topic
Miguel



Joined: 16 Jun 2003
Posts: 21
Location: Spain
Miguel
Very Happy
Hello to alls!
This is tasm´s syntax ...
How to convert to fasm´s syntax?
Code:
                           ..........
..........
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
Code:
 ;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.....
Post 20 Apr 2004, 23:34
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7718
Location: Kraków, Poland
Tomasz Grysztar
Code:
LABEL MulBy320 WORD
I = 0 
REPEAT 204                
DW 320*I 
I = I + 1
END REPEAT    

Doesn't it show that TASM was a bit inspiration for fasm's syntax? Wink
But you can do it also this way:
Code:
LABEL MulBy320 WORD
REPEAT 204
DW 320*(%-1)
END REPEAT     

or the most short (this time a bit of NASM-inspired syntax):
Code:
LABEL MulBy320 WORD
TIMES 204 DW 320*(%-1)    
Post 21 Apr 2004, 07:13
View user's profile Send private message Visit poster's website Reply with quote
Miguel



Joined: 16 Jun 2003
Posts: 21
Location: Spain
Miguel
Very Happy
Yes! Thanks!!!
It´s just that i'm looking for !!!!

_________________
Hola,Hello...my english is not good..but..
we understand us.....
Post 22 Apr 2004, 23:11
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.