It is currently Tue Sep 18, 2018 12:45 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 81 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next
Author Message
PostPosted: Thu Mar 01, 2018 8:32 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 7518
Location: Seattle
Per your description of mapper 173, on my mapper 36 board, shouldn't writes to $4101 have done something to the resultant bank?

e.g. the sequence
$00 -> [$4103]
$30 -> [$4102]
$30 -> [$4101]
xx -> [$4100]
xx -> [$8000]
should cause bank 0 to be mapped, and also 0 to read back from the ASIC?

In contrast, writing 0 to $4101 should have caused bank 3 to be mapped and 3 to read back from the ASIC?

I'm pretty certain that writes to $4101 had just no effect at all when I was testing before, but if it doesn't involve test clips I'm willing to play with hot-swapping things again.


Top
 Profile  
 
PostPosted: Thu Mar 01, 2018 10:43 pm 
Offline

Joined: Thu May 19, 2005 11:30 am
Posts: 649
No, because Mapper 36 does not connect Pin 22 to any PRG or CHR pins, but Mapper 173 does, and I'm still insisting that Pin 22 is operated by $4101. Basically, the way I think it works (and the only way that emulation works) is like this: Writing anything to $8000-$FFFF not only copies the internal register bits (originally from pins 6/8-12) to the output pins (1-3, 23, 24), but also copies the inverse of the $4101 state to Pin 22. Note that I do not expect that writing to $4101 alone without being followed by the usual $4103/$4101/$8000 sequence will have any effect. Because Pin 22 is not connected to anything on Mapper 36, you will not be able to see the effect from hot-plugging alone without connecting something, either a LED or a voltmeter, to Pin 22.

To get 8 KiB CHR bank 0 in Mapper 173, you must write: $FF to $4101 and $x1 (AND $01) to $4102 (and then the usual rest).
To get 8 KiB CHR bank 1 in Mapper 173, you must write: $FF to $4101 and $x0 (AND $01) to $4102 (and then the usual rest).
To get 8 KiB CHR bank 2 in Mapper 173, you must write: $00 to $4101 and $x0 (AND $01) to $4102 (and then the usual rest).
To get 8 KiB CHR bank 3 in Mapper 173, you must write: $00 to $4101 and $x1 (AND $01) to $4102 (and then the usual rest).
The other bits in $4102 are only relevant for the game reading back from $4100 and checking its value. You can see it yourself in the Mapper 173 dump of Puzzle from PC $E6F5 on (which also does three increments, so it'll be a bit more complicated). Here's the equivalent Kazzo script, also with three increments since it was just copied after the game's code:
Code:
function ppu_dump(d, pagesize, banksize)
{
   for(local i = 0; i < pagesize; i++){
      local xorvalue = ((i >> 1) & 1) * 0xFF) ^ 0xFF;
      cpu_write(d, 0x4101, xorvalue);
      local written = (((i & 7) - 3) & 7) | (i & 8);
      cpu_write(d, 0x4102, written ^ xorvalue);
      cpu_write(d, 0x4103, 0);
      cpu_write(d, 0x4100, 0);
      cpu_write(d, 0x4103, 0xFF);
      cpu_write(d, 0x4100, 0xFF);
      cpu_write(d, 0x4100, 0xFF);
      cpu_write(d, 0x4100, 0xFF);
      cpu_write(d, 0x80EF, 0xFF);
      ppu_read(d, 0, banksize);
   }
}


Top
 Profile  
 
PostPosted: Fri Mar 02, 2018 1:15 am 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 7518
Location: Seattle
Sure? I wasn't talking about the CHR A14 bit on mapper 173, but rather what's going on with the readback value.

For mapper 173, you wrote
Code:
Read $4100-$4103: [.... RRRR]: Read Register. Bit 3 is inverted if Invert==1. Bits 4-7 are open bus.
Write $4100: When Mode==0: Bits 0-3 of Register := Input, bits 0-2 being inverted if Invert==1.
             When Mode==1: Bits 0-2 of Register incremented by one, bit 3 unaffected.
Write $4101: Invert := Written value bit 0.
Write $4102: Input := Written value bits 0-3.
Write $4103: Mode := Written value bit 0.
Write $8000-$FFFF: Output := Register; written value is ignored.


so if I write 0 to $4103, then 0 to $4102, then $10 to $4101, and then anything to $4100 ... the value I read back from $4100 should be something other than 0, right? Or am I confused?


Top
 Profile  
 
PostPosted: Fri Mar 02, 2018 1:25 am 
Offline

Joined: Thu May 19, 2005 11:30 am
Posts: 649
All games always write to $4101 before writing to $4102, and then do not write to $4101 until they have read from $4100 to check its result. So honestly I have no idea what to expect when writing to $4101 after you have written to $4102. That will have to be investigated.

I do think that we should investigate the $4101->Pin 22 issue first (assuming you don't insist on the "broken chip" explanation).


Last edited by NewRisingSun on Fri Mar 02, 2018 10:03 am, edited 1 time in total.

Top
 Profile  
 
PostPosted: Fri Mar 02, 2018 2:07 am 
Offline

Joined: Tue Feb 14, 2017 9:50 am
Posts: 89
I have a ET.02 Xiao Ma Li up for grabs. So if any of you want it to have some fun with the ITC20V8…


Top
 Profile  
 
PostPosted: Fri Mar 02, 2018 11:34 am 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 7518
Location: Seattle
NewRisingSun wrote:
All games always write to $4101 before writing to $4102, and then do not write to $4101 until they have read from $4100 to check its result. So honestly I have no idea what to expect when writing to $4101 after you have written to $4102. That will have to be investigated.
What I'm trying to get at isn't the order, but instead that it seems that writes to $4101should have done anything at all on mapper 36, unless I'm really misunderstanding things.

Quote:
I do think that we should investigate the $4101->Pin 22 issue first (assuming you don't insist on the "broken chip" explanation).
I can't rule out that behavior having something to do with pins 4-8 being wired differently.

MLX wrote:
I have a ET.02 Xiao Ma Li up for grabs. So if any of you want it to have some fun with the ITC20V8…
I unfortunately only have a front-loading NES and no famicom-to-NES adapter, so would have difficulty doing any tests. (short of desoldering it)


Top
 Profile  
 
PostPosted: Fri Mar 02, 2018 11:45 am 
Offline

Joined: Thu May 19, 2005 11:30 am
Posts: 649
Quote:
What I'm trying to get at isn't the order, but instead that it seems that writes to $4101 should have done anything at all on mapper 36, unless I'm really misunderstanding things.
Let me revise what I have previously written to more accurately answer your question. The snipped you quoted, if correct, would say in terms of chip pins (and with my new understanding that there are really six bits plus one carry bit, even if Mapper 173 only connects four of them):
  1. Writing to $4101 changes Invert to Pin 12's value.
  2. When $4100 is written to and Mode is 0, the value previously written to $4102, being the triplet from Pin 10-12 and the triplet from Pin 6/8/9, is copied into Register. If Invert is active, the triplet from Pin 10-12 is inverted during copying, while the triplet from Pin 6/8/9 is not inverted.
  3. When $4100 is read from, the two triplets from Register are copied to Pin 6/8/9 and Pin 10-12. If Invert is active, the triplet copied to Pin 6/8/9 is inverted during copying while the triplet copied to Pin 10-12 is not inverted.
  4. When $8000 is written to, Register is copied to Output, and Pin 22 goes high if Invert is inactive and low if Invert is active.
The basic hypthesis here is that $4101 inverts one triplet during writing only and the other triplet during reading only.

On Mapper 36, since only two bits of the Pin 10-12 triplet and none of the bits of the Pin 6/8/9 triplet are connected, writing a value to $4102+$4100 with Invert inactive, then activating Invert, then reading via $4100 will return the same value because reading $4100 only inverts the non-connected triplet. Writing a value to $4102+$4100 with Invert active and reading it back via $4100 should however invert it. This is something you can test without clips.


Last edited by NewRisingSun on Fri Mar 02, 2018 12:43 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Fri Mar 02, 2018 12:30 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 7518
Location: Seattle
Ok, great, my earlier analysis was wrong. Writes to $4101 do have an effect.

If I specifically write:
$30 → [$4102]
$10 → [$4101]
xx → [$4100]

then the value read back is $4F (D7, D6, D3-D0 open bus)

If I write
$30 → [$4102]
$20 → [$4101]
xx → [$4100]

then the value read back is $7F.

Subsequently, if I just write

$10 or $00 → [$4101]
xx → [$4100]

then the value switches to $4F and $7F as appropriate.

My hotswap test reads back after every write, and the value read back doesn't change until the final write to $4100.


Top
 Profile  
 
PostPosted: Fri Mar 02, 2018 12:43 pm 
Offline

Joined: Thu May 19, 2005 11:30 am
Posts: 649
Yes, that seems compatible with my description. I have further edited it to highlight the importance of the final $4100 write. The experiment also nicely shows that only Pin 12 is relevant during the $4101 write. As for $4101 inverting the 6/8/9 triplet while reading from $4100, as I hypothesized, you will not be able to test this with a Mapper 36 board without using clips, as these pins are not connected to the CPU data bus.


Top
 Profile  
 
PostPosted: Fri Mar 02, 2018 12:49 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 7518
Location: Seattle
Mostly I was just worried about my earlier (incomplete) evidence implying a difference between your required behavior in mapper 173 and what I'd observed in mapper 36. But now that's resolved cleanly.


Top
 Profile  
 
PostPosted: Sun Mar 04, 2018 1:12 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 7518
Location: Seattle
MLX wrote:
I have a ET.02 Xiao Ma Li up for grabs. So if any of you want it to have some fun with the ITC20V8…
Oh, actually. There's a few simple tests that would let us determine whether pin 4 is an input/output or connected internally to the other ground pin. Would you be willing to do them?

They're:
* measure resistance between pin 4 and pin 19 — whether it's more or less than a couple kiloohms
* measure diode drop across pin 19 to pin 4 — whether it exists
* measure diode drop across pin 4 to pin 5/7 — whether it exists


Top
 Profile  
 
PostPosted: Sun Mar 04, 2018 1:56 pm 
Offline

Joined: Tue Feb 14, 2017 9:50 am
Posts: 89
Alright. My multimeter is kinda primitive so I'm not sure it's going to meet your expectations.

1-2) I can't, pin 4 is grounded by a trace under the IC (from pin 19).
3) Since the multimeter only has ohmic and continuity functionnality, I can't mesure any voltage drop… but we can still check both side:
4->5, 4->7: 520 Ohm
5->4, 7->4: 637 Ohm
The same value were observed for both 5 and 7.

Since it's straight grounded.


Last edited by MLX on Sun Mar 04, 2018 2:07 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Sun Mar 04, 2018 1:59 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 7518
Location: Seattle
MLX wrote:
1-2) I can't, pin 4 is grounded by a trace under the IC (from pin 19).
Argh. Well, ok, that's the answer we're going to get for that question.


Top
 Profile  
 
PostPosted: Sun Mar 04, 2018 2:20 pm 
Offline

Joined: Thu May 19, 2005 11:30 am
Posts: 649
My hypothesis is still that Pin 4 was meant to take PA10 as an input and Pin 5 was originally meant to take PA11, and Pin 22 meant to output to CIRAM A10, relaying Pin 5 if $4101 D0==0 and Pin 4 if $4101 D0==1, just as Pins 24/25/26 on the JV001 ASIC. With Mapper 173 tying Pin 4 to GND and Pin 5 to Vcc, under this hypothesis, Pin 22 would instead constantly output 0 or 1 depending on the $4101 setting.


Top
 Profile  
 
PostPosted: Fri Mar 09, 2018 3:55 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 7518
Location: Seattle
I realized that I could easily use a wire-wrap tool to non-destructively add connections to my copy of Policeman ... if we can think of any tests where that would be useful.

Unfortunately, I don't see an easy way to read back the contents of pins 1,2, and 24-22 without adding a lot of extra hardware.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 81 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 4 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