HiRes package for Toddy Forth
Posted: Sun Feb 28, 2021 6:37 pm
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.
(click on the image to open the animation)
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.
(click on the image to open the animation)