Some tweaks in Minimig boot code.

This commit is contained in:
sorgelig
2017-07-17 01:27:15 +08:00
parent 31e9e9eaea
commit 8a17d66496
13 changed files with 68 additions and 88 deletions

View File

@@ -65,7 +65,6 @@
<ClInclude Include="charrom.h" />
<ClInclude Include="config.h" />
<ClInclude Include="debug.h" />
<ClInclude Include="errors.h" />
<ClInclude Include="file_io.h" />
<ClInclude Include="fdd.h" />
<ClInclude Include="fpga_base_addr_ac5.h" />

View File

@@ -85,9 +85,6 @@
<ClInclude Include="debug.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="errors.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="fdd.h">
<Filter>Header Files</Filter>
</ClInclude>

7
boot.c
View File

@@ -447,16 +447,12 @@ void BootInit()
WaitTimer(500);
char rtl_ver[45];
siprintf(rtl_ver, "**** MINIMIG-AGA%s v%d.%d.%d for MiST ****", ver_beta ? " BETA" : "", ver_major, ver_minor, ver_minion);
siprintf(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(" ");
BootPrintEx("MINIMIG-AGA for MiST by Rok Krajnc (rok.krajnc@gmail.com)");
BootPrintEx("Original Minimig by Dennis van Weeren");
BootPrintEx("Updates by Jakub Bednarski, Tobias Gubener, Sascha Boing, A.M. Robinson & others");
BootPrintEx("MiST by Till Harbaum (till@harbaum.org)");
BootPrintEx("For updates & code see https://github.com/rkrajnc/minimig-mist");
BootPrintEx(" ");
WaitTimer(1000);
//eject all disk
df[0].status = 0;
@@ -473,7 +469,6 @@ void BootInit()
//// BootPrint() ////
void BootPrintEx(char * str)
{
char buf[2];
unsigned char i, j;
unsigned char len;

View File

@@ -4,7 +4,6 @@
#include <string.h>
#include <stdbool.h>
#include "errors.h"
#include "hardware.h"
#include "boot.h"
#include "file_io.h"
@@ -14,6 +13,7 @@
#include "menu.h"
#include "config.h"
#include "user_io.h"
#include "input.h"
configTYPE config = { 0 };
char configfilename[32];
@@ -296,8 +296,8 @@ unsigned char LoadConfiguration(char *filename)
// set default configuration
memset((void*)&config, 0, sizeof(config)); // Finally found default config bug - params were reversed!
strncpy(config.id, config_id, sizeof(config.id));
strcpy(config.kickstart, "KICK.ROM");
config.memory = 0x15;
strcpy(config.kickstart, "Amiga/KICK.ROM");
config.memory = 0x11;
config.cpu = 0;
config.chipset = 0;
config.floppy.speed = CONFIG_FLOPPY2X;
@@ -310,47 +310,32 @@ unsigned char LoadConfiguration(char *filename)
config.hardfile[1].long_name[0] = 0;
config.hardfile[1].enabled = 1; // Default is access to entire SD card
updatekickstart = true;
BootPrint("Defaults set\n");
BootPrintEx(">>> No config found. Using defaults. <<<");
}
// print config to boot screen
char cfg_str[41];
siprintf(cfg_str, "CPU: %s", config_cpu_msg[config.cpu & 0x03]); BootPrintEx(cfg_str);
siprintf(cfg_str, "Chipset: %s", config_chipset_msg[(config.chipset >> 2) & 7]); BootPrintEx(cfg_str);
siprintf(cfg_str, "Memory: CHIP: %s FAST: %s SLOW: %s", config_memory_chip_msg[(config.memory >> 0) & 0x03], config_memory_fast_msg[(config.memory >> 4) & 0x03], config_memory_slow_msg[(config.memory >> 2) & 0x03]); BootPrintEx(cfg_str);
char cfg_str[256];
siprintf(cfg_str, "CPU: %s, Chipset: %s, ChipRAM: %s, FastRAM: %s, SlowRAM: %s",
config_cpu_msg[config.cpu & 0x03], config_chipset_msg[(config.chipset >> 2) & 7],
config_memory_chip_msg[(config.memory >> 0) & 0x03], config_memory_fast_msg[(config.memory >> 4) & 0x03], config_memory_slow_msg[(config.memory >> 2) & 0x03]
);
BootPrintEx(cfg_str);
// wait up to 3 seconds for keyboard to appear. If it appears wait another
// two seconds for the user to press a key
/*
int8_t keyboard_present = 0;
for(i=0;i<3;i++) {
unsigned long to = GetTimer(1000);
//while(!CheckTimer(to)) usb_poll();
// check if keyboard just appeared
if(!keyboard_present && hid_keyboard_present()) {
// BootPrintEx("Press F1 for NTSC, F2 for PAL");
keyboard_present = 1;
i = 0;
}
}
*/
key = OsdGetCtrl();
if (key == KEY_F1) {
// BootPrintEx("Forcing NTSC video ...");
// force NTSC mode if F1 pressed
input_poll(0);
if (is_key_pressed(59))
{
BootPrintEx("Forcing NTSC video ...");
//force NTSC mode if F1 pressed
config.chipset |= CONFIG_NTSC;
}
if (key == KEY_F2) {
// BootPrintEx("Forcing PAL video ...");
else if (is_key_pressed(60))
{
BootPrintEx("Forcing PAL video ...");
// force PAL mode if F2 pressed
config.chipset &= ~CONFIG_NTSC;
}
ApplyConfiguration(updatekickstart);
return(result);
}
@@ -447,10 +432,16 @@ void ApplyConfiguration(char reloadkickstart)
DisableOsd();
if (!UploadKickstart(config.kickstart))
{
strcpy(config.kickstart, "KICK.ROM");
strcpy(config.kickstart, "Amiga/KICK.ROM");
if (!UploadKickstart(config.kickstart))
{
FatalError(6);
strcpy(config.kickstart, "KICK.ROM");
if (!UploadKickstart(config.kickstart))
{
BootPrintEx("No Kickstart loaded. Press F12 for settings.");
BootPrintEx("** Halted! **");
return;
}
}
}
EnableOsd();

View File

@@ -1,9 +0,0 @@
#define ERROR_NONE 0
#define ERROR_FILE_NOT_FOUND 1
#define ERROR_INVALID_DATA 2
#define ERROR_UPDATE_FAILED 3
extern unsigned char Error;
void ErrorMessage(const char *message, unsigned char code);
void FatalError(unsigned long error);

4
fdd.c
View File

@@ -24,13 +24,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// 2010-01-09 - support for variable number of tracks
#include <stdio.h>
#include "errors.h"
#include "hardware.h"
#include "file_io.h"
#include "fdd.h"
#include "config.h"
#include "debug.h"
#include "fpga_io.h"
#include "menu.h"
unsigned char drives = 0; // number of active drives reported by FPGA (may change only during reset)
adfTYPE *pdfx; // drive select pointer
@@ -38,6 +38,8 @@ adfTYPE df[4]; // drive 0 information structure
static uint8_t sector_buffer[512];
unsigned char Error;
#define TRACK_SIZE 12668
#define HEADER_SIZE 0x40
#define DATA_SIZE 0x400

1
hdd.c
View File

@@ -22,7 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <stdio.h>
#include <string.h>
#include "errors.h"
#include "hardware.h"
#include "file_io.h"
#include "hdd.h"

31
input.c
View File

@@ -1048,9 +1048,10 @@ static void getVidPid(int num, uint16_t* vid, uint16_t* pid)
*pid = read_hex(name);
}
static struct pollfd pool[NUMDEV + 1];
int input_test(int getchar)
{
static struct pollfd pool[NUMDEV + 1];
static char cur_leds = 0;
static int state = 0;
@@ -1353,3 +1354,31 @@ int input_poll(int getchar)
}
}
}
int is_key_pressed(int key)
{
unsigned char bits[(KEY_MAX + 7) / 8];
for (int i = 0; i < NUMDEV; i++)
{
if (pool[i].fd > 0)
{
unsigned long evbit = 0;
if (ioctl(pool[i].fd, EVIOCGBIT(0, sizeof(evbit)), &evbit) >= 0)
{
if (evbit & (1 << EV_KEY))
{
memset(bits, 0, sizeof(bits));
if (ioctl(pool[i].fd, EVIOCGKEY(sizeof(bits)), &bits) >= 0)
{
if (bits[key / 8] & (1 << (key % 8)))
{
return 1;
}
}
}
}
}
}
return 0;
}

View File

@@ -12,7 +12,7 @@ int get_kbdled(int mask);
int toggle_kbdled(int mask);
int input_poll(int getchar);
int is_key_pressed(int key);
void start_map_setting(int cnt);
int get_map_button();

22
main.c
View File

@@ -23,7 +23,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <unistd.h>
#include <stdio.h>
#include "string.h"
#include "errors.h"
#include "hardware.h"
#include "file_io.h"
#include "osd.h"
@@ -40,27 +39,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
const char version[] = { "$VER:HPS" VDATE };
unsigned char Error;
void FatalError(unsigned long error)
{
unsigned long i;
iprintf("Fatal error: %lu\n", error);
while (1)
{
for (i = 0; i < error; i++)
{
DISKLED_ON;
WaitTimer(250);
DISKLED_OFF;
WaitTimer(250);
}
WaitTimer(1000);
}
}
void HandleDisk(void)
{
unsigned char c1, c2;

12
menu.c
View File

@@ -30,7 +30,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <fcntl.h>
#include "stdio.h"
#include "string.h"
#include "errors.h"
#include "file_io.h"
#include "osd.h"
#include "state.h"
@@ -139,15 +138,16 @@ const char *config_tos_mem[] = { "512 kB", "1 MB", "2 MB", "4 MB", "8 MB", "14 M
const char *config_tos_wrprot[] = { "none", "A:", "B:", "A: and B:" };
const char *config_tos_usb[] = { "none", "control", "debug", "serial", "parallel", "midi" };
const char *config_memory_chip_msg[] = { "512kb", "1mb", "1.5mb", "2mb" };
const char *config_memory_slow_msg[] = { "none", "512kb", "1mb", "1.5mb" };
const char *config_memory_fast_msg[] = { "none", "2mb", "4mb","24mb","24mb" };
const char *config_filter_msg[] = { "none", "HORIZONTAL", "VERTICAL", "H+V" };
const char *config_memory_chip_msg[] = { "0.5 MB", "1.0 MB", "1.5 MB", "2.0 MB" };
const char *config_memory_slow_msg[] = { "none ", "0.5 MB", "1.0 MB", "1.5 MB" };
const char *config_scanlines_msg[] = { "off", "dim", "black" };
const char *config_ar_msg[] = { "4:3", "16:9" };
const char *config_blank_msg[] = { "Blank", "Blank+" };
const char *config_dither_msg[] = { "off", "SPT", "RND", "S+R" };
const char *config_memory_fast_msg[] = { "none ", "2.0 MB", "4.0 MB","24.0 MB","24.0 MB" };
const char *config_cpu_msg[] = { "68000 ", "68010", "-----","68020" };
const char *config_cpu_msg[] = { "68000", "68010", "-----","68020" };
const char *config_hdf_msg[] = { "Disabled", "Hardfile (disk img)", "MMC/SD card", "MMC/SD partition 1", "MMC/SD partition 2", "MMC/SD partition 3", "MMC/SD partition 4" };
const char *config_chipset_msg[] = { "OCS-A500", "OCS-A1000", "ECS", "---", "---", "---", "AGA", "---" };
const char *config_turbo_msg[] = { "none", "CHIPRAM", "KICK", "BOTH" };
@@ -1266,7 +1266,7 @@ void HandleUI(void)
OsdDrawLogo(3, 3, 1);
OsdDrawLogo(4, 4, 1);
OsdDrawLogo(5, 5, 1);
ScrollText(OsdIsBig ? 13 : 6, " MiST by Till Harbaum, based on Minimig by Dennis van Weeren and other projects. MiST hardware and software is distributed under the terms of the GNU General Public License version 3. MiST FPGA cores are the work of their respective authors under individual licensing.", 0, 0, 0, 0);
ScrollText(OsdIsBig ? 13 : 6, " MiSTer by Sorgelig, based on MiST by Till Harbaum and Minimig by Dennis van Weeren and other projects. MiSTer hardware and software is distributed under the terms of the GNU General Public License version 3. MiSTer FPGA cores are the work of their respective authors under individual licensing.", 0, 0, 0, 0);
if (menu | select | left)
{

2
menu.h
View File

@@ -118,10 +118,10 @@ void InsertFloppy(adfTYPE *drive, char* path);
void HandleUI(void);
void PrintDirectory(void);
void ScrollLongName(void);
void ErrorMessage(const char *message, unsigned char code);
void InfoMessage(char *message);
void ShowSplash();
void HideSplash();
void EjectAllFloppies();
#endif

View File

@@ -17,7 +17,6 @@
#include "spi.h"
#include "mist_cfg.h"
#include "tos.h"
#include "errors.h"
#include "input.h"
#include "fpga_io.h"
#include "file_io.h"