Skip to content

Commit

Permalink
[#231] SHX & SHY
Browse files Browse the repository at this point in the history
Teilweise Implementierung der "unstable" Verhalten.
  • Loading branch information
ThKattanek committed Sep 15, 2022
1 parent db2c717 commit e180979
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 3 deletions.
43 changes: 40 additions & 3 deletions src/mos6510_class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ MOS6510::MOS6510(void)

EnableDebugCart = false;
WRITE_DEBUG_CART = false;

shxy_dma = false;
}

MOS6510::~MOS6510(void)
Expand Down Expand Up @@ -557,6 +559,15 @@ bool MOS6510::OneZyklus(void)
break;
//R // TMPByte von Adresse holen
case 13:
// Prüfen ob DMA statt findet
if(!shxy_dma)
{
if(!*RDY && !CpuWait)
shxy_dma = true;
else
shxy_dma = false;
}

CHK_RDY
TMPByte = Read(Adresse);
break;
Expand Down Expand Up @@ -1637,12 +1648,38 @@ bool MOS6510::OneZyklus(void)
break;
//W // Illegal [SHY]
case 134:
Write(Adresse, YR & ((Adresse >> 8) + 1));
if((Adresse & 0xFF) < XR)
{
// page boundary crossing
axa_byte = (Adresse >> 8) & YR;
Adresse = (Adresse & 0xFF) | axa_byte << 8;
}
else
axa_byte = YR & ((Adresse >> 8) + 1);
if(shxy_dma)
{
axa_byte = YR;
shxy_dma = false;
}
Write(Adresse, axa_byte);
break;
//W // Illegal [SHX]
case 135:
Write(Adresse, XR & ((Adresse >> 8) + 1));
break;
if((Adresse & 0xFF) < YR)
{
// page boundary crossing
axa_byte = (Adresse >> 8) & XR;
Adresse = (Adresse & 0xFF) | axa_byte << 8;
}
else
axa_byte = XR & ((Adresse >> 8) + 1);
if(shxy_dma)
{
axa_byte = XR;
shxy_dma = false;
}
Write(Adresse, axa_byte);
break;
//W // Illegal [SHA]
case 136:
Write(Adresse, AC & XR & ((Adresse >> 8) + 1));
Expand Down
3 changes: 3 additions & 0 deletions src/mos6510_class.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ class MOS6510

bool EnableDebugCart;
unsigned char DebugCartValue;

bool shxy_dma;
uint8_t axa_byte;
};

#define SetAdresseLo(wert) Adresse = ((Adresse&0xFF00)|wert)
Expand Down

0 comments on commit e180979

Please sign in to comment.