• Please review our updated Terms and Rules here

RealDOOM: A port of DOOM to Real Mode

OK, it's almost always the case that EMS is not working as expected in these cases. (One of the last things I want to add before a public alpha is an EMS diagnostic at startup to find these issues and give a more accurate description of the problem).

Looks like the previous version you tried last year had some complications like E000 UMB requirements but thats all gone now and the current version should also be able to use CC00 as your page frame with no issue (as we can see in the screenshot)

Anyway, Everex EV 159 seems to exist on 86box. I may be able to figure out through that implementation how it works and create a SQEMM driver for it. Then in theory that should work for you. Or I may be able to fiddle around with the existing Everex driver and figure out a working setup.

I'd like to confirm - are you using backfill via the everex card? That is required for RealDOOM. The manual states under features - "Allows the "window" to use pages in the backfill memory area (the base memory area between 256K and 640K)" so it should be possible.
 
Well, I've checked everywhere, and there seems to be no where I can configure anything related to backfilling. The only mention in the manual that I've found is in the "features" section: "Allows the "window" to use pages in the backfill memory area (the base memory area between 256K and 640K).
 
Well, I've checked everywhere, and there seems to be no where I can configure anything related to backfilling. The only mention in the manual that I've found is in the "features" section: "Allows the "window" to use pages in the backfill memory area (the base memory area between 256K and 640K).

I looked at the manual and my guess is you want the starting address to be 256K (40000H) as designated in table 2, SW3 positions 2-8 as OFF OFF OFF OFF OFF ON OFF. Section 3.3 also talks more about the details of card taking up conventional memory space.

One thing I haven't tested yet - what I worry about with 286 boards and chipsets is that many seem to have 512k as a minimum memory amount (256Kx1 memory chip times sixteen, or 256Kx8 SIMM times 2). I'm not sure how they support a card like this with backfill - if the memory controller can be configured to ignore that extra onboard memory and route to the ISA bus, etc. Possibly its not supported especially on earlier chipsets.

If this ends up being a problem then you would need to set the starting address of the card to 0 instead of 256k. If you did this, Then you would probably have to remove all the system memory. But if you had 3 MB on the card that would then be enough to run RealDOOM. (256K base + 2MB EMS)
 
Hi! thanks, i tried just to be sure, every SQEMM (1-11), headaka, last byte memory manager, etc no luck

My board is a Zida TD60C, it can have a max of 17mb ram, 16mb in SIMMM and 1mb onboard in DIPP, right now i have 1mb dipp and 4mb simm 60ns, works real good, but lack of ems is a pain sometimes. I will be happy to help in anything

thanks!

OK, I finally got a chance to take a look at my two Citygate boards. I have a TD60 chipset board by PC Chips with 2 MB max (dips only). This one actually supports EMS with a clone of the C&T NEAT implementation according to my notes from over a year ago. Then, the Zida TD60C which I have just like you, oddly, has the TD90 as you mentioned. I mistakenly assumed it had a TD60 like the board name but it's different. The only bios online seems to not expose any options for EMS or UMBS. However it does have shadowing options and I can't figure out how they are enabled on the chip. There are no chipset documents online, so I can't say its impossible that UMB or EMS might exist, but it will require reverse engineering the BIOS and some guessing to know for sure. I may take a look at some point but you are right in that it's not so simple and may be impossible after all. But if the chipset supports shadowing then I would think UMB remapping shouldn't be too hard. Maybe this chipset was originally meant for a 386sx, where it would have made more sense to use EMM386 to enable UMBs and EMS while the bios would need a hand in shadowing.

---

I'm going to start to have time to work on RealDOOM again in the next week I think. I'll also revisit my headland EMS/board implementation over the next few weeks to make sure it is working. Then I will try to finish patching up the sound implementation in asm, and put in some EMS diagnostics and put out a public alpha. Then I work on either converting the rest of the project to ASM or I will try to support custom wads. Those are the 2 main things I want to do in addition to finishing any bugfixing.
 
I'm going to start to have time to work on RealDOOM again in the next week I think. I'll also revisit my headland EMS/board implementation over the next few weeks to make sure it is working. Then I will try to finish patching up the sound implementation in asm, and put in some EMS diagnostics and put out a public alpha. Then I work on either converting the rest of the project to ASM or I will try to support custom wads. Those are the 2 main things I want to do in addition to finishing any bugfixing.
Great news Patrick, I look forward to this!

I meant to ask you before, I have been having some trouble with the sound which has a lot of interference.
I am happy that I at least am able to hear the sound effects but a clear sound would be really nice too and when playing for a long time it would be more pleasant.

I wonder, is there a certain sound card that would work better?
I think you used a newer sound blaster card in your youtube gameplay videos?
There the sound is really great.
I meant to test with a different card, I also have a ISA soundblaster AWE64 card I think.
I need to check the software to get that card running, which is on another harddisk which I have here somewhere.

Anyway, it's really great to read about your plans!

Kind regards,

Rodney
 
I meant to ask you before, I have been having some trouble with the sound which has a lot of interference.
I am happy that I at least am able to hear the sound effects but a clear sound would be really nice too and when playing for a long time it would be more pleasant.

I wonder, is there a certain sound card that would work better?
I think you used a newer sound blaster card in your youtube gameplay videos?

Hmm. My experience with old sound cards even through the early PCI days is that sound cards always had a lot of interference/noise. I'm guessing there is some electrical reason for this - I believe noise in ground. I wonder if it's possible to modify a card to have less noise? But yes now that you mention it my playthrough didnt have much noise did it. Hmm, I think I used an AWE64 value. This is because the ISA bus was at 12.5 mhz and some older cards did not operate properly at that speed.

Oh! Now that I think about it I believe what I did was use a ground loop noise isolator. Basically I have many retro computers hooked up to a single audio mixer, then with one of these ground loop noise isolators in front of the PC capturing the sound and video. I assume there is some downside where some audio fidelity can be lost but it has always been a net positive to me. I bet the device is internally something really simple, I recall it was less than 10 dollars on amazon or some such and it has a 3.5mm input and output.


---

I'm back to work on the codebase, and I've already forgotten the meaning of most of the code and notes I wrote last month. But with some fresh eyes I've also been able to remove some unneressary code and simplify things.

I've also noticed I've not been very safe with my stack handling in my sound effects interrupt. I am assuming DS = SS as is the case in the rest of my code by default, but that is not always true, especially if this interrupt were to fire in the middle of some ms-dos code for example. I need to create a free stack area somewhere in my memory map so I can push old SS, set SS to that safe area, and on return reset SS to what it was before.
 
Hmm. My experience with old sound cards even through the early PCI days is that sound cards always had a lot of interference/noise. I'm guessing there is some electrical reason for this - I believe noise in ground. I wonder if it's possible to modify a card to have less noise? But yes now that you mention it my playthrough didnt have much noise did it. Hmm, I think I used an AWE64 value. This is because the ISA bus was at 12.5 mhz and some older cards did not operate properly at that speed.

Oh! Now that I think about it I believe what I did was use a ground loop noise isolator. Basically I have many retro computers hooked up to a single audio mixer, then with one of these ground loop noise isolators in front of the PC capturing the sound and video. I assume there is some downside where some audio fidelity can be lost but it has always been a net positive to me. I bet the device is internally something really simple, I recall it was less than 10 dollars on amazon or some such and it has a 3.5mm input and output.


---

I'm back to work on the codebase, and I've already forgotten the meaning of most of the code and notes I wrote last month. But with some fresh eyes I've also been able to remove some unneressary code and simplify things.

I've also noticed I've not been very safe with my stack handling in my sound effects interrupt. I am assuming DS = SS as is the case in the rest of my code by default, but that is not always true, especially if this interrupt were to fire in the middle of some ms-dos code for example. I need to create a free stack area somewhere in my memory map so I can push old SS, set SS to that safe area, and on return reset SS to what it was before.
Interesting, I must find that software and try my AWE64.

My Trust card has sound blaster pro operation but the sound has a lot of crackling, it's not like white noise but some repetitive crackling patterns.
It's a bit like when you use a very low frequency codec and this introduces some repetitive artifacts in the sound.
I think I tried a creative SB Pro card but that also sounded the same as the Trust card.

I remember long ago I made a ZX81 computer with ZX-Pand sound capability and I made the mistake to include an opamp to amplify/mix and for simple tone control for the chip tunes.
Well amplification will also increase the noise. So I think in a digital system, usually less is more. The amplification should better take place outside of the computer with its own regulated power supply.
I also found that the cheap class D digital amplification sounds particularly clear.

Ah, I know all about this, when you are inside certain processes, and exit again, later to return, it's sometimes difficult to get back into that same "zone".
I have hundreds of folders of experimental logic and entering back into that same process would be really difficult to do. Not impossible, but still also not easy.
Some things are particularly complex, and sometimes to get to that eureka moment is something that feels almost like magic especially for things which are so difficult that you are not even sure there even exists a solution.
I can totally identify with this!
Indeed, sometimes taking a break and returning can also help to gain a new insight.

It's good that you realized that point about DS = SS, sounds like you at least have an inspiration now about how you plan to resolve that.

I found that my best ideas come to me when I just get out of bed and reflect on the past evening (or night - oof!) of working on some problem or development.
Usually I get a whole range of ideas and realizations at that moment.
It must be sleeping on something which also helps a lot.

I will give the AWE64 card a try, I will update on this later when I know more, as soon as I find the time to get the software copied from that drive which is mounted in another PC case.

Kind regards,

Rodney
 
My experience with old sound cards even through the early PCI days is that sound cards always had a lot of interference/noise. I'm guessing there is some electrical reason for this - I believe noise in ground. I wonder if it's possible to modify a card to have less noise?
A cheap design (which many Creative cards have) will always be very noisy. Old decoupling capacitors which may have failed or at least drifted do not help; replacing them with modern high-quality capacitors can improve the noise situation. Some (many?) clone cards used a much better designed PCB. When paired with low-quality (non-audio) components, recapping is incredibly effective.

Bad or low-quality capaciors on the mainboard can lead to noisy bus (power and signal) lines, which leak into the sound card's analog circuitry.
 
I went ahead and converted a bit more code from C to asm over the past week. This mostly included initialization code - now the binary is like 1kb smaller or so once again. I found a few bugs and fixed them as well. Right now there is only two c files left:

p_setup.c which contains 'level setup' code. I do not want to convert to asm yet, because I would like to add custom/user wad support soon, and this file will be pretty critical and being able to debug while it's in c is preferable. However It's 3-4 kb in size and I'm sure I could cut out several hundred bytes and speed up level loading quite a bit by rewriting it.

then there is i_main.c which contains the main function. I tried moving the main function out of c and into asm but the presence of the main function seems to signal to openwatcom that it's a c application while if I put it in asm certain libraries, etc are not included. I will investigate later, but the ultimate goal is to go full asm. Before that I must remove the last bits of clib include file operations and program startup and shutdown.

I probably should release something like a 'final alpha' version in the next week or two.

Some notes:

- RealDOOM no longer have any C variables. They are all emitted from an ASM file and I use preprocessor constants as the variable locations in both C and ASM. This allows me to keep the same variable in the same place across build steps and things like that.

- The binary is a little under 53 KB. It probably needs about 540 kb of conventional memory to run (plus the EMS requirements). Since even an 8088 with 640k has 571kb free with ms dos 6.22, I have around 32kb free even in a 'bad case'. I'm sure I'll squeeze out another 8-10kb out of asm-ifying the rest, getting rid of clib, etc. I am thinking about whether or not I can use this free space for any significant engine/speed improvements. Nothing has really come to mind yet.

- The program's (fixed) stack size is 0A00h. I don't think more than 800h-900h is used so I might be able to reclaim a few hundred more bytes of binary space here for free. Basically I just run the program in MartyPC with memory breakpoints and see how far down stack usage goes. It's mostly heavy file usage that causes file buffers to go into the stack temporarily.

Remaining stuff to do:

- Clean up sound implementation and test sound on real hardware again. It's been two months since I have and Rodney noted some bugs. I will see what I can do about this. 22KhZ sound effect mixing is also messy and buggy and I would like to fix that, then there is also an issue where some sound channels disapear. This is hard to debug because it involves interrupts and martypc does not do soundblaster. The idea I have is that since I cant easily write to a debug file in interrupts, I will probably write data into a ring buffer in a UMB (E0000) and try and quit out when I detect the issue and use debug to look at the data in there.

- Remove clib file operations. clib internally mallocs and receives memory from DOS which is annoying because I have to leave a couple KB for it to grow so it doesn't step on my toes. Once I write my own file operations, I will have some fixed file buffers and I should reclaim a couple more KB here. Actually since watcom doesnt have a far fread, i have my own far fread with its own buffer, and then watcom has its own internal one inside of that. No idea if ms-dos has its own too. It's buffers all the way down! File reads/writes actually don't happen too much during gameplay so there won't be big differences in FPS, but I'm curious to see if improvements here speed up program startup.

- I need to check chipset implementations again, especially the HT18 which I have not tested in over a year.

- I mentioned above but one of the big remaining goals is being able to run custom wads (of a reasonable size...) like a real full fledged doom engine. Once this is all done I may make my own DOOM WAD for fun that runs in the engine and plays to its strengths (or rather, avoids its weaknesses).

- And of course a sort of final goal is to make the program asm only. Once this is done I think the current multi-step build process can be cleaned up. I currently have four different files (DOOM.EXE, DOOMCODE.BIN, DOOMDATA.BIN, DSTRINGS.TXT) included in the project. I would like to one day combine all the files into the EXE. Once I have rewritten the program loader it should be possible to tell MS-DOS to not load the entire binary into memory. Then I can keep a single file handle open for all these things, and load data where it needs to go during runtime - instead of juggling file handles and such. It would also just represent a much cleaner way to distribute the game.

Pie in the sky goals:

- I would not have believed a year ago that an EMS 3.2 version is possible, but I guess with how much code I am loading into pageable regions and loading in and out dynamically, combined with how small I have made the binary and how much memory I have saved up - I think a 3.2 version with just a single page frame may be possible down the road. I could probably maintain an EMS 3.2 and EMS 4.0 system at the same time during a transitional period as I move certain features and code from running in one area to the other. There are a few complications - I don't know if i could do the screen wipe effect (too many screen buffers for a single page frame) and music and sound might realistically require a 2nd EMS card with their own memory region. That said I can't say I'm immediately motivated to work on this conversion. It'd be a lot of months of work to make something like a 10-30% slower port most likely.

- I have not done much 286 overclocking recently. I have run out of good 286 sources, and I am kind of stuck on my memory maxing out at around 35-37 mhz 0ws. I have chips that can hit 41mhz, and should approach 45 with peltier cooling and i haven't even gotten into overvolting yet. Wouldn't 50 mhz be neat? I'd love to crack 10 fps on high quality or 20 on low quality one day on a RealDOOM time demo and I probably have the cpu/motherboard/video card to do it. I should probably start looking into designing faster SIMMs. People have done a lot of things with EDO chips hacked to support FPM boards and other things. There's also lessons to learn from Rodney's ongoing experiences with SRAM, etc. It might also be as simple as benchmarking and binning individual DRAM chips. Maybe a simple arduino design could test a DIP/SOJ memory to failure. My fastest drams are actually labeled 60 ns chips, even though i have 45ns and 50ns sticks.

- Speaking of hardware and memory, of course I'd love to work on an EMS 4.0 ISA card with backfill. Making SQEMM a more proper EMS 4.0 driver probably comes first. This is the most likely task to immediately follow RealDOOM

- It'd be cool to make a GL renderer version of RealDOOM. I'd probably have to use a pci card, which means this would be limited to must faster systems. There is also very limited DOS support and libraries for OpenGL. However in general the render is 80-90% of the runtime of the game. Offsetting that processing power to a gpu would work really well. It would not be visually identical to the original however. In theory if there is a GL version of RealDOOM, then if there were a GL capable ISA card that someone decided to make some day, I believe a fast v20 or slow to mid 286 would achieve FPS in the teens in high quality, which sounds pretty cool.
 
- Clean up sound implementation and test sound on real hardware again. It's been two months since I have and Rodney noted some bugs. I will see what I can do about this. 22KhZ sound effect mixing is also messy and buggy and I would like to fix that, then there is also an issue where some sound channels disapear. This is hard to debug because it involves interrupts and martypc does not do soundblaster. The idea I have is that since I cant easily write to a debug file in interrupts, I will probably write data into a ring buffer in a UMB (E0000) and try and quit out when I detect the issue and use debug to look at the data in there.
It's great to read more interesting details about your work on RealDOOM, which is really progressing Patrick!

I have followed your updates on GitHub to test with all the recent code updates I noticed, today I will again download and test the latest builds you uploaded.

I can report one difference I noticed already which has been that the game demo is now again running correctly where the gameplay as followed in the demo now progresses correctly into the game again. So the timing is right again in the game demo playback. Which is pretty cool to see because when I run your demo as a stability test in my development system, I can see the demo game go through the entire level which just looks really cool.

Earlier I have tested the sound though the SFX were still missing. Of course, I am hopeful that as a result of your updates the sound effects will come back, I will let you know right away if I find this. As I understand this is much more difficult for you to test and verify since the emulator doesn't simulate the sound card. So it's much more involved to be needing to be near the hardware, and in addition to need to transfer the updated files to the physical drive each time.

Indeed, we have discovered quite a few things involving the memory management and timing for achieving higher speeds and efficiency, which is similarly relevant for all types of RAM.

I am currently working on the first FPGA design phase of our 286 PC/AT system where we will be able to apply much more dedicated really fast logic for creating new system control, and in addition to that we will be able to make use of the pipeline timing of the 286 address bus which provides us with much more time to setup the memory address lines and this will get us closer to 0ws on the FPGA system as well. I will be working on featuring a "PCI" type slot connector where we can work on new types of hardware, and possibly enabling a much larger range of existing faster VGA cards to work with the 286 CPU.

Currently I have seen VGA card example implementations in hardware code for a complete PC system implementation such as the ao486 which may some day be possible to be split out and convert that adapter to work with the 286 16 bit bus as well.

With FPGA technology we also may be able to create hardware that doesn't exist yet, like possibly even a GL type of graphics adapter. There is a lot of work out there being done with FPGA technology by really talented people.

After finishing the first FPGA mainboard, we also could work on creating a slot VGA adapter card with a dedicated FPGA and fast modern RAM purely for generating the graphics. The FPGA may also be able to offer a super fast dual port caching memory system to allow much faster transfers into the VGA memory window because the cache memory can be written to and read at the same time without delaying any operations on both sides. So imagine doing continuous VGA transfers with 0WS at 30MHz and higher which would be at least as fast as the system memory, without getting delayed by IOCH_RDY occurrences. With FPGA technology there is a huge potential for speeding up the system in different areas.

And if someone would develop a 286 CPU code in VHDL or Verilog, when this code runs in the FPGA, it may be able to run at really high clock speeds far above the physical chip speed. And having a really fast FPGA interfaced with a 286, that system may very well already be able to run faster than time period systems as well.

Anyway, I am developing the hardware step by step, and with each progression we will be able to make big improvements in the clock speed and efficiency.
And of course, the goal will be to keep supporting RealDOOM on each subsequent new system from now on!

Thanks for your continued great work on the project Patrick, it's much appreciated!

Kind regards,

Rodney
 
I did not work on the sound card bug fixing at all. Instead I just started disassembling tons of code again and thanks to that, as of today RealDOOM is now 100% assembly!

I talked about it a little bit more in depth in the doomworld forums but over the past two weeks I got rid of clib in the project by implementing all the file functions. Then free and malloc, and then c initialization and shutdown procedures. After this I was able to start whittling away at unused features, and eventually got rid of the remaining uses of the heap (varargs, file buffers, and file/stream allocations which are all static now). I got rid of things like file flushes and the dirty bit because we never have in progress writes in RealDOOM. I got rid of fputc and fgetc and directly write thru dos system calls to the screen instead of thru the stdout file.

Anyway, the binary is about 10kb smaller than a couple weeks ago and it will get even smaller. I’ve also received some faster code from contributors for mul and div functions and will be testing those out. Because I just converted a lot of stuff to asm there is probably some regression testing to do and then finally I can finish fixing chipset builds and make sound effects work a little better.

I think the project is very close to a final state now. Maybe a clean beta release will be ready in a month or two, then I can finally move to adjacent projects like the 5434 bios disassembly and a more complete ems driver.
 
RealDOOM is now 100% assembly!
That is amazing news Patrick! Congratulations on this huge milestone!

So do I understand correctly that you now no longer need the C compiler to create the RealDOOM binaries?
That is very cool!
It must feel very satisfying to be able to clean up so many things now, I can imagine you have been anticipating this for quite a while and a lot of work to get there!

I did not work on the sound card bug fixing at all.
Totally understandable, getting the C code out has been your goal since the start and being so close, you now got it to the finish for that goal.

Anyway, the binary is about 10kb smaller than a couple weeks ago and it will get even smaller. I’ve also received some faster code from contributors for mul and div functions and will be testing those out.
Sounds like the code is getting really lean and fast now, which the 286 will benefit the most from to lighten any unnecessary load.

and then finally I can finish fixing chipset builds and make sound effects work a little better.
That would be really cool for the game experience Patrick to have some working sound effects again. I have been downloading and testing your frequent updates regularly.
Regarding chipsets, I found that the SCAMP system didn't initialize the EMS correctly on the latest build, even though I loaded the driver.
After running a previous SCAMP specific build you made before, I can then start the 286 build correctly on the SCAMP.
I should look into how to compile the chipset specific version of the binaries which I expect will then initialize the SCAMP again.

Really great work Patrick!

Kind regards,

Rodney
 
I wanted to try RealDOOM (0.78, 386) on my Tandy 1000 RSX (386SX-25). Unfortunately, I was unsuccessful. I tried with MS-DOS 7, PC DOS 7.1 and FreeDos, with emm386 and jemmex. It freezes after M_LoadDefaults : Load system defaults.

Any clue?

Thanks!
 
I wanted to try RealDOOM (0.78, 386) on my Tandy 1000 RSX (386SX-25). Unfortunately, I was unsuccessful. I tried with MS-DOS 7, PC DOS 7.1 and FreeDos, with emm386 and jemmex. It freezes after M_LoadDefaults : Load system defaults.

Any clue?

Thanks!

Let's see. I just checked the binary and it worked for me on 86box running EMM386 and ms dos 6.22 It should work on a 386 without too much hassle, but here is my exact config.sys line:

Code:
DEVICEHIGH = C:\DOS\EMM386.EXE RAM FRAME=D000 /I=E000-EFFF

The ignore range is probably not necessary, and aside from that I also have dos=high,umb and himem.sys loaded of course.

No idea on jemmex, also don't think ive ever tried DOS 7/7.1/Freedos. In theory they should work, but I suppose its possible you're below 550 kb conventional or something if one of those are really bloated.
 
This is a very interesting program. I will check it out soon, would this work on say, an IBM PC convertible or a Compaq II?
 
I don't think so. Doom is a VGA game, and I think both of those are CGA internal displays.
There have been CGA conversion attempts.

Not sure if the CGA version overlaps enough to use with realdoom (aka CGA doom was the usual 386+ code)
 
Back
Top