fabiensanglard / cpsb

The book of CPS-1
MIT License
107 stars 33 forks source link

68000 memory map on page 55 has issues #148

Closed frioglobal closed 1 year ago

frioglobal commented 1 year ago

In section 2.5.4, the 68000 memory map has some issues, as it shows the kick harness (0x800176-0x800177) and the CPS-B registers (0x800140-0x80017f) map to overlapping addresses. Different variants of the board map the kick harness, the CPS-A and B registers and the sound latches at different sets of addresses, while the map seems to show a combination of different variants?

fabiensanglard commented 1 year ago

Definitely an error. I cannot remember how I came up with these values. I have emailed Ben Torkington to see if he remembers.

The other values should be correct and all referring to ”Street Fighter 2” (mame="sf2"): board A ”88617A-7B”, board B ”90629B”, and board C ”90628-C”.

frioglobal commented 1 year ago

Sounds good, let me know when you figure out the correct map!

On Fri, Dec 30, 2022 at 1:35 AM Fabien @.***> wrote:

Definitely an error. I cannot remember how I came up with these values. I have emailed Ben Torkington to see if he remembers.

The other values should be correct and all referring to ”Street Fighter 2” (mame="sf2"): board A ”88617A-7B”, board B ”90629B”, and board C ”90628-C”.

— Reply to this email directly, view it on GitHub https://github.com/fabiensanglard/cpsb/issues/148#issuecomment-1367751893, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA3QW5SYI4IBO3B2ZYBHOZDWPZ7ETANCNFSM6AAAAAASQ65YR4 . You are receiving this because you authored the thread.Message ID: @.***>

bentorkington commented 1 year ago

0x800176-0x800177 is definitely the address of the kick buttons, at least on sf2ua. Here's the relevant part of the interrupt handler which reads the player inputs.

00001C16   1039 0080 0001                   MOVE.B    A_00800001,D0          
00001C1C   4600                             NOT.B     D0                     ;active low
00001C1E   1b40 007f                        MOVE.B    D0,(D_007f,A5)         ;write P1 controls
00001C22   1039 0080 0000                   MOVE.B    A_00800000,D0          ;other port
00001C28   4600                             NOT.B     D0                     ;active low
00001C2A   1b40 0083                        MOVE.B    D0,(D_0083,A5)
00001C2E   1039 0080 0177                   MOVE.B    A_00800177,D0          ;cps1_input2
00001C34   4600                             NOT.B     D0
00001C36   1200                             MOVE.B    D0,D1
00001C38   0200 0007                        AND.B     #0x7,D0                ;split kick buttons
00001C3C   1b40 007e                        MOVE.B    D0,(Game_ContrP1,A5)
00001C40   e849                             LSR.W     #4,D1
00001C42   0201 0007                        AND.B     #0x7,D1
00001C46   1b41 0082                        MOVE.B    D1,(Game_ContrP2) ;kick buttons

I don't have the schematics for a CPS SF2 board, but I think what's happening is the kick harness hangs off an unused part of the CPS-B address space

fabiensanglard commented 1 year ago

The expert has spoken. I will keep this issue open just for posterity.

frioglobal commented 1 year ago

Fair enough, I think the different variants of the board may have different mappings, as the addresses definitely overlap...

On Sat, Dec 31, 2022 at 2:05 AM Fabien @.***> wrote:

The expert has spoken. I will keep this issue open just for posterity.

— Reply to this email directly, view it on GitHub https://github.com/fabiensanglard/cpsb/issues/148#issuecomment-1368176059, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA3QW5XBDYZ64WI43LXAUDTWP7LKBANCNFSM6AAAAAASQ65YR4 . You are receiving this because you authored the thread.Message ID: @.***>