VOGONS

Common searches


How does Sierra's EGA640.DRV even work?

Topic actions

First post, by Good_Punk

User metadata
Rank Newbie
Rank
Newbie

I've recently stumbled over this driver and how it "emulates" VGA graphics on an EGA display.
Has anybody here taken a closer look at it and can explain to me how this thing works?

I'd be interested to create a youtube video on the topic and I would like to explain what that driver does and how it achieves the dithering and how it slots into the Sierra engine.

Generally any information on that thing might be helpful and highly appreciated. 😀

Reply 3 of 64, by Good_Punk

User metadata
Rank Newbie
Rank
Newbie
ripsaw8080 wrote on 2021-12-21, 17:34:

Thanks, that's definetly helpful. Would be interesting to understand the logic behind how the driver choses the colors and creates the dither patterns. But you would probably have to reverse engineer it.

Reply 5 of 64, by Peter Swinkels

User metadata
Rank Member
Rank
Member

I have tried reverse engineering binaries. This is very time consuming and tedious. My advice would be to observe the driver's behaviour using a debugger. Perhaps a memory dumper or something that takes a snapshot of the current color palette.

Do not read if you don't like attention seeking self-advertisements!

Did you read it anyway? Well, you can find all sorts of stuff I made using various programming languages over here:
https://github.com/peterswinkels

Reply 7 of 64, by Good_Punk

User metadata
Rank Newbie
Rank
Newbie
ripsaw8080 wrote on 2021-12-22, 08:48:

FYI, some LucasArts adventure games offer the same kind of dithering with their "e" display option: Monkey Island 256-color, Monkey Island 2, Fate of Atlantis.

Yes... I found that out by accident... I had set DosBox zu EGA machine and started MI2. 😁 (You don't need the display option then)
Also Start Trek 25th Anniversary Edition seems to be able to do that as well but I have to buy that game first to try it out myself. 😀

Reply 10 of 64, by mkarcher

User metadata
Rank Oldbie
Rank
Oldbie

I remember the 256-color versions of early LucasArts games (like Monkey Island 1) including a README that asked EGA owners to swap the game with the 16-color version if the dithering is too slow. And indeed, on a 12 MHz 286 computer with a slow (for today's standards) 8-bit VGA card, Indiana Jones and the Fate of Atlantis was updating the screen quite slowly if you forced it to EGA mode. Actually, I wonder how many machines were fast enough that the dithering wasn't annoyingly slow, but didn't support the VGA 256-color mode.

Reply 12 of 64, by Peter Swinkels

User metadata
Rank Member
Rank
Member

Look under the header "3C0-3CF EGA/VGA" at http://helppc.netcore2k.net/hardware/ports

That may contain some useful info, and at the risk of attention seeking self-advertising, possibly my Github page (see signature) will contain a few useful things. Probably nothing that will help with your immediate question but there is stuff about x86 assembly programming, memory dumping, screen dumping, and a Quick Basic program about video modes there.

PS:
I did a quick check of my games collection. It seems there several versions of EGA640.drv - I several of my games have a copy with a different size than the other.

Another PS:
Glancing with Microsoft Editor (it supports opening binary files) it seems each copy contains a header describing the driver followed by a repetitive data segment which is followed by a few kilobytes of varying binary values. Probably x86 machine code but don't hold me to it. The data segment looks like it could very well contain a color palette. Each version is approx 5-10kb in size.

Do not read if you don't like attention seeking self-advertisements!

Did you read it anyway? Well, you can find all sorts of stuff I made using various programming languages over here:
https://github.com/peterswinkels

Reply 13 of 64, by llm

User metadata
Rank Member
Rank
Member
Peter Swinkels wrote on 2021-12-22, 20:43:

PS:
I did a quick check of my games collection. It seems there several versions of EGA640.drv - I several of my games have a copy with a different size than the other.

table with some game names + sizes + MD5?

Reply 14 of 64, by llm

User metadata
Rank Member
Rank
Member

i've disassembed "Freddy Pharkas - Frontier Pharmacist\EGA640.DRV" with my IDA 6.8 (IDA Freeware 5 should give the same result): https://pastebin.com/NfeghyDy
is not that much assembler code - if one can read assembler 😀

Reply 15 of 64, by Good_Punk

User metadata
Rank Newbie
Rank
Newbie

I've found out that I could copy the EGA640.DRV from Space Quest 5 over to my Larry 5 and Police Quest 3 version that both didn't include it. The games run but unfortinaetly the mouse cursor is not showing anymore. So my guess would be that you need extra cursor images for EGA and those were only supplied when the game actually supported it? (I know there are Larry5 and PQ3 versions WITH ega support but mine don't have that unfortunately)
EcoQuest1 on the other hand worked even with mouse cursor when I copied the EGA640 file over. 😀

Reply 16 of 64, by mkarcher

User metadata
Rank Oldbie
Rank
Oldbie
llm wrote on 2021-12-23, 06:01:

(IDA Freeware 5 should give the same result):

Just a hint: IDA Freeware 5 is obsolete. Currently, IDA Freeware is at 7.6, see https://hex-rays.com/ida-free/#download . For reverse-engineering 16-bit DOS stuff, IDA 5 should be good enough, or possibly even better, though.

Reply 17 of 64, by llm

User metadata
Rank Member
Rank
Member
mkarcher wrote on 2021-12-23, 07:08:
llm wrote on 2021-12-23, 06:01:

(IDA Freeware 5 should give the same result):

Just a hint: IDA Freeware 5 is obsolete. Currently, IDA Freeware is at 7.6, see https://hex-rays.com/ida-free/#download . For reverse-engineering 16-bit DOS stuff, IDA 5 should be good enough, or possibly even better, though.

i've got a full version IDA 7.6/Hex-rays at work so i know that there are new versions 😀 - my private license 6.8 is just a little bit older

the IDA Freeware 7 is very downsized - can't handle DOS exe/com or binary files - only Win PE executables - so it can't be used for most DOS reverse engineering stuff
Scummvm is now the official hoster of the old IDA 5 Freeware for that reason: https://www.scummvm.org/news/20180331/

but Ghidra (https://ghidra-sre.org/) is getting better and better - but still not on IDA level (compiler and library detection even for 1985 C compilers, Interrupt documentation etc. is just great with IDA) - Ghidra missing much of that

Reply 18 of 64, by Peter Swinkels

User metadata
Rank Member
Rank
Member

@ilm:

file.php?mode=view&id=126365

Attachments

  • ega640.png
    Filename
    ega640.png
    File size
    131.39 KiB
    Views
    498 views
    File license
    Public domain

Do not read if you don't like attention seeking self-advertisements!

Did you read it anyway? Well, you can find all sorts of stuff I made using various programming languages over here:
https://github.com/peterswinkels