-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
--------------- Fixed bug in CPU for 65816 INC A when the B portion is non-zero. F256K emulator now supports Math Co-pro functions. F256K emulator now supports DMA functions. The kernel can now be loaded with a bulk.csv file located in roms\F256 instead of a .hex file. The binary files most be located there too. Added the debug port command $90 and $91 for boot to RAM and FLASH, respectively. Add machine CHIP version and sub-version. Implemented Start of Line (SOL) register for F256. Flash using multiple bin files, based on CSV master file. When uploading PGZ, PGX and HEX for the F256, execute the program on machine. Added rectype 5 to HexFile.load to set the start address - this is used by the Calypsi compiler.
- Loading branch information
Daniel Tremblay
committed
Jan 2, 2024
1 parent
794aa70
commit 104aeec
Showing
24 changed files
with
1,193 additions
and
4,602 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace FoenixIDE.Simulator.Devices | ||
{ | ||
public class DMA_JR : MemoryLocations.MemoryRAM | ||
{ | ||
private MemoryLocations.MemoryRAM System; | ||
|
||
public DMA_JR(int StartAddress, int Length) : base(StartAddress, Length) | ||
{ | ||
} | ||
|
||
public void setSystemRam(MemoryLocations.MemoryRAM ram) | ||
{ | ||
System = ram; | ||
} | ||
|
||
public override void WriteByte(int Address, byte Value) | ||
{ | ||
data[Address] = Value; | ||
// The only address that matters is the register | ||
// If the Enable and Transfer bits are set then do the transfer | ||
if ((Address == 0) && (Value & 0x81) == 0x81) | ||
{ | ||
// Read the Fill Byte | ||
bool isFillTransfer = (Value & 4) != 0; | ||
byte fillByte = 0; | ||
if (isFillTransfer) | ||
{ | ||
fillByte = ReadByte(1); | ||
} | ||
// Indicate that DMA is busy | ||
data[1] = 0x80; | ||
int srcAddr = ReadLong(4); | ||
int destAddr = ReadLong(8); | ||
|
||
bool is2DTransfer = (Value & 2) != 0; | ||
int size1DTransfer = ReadLong(0xC); | ||
|
||
// Setup variables | ||
int width2DTransfer = ReadWord(0xC); | ||
int height2DTransfer = ReadWord(0xE); | ||
int srcStride = ReadWord(0x10); | ||
int destStride = ReadWord(0x12); | ||
|
||
if (isFillTransfer) | ||
{ | ||
if (is2DTransfer) | ||
{ | ||
// Copy the fillbyte in the rectangle | ||
for (int y = 0; y < height2DTransfer; y++) | ||
{ | ||
for (int x = 0; x < width2DTransfer; x++) | ||
{ | ||
System.WriteByte(destAddr + x + y * destStride, fillByte); | ||
} | ||
} | ||
} | ||
else | ||
{ | ||
// This is the easiest use case. Just fill the same byte in to destination | ||
for (int i = 0; i < size1DTransfer; i++) | ||
{ | ||
System.WriteByte(destAddr + i, fillByte); | ||
} | ||
} | ||
} | ||
else | ||
{ | ||
if (is2DTransfer) | ||
{ | ||
for (int y = 0; y < height2DTransfer; y++) | ||
{ | ||
for (int x = 0; x < width2DTransfer; x++) | ||
{ | ||
byte srcByte = System.ReadByte(srcAddr + x + y * srcStride); | ||
System.WriteByte(destAddr + x + y * destStride, srcByte); | ||
} | ||
} | ||
} | ||
else | ||
{ | ||
// Copy the memory from source to destination | ||
byte[] buffer = new byte[size1DTransfer]; | ||
System.CopyIntoBuffer(srcAddr, size1DTransfer, buffer); | ||
System.CopyBuffer(buffer, 0, destAddr, size1DTransfer); | ||
} | ||
} | ||
|
||
// Set the status to not busy | ||
data[1] = 0; | ||
|
||
// Raise an interrupt | ||
if ((Value & 8) == 8) | ||
{ | ||
|
||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace FoenixIDE.Simulator.Devices | ||
{ | ||
|
||
/** | ||
* The SOL Register in F256 allows for | ||
* - writing values for LINT_CTRL and LINT_L | ||
* - reading values for RAST_COL and RAST_ROW | ||
* | ||
*/ | ||
public class SOL : MemoryLocations.MemoryRAM | ||
{ | ||
bool lineInterrupt = false; | ||
int lineNumber = 0; // 12 bit value for the line number to raise the interrupt on | ||
|
||
int rasterColum = 0; | ||
int rasterRow = 0; | ||
|
||
public SOL(int StartAddress, int Length) : base(StartAddress, Length) | ||
{ | ||
} | ||
|
||
public override byte ReadByte(int Address) | ||
{ | ||
switch (Address) | ||
{ | ||
case 0: | ||
return (byte)(rasterColum & 0xFF); | ||
case 1: | ||
return (byte)(rasterColum >> 8); | ||
case 2: | ||
return (byte)(rasterRow & 0xFF); | ||
case 3: | ||
return (byte)(rasterRow >> 8); | ||
} | ||
return 0; | ||
} | ||
public override void WriteByte(int Address, byte Value) | ||
{ | ||
switch (Address) | ||
{ | ||
case 0: | ||
lineInterrupt = (Value & 1) > 0; | ||
break; | ||
case 1: | ||
lineNumber |= Value; | ||
break; | ||
case 2: | ||
lineNumber |= (Value << 8); | ||
break; | ||
} | ||
} | ||
|
||
// This method is called from the GPU class while drawing. | ||
public void SetRasterRow(int value) | ||
{ | ||
rasterRow = value; | ||
} | ||
|
||
public bool IsInterruptEnabled() | ||
{ | ||
return lineInterrupt; | ||
} | ||
|
||
public int GetSOLLineNumber() | ||
{ | ||
return lineNumber; | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.