flat assembler
Message board for the users of flat assembler.
Index
> Main > code resolving magic Goto page 1, 2 Next |
Author |
|
gunblade 24 Jan 2006, 10:57
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 24 Jan 2006, 10:58
wow :O
|
|||
24 Jan 2006, 10:58 |
|
Tomasz Grysztar 24 Jan 2006, 11:00
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 25 Jan 2006, 04:31
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 09 Jul 2010, 18:47
Code: x = (y-2)*(y+1)/2-2*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+1-2)*(x+1+1)/2-2*(x+1) y = x+1 dd x,y |
|||
09 Jul 2010, 18:47 |
|
ass0 09 Jul 2010, 19:15
Are you all being sarcastic? or i am missing something. =S
Code: x = (y-2)*(y+1)/2-2*y y = x+1 dd x,y ;6,7 Code: ;but this: x = (y-2)*(y+1)/3-2*y y = x+1 dd x,y;error: value out of range. Code: ;and this: x = (y-2)*(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 09 Jul 2010, 19:25
when i try compiling all 3 samples it says "symbol 'y' out of scope"
? |
|||
09 Jul 2010, 19:25 |
|
baldr 11 Jul 2010, 04:47
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 = (y-2)*(y+1)/3-2*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 11 Jul 2010, 09:31
Cooooool! Yet is a little dangerous feature. =D
_________________ Nombre: Aquiles Castro. Location2: about:robots |
|||
11 Jul 2010, 09:31 |
|
edemko 11 Jul 2010, 11:24
baldr wrote:
all three ass0's samples in same order |
|||
11 Jul 2010, 11:24 |
|
revolution 11 Jul 2010, 11:38
edemko wrote:
|
|||
11 Jul 2010, 11:38 |
|
edemko 11 Jul 2010, 11:43
i do
Code: /* x = (y-2)*(y+1)/2-2*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+1-2)*(x+1+1)/2-2*(x+1) y = x+1 dd x,y */ ;ass0 ;Are you all being sarcastic? or i am missing something. =S ;Code: x = (y-2)*(y+1)/2-2*y y = x+1 dd x,y ;6,7 ;Code: ;but this: x = (y-2)*(y+1)/3-2*y y = x+1 dd x,y;error: value out of range. ;Code: ;and this: x = (y-2)*(y+1)/2*y y = x+1 dd x,y;error: code cannot be generated. |
|||
11 Jul 2010, 11:43 |
|
revolution 11 Jul 2010, 13:11
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 11 Jul 2010, 21:38
revolution,
Not a completely new definition of "all 3 samples", but I'm shocked. |
|||
11 Jul 2010, 21:38 |
|
edfed 12 Jul 2010, 23:13
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 13 Jul 2010, 01:45
Simple rules can give complex results.
Anyone up for a game of Go? |
|||
13 Jul 2010, 01:45 |
|
baldr 13 Jul 2010, 13:38
|
|||
13 Jul 2010, 13:38 |
|
ender 13 Jul 2010, 13:50
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 13 Jul 2010, 13:52
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 © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.