![]() |
|
#1
|
|||
|
|||
|
I am trying to input a text string which will be converted by CONVERT or NUMBER or FNUMBER later. I am not having much luck. Here is are the tests that I have done and the results.
\ Here is a way to input a counted string that works: : GET_COUNTED$ ( -- a ) PAD 1+ 20 EXPECT SPAN @ PAD C! PAD ; : TEST_GET_COUNTED$ ( a -- ) CR CR ." Enter a string: " [COMPILE] GET_COUNTED$ CR CR ." Here is your string: " COUNT TYPE CR ; TEST_GET_COUNTED$ \ Here is the result: \ Enter a string: This is a string. \ Here is your string: This is a string. \ OK FORGET TEST_GET_COUNTED$ FORGET GET_COUNTED$ : GET_COUNTED$ ( -- a ) 1 WORD ; : TEST_GET_COUNTED$ ( a -- ) CR CR ." Enter a string: " [COMPILE] GET_COUNTED$ CR CR ." Here is your string: " COUNT TYPE CR ; TEST_GET_COUNTED$ \ Here is the result: \ Enter a string: \ Here is your string: \ OK \ Note: WORD did not try to enter a string. It seems to have just entered \ a null string and run with \ it. I thought perhaps WORD is IMMEDIATE so I tried this: FORGET TEST_GET_COUNTED$ FORGET GET_COUNTED$ : GET_COUNTED$ ( -- a ) 1 [COMPILE] WORD ; : TEST_GET_COUNTED$ ( a -- ) CR CR ." Enter a string: " [COMPILE] GET_COUNTED$ CR CR ." Here is your string: " COUNT TYPE CR ; TEST_GET_COUNTED$ \ Here is the result: \ Enter a string: \ Here is your string: \ OK \ Note: [COMILE] did not change anything that I can tell. \ UNCLE! I give up! How do I make this work? BTW: If you try to send a comment line to the IsoPod via NMITerm by loading or pasting something like: \ test you will get a error boxes that says: NMITerm Run-time error '-2147417848 (80010108)': Automation error The object invoked has disconnected from its clients. followed by: Program Error NMITerm.exe has generated errors and will be closed by Windows. You will need to restart the program. An error log is being created. I would not care too much except that when trying to learn a new system I like to create an executeable test file like this one to document what I have tried. Not being able to load comment likes complecates my procedures. What am I doing wrong? Don |
|
#2
|
|||
|
|||
|
NMITerm V0.9.74 bug "\"
Somehow NMITerm did not recognize the comment character, "\" if it is the first character to be downloaded or pasted. To work around this problem makesure you replace "\" with "(" until the next version 0.9.75 releases.
|
|
#3
|
|||
|
|||
|
A bit confused about the use of [COMPILE]. Why? The word following, GET_COUNTED$, isn't immediate. I don't suppose [COMPILE] causes a problem, but it seems odd.
Look at this similar section of code, following the second example. I added .S's to it to help find out what was going on. COLD IsoMax V0.5 : GET_COUNTED$ ( -- a ) .S 1 WORD .S ; OK : TEST_GET_COUNTED$ ( a -- ) CR CR ." Enter a string: " [COMPILE] GET_COUNTED$ CR CR ." Here is your string: " COUNT TYPE CR ; OK TEST_GET_COUNTED$ Enter a string: EMPTY 1463 Here is your string: OK PAD . 1420 OK HERE . 1463 OK TEST_GET_COUNTED$ Enter a string: EMPTY 1463 Here is your string: So I got about the same results. I did note that WORD works with HERE as opposed to PAD, and the number printed by .S confirms this. I think what may be missed here, is the string WORD will be looking for is in TIB, and the way the second example runs, TIB is empy after TEST_GET_COUNTED$. So the program is working correctly. Look what happens if I out the string after the invocation of TEST_GET_COUNTED$ as follows. TEST_GET_COUNTED$ HERE IS YOUR STRING Enter a string: EMPTY 1463 Here is your string: HERE IS YOUR STRING I hope this gives you the clue you need to understand WORD. |
|
#4
|
|||
|
|||
|
Here is a code that takes the following string from TIB with WORD and some examples of the string going to the data stack, or the floating point stack. DPL holds the key to knowing where the data went.
: GET_COUNTED$ ( -- a ) 1 WORD ; : TEST_GET_COUNTED$ ( a -- ) GET_COUNTED$ CR ." Here is your string: " DUP COUNT TYPE CR FNUMBER CR ." Data stack " .S CR ." F.P. stack " F.S CR ." DPL " DPL ? CR CR CR ; TEST_GET_COUNTED$ 1234578 . D. TEST_GET_COUNTED$ 1234578. . D. TEST_GET_COUNTED$ 123457.8 . D. TEST_GET_COUNTED$ 12345.78 . D. TEST_GET_COUNTED$ 1234.578 . D. TEST_GET_COUNTED$ 1234578E0 . F. TEST_GET_COUNTED$ 1234578E-3 . F. gives results : GET_COUNTED$ ( -- a ) 1 WORD ; OK : TEST_GET_COUNTED$ ( a -- ) GET_COUNTED$ CR ." Here is your string: " DUP COUNT TYPE CR FNUMBER CR ." Data stack " .S CR ." F.P. stack " F.S CR ." DPL " DPL ? CR CR CR ; OK TEST_GET_COUNTED$ 1234578 Here is your string: 1234578 Data stack 1471 18 -10606 F.P. stack > 0 DPL -1 OK . D. 1471 1234578 OK OK TEST_GET_COUNTED$ 1234578. Here is your string: 1234578. Data stack 1472 18 -10606 F.P. stack > 0 DPL 0 OK . D. 1472 1234578 OK OK TEST_GET_COUNTED$ 123457.8 Here is your string: 123457.8 Data stack 1472 18 -10606 F.P. stack > 0 DPL 1 OK . D. 1472 1234578 OK OK TEST_GET_COUNTED$ 12345.78 Here is your string: 12345.78 Data stack 1472 18 -10606 F.P. stack > 0 DPL 2 OK . D. 1472 1234578 OK OK TEST_GET_COUNTED$ 1234.578 Here is your string: 1234.578 Data stack 1472 18 -10606 F.P. stack > 0 DPL 3 OK . D. 1472 1234578 OK OK TEST_GET_COUNTED$ 1234578E0 Here is your string: 1234578E0 Data stack 1473 F.P. stack 1234578.0000 > 1 DPL -2 OK . F. 1473 1234578.0000 OK OK TEST_GET_COUNTED$ 1234578E-3 Here is your string: 1234578E-3 Data stack 1474 F.P. stack 1234.5780 > 1 DPL -2 OK . F. 1474 1234.5780 OK |
|
#5
|
|||
|
|||
|
Download NMITerm V0.9.75
Don,
Here is the update version NMITerm V0.9.75 http://www.newmicros.com/download/NMITerm.zip Fixed the "\" bug Added Uninstall NMITerm feature Increased Buffer size for input |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|