flat assembler
Message board for the users of flat assembler.
![]() Goto page Previous 1, 2 |
Author |
|
Matrix 05 Apr 2006, 15:34
relsoft wrote: vid. thanks for the explanation. :*) hello, you have cool tuts there ![]() you should write "http://rel.betterwebber.com/mytutes/3dtutes/chapter3/Files/" instead of "http://rel.betterwebber.com/Mytutes/3dTutes/Chapter3/Files/" case sensitivity... |
|||
![]() |
|
relsoft 06 Apr 2006, 00:46
Matrix, thanks. I never noticed that. Anyways here are some other tutes I made.
Chapter 5 of the 3d series: http://www.phatcode.net/articles.php?id=216 Plasma : http://petesqbsite.com/sections/zines/qbcm/issues/4-1/default.html#plasmas Metaballs/blobs: http://petesqbsite.com/sections/express/issue1/index.html#blobs There are other's but I don't know if they'd be useful to you guys as the code are in either Qbasic or FreeBasic. The_greay_beast: Thanks for the kind comments. Anyways, I was playing with radial displacement last night and I thought I could apply it on the above tunnel so here's the flower tunnel. :*) Code: ;***************************************************************** ; flower tunnel by rel ; Assemble with fasm ; Http://Rel.Betterwebber.com ;***************************************************************** diameter = 64 diamxscale = (64 * diameter) scale = 256 org 100h ;***************************************************************** ;***************************************************************** ;***************************************************************** push word 0a000h pop es mov ax, 0013h ; mode 13h int 10h ; we are now in 320x200x256 fninit ;====set palette mov dx, 03c8h ;palette write register out dx, al ;send value inc dx ;0x3c9(write RGB values) mov cx, 256 ;whole 256 colors fldpi ;st0 = pi mov [ishort], 180 ;st0 = 180, st1 = pi fild [ishort] palloop: mov bx, 256 sub bx, cx shl bx,1 mov [ishort], bx fild [ishort] ;st0 = deg, st1 = 180, st2 = pi fmul st0, st2 fdiv st0, st1 fsin ;st0 = sin(rad) mov [ishort], 64 fimul [ishort] fistp [ishort] mov ax, [ishort] out dx, al ;red shl al,1 ;blue out dx, al shr al, 2 out dx, al ;than green loop palloop ;go back if not 0 fstp st0 fstp st0 mov [fold_num], 5 MainLoop: mov [scx],160 mov [scy],100 inc [frame] ;displacement fild [frame] mov [ishort], 50 fidiv [ishort] fsin mov [ishort], 120 fimul [ishort] fistp [ishort] mov ax, [ishort] add [scx], ax fild [frame] mov [ishort], 60 fidiv [ishort] fsin mov [ishort], 80 fimul [ishort] fistp [ishort] mov ax, [ishort] add [scy], ax ;flower ;fold_off += 0.2 mov [ishort], 2 fild [ishort] mov [ishort], 10 fidiv [ishort] fadd [fold_off] fstp [fold_off] ;fold_scale = 0.3 * sin(frame / 40) mov [ishort], 5 fild [ishort] mov [ishort], 10 fidiv [ishort] fild [frame] ;st0 = frame; st1 = 0.3 mov [ishort], 40 fidiv [ishort] fsin fmul st0, st1 fstp [fold_scale] fstp st0 ;===========tunnel mov dx,200 mov di, 0 tunnel_yloop: mov cx,320 tunnel_xloop: ;atan2 fldpi ;st0 = pi mov ax, [scy] mov [short_var], ax sub [short_var], dx fild [short_var] ;st0 = dy, st1 = pi mov ax, [scx] mov [short_var], ax sub [short_var], cx fild [short_var] ;st0 = dx, st1 = dy, st2 = pi fpatan ;st0 = atan(dy/dx) = atan(st1/st0) ;flower ;xdist = xdist * ((sin(fold_off + fold_num * angle) * fold_scale)+1) fstp [real_var] fld [real_var] ;restore fld [real_var] fimul [fold_num] fadd [fold_off] fsin fmul [fold_scale] mov [ishort], 1 fiadd [ishort] fstp [real_var] ;real_var =((sin(fold_off + fold_num * angle) * fold_scale)+1) mov [short_var], scale fimul [short_var] ;atan(st0))*256/pi fdiv st0, st1 fistp [short_var] ;short_var = scaledpi mov ax, [scx] sub ax, cx ;cmx mov [ishort], ax fild [ishort] ;st0 = cmx fmul st0, st0 ;cmx * cmx mov ax, [scy] sub ax, dx mov [ishort], ax fild [ishort] ;st0 = cmy st1 = cmx*cmx fmul st0, st0 ;cmy * cmy fadd st0, st1 ;st0 cmx^2 + cmy^2 fsqrt ;sqrt st0 fmul [real_var] mov [ishort], diamxscale ;st0 = diamxscale st1 = sqrt(dist) fild [ishort] fdiv st0, st1 fistp [ishort] fstp st0 fstp st0 fstp st0 mov ax, [ishort] mov bx, [short_var] add ax, [frame] add bx, [frame] xor ax, bx mov [es:di], al inc di dec cx jnz tunnel_xloop dec dx jnz tunnel_yloop mov ah, 01h ; check for keypress int 16h ; is a key waiting in the buffer? Jz MainLoop ;textmode mov ax, 0003h int 10h ret frame dw 0 ishort dw 0 short_var dw 0 scx dw 0 scy dw 0 fold_num dw 0 fold_off dd 0 fold_scale dd 0 real_var dd 0 A little big though, but still less than 500 bytes. :*) _________________ Hello |
|||
![]() |
|
Matrix 06 Apr 2006, 07:24
relsoft wrote: Matrix, thanks. I never noticed that. Anyways here are some other tutes I made. We all have to start somewhere ![]() , i started with pascal, c-- I tested some games on your site, there might be some faster way in the core, i have something similar to your shooter game in sphinX C--, with sources, and it goes well in real time. I was wondering too how to get an accurate timeslice, the best i could think is tsc in pentium and later processors ( rdtsc ). With Fasm, your speed problems can be solved. This does not mean you don't have to optimize. |
|||
![]() |
|
Dex4u 06 Apr 2006, 08:53
Little things make a big difference, eg: in my OS by setting MTRR to WC, i get a 70% increase in FPS.
|
|||
![]() |
|
relsoft 07 Apr 2006, 00:29
Matrix: Yeah, I know about that screensynch prob with the current build of the shooter. The old build ran at full speed on a 233 mhz cyrix. The problem started when I did some low-level hack on the Freebasic GFX lib to implement "scale2x". I guess doing a scale2x made the GFX thread miss one render per frame and called vsynch twice per frame.
So I reverted the download of the said shooter to its old version. This runs on a 233 at full speed. No scale2x though. :*) http://rel.betterwebber.com/junk.php?id=49 _________________ Hello |
|||
![]() |
|
Borsuc 18 Apr 2006, 11:48
Hey rel: is there a way to see those cool 3D tutorials you wrote offline. The problem is, I'm not very frequent online, so if there's a way, please tell me so. thanks
![]() |
|||
![]() |
|
relsoft 18 Apr 2006, 15:13
Yep. You could go here:
http://www.phatcode.net/articles.php?sub=graphics Open the tutes and save as webpage HTML complete. I could also send you the complete tute series if you send me an email so that I could send it to you via email. Just put "3d tutes" or the like in the heading. :*) _________________ Hello |
|||
![]() |
|
Borsuc 18 Apr 2006, 15:15
thanks. i'll do that
ps: my email can be seen in profile (grey_predator@yahoo.com). don't ask me how I got it's name.. it's not really a good one, but is sort-of good anti-span ![]() |
|||
![]() |
|
relsoft 20 Apr 2006, 10:43
The_Grey_Beast: My friend who hosted some of my tutes was kind enough to make the zips for you. Yahoo somehow takes eons to scan the zips so I'll post the links here:
http://www.phatcode.net/articles.php?id=212&action=download http://www.phatcode.net/articles.php?id=213&action=download http://www.phatcode.net/articles.php?id=214&action=download http://www.phatcode.net/articles.php?id=215&action=download http://www.phatcode.net/articles.php?id=216&action=download Enjoy! |
|||
![]() |
|
Goto page Previous 1, 2 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.