IBM PCjr BIOS in PCXT Core

User avatar
spark2k06
Core Developer
Posts: 868
Joined: Sat Jun 06, 2020 9:05 am
Has thanked: 409 times
Been thanked: 961 times

IBM PCjr BIOS in PCXT Core

Unread post by spark2k06 »

The BIOS has been modified to avoid initial errors, now it shows the PCjr splash screen but the keyboard doesn't work and it doesn't boot from a previously mounted floppy drive:



I have carried out the following patches on the original PCjr BIOS to bypass various errors up to this point:


PCJR BIOS FAILS HERE (IN THIS CASE IT IS NORMAL BECAUSE WE ARE MODIFYING THE BIOS)

Code: Select all

F000:0134 ;----------------------------------------------------
F000:0134 ; test 4
F000:0134 ;	planar board ros checksum test
F000:0134 ; description
F000:0134 ;	a checksum test	is done	for each ros
F000:0134 ;	module on the planar board to.
F000:0134 ;	mfg error code =0003h module at	address
F000:0134 ;			f000:0000 error
F000:0134 ;			0004h module at	address
F000:0134 ;			f800:0000 error
F000:0134 ;----------------------------------------------------
F000:0134		  mov	  al, 0FCh ; 'ü'
F000:0136		  out	  10h, al	  ; mfg	out = fc
F000:0138 ; check module at f000:0 (lenght 32k)
F000:0138		  xor	  si, si
F000:013A		  mov	  ax, cs
F000:013C		  mov	  ss, ax
F000:013E		  mov	  ds, ax
F000:0140		  mov	  cx, 8000h
F000:0143		  mov	  sp, 1Bh
F000:0146		  jmp	  ros_checksum
F000:0146 ; END	OF FUNCTION CHUNK FOR kb_int
F000:0149 l12:					  ; DATA XREF: F000:z1o
F000:0149		  jz	  short	l13
F000:014B		  mov	  bx, 3
F000:014E		  jmp	  e_msg
F000:0151 l13:					  ; CODE XREF: F000:l12j
F000:0151		  mov	  cx, 8000h
F000:0154		  jmp	  ros_checksum
F000:0157 l14:					  ; DATA XREF: F000:001Do
F000:0157		  jz	  short	l15
F000:0159		  mov	  bx, 4		  ; indicate error
F000:015C		  jmp	  e_msg
IF WE SKIP IT, THE PCJR BIOS FAILS HERE

Code: Select all

F000:034F		  in	  al, 61h
F000:0351		  or	  al, 1
F000:0353		  out	  61h, al
F000:0355		  mov	  cx, 0Ah
F000:0358 ck2_lo:				  ; CODE XREF: F000:ck2_loj
F000:0358		  loop	  ck2_lo
F000:035A		  in	  al, 62h
F000:035C		  and	  al, 20h
F000:035E		  jnz	  short	pod_13_end
F000:0360		  mov	  bl, 6
F000:0362 timer_error:				  ; CODE XREF: F000:02BFj
F000:0362					  ; F000:02CFj	F000:02EBj
F000:0362					  ; F000:031Aj	F000:0334j
F000:0362					  ; F000:034Dj
F000:0362		  mov	  bh, 8		  ; timer error	indicator
F000:0364		  call	  e_msg
F000:0367		  jmp	  short	pod_13_end
IF WE SKIP IT, THE PCJR BIOS FAILS HERE

Code: Select all

F000:04A3		  mov	  bh, 9		  ; set	msb of error code
F000:04A5		  jmp	  e_msg
IF WE SKIP IT, THE PCJR BIOS FAILS HERE, IT DOES NOT CONTINUE BECAUSE AT THIS POINT THE KEYBOARD DOES NOT WORKS AND HANGS AT INT 16h

Code: Select all

F000:08C9		  jz	  short	f15a_0	  ; continue if	no error
F000:08CB		  mov	  dl, 2
F000:08CD		  call	  err_beep
F000:08D0 err_wait:				  ; CODE XREF: F000:08D7j
F000:08D0		  mov	  ah, 0
F000:08D2		  int	  16h		  ; KEYBOARD - READ CHAR FROM BUFFER, WAIT IF EMPTY
F000:08D2					  ; Return: AH = scan code, AL = character
F000:08D4		  cmp	  ah, 1Ch
F000:08D7		  jnz	  short	err_wait
F000:08D9		  jmp	  short	f15c
IF WE SKIP THIS LOOP THAT WAITS FOR A KEY TO BE PRESSED, IT JUMPS DIRECTLY TO THE BASIC ROM, WITH THE KEYBOARD NOT WORKING... EVEN IF THERE IS A FLOPPY IMAGE MOUNTED, IT SEEMS TO IGNORE IT AND JUMPS TO THE BASIC ROM

The complete list of the disassembled PCjr BIOS can be found here:

https://github.com/ricardoquesada/bios- ... r-bios.lst

It would be interesting to run this BIOS to enjoy various PC booters games in Tandy video mode, which are only displayed on this particular model of PC, and not in Tandy 1000:

http://nerdlypleasures.blogspot.com/202 ... usive.html
AmintaMister
Posts: 292
Joined: Thu Sep 16, 2021 10:54 pm
Has thanked: 764 times
Been thanked: 45 times

Re: IBM PCjr BIOS in PCXT Core

Unread post by AmintaMister »

Fantastic! So do you plan to support the PCjr hardware also?
User avatar
spark2k06
Core Developer
Posts: 868
Joined: Sat Jun 06, 2020 9:05 am
Has thanked: 409 times
Been thanked: 961 times

Re: IBM PCjr BIOS in PCXT Core

Unread post by spark2k06 »

kitune-san wrote:
AmintaMister wrote: Tue Oct 25, 2022 7:08 am Fantastic! So do you plan to support the PCjr hardware also?
That will depend on how @kitune-san, who is more familiar with the keyboard module and other features of his chipset, sees it.
jordi
Posts: 238
Joined: Thu Jun 11, 2020 10:11 am
Has thanked: 95 times
Been thanked: 80 times

Re: IBM PCjr BIOS in PCXT Core

Unread post by jordi »

Interesting!

There was this article that showed the differences

http://nerdlypleasures.blogspot.com/201 ... s.html?m=1


The games determined by the system they were running on by checking the PC identifier byte at F000:FFFE, which was FF for a PC, FD for a PCjr., FE for an early XT and all PC Portables, FB for a later XT, F9 for a PC Convertible and FC for an AT and XT/286.


Keyboard - The IBM PCjr.'s keyboard is basically compatible with the PCs, although not as easy to use due to the fewer keys and the chiclet arrangement. However, with Fn key combinations it is possible to generate all the keystrokes of the PC keyboard. The Tandy 1000's keyboard interface came from the less-than-PC compatible Tandy 2000, and while compatible at the BIOS Int 16 level, there are real differences on how the keyboards work at the hardware level. Games bypassing the BIOS routines may fail to recognize keyboard input.
User avatar
spark2k06
Core Developer
Posts: 868
Joined: Sat Jun 06, 2020 9:05 am
Has thanked: 409 times
Been thanked: 961 times

Re: IBM PCjr BIOS in PCXT Core

Unread post by spark2k06 »

jordi wrote: Tue Oct 25, 2022 7:29 am Interesting!

There was this article that showed the differences

http://nerdlypleasures.blogspot.com/201 ... s.html?m=1


The games determined by the system they were running on by checking the PC identifier byte at F000:FFFE, which was FF for a PC, FD for a PCjr., FE for an early XT and all PC Portables, FB for a later XT, F9 for a PC Convertible and FC for an AT and XT/286.


Keyboard - The IBM PCjr.'s keyboard is basically compatible with the PCs, although not as easy to use due to the fewer keys and the chiclet arrangement. However, with Fn key combinations it is possible to generate all the keystrokes of the PC keyboard. The Tandy 1000's keyboard interface came from the less-than-PC compatible Tandy 2000, and while compatible at the BIOS Int 16 level, there are real differences on how the keyboards work at the hardware level. Games bypassing the BIOS routines may fail to recognize keyboard input.
Thanks for the information, for now, I will try duplicating the floppy access in 3F0h-3F5h and F0h-F5h I/O ports, and see what happens.
User avatar
spark2k06
Core Developer
Posts: 868
Joined: Sat Jun 06, 2020 9:05 am
Has thanked: 409 times
Been thanked: 961 times

Re: IBM PCjr BIOS in PCXT Core

Unread post by spark2k06 »

I've already made the change and tried it, but no luck... it doesn't boot from the floppy either, it goes straight to the BASIC ROM:

Code: Select all

wire floppy0_select_n = ~(~address_enable_n && (({address[15:2], 2'd0} == 16'h03F0) || ({address[15:1], 1'd0} == 16'h03F4) || ({address[15:0]} == 16'h03F7 || 
	                                         {address[15:2], 2'd0} == 16'h00F0) || ({address[15:1], 1'd0} == 16'h00F4) || ({address[15:0]} == 16'h00F7)));
bbond007
Top Contributor
Posts: 521
Joined: Tue May 26, 2020 5:06 am
Has thanked: 86 times
Been thanked: 204 times

Re: IBM PCjr BIOS in PCXT Core

Unread post by bbond007 »

jordi wrote: Tue Oct 25, 2022 7:29 am Keyboard - The IBM PCjr.'s keyboard is basically compatible with the PCs, although not as easy to use due to the fewer keys and the chiclet arrangement. However, with Fn key combinations it is possible to generate all the keystrokes of the PC keyboard. The Tandy 1000's keyboard interface came from the less-than-PC compatible Tandy 2000, and while compatible at the BIOS Int 16 level, there are real differences on how the keyboards work at the hardware level. Games bypassing the BIOS routines may fail to recognize keyboard input.
Here is a more detailed description of pcJr keyboard handling:

"On the PCjr the Non-Maskable Interrupt (NMI) of the 8088 is used instead of IRQ 1 as on the IBM PC."

https://www.brutman.com/PCjr/pcjr_keybo ... dling.html
User avatar
spark2k06
Core Developer
Posts: 868
Joined: Sat Jun 06, 2020 9:05 am
Has thanked: 409 times
Been thanked: 961 times

Re: IBM PCjr BIOS in PCXT Core

Unread post by spark2k06 »

bbond007 wrote: Tue Oct 25, 2022 12:58 pm
jordi wrote: Tue Oct 25, 2022 7:29 am Keyboard - The IBM PCjr.'s keyboard is basically compatible with the PCs, although not as easy to use due to the fewer keys and the chiclet arrangement. However, with Fn key combinations it is possible to generate all the keystrokes of the PC keyboard. The Tandy 1000's keyboard interface came from the less-than-PC compatible Tandy 2000, and while compatible at the BIOS Int 16 level, there are real differences on how the keyboards work at the hardware level. Games bypassing the BIOS routines may fail to recognize keyboard input.
Here is a more detailed description of pcJr keyboard handling:

"On the PCjr the Non-Maskable Interrupt (NMI) of the 8088 is used instead of IRQ 1 as on the IBM PC."

https://www.brutman.com/PCjr/pcjr_keybo ... dling.html
This has important implications, especially in relation to serdrive, if we ever use it with this BIOS, as the use of floppy and PC booters could be sufficient in principle, and for the rest, use Tandy 1000:
The leading edge of the start bit from the keyboard signals the NMI on the 8088. When the NMI occurs the PCjr jumps to a routine to start reading the incoming data stream from the keyboard. Interrupts are disabled during this time so any hardware event that requires service in 4.8 milliseconds to avoid an overrun condition might experience an overrun.

This explains why the PCjr can not reliably transfer data using the serial port at high speed:
However, I wonder whether this is really critical for the normal functioning of the BIOS or whether the fact that we also use IRQ 1 is transparent.
kitune-san
Top Contributor
Posts: 401
Joined: Wed May 18, 2022 11:20 am
Has thanked: 127 times
Been thanked: 412 times

Re: IBM PCjr BIOS in PCXT Core

Unread post by kitune-san »

PCJr cannot use PCXT keyboard controller.
kitune-san
Top Contributor
Posts: 401
Joined: Wed May 18, 2022 11:20 am
Has thanked: 127 times
Been thanked: 412 times

Re: IBM PCjr BIOS in PCXT Core

Unread post by kitune-san »

In PCXT, keyboard input was buffered in the shift register.
However, in PCJr, the data signal is input directly to 8255.

If we want to implement it in MisterPCXT... we will need to create a converter.
User avatar
spark2k06
Core Developer
Posts: 868
Joined: Sat Jun 06, 2020 9:05 am
Has thanked: 409 times
Been thanked: 961 times

Re: IBM PCjr BIOS in PCXT Core

Unread post by spark2k06 »

kitune-san wrote: Tue Oct 25, 2022 2:30 pm In PCXT, keyboard input was buffered in the shift register.
However, in PCJr, the data signal is input directly to 8255.

If we want to implement it in MisterPCXT... we will need to create a converter.
It seems like it would take a lot of work, maybe in the future it could be assessed. We would only gain another small catalogue of PCjr exclusive
Tandy 320x200 16 colour games, I don't think much more... so I don't know if it's worth the effort.

Anyway, thanks for the information!
AmintaMister
Posts: 292
Joined: Thu Sep 16, 2021 10:54 pm
Has thanked: 764 times
Been thanked: 45 times

Re: IBM PCjr BIOS in PCXT Core

Unread post by AmintaMister »

spark2k06 wrote: Tue Oct 25, 2022 2:55 pm
kitune-san wrote: Tue Oct 25, 2022 2:30 pm In PCXT, keyboard input was buffered in the shift register.
However, in PCJr, the data signal is input directly to 8255.

If we want to implement it in MisterPCXT... we will need to create a converter.
It seems like it would take a lot of work, maybe in the future it could be assessed. We would only gain another small catalogue of PCjr exclusive
Tandy 320x200 16 colour games, I don't think much more... so I don't know if it's worth the effort.

Anyway, thanks for the information!
From the historical point of view the support of PCJr would be a HUGE think, even if the catalogue is small.. In meantime, THANKS for your EXCELLENT work! I'm enjoying using PCXT core on my MiSTer!
bbond007
Top Contributor
Posts: 521
Joined: Tue May 26, 2020 5:06 am
Has thanked: 86 times
Been thanked: 204 times

Re: IBM PCjr BIOS in PCXT Core

Unread post by bbond007 »

kitune-san wrote: Tue Oct 25, 2022 2:30 pm In PCXT, keyboard input was buffered in the shift register.
However, in PCJr, the data signal is input directly to 8255.

If we want to implement it in MisterPCXT... we will need to create a converter.
spark2k06 wrote: Tue Oct 25, 2022 2:55 pm It seems like it would take a lot of work, maybe in the future it could be assessed. We would only gain another small catalogue of PCjr exclusive
Tandy 320x200 16 colour games, I don't think much more... so I don't know if it's worth the effort.
We can't just alter the pcJr BIOS's keyboard ISR?

I guess there might be some stuff that reads the pcJr's keyboard directly without using the BIOS. I wonder how common that is...
User avatar
spark2k06
Core Developer
Posts: 868
Joined: Sat Jun 06, 2020 9:05 am
Has thanked: 409 times
Been thanked: 961 times

Re: IBM PCjr BIOS in PCXT Core

Unread post by spark2k06 »

bbond007 wrote: Tue Oct 25, 2022 4:56 pm We can't just alter the pcJr BIOS's keyboard ISR?
My philosophy in this core is not to alter BIOS code to avoid maintenance, let alone proprietary code. The alteration I have made so far is only on a test level.
bbond007
Top Contributor
Posts: 521
Joined: Tue May 26, 2020 5:06 am
Has thanked: 86 times
Been thanked: 204 times

Re: IBM PCjr BIOS in PCXT Core

Unread post by bbond007 »

spark2k06 wrote: Tue Oct 25, 2022 1:26 pm This has important implications, especially in relation to serdrive, if we ever use it with this BIOS, as the use of floppy and PC booters could be sufficient in principle, and for the rest, use Tandy 1000:
I was also considering that, however, I'd also guess that the XTIDE BIOS probably is aware of the FIFO in a 16550 UART so was not quite sure if it would be a factor or not...
User avatar
spark2k06
Core Developer
Posts: 868
Joined: Sat Jun 06, 2020 9:05 am
Has thanked: 409 times
Been thanked: 961 times

Re: IBM PCjr BIOS in PCXT Core

Unread post by spark2k06 »

bbond007 wrote: Tue Oct 25, 2022 11:03 pm
spark2k06 wrote: Tue Oct 25, 2022 1:26 pm This has important implications, especially in relation to serdrive, if we ever use it with this BIOS, as the use of floppy and PC booters could be sufficient in principle, and for the rest, use Tandy 1000:
I was also considering that, however, I'd also guess that the XTIDE BIOS probably is aware of the FIFO in a 16550 UART so was not quite sure if it would be a factor or not...
Well seen.
Malor
Top Contributor
Posts: 860
Joined: Wed Feb 09, 2022 11:50 pm
Has thanked: 64 times
Been thanked: 194 times

Re: IBM PCjr BIOS in PCXT Core

Unread post by Malor »

If the games are still calling into the BIOS for service routines, not being PCJr versions might not matter. You possibly could fool some games by just changing to the PCJr ID byte, rather than implementing the entire hardware and BIOS.

That may also blow up spectacularly, if the programs try to twiddle the hardware directly without using the BIOS.
azesmbog
Posts: 32
Joined: Thu Jun 11, 2020 7:00 am
Has thanked: 22 times
Been thanked: 25 times

Re: IBM PCjr BIOS in PCXT Core

Unread post by azesmbog »

A little off topic, but still I’ll ask, but have you tried to run such a BIOS?))
https://github.com/640-KB/GLaBIOS
User avatar
spark2k06
Core Developer
Posts: 868
Joined: Sat Jun 06, 2020 9:05 am
Has thanked: 409 times
Been thanked: 961 times

Re: IBM PCjr BIOS in PCXT Core

Unread post by spark2k06 »

azesmbog wrote: Sun Oct 30, 2022 11:37 am A little off topic, but still I’ll ask, but have you tried to run such a BIOS?))
https://github.com/640-KB/GLaBIOS
Interesting BIOS, it works perfectly. I will make reference to it in the README of the project, thanks!
GLaBIOS.png
GLaBIOS.png (122.86 KiB) Viewed 2982 times
MicroCoreLabs
Core Developer
Posts: 96
Joined: Sun Jun 05, 2022 6:12 pm
Location: California
Has thanked: 6 times
Been thanked: 86 times
Contact:

Re: IBM PCjr BIOS in PCXT Core

Unread post by MicroCoreLabs »

For the PCjr experiment is there any way to insert a CTL-ALT-INS which, after the splash screen, begins the internal diagnostics. It will display a menu and memory count at the top the screen which would be interesting to see.
User avatar
spark2k06
Core Developer
Posts: 868
Joined: Sat Jun 06, 2020 9:05 am
Has thanked: 409 times
Been thanked: 961 times

Re: IBM PCjr BIOS in PCXT Core

Unread post by spark2k06 »

MicroCoreLabs wrote: Sun Oct 30, 2022 10:08 pm For the PCjr experiment is there any way to insert a CTL-ALT-INS which, after the splash screen, begins the internal diagnostics. It will display a menu and memory count at the top the screen which would be interesting to see.
I can see from the 86Box emulator that a lot of diagnostics can be done:
test_pcjr.png
test_pcjr.png (2.52 KiB) Viewed 2864 times
However, as the keyboard does not work, it is not possible to do CTRL-ALT-INS... and even if I skip this step and manage to enter, I will not be able to enter any of the tests, because the keyboard is needed for it :)
User avatar
Caldor
Top Contributor
Posts: 930
Joined: Sat Jul 25, 2020 11:20 am
Has thanked: 112 times
Been thanked: 111 times

Re: IBM PCjr BIOS in PCXT Core

Unread post by Caldor »

I think I saw that Alleycat has a special color theme for the PCjr. Not sure how many games have special PCjr support though.

This article goes into it. There does seem to be... well... more than 10 games? That have PCjr specific enhancements without having Tandy support as an alternative:
http://nerdlypleasures.blogspot.com/202 ... usive.html

Certainly could be interesting to see support for it at some point. I still have plans to do a video of this core, but have not gotten around to it. Got sidetracked by new VR hardware and the C64OS and games.
jordi
Posts: 238
Joined: Thu Jun 11, 2020 10:11 am
Has thanked: 95 times
Been thanked: 80 times

Re: IBM PCjr BIOS in PCXT Core

Unread post by jordi »

Caldor wrote: Tue Nov 01, 2022 8:43 am I think I saw that Alleycat has a special color theme for the PCjr. Not sure how many games have special PCjr support though.

This article goes into it. There does seem to be... well... more than 10 games? That have PCjr specific enhancements without having Tandy support as an alternative:
http://nerdlypleasures.blogspot.com/202 ... usive.html

Certainly could be interesting to see support for it at some point. I still have plans to do a video of this core, but have not gotten around to it. Got sidetracked by new VR hardware and the C64OS and games.
You should check tandycat patch which is mostly creating this alleycat version on the tandy.
jordi
Posts: 238
Joined: Thu Jun 11, 2020 10:11 am
Has thanked: 95 times
Been thanked: 80 times

Re: IBM PCjr BIOS in PCXT Core

Unread post by jordi »

https://www.vogons.org/viewtopic.php?t=50417

I found this thread to be very interesting on how PC jr is detected
MicroCoreLabs
Core Developer
Posts: 96
Joined: Sun Jun 05, 2022 6:12 pm
Location: California
Has thanked: 6 times
Been thanked: 86 times
Contact:

Re: IBM PCjr BIOS in PCXT Core

Unread post by MicroCoreLabs »

The MCL86 does work in a real PCjr :)

https://www.youtube.com/watch?v=BUYmz3fqxss
AmintaMister
Posts: 292
Joined: Thu Sep 16, 2021 10:54 pm
Has thanked: 764 times
Been thanked: 45 times

Re: IBM PCjr BIOS in PCXT Core

Unread post by AmintaMister »

So, no luck to support Pc Jr Bios even only for the booters?

User avatar
spark2k06
Core Developer
Posts: 868
Joined: Sat Jun 06, 2020 9:05 am
Has thanked: 409 times
Been thanked: 961 times

Re: IBM PCjr BIOS in PCXT Core

Unread post by spark2k06 »

AmintaMister wrote: Wed Jan 17, 2024 3:27 am

So, no luck to support Pc Jr Bios even only for the booters?

It has many implications. I know kitune-san is working on a version of PCJr, currently as POC:

https://github.com/kitune-san/KFPCJr

Maybe in the future it will become a reality and we can have a core exclusive to this system.

AmintaMister
Posts: 292
Joined: Thu Sep 16, 2021 10:54 pm
Has thanked: 764 times
Been thanked: 45 times

Re: IBM PCjr BIOS in PCXT Core

Unread post by AmintaMister »

spark2k06 wrote: Wed Jan 17, 2024 4:35 am
AmintaMister wrote: Wed Jan 17, 2024 3:27 am

So, no luck to support Pc Jr Bios even only for the booters?

It has many implications. I know kitune-san is working on a version of PCJr, currently as POC:

https://github.com/kitune-san/KFPCJr

Maybe in the future it will become a reality and we can have a core exclusive to this system.

Great news to hear, thanks!

Post Reply