minimig: move config from OSD to UIO, refactoring.
This commit is contained in:
26
menu.cpp
26
menu.cpp
@@ -2877,13 +2877,13 @@ void HandleUI(void)
|
||||
else if (plus && (minimig_config.floppy.drives<3))
|
||||
{
|
||||
minimig_config.floppy.drives++;
|
||||
ConfigFloppy(minimig_config.floppy.drives, minimig_config.floppy.speed);
|
||||
minimig_ConfigFloppy(minimig_config.floppy.drives, minimig_config.floppy.speed);
|
||||
menustate = MENU_MAIN1;
|
||||
}
|
||||
else if (minus && (minimig_config.floppy.drives>0))
|
||||
{
|
||||
minimig_config.floppy.drives--;
|
||||
ConfigFloppy(minimig_config.floppy.drives, minimig_config.floppy.speed);
|
||||
minimig_ConfigFloppy(minimig_config.floppy.drives, minimig_config.floppy.speed);
|
||||
menustate = MENU_MAIN1;
|
||||
}
|
||||
else if (select)
|
||||
@@ -2905,7 +2905,7 @@ void HandleUI(void)
|
||||
else if (menusub == 4) // Toggle floppy turbo
|
||||
{
|
||||
minimig_config.floppy.speed ^= 1;
|
||||
ConfigFloppy(minimig_config.floppy.drives, minimig_config.floppy.speed);
|
||||
minimig_ConfigFloppy(minimig_config.floppy.drives, minimig_config.floppy.speed);
|
||||
menustate = MENU_MAIN1;
|
||||
}
|
||||
else if (menusub == 5) // Go to harddrives page.
|
||||
@@ -3419,7 +3419,7 @@ void HandleUI(void)
|
||||
_config_cpu += 1;
|
||||
if (_config_cpu == 0x02) _config_cpu += 1;
|
||||
minimig_config.cpu = (minimig_config.cpu & 0xfc) | (_config_cpu & 0x3);
|
||||
ConfigCPU(minimig_config.cpu);
|
||||
minimig_ConfigCPU(minimig_config.cpu);
|
||||
}
|
||||
else if (menusub == 1)
|
||||
{
|
||||
@@ -3427,13 +3427,13 @@ void HandleUI(void)
|
||||
int _config_turbo = (minimig_config.cpu >> 2) & 0x3;
|
||||
_config_turbo += 1;
|
||||
minimig_config.cpu = (minimig_config.cpu & 0x3) | ((_config_turbo & 0x3) << 2);
|
||||
ConfigCPU(minimig_config.cpu);
|
||||
minimig_ConfigCPU(minimig_config.cpu);
|
||||
}
|
||||
else if (menusub == 2)
|
||||
{
|
||||
minimig_config.chipset ^= CONFIG_NTSC;
|
||||
menustate = MENU_SETTINGS_CHIPSET1;
|
||||
ConfigChipset(minimig_config.chipset);
|
||||
minimig_ConfigChipset(minimig_config.chipset);
|
||||
}
|
||||
else if (menusub == 3)
|
||||
{
|
||||
@@ -3453,19 +3453,19 @@ void HandleUI(void)
|
||||
}
|
||||
|
||||
menustate = MENU_SETTINGS_CHIPSET1;
|
||||
ConfigChipset(minimig_config.chipset);
|
||||
minimig_ConfigChipset(minimig_config.chipset);
|
||||
}
|
||||
else if (menusub == 4)
|
||||
{
|
||||
minimig_config.autofire ^= 0x4;
|
||||
menustate = MENU_SETTINGS_CHIPSET1;
|
||||
ConfigAutofire(minimig_config.autofire, 0x4);
|
||||
minimig_ConfigAutofire(minimig_config.autofire, 0x4);
|
||||
}
|
||||
else if (menusub == 5)
|
||||
{
|
||||
minimig_config.autofire ^= 0x8;
|
||||
menustate = MENU_SETTINGS_CHIPSET1;
|
||||
ConfigAutofire(minimig_config.autofire, 0x8);
|
||||
minimig_ConfigAutofire(minimig_config.autofire, 0x8);
|
||||
}
|
||||
else if (menusub == 6)
|
||||
{
|
||||
@@ -3790,27 +3790,27 @@ void HandleUI(void)
|
||||
minimig_config.scanlines = ((minimig_config.scanlines + 1) & 0x03) | (minimig_config.scanlines & 0xfc);
|
||||
if ((minimig_config.scanlines & 0x03) > 2) minimig_config.scanlines = minimig_config.scanlines & 0xfc;
|
||||
menustate = MENU_SETTINGS_VIDEO1;
|
||||
ConfigVideo(minimig_config.filter.hires, minimig_config.filter.lores, minimig_config.scanlines);
|
||||
minimig_ConfigVideo(minimig_config.filter.hires, minimig_config.filter.lores, minimig_config.scanlines);
|
||||
}
|
||||
else if (menusub == 1)
|
||||
{
|
||||
minimig_config.scanlines &= ~0x80;
|
||||
minimig_config.scanlines ^= 0x40;
|
||||
menustate = MENU_SETTINGS_VIDEO1;
|
||||
ConfigVideo(minimig_config.filter.hires, minimig_config.filter.lores, minimig_config.scanlines);
|
||||
minimig_ConfigVideo(minimig_config.filter.hires, minimig_config.filter.lores, minimig_config.scanlines);
|
||||
}
|
||||
else if (menusub == 2)
|
||||
{
|
||||
minimig_config.scanlines &= ~0x20; // reserved for auto-ar
|
||||
minimig_config.scanlines ^= 0x10;
|
||||
menustate = MENU_SETTINGS_VIDEO1;
|
||||
ConfigVideo(minimig_config.filter.hires, minimig_config.filter.lores, minimig_config.scanlines);
|
||||
minimig_ConfigVideo(minimig_config.filter.hires, minimig_config.filter.lores, minimig_config.scanlines);
|
||||
}
|
||||
else if (menusub == 3)
|
||||
{
|
||||
minimig_config.audio = (minimig_config.audio + 1) & 3;
|
||||
menustate = MENU_SETTINGS_VIDEO1;
|
||||
ConfigAudio(minimig_config.audio);
|
||||
minimig_ConfigAudio(minimig_config.audio);
|
||||
}
|
||||
else if (menusub == 4)
|
||||
{
|
||||
|
||||
38
osd.cpp
38
osd.cpp
@@ -571,44 +571,6 @@ void OsdDisable(void)
|
||||
spi_osd_cmd(OSD_CMD_DISABLE);
|
||||
}
|
||||
|
||||
|
||||
void ConfigVideo(unsigned char hires, unsigned char lores, unsigned char scanlines)
|
||||
{
|
||||
spi_osd_cmd16(OSD_CMD_VID, (((scanlines >> 6) & 0x03) << 10) | (((scanlines >> 4) & 0x03) << 8) | (((scanlines >> 2) & 0x03) << 6) | ((hires & 0x03) << 4) | ((lores & 0x03) << 2) | (scanlines & 0x03));
|
||||
}
|
||||
|
||||
void ConfigAudio(unsigned char audio)
|
||||
{
|
||||
spi_osd_cmd8(OSD_CMD_AUD, audio);
|
||||
}
|
||||
|
||||
void ConfigMemory(unsigned char memory)
|
||||
{
|
||||
spi_osd_cmd8(OSD_CMD_MEM, memory);
|
||||
}
|
||||
|
||||
void ConfigCPU(unsigned char cpu)
|
||||
{
|
||||
spi_osd_cmd8(OSD_CMD_CPU, cpu & 0x0f);
|
||||
}
|
||||
|
||||
void ConfigChipset(unsigned char chipset)
|
||||
{
|
||||
spi_osd_cmd8(OSD_CMD_CHIP, chipset & 0x1f);
|
||||
}
|
||||
|
||||
void ConfigFloppy(unsigned char drives, unsigned char speed)
|
||||
{
|
||||
spi_osd_cmd8(OSD_CMD_FLP, ((drives & 0x03) << 2) | (speed & 0x03));
|
||||
}
|
||||
|
||||
void ConfigAutofire(unsigned char autofire, unsigned char mask)
|
||||
{
|
||||
uint16_t param = mask;
|
||||
param = (param << 8) | autofire;
|
||||
spi_osd_cmd16(OSD_CMD_JOY, param);
|
||||
}
|
||||
|
||||
void ScrollText(char n, const char *str, int off, int len, int max_len, unsigned char invert)
|
||||
{
|
||||
// this function is called periodically when a string longer than the window is displayed.
|
||||
|
||||
33
osd.h
33
osd.h
@@ -10,36 +10,11 @@
|
||||
#define OSD_CMD_ENABLE 0x41 // OSD enable command
|
||||
#define OSD_CMD_DISABLE 0x40 // OSD disable command
|
||||
|
||||
// ---- Minimig v2 constants -------
|
||||
#define OSD_CMD_READ 0x00
|
||||
#define OSD_CMD_RST 0x08
|
||||
#define OSD_CMD_CLK 0x18
|
||||
#define OSD_CMD_CHIP 0x04
|
||||
#define OSD_CMD_CPU 0x14
|
||||
#define OSD_CMD_MEM 0x24
|
||||
#define OSD_CMD_VID 0x34
|
||||
#define OSD_CMD_FLP 0x44
|
||||
#define OSD_CMD_HDD 0x54
|
||||
#define OSD_CMD_JOY 0x64
|
||||
#define OSD_CMD_AUD 0x74
|
||||
#define OSD_CMD_WR 0x1c
|
||||
#define OSD_CMD_VERSION 0x88
|
||||
|
||||
#define DISABLE_KEYBOARD 0x02 // disable keyboard while OSD is active
|
||||
#define OSD_INFO 0x04 // display info
|
||||
|
||||
#define REPEATDELAY 500 // repeat delay in 1ms units
|
||||
#define REPEATRATE 50 // repeat rate in 1ms units
|
||||
#define BUTTONDELAY 20 // repeat rate in 1ms units
|
||||
|
||||
#define CONFIG_TURBO 1
|
||||
#define CONFIG_NTSC 2
|
||||
#define CONFIG_A1000 4
|
||||
#define CONFIG_ECS 8
|
||||
#define CONFIG_AGA 16
|
||||
|
||||
#define CONFIG_FLOPPY1X 0
|
||||
#define CONFIG_FLOPPY2X 1
|
||||
|
||||
#define OSD_ARROW_LEFT 1
|
||||
#define OSD_ARROW_RIGHT 2
|
||||
@@ -54,14 +29,6 @@ void OsdEnable(unsigned char mode);
|
||||
void InfoEnable(int x, int y, int width, int height);
|
||||
void OsdRotation(uint8_t rotate);
|
||||
void OsdDisable(void);
|
||||
void ConfigVideo(unsigned char hires, unsigned char lores, unsigned char scanlines);
|
||||
void ConfigAudio(unsigned char audio);
|
||||
void ConfigMemory(unsigned char memory);
|
||||
void ConfigCPU(unsigned char cpu);
|
||||
void ConfigChipset(unsigned char chipset);
|
||||
void ConfigFloppy(unsigned char drives, unsigned char speed);
|
||||
void ConfigAutofire(unsigned char autofire, unsigned char mask);
|
||||
void OSD_PrintText(unsigned char line, const char *text, unsigned long start, unsigned long width, unsigned long offset, unsigned char invert);
|
||||
void OSD_PrintInfo(const char *message, int *width, int *height, int frame = 0);
|
||||
void OsdDrawLogo(int row);
|
||||
void ScrollText(char n, const char *str, int off, int len, int max_len, unsigned char invert);
|
||||
|
||||
10
spi.cpp
10
spi.cpp
@@ -211,17 +211,17 @@ void spi_osd_cmd32(uint8_t cmd, uint32_t parm)
|
||||
DisableOsd();
|
||||
}
|
||||
|
||||
void spi_osd_cmd32le_cont(uint8_t cmd, uint32_t parm)
|
||||
void spi_uio_cmd32le_cont(uint8_t cmd, uint32_t parm)
|
||||
{
|
||||
EnableOsd();
|
||||
EnableIO();
|
||||
spi8(cmd);
|
||||
spi32le(parm);
|
||||
}
|
||||
|
||||
void spi_osd_cmd32le(uint8_t cmd, uint32_t parm)
|
||||
void spi_uio_cmd32le(uint8_t cmd, uint32_t parm)
|
||||
{
|
||||
spi_osd_cmd32le_cont(cmd, parm);
|
||||
DisableOsd();
|
||||
spi_uio_cmd32le_cont(cmd, parm);
|
||||
DisableIO();
|
||||
}
|
||||
|
||||
/* User_io related SPI functions */
|
||||
|
||||
4
spi.h
4
spi.h
@@ -52,8 +52,6 @@ void spi_osd_cmd8(uint8_t cmd, uint8_t parm);
|
||||
void spi_osd_cmd16(uint8_t cmd, uint16_t parm);
|
||||
void spi_osd_cmd32_cont(uint8_t cmd, uint32_t parm);
|
||||
void spi_osd_cmd32(uint8_t cmd, uint32_t parm);
|
||||
void spi_osd_cmd32le_cont(uint8_t cmd, uint32_t parm);
|
||||
void spi_osd_cmd32le(uint8_t cmd, uint32_t parm);
|
||||
|
||||
/* User_io related SPI functions */
|
||||
uint8_t spi_uio_cmd_cont(uint8_t cmd);
|
||||
@@ -62,5 +60,7 @@ void spi_uio_cmd8(uint8_t cmd, uint8_t parm);
|
||||
void spi_uio_cmd8_cont(uint8_t cmd, uint8_t parm);
|
||||
void spi_uio_cmd16(uint8_t cmd, uint16_t parm);
|
||||
void spi_uio_cmd32(uint8_t cmd, uint32_t parm, int wide);
|
||||
void spi_uio_cmd32le_cont(uint8_t cmd, uint32_t parm);
|
||||
void spi_uio_cmd32le(uint8_t cmd, uint32_t parm);
|
||||
|
||||
#endif // SPI_H
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "stdio.h"
|
||||
#include "minimig_boot.h"
|
||||
#include "../../hardware.h"
|
||||
#include "../../osd.h"
|
||||
#include "../../user_io.h"
|
||||
#include "../../spi.h"
|
||||
#include "../../file_io.h"
|
||||
#include "minimig_config.h"
|
||||
@@ -18,12 +18,12 @@ static uint8_t buffer[1024];
|
||||
|
||||
static void mem_upload_init(unsigned long addr)
|
||||
{
|
||||
spi_osd_cmd32le_cont(OSD_CMD_WR, addr);
|
||||
spi_uio_cmd32le_cont(UIO_MM2_WR, addr);
|
||||
}
|
||||
|
||||
static void mem_upload_fini()
|
||||
{
|
||||
DisableOsd();
|
||||
DisableIO();
|
||||
}
|
||||
|
||||
static void mem_write16(unsigned short x)
|
||||
@@ -145,14 +145,7 @@ static const char boot_font[96][8] =
|
||||
static void BootEnableMem()
|
||||
{
|
||||
// TEMP enable 1MB memory
|
||||
spi_osd_cmd8(OSD_CMD_MEM, 0x5);
|
||||
//EnableOsd();
|
||||
//spi8(OSD_CMD_RST);
|
||||
//rstval = (SPI_CPU_HLT | SPI_RST_CPU);
|
||||
//spi8(rstval);
|
||||
//DisableOsd();
|
||||
//SPIN(); SPIN(); SPIN(); SPIN();
|
||||
//while ((read32(REG_SYS_STAT_ADR) & 0x2));
|
||||
spi_uio_cmd8(UIO_MM2_MEM, 0x5);
|
||||
}
|
||||
|
||||
static void BootClearScreen(int adr, int size)
|
||||
@@ -402,28 +395,14 @@ void BootInit()
|
||||
{
|
||||
puts("Running minimig setup");
|
||||
|
||||
EnableOsd();
|
||||
spi8(OSD_CMD_VERSION);
|
||||
char ver_beta = spi_b(0xff);
|
||||
char ver_major = spi_b(0xff);
|
||||
char ver_minor = spi_b(0xff);
|
||||
char ver_minion = spi_b(0xff);
|
||||
DisableOsd();
|
||||
spi8(OSD_CMD_RST);
|
||||
rstval = (SPI_RST_USR | SPI_RST_CPU | SPI_CPU_HLT);
|
||||
spi8(rstval);
|
||||
DisableOsd();
|
||||
EnableOsd();
|
||||
spi8(OSD_CMD_RST);
|
||||
rstval = (SPI_RST_CPU | SPI_CPU_HLT);
|
||||
spi8(rstval);
|
||||
DisableOsd();
|
||||
spi_uio_cmd8(UIO_MM2_RST, SPI_RST_USR | SPI_RST_CPU | SPI_CPU_HLT);
|
||||
spi_uio_cmd8(UIO_MM2_RST, SPI_RST_CPU | SPI_CPU_HLT);
|
||||
|
||||
if (cfg.bootscreen)
|
||||
{
|
||||
//default video config till real config loaded.
|
||||
ConfigVideo(0, 0, 0x40);
|
||||
ConfigAudio(0);
|
||||
minimig_ConfigVideo(0, 0, 0x40);
|
||||
minimig_ConfigAudio(0);
|
||||
|
||||
WaitTimer(100);
|
||||
|
||||
@@ -435,9 +414,7 @@ void BootInit()
|
||||
BootCustomInit();
|
||||
|
||||
WaitTimer(500);
|
||||
char rtl_ver[128];
|
||||
sprintf(rtl_ver, "MINIMIG-AGA%s v%d.%d.%d by Rok Krajnc. MiSTer port by Sorgelig.", ver_beta ? " BETA" : "", ver_major, ver_minor, ver_minion);
|
||||
BootPrintEx(rtl_ver);
|
||||
BootPrintEx("Minimig-AGA by Rok Krajnc. MiSTer port by Sorgelig.");
|
||||
BootPrintEx(" ");
|
||||
BootPrintEx("Original Minimig by Dennis van Weeren");
|
||||
BootPrintEx("Updates by Jakub Bednarski, Tobias Gubener, Sascha Boing, A.M. Robinson & others");
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
#include "../../hardware.h"
|
||||
#include "../../file_io.h"
|
||||
#include "../../osd.h"
|
||||
#include "../../menu.h"
|
||||
#include "../../user_io.h"
|
||||
#include "../../input.h"
|
||||
@@ -64,9 +63,9 @@ static void SendFileV2(fileTYPE* file, unsigned char* key, int keysize, int addr
|
||||
if ((int)keyidx >= keysize) keyidx -= keysize;
|
||||
}
|
||||
}
|
||||
EnableOsd();
|
||||
EnableIO();
|
||||
unsigned int adr = address + i * 512;
|
||||
spi8(OSD_CMD_WR);
|
||||
spi8(UIO_MM2_WR);
|
||||
spi8(adr & 0xff); adr = adr >> 8;
|
||||
spi8(adr & 0xff); adr = adr >> 8;
|
||||
spi8(adr & 0xff); adr = adr >> 8;
|
||||
@@ -78,7 +77,7 @@ static void SendFileV2(fileTYPE* file, unsigned char* key, int keysize, int addr
|
||||
spi8(buf[j + 2]);
|
||||
spi8(buf[j + 3]);
|
||||
}
|
||||
DisableOsd();
|
||||
DisableIO();
|
||||
}
|
||||
|
||||
printf("]\n");
|
||||
@@ -123,9 +122,9 @@ static char UploadKickstart(char *name)
|
||||
FileClose(&file);
|
||||
//clear tag (write 0 to $fc0000) to force bootrom to load Kickstart from disk
|
||||
//and not use one which was already there.
|
||||
spi_osd_cmd32le_cont(OSD_CMD_WR, 0xfc0000);
|
||||
spi_uio_cmd32le_cont(UIO_MM2_WR, 0xfc0000);
|
||||
spi8(0x00);spi8(0x00);
|
||||
DisableOsd();
|
||||
DisableIO();
|
||||
return(1);
|
||||
}
|
||||
else if (file.size == 0x2000) {
|
||||
@@ -133,9 +132,9 @@ static char UploadKickstart(char *name)
|
||||
BootPrint("Uploading A1000 boot ROM");
|
||||
SendFileV2(&file, NULL, 0, 0xf80000, file.size >> 9);
|
||||
FileClose(&file);
|
||||
spi_osd_cmd32le_cont(OSD_CMD_WR, 0xfc0000);
|
||||
spi_uio_cmd32le_cont(UIO_MM2_WR, 0xfc0000);
|
||||
spi8(0x00);spi8(0x00);
|
||||
DisableOsd();
|
||||
DisableIO();
|
||||
return(1);
|
||||
}
|
||||
else if (file.size == 0x80000) {
|
||||
@@ -199,7 +198,7 @@ static char UploadActionReplay()
|
||||
SendFileV2(&file, NULL, 0, 0xa10000, (file.size + 511) >> 9);
|
||||
// HRTmon config
|
||||
adr = 0xa10000 + 20;
|
||||
spi_osd_cmd32le_cont(OSD_CMD_WR, adr);
|
||||
spi_uio_cmd32le_cont(UIO_MM2_WR, adr);
|
||||
data = 0x00800000; // mon_size, 4 bytes
|
||||
spi8((data >> 24) & 0xff); spi8((data >> 16) & 0xff);
|
||||
spi8((data >> 8) & 0xff); spi8((data >> 0) & 0xff);
|
||||
@@ -239,13 +238,13 @@ static char UploadActionReplay()
|
||||
spi8((data >> 0) & 0xff);
|
||||
data = 1; // hexmode, 1 byte
|
||||
spi8((data >> 0) & 0xff);
|
||||
DisableOsd();
|
||||
DisableIO();
|
||||
adr = 0xa10000 + 68;
|
||||
spi_osd_cmd32le_cont(OSD_CMD_WR, adr);
|
||||
spi_uio_cmd32le_cont(UIO_MM2_WR, adr);
|
||||
data = ((minimig_config.memory & 0x3) + 1) * 512 * 1024; // maxchip, 4 bytes TODO is this correct?
|
||||
spi8((data >> 24) & 0xff); spi8((data >> 16) & 0xff);
|
||||
spi8((data >> 8) & 0xff); spi8((data >> 0) & 0xff);
|
||||
DisableOsd();
|
||||
DisableIO();
|
||||
|
||||
FileClose(&file);
|
||||
return(1);
|
||||
@@ -290,12 +289,12 @@ static void ApplyConfiguration(char reloadkickstart)
|
||||
if (force_reload_kickstart) reloadkickstart = 1;
|
||||
force_reload_kickstart = 0;
|
||||
|
||||
ConfigCPU(minimig_config.cpu);
|
||||
minimig_ConfigCPU(minimig_config.cpu);
|
||||
|
||||
if (!reloadkickstart)
|
||||
{
|
||||
ConfigChipset(minimig_config.chipset);
|
||||
ConfigFloppy(minimig_config.floppy.drives, minimig_config.floppy.speed);
|
||||
minimig_ConfigChipset(minimig_config.chipset);
|
||||
minimig_ConfigFloppy(minimig_config.floppy.drives, minimig_config.floppy.speed);
|
||||
}
|
||||
|
||||
printf("CPU clock : %s\n", minimig_config.chipset & 0x01 ? "turbo" : "normal");
|
||||
@@ -320,14 +319,14 @@ static void ApplyConfiguration(char reloadkickstart)
|
||||
}
|
||||
|
||||
rstval = SPI_CPU_HLT;
|
||||
spi_osd_cmd8(OSD_CMD_RST, rstval);
|
||||
spi_osd_cmd8(OSD_CMD_HDD, (minimig_config.enable_ide ? 1 : 0) | (OpenHardfile(0) ? 2 : 0) | (OpenHardfile(1) ? 4 : 0) | (OpenHardfile(2) ? 8 : 0) | (OpenHardfile(3) ? 16 : 0));
|
||||
spi_uio_cmd8(UIO_MM2_RST, rstval);
|
||||
spi_uio_cmd8(UIO_MM2_HDD, (minimig_config.enable_ide ? 1 : 0) | (OpenHardfile(0) ? 2 : 0) | (OpenHardfile(1) ? 4 : 0) | (OpenHardfile(2) ? 8 : 0) | (OpenHardfile(3) ? 16 : 0));
|
||||
|
||||
ConfigMemory(memcfg);
|
||||
ConfigCPU(minimig_config.cpu);
|
||||
minimig_ConfigMemory(memcfg);
|
||||
minimig_ConfigCPU(minimig_config.cpu);
|
||||
|
||||
ConfigChipset(minimig_config.chipset);
|
||||
ConfigFloppy(minimig_config.floppy.drives, minimig_config.floppy.speed);
|
||||
minimig_ConfigChipset(minimig_config.chipset);
|
||||
minimig_ConfigFloppy(minimig_config.floppy.drives, minimig_config.floppy.speed);
|
||||
|
||||
if (minimig_config.memory & 0x40) UploadActionReplay();
|
||||
|
||||
@@ -335,7 +334,7 @@ static void ApplyConfiguration(char reloadkickstart)
|
||||
{
|
||||
printf("Reloading kickstart ...\n");
|
||||
rstval |= (SPI_RST_CPU | SPI_CPU_HLT);
|
||||
spi_osd_cmd8(OSD_CMD_RST, rstval);
|
||||
spi_uio_cmd8(UIO_MM2_RST, rstval);
|
||||
if (!UploadKickstart(minimig_config.kickstart))
|
||||
{
|
||||
strcpy(minimig_config.kickstart, "Amiga/KICK.ROM");
|
||||
@@ -351,21 +350,21 @@ static void ApplyConfiguration(char reloadkickstart)
|
||||
}
|
||||
}
|
||||
rstval |= (SPI_RST_USR | SPI_RST_CPU);
|
||||
spi_osd_cmd8(OSD_CMD_RST, rstval);
|
||||
spi_uio_cmd8(UIO_MM2_RST, rstval);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Resetting ...\n");
|
||||
rstval |= (SPI_RST_USR | SPI_RST_CPU);
|
||||
spi_osd_cmd8(OSD_CMD_RST, rstval);
|
||||
spi_uio_cmd8(UIO_MM2_RST, rstval);
|
||||
}
|
||||
|
||||
rstval = 0;
|
||||
spi_osd_cmd8(OSD_CMD_RST, rstval);
|
||||
spi_uio_cmd8(UIO_MM2_RST, rstval);
|
||||
|
||||
ConfigVideo(minimig_config.filter.hires, minimig_config.filter.lores, minimig_config.scanlines);
|
||||
ConfigAudio(minimig_config.audio);
|
||||
ConfigAutofire(minimig_config.autofire, 0xC);
|
||||
minimig_ConfigVideo(minimig_config.filter.hires, minimig_config.filter.lores, minimig_config.scanlines);
|
||||
minimig_ConfigAudio(minimig_config.audio);
|
||||
minimig_ConfigAutofire(minimig_config.autofire, 0xC);
|
||||
}
|
||||
|
||||
int minimig_cfg_load(int num)
|
||||
@@ -626,3 +625,40 @@ char minimig_get_adjust()
|
||||
{
|
||||
return minimig_adjust;
|
||||
}
|
||||
|
||||
void minimig_ConfigVideo(unsigned char hires, unsigned char lores, unsigned char scanlines)
|
||||
{
|
||||
spi_uio_cmd16(UIO_MM2_VID, (((scanlines >> 6) & 0x03) << 10) | (((scanlines >> 4) & 0x03) << 8) | (((scanlines >> 2) & 0x03) << 6) | ((hires & 0x03) << 4) | ((lores & 0x03) << 2) | (scanlines & 0x03));
|
||||
}
|
||||
|
||||
void minimig_ConfigAudio(unsigned char audio)
|
||||
{
|
||||
spi_uio_cmd8(UIO_MM2_AUD, audio);
|
||||
}
|
||||
|
||||
void minimig_ConfigMemory(unsigned char memory)
|
||||
{
|
||||
spi_uio_cmd8(UIO_MM2_MEM, memory);
|
||||
}
|
||||
|
||||
void minimig_ConfigCPU(unsigned char cpu)
|
||||
{
|
||||
spi_uio_cmd8(UIO_MM2_CPU, cpu & 0x0f);
|
||||
}
|
||||
|
||||
void minimig_ConfigChipset(unsigned char chipset)
|
||||
{
|
||||
spi_uio_cmd8(UIO_MM2_CHIP, chipset & 0x1f);
|
||||
}
|
||||
|
||||
void minimig_ConfigFloppy(unsigned char drives, unsigned char speed)
|
||||
{
|
||||
spi_uio_cmd8(UIO_MM2_FLP, ((drives & 0x03) << 2) | (speed & 0x03));
|
||||
}
|
||||
|
||||
void minimig_ConfigAutofire(unsigned char autofire, unsigned char mask)
|
||||
{
|
||||
uint16_t param = mask;
|
||||
param = (param << 8) | autofire;
|
||||
spi_uio_cmd16(UIO_MM2_JOY, param);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,15 @@
|
||||
|
||||
#include "../../file_io.h"
|
||||
|
||||
#define CONFIG_TURBO 1
|
||||
#define CONFIG_NTSC 2
|
||||
#define CONFIG_A1000 4
|
||||
#define CONFIG_ECS 8
|
||||
#define CONFIG_AGA 16
|
||||
|
||||
#define CONFIG_FLOPPY1X 0
|
||||
#define CONFIG_FLOPPY2X 1
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char lores;
|
||||
@@ -54,4 +63,12 @@ void minimig_set_kickstart(char *name);
|
||||
void minimig_set_adjust(char n);
|
||||
char minimig_get_adjust();
|
||||
|
||||
void minimig_ConfigVideo(unsigned char hires, unsigned char lores, unsigned char scanlines);
|
||||
void minimig_ConfigAudio(unsigned char audio);
|
||||
void minimig_ConfigMemory(unsigned char memory);
|
||||
void minimig_ConfigCPU(unsigned char cpu);
|
||||
void minimig_ConfigChipset(unsigned char chipset);
|
||||
void minimig_ConfigFloppy(unsigned char drives, unsigned char speed);
|
||||
void minimig_ConfigAutofire(unsigned char autofire, unsigned char mask);
|
||||
|
||||
#endif
|
||||
|
||||
12
user_io.h
12
user_io.h
@@ -82,6 +82,18 @@
|
||||
#define UIO_DMA_READ 0x62
|
||||
#define UIO_DMA_SDIO 0x63
|
||||
|
||||
// ---- Minimig v2 constants -------
|
||||
#define UIO_MM2_WR 0xF0 //0x1c
|
||||
#define UIO_MM2_RST 0xF1 //0x08
|
||||
#define UIO_MM2_AUD 0xF2 //0x74
|
||||
#define UIO_MM2_CHIP 0xF3 //0x04
|
||||
#define UIO_MM2_CPU 0xF4 //0x14
|
||||
#define UIO_MM2_MEM 0xF5 //0x24
|
||||
#define UIO_MM2_VID 0xF6 //0x34
|
||||
#define UIO_MM2_FLP 0xF7 //0x44
|
||||
#define UIO_MM2_HDD 0xF8 //0x54
|
||||
#define UIO_MM2_JOY 0xF9 //0x64
|
||||
|
||||
#define JOY_RIGHT 0x01
|
||||
#define JOY_LEFT 0x02
|
||||
#define JOY_DOWN 0x04
|
||||
|
||||
Reference in New Issue
Block a user