VOGONS


Reply 560 of 984, by rasz_pl

User metadata
Rank l33t
Rank
l33t
ViTi95 wrote on 2022-11-18, 19:46:

I'm still looking for a way to dynamically link code on runtime

dudes (neozeed?) who ported Quake 2 to dos made it work http://dk.toastednet.org/Q2DOS/ https://bitbucket.org/neozeed/q2dos/src/master/
something about .dxe DJGPP DLL like mechanism for dos, but later they managed to work with ordinary openwatcom? .ovl files (glide)
I remember reading whole blog update about that, but cant find it anymore 🙁 I did find this mentioning it https://www.bttr-software.de/forum/mix_entry.php?id=16158
edit: found 5 entries blog series mentioning it https://virtuallyfun.com/2015/06/02/porting-q … -to-ms-dos-pt1/

Open Source AT&T Globalyst/NCR/FIC 486-GAC-2 proprietary Cache Module reproduction

Reply 562 of 984, by ViTi95

User metadata
Rank Member
Rank
Member
theelf wrote on 2022-11-21, 14:49:

One think will be amazing, i dont know how difficult will be to implement is AudioCD. If i dont remember bad, Ultimate Doom soundtrack is something like 50-55min longer and Doom 2 70-75, perfect to fit in a cdrom

Mmmm interesting idea, I've never worked with the MSCDEX but will take a look into it. Is there any Doom port that already implements this?

rasteri wrote on 2022-11-21, 22:50:

Yeah Watcom at least USED to have dynamic linker support, but I think it only works with certain DOS extenders (maybe not DOS/32A)

Is there any tutorial or example on how to develop this? I think this will be extremely helpful reducing the number of executables (and executable size)

https://www.youtube.com/@viti95

Reply 563 of 984, by theelf

User metadata
Rank Oldbie
Rank
Oldbie
ViTi95 wrote on 2022-11-23, 07:38:
theelf wrote on 2022-11-21, 14:49:

One think will be amazing, i dont know how difficult will be to implement is AudioCD. If i dont remember bad, Ultimate Doom soundtrack is something like 50-55min longer and Doom 2 70-75, perfect to fit in a cdrom

Mmmm interesting idea, I've never worked with the MSCDEX but will take a look into it. Is there any Doom port that already implements this?

Hi, thanks

Yes, DosDoom 0.653 support audiocd and is AMAZING, plus, i get some extra fps compared to opl music, at least in dosdoom benchmarks, and i think this is the goal of fastdoom too

The problem of dosdoom is that you need to manually change the tracks, the idea will be that fastdoom have hardcoded track numbers for every level (e1m1-track1, e1m2-track2, etc) and detect audio cd finish to start track again

http://www.doomworld.com/3ddownloads/ports/dd0653b.zip

source

https://www.doomworld.com/idgames/historic/dd0653

thanks!

Reply 564 of 984, by rasteri

User metadata
Rank Member
Rank
Member
ViTi95 wrote on 2022-11-23, 07:38:

Is there any tutorial or example on how to develop this? I think this will be extremely helpful reducing the number of executables (and executable size)

Sorry this is just my memory going back to the 90s...

I did find this though - https://open-watcom.github.io/open-watcom-v2- … docs/lguide.pdf - check section 4.3 (Overlays)

Reply 565 of 984, by 7F20

User metadata
Rank Member
Rank
Member

If you're going to make CD-Audio available, it might be a good idea to make sure it will play arbitrary Audio CDs. I have fond memories of just plopping in whatever CD I wanted to with Quake and it will sequence the tracks with levels. It skips track 1 iirc (for the data).

Reply 566 of 984, by noshutdown

User metadata
Rank Oldbie
Rank
Oldbie

hello. i am interested in this port, and i have a few questions:
1. is it fully demo compatible with vanilla doom?
2. will there be a 160*100*256c mode? that is, 256 color version of FDOOMC16 and FDOOMC16.
3. is there any plan of porting to djgpp? because djgpp is usually supposed to generate faster binaries than watcom.

Reply 567 of 984, by ViTi95

User metadata
Rank Member
Rank
Member

Hi @noshutdown!

noshutdown wrote on 2022-12-08, 08:34:

1. is it fully demo compatible with vanilla doom?

Latest release it's as compatible with Vanilla Doom as possible, any bug related to desync on demos will be studied and fixed.

noshutdown wrote on 2022-12-08, 08:34:

2. will there be a 160*100*256c mode? that is, 256 color version of FDOOMC16 and FDOOMC16.

For CGA cards the next release (0.9.3) will feature a "512 color" 80x100 mode, the same used on 8088MPH demos. Will require an original IBM CGA card with composite output. It's pretty much on the limit of what a CGA card can do. For VGA cards the only way to do 160x100@256 is by reducing the rendering resolution and doubling drawn vertical pixels in software because the minimum resolution is 320x200 on 256 colors with VGA hardware (unless there is some trick I don't know). With some tricks it's possible to write 2 or 4 pixels horizontal on a single write. That's why potato resolution is 80x200 and low is 160x200.

noshutdown wrote on 2022-12-08, 08:34:

3. is there any plan of porting to djgpp? because djgpp is usually supposed to generate faster binaries than watcom.

There is some work done to port FastDoom to DJGPP, but requires rewriting huge parts of the sound code and right now is non-functional. Being almost only one developer with limited time for the project, I haven't spent more time on this. Right now I prefer to optimize even further in Watcom and add support for more hardware. As always any help is very welcome.

https://www.youtube.com/@viti95

Reply 568 of 984, by noshutdown

User metadata
Rank Oldbie
Rank
Oldbie
ViTi95 wrote on 2022-12-08, 09:20:

For VGA cards the only way to do 160x100@256 is by reducing the rendering resolution and doubling drawn vertical pixels in software because the minimum resolution is 320x200 on 256 colors with VGA hardware (unless there is some trick I don't know).

i think thats what i intended to mean.

There is some work done to port FastDoom to DJGPP, but requires rewriting huge parts of the sound code and right now is non-functional. Being almost only one developer with limited time for the project, I haven't spent more time on this. Right now I prefer to optimize even further in Watcom and add support for more hardware. As always any help is very welcome.

for sound, maybe you can have a look at other dos ports and see how they did it, mbf and eternity comes to mind.

also, is this port limit-removing?

Reply 569 of 984, by ViTi95

User metadata
Rank Member
Rank
Member

Those ports use the Allegro library for sound, that's another option. But any optimization or support for new sound card has to be redone for this library. About limit-removing, only unlimited sprites are included right now, I've also developed unlimited visplane support but won't be released until is 100% stable.

https://www.youtube.com/@viti95

Reply 570 of 984, by 7F20

User metadata
Rank Member
Rank
Member
ViTi95 wrote on 2022-12-08, 09:20:

For CGA cards the next release (0.9.3) will feature a "512 color" 80x100 mode, the same used on 8088MPH demos. Will require an original IBM CGA card with composite output.

That means this will be impossible to try out in emulation, correct?

Reply 571 of 984, by ViTi95

User metadata
Rank Member
Rank
Member

It's fully working on DosBox-staging, both old and new models of IBM CGA cards are supported. The 512 color mode doesn't require perfect timing cycles, so it should work on any emulator / computer (with the IBM CGA obviously). I still have to try on real hardware since my IBM CGA card composite output is dead.

https://www.youtube.com/@viti95

Reply 572 of 984, by rasz_pl

User metadata
Rank l33t
Rank
l33t

cnlohr maintains slimmed down embedded doom fork he did for esp32 https://github.com/cnlohr/embeddedDOOM/
he recently ran it in his minimal (400 lines of code) RISC-V emulator
https://www.youtube.com/watch?app=desktop&v=uZMNK17VCMU

tldr: he implemented some extensive hacks to doom codebase to make it use less ram ("theoretically, you could run this on a system with only 384kB RAM", but probably not cpu), might be interesting checking his modifications.

Open Source AT&T Globalyst/NCR/FIC 486-GAC-2 proprietary Cache Module reproduction

Reply 573 of 984, by wbc

User metadata
Rank Member
Rank
Member
ViTi95 wrote on 2022-12-08, 09:20:

For VGA cards the only way to do 160x100@256 is by reducing the rendering resolution and doubling drawn vertical pixels in software because the minimum resolution is 320x200 on 256 colors with VGA hardware (unless there is some trick I don't know

you can stretch scanlines vertically by setting height (minus one) to bits 0-4 of CRTC Maximum Scan Line register (0x3D4 index 9), additionally bit 7 of the same register further doubles line height:

3d4h index  9  (R/W):  CRTC: Maximum Scan Line Register
bit 0-4 Number of scan lines in a character row -1. In graphics modes this is
the number of times (-1) the line is displayed before passing on to
the next line (0: normal, 1: double, 2: triple...).
This is independent of bit 7, except in CGA modes which seems to
require this field to be 1 and bit 7 to be set to work.
5 Bit 9 of Start Vertical Blanking
6 Bit 9 of Line Compare Register
7 Doubles each scan line if set. I.e. displays 200 lines on a 400
display.

By default, in 320x200 256 color VGA mode, this register has bits 0-4 set to 1 and doublescan bit reset, so as there are actually 400 scanines onscreen, every frame buffer line is displayed twice. setting those bits to 3 makes every line to be scanned 4 times, stretching 320x100 buffer to full screen. Or you can set those bits to 0 to create 320x400 mode, as one supported by Quake 😀

by the way, apart of known and currently used "write 2/4 bitplanes at once" method, you can create true 160x100/200/400 mode by tweaking CRTC to use timings from 320x200 16 color mode and halving pixel clock via Sequencer index 1. Unfortunately, it is not very compatible with some VGA cards (i.e. it needs vendor-specific /2 clock divider for Trident/Realtek, causes out of spec 140Hz vertical refresh on ET6000, and S3 cards either display solid color or mess up RAMDAC writes)

example 160x200 256 mode code
printf("\n");
printf("test 160x200 256 color mode\n");
printf("this mode uses display timings from 320x200 16 color mode, and utilize\n");
printf("VGA 256 color pixel doubling to create extra-lowres mode :)\n");
printf("Some VGA cards (like S3 or Trident) are incompatible with this mode, or\n");
printf("require vendor-specific tweaks.\n");

printf("\n");
printf("select method:\n");
printf(" 1) set 320x200 16 color mode, then switch ATC/GC to 256 color mode\n");
printf(" 2) set regular mode 0x13, then tweak CRTC horizontal timings\n");
uint32_t baseMode = inputSelection(2); if (baseMode == -1) return true;

printf("select vendor-specific tweaks:\n");
printf(" 1) none\n");
printf(" 2) Trident (vendor-specific /2 clock divider)\n");
printf(" 3) Realtek (vendor-specific /2 clock divider)\n");
printf(" 4) S3 (vendor-specific /2 clock divider, may cause palette issues)\n");
uint32_t clockMode = inputSelection(4); if (clockMode == -1) return true;

if (baseMode == 0) {
// set 320x200 16 color mode, then switch ATC/GC to 256 color mode
setvgamode(0x0D);
set60hz();
// setLinear16c();
for (int i = 0; i < 16; i++) { inp(0x3da); outp(0x3c0, i); outp(0x3c0, i); } // attribute controller/EGA palette identity mapping
inp(0x3da); outp(0x3c0, 0x30); uint8_t atc = inp(0x3c1);
inp(0x3da); outp(0x3c0, 0x30); outp(0x3c0, atc | 0x40);
outp(0x3ce, 5); outp(0x3cf, inp(0x3cf) | 0x40);

// enable chain-4 (skip for Mode-X)
outp(0x3c4, 4); outp(0x3c5, inp(0x3c5) | 0x08);
outp(0x3d4, 0x14); outp(0x3d5, inp(0x3d5) | 0x40);
outp(0x3d4, 0x17); outp(0x3d5, inp(0x3d5) | 0x40);

} else {
// set regular mode 0x13, then tweak CRTC horizontal timings
setvgamode(0x13);
set60hz();
outp(0x3d4, 0x11); outp(0x3d5, inp(0x3d5) & ~0x80);
outpw(0x3d4, 0x1413);

outpw(0x3D4, 0x2D00);
outpw(0x3D4, 0x2701);
outpw(0x3D4, 0x2802);
outp (0x3D4, 0x03); outp(0x3D5, (inp(0x3D5) & ~(0x1F)) | 0x10);
outpw(0x3D4, 0x2B04);
outp (0x3D4, 0x05); outp(0x3D5, (inp(0x3D5) & ~(0x9F)) | 0x8F);

// enable VGA DCLK/2
if (clockMode == 0) {
outpw(0x3c4, 0x0100);
outp(0x3c4, 1); outp(0x3c5, inp(0x3c5) | 0x08);
outpw(0x3c4, 0x0300);
}
}

if (clockMode > 0) {
// disable VGA DCLK/2
outpw(0x3c4, 0x0100);
Show last 29 lines
        outp(0x3c4, 1); outp(0x3c5, inp(0x3c5) & ~0x08);
outpw(0x3c4, 0x0300);
}
switch (clockMode) {
case 1:
// Trident DCLK/2
outp(0x3C4, 0x0B); inp(0x3C5); // select new mode
outp(0x3C4, 0x0D); outp(0x3C5, (inp(0x3C5) & ~0x6) | 2);
break;
case 2:
// Realtek DCLK/2
outp(0x3CE, 0x0B); outp(0x3CF, inp(0x3CF & ~3) | 2);
break;
case 3:
// S3 DCLK/2 (leads to palette issues as CPU accesses to RAMDAC are syncronized to DCLK,
// causing RAMDAC to miss palette writes/reads if DCLK is too low)

// unlock S3 extensions
outpw(0x3C4, 0x0608);
outpw(0x3D4, 0x4838);
// use S3 method of VCLK/2
outp(0x3C4, 1); outp(0x3C5, (inp(0x3C5) & 0xF7));
outp(0x3C4, 0x15); outp(0x3C5, (inp(0x3C5) | 0x10));
// lock S3 extensions
outpw(0x3C4, 0x0008);
outpw(0x3D4, 0x0038);
break;
default: break;
}

--wbcbz7

Reply 576 of 984, by ViTi95

User metadata
Rank Member
Rank
Member

While developing optimizations for Potato mode i've just discovered a bug that I think it hasn't been documented and exists since... 1994 (!!) It just happens that Heretic has a rendering bug on R_DrawSpan (which is ASM optimized and it's much faster compared to Doom R_DrawSpan). It basically renders the first pixel twice and then continues rendering the rest without issues. It's hard to find on a 320x200 resolution, but it becames very obvious on FastDoom's potato mode (80x200):

Here is the bug on Heretic:

heretic_002_double.png
Filename
heretic_002_double.png
File size
34.14 KiB
Views
1364 views
File comment
Heretic bug
File license
CC-BY-4.0
heretic_002_zoom.png
Filename
heretic_002_zoom.png
File size
1.04 KiB
Views
1364 views
File comment
Heretic bug zoom
File license
CC-BY-4.0

And here is the same bug on FastDoom's Potato mode:

dos4gw_000_double.png
Filename
dos4gw_000_double.png
File size
18.27 KiB
Views
1364 views
File comment
FastDoom potato's bug
File license
CC-BY-4.0
dos4gw_000_zoom.png
Filename
dos4gw_000_zoom.png
File size
2.38 KiB
Views
1364 views
File comment
FastDoom potato's bug zoom
File license
CC-BY-4.0

Right now, the bug has been fixed and these are some performance numbers:

FastDoom 0.9.1: 27.632 fps
FastDoom 0.9.2: 33.860 fps

This is 22% faster, on a 386DX-40 (Ultimate Doom timedemo demo3, fullscreen+HUD and no sound). And here is the cool thing, the same optimization will be applied for low detail and high detail modes on Mode Y, so expect performance uplift on the next release 😁

rmay635703 wrote on 2022-12-10, 04:38:

Doom on CGA without 16bit x86 support is a travesty
Harris 286-25 🙁 no doom

Yeah I know, as is already been said, is very hard to port Doom to 16-bit only instruction set. Maybe some crazy developer (and more experienced than me) could achieve this. Or make Wolfenstein 3D Hercules/CGA/EGA compatible 😏

Last edited by ViTi95 on 2022-12-16, 10:22. Edited 1 time in total.

https://www.youtube.com/@viti95

Reply 577 of 984, by leileilol

User metadata
Rank l33t++
Rank
l33t++

OMFG It's in Hexen too!

(Strife has been spared of this bug)

Attachments

  • hexens.png
    Filename
    hexens.png
    File size
    918 Bytes
    Views
    1341 views
    File license
    Fair use/fair dealing exception

apsosig.png
long live PCem

Reply 578 of 984, by Gmlb256

User metadata
Rank l33t
Rank
l33t
ViTi95 wrote on 2022-12-16, 09:33:

While developing optimizations for Potato mode i've just discovered a bug that I think it hasn't been documented and exists since... 1994 (!!) It just happens that Heretic has a rendering bug on R_DrawSpan (which is ASM optimized and it's much faster compared to Doom R_DrawSpan). It basically renders the first pixel twice and then continues rendering the rest without issues.

Interesting, the original DOS version of DOOM also used an ASM optimized version of R_DrawSpan (even though id Software never released the DOS version of the source code because of the DMX sound library, they added the ASM routines into the README.ASM file found in linuxdoom).

Or make Wolfenstein 3D Hercules/CGA/EGA compatible 😏

Wolfenstein 3-D alpha had a EGA version that was used in Catacomb 3-D, the direct predecessor. Some of the removed content and leftovers can be seen in the Development Info page of the game in The Cutting Room Floor and the source code respectively.

VIA C3 Nehemiah 1.2A @ 1.46 GHz | ASUS P2-99 | 256 MB PC133 SDRAM | GeForce3 Ti 200 64 MB | Voodoo2 12 MB | SBLive! | AWE64 | SBPro2 | GUS