mirror of
https://github.com/mist-devel/mist-firmware.git
synced 2026-05-03 06:49:36 +00:00
Add MIST2 core type
This commit is contained in:
2
fpga.c
2
fpga.c
@@ -933,7 +933,7 @@ void fpga_init(char *name, unsigned long currentdirectory) {
|
||||
|
||||
} // end of minimig setup
|
||||
|
||||
if(user_io_core_type() == CORE_TYPE_MIST) {
|
||||
if((user_io_core_type() == CORE_TYPE_MIST) || (user_io_core_type() == CORE_TYPE_MIST2)) {
|
||||
puts("Running mist setup");
|
||||
|
||||
tos_upload(NULL);
|
||||
|
||||
@@ -170,6 +170,7 @@ char *get_core_name()
|
||||
return "PACE";
|
||||
|
||||
case CORE_TYPE_MIST:
|
||||
case CORE_TYPE_MIST2:
|
||||
return "ST";
|
||||
|
||||
case CORE_TYPE_ARCHIE:
|
||||
|
||||
3
main.c
3
main.c
@@ -180,7 +180,8 @@ int main(void)
|
||||
usb_poll();
|
||||
|
||||
// MIST (atari) core supports the same UI as Minimig
|
||||
if(user_io_core_type() == CORE_TYPE_MIST) {
|
||||
if((user_io_core_type() == CORE_TYPE_MIST) ||
|
||||
(user_io_core_type() == CORE_TYPE_MIST2)) {
|
||||
if(!fat_medium_present())
|
||||
tos_eject_all();
|
||||
|
||||
|
||||
7
menu.c
7
menu.c
@@ -505,6 +505,7 @@ char* get_keycode_table()
|
||||
return "Amiga";
|
||||
|
||||
case CORE_TYPE_MIST:
|
||||
case CORE_TYPE_MIST2:
|
||||
return " ST";
|
||||
|
||||
case CORE_TYPE_ARCHIE:
|
||||
@@ -693,7 +694,8 @@ void HandleUI(void)
|
||||
if((user_io_core_type() == CORE_TYPE_MINIMIG) ||
|
||||
(user_io_core_type() == CORE_TYPE_MINIMIG2))
|
||||
menustate = MENU_MAIN1;
|
||||
else if(user_io_core_type() == CORE_TYPE_MIST)
|
||||
else if((user_io_core_type() == CORE_TYPE_MIST) ||
|
||||
(user_io_core_type() == CORE_TYPE_MIST2))
|
||||
menustate = MENU_MIST_MAIN1;
|
||||
else if(user_io_core_type() == CORE_TYPE_ARCHIE)
|
||||
menustate = MENU_ARCHIE_MAIN1;
|
||||
@@ -1129,6 +1131,7 @@ void HandleUI(void)
|
||||
menustate = MENU_MAIN2_1;
|
||||
break;
|
||||
case CORE_TYPE_MIST:
|
||||
case CORE_TYPE_MIST2:
|
||||
menusub = 5;
|
||||
menustate = MENU_MIST_MAIN1;
|
||||
break;
|
||||
@@ -3329,6 +3332,7 @@ void HandleUI(void)
|
||||
if (menu) {
|
||||
switch(user_io_core_type()) {
|
||||
case CORE_TYPE_MIST:
|
||||
case CORE_TYPE_MIST2:
|
||||
menusub = 5;
|
||||
menustate = MENU_MIST_MAIN1;
|
||||
break;
|
||||
@@ -3357,6 +3361,7 @@ void HandleUI(void)
|
||||
else if (menusub == fat_uses_mmc()?2:1) {
|
||||
switch(user_io_core_type()) {
|
||||
case CORE_TYPE_MIST:
|
||||
case CORE_TYPE_MIST2:
|
||||
menusub = 5;
|
||||
menustate = MENU_MIST_MAIN1;
|
||||
break;
|
||||
|
||||
1
osd.c
1
osd.c
@@ -609,6 +609,7 @@ unsigned char OsdGetCtrl(void)
|
||||
|
||||
// mist/atari, archie and 8bit cores use local queue
|
||||
if((user_io_core_type() == CORE_TYPE_MIST) ||
|
||||
(user_io_core_type() == CORE_TYPE_MIST2) ||
|
||||
(user_io_core_type() == CORE_TYPE_ARCHIE) ||
|
||||
(user_io_core_type() == CORE_TYPE_8BIT))
|
||||
c1 = OsdKeyGet();
|
||||
|
||||
126
tos.c
126
tos.c
@@ -672,34 +672,30 @@ static void tos_font_load() {
|
||||
}
|
||||
}
|
||||
|
||||
void tos_load_cartridge(char *name) {
|
||||
void tos_load_cartridge_mist1(char *name) {
|
||||
fileTYPE file;
|
||||
|
||||
if(name)
|
||||
strncpy(config.cart_img, name, 11);
|
||||
|
||||
// upload cartridge
|
||||
// upload cartridge
|
||||
if(config.cart_img[0] && FileOpen(&file, config.cart_img)) {
|
||||
int i;
|
||||
char buffer[512];
|
||||
|
||||
|
||||
tos_debugf("%s:\n size = %d", config.cart_img, file.size);
|
||||
|
||||
int blocks = file.size / 512;
|
||||
tos_debugf(" blocks = %d", blocks);
|
||||
|
||||
|
||||
DISKLED_ON;
|
||||
for(i=0;i<blocks;i++) {
|
||||
FileRead(&file, buffer);
|
||||
|
||||
if(!(i&0x7f))
|
||||
mist_memory_set_address(CART_BASE_ADDRESS+512*i, 128, 0);
|
||||
|
||||
mist_memory_set_address(CART_BASE_ADDRESS+512*i, 128, 0);
|
||||
|
||||
mist_memory_write_block(buffer);
|
||||
|
||||
|
||||
if(i != blocks-1)
|
||||
FileNextSector(&file);
|
||||
FileNextSector(&file);
|
||||
}
|
||||
DISKLED_OFF;
|
||||
|
||||
@@ -714,6 +710,35 @@ void tos_load_cartridge(char *name) {
|
||||
mist_memory_set(0, 64*1024/2);
|
||||
mist_memory_set_address(CART_BASE_ADDRESS+128*512, 128, 0);
|
||||
mist_memory_set(0, 64*1024/2);
|
||||
|
||||
}
|
||||
|
||||
void tos_load_cartridge_mist2(char *name) {
|
||||
fileTYPE file;
|
||||
|
||||
// upload cartridge
|
||||
if(config.cart_img[0] && FileOpen(&file, config.cart_img)) {
|
||||
user_io_file_tx(&file, 0x02);
|
||||
tos_debugf("%s uploaded", config.cart_img);
|
||||
return;
|
||||
}
|
||||
// erase that ram area to remove any previously uploaded
|
||||
// image
|
||||
tos_debugf("Erasing cart memory");
|
||||
user_io_fill_tx(0, 128*1024, 0x02);
|
||||
}
|
||||
|
||||
void tos_load_cartridge(char *name) {
|
||||
|
||||
if(name)
|
||||
strncpy(config.cart_img, name, 11);
|
||||
|
||||
if(user_io_core_type() == CORE_TYPE_MIST) {
|
||||
tos_load_cartridge_mist1(name);
|
||||
} else {
|
||||
tos_load_cartridge_mist2(name);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
char tos_cartridge_is_inserted() {
|
||||
@@ -721,10 +746,8 @@ char tos_cartridge_is_inserted() {
|
||||
}
|
||||
|
||||
void tos_upload(char *name) {
|
||||
fileTYPE file;
|
||||
|
||||
// set video offset in fpga
|
||||
tos_set_video_adjust(0, 0);
|
||||
tos_debugf("Uploading TOS");
|
||||
|
||||
if(name)
|
||||
strncpy(config.tos_img, name, 11);
|
||||
@@ -732,6 +755,73 @@ void tos_upload(char *name) {
|
||||
// put cpu into reset
|
||||
config.system_ctrl |= TOS_CONTROL_CPU_RESET;
|
||||
mist_set_control(config.system_ctrl);
|
||||
if(user_io_core_type() == CORE_TYPE_MIST) {
|
||||
tos_upload_mist1(name);
|
||||
} else {
|
||||
tos_upload_mist2(name);
|
||||
}
|
||||
|
||||
// let cpu run (release reset)
|
||||
config.system_ctrl &= ~TOS_CONTROL_CPU_RESET;
|
||||
mist_set_control(config.system_ctrl);
|
||||
|
||||
}
|
||||
|
||||
void tos_upload_mist2(char *name) {
|
||||
fileTYPE file;
|
||||
|
||||
// upload and verify tos image
|
||||
if(FileOpen(&file, config.tos_img)) {
|
||||
|
||||
tos_debugf("TOS.IMG:\n size = %d", file.size);
|
||||
|
||||
if(file.size >= 256*1024)
|
||||
user_io_file_tx(&file, 0x00);
|
||||
else if(file.size == 192*1024)
|
||||
user_io_file_tx(&file, 0x01);
|
||||
else
|
||||
tos_debugf("WARNING: Unexpected TOS size!");
|
||||
} else {
|
||||
tos_debugf("Unable to find tos.img");
|
||||
return;
|
||||
}
|
||||
|
||||
// This is the initial boot if no name was given. Otherwise the
|
||||
// user reloaded a new os
|
||||
if(!name) {
|
||||
// load
|
||||
tos_load_cartridge(NULL);
|
||||
|
||||
// try to open both floppies
|
||||
int i;
|
||||
for(i=0;i<2;i++) {
|
||||
char name[] = "DISK_A ST ";
|
||||
fileTYPE file;
|
||||
if(FileOpen(&file, name)) {
|
||||
tos_insert_disk(i, &file);
|
||||
}
|
||||
}
|
||||
|
||||
if(config.sd_direct) {
|
||||
tos_set_direct_hdd(1);
|
||||
} else {
|
||||
// try to open harddisk image
|
||||
for(i=0;i<2;i++) {
|
||||
if(FileOpen(&file, config.acsi_img[i])) {
|
||||
tos_select_hdd_image(i, &file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ikbd_reset();
|
||||
}
|
||||
|
||||
void tos_upload_mist1(char *name) {
|
||||
fileTYPE file;
|
||||
int i;
|
||||
|
||||
// set video offset in fpga
|
||||
tos_set_video_adjust(0, 0);
|
||||
|
||||
tos_font_load();
|
||||
tos_clr();
|
||||
@@ -740,8 +830,6 @@ void tos_upload(char *name) {
|
||||
tos_write("\x0e\x0f MIST core \x0e\x0f ");
|
||||
tos_write("Uploading TOS ... ");
|
||||
|
||||
tos_debugf("Uploading TOS ...");
|
||||
|
||||
DISKLED_ON;
|
||||
|
||||
// upload and verify tos image
|
||||
@@ -963,9 +1051,6 @@ void tos_upload(char *name) {
|
||||
|
||||
ikbd_reset();
|
||||
|
||||
// let cpu run (release reset)
|
||||
config.system_ctrl &= ~TOS_CONTROL_CPU_RESET;
|
||||
mist_set_control(config.system_ctrl);
|
||||
}
|
||||
|
||||
static unsigned long get_long(char *buffer, int offset) {
|
||||
@@ -1008,7 +1093,8 @@ void tos_update_sysctrl(unsigned long n) {
|
||||
// some of the usb drivers also call this without knowing which
|
||||
// core is running. So make sure this only happens if the Atari ST (MIST)
|
||||
// core is running
|
||||
if(user_io_core_type() == CORE_TYPE_MIST) {
|
||||
if((user_io_core_type() == CORE_TYPE_MIST) ||
|
||||
(user_io_core_type() == CORE_TYPE_MIST2)) {
|
||||
config.system_ctrl = n;
|
||||
mist_set_control(config.system_ctrl);
|
||||
}
|
||||
|
||||
4
tos.h
4
tos.h
@@ -82,6 +82,8 @@
|
||||
|
||||
unsigned long tos_system_ctrl(void);
|
||||
|
||||
void tos_upload_mist1(char *);
|
||||
void tos_upload_mist2(char *);
|
||||
void tos_upload(char *);
|
||||
void tos_poll();
|
||||
void tos_update_sysctrl(unsigned long);
|
||||
@@ -96,6 +98,8 @@ void tos_reset(char cold);
|
||||
char *tos_get_image_name();
|
||||
char *tos_get_cartridge_name();
|
||||
char tos_cartridge_is_inserted();
|
||||
void tos_load_cartridge_mist1(char *);
|
||||
void tos_load_cartridge_mist2(char *);
|
||||
void tos_load_cartridge(char *);
|
||||
|
||||
void tos_set_video_adjust(char axis, char value);
|
||||
|
||||
47
user_io.c
47
user_io.c
@@ -226,6 +226,7 @@ void user_io_detect_core_type() {
|
||||
(core_type != CORE_TYPE_MINIMIG2) &&
|
||||
(core_type != CORE_TYPE_PACE) &&
|
||||
(core_type != CORE_TYPE_MIST) &&
|
||||
(core_type != CORE_TYPE_MIST2) &&
|
||||
(core_type != CORE_TYPE_ARCHIE) &&
|
||||
(core_type != CORE_TYPE_8BIT))
|
||||
core_type = CORE_TYPE_UNKNOWN;
|
||||
@@ -252,6 +253,7 @@ void user_io_detect_core_type() {
|
||||
break;
|
||||
|
||||
case CORE_TYPE_MIST:
|
||||
case CORE_TYPE_MIST2:
|
||||
puts("Identified MiST core");
|
||||
break;
|
||||
|
||||
@@ -379,8 +381,8 @@ void user_io_digital_joystick(unsigned char joystick, unsigned char map) {
|
||||
|
||||
// atari ST handles joystick 0 and 1 through the ikbd emulated by the io controller
|
||||
// but only for joystick 1 and 2
|
||||
if((core_type == CORE_TYPE_MIST) && (joystick < 2)) {
|
||||
ikbd_joystick(joystick, map);
|
||||
if(((core_type == CORE_TYPE_MIST) || (core_type == CORE_TYPE_MIST2)) && (joystick < 2)) {
|
||||
ikbd_joystick(joystick, map);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -700,12 +702,30 @@ static void user_io_file_tx_done(void) {
|
||||
iprintf("\n");
|
||||
}
|
||||
|
||||
static void user_io_file_tx_fill(unsigned char fill, unsigned int len) {
|
||||
|
||||
EnableFpga();
|
||||
SPI(UIO_FILE_TX_DAT);
|
||||
while(len--) {
|
||||
SPI(fill);
|
||||
}
|
||||
DisableFpga();
|
||||
}
|
||||
|
||||
|
||||
void user_io_file_tx(fileTYPE *file, unsigned char index) {
|
||||
user_io_file_tx_prepare(index);
|
||||
user_io_file_tx_send(file);
|
||||
user_io_file_tx_done();
|
||||
}
|
||||
|
||||
// send 'fill' byte 'len' times
|
||||
void user_io_fill_tx(unsigned char fill, unsigned int len, unsigned char index) {
|
||||
user_io_file_tx_prepare(index);
|
||||
user_io_file_tx_fill(fill, len);
|
||||
user_io_file_tx_done();
|
||||
}
|
||||
|
||||
// 8 bit cores have a config string telling the firmware how
|
||||
// to treat it
|
||||
char *user_io_8bit_get_string(char index) {
|
||||
@@ -872,12 +892,14 @@ void user_io_poll() {
|
||||
(core_type != CORE_TYPE_MINIMIG2) &&
|
||||
(core_type != CORE_TYPE_PACE) &&
|
||||
(core_type != CORE_TYPE_MIST) &&
|
||||
(core_type != CORE_TYPE_MIST2) &&
|
||||
(core_type != CORE_TYPE_ARCHIE) &&
|
||||
(core_type != CORE_TYPE_8BIT)) {
|
||||
return; // no user io for the installed core
|
||||
}
|
||||
|
||||
if(core_type == CORE_TYPE_MIST) {
|
||||
if((core_type == CORE_TYPE_MIST) ||
|
||||
(core_type == CORE_TYPE_MIST2)) {
|
||||
char redirect = tos_get_cdc_control_redirect();
|
||||
|
||||
ikbd_poll();
|
||||
@@ -1027,7 +1049,8 @@ void user_io_poll() {
|
||||
}
|
||||
}
|
||||
|
||||
if(core_type == CORE_TYPE_MIST) {
|
||||
if((core_type == CORE_TYPE_MIST) ||
|
||||
(core_type == CORE_TYPE_MIST2)) {
|
||||
// do some tos specific monitoring here
|
||||
tos_poll();
|
||||
}
|
||||
@@ -1370,7 +1393,8 @@ static void send_keycode(unsigned short code) {
|
||||
kbd_fifo_enqueue(code);
|
||||
}
|
||||
|
||||
if(core_type == CORE_TYPE_MIST) {
|
||||
if((core_type == CORE_TYPE_MIST) ||
|
||||
(core_type == CORE_TYPE_MIST2)) {
|
||||
// atari has "break" marker in msb
|
||||
if(code & BREAK) code = (code & 0xff) | 0x80;
|
||||
|
||||
@@ -1438,7 +1462,8 @@ void user_io_mouse(unsigned char b, char x, char y) {
|
||||
}
|
||||
|
||||
// send mouse data as mist expects it
|
||||
if(core_type == CORE_TYPE_MIST)
|
||||
if((core_type == CORE_TYPE_MIST) ||
|
||||
(core_type == CORE_TYPE_MIST2))
|
||||
ikbd_mouse(b, x, y);
|
||||
|
||||
if(core_type == CORE_TYPE_ARCHIE)
|
||||
@@ -1491,7 +1516,8 @@ unsigned short keycode(unsigned char in) {
|
||||
|
||||
// atari st and the 8 bit core (currently only used for atari 800)
|
||||
// use the same key codes
|
||||
if(core_type == CORE_TYPE_MIST)
|
||||
if((core_type == CORE_TYPE_MIST) ||
|
||||
(core_type == CORE_TYPE_MIST2))
|
||||
return usb2atari[in];
|
||||
|
||||
if(core_type == CORE_TYPE_ARCHIE)
|
||||
@@ -1552,11 +1578,12 @@ unsigned short modifier_keycode(unsigned char index) {
|
||||
return amiga_modifier[index];
|
||||
}
|
||||
|
||||
if(core_type == CORE_TYPE_MIST) {
|
||||
if((core_type == CORE_TYPE_MIST) ||
|
||||
(core_type == CORE_TYPE_MIST2)) {
|
||||
static const unsigned short atari_modifier[] =
|
||||
{ 0x1d, 0x2a, 0x38, MISS, 0x1d, 0x36, 0x38, MISS };
|
||||
return atari_modifier[index];
|
||||
}
|
||||
}
|
||||
|
||||
if(core_type == CORE_TYPE_8BIT) {
|
||||
static const unsigned short ps2_modifier[] =
|
||||
@@ -1589,6 +1616,7 @@ static char key_used_by_osd(unsigned short s) {
|
||||
// else none as it's up to the core to forward keys
|
||||
// to the OSD
|
||||
return((core_type == CORE_TYPE_MIST) ||
|
||||
(core_type == CORE_TYPE_MIST2) ||
|
||||
(core_type == CORE_TYPE_ARCHIE) ||
|
||||
(core_type == CORE_TYPE_8BIT));
|
||||
}
|
||||
@@ -1722,6 +1750,7 @@ void user_io_kbd(unsigned char m, unsigned char *k, uint8_t priority, unsigned s
|
||||
if( (core_type == CORE_TYPE_MINIMIG) ||
|
||||
(core_type == CORE_TYPE_MINIMIG2) ||
|
||||
(core_type == CORE_TYPE_MIST) ||
|
||||
(core_type == CORE_TYPE_MIST2) ||
|
||||
(core_type == CORE_TYPE_ARCHIE) ||
|
||||
(core_type == CORE_TYPE_8BIT))
|
||||
{
|
||||
|
||||
@@ -125,6 +125,7 @@
|
||||
#define CORE_TYPE_8BIT 0xa4 // atari 800/c64 like core
|
||||
#define CORE_TYPE_MINIMIG2 0xa5 // new Minimig with AGA
|
||||
#define CORE_TYPE_ARCHIE 0xa6 // Acorn Archimedes
|
||||
#define CORE_TYPE_MIST2 0xa7 // New MiST core
|
||||
|
||||
// user io status bits (currently only used by 8bit)
|
||||
#define UIO_STATUS_RESET 0x01
|
||||
@@ -166,6 +167,7 @@ void user_io_osd_key_enable(char);
|
||||
void user_io_serial_tx(char *, uint16_t);
|
||||
char *user_io_8bit_get_string(char);
|
||||
unsigned long user_io_8bit_set_status(unsigned long, unsigned long);
|
||||
void user_io_fill_tx(unsigned char, unsigned int, unsigned char);
|
||||
void user_io_file_tx(fileTYPE *, unsigned char);
|
||||
void user_io_sd_set_config(void);
|
||||
char user_io_dip_switch1(void);
|
||||
|
||||
Reference in New Issue
Block a user