V-FORTH - Forth-83 for the VIC
Moderator: Moderators
-
- Vic 20 Hobbyist
- Posts: 146
- Joined: Sun Feb 28, 2016 9:59 pm
- Location: CA USA
Re: V-FORTH - Forth-83 for the VIC
You just made my year..s...!
Mystery solved, and I can use my good old commodore 16k cart! 8k is plenty for me...and for forth.
So what do some of those sys-xxxx commands do then. Some are self evident, but that one, sys-writeb, what is that, and why did it make text invisible? What if I mistake other words? Any chance you could whip up a short manual to help out us newbs to V-FORTH? Because this is now going to be my main language on the vic by far, short of load/run basic games. namely because it is fast, and extremely concise...and now I can use it lol.
[edit while I was asking, you had already answered my next questions... ]
Mystery solved, and I can use my good old commodore 16k cart! 8k is plenty for me...and for forth.
So what do some of those sys-xxxx commands do then. Some are self evident, but that one, sys-writeb, what is that, and why did it make text invisible? What if I mistake other words? Any chance you could whip up a short manual to help out us newbs to V-FORTH? Because this is now going to be my main language on the vic by far, short of load/run basic games. namely because it is fast, and extremely concise...and now I can use it lol.
[edit while I was asking, you had already answered my next questions... ]
- Mike
- Herr VC
- Posts: 4888
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
Re: V-FORTH - Forth-83 for the VIC
TAP != T64Forbidden64 wrote:Yes, Vice doesn't support writing .TAP files. At least according to their instruction manual, and what I have found in practice:
section 5.5 of VICE manual paragraph 4:
Supported formats are D64 and X64 for disk images (devices 8, 9 and 10) and T64 for tape images. Notice that T64 support is read-only, and that the cassette is automatically rewound when you reach its end.
-
- Vic 20 Hobbyist
- Posts: 146
- Joined: Sun Feb 28, 2016 9:59 pm
- Location: CA USA
Re: V-FORTH - Forth-83 for the VIC
Ill call the output of that statement -1
There is an easy way to test this...Ill just write a program, and attempt to record it. *types 'basic' on his forth computer *
Well holy crap! I love it when I'm wrong! Datasette functions work perfectly for recording .TAPs! Well, that is probably the first and last time that reading the manual actually did more harm than good.
There is an easy way to test this...Ill just write a program, and attempt to record it. *types 'basic' on his forth computer *
Well holy crap! I love it when I'm wrong! Datasette functions work perfectly for recording .TAPs! Well, that is probably the first and last time that reading the manual actually did more harm than good.
-
- Vic 20 Hobbyist
- Posts: 146
- Joined: Sun Feb 28, 2016 9:59 pm
- Location: CA USA
Re: V-FORTH - Forth-83 for the VIC
Srowe, the documentation for V-FORTH, quite the contrary to VICE, is sublime! I am now figuring out how to make a TSAVE word hehe. I'll finish that when I wake up.
Re: V-FORTH - Forth-83 for the VIC
I've added quite a few more examples recently, I think they help explain as much as a document. I don't think I've made a build of the latest version public, I'll try and do that tomorrow.Forbidden64 wrote:Any chance you could whip up a short manual to help out us newbs to V-FORTH?
-
- Vic 20 Hobbyist
- Posts: 146
- Joined: Sun Feb 28, 2016 9:59 pm
- Location: CA USA
Re: V-FORTH - Forth-83 for the VIC
: csave ( sa da lfn addr count -- ) sys-setnam 2dup sys-setlfs 1 sys-open 1 sys-close ;
It did something to the tape that resembles saving lol...I'm really not sure how to "view" anything in this editor though.
Here is a question:
When I write some words, where are they? and how would I even know short of a freezer/monitor how much space it took up? Is there a tracker or byte marker in there somewhere at the end like basic? perhaps a vector in memory somewhere?
It did something to the tape that resembles saving lol...I'm really not sure how to "view" anything in this editor though.
Here is a question:
When I write some words, where are they? and how would I even know short of a freezer/monitor how much space it took up? Is there a tracker or byte marker in there somewhere at the end like basic? perhaps a vector in memory somewhere?
-
- Vic 20 Hobbyist
- Posts: 146
- Joined: Sun Feb 28, 2016 9:59 pm
- Location: CA USA
Re: V-FORTH - Forth-83 for the VIC
I guess a better way to phrase that question, is how do I delineate between the base words and additional words? It would be convenient to have both. For example, if I wanted to be able to load the base library of words, and then switch between applications, or load in small groups of words that I like to use and merge them on top, but not exclusively all or nothing. This would be useful for merging commonly used words for things like graphics and sound, or even RS232 support which could be added in as a small group of words. I noticed you recently made a wedge patch for rs232 on Bobbi's project for instance, but I might not need that in every single program, as it would waste memory in a game for instance.
Conversely, for distributed software, combining the entire thing and saving the whole thing might be beneficial, as you can make a application for other users which already has forth in the save file, and eliminates a secondary loading procedure. Thing is, even if the editor is just cut and paste, saving the code onto a storage media device is still crucial for a real machine to run it.
I tried to run this with the 16k expansion in VICE, and I cut and pasted some stuff in there. It got stuck in an infinite loop, and never comes back. It only happens after you press the return key, and I placed in the same word from the previous post. I did try typing in direct commands, and that worked. I then tried defining another word,
same thing it died :<
Conversely, for distributed software, combining the entire thing and saving the whole thing might be beneficial, as you can make a application for other users which already has forth in the save file, and eliminates a secondary loading procedure. Thing is, even if the editor is just cut and paste, saving the code onto a storage media device is still crucial for a real machine to run it.
I tried to run this with the 16k expansion in VICE, and I cut and pasted some stuff in there. It got stuck in an infinite loop, and never comes back. It only happens after you press the return key, and I placed in the same word from the previous post. I did try typing in direct commands, and that worked. I then tried defining another word,
Code: Select all
: ad 4 4 + cr ;
Re: V-FORTH - Forth-83 for the VIC
They're compiled into the dictionary. There isn't a standard word but the remaining space in the dictionary can be printed withForbidden64 wrote: Here is a question:
When I write some words, where are they? and how would I even know short of a freezer/monitor how much space it took up? Is there a tracker or byte marker in there somewhere at the end like basic? perhaps a vector in memory somewhere?
Code: Select all
>TIB HERE - U.
Re: V-FORTH - Forth-83 for the VIC
Normally FORTH uses screens to achieve what you say, but they're clunky and very different from the file-based approach that other languages typically use. V-FORTH can load and compile definitions from text (SEQ) files and (with the latest release) one file can include another. So, for example, a game file (bluemeanies.fs) could have at the top of itForbidden64 wrote:I guess a better way to phrase that question, is how do I delineate between the base words and additional words? It would be convenient to have both. For example, if I wanted to be able to load the base library of words, and then switch between applications, or load in small groups of words that I like to use and merge them on top, but not exclusively all or nothing. This would be useful for merging commonly used words for things like graphics and sound, or even RS232 support which could be added in as a small group of words. I noticed you recently made a wedge patch for rs232 on Bobbi's project for instance, but I might not need that in every single program, as it would waste memory in a game for instance.
Code: Select all
INCLUDE GRAPHICS.FS
INCLUDE SOUND.FS
INCLUDE GAMEIO.FS
to pull in common definitions.
Once compiled the whole dictionary can be save to disk (or tape) usingConversely, for distributed software, combining the entire thing and saving the whole thing might be beneficial, as you can make a application for other users which already has forth in the save file, and eliminates a secondary loading procedure. Thing is, even if the editor is just cut and paste, saving the code onto a storage media device is still crucial for a real machine to run it.
Code: Select all
DSAVE BLUEMEANIES
Code: Select all
DLOAD BLUEMEANIES
Odd, which version are you using? I'll post the latest build now, there were a number of bugs fixed but I don't recall one like that.I tried to run this with the 16k expansion in VICE, and I cut and pasted some stuff in there. It got stuck in an infinite loop, and never comes back. It only happens after you press the return key, and I placed in the same word from the previous post. I did try typing in direct commands, and that worked. I then tried defining another word,same thing it died :<Code: Select all
: ad 4 4 + cr ;
Re: V-FORTH - Forth-83 for the VIC
Here is the latest version of V-FORTH (3.4). There have been quite a lot of improvements and fixes, take a look at the README for a summary. There are quite a few more modules (graphics, sound etc) which provide functionality. There are also docs which describe memory layout and most of the system interface words.
- Attachments
-
- vforth.zip
- (86.5 KiB) Downloaded 222 times
-
- Vic 20 Hobbyist
- Posts: 146
- Joined: Sun Feb 28, 2016 9:59 pm
- Location: CA USA
Re: V-FORTH - Forth-83 for the VIC
[edit: my second word then is:srowe wrote: They're compiled into the dictionary. There isn't a standard word but the remaining space in the dictionary can be printed with
Code: Select all
>TIB HERE - U.
This takes the address of the user variable store and subtracts the next free dictionary address.
Code: Select all
: free >tib here - cr u. ;
I guess the answer of 8076 explains why it was crashing with 8 less K...
[edit: I read what you wrote more carefully, and the new version does indeed have a smaller 6k prg that I can run on my real vic!! ]
which would leave be plenty for most applications, especially where one char words are used...I'm glad you left most of them free for us!
I found the memory map, I don't quite understand what this means, where it says user area is 0x40 and the Dictionary is the next byte...is that a one byte kind of pointer with the other one inferred? Kind of like the graphics chip's scheme?
Is it essentially fixed to that 4000 range like 4000-4FFF? which would imply that the pointer is at location 201F? It can't be because then the dictionary would be 99% of that memory...
Code: Select all
47 | 0x2000 COLD entry |
48 | 0x2004 WARM entry |
49 | 0x2010 Initial IP |
50 | 0x2012 Initial user |
51 | values |
52 +------------------------+
53 | 0x201E |
54 | Dictionary |
55 | MEMHIGH-0x41 |
56 +------------------------+
57 | MEMHIGH-0x40 |
58 | User area |
59 | MEMHIGH-1 |
60 +------------------------+
Code: Select all
: prglen free 16339 - cr . ;
Code: Select all
: free >tib here - ;
: prglen 16339 free - ;
prglen cr .
which would indeed make a very versatile save and/or transmission of a length of data rather easy! I am loving this! I feel like FORTH tends to make me into a temporary severely bipolar person...perhaps it will teach me patience.
OH THANK GOD THERE IS A MANUAL!
I'm still playing with this non-stop lol I only have a few more hours of day off
- orion70
- VICtalian
- Posts: 4343
- Joined: Thu Feb 02, 2006 4:45 am
- Location: Piacenza, Italy
- Occupation: Biologist
Re: V-FORTH - Forth-83 for the VIC
Creating, attaching and using TAP files in VICE is easy:Mike wrote:Eh, what?Forbidden64 wrote:[...] VICE doesn't support writing .TAP files.
Code: Select all
FILE --> ATTACH TAPE IMAGE...
(name TAPIMAGE.TAP)
click CREATE IMAGE
(click on TAPIMAGE.TAP)
click OK
(now, you can operate files as usual, eg. from BASIC type:)
SAVE"PROGRAM"
FILE --> DATASSETTE CONTROL --> RECORD
FILE --> DATASSETTE CONTROL --> REWIND
(now you can load the program:)
LOAD"PROGRAM"
FILE --> DATASSETTE CONTROL --> PLAY
(...and so on)
-
- Vic 20 Hobbyist
- Posts: 146
- Joined: Sun Feb 28, 2016 9:59 pm
- Location: CA USA
Re: V-FORTH - Forth-83 for the VIC
Wow, I just saw that other post as well
so between reading the file-io, and inferring the word device# sets the default device#
I can then say:
The INCLUDE is a real bonus! I can see how that works as well!
You also mention in the file-io a rather godsmackingly cool command... an auto-load command which, upon loading is checked in the dictionary, and if present, automatically goes from cold start to running the software! That was a very good addition!
What is that command out of interest?
Do I simply define autoload myself, and then it automatically executes what is in that word?
so between reading the file-io, and inferring the word device# sets the default device#
I can then say:
Code: Select all
9 device# (I presume the default is 8 or perhaps 0)
dsave bluemeanies.fs
You also mention in the file-io a rather godsmackingly cool command... an auto-load command which, upon loading is checked in the dictionary, and if present, automatically goes from cold start to running the software! That was a very good addition!
What is that command out of interest?
Do I simply define autoload myself, and then it automatically executes what is in that word?
Re: V-FORTH - Forth-83 for the VIC
The memory map runs like this:Forbidden64 wrote: I found the memory map, I don't quite understand what this means, where it says user area is 0x40 and the Dictionary is the next byte...is that a one byte kind of pointer with the other one inferred? Kind of like the graphics chip's scheme?
The built-in part of the dictionary runs from $201E to $3FE0 (for the latest version). User variables occupy $40 bytes at the end of memory (MEMHIGH). With 16K expansion that is at $5FFF. User-defined words can therefore run between $3FE0 and $5FBF, 8159 bytes. With 24K expansion you gain another 8K.
Memory from $1000 to $1FFF is left free, it's precious because it's addressable by the VIC.
Re: V-FORTH - Forth-83 for the VIC
Nearly, changing variables in FORTH needs an explict store soForbidden64 wrote:Wow, I just saw that other post as well
so between reading the file-io, and inferring the word device# sets the default device#
I can then say:
Code: Select all
9 device# (I presume the default is 8 or perhaps 0) dsave bluemeanies.fs
Code: Select all
9 device# !
I actually took this a step further. Because the same modules are used in multiple files having a conditional include is also useful. So you can also doThe INCLUDE is a real bonus! I can see how that works as well!
Code: Select all
?include dos dos.fs
Simplest to give an example: load the words you want to run followed by "autosave.fs". The AUTOSAVE word takes the CFA of the word to automatically start and the filename to save to.You also mention in the file-io a rather godsmackingly cool command... an auto-load command which, upon loading is checked in the dictionary, and if present, automatically goes from cold start to running the software! That was a very good addition!
What is that command out of interest?
Do I simply define autoload myself, and then it automatically executes what is in that word?
Code: Select all
INCLUDE DEMO.FS
INCLUDE AUTOSAVE.FS
' MAZE AUTOSAVE MAZE.PRG
Code: Select all
LOAD"MAZE.PRG",8,1
SYS8192