flat assembler
Message board for the users of flat assembler.
Index
> DOS > regression...(3 256byte demos inside) |
Author |
|
relsoft 17 Apr 2006, 11:43
Hello, I'm back and I updated my site with 3 256 byte FASM demos. Check my site up for the full story...
http://rel.betterwebber.com/ Here are the demos: Oh yeah, source included in each zip. :*) Click the images to download the demos 1. Flower256 2. Bounce256 3. Wobble256 After 2 hours of work, I was able to fit it in 256 bytes but with a palette and a displacement. Now for the nice texture.....j/k Code: ;********************************************************** ; ; FlOWER256(Updated to with displacement) ; Morphing tunnel of the overused XOR texture. :*) ; Another 256 Byte demo by ; Relsoft (Richard Eric M. Lope BSN RN) ; http://rel.betterwebber.com ; Assemble with FASM (FlatAssembler.net) ; ;********************************************************** diameter = 32 diamxscale = (64 * diameter) scx = 160 scy = 100 org 100h ;***************************************************************** ;***************************************************************** ;***************************************************************** cenx: push word 0a000h ;word pop es ;byte ceny: mov al, 13h ; mode 13h int 10h ; we are now in 320x200x256 frame: mov dx, 03c8h ;palette write register fold_off: xor al, al ;start at color 0 out dx, al ;send value inc dx ;0x3c9(write RGB values) mov cx, 256*3 ;whole 256 colors palloop: fold_scale: mov ax, 256 / 4 sub ax, cx out dx, al loop palloop main_loop: ;si = frame counter inc word [frame] ;flower ;fold_off += 0.2 fld [c_fold_off] fadd dword[fold_off] fstp dword[fold_off] ;fold_scale = 0.5 * sin(frame / 40) fld [c_fold_scale] fild word [frame] ;st0 = frame; st1 = 0.3 mov bx, bp mov word [bx], 40 fidiv word [bx] fsin fmul st0, st1 fstp dword[fold_scale] mov word[cenx], scx mov word[ceny], scy ;displacement fild word[frame] mov word[bx], 50 fidiv word[bx] fsin mov word[bx], 120 fimul word[bx] fistp word[bx] mov ax, [bx] add [cenx], ax ;===========tunnel mov dx,200 xor di, di tunnel_yloop: mov cx,320 tunnel_xloop: ;bx = word pointer ;bp = dword ptr ; ; ;atan2 fninit ;call this to ditch the st pops mov bx, bp mov ax, [ceny] mov word [bx], ax sub [bx], dx fild word [bx] ;st0 = dy mov ax, [cenx] mov word [bx], ax sub [bx], cx fild word [bx] ;st0 = dx, st1 = dy fpatan ;st0 = atan(dy/dx) = atan(st1/st0) ;flower ;xdist = xdist * ((sin(fold_off + fold_num * angle) * fold_scale)+1) fstp dword [bx] fld dword [bx] ;restore fld dword [bx] fimul [fold_num] fadd dword[fold_off] fsin fmul dword[fold_scale] mov word [bx], 1 fiadd word [bx] fstp dword [bp] ;real_var =((sin(fold_off + fold_num * angle) * fold_scale)+1) fmul [c_scale] ;atan(st0))*256/pi fistp word [bx] ;short_var = scaledpi mov gs,[bx] mov ax, [cenx] sub ax, cx ;cmx mov [bx], ax fild word [bx] ;st0 = cmx fmul st0, st0 ;cmx * cmx mov ax, [ceny] sub ax, dx mov [bx], ax fild word [bx] ;st0 = cmy st1 = cmx*cmx fmul st0, st0 ;cmy * cmy fadd st0, st1 ;st0 cmx^2 + cmy^2 fsqrt ;sqrt st0 fmul dword [bp] mov word [bx], diamxscale ;st0 = diamxscale st1 = sqrt(dist) fild word [bx] fdiv st0, st1 fistp word [bx] mov ax, word [bx] add ax, word [frame] mov bx, gs add bx, word [frame] xor ax, bx stosb dec cx jnz tunnel_xloop dec dx jnz tunnel_yloop ; mov dx,3dah ; vsync: ; in al,dx ; and al,8 ; jz vsync in al,60h dec al jnz main_loop ret fold_num dw 7 c_fold_off dd 0.2 c_fold_scale dd 0.3 c_scale dd 40.74 _________________ Hello Last edited by relsoft on 18 Apr 2006, 15:17; edited 1 time in total |
|||
17 Apr 2006, 11:43 |
|
Dex4u 17 Apr 2006, 12:00
Nice work relsoft, i will convert them to run on Dex4u OS.
|
|||
17 Apr 2006, 12:00 |
|
relsoft 17 Apr 2006, 12:06
Thanks!!!! You could use them anyway you want; *)
If not for the 256 byte limit, I could have made them better though. :*) |
|||
17 Apr 2006, 12:06 |
|
Dex4u 17 Apr 2006, 13:12
Thanks relsoft, i have converted all, but "flower256" which is coded in a way that would meant a rewrite.
eg: Code: frame: push word 0a000hishort: pop es For pmode i would need to convert alot of the program. @wyr3x, Yes they would make good screensavers or good tuts for new programmers to Dex4u OS . PS: Will post them on Dex4u's web site, in one demo zip file, with full acknowledgement to you relsoft. |
|||
17 Apr 2006, 13:12 |
|
relsoft 17 Apr 2006, 13:39
Dex4u wrote: Thanks relsoft, i have converted all, but "flower256" which is coded in a way that would meant a rewrite. Cool!! Sorry about that, I was having problems fitting the whole code in 256 bytes so I converted unused offsets to variables. you could just remove those labels and add this as variables at the end of the com file: Code: frame dw ? ishort dw ? Now I don't have any idea on how to code in flat pmode DOS but if you could point me to a tutorial I would be able to convert the codes to pmode so that they can be used as screensavers. :*) What I need in pmode is the ability to set aside a buffer. I used to work with 32 bit asm using the GNU asssembler but code it inline from a higher level language which means allocate memory to write-to using freebasic and blit using asm. Thanks n advance! _________________ Hello |
|||
17 Apr 2006, 13:39 |
|
Dex4u 17 Apr 2006, 15:35
I am like you, i do not use flat pmode Dos, 99% of my coding is done on my OS, as for tuts, i do not know of any good ones, that use dpmi.
That why i made Dex4uOS, as you learnt to code asm in dos, then went on to code pmode, but that meant moving to win32asm which was totally differant . In Dex4u, its so simple you are loaded to 0x200000 (2mb) and can use all memory from there, to top of ram, Note: Ram top, may not be top of real ram, as Dex4u can load modules to top and move ram size down by modules sizes. Also built into dex4u is a number of functions, that you can call, just like int 21h in dos. Check "CdPod" out to see what can be fited into 512bytes, http://board.flatassembler.net/topic.php?t=2164&start=60 Fully bootable, 32bit, pmode, 640x480 32bpp vesa graphics, CdPlayer and less than 512bytes. Note: I was called ASHLEY4 than . |
|||
17 Apr 2006, 15:35 |
|
relsoft 17 Apr 2006, 23:10
Wow!!! Trippy!!
Now I'm really loooking forward for dex4u. ;*) _________________ Hello |
|||
17 Apr 2006, 23:10 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.