Skip to content

Commit

Permalink
Update to V1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherman26 authored May 23, 2022
1 parent bb0b093 commit 297affc
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions M6800/src/m6800/MemoryModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,15 @@ public class MemoryModule {
final static int KEYPADSTART = 0xC003;
final int RAMSIZE = 512;
final int ROMSIZE = 1024;
final int DISPLAYSIZE = 0x60;
//final int DISPLAYSIZE = 0x60;
final int DISPLAYSIZE = 0xF0;
final int KEYPADSIZE = 8;
final static int KEYPADDEBOUNCE = 32;
static int debug;
final static int DISPLAY_DONTCARE_MASK = 0xFF77;

private final int KeypadCounter[];
private boolean ROMLoaded;


MemRegion RAM;
Expand All @@ -78,13 +81,27 @@ public void MemWrite(int iAddress, int iValue)
if((iAddress >= RAM.memstart && iAddress < (RAM.memstart + RAM.memsize)) ||
(iAddress >= DISPLAY.memstart && iAddress < (DISPLAY.memstart + DISPLAY.memsize)))
{
////
if (iAddress >= DISPLAY.memstart)
{
iAddress &= DISPLAY_DONTCARE_MASK;
}
memArray[iAddress] = (iValue & 0xFF);
}
if ((iAddress == 0) && (iValue == 7))
debug = 1;
else
debug = 0;
}

public void ROMWrite (int iAddress, int iValue)
{
if ((iAddress >= ROM.memstart) && (iAddress < (ROM.memstart + ROM.memsize)))
{
memArray[iAddress] = iValue & 0xFF;
}
ROMLoaded = true;
}

/*
** MemRead - Accessor for reading RAM/ROM/Keypad/Display
Expand All @@ -104,7 +121,10 @@ else if (iAddress >= KEYPAD.memstart && iAddress < (KEYPAD.memstart + KEYPAD.mem
}
else if (iAddress >= ROM.memstart && iAddress < (ROM.memstart + ROM.memsize))
{
return (ET3400AROM[iAddress - ROM.memstart]);
if (ROMLoaded)
return (memArray[iAddress]);
else
return (ET3400AROM[iAddress - ROM.memstart]);
}
else
return (0);
Expand All @@ -128,6 +148,7 @@ public MemoryModule()
ROM = new MemRegion(ROMSTART, ROMSIZE);
DISPLAY = new MemRegion(DISPLAYSTART, DISPLAYSIZE);
KEYPAD = new MemRegion(KEYPADSTART, KEYPADSIZE);
ROMLoaded = false;
}

public int KeypadRead(int address)
Expand Down

0 comments on commit 297affc

Please sign in to comment.