Page 1 of 1

Detecting PCjr/Tandy video?

PostPosted: Mon Jul 12, 2010 8:55 am
by CommodoreJohn
I'm wondering if there's a good way to detect the video system for the PCjr or Tandy computers without either having to perform a bunch of attempted mode changes (annoying) or prompting the user (slow and annoying.) Assembler examples would be nice, but any explanation of how to do it would be very welcome.

Re: Detecting PCjr/Tandy video?

PostPosted: Mon Jul 12, 2010 9:48 am
by Brutman
On a PCjr this is pretty easy. Look for the ID byte at the high end of ROM - it should say 0xFD. You can check the BIOS date too to be sure - there was only one PCjr BIOS version, so it is always the same. (June 1983 or something like that.) And then lastly check the BIOS RAM area for the amount of installed memory - a PCjr with 64KB does not have access to the extended video modes, but a 128KB Jr can do them all.

The Tandy machines are going to be a problem. There must be a common copyright string you can look for. I'm not sure what ROM ID byte they use - that might vary. And there is no secret port that I know of that says what a machine is capable of displaying, or that provides a rock solid ID for the machine. Which is why way back when all of the games asked you what kind of graphics you wanted to use.

Re: Detecting PCjr/Tandy video?

PostPosted: Mon Jul 12, 2010 10:16 am
by CommodoreJohn
Hmm. I looked around a bit, and found two things. First, on all the Tandy 1000x BIOS ROMs I looked through, the text "Tandy Corporation" appears somewhere after 0xC000 in the ROM file (F000:C000 in the machine, I think;) it's not at the same address across revisions, but it seems to be within the first 256 bytes of that area, so it would be easy to search for. More simply, though, this thread over on the VOGONS forums says that Tandy systems have a special ID byte of 0x21 at exactly F000:C000 (the normal ID byte looks to be 0xFF.) The ROMs I looked through seem to confirm this. I dunno about the Tandy 2000, though.

Thanks for your help!

Re: Detecting PCjr/Tandy video?

PostPosted: Mon Jan 10, 2011 7:36 pm
by deathshadow60
Not to bump a seven month old post, but my latest blog entry is related -- which Is part of my Winter-warm up for the 2011 retro challenge.

For those of you who don't want to click through to the blog, the meat of it being my current video card detection routine: (TP7/ASM mix)

Code: Select all

function detectCard:byte; assembler;
   mov  ax,$1200
   mov  bl,$32       { VGA only enable video }
   int  $10
   cmp  al,$12       { VGA returns $12, all others leave it unmodified! }
   jne  @notVGA      { not a vga, test for EGA }
   mov  al,videoCard_vga
@notVGA:           { We eliminated VGA, so an EGA/VGA true must be EGA }
   mov  ah,$12
   mov  bl,$10       { EGA/VGA get configuration info }
   int  $10
   and  bl,$03       { EGA/VGA returns a 0..3 value here }
   jz   @notEGA      { not a VGA, test for MDA }
   mov  al,videoCard_ega
@notEGA:            { MDA all we need to detect is video mode 7 }
   mov  ah,$0F       { get Video mode }
   int  $10
   cmp  al,$07
   jne  @notMDA
   mov  al,videoCard_mda
@notMDA:            { not MDA, check for Jr. }
   mov  ax,$FFFF
   mov  es,ax
   mov  di,$000E     { second to last byte PCjr/Tandy BIOS info area }
   mov  al,$FD       { ends up $FD only on the Jr. }
   cmp  es:[di],al
   jne  @notJr
   mov  al,videoCard_pcJr
@notJr:             { not junior, test for tandy }
   mov  al,$FF       { all tandy's return $FF here }
   cmp  es:[di],al
   jne  @notTandy
   mov  ax,$FC00
   mov  es,ax
   xor  di,di
   mov  al,$21
   cmp  es:[di],al
   jne  @notTandy
   mov  ah,$C0       { test for SL/TL }
   int  $15          { Get System Environment }
   jnc  @tandySLTL     { early Tandy's leave the carry bit set, TL/SL does not }
   mov  al,videoCard_tandy1000
   mov  al,videoCard_tandySLTL
   mov  al,videoCard_cga { all other cards eliminated, must be CGA }

I'm hoping to add AT&T "400", 8514 and 3270 support to that as well in the near future.