VOGONS


First post, by chjmartin2

User metadata
Rank Newbie
Rank
Newbie

Hi,

Does anybody know of a tool that would extract CGA/EGA graphics data from Prince of Persia and a way to send them back? For some reason that I am not sure I understand I would like to see how involved it would be to edit the graphics and enabled a Composite CGA mode Prince of Persia. The only tools I can find extract the VGA data and it is very clear that the CGA and EGA versions do not appear to be interpreted from the VGA version, they appear to be completely independent graphics. The other thing to figure out would be how to get colorburst enabled and get it into 640x200 mode although you could just use the 4 color mode we have but that palette isn't as ideal as the 640x200 mode. Any ideas on where to start?

Chris

Reply 1 of 8, by VileR

User metadata
Rank l33t
Rank
l33t

Interesting question... I guess I'd start with Princed Graphics Extractor which includes C sources. Looks like it can extract all the graphical .DATs, CGA/EGA included. I didn't look too closely, but at least the created .raw chunks appear to be correct. The CGA .bmp results have the wrong palette (all black), but that can probably be fixed in the source. More importantly, you get a .txt description of each .DAT you extract - and since you have the decompression code in the source, that could help recreate them with the modified graphics.

FWIW, I think the EGA data won't help you much; it has the wrong bit-depth, and the colors don't map 1:1 to any composite CGA palette anyway.

Changing the CGA mode-setting code (to set up mode 6 and disable the BW bit) is probably easier, but likely requires a few more bytes of code than whatever it currently does. So you'd have to look into the various versions of the .EXE and find somewhere to add it, then patch the original code to call/jump to your new code instead.

[ WEB ] - [ BLOG ] - [ TUBE ] - [ CODE ]

Reply 2 of 8, by chjmartin2

User metadata
Rank Newbie
Rank
Newbie
VileR wrote on 2022-12-09, 19:02:

Interesting question... I guess I'd start with Princed Graphics Extractor which includes C sources. Looks like it can extract all the graphical .DATs, CGA/EGA included. I didn't look too closely, but at least the created .raw chunks appear to be correct. The CGA .bmp results have the wrong palette (all black), but that can probably be fixed in the source. More importantly, you get a .txt description of each .DAT you extract - and since you have the decompression code in the source, that could help recreate them with the modified graphics.

FWIW, I think the EGA data won't help you much; it has the wrong bit-depth, and the colors don't map 1:1 to any composite CGA palette anyway.

Changing the CGA mode-setting code (to set up mode 6 and disable the BW bit) is probably easier, but likely requires a few more bytes of code than whatever it currently does. So you'd have to look into the various versions of the .EXE and find somewhere to add it, then patch the original code to call/jump to your new code instead.

Thank you for the tool - it will be useful. I'm not ever sure where to start on the CGA mode-setting - funny that you say it is easier as I think the easiest part would be editing/creating the composite graphics. I searched the PRINCE.EXE that I have and looked for the mode control register (03D8) and found several instances of it, but I have NEVER created a patch, so it is completely new to me for sure. Any insight you could provide on a better hex editor or disassembler that may yield help me along the way?

Lastly and this is for anybody that reads the thread. What would be the best version to patch for CGA? Would it be the 1.4 version or a much older one?

Reply 3 of 8, by chjmartin2

User metadata
Rank Newbie
Rank
Newbie

Hi,

Well I finally got back to this topic. I haven't done anything with editing graphics but I did get the first part I wanted to done - a launcher that allows you to set and keep a different CGA mode persistent. You NEED to use Prince of Persia 1.3 and put the CGAPRINC.COM file in the directory. You run it and select the mode and it will launch. Initially I thought it would be cool to run Prince in the tweaked CGA mode but if we can do that then we can set any mode - including composite. You can also select background colors although it does eliminate some of the effects (like when you get the sword) that use a flashing background color change. Any other background besides black, dark blue or dark grey isn't really worth using unless you like that sort of thing. You can choose a 640x200 mode and pick the foreground, don't make the mistake of selecting 0 or you won't get anything! I like how the bright green looks - reminds me of an Apple II green screen monitor. The next thing I have to do is extract the graphics and figure out how to make a much better composite version - this is not my skillset so not sure where to start, but nice to know it can be done.

(I have been reminded that it has been 1,337 days since the last post here which is just under 4 years ago, better late than never.)

Chris

The attachment text.png is no longer available
The attachment tweaked.png is no longer available
The attachment green.png is no longer available
The attachment composite.png is no longer available
Last edited by chjmartin2 on 2026-08-10, 01:41. Edited 1 time in total.

Reply 4 of 8, by chjmartin2

User metadata
Rank Newbie
Rank
Newbie

Some other shots...

The attachment yellowgreenblue.png is no longer available
The attachment redgreenbrown.png is no longer available
The attachment blackwhite.png is no longer available

Reply 5 of 8, by chjmartin2

User metadata
Rank Newbie
Rank
Newbie

I need insight. If I am going to design a composite Prince of Persia - should I optimize for OLD CGA or NEW CGA composite?

Reply 7 of 8, by VileR

User metadata
Rank l33t
Rank
l33t

(I have been reminded that it has been 1,337 days since the last post here which is just under 4 years ago, better late than never.)

Nice work! 1337 indeed 😉

chjmartin2 wrote on Yesterday, 12:38:

I need insight. If I am going to design a composite Prince of Persia - should I optimize for OLD CGA or NEW CGA composite?

If you're sticking with mode 6 and white/grey as the underlying foreground, the graphics will look very similar on both board revisions ('new' CGA is more saturated, but the hues and levels are close enough). The tradeoff is that effects like the sword pickup will momentarily change the palette instead of the background.
If you go with mode 4, then any artifact colors generated using non white pixel data will look different, so it would also depend on which palette(s) you find more 'useful'. Although it could also be fun to try two separate graphics sets...

BTW: in the Apple II version, the static screens (but not the game or the animated cut scenes) use DHGR mode, which has the exact same palette you get on an 'old'-style CGA in mode 6 with a white foreground. The resolution is different, but if I was converting the colors for those screens, that'd be a good reference.

chjmartin2 wrote on Yesterday, 01:39:

The next thing I have to do is extract the graphics and figure out how to make a much better composite version - this is not my skillset so not sure where to start

At one point I was going to write a sort of guide to creating composite graphics, back when I did those Keen 4 and Keen 5 mods. Never got to do that, but I can recommend a general approach: always work at 640x200, and if you're using a "modern" image editor, find some way to overlay each color of your working artifact palette with the actual bit patterns that would generate it in your target mode (e.g. photoshop's fill layers and blending options). Of course if you use an oldschool CGA graphics program, you can do it in DOSBox and get a constant live preview.

In any case, try to avoid the naive "each nybble is a solid pixel" approach (treating a composite screen as a simple 160x200 bitmap). Both old and new games have done that, which is a pity since it misses out on a lot of potential detail.

On the other hand, if you're actually looking for an artist then it could be intersting to collaborate on this...

[ WEB ] - [ BLOG ] - [ TUBE ] - [ CODE ]

Reply 8 of 8, by BitWrangler

User metadata
Rank l33t++
Rank
l33t++

Interesting, gotta file this in the "When 5155 is working and plugged to 14in Monitor-TV" stuff to try. Presuming it will work on the EGA Wonder I'm planning on having in there.

Unicorn herding operations are proceeding, but all the totes of hens teeth and barrels of rocking horse poop give them plenty of hiding spots.