V-FORTH - Forth-83 for the VIC
Moderator: Moderators
-
- Vic 20 Hobbyist
- Posts: 125
- Joined: Sun Feb 28, 2016 9:59 pm
- Location: CA USA
Re: V-FORTH - Forth-83 for the VIC
You realize of course, that this has historically never been done on any system...it is for all intents and purposes, a standalone FORTH OS because of these features no one else apparently thought of. Likely because they were too busy trying to adhere to a standard from 1976 made for tele-terminals(FIG). Incidentally, since V-FORTH doesn't have an editor, and also reads sequential files as though they are being typed...doesn't also then mean that any VIC word processor can be an editor, as well as you mentioned, any modern machine's text editors?
Or in essence, as you mentioned, any sequential file...? I'll do some testing and find out...like if quick brown fox can make V-FORTH compatible code structures, that would be interesting. Cool, would be an editor like take for instance a text editor made with minigrafik. :O.
Especially since they don't even need to be loaded at the same time. Although I am just hearing about minigrafik, and don't know much about it yet.
Or in essence, as you mentioned, any sequential file...? I'll do some testing and find out...like if quick brown fox can make V-FORTH compatible code structures, that would be interesting. Cool, would be an editor like take for instance a text editor made with minigrafik. :O.
Especially since they don't even need to be loaded at the same time. Although I am just hearing about minigrafik, and don't know much about it yet.
Re: V-FORTH - Forth-83 for the VIC
Things were different when the VIC came out. No one had a disk drive (at least in the UK) and the concept of using a standarized editor etc would have been quite alien. The integrated line editor that BASIC had was the model of the day.
In theory, yes, any word processor or similar program should do. From memory some of them do non-standard things, I think the editor that came with my assembler used characters 0x01 to 0x08 to indicate tabs.
I think a text editor that uses tokra's Maxi-Edit
http://sleepingelephant.com/ipw-web/bul ... f=2&t=8375
would make developing on a VIC much easier.
In theory, yes, any word processor or similar program should do. From memory some of them do non-standard things, I think the editor that came with my assembler used characters 0x01 to 0x08 to indicate tabs.
I think a text editor that uses tokra's Maxi-Edit
http://sleepingelephant.com/ipw-web/bul ... f=2&t=8375
would make developing on a VIC much easier.
- Mike
- Herr VC
- Posts: 5130
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
Re: V-FORTH - Forth-83 for the VIC
The thread to the MG batch suite I pointed you to (in the post you're most probably referring to) contains links to a disk image and manual for MG, in the top post.Forbidden64 wrote:[...] I am just hearing about minigrafik, and don't know much about it yet.
Besides this you're taking a good chance, that a program/tool/game in the Announcement section (especially those released by me, but there are also other users) sports MINIGRAFIK under the hood. MG has been around for over ten years now.
This idea, a tool set of symbolic assember and text editor, hosted on the VIC-20, both working in a software 40 column mode, and capable of constructing themselves pops up here in Denial every now and then, see:Cool, would be an editor like take for instance a text editor made with minigrafik. :O
o First Step in Vic-20 Software Development,
o 40 column word processor?, and
o Programming language implementation ...
... including the reasons I didn't start out with that project.

-
- Vic 20 Afficionado
- Posts: 354
- Joined: Thu Oct 13, 2016 11:35 am
- Location: Toronto
- Occupation: Programmer
Re: V-FORTH - Forth-83 for the VIC
For what it is worth, the little VICScript language I made last year has a primitive line editor which can be used to edit PETSCII SEQ files. Programs are loaded from plain text SEQ files. These files can be created in any text editor or word processor, so you are not stuck with my dreadful line editor! I chose to use PETSCII encoding but I could also have decided to use ASCII files so I could edit them easily on another platform. I am thinking to add an option to load and save in ASCII to allow files to be easily migrated from PC to VIC-20 and back.
-
- Vic 20 Hobbyist
- Posts: 125
- Joined: Sun Feb 28, 2016 9:59 pm
- Location: CA USA
Re: V-FORTH - Forth-83 for the VIC
Grr, I have been so busy I haven't been able to toy around with this since my last post. I have been studying my book on the road when I get chances though. Hopefully, in a month or two things won't be as crazy...and I can set aside some proper time for this very cool new language. I guess having a VIC based editor is superfluous in the sense that, as the author pointed out, there are better modern alternatives. I just wanted to point out that this was an option theoretically. You could develop the entire thing directly on the VIC even though there is no formal editor.
All you would need is a 40 column word processor to make it comfy. That is, of course, independent from the language itself, which is already stand-alone...
I also found yesterday when I was searching around some archives, some very cool stuff. A 6502 & 65c02 cross assembler for dos, and unix. An 6502 object code disassembler for amiga(it's a ".1" file?), a 6502 assembler/ linker for the atari, a 6502 disassembler for UNIX, As well as a smorgasbord of other similar programs. I was having a quick look around to see if there was anything in there for my arrested LSI-11 project for later related to the LSX operating system, which is essentially a sysgen for UNIX 4.0, that fits onto an 8" floppy an runs with only 20kw of memory. Sadly, that project has been shelved for a while.
Also, apparently there is already a VFORTH...Vax FORTH, which is also in that archive. Apparently, this archive was ripped off of usenet circa '88/'89, along with even some message board content.
http://cd.textfiles.com/sourcecode/
All you would need is a 40 column word processor to make it comfy. That is, of course, independent from the language itself, which is already stand-alone...
I also found yesterday when I was searching around some archives, some very cool stuff. A 6502 & 65c02 cross assembler for dos, and unix. An 6502 object code disassembler for amiga(it's a ".1" file?), a 6502 assembler/ linker for the atari, a 6502 disassembler for UNIX, As well as a smorgasbord of other similar programs. I was having a quick look around to see if there was anything in there for my arrested LSI-11 project for later related to the LSX operating system, which is essentially a sysgen for UNIX 4.0, that fits onto an 8" floppy an runs with only 20kw of memory. Sadly, that project has been shelved for a while.
Also, apparently there is already a VFORTH...Vax FORTH, which is also in that archive. Apparently, this archive was ripped off of usenet circa '88/'89, along with even some message board content.
http://cd.textfiles.com/sourcecode/
- J.E.E.K.
- Vic 20 Drifter
- Posts: 23
- Joined: Wed Jan 25, 2017 12:31 pm
- Website: http://klasek.at/8bit
- Location: AT
Re: V-FORTH - Forth-83 for the VIC
Great stuff, nice work!srowe wrote:[..]
I meant to mention, the source and build can be downloaded from http://eden.mose.org.uk/vforth.git
FIG Forth which this Forth is based on has historically a lot of bugs. Couple of weeks ago I went through the U/ or UM/MOD field and looked for implementations in various Forth sources for the C64, VIC 20 or even 65816.
Fine to see that your version looks pretty good and efficient (nearly the same as my version from the conclusion on the different sources I took into consideration). Nevertheless it has a bug ...
The original code (from the Git repo):
Code: Select all
259 CODE UM/MOD ( 31 BIT DIVIDEND-2, -3, 16 BIT DIVISOR-1 *)
260 ( 16 BIT REMAINDER-2, 16 BIT QUOTIENT-1 *)
261 SEC 2 + LDA, SEC LDY, SEC 2 + STY, .A ASL, SEC STA,
262 SEC 3 + LDA, SEC 1+ LDY, SEC 3 + STY, .A ROL, SEC 1+ STA,
263 10 # LDA, N STA,
264 BEGIN, SEC 2 + ROL, SEC 3 + ROL, SEC 2+ LDA,
265 CS NOT IF,
266 SEC, BOT SBC, TAY,
267 SEC 3 + LDA, BOT 1+ SBC,
268 CS IF, SEC 2+ STY, LABEL L442 SEC 3 + STA, THEN,
269 SEC ROL, SEC 1+ ROL,
270 N DEC, SWAP 0=
271 UNTIL, POP JMP,
272 THEN, BOT SBC, SEC 2+ STA, SEC 3 + LDA, BOT 1+ SBC,
273 L442 JMP,
274 END-CODE
Code: Select all
272 THEN, BOT SBC, SEC 2+ STA, SEC 3 + LDA, BOT 1+ SBC, SEC,
Test case:
HEX
0 8000 C000 UM/MOD U. U.
AAAA 8000 OK
should be the correct value.
Currently I got
0 8000 OK
As described above the missing carry (unset after subtraction of the divisor) is rotated into the quotient. The remainder is ok in this case.
- J.E.E.K.
- Vic 20 Drifter
- Posts: 23
- Joined: Wed Jan 25, 2017 12:31 pm
- Website: http://klasek.at/8bit
- Location: AT
Re: V-FORTH - Forth-83 for the VIC
In addition to the previous one might replace the final JMP by a BCS which is in this case always taken.
could be written as
This saves the byte lost which "SEC," costs because the branch takes only 2 bytes instead of 3 for the "JMP,".
The branch opcodes are missing in Ragsdale's Assembler (we would need such as "BCS,") therefore we have to do the corresponding like the stuff in THEN, (I hope the offset calculation is right - not tested).
Code: Select all
272 THEN, BOT SBC, SEC 2+ STA, SEC 3 + LDA, BOT 1+ SBC,
273 L442 JMP,
could be written as
Code: Select all
272 THEN, BOT SBC, SEC 2+ STA, SEC 3 + LDA, BOT 1+ SBC,
273 L442 HERE 2- CS NOT C, C,
The branch opcodes are missing in Ragsdale's Assembler (we would need such as "BCS,") therefore we have to do the corresponding like the stuff in THEN, (I hope the offset calculation is right - not tested).
Re: V-FORTH - Forth-83 for the VIC
Thanks for reporting this, I did pick up a number of bug fixes I found on 6502.org but I don't recall seeing this one mentioned.
I think this is the correct change to handle both the missing carry set and switch to use a relative jump
Rather than use explicit branch instructions my code uses the standard ASSEMBLER conditionals. There's no check for pairings so with a bit of stack manipulation you can interleave BEGIN, IF, UNTIL, THEN, etc if you're careful.
I think this is the correct change to handle both the missing carry set and switch to use a relative jump
Code: Select all
diff --git a/vforth.fs b/vforth.fs
index 84d989d..cdbf64c 100644
--- a/vforth.fs
+++ b/vforth.fs
@@ -265,12 +265,12 @@ CODE UM/MOD ( 31 BIT DIVIDEND-2, -3, 16 BIT DIVISOR-1 *)
CS NOT IF,
SEC, BOT SBC, TAY,
SEC 3 + LDA, BOT 1+ SBC,
- CS IF, SEC 2+ STY, LABEL L442 SEC 3 + STA, THEN,
+ CS IF, SEC 2+ STY, BEGIN, SEC 3 + STA, SWAP THEN,
SEC ROL, SEC 1+ ROL,
- N DEC, SWAP 0=
+ N DEC, ROT 0=
UNTIL, POP JMP,
- THEN, BOT SBC, SEC 2+ STA, SEC 3 + LDA, BOT 1+ SBC,
- L442 JMP,
+ SWAP THEN, BOT SBC, SEC 2+ STA, SEC 3 + LDA, BOT 1+ SBC, SEC,
+ CS NOT UNTIL,
END-CODE
CODE 2/
- J.E.E.K.
- Vic 20 Drifter
- Posts: 23
- Joined: Wed Jan 25, 2017 12:31 pm
- Website: http://klasek.at/8bit
- Location: AT
Re: V-FORTH - Forth-83 for the VIC
Thanks Simon for the quick response. As I remember Mike Barry's latest version from 6502.org got this fixed too.srowe wrote:Thanks for reporting this, I did pick up a number of bug fixes I found on 6502.org but I don't recall seeing this one mentioned.
I think this is the correct change to handle both the missing carry set and switch to use a relative jump
Just for reference, see the thread Re: integer division and multiplication
Ok, I see, that's python assembler without pairing you're referring to as standard assembler?srowe wrote: Rather than use explicit branch instructions my code uses the standard ASSEMBLER conditionals. There's no check for pairings so with a bit of stack manipulation you can interleave BEGIN, IF, UNTIL, THEN, etc if you're careful.
Did you pushed the changes into the repo already?
Johann
Re: V-FORTH - Forth-83 for the VIC
Thanks for the link, I hadn't come across that thread.J.E.E.K. wrote: Thanks Simon for the quick response. As I remember Mike Barry's latest version from 6502.org got this fixed too.
Just for reference, see the thread Re: integer division and multiplication
Yes, the implementation of the ASSEMBLER conditionals in the python compiler mimics those in the Ragsdale code (just without the pair checks).Ok, I see, that's python assembler without pairing you're referring to as standard assembler?
Did you pushed the changes into the repo already?
I've tagged a 3.8 release with this fix and pushed it.
Cheers
- J.E.E.K.
- Vic 20 Drifter
- Posts: 23
- Joined: Wed Jan 25, 2017 12:31 pm
- Website: http://klasek.at/8bit
- Location: AT
Re: V-FORTH - Forth-83 for the VIC
Thanks a lot, Simon!
BTW, will you provide a link to the ZIP for distribution or upload the image here again?
Johann
BTW, will you provide a link to the ZIP for distribution or upload the image here again?
Johann
Re: V-FORTH - Forth-83 for the VIC
Sure, I've uploaded both the D64 image and a zip file containing source, docs and binaries to my web site
https://eden.mose.org.uk/download/
https://eden.mose.org.uk/download/
Re: V-FORTH - Forth-83 for the VIC
This is mind-boggling. Never cared about FORTH before. Well done!
EDIT: HINT: There's open source code for bitmapped display and 40 columns one could plug in.
EDIT: HINT: There's open source code for bitmapped display and 40 columns one could plug in.

A man without talent or ambition is most easily pleased. Others set his path and he is content.
https://github.com/SvenMichaelKlose
https://github.com/SvenMichaelKlose
Re: V-FORTH - Forth-83 for the VIC
Thanks, I had a lot of fun learning the internals of a Forth VM.
I'm using the full 8K for the ROM-based version but I could look at adding 40 column mode to the PRG version. It would reduce the maximum size of the dictionary a little but would be more usable in a visual way.
I'm using the full 8K for the ROM-based version but I could look at adding 40 column mode to the PRG version. It would reduce the maximum size of the dictionary a little but would be more usable in a visual way.
Re: V-FORTH - Forth-83 for the VIC
Hi good afternoon.
a nice vforth
why are the graphics-screen so small please?
How can you make it big, please?
is there a new version of vforth from 2019?
Thank you.
greetings from Germany
a nice vforth
why are the graphics-screen so small please?
How can you make it big, please?
is there a new version of vforth from 2019?
Thank you.
greetings from Germany