flat assembler
Message board for the users of flat assembler.
Index
> Main > code resolving magic Goto page 1, 2 Next 
Author 

gunblade
Thats indeed very impressive, could save some pressious cycles in certain situations. Any idea to the limits of the complexity of the function?
Thanks, gunblade 

24 Jan 2006, 10:57 

decard
wow :O


24 Jan 2006, 10:58 

Tomasz Grysztar
There are no limits to the complexity of function, but there are other limits: mainly that iterated searching for solution will actually fail in most cases of complex arithmetic equations  fasm's code resolving was designed to deal rather with code optimization than mathematic problems. The above is just a kind of curiosity.


24 Jan 2006, 11:00 

RedGhost
i have used this for row/column pixel drawing in my hobby os in graphics mode
its alot easier than doing it in my head (i suck at math) and alot faster than letting it assemble with add, sub, div, and etc i found this out by accident, and it just made me love fasm even more! _________________ redghost.ca 

25 Jan 2006, 04:31 

edemko
Code: x = (y2)*(y+1)/22*y ;\ y = x+1 ; \ dd x,y ;/ my new signature on wasm.ru, thanks TG ;Having seen it my eyes became hugged with hands. ;Nice blast. ;Internals and thanks: x = (x+12)*(x+1+1)/22*(x+1) y = x+1 dd x,y 

09 Jul 2010, 18:47 

ass0
Are you all being sarcastic? or i am missing something. =S
Code: x = (y2)*(y+1)/22*y y = x+1 dd x,y ;6,7 Code: ;but this: x = (y2)*(y+1)/32*y y = x+1 dd x,y;error: value out of range. Code: ;and this: x = (y2)*(y+1)/2*y y = x+1 dd x,y;error: code cannot be generated. _________________ Nombre: Aquiles Castro. Location2: about:robots 

09 Jul 2010, 19:15 

edemko
when i try compiling all 3 samples it says "symbol 'y' out of scope"
? 

09 Jul 2010, 19:25 

baldr
ass0,
No wonder it gives you errors in latter two cases: it's all about the way fasm resolves dependencies. fasm doesn't try to solve system of equations: it performs multiple passes, up to 100 or whichever value you've specified in p option (or Passes value in [Compiler] section of FASMW.INI), and uses some hints from previous passes to get closer to (or farther from) the solution (one of many possible, perhaps). Let's consider simple case: Code: sqrt = (25/approx+approx)/2 approx = sqrt+1 Pass 1: approx still not defined yet, but it has predicted value of 1 (from previous pass), sqrt is set to 13; approx receives new value of 14. Pass 2: sqrt = (25/14+14)/2 = 7; approx = 8. Pass 3: sqrt = (25/8+8)/2 = 5; approx = 6. Pass 4: sqrt = (25/6+6)/2 = 5; approx = 6. Solution is stable: there were no mispredictions during this pass, so it's final. Now take a look at Code: x = (y2)*(y+1)/32*y y = x+1 Your next example exhibits another behavior: first pass finishes with (x, y) = (0, 1), second one with (1, 0), next with (0, 1) and values oscillate so on, until compiler says it's tired. Corollary: fasm can do amazing things it's not supposed to, but you must know enough of its inner workings to be sure that the result is correct/reachable. 8< edemko, Have you compiled exactly the code shown? 

11 Jul 2010, 04:47 

ass0
Cooooool! Yet is a little dangerous feature. =D
_________________ Nombre: Aquiles Castro. Location2: about:robots 

11 Jul 2010, 09:31 

edemko
baldr wrote:
all three ass0's samples in same order 

11 Jul 2010, 11:24 

revolution
edemko wrote:


11 Jul 2010, 11:38 

edemko
i do
Code: /* x = (y2)*(y+1)/22*y ;\ y = x+1 ; \ dd x,y ;/ my new signature on wasm.ru, thanks TG ;Having seen it my eyes became hugged with hands. ;Nice blast. ;Internals and thanks: x = (x+12)*(x+1+1)/22*(x+1) y = x+1 dd x,y */ ;ass0 ;Are you all being sarcastic? or i am missing something. =S ;Code: x = (y2)*(y+1)/22*y y = x+1 dd x,y ;6,7 ;Code: ;but this: x = (y2)*(y+1)/32*y y = x+1 dd x,y;error: value out of range. ;Code: ;and this: x = (y2)*(y+1)/2*y y = x+1 dd x,y;error: code cannot be generated. 

11 Jul 2010, 11:43 

revolution
You have to do each as a separate file. You can't combine all three together like that unless you change the variable names.


11 Jul 2010, 13:11 

baldr
revolution,
Not a completely new definition of "all 3 samples", but I'm shocked. 

11 Jul 2010, 21:38 

edfed
it is simply amazing how nature is...
just see it as a basic rule of a world (fasm directives resolution), and then, see how the simple rule for resolution can give complex results. exactlly as particles, two particles of same charge will repulse. then, put a lot of particles in vacumm, and lets play the nature, the sun appear, planets, humans, and computer with fasm "installed". some 256 bytes demos uses only few instructions and will give really cool effects. the rules are the engine of a game. 

12 Jul 2010, 23:13 

revolution
Simple rules can give complex results.
Anyone up for a game of Go? 

13 Jul 2010, 01:45 

baldr


13 Jul 2010, 13:38 

ender
As for Go  I'm in. I'm not very strong but... well, I may take the goban with me  anyone for a little bit of tournament?
_________________ &r 

13 Jul 2010, 13:50 

vid
ender: I never played it "in real", and I would enjoy trying it out.


13 Jul 2010, 13:52 

Goto page 1, 2 Next < Last Thread  Next Thread > 
Forum Rules:

Copyright © 19992020, Tomasz Grysztar.
Powered by rwasa.