FORTH for the SHARP PC-E500 (S)
10-04-2021, 06:43 AM (This post was last modified: 10-04-2021 08:39 AM by Klaus Overhage.)
Post: #18
 Klaus Overhage Member Posts: 55 Joined: Jan 2016
RE: FORTH for the SHARP PC-E500 (S)
Thank you Rob for your Forth500. For me, both the handling of the PC-E500 and the Forth language are new territory. With Forth500 I am now taking my first steps and have already learned a lot in the process:

Installation of Forth500
===============

I was able to load the "expanded" version onto a PC-E500S with 256K RAM. And even with a PC-E500 with 32K and an inserted 256K card, I have succeeded in entering MEM \$ = "B" beforehand. When & B0000- & BFC00 were reserved, the Ramdisk E: and its contents were retained.

With the help of Helix Program bintoasc, Forth500.bin became FORTH500.TXT with 53k bytes. On the PC I use the program MBSharpNotepad together with an old serial interface cable (see https://manib.bplaced.net/blog/?page_id=458#) First deactivate the menu item "View / Syntax Highlighting" in MBSharpNotepad because otherwise large text files take a long time to load. Then FORTH500.TXT opened and found that the line breaks are not displayed.

Tried it and found this way as a solution: First create a new text file with MBSharpNotepad and save it. Open this file with a double click in notepad, open FORTH500.TXT also with a double click in notepad, mark everything (CTRL-A), copy and paste into the new file. Close Notepad again, the new file was now 71K and is displayed by MBSharpNotepad as normal with line breaks.

I had to change something in the Helix BASIC program because MBSharpNotepad now sends an additional 0 after each line. I named it FLOAD and appended it below. Sending the 71K file to the PC-E500 takes 18 minutes, but MBSharpNotepad shows a nice progress bar. Then you can use PEEK commands to check whether it worked: PEEK A must result in 48 and PEEK (A + 1) must result in 113.

@Helix: How do you start the data transfer to the PC-E500 on the PC?

Using Forth500
==========

After reading Rob's wonderful "Quick Forth tutorial" I wanted to create a Forth program on the PC and transfer it to the PC-E500. I opened an empty editor window in MBSharpNotepad and copied an example from the tutorial into it:
Code:
 \ HELLO.FTH .( Loading HELLO... ) ANEW _HELLO_   0 CONSTANT #english 1 CONSTANT #spanish 2 CONSTANT #french VARIABLE language #english language ! : hello   language @ CASE     #english OF ." Hello, World!"  ENDOF     #spanish OF ." Hola, Mundo!"   ENDOF     #french  OF ." Salut Mondial!" ENDOF     ." Unknown language"   ENDCASE  CR ;
Then saved as HELLO.FTH on the PC. Data reception on the PC-E500 is started with
COPY "COM:" TO "E:HELLO.FTH", A
and sending on the PC in the MBSharpNotepad.

The file can then be added to the dictionary from FORT500 as follows: INCLUDE HELLO.FTH
Try it with HELLO and delete it again with FORGET _HELLO_.

I'm looking forward to trying out the examples from some of the Forth books ...

Attached File(s)