flat assembler
Message board for the users of flat assembler.

Index > DOS > A lot of firsts...

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
Matrix



Joined: 04 Sep 2004
Posts: 1171
Location: Overflow
Matrix
relsoft wrote:
vid. thanks for the explanation. :*)

Dex. I just went to your OS's site and that's one fine project you have there. Anyways, if I say develop a game with FASM in 13h ( I already have a lot of base code for GFX routines like mode7, sprite, translucency, triangle fillers all in ASM but still not converted to FASM), http://rel.betterwebber.com/junk.php?id=22 and I use real mode, would it be hard to convet to dex4u?

I may have a little time next week as I'll be on vacation from work and I'll be offline so I might as well make something with my free time. Although I'm also developing an OpenGL game ( Image)with a friend, the computer I'll be using while on vacation can't handle the ARB extensions which means I'm stuck with non-opengl apps while on vacation. :*)


hello, you have cool tuts there Wink, but there is a misconfiguration at your server ...
you should write
"http://rel.betterwebber.com/mytutes/3dtutes/chapter3/Files/"
instead of
"http://rel.betterwebber.com/Mytutes/3dTutes/Chapter3/Files/"
case sensitivity...
Post 05 Apr 2006, 15:34
View user's profile Send private message Visit poster's website Reply with quote
Borsuc



Joined: 29 Dec 2005
Posts: 2466
Location: Bucharest, Romania
Borsuc
relsoft wrote:
Hello, I'm kinda new here and just figured out how to use FASM ( I used TASM and MASM before). I like what you have sone with this assembler. Easy to figure out and I just love the win IDE. I'm kind of an occasional asm coder though. More of like a noob. Anyways here are my firsts...
1. This is my first FASM program( I downloaded FASM like 2 hours ago)
2. This is my first <256 proggie
3. And lastly, this is my first post.

Awesome Cool man Very Happy

I still can't believe it fits on 245 bytes. I guess I'll have to appreciate more that such small memory can store so much data if well-written (i.e not wasting it). I'll surely have to send this to a friend who surely believes such a program requires a texture, etc... probably around 100KB.

Great work though, keep it up, and good luck with that other game Wink
Post 05 Apr 2006, 18:30
View user's profile Send private message Reply with quote
relsoft



Joined: 03 Apr 2006
Posts: 29
relsoft
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
Post 06 Apr 2006, 00:46
View user's profile Send private message Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1171
Location: Overflow
Matrix
relsoft wrote:
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. :*)



We all have to start somewhere Wink
, 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.
Post 06 Apr 2006, 07:24
View user's profile Send private message Visit poster's website Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
Little things make a big difference, eg: in my OS by setting MTRR to WC, i get a 70% increase in FPS.
Post 06 Apr 2006, 08:53
View user's profile Send private message Reply with quote
relsoft



Joined: 03 Apr 2006
Posts: 29
relsoft
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
Post 07 Apr 2006, 00:29
View user's profile Send private message Reply with quote
Borsuc



Joined: 29 Dec 2005
Posts: 2466
Location: Bucharest, Romania
Borsuc
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 Very Happy
Post 18 Apr 2006, 11:48
View user's profile Send private message Reply with quote
relsoft



Joined: 03 Apr 2006
Posts: 29
relsoft
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
Post 18 Apr 2006, 15:13
View user's profile Send private message Reply with quote
Borsuc



Joined: 29 Dec 2005
Posts: 2466
Location: Bucharest, Romania
Borsuc
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 Smile
Post 18 Apr 2006, 15:15
View user's profile Send private message Reply with quote
relsoft



Joined: 03 Apr 2006
Posts: 29
relsoft
Post 20 Apr 2006, 10:43
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2

< 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. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.