Hello everyone, it's been a very long time since I have played around with AGI/SCI. I used to run agigames.com many many years ago.
I am working on some tools and libraries for AGI and in the save game specification, I noticed something in the general state section that does not make much sense to me. The "Text Attribute value" which is 2 bytes "1489-1490" would be 16 bits, however it only mentions:
background color in top 4-bits, foreground in bottom 4-bits
So it only talks about 8 of the 16 bits. Is there something I am not understanding or am missing? Hopefully somebody here with more experience might be able to shed some light.
The game state section of the save file is actually a literal dump of memory; it varies from version to version, so I'd be careful about treating it as a 'format'. The size of the game state memory dump goes from 987 bytes in v2.089 to 1508 bytes in v3.002.102/3.002.107.
That being said, regarding the text attribute memory location, it is a 16 bit word, but only the lower 8 bits are used.
Keep in mind this value gets recalculated everytime AGI prints text on the screen, regardless of display mode. When in graphics mode, if BG is 0 (black), FG is stored at this location. If BG is non-zero, AGI stores a value of 0x008F in this location. (The graphics routines use this value of 0x008F to display black text on a white background).
If in text mode, AGI combines the FG and BG values into a single 16 bit number, by shifting the BG left by four bits, then AND-ing it with FG.
Also note that this value is only used internally to support the graphics subroutines. While it is stored in the save file (because it's in the block of memory that gets dumped), it isn't really needed because AGI recalculates it everytime it needs it when drawing text on the screen.