Jump to content
IGNORED

Forth Tutorials


matthew180

Recommended Posts

=) I'm definitely excited about v1.2. I am having fun with 1.1, but when 1.2 comes out, I'll be getting a cartridge for sure. And (forgive my ignorance) what is the ETA on his book?

 

I don't think he's said anything except that he needs to get back to it. Maybe that's one of the reasons he's been laying low. He'll no doubt jump in soon to disabuse us of our speculation!

 

...lee

Link to comment
Share on other sites

heh.... Maybe if I start making crazy assumptions and speculations about TF he'll get on and set me straight...

 

 

**here goes**

 

"I've figured out that TurboForth is EXACTLY THE SAME AS TI FORTH.... IT'S A DIRECT LINE FOR LINE PORT OF TI FORTH AND THERE IS NO ORIGINAL CODE IN THE SOURCE AT ALL... THIS IS A STRAIGHT COPY OF TI FORTH, GUYS.... "

 

 

***Let him come.......

Link to comment
Share on other sites

heh.... Maybe if I start making crazy assumptions and speculations about TF he'll get on and set me straight...

 

 

**here goes**

 

"I've figured out that TurboForth is EXACTLY THE SAME AS TI FORTH.... IT'S A DIRECT LINE FOR LINE PORT OF TI FORTH AND THERE IS NO ORIGINAL CODE IN THE SOURCE AT ALL... THIS IS A STRAIGHT COPY OF TI FORTH, GUYS.... "

 

 

***Let him come.......

 

Uh oh! Now you've done it! |:)

 

...lee

Link to comment
Share on other sites

heh.... Maybe if I start making crazy assumptions and speculations about TF he'll get on and set me straight...

 

 

**here goes**

 

"I've figured out that TurboForth is EXACTLY THE SAME AS TI FORTH.... IT'S A DIRECT LINE FOR LINE PORT OF TI FORTH AND THERE IS NO ORIGINAL CODE IN THE SOURCE AT ALL... THIS IS A STRAIGHT COPY OF TI FORTH, GUYS.... "

 

 

***Let him come.......

 

Hmm... Looks like they're onto me, Lee! Darn it!

Link to comment
Share on other sites

I've not done much TFV1.2 work lately. The current build I have is very stable, and has vocabularies partly implemented. I'll try and get back to it next week. I've kind of been sidelined on another Forth project, which has required me to write a PC based assembler. I had a good long think about which language I'd use for the assembler, and decided I'd use Java, since I haven't done Java in a while, and didn't get that deep into it. So I've been Java'ing just lately and need to get back into Forth mode.

 

I've also been listening to a lot of Mark Knopfler, Chris Rea, Vince Gill, and James Taylor :D

 

Regarding vocabulary support, it looks like I'll only have ROM space to implement the mechanics of the vocabularies (IIRC I've already updated FIND) but I won't have space to implement words like VOCABULARY and DEFINITIONS etc (unless I chop something out, which I haven't ruled out yet - I'm thinking about removing some of the block buffer words, which aren't normally provided in Forth anyway...)

Link to comment
Share on other sites

...

Regarding vocabulary support, it looks like I'll only have ROM space to implement the mechanics of the vocabularies (IIRC I've already updated FIND) but I won't have space to implement words like VOCABULARY and DEFINITIONS etc (unless I chop something out, which I haven't ruled out yet - I'm thinking about removing some of the block buffer words, which aren't normally provided in Forth anyway...)

 

H-m-m-m...Does this mean we might need to go back to using console routines for the floating point library to free up space in low-mem CPU RAM?

 

...lee

Link to comment
Share on other sites

Quick question...

 

Why would this freeze up TF

 

2 SCREEN

 

Well, let me show you the whole block...

 

lemprob_zpsdf185ac7.png

 

When I type "SCRDSP" in immediate mode the screen turns green (which is good) and then does NOTHING else. It doesn't show the :ok or revert back to the standard purple screen... The thing just freezes and cannot be broken out of... Have to reset.

 

Before I added the "2 SCREEN" in there, it worked fine.

 

If you just type in "2 SCREEN" in immediate mode with no block loaded, it does the same thing.

 

I'm sure this is just my ignorance... but am I making a mistake with how I am ordering the words or placing values on the stack? As I said, take the 2 SCREEN out and it works fine.

 

Any info you could offer would be greatly appreciated... I'm a complete novice in this language, so be gentle when you tell me how much of a jackass I am. =)

Edited by Opry99er
Link to comment
Share on other sites

What I'm trying to do is port Lemonade Stand to two different languages.... TurboForth and AceForth. The pre-defined words are a little different and the conventions are a bit different, but it's still Forth. The source for both is as follows. (Since AceForth is monochromatic, there are no color calls)

 

 



****ACEFORTH****






: space 32 emit ;


: spaces 0 do space loop ;


: tab 10 spaces ;


: scrdsp

 cls

 tab
 ." LEMONADE STAND "

   cr tab

 ." BY: OWEN BRAND "


   cr

;







****TURBOFORTH****

: SPACE 32 EMIT ;

: SPACES 0 DO SPACE LOOP ;

: TAB 10 SPACES ;

: SCRDSP
2 SCREEN
PAGE TAB
." LEMONADE STAND "
CR TAB
." BY OWEN BRAND "
CR
;


 

 

 

I really want to try this project. =) It'll be a slow process, but rewarding, I believe. =)

Edited by Opry99er
Link to comment
Share on other sites

Lee, Mark?

 

Your program did not freeze up. You just couldn't see what was going on! The problem is that SCREEN in text mode in both TF and TIF expects not just the background screen color but also the foreground color. When you execute 2 SCREEN , you are setting the foreground color to transparent! The easiest way to set both is to use a hex byte with the first nybble set to the foreground color and the second nybble to the background color. For TF, $12 SCREEN will set the colors to black on medium green.

 

...lee

Link to comment
Share on other sites

so this is what I was going off of with the "2 SCREEN" Shouldn't it read "fgcolor,bgcolor--" or am I reading it wrong?

 

Yes, it should. I actually changed that in my edition of the TI Forth Instruction Manual because it basically had the same misleading information. I hadn't realized the TurboForth Language Reference had it the same way because I had never used the command in TF. As soon as I read of your difficulty with it, I remembered having exactly the same problem with TIF almost 30 years ago!

 

...lee

Link to comment
Share on other sites

Doing the port for both forth dialects at the same time will be a fun challenge. I like both systems and both communities... The Ace group is far less active than we are, but that console is so cool!! A bare console running forth as it's native language... That's just epic. :)

Link to comment
Share on other sites

Regarding the SCREEN word, I should add that the reason it is so cryptic is that changing the screen color (background) is all that happens in graphics modes, whereas both background and foreground colors are changed in text mode---all this by writing a single byte to VDP write-only register 7. I suppose the word could have been written, as Owen implied, by requiring it to actually expect two values on the stack, which then would get processed by SCREEN to compose the single byte for VDP write-only register 7 by shifting the foreground value left 4 bits and adding the result to the background value before doing the register write. It would be sacrificing simplicity for the sake of clarity; however, that clarity does not seem so secure when considering that the foreground value is superfluous in the graphics modes...I'm torn. :?

 

...lee

Link to comment
Share on other sites

H-m-m-m...Does this mean we might need to go back to using console routines for the floating point library to free up space in low-mem CPU RAM?

 

...lee

 

No. I anticpate no further changes will be necessary to FP package. I wouldn't be able to show my face around here if I asked you to change it again! :woozy:

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...