Skip to content

P2 credit add/subtract write into P1's counter #139

@dogruis

Description

@dogruis

if (rising & P2_BIT) ADD_BCD(bram_p1_credits_bcd, bram_settings_credits_for_p2);

In nullbios/credits.c, the P2 paths for both add (coin insert) and subtract
(player start) target P1's counter:

// credits.c:78-79 — on coin insert
if (rising & P1_BIT) ADD_BCD(bram_p1_credits_bcd, bram_settings_credits_for_p1);
if (rising & P2_BIT) ADD_BCD(bram_p1_credits_bcd, bram_settings_credits_for_p2);  // <-- p1

// credits.c:113-114 — on player start
if (bios_start_flag & P1_BIT) SUB_BCD(bram_p1_credits_bcd, 1);
if (bios_start_flag & P2_BIT) SUB_BCD(bram_p1_credits_bcd, 1);                    // <-- p1

bram_p2_credits_bcd is declared in include/ngdevkit/bios-backup-ram.h
extern u8 bram_p2_credits_bcd;
and zero-initialized at credits.c, but never read or written anywhere else.
Result: inserting a coin in slot 2 increments bram_p1_credits_bcd, and starting
P2 decrements it. P2 credit accounting is effectively non-functional on MVS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions