Copy Link
Add to Bookmark
Report
Atari resource structure (file)
Resource structure (file)
A resource file (*.RSC) is normally loaded with ~RSRC_LOAD(filenamne), which allocates memory for the file, and then performs:
- internal AES pointer initialization (ADDROUT(0)= tree%)
- conversion of character coordinates to pixel coordinates in the current resolution (ie ~RSRC_OBFIX(tree%,obj%) for each object)
- pointer conversion (L:ob_spec and others) from file relative to memory absolute (see file structure below)
The RSC-file is structured as at least five distinct blocks:
- a file header (18 words, 36 bytes)
- a text block with all strings, masks and type info
- an info block with L:pointers (TEDINFO to texts...)
- a tree info block (L:ob_spec pointers) (n x 24 bytes)
- a relocation table (L: rel ptrs, n x 4 bytes)
It should be noted that the program variable tree% obtained with the function ~RSRC_GADDR(0,0,tree%) points to the (first) tree info block, not the beginning of the file as located in memory. Filestart is thus at:
<tree%> - <W:rsh_vrsn>
File header (18 words)
+00 1 W:rsh_vrsn (editor ID#, usually 0 or 1)
--- offset pointers
+02 2 W:rsh_object (relative) to (first) tree info (object field)
3 W:rsh_tedinfo position of the TEDINFo structs
4 W:rsh_iconblk position of the ICONBLK structs
5 W:rsh_bitblk position of the BITBLK struct
6 W:rsh_frstr position of the free strings
7 W:rsh_string position of fixed strings
8 W:rsh_imdata position of imagedata
9 W:rsh_frimg position of the free images
10 W:rsh_trindex (relative) to relocation table
--- structure info
+20 11 W:rsh_nobs total number of objects
12 W:rsh_ntree Obj trees (must be >=1 for valid RSC-file)
13 W:rsh_nted total number of TEDINFO structs
14 W:rsh_nib total number of ICONBLK structs
15 W:rsh_nbb total number of BITBLK structs
16 W:rsh_nstring total number of strings
17 W:rsh_nimages total number of images
18 W:rsh_rssize file length (should be same as LOF when loading)
--- --- ---
+36 start of text strings
Notes:
- K saves with W(1) id#=1.
- K-resource rejects files if W(18)<>LOF().W(18) may be poked to correct (actual) size to fix this.