pull/31/head
AlinTigaeru 2023-02-02 14:34:54 +00:00
rodzic 86590f8e79
commit 8718ba1a74
5 zmienionych plików z 118 dodań i 33 usunięć

Wyświetl plik

@ -1,35 +1,51 @@
#include "processor/Z80.h"
#include "roms/rom464.h"
#include "emuapi.h"
#include "crtc.h"
#include "ga.h"
struct { unsigned char R,G,B;} Palette[27] = {
{ 0, 0, 0}, // Black
{ 0, 0, 128}, // Blue
{ 0, 0, 255}, // Bright blue
{ 128, 0, 0}, // Red
{ 128, 0, 128}, // Magenta
{ 128, 0, 255}, // Mauve
{ 255, 0, 0}, // Bright Red
{ 255, 0, 128}, // Purple
{ 255, 0, 255}, // Bright Magenta
{ 0, 128, 0}, // Green
{ 0, 128, 128}, // Cyan
{ 0, 128, 255}, // Sky Blue
{ 128, 128, 0}, // Yellow
{ 128, 128, 128}, // White
{ 128, 128, 255}, // Pastel Blue
{ 255, 128, 0}, // Orange
{ 255, 128, 128}, // Pink
{ 255, 128, 255}, // Pastel Magenta
{ 0, 255, 0}, // Bright Green
{ 0, 255, 128}, // Sea Green
{ 0, 255, 255}, // Bright Cyan
{ 128, 255, 0}, // Lime
{ 128, 255, 128}, // Pastel Green
{ 128, 255, 255}, // Pastel Cyan
{ 255, 255, 0}, // Bright Yellow
{ 255, 255, 128}, // Pastel Yellow
{ 255, 255, 255}, // Bright White
};
/*
* The implementations of the Z80 instructions required by the portable Z80 emulator.
* These implementations are system-specific.
*/
void OutZ80(register word Port, register byte Value)
{
if(!(Port & 0x8000)) write_ga(Port, Value); // The Gate Array is selected when bit 15 is set to 0.
if(!(Port & 0x4000)) write_crtc(Port, Value); // The CRTC is selected when bit 14 is set to 0.
return;
}
// TODO add cpu instance etc.
byte InZ80(register word Port)
{
if(!(Port & 0x4000)) read_crtc(Port); // The CRTC is selected when bit 14 is set to 0.
return 0xFF;
}
void WrZ80(register word Addr,register byte Value)
{
return;
}
byte RdZ80(register word Addr)
{
return 0xFF;
}
void PatchZ80(register Z80 *R)
{
return;
}
word LoopZ80(register Z80 *R)
{
return 0xFFFF;
}
// void JumpZ80(word PC)
// {
// return;
// }
/*
* Non-Z80 stuff.
*/

Wyświetl plik

@ -3,5 +3,42 @@
* video memory addresses to fetch pixel data.
* Gate Array works together in sync with CRTC, and is responsible for converting the pixel data in memory
* into video signals through an R2R DAC.
*
*/
*/
#include "pico.h"
#include "pico/stdlib.h"
struct Registers {
uint8_t HorizontalTotal = 63;
uint8_t HorizontalDisplayed = 40;
uint8_t HorizontalSyncPosition = 46;
uint8_t HorizontalAndVerticalSyncWidths = 142;
uint8_t VerticalTotal = 38;
uint8_t VerticalTotalAdjust = 0;
uint8_t VerticalDisplayed = 25;
uint8_t VerticalSyncPosition = 30;
uint8_t InterlaceAndSkew = 0;
uint8_t MaximumRasterAddress = 7;
uint8_t CursorStartRaster = 0;
uint8_t CursorEndRaster = 0;
uint8_t DisplayStartAddressHigh = 48;
uint8_t DisplayStartAddressLow = 0;
uint8_t CursorAddressHigh = 0;
uint8_t CursorAddressLow = 0;
uint8_t LightPenAddressHigh = 0; // Read only
uint8_t LightPenAddressLow = 0; // Read only
};
void write_crtc(unsigned short address, unsigned short value)
{
return;
}
void read_crtc(unsigned short address)
{
switch(address & 0xFF00)
{
case 0xBF00: break;
}
return;
}

Wyświetl plik

@ -0,0 +1,2 @@
void write_crtc(unsigned short address, unsigned short value);
void read_crtc(unsigned short address);

Wyświetl plik

@ -3,4 +3,33 @@
* Gate Array's READY signal is connected to Z80's WAIT input for "memory contention".
* This means CPU execution is halted every time Gate Array and CPU accesses the memory at the same time.
* The reason for this is that both GA and the CPU share the same address/data bus for memory access.
*/
*/
struct { unsigned char R,G,B;} Palette[27] = {
{ 0, 0, 0}, // Black
{ 0, 0, 128}, // Blue
{ 0, 0, 255}, // Bright blue
{ 128, 0, 0}, // Red
{ 128, 0, 128}, // Magenta
{ 128, 0, 255}, // Mauve
{ 255, 0, 0}, // Bright Red
{ 255, 0, 128}, // Purple
{ 255, 0, 255}, // Bright Magenta
{ 0, 128, 0}, // Green
{ 0, 128, 128}, // Cyan
{ 0, 128, 255}, // Sky Blue
{ 128, 128, 0}, // Yellow
{ 128, 128, 128}, // White
{ 128, 128, 255}, // Pastel Blue
{ 255, 128, 0}, // Orange
{ 255, 128, 128}, // Pink
{ 255, 128, 255}, // Pastel Magenta
{ 0, 255, 0}, // Bright Green
{ 0, 255, 128}, // Sea Green
{ 0, 255, 255}, // Bright Cyan
{ 128, 255, 0}, // Lime
{ 128, 255, 128}, // Pastel Green
{ 128, 255, 255}, // Pastel Cyan
{ 255, 255, 0}, // Bright Yellow
{ 255, 255, 128}, // Pastel Yellow
{ 255, 255, 255}, // Bright White
};

Wyświetl plik

@ -0,0 +1 @@
void write_ga(unsigned short address, unsigned short value);