wiki:Develop/FileFormats/MOTO

Version 2 (modified by Thomas Bernard, 5 years ago) ( diff )

--

Thomson MO/TO files formats

GrafX2 is able to load/save pictures for the Thomson MO/TO ranges of computer in several formats :

  • RAW binary files. Two files of 8000 (8008 or 8032 with color palette) per picture : One 'P' file for the "FORME" VRAM, one 'C' file for the color VRAM (READ ONLY)
  • Autoloading DECB binary files.
  • MAP files (with optional TO-SNAP extension)

As the TO7, TO7/70 and MO5 machines only have a fixed palette, palette data (or TO-SNAP) extension is not saved when targetting theses machines.

MAP files

documentation for the MAP files : http://collection.thomson.free.fr/code/articles/prehisto_bulletin/page.php?XI=0&XJ=13

MAP files are saved on a Thomson machine using GET/SAVEP and loaded using LOADP/PUT. See link below for loading the palette from the TO-SNAP extension. GrafX2 use an optimized packing algorithm.

GrafX2 autoloading DECB binary files (BIN)

GrafX2 use a format that can be natively be loaded on the Thomson machine using the LOADM instruction.

The FORME VRAM is selected and loaded, then the COULEUR VRAM is selected and filled. For TO8/TO9 :

offset| data                    | comment
 0000 | 00 00 01 e7 c3 65       | write 0x65 to 0xe7c3 to select FORME
 0006 | 00 1f 80 40 00 xx xx xx | write 8064 bytes to 0x4000 (VRAM)
 1f8c | 00 00 01 e7 c3 64       | write 0x64 to 0xe7c3 to select COULEUR
 1f91 | 00 1f 80 40 00 xx xx xx | write 8064 bytes to 0x4000 (VRAM)
 3f16 | ff 00 00 00 00          | end marker

When targeting MO6 or TO8/TO9/TO9+, the 16 colors palette is store immediately after the 8000 bytes picture data in 0bgr format. Then 31 bytes are reserved for the comment, and one last byte for the video mode.

The video mode at offset 8063 (&H1F7F) is stored in ascii format ('0' => 40col, '1' => 80col, '2' => bm4 or '3' => bm16).

Theses supplementary data are duplicated between FORME and COULEUR VRAM, so they are always readable from BASIC with PEEK().

Here are the offsets after loading :

              MO6 | TO8/TO9
picture data &H0000 | &H4000
palette data &H1F40 | &H5F40
comment      &H1F60 | &H5F60
video mode   &H1F7F | &H5F7F

Here is a BASIC 128/512 program to load such a file :

10 REM CHARGEMENT D'UNE IMAGE GrafX2
20 REM (C) THOMAS BERNARD
30 LOCATE,,0 'DESACTIVE CURSEUR
40 LOADM"POISCTO8"
50 REM PALETTE EN VRAM APRES L'IMAGE
60 FOR I=0 TO 15
70 BGR=PEEK(&H4000+8000+I*2)*256+PEEK(&H4000+8000+I*2+1)
80 PALETTE I,BGR
90 NEXT I
100 IF INKEY$="" GOTO 100
110 LOCATE,,1 'ACTIVE CURSEUR
120 REM AFFICHAGE DU COMMENTAIRE
130 FOR I=0 TO 31
140 C=PEEK(&H4000+8032+I)
150 IF C>=32 AND C<127 THEN PRINT CHR$(C);
160 NEXT I
170 PRINT
Note: See TracWiki for help on using the wiki.