Talk:RAMBO-1: Difference between revisions

From NESdev Wiki
Jump to navigationJump to search
m (→‎Alternate IRQ timing: Minor fixes.)
(→‎Alternate IRQ timing: Progress, Klax is off by 1 scanline only. All the others are perfect.)
Line 20: Line 20:
== Alternate IRQ timing  ==
== Alternate IRQ timing  ==


This is how to get 3 games working: Klax, Skull&Crossbones and Hard Drivin'.
This is how to get 4 games working: Klax, Skull&Crossbones, Rolling Thunder and Hard Drivin'.
*Address mask: $E001.
*Address mask: $E001.


*Register $C000: IRQ_latch = value AND $FE (last bit is NOT used), IRQ_clear = '''true'''.
writes to $C000: irq_latch=data;
*Register $C001: IRQ_mode = value AND $01, IRQ_clear = '''true'''.
writes to $C001: irq_reload=true; irq_mode=data&1;
*Register $E000: IRQ_enable = '''false''', acknowledges IRQ.
writes to $E000: irq_enable=false; IRQ acknowledge by CPU.
*Register $E001: IRQ_enable = '''true''', acknowledges IRQ.
writes to $E001: irq_enable=true; IRQ acknowledge by CPU.


When the IRQ is clocked by CPU or scanline modes:
- IRQ clock does NOT occur if the IRQ delay is enabled!


'''When the IRQ is clocked by CPU or scanline modes:'''
- If IRQ delay is disabled:
*IF IRQ_counter++ == IRQ_latch:
If irq_reload == true:
**IF IRQ_enable == true, wait 4 CPU cycles, then trigger an IRQ '''AND''' clear IRQ_counter.
    irq_counter = irq_latch;
*ELSE IF IRQ_clear == '''true''':
    if(irq_latch != 0) irq_counter |= 1;
**Clear IRQ_counter and IRQ_clear = '''false'''.
    irq_reload=false;
Else if irq_counter == 0:
    irq_counter = irq_latch;
Else
    irq_counter--;
If irq_counter == 0 and irq_enable == true
    irq_delay=4 (IRQ will be fired 4 CPU cycles later)

Revision as of 05:01, 6 August 2017

As for the 2mb PRG, I'm not sure if the cart actually supports that much ROM, but the PRG registers apparently are 8 bits, and 8kb * $100 = 2048kb = 2mb. --Drag 03:05, 9 November 2011 (UTC)

IRQ related - Hard Drivin'

Suggested changes for the Mapper64 IRQ. It makes Hard Drivin' to work fine. No other games are affected with this change. Every cycle on 6502 is either a read or a write cycle. So, you update the IRQ counter in the next CPU cycle:

  • IF $C001 was written to after previous clock
    • reload IRQ counter with IRQ Reload value PLUS ONE
  • ELSE IF IRQ counter is 0
    • reload IRQ counter with IRQ Reload value

When the IRQ is clocked by the mapper (in scanline or cycle mode):

    • Decrement IRQ counter by 1
    • IF IRQ counter is now 0 AND IRQs are enabled
      • wait one M2 cycle, then trigger IRQ

Hard Drivin' works. --Zepper (talk) 17:57, 14 January 2014 (MST)

Alternate IRQ timing

This is how to get 4 games working: Klax, Skull&Crossbones, Rolling Thunder and Hard Drivin'.

  • Address mask: $E001.
writes to $C000: irq_latch=data;
writes to $C001: irq_reload=true; irq_mode=data&1;
writes to $E000: irq_enable=false; IRQ acknowledge by CPU.
writes to $E001: irq_enable=true; IRQ acknowledge by CPU.
When the IRQ is clocked by CPU or scanline modes:
- IRQ clock does NOT occur if the IRQ delay is enabled!
- If IRQ delay is disabled:
If irq_reload == true:
   irq_counter = irq_latch;
   if(irq_latch != 0) irq_counter |= 1;
   irq_reload=false;
Else if irq_counter == 0:
   irq_counter = irq_latch;
Else
   irq_counter--;
If irq_counter == 0 and irq_enable == true
   irq_delay=4 (IRQ will be fired 4 CPU cycles later)