Changing banks however on the hardware side is very easy if you are using the standard neogeo cart hardware. The P ROM bank is from 0x200000 – 0x2FFFFF, bank 0 is default. You write the bank number (word size) you require to 0x2FFFF0, for normal hardware 4 banks are possible (0 to 3). Once you swap the bank you need to read the address to confirm the bank has changed (something like https://wiki.neogeodev.org/index.php?title=Cartridge_self-checking). This means 0x2FFFF0 in each data bank must contain its bank number.
Ho lavorato per anni con l'assembly 68K
Prova a riportare i tuoi problemi qui, in dettaglio, e se avrò la possibilità cercherò di aiutarmi, ma non posso prometterti nulla di sicuro.
ROM_START( neothunx ) ROM_REGION( 0x100000, "maincpu", 0 ) ROM_LOAD( "dev_p1.rom", 0x000000, 0x100000, CRC(f67f9aee) SHA1(17677c7f08fe0265453a329e507cce0fcf2ab234) ) NEO_SFIX_128K( "202-s1.s1", CRC(cd19264f) SHA1(531be2305cd56d332fb7a53ab924214ade34a9e8) ) /* TC531000 */ NEO_BIOS_AUDIO_128K( "202-m1.m1", CRC(9c0291ea) SHA1(3fa67c62acba79be6b3a98cc1601e45569fa11ae) ) /* TC531001 */ ROM_REGION( 0x080000, "ymsnd", 0 ) ROM_LOAD( "202-v1.v1", 0x000000, 0x080000, CRC(debeb8fb) SHA1(49a3d3578c087f1a0050168571ef8d1b08c5dc05) ) /* TC534200 */ NO_DELTAT_REGION ROM_REGION( 0x4000000, "sprites", 0 ) ROM_LOAD( "char.bin", 0x000000, 0x4000000, CRC(2878f3aa) SHA1(043acd05b243d25b49df004aad72f5abcdcc5391) )ROM_END
You write the bank number (word size) you require to 0x2FFFF0, for normal hardware 4 banks are possible (0 to 3). Once you swap the bank you need to read the address to confirm the bank has changed (something like https://wiki.neogeodev.org/index.php?title=Cartridge_self-checking). This means 0x2FFFF0 in each data bank must contain its bank number.
int *BANK_NUMBER = (int *)(0x2ffff0);bool switch(int bank) { *BANK_NUMBER = bank; // Double check: returns "true" when switching; false on error return (*BANK_NUMBER == bank)}// .... // Qui mi serve fare switching:if (switch(3)) { // Sono nel banco 3, carico i dati che mi servono} else { // Si è verificato un errore, non riesco a cambiare banco}
If you want to change P rom bank all you need is; move.b #$00, $2FFFF0 the above will set to bank 0 move.b #$01, $2FFFF0 the above will set to bank 1 Its very simple. Once you change the bank you simply read some expected data at an address inside the bank and keep reading it until you receive the expected value. Once its there you know that bank has successfully changed
@z80 fantu forse hai visto meglio il gameboy: questa faccenta ti e' capitata ? a me no, nella mia cartuccia avevo si l'MBC5 ma indirizzavo 32Kbyte, senza quindi dover cambiare banco.
secondo si può anche fare una cosa molto bovina, ovvero, dato che ogni bank e' un mondo isolato, in address collision (ovvero tutti i bank assumono di vedere lo stesso address space), allora li si può trattare come se fossero dei processi.
//settiamo la banca..char * const MY_BANKNUM = (char * const )(0x2ffff0);extern char CBANK;
if(p1&JOY_C) { CBANK = '1'; *MY_BANKNUM = CBANK; prepareStep(); STAGE1(); break; }
if(p1&JOY_D) { CBANK = '0'; *MY_BANKNUM = CBANK; prepareStep(); STAGE1(); break; }