HiRes package for Toddy Forth

Discussion about ZX80 / ZX81 Software
User avatar
kmurta
Posts: 302
Joined: Tue Sep 01, 2009 5:04 am
Location: Belo Horizonte - BR
Contact:

HiRes package for Toddy Forth

Post by kmurta »

Hi people!

Here is a basic high-resolution graphics package to use with Toddy Forth (I recommend versions >= 1.5, not tested with the previous ones).

The graphic screen has a resolution of 256x192 pixels, with the coordinate (0,0) located at the bottom left of the screen, and the coordinate (255,191) at the top right. All graphic words accept coordinates beyond the limits of the screen, pixels outside the range are simply ignored.

Description of implemented words:

HGR ( -- )
Switches to the HR graphics screen

TEXT ( -- )
Switches to the normal text screen

GINVERT ( -- )
Invert the graphics screen

GPAGE ( -- )
Clear the graphics screen

PMODE ( n -- )
Set the behavior of GSET, GLINE and GLINETO:
n = 0 -> clear the pixel
n = 1 -> set the pixel
n = 2 -> invert the pixel

GPIX ( x y -- )
Changes the point with the coordinates (x,y) according to the condition defined by PMODE

GSET? ( x y -- flag )
Give a true flag if the point with coordinates (x,y) is set.

GMOVE ( x y -- )
Change the "last point" coordinates to (x,y), without affecting the point.

GPOS? ( -- x y )
Get the coordinates of the last point referred to by any other graphics word.

GLINE ( dx dy -- )
Draw a straight line from the last point, across dx pixels to the right, and up dy pixels. Either dx or dy can be negative, producing lines going left and down.

GLINETO ( x y -- )
An alternative to GLINE, with this word you specify the destination coordinates of the line, which is drawn to there from the last point.

The Hires screen start at address $A000, so set your ZXpand to high memory before loading tforth.

tfhgr.gif
(click on the image to open the animation)
tforth-hgr.zip
(5.98 KiB) Downloaded 151 times
1 x ZX81, 2 x TK85 , 1 TK82C, 1 TK95, 1 x Alphacom 32 printer, 1 x ZXpand
ZeXtender board, Joy81 - Programmable Joystick Controller, Turbo Sound 81
http://zx81.eu5.org
https://toddysoftware.itch.io/
Moggy
Posts: 3231
Joined: Wed Jun 18, 2008 2:00 pm

Re: HiRes package for Toddy Forth

Post by Moggy »

Excellent work Kelly :ugeek: many thanks for this.

I have been having fun with the lines and circle routines in 1.5 so this will be a worthy addition and will certainly have fun if I can master it. :D

(Only the floating point and Memotech things we discussed to do then you can rest!!! :lol: )


Regards.

Moggy.
Moggy
Posts: 3231
Joined: Wed Jun 18, 2008 2:00 pm

Re: HiRes package for Toddy Forth

Post by Moggy »

Hi Kelly.

I seem to have a problem with the compilation of the drivers.

If I use an emulator (SZ81 they will compile but the screen is a mess and I cannot get Eighty One to do anything no surprise there) but on real ZX81 which is all I'm interested in not emulation, the compilation stops at the GSET or GMOVE point with a few random graphics and then a ? shown,are you using an emulator or the real thing?

I have tried ZXpands V1, 3, 5 and 5.1 and used a fresh down load of toddy V1.5 different sd cards etc and different 81's but still no luck I notice you are using V1.6 is there a download for this?


Regards.

Moggy.
User avatar
kmurta
Posts: 302
Joined: Tue Sep 01, 2009 5:04 am
Location: Belo Horizonte - BR
Contact:

Re: HiRes package for Toddy Forth

Post by kmurta »

Moggy wrote: Sun Feb 28, 2021 8:57 pm If I use an emulator (SZ81 they will compile but the screen is a mess and I cannot get Eighty One to do anything no surprise there) but on real ZX81 which is all I'm interested in not emulation, the compilation stops at the GSET or GMOVE point with a few random graphics and then a ? shown,are you using an emulator or the real thing?
Hi Moggy!

I used it only with EightyOne (set the "High Resolution" option to wrx), but the problem should probably be due to the memory configuration. The source file is about 10Kb, so you must configure the ZXpand to use the high memory (16k-48K) with CONFIG "M=H", before loading the tforth. And use tforth15.p instead of tforth15u.p, as the latter requires RAM between 8k-16k.
I notice you are using V1.6 is there a download for this?
Not yet, I'm still working on it but there have been a lot of changes since v1.5 that I think it's better to release it as V2.0. But it is already quite functional and I leave it here so that you can test it:


( look for the file some posts below )


I am not satisfied with the block handling mode currently implemented, I am looking to implement something more flexible and closer to the traditional method used by the other Forths, but the unavailability of more RAM is a limiter. I am studying a way to implement a RAM expansion to be used together with the ZXpand, but I am in doubt if I will add only 32Kb more (as in the Chroma81 interface) or if I leave soon for a RAMDISK of 128K or more.

The advantage of opting for an expansion of 32Kb is that I could implement the shadow ROM scheme designed by Wilf Rigter and perhaps this is of more value than a RAMDISK of greater capacity.
Last edited by kmurta on Tue Mar 02, 2021 12:01 am, edited 1 time in total.
1 x ZX81, 2 x TK85 , 1 TK82C, 1 TK95, 1 x Alphacom 32 printer, 1 x ZXpand
ZeXtender board, Joy81 - Programmable Joystick Controller, Turbo Sound 81
http://zx81.eu5.org
https://toddysoftware.itch.io/
Moggy
Posts: 3231
Joined: Wed Jun 18, 2008 2:00 pm

Re: HiRes package for Toddy Forth

Post by Moggy »

Sad to say the same thing is happening no what memory setting high or low it gets as far as GSET prints a couple of random graphics then ?
I can only assume there is something in the words that the zeddy doesn't like during compilation hence the ?? and not the memory setting as that makes no difference whatsoever.

Something definitely wrong as far as real zeddy is concerned and I have tried three different ones and four different ZXpands and three copies of Toddy (non UDG)it would seem that Eighty One and the real thing are worlds apart in some ways.

Could you perhaps post your Toddy with the drivers already compiled and I will see if it can run on real 81 as opposed to an emulator.

I notice also the CLS command is missing.
Attachments
SANY0253.JPG
Moggy
Posts: 3231
Joined: Wed Jun 18, 2008 2:00 pm

Re: HiRes package for Toddy Forth

Post by Moggy »

Ok some progress made in which I have learned.

Don't use Toddy via ZXpand commander even though it is set at MEM=H

If you are using the above then use Q to quit it then NEW. Then navigate via CONFIG "D=(your toddy folder)" to load Toddy and compile the drivers as described and all should work as it did for me however on typing HGR to get the Hi-Res screen I unfortunately got the screen pictured which I somehow don't think is correct.

Typing TEXT does however return you to the normal screen.

EDIT.

I have also just noticed that this version of Toddy has dropped the custom keyboard routine and is now usable with a Memotech keyboard, Nice job Kelly much appreciated.
Attachments
SANY0255.JPG
User avatar
kmurta
Posts: 302
Joined: Tue Sep 01, 2009 5:04 am
Location: Belo Horizonte - BR
Contact:

Re: HiRes package for Toddy Forth

Post by kmurta »

Moggy wrote: Sun Feb 28, 2021 11:55 pm Don't use Toddy via ZXpand commander even though it is set at MEM=H
Yes, ZXpand Commander changes the memory configuration.
If you are using the above then use Q to quit it then NEW. Then navigate via CONFIG "D=(your toddy folder)" to load Toddy and compile the drivers as described and all should work as it did for me however on typing HGR to get the Hi-Res screen I unfortunately got the screen pictured which I somehow don't think is correct.
Are you using the UDG4ZXPAND? If so, then you have to disable UDGs by removing the jumper; use the HPAGE word to clear the HR screen.

I tested the routines on the real ZX81 and it worked perfectly: https://youtu.be/mzaF7b9K4PQ

Regarding CLS, it was replaced by PAGE which is the default word in Forth to clear the screen.
1 x ZX81, 2 x TK85 , 1 TK82C, 1 TK95, 1 x Alphacom 32 printer, 1 x ZXpand
ZeXtender board, Joy81 - Programmable Joystick Controller, Turbo Sound 81
http://zx81.eu5.org
https://toddysoftware.itch.io/
Moggy
Posts: 3231
Joined: Wed Jun 18, 2008 2:00 pm

Re: HiRes package for Toddy Forth

Post by Moggy »

Hi Kelly.
.
I am not using UDG4XPAND but I think at last I understand how this is working and you must excuse me Kelly as I'm am not the smartest here. :oops:

Typing HGR on its own will produce the garbage screen but I now understand that is not the way to use it.
If I understand correctly all the instructions or programming are done in the Low-res screen then these instructions switch on the Hires and perform what has been instructed, much like the Memotech Hi-res unit,then it switches back to Low-res by using TEXT.

I understand about the CLS thing now.

Many thanks for this addition to Toddy as it really brings it up to date with a lot of modern Forth implementations that use Hi-res and please keep the keyboard routine for future Toddy V2.0 that is in V1.6 as it now Memotech friendly.


Regards.

Moggy.
Moggy
Posts: 3231
Joined: Wed Jun 18, 2008 2:00 pm

Re: HiRes package for Toddy Forth

Post by Moggy »

Now getting the hang of this works,how to go between screens etc but I have found that once the drivers are compiled any work you create cannot be saved by FSAVE as whist it goes through the process of saving when it is reloaded the system stops with the 0/0 error.

Is this something you are aware of because as it stands it means typing in whatever you have created every time you need to use it then compiling all over again.
User avatar
kmurta
Posts: 302
Joined: Tue Sep 01, 2009 5:04 am
Location: Belo Horizonte - BR
Contact:

Re: HiRes package for Toddy Forth

Post by kmurta »

Moggy wrote: Mon Mar 01, 2021 9:01 pm Now getting the hang of this works,how to go between screens etc but I have found that once the drivers are compiled any work you create cannot be saved by FSAVE as whist it goes through the process of saving when it is reloaded the system stops with the 0/0 error.

Is this something you are aware of because as it stands it means typing in whatever you have created every time you need to use it then compiling all over again.
Sorry :oops:

Thanks for reporting this issue, now it's fixed ;)
tforth16.p
(5.38 KiB) Downloaded 136 times
and with the HGR package already compiled:
HGRTF16.P
(5.87 KiB) Downloaded 131 times
Edit 1: I identified an error in the word ABS, so the files were replaced

Edit 2: Moggy identified a problem in a colon definition when a word is misspelled, which caused loss of access to vocabulary. This was fixed and the corrected files can be accessed above.

Note: This is a "work in progress" version and therefore subject to more issues, so I ask you to inform me if you find any so that I can correct them.
Last edited by kmurta on Thu Mar 04, 2021 3:28 am, edited 1 time in total.
1 x ZX81, 2 x TK85 , 1 TK82C, 1 TK95, 1 x Alphacom 32 printer, 1 x ZXpand
ZeXtender board, Joy81 - Programmable Joystick Controller, Turbo Sound 81
http://zx81.eu5.org
https://toddysoftware.itch.io/
Post Reply