CRT Controller Emulation
- TheMechanist
- Posts: 71
- Joined: Mon 03 Apr, 2017 6:59 pm
- Contact:
CRT Controller Emulation
Hi,
first, PCem is a great piece of software ! Thanks for your effort. First time booting the AMI 286er and installing MS DOS 5.0 felt like a time travel back to the 90ies to my children's room
I'm doing some DOS 16 Bit retro demo stuff targeting 286er machines and I've chosen PCem 'cause of it's known cycle accuracy .. some of the effects use direct CRTC programming, atm just documented functions that can be found in VGA reference manuals.
A smooth vertical scrolling in text mode 80x25, characters height 16 pixels/scanlines, is done by programming the CRTC Register with index 8 - "Preset Row Scan Register", and writing bits 0 - 4, to shift that amount of scanlines. It works flawlessly in DOSBox, but not with PCem v12 - neither with linux nor with windows builds -, no matter wich VGA Bios is used. Writing e.g. "Start Address High/Low Register" works; that's why the lines are shifted only by character height, which is not smooth
http://www.osdever.net/FreeVGA/vga/crtcreg.htm
I'm not sure how far the development has come .. is it a bug or an atm not implemented function ?
Btw. the linux build doesn't recognize et4000.bin while windows build does
Greetz
TheMechanist
first, PCem is a great piece of software ! Thanks for your effort. First time booting the AMI 286er and installing MS DOS 5.0 felt like a time travel back to the 90ies to my children's room
I'm doing some DOS 16 Bit retro demo stuff targeting 286er machines and I've chosen PCem 'cause of it's known cycle accuracy .. some of the effects use direct CRTC programming, atm just documented functions that can be found in VGA reference manuals.
A smooth vertical scrolling in text mode 80x25, characters height 16 pixels/scanlines, is done by programming the CRTC Register with index 8 - "Preset Row Scan Register", and writing bits 0 - 4, to shift that amount of scanlines. It works flawlessly in DOSBox, but not with PCem v12 - neither with linux nor with windows builds -, no matter wich VGA Bios is used. Writing e.g. "Start Address High/Low Register" works; that's why the lines are shifted only by character height, which is not smooth
http://www.osdever.net/FreeVGA/vga/crtcreg.htm
I'm not sure how far the development has come .. is it a bug or an atm not implemented function ?
Btw. the linux build doesn't recognize et4000.bin while windows build does
Greetz
TheMechanist
Re: CRT Controller Emulation
TheMechanist wrote: [...] Btw. the linux build doesn't recognize et4000.bin while windows build does [...]
Looking at the code, i think that you need to renamed it because on Linux filenames are case sensitive (and PCem is searching for et4000.BIN file).
On Windows it works because the case is ignored if file is open with a Win32 program (like Pcem).
- TheMechanist
- Posts: 71
- Joined: Mon 03 Apr, 2017 6:59 pm
- Contact:
Re: CRT Controller Emulation
okay, that should be uniform for all required files .. I renamed all rom files to lowercase since it was recommended in that forum 'cause of case sensitivity, in most cases it works ..AmatCoder wrote: .. PCem is searching for et4000.BIN file ...
Regarding the CRTC Bug - any idea ? I looked at the source code but I have no idea where to start and where the problem could be
- SarahWalker
- Site Admin
- Posts: 2054
- Joined: Thu 24 Apr, 2014 4:18 pm
Re: CRT Controller Emulation
Register 8 isn't currently emulated I'm afraid. I can add it, but probably not until the weekend.
- TheMechanist
- Posts: 71
- Joined: Mon 03 Apr, 2017 6:59 pm
- Contact:
Re: CRT Controller Emulation
Hi Sarah, wow, thanks ! There's no rush .. do you have an overview which CRT / Sequencer Registers are not emulated ?SarahWalker wrote:Register 8 isn't currently emulated I'm afraid. I can add it, but probably not until the weekend.
Btw. I tried some 199x PC Demos/intros
check it out: http://www.pouet.net/prodlist.php?platf ... &reverse=1
and a lot of them performed really well, which is the ultimate accolade for your emulator since the scene uses a lot of undocumented vga tweaks to enable graphic effects .. good job !
I guess PCem could be the perfect environment for demo parties with an oldschool pc demo compo !
- TheMechanist
- Posts: 71
- Joined: Mon 03 Apr, 2017 6:59 pm
- Contact:
Re: CRT Controller Emulation
Seems, that PCem doesn't atm support Mode 320x240x256 (called "Mode-X") ..
http://www.jagregory.com/abrash-black-b ... color-mode
see Listing 47.1
It's essentially changing some CRT registers, which you can see in the listing step by step .. when changing these registers, PCem stays with 200 scanlines ..
This Mode-X is reported to work on every piece of real VGA Hardware (Dosbox supports it), Software & Games used it, so it's not just a freaky tweak for some hardcore nerds . Not high priority but should be supported on a long term basis for perfect emulation.
btw. 320x200 unchained mode works.
http://www.jagregory.com/abrash-black-b ... color-mode
see Listing 47.1
It's essentially changing some CRT registers, which you can see in the listing step by step .. when changing these registers, PCem stays with 200 scanlines ..
This Mode-X is reported to work on every piece of real VGA Hardware (Dosbox supports it), Software & Games used it, so it's not just a freaky tweak for some hardcore nerds . Not high priority but should be supported on a long term basis for perfect emulation.
btw. 320x200 unchained mode works.
- SarahWalker
- Site Admin
- Posts: 2054
- Joined: Thu 24 Apr, 2014 4:18 pm
Re: CRT Controller Emulation
Umm, pretty sure 320x240x256 works, and always has. Any examples of anything using it that doesn't work?
- TheMechanist
- Posts: 71
- Joined: Mon 03 Apr, 2017 6:59 pm
- Contact:
Re: CRT Controller Emulation
oh, sorry, maybe my fault .. atm only my code, I initialized the mode like Michael Abrash did, in Dosbox it went fine .. I'll check it again and tell you if I find the bug, perhaps PCems emulation is simply more realistic than dosbox and doesn't forgive coders inaccuracies !
- TheMechanist
- Posts: 71
- Joined: Mon 03 Apr, 2017 6:59 pm
- Contact:
Re: CRT Controller Emulation
After a lot of testing, I have to deeply apologise to you - yes, Mode-X works with PCem, and not just 320x240 but a lot of modes I even didn't know that they are available
http://www.pouet.net/prod.php?which=66241 - I tested 320x240, 256x240, 360x360 and even 376x564
As guessed - since my code worked with Dosbox - PCem is much more accurate and even small differences in the register data matter - obviously dosbox just guesses, what the coder wanted to do .. one reason more for me, to test with PCem !
http://www.pouet.net/prod.php?which=66241 - I tested 320x240, 256x240, 360x360 and even 376x564
As guessed - since my code worked with Dosbox - PCem is much more accurate and even small differences in the register data matter - obviously dosbox just guesses, what the coder wanted to do .. one reason more for me, to test with PCem !
- TheMechanist
- Posts: 71
- Joined: Mon 03 Apr, 2017 6:59 pm
- Contact:
Re: CRT Controller Emulation
Seems, that PCem 13.1 doesn't emulate it .. would be nice for future releases to get a fully emulated crt controller, I guess some games use smooth vertical scrolling and other hacks too ..SarahWalker wrote: ↑Tue 04 Apr, 2017 8:16 pm Register 8 isn't currently emulated I'm afraid. I can add it, but probably not until the weekend.
Btw. PCem 13.1 rocks ! Excellent gui ..
- SarahWalker
- Site Admin
- Posts: 2054
- Joined: Thu 24 Apr, 2014 4:18 pm
Re: CRT Controller Emulation
Sorry, my bad - forgot in the mess surrounding the v13 release. Added in rev 1015.