From: Hannu V. <vu...@ms...> - 2011-04-10 02:48:45
|
>>> Common constructs are: >>> : main ( -- ) begin ... key? until ; \ test for any key >>> : main ( -- ) begin ." ." 1000 ms key? dup if drop key $03 = then >>> until ; \ test ctrl-c >> >> OK. Now I don't understand. ." is for printing like ." Hello >> world!" If I've understood correct. What does two ." ." in row? > > You are right, the phrase ." xyz" in a definition outputs the string > "xyz" to Terminal. The second " right after z is the delimmiter of > the string definition. So if want a string of 5 stars I code ." > *****" and if I want 3 dots I do ." ..." and if I want one dot only > it is ." ." you see. You may use hex 2E emit as well. Damn. You got me off guard. ofcourse it works like that. Those were such false friends so that I didn't saw the obvious. >> wait a second check for input duplicate TOS (Why? does IF consume >> one?) and if is true drop TOS, retrive the character and read from >> memory address 03 ? Shouldn't that be just 03 when equality is >> tested and passed to until after then word. So My current >> understanding says that the duplicated key? is consumed only during >> until? > > Yes, UNTIL consumes a flag. IF consumes a flag too. So you need two > of them. If a key has been entered, check if it is ctrl-c ($03). This > check gives the flag for UNTIL, so we better drop the underlying true > flag. If there was no key we have a false flag, IF consumes the > duplicated key? flag, an the false flag is passed on to UNTIL, so we > get another run in the loop. OK. Does amforth's words page have then error in if ( -- addr ) ? shouldn't that be ( f -- addr) Also until ( addr -- ) looks wrong. (f -- ) as it is making boolean decission. <Good info only deleted from reply, not lost> > > Success! Fail: ATmega88 memory use summary [bytes]: Segment Begin End Code Data Used Size Use% --------------------------------------------------------------- [.cseg] 0x000000 0x001f96 1730 7696 9426 8192 115.1% [.dseg] 0x000100 0x000100 0 0 0 1024 0.0% [.eseg] 0x000000 0x000040 0 64 64 512 12.5% Assembly complete, 0 errors. 0 warnings I need to wait for my new dev-board with ATMega 128 and get 328 for the dimmer. I started trying copying template and commenting out everything from appl_dict and starting to add themback so it compiled without errors. 13+% optimization is required to run amforth with 8k devices. Now it's time to sleep. Hannu |