Page 2 of 3
Re: Graphical Errors on 3D games
Posted: Thu Oct 16, 2014 8:58 pm
by Trixter
Okay, this beat me up tonight; the issue tends to go away when you use a debugger so trying to debug a problem that isn't showing up is madness.
I have narrowed down the issue to certain places where a keypress occurs and a sound is generated or stopped. If you turn sound off, the issue happens much less, but it can still happen. I'll see if I can get to the bottom of it tomorrow night.
This is very atypical, btw. I have patched a lot of games to run on PCjr and 99% of them are pretty easy.
Re: Graphical Errors on 3D games
Posted: Fri Oct 17, 2014 4:07 pm
by MadKingCorduroy
Wow that's weird. I really appreciate you doing this, this is so cool.

Re: Graphical Errors on 3D games
Posted: Fri Oct 17, 2014 7:52 pm
by Trixter
(Posting for future posterity, and that so others can learn from this exercise)
I found out why it was glitching, and it had nothing to with the previous writes to ports 3d8 and 3d9 -- while those are unsupported, sending them garbage doesn't cause the glitch. What causes the glitch is when Elite tries to write to the speaker (seriously). Controlling the speaker is done through port 61h. On a regular PC, those bits are:
Code: Select all
0: Tmr 2 gate --- OR 03H=spkr ON
1: Tmr 2 data -+ AND 0fcH=spkr OFF
3: 1=read high switches
4: 0=enable RAM parity checking
5: 0=enable I/O channel check
6: 0=hold keyboard clock low
7: 0=enable kbrd
Bits 0-1 control the speaker. Bit 2 is "reserved" (it does nothing). Now, contrast that with the PCjr:
Code: Select all
0: Tmr 2 gate --- OR 03H=spkr ON
1: Tmr 2 data -+ AND 0fcH=spkr OFF
2: +Alpha (-Graphics)
3: Cassette motor off
4: Disable internal beeper and cassette motor relay
5: SPKR switch 0
6: SPKR switch 1
7: reserved
Bits 0-1 are the same, but bit 2 toggles between text mode and graphics mode! And that bit is getting set sometimes and then sent to the speaker. The original programmer didn't do anything "wrong" because that bit does nothing on a PC.
I have an idea where this is getting set; the game runs a housekeeping interrupt 1000 times a second and that interrupt is responsible for, among other things, playing complex sound effects where bit 1 is toggled quickly. I think bit 2 is getting set in there by mistake. Problem is, I'm not sure it can be fixed because I need "room" to add an instruction that un-sets bit 2 before sending it to the speaker, and there is currently no room.
Work continues...
Re: Graphical Errors on 3D games
Posted: Fri Oct 17, 2014 8:47 pm
by Trixter
And, we're done:
ftp://ftp.oldskool.org/pub/misc/Softwar ... iteljr.exe
...which changes this code:
Code: Select all
seg000:00D9 in al, 61h ; PC/XT PPI port B
seg000:00DB mov origPortB, al
seg000:00DE and al, 11111100b
seg000:00E0 mov portBSpkrVal, al
...to this:
Code: Select all
seg000:00D9 in al, 61h ; PC/XT PPI port B
seg000:00DB mov origPortB, al
seg000:00DE and al, 11111000b ; <--- also clear bit 2 which is +Alpha (-Graphics)
seg000:00E0 mov portBSpkrVal, al
This saves the port 61h info with the graphics bit cleared; since this variable is only used when the game is in graphics mode anyway, it works. Tested successfully; sound, graphics, all work correctly. Probably works on a regular PC as well.
Now let's see another episode of
Will it run on the IBM PCjr? ;-)
Re: Graphical Errors on 3D games
Posted: Fri Oct 17, 2014 10:24 pm
by MadKingCorduroy
OH MY GOD YOU ARE AWESOME! IT WORKS PERFECTLY!
I can't even begin to tell you how awesome this is! I never thought this would be possible lol. YOU ARE THE COOLEST!
I'm am literally dancing around the room! lol
You can bet I'll be letting the world know of this new version in the VERY near future! OMFG this is so cool. lol
Once again I just have to tell you thank you! This has really made my day! YOU ARE THE COOLEST! lol
Also, it runs perfectly fine on my Windows 98SE Packard Bell Platinum 55. So I am guessing it should work fine for all the rest of the PC clones out there as well.

Re: Graphical Errors on 3D games
Posted: Mon Oct 20, 2014 9:52 am
by Trixter
:-) Hope the game itself is living up to your standards. Companion video, if you're curious:
https://www.youtube.com/watch?v=BCSaKuqPrf4
BTW the crack message in the executable wasn't for you; that was from my original crack in 1989, which is why it is so inelegant. If I can still find the originals, I'll likely re-crack it to just bypass that screen entirely.
Re: Graphical Errors on 3D games
Posted: Mon Oct 20, 2014 5:06 pm
by MadKingCorduroy
Interesting video, perhaps will lead to more patched games for PCjr. My mistake, I didn't realize you had a generic message. Not sure what you mean about standards though, I've been playing this game for quite a while. I also have it for Commodore 64 (which in all honesty that version is better) but the IBM PCjr is closer to my heart since it was my first 8 bit computer.
Re: Graphical Errors on 3D games
Posted: Mon Oct 20, 2014 5:08 pm
by Trixter
MadKingCorduroy wrote:I also have it for Commodore 64 (which in all honesty that version is better)
That's what I meant by living up to your standards; the PC version is not the best version.
Re: Graphical Errors on 3D games
Posted: Mon Oct 20, 2014 5:10 pm
by MadKingCorduroy
lol It's all the same game. I'm certainly no graphics whore.

Re: Graphical Errors on 3D games
Posted: Sun Nov 08, 2020 6:12 pm
by slaanesh
Yep getting back to this thread.
I recently tried out Elite on the IBM PCjr and found it did indeed mostly work, except when I went to save/load.
It looks like it's doing the same sort of thing at this point (possibly) read and write to 61h and inadvertently changing graphics/text mode.
So one interesting thing to note is that when save/loading the game, the PCjr is actually in text mode. The patch is always assuming that sound is always being played in graphics mode.
Is anyone else having the same issue?
I actually prefer Elite on the PC... The C64 version I originally played is so slow in comparison. And docking is way more forgiving on the PC. And you can save so much more easily (using real hardware).
A whole lot of reasons that the PC version is one of the better versions of Elite IMHO.