It is currently Sat Aug 19, 2017 2:11 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Wed Feb 08, 2017 8:27 pm 
Offline

Joined: Sat Jul 04, 2015 9:08 am
Posts: 12
So theres a script already for Taito X1-005 (mapper 80) so I need to adapt it to Taito X1-017 (mapper 82).
The mappers are almost the same, in fact I get the PPU correct with the 005.

So mapper 80 is:
Code:
$7EFA,7EFB:  PRG Reg 0 (8k @ $8000)
$7EFC,7EFD:  PRG Reg 1 (8k @ $A000)
$7EFE,7EFF:  PRG Reg 2 (8k @ $C000)

function cpu_dump(d, pagesize, banksize)
{
   local i;
   for(i = 0; i < pagesize - 2; i += 2){
      cpu_write(d, 0x7efa, i);
      cpu_write(d, 0x7efc, i | 1);
      cpu_read(d, 0x8000, banksize * 2);
   }
   cpu_write(d, 0x7efe, i);
   cpu_read(d, 0xc000, banksize * 2);
}


mapper 82 is:
Code:
$7EFA:  [PPPP PP..]  PRG Reg 0 (8k @ $8000)
$7EFB:  [PPPP PP..]  PRG Reg 1 (8k @ $A000)
$7EFC:  [PPPP PP..]  PRG Reg 2 (8k @ $C000)


Ive got a crude understanding of kazoo scripts (enough to do damage), but this one has me confused.
It would be great if someone took the time one day to define all of these variables.

But im going to write my comments on this script on what i think is happening. Hopefully someone can correct me.
Code:
   for(i = 0; i < pagesize - 2; i += 2){ /* the total memory is 128k, i think the notes above mean that i can see 24k at one time. So would it mean i have 5 pages? but the +=2 seems to be counting banks.... */
      cpu_write(d, 0x7efa, i); /* 2nd arg is the register, notes above dont really make it clear what has to be written to the register, maybe 1,2,3...? */
      cpu_write(d, 0x7efc, i | 1); /* what is the OR 1 trying to do here?
      cpu_read(d, 0x8000, banksize * 2); /* reading from 0x8000 and 0xA000? */
   }
   cpu_write(d, 0x7efe, i); /* ok this is the 3rd bank, but i seem no reason its not part of the page..is it always the same?
   cpu_read(d, 0xc000, banksize * 2); /* reading from 0xC000 and beyond, i thought it would be *1 ? */


So clearly the registers should be 0x7efa, 0x7efb, 0x7efc, i dont understand what is written for the P's. Just an incrementing index?

Code:
function cpu_dump(d, pagesize, banksize)
{
   local i;
   for(i = 0; i < pagesize; i += 1){
      cpu_write(d, 0x7efa, i<<2);
      cpu_write(d, 0x7efb, i<<2);
      cpu_write(d, 0x7efc, i<<2);
      cpu_read(d, 0x8000, banksize * 3);
   }
}


Top
 Profile  
 
PostPosted: Thu Feb 09, 2017 11:40 am 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6033
Location: Seattle
Pickle wrote:
It would be great if someone took the time one day to define all of these variables.
The convention that we've taken to using on the wiki assumes a familiarity with binary numbers, specifically breaking the 8-bit bytes into its individual bits to express what's going on.

The writeup for the X1-017 says that the two least significant bits (i.e. the ones in the "ones" and "twos" place) are ignored, and the six most significant bits specify a ROM offset. That is: "0","1","2", or "3" means "the very first 8 KiB", "4","5","6", or "7" means "the next 8 KiB", and so on.

Quote:
/* the total memory is 128k, i think the notes above mean that i can see 24k at one time. So would it mean i have 5 pages? but the +=2 seems to be counting banks.... */
Except that 128 รท 24 = 5.3333, not 5. So instead, the dumper dumps 16 KiB at a time, taking exactly 8 loops.
Quote:
/* what is the OR 1 trying to do here? */
In this case, it's a funny way of writing "+ 1", because the dumper script assumes that least significant bit is always 0.
Quote:
cpu_write(d, 0x7efe, i); /* ok this is the 3rd bank, but i seem no reason its not part of the page..is it always the same?
cpu_read(d, 0xc000, banksize * 2); /* reading from 0xC000 and beyond, i thought it would be *1 ? */
For whatever reason, the convention in most Kazoo scripts seems to be read all but the last 16 KiB from the moveable windows, and then to read the last 16 KiB from the fixed window at 0xC000 and 0xE000.

Try something more like this:
Code:
function cpu_dump(d, pagesize, banksize)
{
   local i;
   for(i = 0; i < pagesize; i += 2){
      cpu_write(d, 0x7efa, i<<2);
      cpu_write(d, 0x7efb, (i+1)<<2);
      cpu_read(d, 0x8000, banksize * 2);
   }
}


Top
 Profile  
 
PostPosted: Thu Feb 09, 2017 1:48 pm 
Offline

Joined: Sat Jul 04, 2015 9:08 am
Posts: 12
Quote:
The writeup for the X1-017 says that the two least significant bits (i.e. the ones in the "ones" and "twos" place) are ignored, and the six most significant bits specify a ROM offset. That is: "0","1","2", or "3" means "the very first 8 KiB", "4","5","6", or "7" means "the next 8 KiB", and so on.


Yeah i know binary and understood the real value had to shifted. I just didnt see anywhere is said that PPPP was the index going from 0,1,etc.
In this case I should be able to access 0-15 banks. My thinking was that I could only access certain banks from their respective registers (thus no increments in the bit shifts)

Quote:
In this case, it's a funny way of writing "+ 1", because the dumper script assumes that least significant bit is always 0.


ok yeah I was thinking that.

Quote:
For whatever reason, the convention in most Kazoo scripts seems to be read all but the last 16 KiB from the moveable windows, and then to read the last 16 KiB from the fixed window at 0xC000 and 0xE000.


Ok this makes sense now the -2 in the for loop. I would not have thought though that writing to register C would load 2 8kb banks (just 1, the notes only say 8kb...).
ok can you explain fixed a little more?
I think your saying I can see hotswap any 2 of the 16 banks at A and B but I can only see 2 banks at C.
In other words once register C is written to its locked to those banks?


Top
 Profile  
 
PostPosted: Thu Feb 09, 2017 2:11 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6033
Location: Seattle
Pickle wrote:
Ok this makes sense now the -2 in the for loop. I would not have thought though that writing to register C would load 2 8kb banks (just 1, the notes only say 8kb...).
Your first reading was correct; writing to register C only loads the 8 KiB bank at $C000. However, in this mapper, the last 8 KiB (at $E000) are always mapped to the last 8 KiB of the ROM.

The script you inherited writes something equivalent to 256-2 to register C, and thus the last 16 KiB of the memory space seen by the Kazoo is equal to the last 16 KiB of the ROM.

Quote:
I think your saying I can see hotswap any 2 of the 16 banks at A and B but I can only see 2 banks at C.
In other words once register C is written to its locked to those banks?
No, register C is equally functional as registers A and B. As I said, this is just the convention used by the Kazoo scripts. If you wanted, you should be equally able to dump all up-to-512 KiB using any one of the three registers, and just changing the exact value of cpu_write and cpu_read accordingly.

By which I mean, e.g. this should work:
Code:
for (i = 0; i < pagesize ; i += 1) {
  cpu_write(d,0x7efa, i<<2);
  cpu_read(d,0x8000,banksize);
}
as should
Code:
for (i = 0; i < pagesize ; i += 1) {
  cpu_write(d,0x7efc, i<<2);
  cpu_read(d,0xC000,banksize);
}


Top
 Profile  
 
PostPosted: Thu Feb 09, 2017 4:08 pm 
Offline

Joined: Sat Jul 04, 2015 9:08 am
Posts: 12
thanks again for the help.

Here is the complete script for the record. The game is used it for was SD Keiji: Blader.

Code:
/*
Taito X1-017
*/
board <- {
   mappernum = 82, ppu_ramfind = false, vram_mirrorfind = false,
   cpu_rom = {
      size_base = 1 * mega, size_max = 2 * mega,
      banksize = 0x2000
   },
   ppu_rom = {
      size_base = 1 * mega, size_max = 1 * mega,
      banksize = 0x2000 / 8 //0x0800*2 + 0x0400 * 4
   }
};

function cpu_dump(d, pagesize, banksize)
{
   local i;
   for(i = 0; i < pagesize; i ++){
      cpu_write(d, 0x7efa, i<<2);
      cpu_read(d, 0x8000, banksize);
   }
}

function ppu_dump(d, pagesize, banksize)
{
   for(local i = 0; i < pagesize; i += 8){
      local ar = [i, i|2, i|4, i|5, i|6, i|7];
      cpu_write(d, 0x7ef0, ar);
      ppu_read(d, 0x0000, banksize * 8);
   }
}


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group