| 1 | == Thomson MO/TO files formats |
| 2 | |
| 3 | GrafX2 is able to load/save pictures for the Thomson MO/TO ranges of computer in several formats : |
| 4 | * 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) |
| 5 | * Autoloading DECB binary files. |
| 6 | * MAP files (with optional TO-SNAP extension) |
| 7 | |
| 8 | 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. |
| 9 | |
| 10 | == MAP files |
| 11 | |
| 12 | documentation for the MAP files : http://collection.thomson.free.fr/code/articles/prehisto_bulletin/page.php?XI=0&XJ=13 |
| 13 | |
| 14 | 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. |
| 15 | GrafX2 use an optimized packing algorithm. |
| 16 | |
| 17 | == GrafX2 autoloading DECB binary files (BIN) |
| 18 | GrafX2 use a format that can be natively be loaded on the Thomson machine using the LOADM instruction. |
| 19 | |
| 20 | The FORME VRAM is selected and loaded, then the COULEUR VRAM is selected and filled. |
| 21 | |
| 22 | {{{ |
| 23 | offset| data | comment |
| 24 | 0000 | 00 00 01 e7 c3 65 | write 0x65 to 0xe7c3 to select FORME |
| 25 | 0006 | 00 1f 80 40 00 xx xx xx | write 8064 bytes to 0x4000 (VRAM) |
| 26 | 1f8c | 00 00 01 e7 c3 64 | write 0x64 to 0xe7c3 to select COULEUR |
| 27 | 1f91 | 00 1f 80 40 00 xx xx xx | write 8064 bytes to 0x4000 (VRAM) |
| 28 | 3f16 | ff 00 00 00 00 | end marker |
| 29 | }}} |
| 30 | |
| 31 | Here is a BASIC 128/512 program to load such a file : |
| 32 | {{{ |
| 33 | 10 REM CHARGEMENT D'UNE IMAGE GrafX2 |
| 34 | 20 REM (C) THOMAS BERNARD |
| 35 | 30 LOCATE,,0 'DESACTIVE CURSEUR |
| 36 | 40 LOADM"POISCTO8" |
| 37 | 50 REM PALETTE EN VRAM APRES L'IMAGE |
| 38 | 60 FOR I=0 TO 15 |
| 39 | 70 BGR=PEEK(&H4000+8000+I*2)*256+PEEK(&H4000+8000+I*2+1) |
| 40 | 80 PALETTE I,BGR |
| 41 | 90 NEXT I |
| 42 | 100 IF INKEY$="" GOTO 100 |
| 43 | 110 LOCATE,,1 'ACTIVE CURSEUR |
| 44 | 120 REM AFFICHAGE DU COMMENTAIRE |
| 45 | 130 FOR I=0 TO 31 |
| 46 | 140 C=PEEK(&H4000+8032+I) |
| 47 | 150 IF C>=32 AND C<127 THEN PRINT CHR$(C); |
| 48 | 160 NEXT I |
| 49 | 170 PRINT |
| 50 | }}} |
| 51 | |
| 52 | |