flat assembler
Message board for the users of flat assembler.
  
|  Index
      > DOS > What do you see here? | 
| Author | 
 | 
| windwakr 06 Jul 2008, 19:09 What do you see when you run this program?
 I see a cyclops laying on its side throwing up..  ...but thats just me...(btw, most of the code minus a bit was "borrowed" out of comrades 1kb sinus cirlces thingy here.) I stumbled upon this while playing around with the source to that program and generated this odd thing. Each pixel basically is : ((sin(x)+sin(distance to center) / 2) + x) / 2 Code: org 100h ; switch to graphics mode mov al, 013h int 10h push cs pop es mov di, dist mov bx, 200 @@dsty: mov cx, 320 @@dstx: mov [x], cx mov [y], bx sub [x], 160 sub [y], 100 fild [x] fild [x] fmulp st1,st0 fild [y] fild [y] fmulp st1,st0 faddp st1,st0 fsqrt fistp [x] mov ax, [x] stosb loop @@dstx dec bx jnz short @@dsty ; initialize the palette mov cx, 256 xor ax, ax @@spal: mov dx, 3C8h out dx, al inc dx out dx, al out dx, al out dx, al inc al loop @@spal ; main loop @@main: ; wait for vertical sync mov dx, 3DAh @@vs0: in al, dx test al, 8 jz @@vs0 @@vs1: in al, dx test al, 8 jnz @@vs1 ; draw push 0A000h pop es mov bx, 200 mov si, dist xor di, di xor ax, ax mov [x],0 mov [y],0 @@y: mov cx, 320 mov [x1],0 @@x: lodsb mov [y], ax fild [y] fdiv [freq] ;fild [counter] ;fsubp st1,st0 fsin fmul [amp] fadd [amp] fistp [y] fild [x1] ;fiadd [y1] fdiv [freq] ;fild [counter] ;fsubp st1,st0 fsin fmul [amp] fadd [amp] fistp [x] mov ax, [x] add ax,[y] shr ax,1 add ax,[x1] shr ax,1 stosb inc [x1] loop @@x inc [y1] dec bx jnz @@y ;inc [counter] ; delay push cs push 040h pop ds mov ax, [ds:6Ch] @@wait: mov cx, [ds:6Ch] sub cx, ax cmp cx, 2 jl @@wait pop ds key: in al,60h dec al jnz key ;jnz @@main ; restore text mode mov ax, 003h int 10h ret ;######################################################################### freq dd 10.0 amp dd 31.0 x dw 0 y dw 0 x1 dw 0 y1 dw 0 counter dw 0 dist: ;######################################################################### also, try changing: Code: @@x: lodsb mov [y], ax fild [y] fdiv [freq] ;fild [counter] ;fsubp st1,st0 fsin fmul [amp] fadd [amp] fistp [y] fild [x1] ;fiadd [y1] fdiv [freq] ;fild [counter] ;fsubp st1,st0 fsin fmul [amp] fadd [amp] fistp [x] mov ax, [x] add ax,[y] shr ax,1 add ax,[x1] shr ax,1 stosb inc [x1] loop @@x to: Code: @@x: lodsb mov [y], ax fild [y] fdiv [freq] ;fild [counter] ;fsubp st1,st0 fsin fmul [amp] fadd [amp] fistp [y] fild [y1] ;fiadd [y1] fdiv [freq] ;fild [counter] ;fsubp st1,st0 fsin fmul [amp] fadd [amp] fistp [x] mov ax, [x] add ax,[y] shr ax,1 add ax,[y1] shr ax,1 stosb inc [x1] loop @@x Are these boards dying? I've been gone since mid june(no internet  ) and doesn't look like much has gone on since then. Wooooo......4 years as a registered user and only 50 some posts lol | |||
|  06 Jul 2008, 19:09 | 
 | 
| comrade 07 Jul 2008, 01:55 windwakr wrote: 
 What you invented there is a class of graphics demos called "plasmas"   Those used to be real popular in late 80s/early 90s in the demo-scene world. Its a rather easy effect: add a bunch of sine-waves of different periods, index into a gradient palette table. Do a phase-shift on the sine-waves for animation. Check Hornet (these days accessible at http://www.scene.org/dir.php?dir=%2Fmirrors%2Fhornet%2Fcode%2Feffects%2Fplasma/) for more demos of this sort. You will probably need a MS-DOS VM with something like Turbo C and TASM installed to play with the sources  Though I think most stuff still runs fine under NTVDM. | |||
|  07 Jul 2008, 01:55 | 
 | 
| comrade 07 Jul 2008, 01:56 If really get interested in that kinda stuff, also check http://www.pouet.net/ or ask around in #coders on IRCnet. | |||
|  07 Jul 2008, 01:56 | 
 | 
| bitRAKE 07 Jul 2008, 02:07 ZOMG - one of the aliens have revealed itself:     Code: @@x: lodsb mov [y], ax fild [y] fdiv [freq] ;fild [counter] ;fsubp st1,st0 fsin fmul [amp] fadd [amp] fistp [y] fild [y1] ;fiadd [y1] fdiv [freq] ;fild [counter] ;fsubp st1,st0 fsin fmul [amp] fadd [amp] fistp [x] add ax,[y] add ax,[x] shr ax,1 jpe .0 add ax,[y1] jmp .1 .0: xadd ax,dx .1: shr ax,1 stosb inc [x1] loop @@x  _________________ ¯\(°_o)/¯ AI may [not] have aided with the above reply. | |||
|  07 Jul 2008, 02:07 | 
 | 
| windwakr 07 Jul 2008, 02:20 Wow, the forums were hacked? Good thing everythings back to normal(or at least looks normal, I couldn't tell anything had happened)
 comrade: Thanks for the links. I'll check them out. bitRAKE:  .....WOW..... | |||
|  07 Jul 2008, 02:20 | 
 | 
| LocoDelAssembly 07 Jul 2008, 02:46 Since I can't provide any better image then I'll contribute a modification on the code    Code: @@dstx: mov [x], cx mov [y], bx sub [x], 160 sub [y], 100 fild [x] ; fild [x] fmul st0, st0 fild [y] ; fild [y] fmul st0, st0 faddp BTW, also try this: Code: @@dstx: mov [x], cx mov [y], bx sub [x], 160 sub [y], 100 fild [x] fabs fild [y] fabs faddp fistp [x] mov ax, [x] stosb loop short @@dstx | |||
|  07 Jul 2008, 02:46 | 
 | 
| windwakr 07 Jul 2008, 02:54 Ya, that diamond pattern makes it look good. | |||
|  07 Jul 2008, 02:54 | 
 | 
| < Last Thread | Next Thread > | 
| Forum Rules: 
 | 
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.