Skip to content

Commit e62c954

Browse files
committed
Mirror the live MK3 LEDs from $00:61FE
The PAR-NMI keeps the group/trainer blink in MK3 SRAM at $61FE; the $086000 HW register has bit0 masked at runtime, so snoop $61FE for the LED overlay instead.
1 parent a3c6a29 commit e62c954

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎rtl/chip/mk3/mk3_io.sv‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ module mk3_io (
6060

6161
// Address decoders (combinational)
6262
logic is_slot;
63-
logic is_ca, is_cb, is_cc, is_cd, is_led;
63+
logic is_ca, is_cb, is_cc, is_cd, is_led, is_grp;
6464
logic [2:0] slot_index;
6565
logic [1:0] slot_byte;
6666

@@ -71,6 +71,8 @@ module mk3_io (
7171
is_cc = (cpu_addr == 24'h206000);
7272
is_cd = (cpu_addr == 24'h008000);
7373
is_led = (cpu_addr == 24'h086000);
74+
// Live LED output ($00:61FE in MK3 SRAM); snooped, not an IO hit.
75+
is_grp = (cpu_addr == 24'h0061FE);
7476

7577
cpu_hit = is_slot | is_ca | is_cb | is_cc | is_cd | is_led;
7678

@@ -96,6 +98,11 @@ module mk3_io (
9698
end else begin
9799
cb_pulse <= 1'b0; // default low, pulses one cycle on Control B 0->1
98100

101+
// LED snoop: the live group/trainer blink is at $00:61FE (the
102+
// $086000 HW reg has bit0 masked at runtime). Mirror it for the
103+
// overlay; kept out of the IO decode so it never claims cpu_hit.
104+
if (cpu_we && is_grp) leds_r <= cpu_din;
105+
99106
if (cpu_we) begin
100107
if (is_slot) begin
101108
// Update byte `slot_byte` of slot `slot_index`
@@ -117,7 +124,6 @@ module mk3_io (
117124
end
118125
else if (is_cc) cc_r <= cpu_din;
119126
else if (is_cd) cd_r <= cpu_din;
120-
else if (is_led) leds_r <= cpu_din;
121127
end
122128
end
123129
end

0 commit comments

Comments
 (0)