Jump to content
IGNORED

TF, camel, FB Forth fun


GDMike

Recommended Posts

Working with some TurboForth ideas.

So I decided to play around with making splash screen to start off with and I can throw in little things like, sound, SAMs support and assembler and it just loads up and ready for me.

Today I'm experimenting with my version of an include file. Where I can just call a WORD and that word, in this case, would set active a blocks file and display a listing of available routines for that file. I've tried making a FORGET routine to dump a routine, but TF doesn't seem to like that sometimes... and since I'm on real hardware tonight, that can make things take Ionger if things go south.

But, I'm having fun getting back into the forth feeling.

I'm having second thoughts on the naming of the blocks disk I'll use though, instead of calling them INDEX1,2 etc...I'll just stick to block 1,2 etc 

So my call looks like "CALL BLOCK1"

 

IMG_20220717_212247537.jpg

IMG_20220717_212338204_HDR.jpg

Edited by GDMike
Too isolating of a title
  • Like 3
Link to comment
Share on other sites

Thx. Will be checking on each of the previous comments.

My use of  "CALL" is just cosmetic, Ill have to look again and see what I did when I get back to the computer.

On another note, I was successful at keeping the screen active with,

: TS 1 $83D4  ! ; And dropping that into my TI splash routine. 

I'll read up on what you guys pointed out. Thx

Link to comment
Share on other sites

44 minutes ago, TheBF said:

What does CALL do? All Forth words "call" themselves. ;)

 

Have you seen the word THRU  that lets you load a range of contiguous blocks?


 1 30 THRU 

 

Yeah - it's included in TF. I just checked its definition as I was worried it may have been somewhat nieve (thought it might be nesting, leading to a potential return stack overflow - but it isn't). I think it's okay, it's defined as:

 

: THRU ( start-block end-block -- ) 1+ SWAP DO I LOAD LOOP ;

See https://github.com/Mark-Wills/TurboForth/blob/main/bank0/0-18-Blocks.asm

Edited by Willsy
  • Like 3
Link to comment
Share on other sites

2 hours ago, GDMike said:

: TS 1 $83D4  ! ; And dropping that into my TI splash routine. 

 

The Screen Timeout Timer is at $83D6, so

: TS 1 $83D6 ! ;

And, $83D6 gets reset to 0 (i.e., even) every pass through KSCAN that detects a key-press.

 

...lee

Edited by Lee Stewart
CORRECTION
Link to comment
Share on other sites

57 minutes ago, Lee Stewart said:

 

The Screen Timeout Timer is at $83D6, so


: TS 1 $83D6 ! ;

And, $83D6 gets reset to 0 (i.e., even) every pass through KSCAN.

 

...lee

I forget this one too. 

 

So he should modify KEY as the next line in the BLOCK if he wants to keep the screen on all the time.  ?

: KEY    KEY  1 $8ED6 !  ; 

 

  • Like 2
Link to comment
Share on other sites

7 minutes ago, TheBF said:

I forget this one too. 

 

So he should modify KEY as the next line in the BLOCK if he wants to keep the screen on all the time.  ?


: KEY    KEY  1 $8ED6 !  ; 

 

 

Note my correction that $83D6 is reset only when KSCAN detects a key-press.

 

To my knowledge, KEY and KEY? are the only TurboForth words that call the console ROM’s KSCAN, so you might want to do something after KEY? as well, but, if you did it for every call of KEY? , it would slow a loop with KEY? in it (important in gaming).

 

...lee

  • Like 3
Link to comment
Share on other sites

1 hour ago, Lee Stewart said:

 

To my knowledge, KEY and KEY? are the only TurboForth words that call the console ROM’s KSCAN, so you might want to do something after KEY? as well, but, if you did it for every call of KEY? , it would slow a loop with KEY? in it (important in gaming).

 

...lee

AFAIR, yes.

 

Agree. In a game or something, it would be better to write to the screen timeout counter periodically in some other routine away from the main loop.

The word JOYST in TF also sets >83d6, so if you're using joysticks it already taken care of. It actually writes the value 36, which appears to be the base CRU address for the joysticks.

 

https://github.com/Mark-Wills/TurboForth/blob/main/bank1/1-02-Console.asm

 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

3 hours ago, Lee Stewart said:

 

The Screen Timeout Timer is at $83D6, so


: TS 1 $83D6 ! ;

And, $83D6 gets reset to 0 (i.e., even) every pass through KSCAN that detects a key-press.

 

...lee

Correction, I made an error..it's >83D6 . I was relying on my memory again this morning when I wrote that . See, never trust my cranial ram.

Link to comment
Share on other sites

17 minutes ago, GDMike said:

I had made the word "CALL" with this..

: CALL DECIMAL ;

A better version would be:

 

: CALL ( -- ) ; IMMEDIATE

 

This will take up precisely 0 bytes (and therefore 0 time) when you use it in your own words.

 

Boot up TF from the normal disks, and load block 27 from the UTILS disk (the SEE decompiler).

 

Then try this:

 

: CALL ( -- ) ; IMMEDIATE;

: TEST CALL 1 2 + ;

SEE TEST

image.png.0fc4feb084c038279596b20bba2c7db0.png

 

As you can see, the word TEST has no reference to CALL at all. CALL is just syntactic sugar.

  • Like 2
Link to comment
Share on other sites

On 7/18/2022 at 3:24 PM, Willsy said:

A better version would be:

 

: CALL ( -- ) ; IMMEDIATE

 

This will take up precisely 0 bytes (and therefore 0 time) when you use it in your own words.

 

Boot up TF from the normal disks, and load block 27 from the UTILS disk (the SEE decompiler).

 

Then try this:

 

: CALL ( -- ) ; IMMEDIATE;

: TEST CALL 1 2 + ;

SEE TEST

image.png.0fc4feb084c038279596b20bba2c7db0.png

 

As you can see, the word TEST has no reference to CALL at all. CALL is just syntactic sugar.

Got it. But I'm just now seeing what IMMEDIATE does...so sorry for being slow... but better now than never ever.

Link to comment
Share on other sites

Well I'm sorry..there's a few things I've gotta get.

But...btw, im working with real iron most of the time, except weekends, and I noticed the little fan on my tipi/ raspberry quit working, I actually had another very similar, removed, cleaned up the dirt buildup, hot glued the loose tipi communication wiring, put everything together and I'm back in biz.. with my essentials forth boot disk.

Now where were we...oh..yeah, I know IMMEDIATE now, yup.. got it down.IMG_20220719_182151120_HDR.thumb.jpg.bdd6ee3ec79fadc8ef6441a80c09e347.jpg

 

Edited by GDMike
Link to comment
Share on other sites

Yes the content was all correct and it helped explain how immediate words act inside a definition so that was all excellent. 

The use of immediate words to do something useful takes a while for us mere mortals to get our heads around but once grokked they are pretty powerful. 

  • Like 2
Link to comment
Share on other sites

46 minutes ago, GDMike said:

Made a couple words. 

: STOPSC 1 $83D6 ! ."Screensaver is off " ;

: STARTSC 50 $83D6 ! ." Screensaver is on" ;

Well see how it acts..

Remember Lee reminded us that 83D6 is reset to 0 after every KSCAN.  So as soon as your press enter or any key your words are done working.

 

You can see it at the console 

HEX

: ?    @ . ; 

83D6 ?

 

Hit enter and it's zero.  :(

 

 

  • Like 1
Link to comment
Share on other sites

Right. Yup I know. this reserves the original "RESET" feeling of the console, for what I'm doing, because it's a word that I can call when needed and reset back to defaults as a key press occurs.

But my SD card in tipi just died.

I've got to order two highspeed cards because the one I was using is "super" slow. This lost it's partition and I can't find any software that can build it. Putting it into a phone doesn't do the trick either. Windows disk manager can't do it as well. I've been successful in the past but not this time.

It's toast. 

 

Edited by GDMike
  • Like 1
Link to comment
Share on other sites

6 hours ago, Willsy said:

Mike,

 

For a TF tutorial on IMMEDIATE words, have a look at this article. Once you understand it you've got immediate words down. Try the examples. Type them in and see what they do! Ask if you get stuck :thumbsup:

 

 

Ok. Will do, I'll run on classic 99, my tipi and real hw  is broke at the moment. I'll run it over the weekend, when I normally do classic 99 at work.

Thx

  • Like 1
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...