Author Topic: Save game specification  (Read 236 times)

0 Members and 1 Guest are viewing this topic.

Offline cromer

Save game specification
« on: March 23, 2019, 04:48:56 PM »
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:
Quote
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.


Chris Cromer

Offline Kawa

Re: Save game specification
« Reply #1 on: March 23, 2019, 06:33:28 PM »
Seems to me it's just an eight-bit value saved as sixteen-bit.

Offline AGKorson

Re: Save game specification
« Reply #2 on: March 23, 2019, 07:06:24 PM »
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:
Quote
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 1528 bytes in v3.002.149.

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.
« Last Edit: March 24, 2019, 10:07:50 AM by AGKorson »

Offline Collector

Re: Save game specification
« Reply #3 on: March 23, 2019, 09:09:47 PM »
Hey, welcome Chris! We are getting a number of people from the AGI glory days showing up here. Lance Ewing is a semi regular here. Recently we even had Peter Kelly registering an account here. This forum is the closest thing to an heir of the old Mega Tokyo. Hope you can stick around.

You may be interested the internal Sierra AGI documentation, tools and some source that Omer posted here. I updated the Visual AGI source that you gave me and Lance is now working on it, too. AGKorson may also be helping. I also salvaged what remains of your AGI Wiki and added it to our new Wiki -- http://agiwiki.sierrahelp.com/
KQII Remake Pic

Offline cromer

Re: Save game specification
« Reply #4 on: March 25, 2019, 02:27:56 PM »
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:
Quote
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 1528 bytes in v3.002.149.

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.
Thanks this information helps a lot. I don't suppose there is a specification on what is dumped from memory for each version of AGI? I am trying to write the library to be as exact as possible, this should allow original agi game saves to be used in things like interpreters or saved game editors, etc if they use the library.

Quote
Hey, welcome Chris! We are getting a number of people from the AGI glory days showing up here. Lance Ewing is a semi regular here. Recently we even had Peter Kelly registering an account here. This forum is the closest thing to an heir of the old Mega Tokyo. Hope you can stick around.

You may be interested the internal Sierra AGI documentation, tools and some source that Omer posted here. I updated the Visual AGI source that you gave me and Lance is now working on it, too. AGKorson may also be helping. I also salvaged what remains of your AGI Wiki and added it to our new Wiki -- http://agiwiki.sierrahelp.com/
Hello Collector. I had noticed those tools and resources, I actually had ended up crawling the forum and downloading as much of that stuff as I could find. I got the idea to dig into AGI a bit now that I am studying computer science at the university. I have been playing around with SDL and GTK a lot and figured I would like to try making some library and tools for native linux, especially since almost all of the existing ones are designed for windows.
Chris Cromer


SMF 2.0.14 | SMF © 2017, Simple Machines
Simple Audio Video Embedder

Page created in 0.121 seconds with 24 queries.