Author Topic: Would anyone care to explain the Neo Geo driver's nBIOS variable?  (Read 3768 times)

Offline Vague Rant

  • New Member
  • *
  • Posts: 7
  • Karma: +0/-0
I'm pretty incompetent and don't really know what I'm doing, so I was hoping somebody wouldn't mind explaining what's going on with the nBIOS variable in the Neo Geo driver. I'm really not a coder, so I'm only understanding the bare minimum of what's going on here: an external variable (nBIOS) is being read and different hex values are being returned based on the value of nBIOS.

For example, in d_neogeo.cpp, we have the following code snippet:
// This is actually set by a jumper on the PCB
UINT16 __fastcall KogReadWord(UINT32)
{
   extern INT32 nBIOS;
   if (nBIOS == 5 || nBIOS == 8 || nBIOS == 9 || nBIOS == 10 || nBIOS == 13 || nBIOS == 15) {
      return 0xff00;
   } else {
      return 0xff01;
   }
}

I have no idea what this is doing. My best guess: it's checking which BIOS is currently in use and returning one of two values based on ... the PCB jumper layout associated with that BIOS version? But I'm not sure where those values come from. My primary question is, what does the nBIOS value represent and where can I find that information in the code? Secondarily, how much does this affect emulation, if at all? What would go wrong if I got these numbers wrong?

Thanks so much for any help!

Offline barbudreadmon

  • Administrator
  • *****
  • Posts: 1091
  • Karma: +59/-1
  • Helper
Re: Would anyone care to explain the Neo Geo driver's nBIOS variable?
« Reply #1 on: May 12, 2019, 06:11:44 AM »
I think it is identifying the bios currently in use, the numbers might be the ones from the dipswitch in the 4th column here (?) :
Code: [Select]
{0, 0xFD, 0, 33,   "BIOS"                               },
{0x02, 0x01, 0x3f, 0x00, "MVS Asia/Europe ver. 6 (1 slot)"  },
{0x02, 0x01, 0x3f, 0x01, "MVS Asia/Europe ver. 5 (1 slot)"  },
{0x02, 0x01, 0x3f, 0x02, "MVS Asia/Europe ver. 3 (4 slot)"  },
{0x02, 0x01, 0x3f, 0x03, "MVS USA ver. 5 (2 slot)"          },
{0x02, 0x01, 0x3f, 0x04, "MVS USA ver. 5 (4 slot)"          },
{0x02, 0x01, 0x3f, 0x05, "MVS USA ver. 5 (6 slot)"          },
{0x02, 0x01, 0x3f, 0x06, "MVS USA (U4)"                     },
{0x02, 0x01, 0x3f, 0x07, "MVS USA (U3)"                     },
{0x02, 0x01, 0x3f, 0x08, "MVS Japan ver. 6 (? slot)"        },
{0x02, 0x01, 0x3f, 0x09, "MVS Japan ver. 5 (? slot)"        },
{0x02, 0x01, 0x3f, 0x0a, "MVS Japan ver. 3 (4 slot)"        },
{0x02, 0x01, 0x3f, 0x0b, "NEO-MVH MV1C (Asia)"              },
{0x02, 0x01, 0x3f, 0x0c, "NEO-MVH MV1C (Japan)"             },
{0x02, 0x01, 0x3f, 0x0d, "MVS Japan (J3)"                   },
{0x02, 0x01, 0x3f, 0x0e, "MVS Japan (J3, alt)"              },
{0x02, 0x01, 0x3f, 0x0f, "AES Japan"                        },
{0x02, 0x01, 0x3f, 0x10, "AES Asia"                         },
{0x02, 0x01, 0x3f, 0x11, "Development Kit"                  },
{0x02, 0x01, 0x3f, 0x12, "Deck ver. 6 (Git Ver 1.3)"        },
{0x02, 0x01, 0x3f, 0x13, "Universe BIOS ver. 3.3"           },
{0x02, 0x01, 0x3f, 0x14, "Universe BIOS ver. 3.2"           },
{0x02, 0x01, 0x3f, 0x15, "Universe BIOS ver. 3.1"           },
{0x02, 0x01, 0x3f, 0x16, "Universe BIOS ver. 3.0"           },
{0x02, 0x01, 0x3f, 0x17, "Universe BIOS ver. 2.3"           },
{0x02, 0x01, 0x3f, 0x18, "Universe BIOS ver. 2.3 (alt)"     },
{0x02, 0x01, 0x3f, 0x19, "Universe BIOS ver. 2.2"           },
{0x02, 0x01, 0x3f, 0x1a, "Universe BIOS ver. 2.1"           },
{0x02, 0x01, 0x3f, 0x1b, "Universe BIOS ver. 2.0"           },
{0x02, 0x01, 0x3f, 0x1c, "Universe BIOS ver. 1.3"           },
{0x02, 0x01, 0x3f, 0x1d, "Universe BIOS ver. 1.2"           },
{0x02, 0x01, 0x3f, 0x1e, "Universe BIOS ver. 1.2 (alt)"     },
{0x02, 0x01, 0x3f, 0x1f, "Universe BIOS ver. 1.1"           },
{0x02, 0x01, 0x3f, 0x20, "Universe BIOS ver. 1.0"           },
{0x02, 0x01, 0x3f, 0x21, "NeoOpen BIOS v0.1 beta"           },

Sorry i don't know the answer to your second question.

Offline dink

  • Administrator
  • *****
  • Posts: 5014
  • Karma: +449/-1
  • pie? I nearly bought one!
Re: Would anyone care to explain the Neo Geo driver's nBIOS variable?
« Reply #2 on: May 12, 2019, 08:57:05 AM »
Vague Rant,
nBIOS is the position of the bios in the bios list.  Different bios's require that the system return a different value here.   
f.ex the U.S. 6-slot and some Japan models need 0xff00 and all others need 0xff01

best regards,
- dink

Offline Vague Rant

  • New Member
  • *
  • Posts: 7
  • Karma: +0/-0
Re: Would anyone care to explain the Neo Geo driver's nBIOS variable?
« Reply #3 on: May 12, 2019, 09:01:38 AM »
Thanks very much, barbudreadmon and dink. I see now that the positions in the struct are listed in comments in d_neogeo.cpp, that helps immensely. Really appreciate the help from both of you. Thanks for both the support and your great work on FBA! :)