+TheBF Posted July 30, 2022 Share Posted July 30, 2022 Funny you should mention this. With my latest version of ED9980 for 80 columns I was wondering what I should had that would make use of the F18 features. Thanks for the docs! 1 Quote Link to comment https://forums.atariage.com/topic/338224-tf-camel-fb-forth-fun/page/3/#findComment-5097122 Share on other sites More sharing options...
Asmusr Posted July 30, 2022 Share Posted July 30, 2022 Note that some of the pdf is out of date, for instance the Scroll Limit Registers were removed in firmware v. 1.6 and tile layer 2 was added. 1 1 Quote Link to comment https://forums.atariage.com/topic/338224-tf-camel-fb-forth-fun/page/3/#findComment-5097128 Share on other sites More sharing options...
GDMike Posted July 30, 2022 Author Share Posted July 30, 2022 28 minutes ago, Asmusr said: Note that some of the pdf is out of date, for instance the Scroll Limit Registers were removed in firmware v. 1.6 and tile layer 2 was added. I wasn't aware at all about any changes I guess tread lightly with these docs. Maybe we should ask Matt for anything up to date. Quote Link to comment https://forums.atariage.com/topic/338224-tf-camel-fb-forth-fun/page/3/#findComment-5097140 Share on other sites More sharing options...
Asmusr Posted July 30, 2022 Share Posted July 30, 2022 (edited) 1 hour ago, GDMike said: I wasn't aware at all about any changes I guess tread lightly with these docs. Maybe we should ask Matt for anything up to date. The spreadsheet with the register use is up to date. And I think it's mainly the part of the pdf about scrolling that's out of date (the way scrolling is controlled now has actually been simplified a lot). Looking at the JS99er code may help to understand how to F18A works, although the emulation is not in any way hardware accurate but still the best we have. An easy place to start would be to change the color palette, because that doesn't require changes to the VDP table layout. Almost anything else, except smooth scrolling a single page with wrap-around, requires some changes to the VDP table layout. But first of all you need to be able to unlock the F18A. There is an almost infinite ways to do the VDP RAM layout, so either the library makes this choice for the user, which may limit the possibilities to a certain extent, or it is made up to the user, which will make it much easier to do something wrong. I think I would suggest the former, and limit the VDP layout to a few predefined options if you use the library. Multi-color sprites, for instance, require that the sprite pattern table grows to either 4K (4 colors) or 6K (8 colors), but that would be an interesting place to start. I don't know if Camel Forth uses sprite auto motion, but that should still be possible with multi-color sprites if the VDP layout can stay clear of the sprite motion table at >780. There are some interesting choices for how to define patterns for multicolor sprites. The raw way is to separate the color bits into planes (2 planes for 4 colors, 3 planes for 8 colors), but the user friendly way would perhaps be to specify one digit for each pixel. You also need to consider how users would draw those sprites, and Magellan is probably the only tool that supports the F18A directly. It's relatively easy to add more export options, in particular if I can get accurate specifications. Edited July 30, 2022 by Asmusr 1 Quote Link to comment https://forums.atariage.com/topic/338224-tf-camel-fb-forth-fun/page/3/#findComment-5097178 Share on other sites More sharing options...
+TheBF Posted July 30, 2022 Share Posted July 30, 2022 14 minutes ago, Asmusr said: The spreadsheet with the register use is up to date. And I think it's mainly the part of the pdf about scrolling that's out of date (the way scrolling is controlled now has actually been simplified a lot). Looking at the JS99er code may help to understand how to F18A works, although the emulation is not in any way hardware accurate but still the best we have. An easy place to start would be to change the color palette, because that doesn't require changes to the VDP table layout. Almost anything else, except smooth scrolling a single page with wrap-around, requires some changes to the VDP table layout. But first of all you need to be able to unlock the F18A. There is an almost infinite ways to do the VDP RAM layout, so either the library makes this choice for the user, which may limit the possibilities to a certain extent, or it is made up to the user, which will make it much easier to do something wrong. I think I would suggest the former, and limit the VDP layout to a few predefined options if you use the library. Multi-color sprites, for instance, require that the sprite pattern table grows to either 4K (4 colors) or 6K (8 colors), but that would be an interesting place to start. I don't know if Camel Forth uses sprite auto motion, but that should still be possible with multi-color sprites if the VDP layout can stay clear of the sprite motion table at >780. There are some interesting choices for how to define patterns for multicolor sprites. The raw way is to separate the color bits into planes (2 planes for 4 colors, 3 planes for 8 colors), but the user friendly way would perhaps be to specify one digit for each pixel. You also need to consider how users would draw those sprites, and Magellan is probably the only tool that supports the F18A directly. It's relatively easy to add more export options, in particular if I can get accurate specifications. Thanks for all this information. I will examine the JS99er code for sure. Camel Forth is a micro-kernel. (8K) Everything beyond Forth "core" functions is a library file. So it's up to the programmer if they want auto-motion. I read briefly about using code to unlock the F18A. I have an assembler in the system so that should be possible. You have opened up an enormous door. It will be interesting to see if I can create some language extensions that help tame F18 for me and other Camel99 Forth users. 1 1 Quote Link to comment https://forums.atariage.com/topic/338224-tf-camel-fb-forth-fun/page/3/#findComment-5097189 Share on other sites More sharing options...
GDMike Posted July 30, 2022 Author Share Posted July 30, 2022 (edited) This is awesome I think because I also haven't seen significant substance regarding f18A on real hardware for the TI other than text mode. I'll be following because I'm not talented enough to whip something up, it's in good hands I think. Edited July 30, 2022 by GDMike 2 Quote Link to comment https://forums.atariage.com/topic/338224-tf-camel-fb-forth-fun/page/3/#findComment-5097223 Share on other sites More sharing options...
+TheBF Posted October 8, 2022 Share Posted October 8, 2022 I am posting this code here because it is for Turbo Forth. It is a case insensitive string COMPARE word written only in Forth. The original code came from the toolbox of the late Neil Baud (aks Wil Baden) Demo code is at the bottom Spoiler \ case insensitive compare from Neil Baud's tools \ Turbo Forth to ANS/Camel99 Forth harness : UNLOOP R> DROP R> DROP R> DROP ; \ TF do/loop has 3 items on Rstack : BOUNDS OVER + SWAP ; : BETWEEN ( n min max -- ?) 1+ WITHIN ; \ character testers (bf versions) : LOWER? ( char -- ?) ASCII a ASCII z BETWEEN ; : UPPER? ( char -- ?) ASCII A ASCII Z BETWEEN ; \ single char converters (bf versions) : >LOWER ( c -- c ) DUP UPPER? IF BL OR THEN ; : >UPPER ( c -- c ) DUP LOWER? IF $5F AND THEN ; : COMPARE(NC) ( a1 n1 a2 n2 -- -1|0|1 ) ROT 2DUP - >R ( a1 a2 n2 n1)( R: n2-n1) MIN ( a1 a2 n3) BOUNDS 2DUP = IF 2DROP R> DROP EXIT THEN DO ( a1) COUNT >UPPER I C@ >UPPER - ( a1 diff) DUP IF NIP 0< 1 OR ( -1|1) UNLOOP R> DROP EXIT ( a1 diff) THEN DROP ( a1) LOOP DROP ( ) R> DUP IF 0> 1 OR THEN \ 2's complement arith. ; \ * TEST CODE * \ Handy word to "place" a stack string into memory : PLACE ( src n dst -- ) 2DUP C! 1+ SWAP CMOVE ; : .$ COUNT TYPE ; \ prinT COUNTED string from memory CREATE A$ 40 ALLOT CREATE B$ 40 ALLOT CREATE C$ 40 ALLOT S" THIS IS A$" A$ PLACE S" B$ is different" B$ PLACE S" This iS a$" C$ PLACE A$ .$ B$ .$ C$ .$ A$ COUNT C$ COUNT COMPARE(NC) . A$ COUNT B$ COUNT COMPARE(NC) . B$ COUNT A$ COUNT COMPARE(NC) . 2 1 Quote Link to comment https://forums.atariage.com/topic/338224-tf-camel-fb-forth-fun/page/3/#findComment-5134840 Share on other sites More sharing options...
GDMike Posted October 8, 2022 Author Share Posted October 8, 2022 Great. I'll be running this later tonight. Lately I've been playing with simulating blinking "stars" and I've got a word that blinks 1 star by cycling through 15 colors with added delay, and i'm using an ASCII character instead of a sprite just to see how it acts.. And it really turned out nice. I'm guessing that the more stars I add then the less I'll need the delay, or whatever other code that runs and as it grabs the star word might also not need the delay. Anyway, I'm probably gonna have to use sprites to really make a good star field because I don't want a repeating pattern for each star and I don't want the delay to be noticeable either..a key routine would be added and stars blinking on no key press . and the blink rate delay is also random but not too slow or to fast but definitely not the same time. I'll never use the code but I thought it might be fun as an experiment. 1 Quote Link to comment https://forums.atariage.com/topic/338224-tf-camel-fb-forth-fun/page/3/#findComment-5134851 Share on other sites More sharing options...
+TheBF Posted October 9, 2022 Share Posted October 9, 2022 @GDmike had a question about a way to use some free memory temporarily in his program. I remember that I had a library for an ultra-light version of ANS Forth's ALLOCATE and FREE. Turbo Forth reserves the entire low RAM block for program usage like Camel99 Forth so this was a simple port. This code gives the Turbo Forth programmer a way to ALLOCATE and FREE chunks of this memory with these caveats: FREE deallocates everything above it in the heap like Forth's FORGET command RESIZE will fragment the heap if used excessively There is no protection from the programmer using a deallocated pointer. Spoiler \ Minimalist ALLOCATE FREE RESIZE for Camel99 Forth B Fox Sept 3 2020 \ Static allocation, size function and crude re-sizing \ Use with VARIABLEs or VALUEs to retain the pointers \ Ported to Turbo Forth Oct 2022 \ TF keeps the LOW RAM block available like Camel99 so this ports easily \ *** ALLOCATE and FREE are non-standard. They do not return a flag. HERE \ conversion harness : OFF FALSE SWAP ! ; : ON TRUE SWAP ! ; : ALIGNED ( addr -- addr') 1+ $FFFE AND ; VARIABLE HP \ HEAP pointer : NEWHEAP $2000 HP ! ; NEWHEAP ( set HP now ) : HEAP ( -- addr) HP @ ; \ equivalent to HERE in HI memory : HALLOT ( n -- ) HP +! ; \ equivalent to ALLOT in HI memory : HALIGN ( -- ) HEAP ALIGNED HP ! ; \ heap number "compilers". Put a number in memory & advance the pointer : H, ( n -- ) HEAP ! 2 HALLOT ; : HC, ( n -- ) HEAP C! 1 HALLOT ; : ?ALLOC ( n --) HEAP OVER + $3FFF > ABORT" Allocate error" ; : ALLOCATE ( n -- addr ) ?ALLOC DUP H, HEAP SWAP HALLOT ; \ *warning* FREE removes everything above it like FORGET : FREE ( addr -- ) 2- DUP OFF HP ! ; \ *warning* RESIZE will fragment the HEAP : RESIZE ( n addr -- addr ?) DROP ALLOCATE ; : SIZE ( addr -- n) 2- @ ; \ not ANS/ISO commonly found CR HERE SWAP - DECIMAL . .( bytes) Here is a demo showing a potential usage. \ demo code: dynamically create/destroy strings : PLACE ( src n dst -- ) 2DUP C! 1+ SWAP CMOVE ; : PRINT ( $ -- ) COUNT CR TYPE ; : .HEAP ." Heap pointer=" HEAP HEX ." $". DECIMAL ; NEWHEAP .HEAP : DIM$ ALLOCATE VALUE ; 80 DIM$ A$ 80 DIM$ B$ .HEAP S" this is a Turbo Forth string" A$ PLACE S" Here is another string ..." B$ PLACE A$ PRINT B$ PRINT A$ FREE .HEAP 2 2 Quote Link to comment https://forums.atariage.com/topic/338224-tf-camel-fb-forth-fun/page/3/#findComment-5135276 Share on other sites More sharing options...
GDMike Posted October 9, 2022 Author Share Posted October 9, 2022 Well that's pretty cool Quote Link to comment https://forums.atariage.com/topic/338224-tf-camel-fb-forth-fun/page/3/#findComment-5135361 Share on other sites More sharing options...
Willsy Posted October 10, 2022 Share Posted October 10, 2022 On 10/8/2022 at 3:39 PM, TheBF said: I am posting this code here because it is for Turbo Forth. It is a case insensitive string COMPARE word written only in Forth. The original code came from the toolbox of the late Neil Baud (aks Wil Baden) Demo code is at the bottom Hide contents \ case insensitive compare from Neil Baud's tools \ Turbo Forth to ANS/Camel99 Forth harness : UNLOOP R> DROP R> DROP R> DROP ; \ TF do/loop has 3 items on Rstack : BOUNDS OVER + SWAP ; : BETWEEN ( n min max -- ?) 1+ WITHIN ; \ character testers (bf versions) : LOWER? ( char -- ?) ASCII a ASCII z BETWEEN ; : UPPER? ( char -- ?) ASCII A ASCII Z BETWEEN ; \ single char converters (bf versions) : >LOWER ( c -- c ) DUP UPPER? IF BL OR THEN ; : >UPPER ( c -- c ) DUP LOWER? IF $5F AND THEN ; : COMPARE(NC) ( a1 n1 a2 n2 -- -1|0|1 ) ROT 2DUP - >R ( a1 a2 n2 n1)( R: n2-n1) MIN ( a1 a2 n3) BOUNDS 2DUP = IF 2DROP R> DROP EXIT THEN DO ( a1) COUNT >UPPER I C@ >UPPER - ( a1 diff) DUP IF NIP 0< 1 OR ( -1|1) UNLOOP R> DROP EXIT ( a1 diff) THEN DROP ( a1) LOOP DROP ( ) R> DUP IF 0> 1 OR THEN \ 2's complement arith. ; \ * TEST CODE * \ Handy word to "place" a stack string into memory : PLACE ( src n dst -- ) 2DUP C! 1+ SWAP CMOVE ; : .$ COUNT TYPE ; \ prinT COUNTED string from memory CREATE A$ 40 ALLOT CREATE B$ 40 ALLOT CREATE C$ 40 ALLOT S" THIS IS A$" A$ PLACE S" B$ is different" B$ PLACE S" This iS a$" C$ PLACE A$ .$ B$ .$ C$ .$ A$ COUNT C$ COUNT COMPARE(NC) . A$ COUNT B$ COUNT COMPARE(NC) . B$ COUNT A$ COUNT COMPARE(NC) . Oooh! Nice! Of course, this puts me in mind of the string stack that I knocked up years back, after discussions with your good self IIRC :-) http://turboforth.net/resources/string_library.html 1 1 Quote Link to comment https://forums.atariage.com/topic/338224-tf-camel-fb-forth-fun/page/3/#findComment-5135728 Share on other sites More sharing options...
GDMike Posted October 10, 2022 Author Share Posted October 10, 2022 Got it..thx Quote Link to comment https://forums.atariage.com/topic/338224-tf-camel-fb-forth-fun/page/3/#findComment-5135730 Share on other sites More sharing options...
Willsy Posted October 10, 2022 Share Posted October 10, 2022 On 10/8/2022 at 4:09 PM, GDMike said: Great. I'll be running this later tonight. Lately I've been playing with simulating blinking "stars" and I've got a word that blinks 1 star by cycling through 15 colors with added delay, and i'm using an ASCII character instead of a sprite just to see how it acts.. And it really turned out nice. I'm guessing that the more stars I add then the less I'll need the delay, or whatever other code that runs and as it grabs the star word might also not need the delay. Anyway, I'm probably gonna have to use sprites to really make a good star field because I don't want a repeating pattern for each star and I don't want the delay to be noticeable either..a key routine would be added and stars blinking on no key press . and the blink rate delay is also random but not too slow or to fast but definitely not the same time. I'll never use the code but I thought it might be fun as an experiment. I wrote a starfield demo for TF years ago (2012). I tried running it today in the current version of TF and it doesn't work - TF has moved on since the early days. So, here's an updated version of the starfield program that I knocked together this morning, based on the old one: \ Sprite Demo for TurboForth 2022/10/10 MW : Message ( -- addr ) S" The power of Forth! " drop ; \ note: the string above should be 32 characters long : RollMsg ( -- ) Message DUP >R C@ R@ 1+ R@ 32 CMOVE R> 31 + C! ; : .Message ( -- ) RollMsg 0 0 GOTOXY Message 32 TYPE 0 23 GOTOXY Message 32 TYPE ; \ sprite character codes for small, medium, and big stars 0 CONSTANT Sml* 1 CONSTANT Med* 2 CONSTANT Big* \ joystick codes 1 CONSTANT JoyFire 2 CONSTANT JoyLeft 4 CONSTANT JoyRight 8 CONSTANT JoyDown 16 CONSTANT JoyUp \ define colours 15 CONSTANT White 0 VALUE FlipFlop : DoFlipFlop ( -- flag) FlipFlop NOT DUP TO FlipFlop ; \ set up user defined graphics for the 3 star sizes : UDG ( -- ) DATA 4 $8000 0 0 0 Sml* 256 + DCHAR ( small star ) DATA 4 $40E0 $4000 0 0 Med* 256 + DCHAR ( medium star ) DATA 4 $70F8 $F870 0 0 Big* 256 + DCHAR ( large star ) ; \ generate a random Y coordinate : RndY ( -- n ) 180 RND ; \ generate a random X coordinate : RndX ( -- n ) 256 RND ; \ set up our sprites. 10 small, 10 medium, 10 large : SetupSprites ( -- ) 10 0 DO I RndY RndX Sml* White SPRITE LOOP 10 0 DO I 10 + RndY RndX Med* White SPRITE LOOP 10 0 DO I 20 + RndY RndX Big* White SPRITE LOOP ; \ these routines set up the sprite movement list for each direction : GoLeft ( -- ) 10 0 DO I 0 -1 SPRVEC LOOP 10 0 DO I 10 + 0 -2 SPRVEC LOOP 10 0 DO I 20 + 0 -3 SPRVEC LOOP ; : GoRight ( -- ) 10 0 DO I 0 1 SPRVEC LOOP 10 0 DO I 10 + 0 2 SPRVEC LOOP 10 0 DO I 20 + 0 3 SPRVEC LOOP ; : GoUp ( -- ) 10 0 DO I -1 0 SPRVEC LOOP 10 0 DO I 10 + -2 0 SPRVEC LOOP 10 0 DO I 20 + -3 0 SPRVEC LOOP ; : GoDown ( -- ) 10 0 DO I 1 0 SPRVEC LOOP 10 0 DO I 10 + 2 0 SPRVEC LOOP 10 0 DO I 20 + 3 0 SPRVEC LOOP ; : Delay ( -- ) 100 0 DO LOOP ; : ScanJoystick ( -- n ) 0 JOYST CASE JoyUp OF GoUp 0 ENDOF JoyLeft OF GoLeft 0 ENDOF JoyRight OF GoRight 0 ENDOF JoyDown OF GoDown 0 ENDOF JoyFire OF 1 ENDOF 0 ( default case ) ENDCASE ; : Setup ( -- ) 1 GMODE 0 SCREEN 0 SSCROLL ! UDG SetupSprites GoRight ; : GO ( -- ) Setup BEGIN 0 30 SPRMOV ( move all 30 sprites ) Delay DoFlipFlop IF .Message ScanJoystick ELSE 0 THEN UNTIL ; This uses sprites. Use the joystick (or cursor keys on your PC keyboard) to change direction. Use Fire (tab on a PC keyboard) to quit. I've tried to make the code self-explanatory. You can always use the TurboForth Glossary to look up any words you're not sure of. Just use the search facility. 4 1 Quote Link to comment https://forums.atariage.com/topic/338224-tf-camel-fb-forth-fun/page/3/#findComment-5135733 Share on other sites More sharing options...
+TheBF Posted October 10, 2022 Share Posted October 10, 2022 3 hours ago, Willsy said: Oooh! Nice! Of course, this puts me in mind of the string stack that I knocked up years back, after discussions with your good self IIRC :-) http://turboforth.net/resources/string_library.html That was about 17 years ago, when we first emailed. Can you believe it? The little ALLOCATE FREE "in a shoebox", was my attempt to replicate the functionality so I could try other people's code on our little 99. I think it's actually useful spite the limitations. But truth be told I have never used it in a project. 2 1 Quote Link to comment https://forums.atariage.com/topic/338224-tf-camel-fb-forth-fun/page/3/#findComment-5135813 Share on other sites More sharing options...
+TheBF Posted October 10, 2022 Share Posted October 10, 2022 (edited) Hey Mark, I was re-looking at your full VFX style "MEGALocals" implementation. It is a truly beautiful thing. This time what caught my eye was the INSTR demonstration, without locals and then with locals. Without locals example: : instr ( chr c-addr len -- index|-1 ) 0 rot begin dup c@ 4 pick = if drop nip nip exit else 1+ swap 1+ swap then over 3 pick = until 2drop 2drop -1 ; With locals example: : instr { chr start len -- index|-1 } -1 ( assume not found) len 0 do start i + c@ chr = if drop i leave then loop ; Here is an alternative version that leverages the last 30 years of smart Forth people (not me) trying to use factoring instead of locals. This compiles on Turbo Forth. First factor: the Forth magic tool of string manipulation: : /STRING ( a u n -- a+n u-n) \ trim string ROT OVER + -ROT - ; ( should/could be a code word ) 2nd Factor: SCAN It turns out that the new flexible loop structures, which you put in TF, are great for strings where you want to test multiple conditions in a loop. : SCAN ( adr len char -- adr' len') >R \ remember char BEGIN DUP WHILE ( len<>0) OVER C@ R@ <> WHILE ( R@<>char) 1 /STRING \ advance to next char address REPEAT THEN R> DROP ; With factors in hand, here is the alternative INSTR. The hardest part was computing the correct index from the original length. : INSTR ( char addr len -- n|-1) DUP >R \ save original length ROT SCAN NIP ( -- new length ) R> \ get original length OVER 0= \ test not found IF DROP 1- EXIT \ not found. drop length , decr., get out THEN SWAP - ; \ found: newlength-length= index If you only need to know if the char is present this would do it: : POS ( char addr len -- ?) ROT SCAN NIP 0> ; Arguably not as simple as the locals version but serviceable and the factors are re-useable in other string code. Testing at the TF console. Edited October 10, 2022 by TheBF Wrong comment 3 Quote Link to comment https://forums.atariage.com/topic/338224-tf-camel-fb-forth-fun/page/3/#findComment-5135944 Share on other sites More sharing options...
+TheBF Posted October 14, 2022 Share Posted October 14, 2022 I have been watching a video by Sam Falvo on youtube. Watching a Forth master at work has been eye-opening. I realize now that most of the time mere mortals like me write Forth by writing programs in our favourite language, but we use Forth words. I have read that Chuck Moore has struggled with teaching people how he envisioned Forth to be used but I think Sam Falvo is onto to it. Here is one of his tricks that from the video that works on Camel99 Forth (needs the library file DSK1.MARKER) and with Turbo Forth unchanged. I will leave it up to @Lee Stewart to define MARKER for FbForth if he thinks this is useful. The new word is EMPTY and it lets you restore the dictionary back to specific status and recreates the "marker" so it can be done again. This automates the job of cleaning out old definitions before you re-compile your program. : EMPTY S" ---MARKER--- MARKER ---MARKER---" EVALUATE ; IMMEDIATE MARKER ---MARKER--- It's a little cryptic at first glance. We make the word EMPTY as a "text" macro. This uses a string literal and evaluate. Notice that EMPTY references the word ---MARKER--- before it is defined. That's ok because it is in a string literal. Next in the same string literal, we define a new MARKER called ---MARKER--- The string will be evaluated at run-time when EMPTY is invoked Finally, we make the initial MARKER in our code. Now with EMPTY defined and ---MARKER--- defined once, when we execute EMPTY at the top of our source code, the dictionary will collapse back to the word ---MARKER--- and a new ---MARKER--- is created in the dictionary at that same spot. 3 Quote Link to comment https://forums.atariage.com/topic/338224-tf-camel-fb-forth-fun/page/3/#findComment-5137822 Share on other sites More sharing options...
GDMike Posted October 14, 2022 Author Share Posted October 14, 2022 Oh, and I thought I'd be ok with : DELTHIS ; (Create new words....) FORGET DELTHIS 1 Quote Link to comment https://forums.atariage.com/topic/338224-tf-camel-fb-forth-fun/page/3/#findComment-5137846 Share on other sites More sharing options...
+TheBF Posted October 14, 2022 Share Posted October 14, 2022 49 minutes ago, GDMike said: Oh, and I thought I'd be ok with : DELTHIS ; (Create new words....) FORGET DELTHIS For sure. That works fine. But you have to type it every time. 1 Quote Link to comment https://forums.atariage.com/topic/338224-tf-camel-fb-forth-fun/page/3/#findComment-5137869 Share on other sites More sharing options...
GDMike Posted October 16, 2022 Author Share Posted October 16, 2022 Tonight I'm playing with File I/O 2 Quote Link to comment https://forums.atariage.com/topic/338224-tf-camel-fb-forth-fun/page/3/#findComment-5138577 Share on other sites More sharing options...
GDMike Posted October 16, 2022 Author Share Posted October 16, 2022 Geez.. could it not get any simpler than this.. OMG..I feel like a genius now, as I know what this is saying... 😂 It's so remarkable that Mark had to almost grab my hand here and show me how it's done... This is insanely direct. I better shut up..I'm talking way to Loud now. 3 Quote Link to comment https://forums.atariage.com/topic/338224-tf-camel-fb-forth-fun/page/3/#findComment-5138579 Share on other sites More sharing options...
GDMike Posted October 16, 2022 Author Share Posted October 16, 2022 (edited) BEEP needs defined or omitted CLS needs defined from PAGE GXY needs defined from GOTOXY MODE 2 video (80 columns) -- What DOES this do? Allows INPUT from the keyboard for entering a string of < than 30 characters. an <ENTER> carriage return (char 13) exits the input and finishes the operation. I am NOT wanting to SAVE the input other than to a TEMP location for COMPARING later. --------------------------------- ( SCR# 100 Get input from keyboard ) VARIABLE WRDAD HERE @ WRDAD ! VARIABLE W1 32 W1 ! VARIABLE COL 1841 COL ! : INTXT KEY W1 ! ; : LP1 1 23 GXY 30 0 DO INTXT W1 @ DUP EMIT 13 = IF LEAVE THEN LOOP ; : INOCR COL @ V@ 13 = IF 32 COL @ V! THEN ; : LP2 1870 COL @ DO INOCR COL @ 1 + COL ! LOOP ; --> ( SCR# 101 Get input from keybord cont'd. ) : REDIT 1841 WRDAD @ 30 VMBR ; : WRTIT CLS 1841 WRDAD @ 30 VMBW CR ; : INPUT CLS 62 1840 V! BEEP LP1 LP2 1841 COL ! REDIT CLS WRTIT ; Calling the word INPUT gets the string from the keyboard. The word REDIT gathers the string and pushes it to RAM. The word INOCR strip's the "CR" from the trailing edge of the string. The word WRTIT pulls the string from RAM and throws it to the bottom of the screen for viewing. Running the word INPUT a second or third time obviously changes the string. Running WRTIT will always pull the last input entered. I am planning to use the previous COMPARE routine that @BF wrote, BUT im not sure how to get my temporary input string into the "A$" string as you demonstrated. I had defined "PLACE" and tried incorporating that but I failed.. Edited October 16, 2022 by GDMike Quote Link to comment https://forums.atariage.com/topic/338224-tf-camel-fb-forth-fun/page/3/#findComment-5138723 Share on other sites More sharing options...
+Lee Stewart Posted October 16, 2022 Share Posted October 16, 2022 19 minutes ago, GDMike said: VARIABLE WRDAD HERE @ WRDAD ! HERE is not a variable—executing HERE puts the address of the current dictionary location on the stack: VARIABLE WRDAD HERE WRDAD ! ...lee 1 Quote Link to comment https://forums.atariage.com/topic/338224-tf-camel-fb-forth-fun/page/3/#findComment-5138726 Share on other sites More sharing options...
GDMike Posted October 16, 2022 Author Share Posted October 16, 2022 (edited) Right. I placed the address of here into a variable called WRDAD.. sorry, I should of mentioned this is TF. Edited October 16, 2022 by GDMike Quote Link to comment https://forums.atariage.com/topic/338224-tf-camel-fb-forth-fun/page/3/#findComment-5138731 Share on other sites More sharing options...
+Lee Stewart Posted October 16, 2022 Share Posted October 16, 2022 4 hours ago, GDMike said: Right. I placed the address of here into a variable called WRDAD.. sorry, I should of mentioned this is TF. It doesn’t matter. I was pointing out that your code is wrong. Executing HERE gets you what you want. Getting the contents of that location with @ does not. ...lee 2 Quote Link to comment https://forums.atariage.com/topic/338224-tf-camel-fb-forth-fun/page/3/#findComment-5138808 Share on other sites More sharing options...
GDMike Posted October 16, 2022 Author Share Posted October 16, 2022 (edited) What I was trying to do was store all characters to some address. So I thought I could get the next available free location from "HERE" and store the data by using @ for pulling the address. So I shouldn't use the "@" at all? when I did here . I got -19xxx something when I used @ I got 8224... so yeah, I'll pull out the "@" and try again. ty Lee Edited October 16, 2022 by GDMike Quote Link to comment https://forums.atariage.com/topic/338224-tf-camel-fb-forth-fun/page/3/#findComment-5138809 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.