Hi,
I will soon release version 0.3.0 of the FORTH Interpreter/Compiler.
The main change is the ability to use the M&E modules created by PARX in the 90's:
- RIM modules to Read IMages (GIF, TGA, PNG, TIFF, JPEG...)
- WIM modules to Write IMages (idem)
- IFX modules to perform graphic effects
- One TRM module (TRM for tramage in french, that means dithering, but does lot more (zoom, format conversion...)
It's been a long work to understand it all and provide the best instruction set:
- dorim, dowim, doifx, dotrm that will suit most needs, this is the automatic mode
- modinfo, modpal, modexe to perform the calls step by step and keep a total control of the process, this is the manual mode
Here is an example. The program loads both the TRM and the GIF RIM, it
loads and decodes a GIF image and displays it, it should work in
every resolution and adapt the output.
20220406_164218.jpg
The variables :
Code: Select all
variable p \ every module is pointed at by a variable, this one for the GIF
variable t \ the TRM
variable fichier \ the file address in memory
variable total \ the file size
256 string filename \ the filename
1536 allot constant PALs \ room for the source palette
1536 allot constant PALd \ room for the dest palette (after conversion)
variable fhd \ the file handle
First, we load the modules :
Code: Select all
: main
" d:\parx.sys\" 1 modset \ set the folder path for the modules
0 t !
" parx252.trm" graphic_card t modload drop \ load the TRM
0 p !
" rim\gif00.rim" -1 p modload drop \ load the GIF RIM
Then we open the file and test if the handle is positive (else error!):
Code: Select all
" F:\FORTH\GIPHY.GIF" filename $! \ set the name
filename 0 fopensize dup fhd ! \ try to open the file
0> if \ if OK
total ! \ store the file size
fhd @ total @ dup allot dup fichier ! fread drop \ read the whole file in memory
Then we run the RIM to decode the file and get a bitmap bloc
Code: Select all
fichier @ total @ filename fhd @ PALs 1 p dorim drop
Then we prepare the mfdb destination to be adapted to the current number of planes, and then call the TRM to adapt the bloc:
Code: Select all
mfdbs mfdbd fillmfdb \ copy mfdb source to dest
work_out 2- w@ mfdbd 12 + w! \ get the planes and store it into mfdb dest
%b0110010 1 PALs PALd 3 t dotrm drop \ does the conversion
Then we copy the bloc to the screen:
Code: Select all
mfdbd mfdbs fillmfdb \ the dest bloc from TRM becomes source bloc
PALd setvdipal \ set the palette returned by TRM
0 mfdbd ! 0 0 0 0 \ mfdb dest is the screen, coordinates 0,0 to 0,0
mfdbs 4 + w@ mfdbs 6 + w@ 3 vro_cpyfm \ get the image size from mfdb source, and copy bloc!
key drop \ wait for a key
Now, time to clean all:
Code: Select all
fhd @ fclose drop \ close GIF file
then
p modunload \ unload the GIF module
t modunload \ unload the TRM
;
Here are the results, using the
same program (not a line changed!) in
16 colors and
monochrome on a TT without the gfx card:
20220406_164101.jpg
20220406_164025.jpg
I wait for Simon to finish the
English translation of the manual, then I will add the
PARX chapter and publish everything !
Guillaume.
You do not have the required permissions to view the files attached to this post.