First post, by llm
this code is part of a EGA/VGA 320x200x16 color DOS game reverse engineering project - i have no real knowledge about legacy video code stuff except the easy peasy Mode 13h with 256 colors per pixel-byte
does that code change the internal EGA/VGA palett?
// bytes comming from a game picture filestd::vector<uint8_t> color_data{00 05 01 03 00 3A 03 05 38 07 39 3A 3E 3C 04 3F};// used this wayfor(int index = 0; index < color_data.size(); ++i){cli();// force index stateinb(0x3DA);outb(0x3C0, index); // activate cpu-access + color-indexoutb(0x3C0, color_data[index]); // color data// force index stateinb(0x3DA);outb(0x3C0, 0x20); // activate video accesssti();}
i've found the infos about behavior of port 0x3C0 and 0x3DA here https://github.com/cirosantilli/ralf-brown-in … d/PORTS.B#L4666
the index is the color-index but the data part of 0x3C0 is not fully clear to me
indexed registers in ATC (flipflop set to 'data'): (see #P0662)Bit(s) Description (Table P0663)7-6 reserved5 secondary red video4 secondary green/intensity video3 secondary blue/mono video2 primary red video1 primary green video0 primary blue video
Question 1:
what is a secondary blue/mono video bit and a green/intensity video bit?
Question 2:
aren't port 0x3c8(color-index) and 0x3c9(R,G,B) used for color palett changing?
Question 3: could have the code be written like that?
std::vector<uint8_t> color_data{00 05 01 03 00 3A 03 05 38 07 39 3A 3E 3C 04 3F};cli();// force index stateinb(0x3DA);for(int index = 0; index < color_data.size(); ++i){outb(0x3C0, index); // activate cpu-access + color-indexoutb(0x3C0, color_data[index]); // color data}outb(0x3C0, 0x20); // activate video accesssti();