|
Joined: Mar 2002
Posts: 1,368 Likes: 120
Very Senior Member
|
Very Senior Member
Joined: Mar 2002
Posts: 1,368 Likes: 120 |
Got it, it's working fine now. =)
|
|
|
|
Joined: May 2010
Posts: 1,051
Very Senior Member
|
OP
Very Senior Member
Joined: May 2010
Posts: 1,051 |
Cool! Was it in the LED decay code? I thought about that last night when I went to bed. Did whatever you change fix any other COP4 games?
|
|
|
|
Joined: Mar 2002
Posts: 1,368 Likes: 120
Very Senior Member
|
Very Senior Member
Joined: Mar 2002
Posts: 1,368 Likes: 120 |
I don't know if it's a bug in the cpu core, or that it's just the way the pins work. I had to reset the L pins after they're written. It's the same workaround I did for Coleco Basketball.
The display bugs on Space Invader are similar, but the workaround doesn't work there.
|
|
|
|
Joined: May 2010
Posts: 1,051
Very Senior Member
|
OP
Very Senior Member
Joined: May 2010
Posts: 1,051 |
Here's what I thought about while trying to go to sleep: The game strobes the digits from right to left, setting the segments for the current digit. So select digit 1, set segments, select digit 2, set segments, etc. There's a little time after digit 2 has been selected before the digit 2 segments have been set, so the digit 1 segments are still active. I thought maybe the decay code sees that glitch and extends it.
QKR actually disables the segment outputs (EN2=0) before selecting the digit and setting the segments, then re-enables them (EN2=1). I'm guessing that's to keep those glitches from causing ghosts.
I'll take a look at SI and see if it does the same; if so, maybe you could not update the display if EN2=0, then update it when EN2 gets set?
|
|
|
|
Joined: Mar 2002
Posts: 1,368 Likes: 120
Very Senior Member
|
Very Senior Member
Joined: Mar 2002
Posts: 1,368 Likes: 120 |
You're right. It looks like there was a problem with the "lei" instruction, where L pins were not disabled if EN2=0. I'll get rid of the workaround, I think Space Invader is ok as well now.
*edit* indeed, Space Invader looks ok now. h2hbaskb still has display bugs without the workaround though.
Last edited by hap; 12/19/16 08:48 PM.
|
|
|
|
Joined: May 2010
Posts: 1,051
Very Senior Member
|
OP
Very Senior Member
Joined: May 2010
Posts: 1,051 |
I got Jacks and Red Light Green Light a little further along. COP410 only has 32 nibbles of RAM: each of the 4 registers only has 8 nibbles; 0-7 are mirrored to 8-15. The code was treating RAM as 2 registers of 16 nibbles mirrored to registers 2 and 3. So only 1/2 of the locations could be accessed. I'm not sure of the best way to do it, but I replaced the RAM_R and RAM_W macros with functions that modify the RAM index for COP410s.
uint16_t cop400_cpu_device::RAM_R(uint16_t addr)
{
if (m_featuremask != COP410_FEATURE)
{
return m_data->read_byte(addr);
}
else
{
return m_data->read_byte((addr>>1&0x18)|(addr&7));
}
}
void cop400_cpu_device::RAM_W(uint16_t addr,uint16_t data)
{
if (m_featuremask != COP410_FEATURE)
{
m_data->write_byte(addr, data);
}
else
{
m_data->write_byte((addr>>1&0x18)|(addr&7),data);
}
}
Now Jacks seems to run OK, except that I can't pick up the jacks. And Red Light Green Light is better, but the red and green lights don't light up to tell you when to click, so you have to play blind.
|
|
|
|
Joined: May 2010
Posts: 1,051
Very Senior Member
|
OP
Very Senior Member
Joined: May 2010
Posts: 1,051 |
On Jacks, if I hold down multiple buttons I can pick up jacks, but I haven't figured out exactly what's going on yet.
|
|
|
|
Joined: Mar 2002
Posts: 1,368 Likes: 120
Very Senior Member
|
Very Senior Member
Joined: Mar 2002
Posts: 1,368 Likes: 120 |
Thanks, COP410 internal RAM memorymap should be good now. Red Light Green Light is playable with display problems, as if leds get inverted sometimes.
|
|
|
|
Joined: May 2010
Posts: 1,051
Very Senior Member
|
OP
Very Senior Member
Joined: May 2010
Posts: 1,051 |
Thanks! I should have thought of that solution, rather than the quick hack I did.
I figured out the problem with RLGL, but not the answer. I looked at the schematics some more, and noticed that the LED transistors are PNPs; that means the bases must be low for the LEDs to light, so L is active low. I inverted the data in write_l, and the stop and go LEDs started flashing like they should, but a couple of other LEDs also lit up. I thought some more, and figured out it was the LEI fix for EN2=0; the L outputs shouldn't be set low, they should be high impedance. Because the LEDs in RLGL are active low, setting the L outputs low was turning on a bunch of LEDs.
I tested by changing the LEI fix code to set L to 0xff instead of 0 when EN2=0 and that did make RLGL work. Of course it breaks other games (but I should check to see if it makes Basketball work without the other hack).
I'm not sure if there is some kind of tri-state variable to use, or if it would be best to have an active state flag (probably a vector, since each L output could be different) and set L to that value instead of 0 when EN2=0.
|
|
|
|
Joined: May 2010
Posts: 1,051
Very Senior Member
|
OP
Very Senior Member
Joined: May 2010
Posts: 1,051 |
The troublesome code in Jacks is at AF:
AF LBI 0,9 ;set B to 9
B0 INL ;M=L<7:4>, A=L<3:0>
B2 SKE ;skip if A=M
B3 JMP 10A
b5 LB 1,13
When this code is hit, EN2 is set, so L outputs are enabled. Normally, you would disable outputs while getting input. I thought I read something in the data sheet about this, but I can't find it now. I think any output bits set to 1 will read as 1s unless they are driven low. L<5:4> are the muxed button inputs and L<1:0> are the LED muxes. If I'm correct about the output bits getting read, then that SKE will compare those.
|
|
|
0 members (),
305
guests, and
1
robot. |
Key:
Admin,
Global Mod,
Mod
|
|
Forums9
Topics9,320
Posts121,923
Members5,074
|
Most Online1,283 Dec 21st, 2022
|
|
These forums are sponsored by Superior Solitaire, an ad-free card game collection for macOS and iOS. Download it today!
|
|
|
|