VOGONS


MartyPC

Topic actions

Reply 560 of 567, by SoftCat

User metadata
Rank Member
Rank
Member

Could you tell me which emulator is best for testing EGA scrolling in 0Dh and 0Eh modes? I want to do this for each of four video RAM sizes: 64 KB, 128 KB, 192 KB, and 256 KB.

Reply 561 of 567, by superfury

User metadata
Rank l33t++
Rank
l33t++

UniPCemu supports EGA/VGA as well as it's possible (to the cycle rendering level, and even supports SVGA to that level and more features than any other known emulators on the Tseng chipsets), more accurate than any other emulators.
Then again, right now, current commits have some unknown CPU issues (Windows 3.x not booting anymore in 32-bit mode), but 16-bit mode probably still works (on 3.1 and lower). MS-DOS also seems to run fine still (even with Virtual memory managers and EMS managers like EMM386).
No clue yet as what's causing WFW 3.11 to crash during boot. All I see is a single page fault in protected mode CPL 0 before the crash happens, which is on some EIP address (being not present in any PTE/PDE combination). That shouldn't happen from what I know? So right now, at least 9x/3.x in 32-bit mode doesn't boot (16-bit mode still boots, like 3.1/3.0 and MS-DOS itself ofc).

I get through the installation wizard without issues, but when booting the OS, I see a single page fault on CPL 0 that crashes the sub-OS (sub because MS-DOS is effectively the main OS) back to text mode and hanging.
Edit: Hmm, odd. Windows 3.1 fails in 386 enhanced mode as well (like 3.11), while protected mode boots to the desktop and then doesn't respond to mouse/keyboard.
Edit: OK. Tried again without EMM386 and using /s switch. It runs fine now somehow.
Edit: And 3.0 also crashes with /3 parameter. Interesting.
Edit: So does 3.0 in standard mode (triple fault causing a reboot). Odd.
Edit: Real mode does boot properly though. Inputting any number in calc.exe gives me a defeault inputted value of "-0." (without quotes). Inputting any number gives me a "Result is too large for". Paintbrush seems to run fine.

Last edited by superfury on 2025-12-14, 23:33. Edited 2 times in total.

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 562 of 567, by SoftCat

User metadata
Rank Member
Rank
Member

Is it correct to simply assume that the EGA has 256 KB of video RAM and not worry about cases with a smaller volume?

Reply 563 of 567, by mkarcher

User metadata
Rank l33t
Rank
l33t
SoftCat wrote on 2025-12-14, 22:58:

Is it correct to simply assume that the EGA has 256 KB of video RAM and not worry about cases with a smaller volume?

No, it's not. There were EGA cards with just 64K in the wild. I guess 128K and 192K (two or three banks of 64K each) are quite rare. I've seen a YouTube video about someone playing with retro EGA cards, and one of the cards failed to display a couple of games correctly because it only had 64K of RAM installed.

Furthermore, if you target keen-like infinite scrolling, I think there is a control bit that makes the video RAM wrap around at 64K instead of 256K, but you can't have infinite scroll while you use 128K or 192K. If there is a 64K wrap-around mode you can use that mode on 128K or 192K cards as well and just use them like 64K cards.

Reply 564 of 567, by SoftCat

User metadata
Rank Member
Rank
Member
mkarcher wrote on 2025-12-14, 23:03:

No, it's not. There were EGA cards with just 64K in the wild. I guess 128K and 192K (two or three banks of 64K each) are quite rare. I've seen a YouTube video about someone playing with retro EGA cards, and one of the cards failed to display a couple of games correctly because it only had 64K of RAM installed.

Furthermore, if you target keen-like infinite scrolling, I think there is a control bit that makes the video RAM wrap around at 64K instead of 256K, but you can't have infinite scroll while you use 128K or 192K. If there is a 64K wrap-around mode you can use that mode on 128K or 192K cards as well and just use them like 64K cards.

Got it, thank you very much!
If the card has 64 KB and I'm using mode 0xE, the video buffer will occupy addresses 0xA000:0x0000 -- 0xA000:0x3E7F. What happens if I write starting at address 0xA000:0x4000?

Reply 565 of 567, by mkarcher

User metadata
Rank l33t
Rank
l33t
SoftCat wrote on 2025-12-14, 23:17:

Got it, thank you very much!
If the card has 64 KB and I'm using mode 0xE, the video buffer will occupy addresses 0xA000:0x0000 -- 0xA000:0x3E7F. What happens if I write starting at address 0xA000:0x4000?

I'm talking about the original EGA design that used 4 memory banks of 16K x 32 (using 8 chips of 16K x 4 per bank). In that design, a write to A000:4000 will be sent to the second bank, and as there are no chips in that bank, the write will end up ignored. The newer EGA clones having a single bank of 64K x 32 always have 256KB of RAM, so this question does not apply to them.

Furthermore, if you are exploring 64K EGA generally, you should be aware that mode 0F/10h are degraded to 4-color modes using odd/even mode. You only use bits 0 and 2 of the color numbers. You need to enable both planes 0 and 1 to write bit 0 and both planes 2 and 3 to write bit 2 of the color number. Even ISA bus addresses end up in planes 0 and 2, while odd ISA bus addresses end up in planes 1 and 3 (the other planes are automatically masked in odd/even mode writes, even if they are enabled in the map mask register). The ISA adresses 0 to 3FFF map to the even locations in EGA RAM, and thanks to a special control bit set in those modes, ISA address bit 14 is mapped to EGA address bit 0, so starting at ISA address 4000, you will access the odd locations of EGA RAM. The CRTC is accessing the RAM in word mode with 16 pixels per 32-bit unit and also address wrap at 4000 to match the ISA interface.

Reply 566 of 567, by superfury

User metadata
Rank l33t++
Rank
l33t++
SoftCat wrote on 2025-12-14, 23:17:
mkarcher wrote on 2025-12-14, 23:03:

No, it's not. There were EGA cards with just 64K in the wild. I guess 128K and 192K (two or three banks of 64K each) are quite rare. I've seen a YouTube video about someone playing with retro EGA cards, and one of the cards failed to display a couple of games correctly because it only had 64K of RAM installed.

Furthermore, if you target keen-like infinite scrolling, I think there is a control bit that makes the video RAM wrap around at 64K instead of 256K, but you can't have infinite scroll while you use 128K or 192K. If there is a 64K wrap-around mode you can use that mode on 128K or 192K cards as well and just use them like 64K cards.

Got it, thank you very much!
If the card has 64 KB and I'm using mode 0xE, the video buffer will occupy addresses 0xA000:0x0000 -- 0xA000:0x3E7F. What happens if I write starting at address 0xA000:0x4000?

From what I know about the EGA/VGA chipset, first 64K wrapping is applied (when the bit is enabled only), then the resulting address is directly addressed on the VRAM chips. When it's past the final address of the installed VRAM, the memory chip simply floats the bus on reads and doesn't respond on writes. So reads result in FFh being read and writes are effectively ignored. The memory itself is chains like plane 0 byte 0, plane 1 byte 0, plane 2 byte 0, plane 3 byte 0, plane 0 byte 1 etc. Basically modulo 4 is the plane and every 4 bytes a next byte on the four parallel planes.
So if only 64KB of memory is installed, that's only on addresses 0-3FFFh, 4000+ floating the bus (or doing nothing on writes). If the wrapping is applied, the 64KB of memory (0-3FFFh in 32-bit memory) will repeat accross the 256KB memory address space.

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 567 of 567, by SoftCat

User metadata
Rank Member
Rank
Member
mkarcher wrote on Yesterday, 06:26:

I'm talking about the original EGA design that used 4 memory banks of 16K x 32 (using 8 chips of 16K x 4 per bank). In that design, a write to A000:4000 will be sent to the second bank, and as there are no chips in that bank, the write will end up ignored. The newer EGA clones having a single bank of 64K x 32 always have 256KB of RAM, so this question does not apply to them.

Furthermore, if you are exploring 64K EGA generally, you should be aware that mode 0F/10h are degraded to 4-color modes using odd/even mode. You only use bits 0 and 2 of the color numbers. You need to enable both planes 0 and 1 to write bit 0 and both planes 2 and 3 to write bit 2 of the color number. Even ISA bus addresses end up in planes 0 and 2, while odd ISA bus addresses end up in planes 1 and 3 (the other planes are automatically masked in odd/even mode writes, even if they are enabled in the map mask register). The ISA adresses 0 to 3FFF map to the even locations in EGA RAM, and thanks to a special control bit set in those modes, ISA address bit 14 is mapped to EGA address bit 0, so starting at ISA address 4000, you will access the odd locations of EGA RAM. The CRTC is accessing the RAM in word mode with 16 pixels per 32-bit unit and also address wrap at 4000 to match the ISA interface.

Thank you very much for your detailed answer!
As far as I know, mode 0Fh is 4-color in any case. It's designed for use with a monochrome monitor.
If, with 64 KB of video RAM on an EGA graphics card, the video buffer contents were repeated four times in segment 0A000h for mode 0Eh, then infinite scrolling would work exactly the same as with 256 KB of video RAM.
And on SVGA, infinite scrolling would simply loop at 512 KB or 1024 KB. It's all rather complicated.