2013-07-06 04:37:13 +00:00
|
|
|
/*
|
2013-06-11 07:08:15 +00:00
|
|
|
* Apple // emulator for Linux: Miscellaneous support
|
|
|
|
*
|
|
|
|
* Copyright 1994 Alexander Jean-Claude Bottema
|
|
|
|
* Copyright 1995 Stephen Lee
|
|
|
|
* Copyright 1997, 1998 Aaron Culliney
|
|
|
|
* Copyright 1998, 1999, 2000 Michael Deutschmann
|
|
|
|
*
|
|
|
|
* This software package is subject to the GNU General Public License
|
2013-07-06 04:37:13 +00:00
|
|
|
* version 2 or later (your choice) as published by the Free Software
|
2013-06-11 07:08:15 +00:00
|
|
|
* Foundation.
|
|
|
|
*
|
2013-07-06 04:37:13 +00:00
|
|
|
* THERE ARE NO WARRANTIES WHATSOEVER.
|
2013-06-11 07:08:15 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2014-01-23 04:42:34 +00:00
|
|
|
#include "common.h"
|
2013-06-11 07:08:15 +00:00
|
|
|
|
|
|
|
/* ----------------------------------
|
|
|
|
internal apple2 variables
|
|
|
|
---------------------------------- */
|
|
|
|
|
2013-07-06 04:37:13 +00:00
|
|
|
static unsigned char apple_ii_rom[12288];
|
|
|
|
static unsigned char apple_iie_rom[32768]; /* //e */
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2014-01-26 06:10:33 +00:00
|
|
|
bool do_logging = true; // also controlled by NDEBUG
|
|
|
|
FILE *error_log = NULL;
|
|
|
|
|
2013-06-11 07:08:15 +00:00
|
|
|
GLUE_FIXED_READ(read_ram_default,apple_ii_64k)
|
|
|
|
GLUE_FIXED_WRITE(write_ram_default,apple_ii_64k)
|
|
|
|
GLUE_BANK_READ(read_ram_bank,base_d000_rd)
|
|
|
|
GLUE_BANK_MAYBEWRITE(write_ram_bank,base_d000_wrt)
|
|
|
|
GLUE_BANK_READ(read_ram_lc,base_e000_rd)
|
|
|
|
GLUE_BANK_MAYBEWRITE(write_ram_lc,base_e000_wrt)
|
|
|
|
|
|
|
|
|
|
|
|
GLUE_BANK_READ(iie_read_ram_default,base_ramrd)
|
|
|
|
GLUE_BANK_WRITE(iie_write_ram_default,base_ramwrt)
|
|
|
|
GLUE_BANK_READ(iie_read_ram_text_page0,base_textrd)
|
|
|
|
GLUE_BANK_WRITE(iie_write_screen_hole_text_page0,base_textwrt)
|
|
|
|
GLUE_BANK_READ(iie_read_ram_hires_page0,base_hgrrd)
|
|
|
|
GLUE_BANK_WRITE(iie_write_screen_hole_hires_page0,base_hgrwrt)
|
|
|
|
|
|
|
|
GLUE_BANK_READ(iie_read_ram_zpage_and_stack,base_stackzp)
|
|
|
|
GLUE_BANK_WRITE(iie_write_ram_zpage_and_stack,base_stackzp)
|
|
|
|
|
|
|
|
GLUE_BANK_READ(iie_read_slot3,base_c3rom)
|
2013-11-23 07:40:24 +00:00
|
|
|
GLUE_BANK_MAYBEREAD(iie_read_slot4,base_c4rom)
|
|
|
|
GLUE_BANK_MAYBEREAD(iie_read_slot5,base_c5rom)
|
2013-06-11 07:08:15 +00:00
|
|
|
GLUE_BANK_READ(iie_read_slotx,base_cxrom)
|
|
|
|
|
|
|
|
|
2013-11-23 07:37:26 +00:00
|
|
|
int32_t softswitches;
|
|
|
|
|
|
|
|
uint8_t *base_ramrd;
|
|
|
|
uint8_t *base_ramwrt;
|
|
|
|
uint8_t *base_textrd;
|
|
|
|
uint8_t *base_textwrt;
|
|
|
|
uint8_t *base_hgrrd;
|
|
|
|
uint8_t *base_hgrwrt;
|
|
|
|
|
|
|
|
uint8_t *base_stackzp;
|
|
|
|
uint8_t *base_d000_rd;
|
|
|
|
uint8_t *base_e000_rd;
|
|
|
|
uint8_t *base_d000_wrt;
|
|
|
|
uint8_t *base_e000_wrt;
|
|
|
|
|
|
|
|
uint8_t *base_c3rom;
|
|
|
|
void *base_c4rom;
|
|
|
|
void *base_c5rom;
|
|
|
|
uint8_t *base_cxrom;
|
|
|
|
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2014-02-22 17:45:19 +00:00
|
|
|
/* -------------------------------------------------------------------------
|
|
|
|
c_debug_illegal_bcd - illegal BCD (decimal mode) computation
|
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
void c_debug_illegal_bcd()
|
|
|
|
{
|
|
|
|
ERRLOG("Illegal/undefined BCD operation encountered, debug break on c_debug_illegal_bcd to debug...");
|
|
|
|
char *ptr = (char*)0x0bad;
|
|
|
|
*ptr = 0x1337; // segfault
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-06-11 07:08:15 +00:00
|
|
|
/* -------------------------------------------------------------------------
|
|
|
|
c_set_altchar() - set alternate character set
|
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
void c_set_altchar()
|
|
|
|
{
|
|
|
|
video_loadfont(0x40,0x20,mousetext_glyphs,1);
|
|
|
|
video_loadfont(0x60,0x20,lcase_glyphs,2);
|
|
|
|
|
|
|
|
video_redraw();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------------
|
|
|
|
c_set_primary_char() - set primary character set
|
|
|
|
------------------------------------------------------------------------- */
|
2013-07-06 04:37:13 +00:00
|
|
|
void c_set_primary_char()
|
2013-06-11 07:08:15 +00:00
|
|
|
{
|
|
|
|
video_loadfont(0x40,0x40,ucase_glyphs,3);
|
|
|
|
|
|
|
|
video_redraw();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------------
|
|
|
|
c_initialize_font(): Initialize ROM character table to primary char set
|
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
void c_initialize_font()
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2013-06-11 07:08:15 +00:00
|
|
|
video_loadfont(0x00,0x40,ucase_glyphs,2);
|
|
|
|
video_loadfont(0x40,0x40,ucase_glyphs,3);
|
2013-07-06 04:37:13 +00:00
|
|
|
video_loadfont(0x80,0x40,ucase_glyphs,0);
|
2013-06-11 07:08:15 +00:00
|
|
|
video_loadfont(0xC0,0x20,ucase_glyphs,0);
|
|
|
|
video_loadfont(0xE0,0x20,lcase_glyphs,0);
|
|
|
|
video_redraw();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------------
|
|
|
|
c_initialize_tables()
|
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
void c_initialize_tables() {
|
|
|
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/* reset everything */
|
2013-07-06 04:37:13 +00:00
|
|
|
for (i = 0; i < 0x10000; i++)
|
|
|
|
{
|
|
|
|
if (apple_mode == IIE_MODE)
|
|
|
|
{
|
|
|
|
cpu65_vmem[i].r = iie_read_ram_default;
|
|
|
|
cpu65_vmem[i].w = iie_write_ram_default;
|
|
|
|
}
|
|
|
|
else
|
2013-06-11 07:08:15 +00:00
|
|
|
{
|
2013-07-06 04:37:13 +00:00
|
|
|
cpu65_vmem[i].r = read_ram_default;
|
|
|
|
cpu65_vmem[i].w = write_ram_default;
|
|
|
|
}
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* language card read/write area */
|
2013-07-06 04:37:13 +00:00
|
|
|
for (i = 0xD000; i < 0xE000; i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
cpu65_vmem[i].w =
|
|
|
|
write_ram_bank;
|
|
|
|
cpu65_vmem[i].r =
|
|
|
|
read_ram_bank;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0xE000; i < 0x10000; i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
cpu65_vmem[i].w =
|
|
|
|
write_ram_lc;
|
|
|
|
cpu65_vmem[i].r =
|
|
|
|
read_ram_lc;
|
|
|
|
}
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
2013-07-06 04:37:13 +00:00
|
|
|
|
2013-06-11 07:08:15 +00:00
|
|
|
/* done common initialization */
|
|
|
|
|
|
|
|
/* initialize zero-page, //e specific */
|
2013-07-06 04:37:13 +00:00
|
|
|
if (apple_mode == IIE_MODE)
|
|
|
|
{
|
|
|
|
for (i = 0; i < 0x200; i++)
|
|
|
|
{
|
|
|
|
cpu65_vmem[i].r =
|
|
|
|
iie_read_ram_zpage_and_stack;
|
|
|
|
cpu65_vmem[i].w =
|
|
|
|
iie_write_ram_zpage_and_stack;
|
|
|
|
}
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
2013-07-06 04:37:13 +00:00
|
|
|
|
|
|
|
/* initialize first text & hires page, which are specially bank switched
|
2013-06-11 07:08:15 +00:00
|
|
|
*
|
2013-07-06 04:37:13 +00:00
|
|
|
* video_set() substitutes it's own hooks for all visible write locations
|
2013-06-11 07:08:15 +00:00
|
|
|
* affect the display, leaving our write-functions in place only at the
|
|
|
|
* `screen holes', hence the name.
|
|
|
|
*/
|
2013-07-06 04:37:13 +00:00
|
|
|
for (i = 0x400; i < 0x800; i++)
|
|
|
|
{
|
|
|
|
cpu65_vmem[i].r =
|
|
|
|
iie_read_ram_text_page0;
|
|
|
|
cpu65_vmem[i].w =
|
|
|
|
iie_write_screen_hole_text_page0;
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
2013-07-06 04:37:13 +00:00
|
|
|
|
|
|
|
for (i = 0x2000; i < 0x4000; i++)
|
|
|
|
{
|
|
|
|
cpu65_vmem[i].r =
|
|
|
|
iie_read_ram_hires_page0;
|
|
|
|
cpu65_vmem[i].w =
|
|
|
|
iie_write_screen_hole_hires_page0;
|
|
|
|
}
|
|
|
|
|
2013-06-11 07:08:15 +00:00
|
|
|
/* softswich rom */
|
2013-07-06 04:37:13 +00:00
|
|
|
for (i = 0xC000; i < 0xC100; i++)
|
|
|
|
{
|
|
|
|
cpu65_vmem[i].r =
|
|
|
|
read_unmapped_softswitch;
|
|
|
|
cpu65_vmem[i].w =
|
|
|
|
write_unmapped_softswitch;
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
|
|
|
|
2013-11-23 07:40:24 +00:00
|
|
|
/* slot rom defaults */
|
2013-07-06 04:37:13 +00:00
|
|
|
for (i = 0xC100; i < 0xD000; i++)
|
|
|
|
{
|
|
|
|
cpu65_vmem[i].r =
|
|
|
|
iie_read_ram_default;
|
|
|
|
cpu65_vmem[i].w =
|
|
|
|
ram_nop;
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* keyboard data and strobe (READ) */
|
2013-07-06 04:37:13 +00:00
|
|
|
for (i = 0xC000; i < 0xC010; i++)
|
|
|
|
{
|
|
|
|
cpu65_vmem[i].r =
|
|
|
|
read_keyboard;
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
2013-07-06 04:37:13 +00:00
|
|
|
|
|
|
|
for (i = 0xC010; i < 0xC020; i++)
|
|
|
|
{
|
|
|
|
cpu65_vmem[i].r =
|
|
|
|
cpu65_vmem[i].w =
|
|
|
|
read_keyboard_strobe;
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
|
|
|
|
2013-07-06 04:37:13 +00:00
|
|
|
if (apple_mode == IIE_MODE)
|
|
|
|
{
|
|
|
|
|
|
|
|
/* RDBNK2 switch */
|
|
|
|
cpu65_vmem[0xC011].r =
|
|
|
|
iie_check_bank;
|
|
|
|
|
|
|
|
/* RDLCRAM switch */
|
|
|
|
cpu65_vmem[0xC012].r =
|
|
|
|
iie_check_lcram;
|
|
|
|
|
|
|
|
/* 80STORE switch */
|
|
|
|
cpu65_vmem[0xC000].w = iie_80store_off;
|
|
|
|
cpu65_vmem[0xC001].w = iie_80store_on;
|
|
|
|
cpu65_vmem[0xC018].r = iie_check_80store;
|
|
|
|
|
|
|
|
/* RAMRD switch */
|
|
|
|
cpu65_vmem[0xC002].w = iie_ramrd_main;
|
|
|
|
cpu65_vmem[0xC003].w = iie_ramrd_aux;
|
|
|
|
cpu65_vmem[0xC013].r = iie_check_ramrd;
|
|
|
|
|
|
|
|
/* RAMWRT switch */
|
|
|
|
cpu65_vmem[0xC004].w = iie_ramwrt_main;
|
|
|
|
cpu65_vmem[0xC005].w = iie_ramwrt_aux;
|
|
|
|
cpu65_vmem[0xC014].r = iie_check_ramwrt;
|
|
|
|
|
|
|
|
/* ALTZP switch */
|
|
|
|
cpu65_vmem[0xC008].w = iie_altzp_main;
|
|
|
|
cpu65_vmem[0xC009].w = iie_altzp_aux;
|
|
|
|
cpu65_vmem[0xC016].r = iie_check_altzp;
|
|
|
|
|
|
|
|
/* 80COL switch */
|
|
|
|
cpu65_vmem[0xC00C].w = iie_80col_off;
|
|
|
|
cpu65_vmem[0xC00D].w = iie_80col_on;
|
|
|
|
cpu65_vmem[0xC01F].r = iie_check_80col;
|
|
|
|
|
|
|
|
/* ALTCHAR switch */
|
|
|
|
cpu65_vmem[0xC00E].w = iie_altchar_off;
|
|
|
|
cpu65_vmem[0xC00F].w = iie_altchar_on;
|
|
|
|
cpu65_vmem[0xC01E].r = iie_check_altchar;
|
|
|
|
|
|
|
|
/* SLOTC3ROM switch */
|
|
|
|
cpu65_vmem[0xC00A].w = iie_c3rom_internal;
|
|
|
|
cpu65_vmem[0xC00B].w = iie_c3rom_peripheral;
|
|
|
|
cpu65_vmem[0xC017].r = iie_check_c3rom;
|
|
|
|
|
|
|
|
/* SLOTCXROM switch */
|
|
|
|
cpu65_vmem[0xC006].w = iie_cxrom_peripheral;
|
|
|
|
cpu65_vmem[0xC007].w = iie_cxrom_internal;
|
|
|
|
cpu65_vmem[0xC015].r = iie_check_cxrom;
|
|
|
|
|
|
|
|
/* RDVBLBAR switch */
|
|
|
|
cpu65_vmem[0xC019].r =
|
|
|
|
iie_check_vbl;
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
2013-07-06 04:37:13 +00:00
|
|
|
|
2013-06-11 07:08:15 +00:00
|
|
|
/* random number generator */
|
|
|
|
for (i = 0xC020; i < 0xC030; i++)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
|
|
|
cpu65_vmem[i].r =
|
|
|
|
cpu65_vmem[i].w =
|
|
|
|
read_random;
|
|
|
|
}
|
2013-06-11 07:08:15 +00:00
|
|
|
|
|
|
|
/* TEXT switch */
|
|
|
|
cpu65_vmem[0xC050].r =
|
2013-07-06 04:37:13 +00:00
|
|
|
cpu65_vmem[0xC050].w =
|
|
|
|
read_switch_graphics;
|
2013-06-11 07:08:15 +00:00
|
|
|
cpu65_vmem[0xC051].r =
|
2013-07-06 04:37:13 +00:00
|
|
|
cpu65_vmem[0xC051].w =
|
|
|
|
read_switch_text;
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2013-07-06 04:37:13 +00:00
|
|
|
if (apple_mode == IIE_MODE)
|
|
|
|
{
|
|
|
|
cpu65_vmem[0xC01A].r =
|
|
|
|
iie_check_text;
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
2013-07-06 04:37:13 +00:00
|
|
|
|
2013-06-11 07:08:15 +00:00
|
|
|
/* MIXED switch */
|
|
|
|
cpu65_vmem[0xC052].r =
|
2013-07-06 04:37:13 +00:00
|
|
|
cpu65_vmem[0xC052].w =
|
|
|
|
read_switch_no_mixed;
|
2013-06-11 07:08:15 +00:00
|
|
|
cpu65_vmem[0xC053].r =
|
2013-07-06 04:37:13 +00:00
|
|
|
cpu65_vmem[0xC053].w =
|
|
|
|
read_switch_mixed;
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2013-07-06 04:37:13 +00:00
|
|
|
if (apple_mode == IIE_MODE)
|
|
|
|
{
|
|
|
|
cpu65_vmem[0xC01B].r =
|
|
|
|
iie_check_mixed;
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
2013-07-06 04:37:13 +00:00
|
|
|
|
2013-06-11 07:08:15 +00:00
|
|
|
/* PAGE2 switch */
|
2013-07-06 04:37:13 +00:00
|
|
|
if (apple_mode == IIE_MODE)
|
|
|
|
{
|
|
|
|
cpu65_vmem[0xC054].r =
|
|
|
|
cpu65_vmem[0xC054].w =
|
|
|
|
iie_page2_off;
|
|
|
|
}
|
|
|
|
else
|
2013-06-11 07:08:15 +00:00
|
|
|
{
|
2013-07-06 04:37:13 +00:00
|
|
|
cpu65_vmem[0xC054].r =
|
|
|
|
cpu65_vmem[0xC054].w =
|
|
|
|
read_switch_primary_page;
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
|
|
|
|
2013-07-06 04:37:13 +00:00
|
|
|
if (apple_mode == IIE_MODE)
|
|
|
|
{
|
|
|
|
cpu65_vmem[0xC01C].r =
|
|
|
|
iie_check_page2;
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
2013-07-06 04:37:13 +00:00
|
|
|
|
2013-06-11 07:08:15 +00:00
|
|
|
/* PAGE2 switch */
|
2013-07-06 04:37:13 +00:00
|
|
|
if (apple_mode == IIE_MODE)
|
|
|
|
{
|
|
|
|
cpu65_vmem[0xC055].r =
|
|
|
|
cpu65_vmem[0xC055].w =
|
|
|
|
iie_page2_on;
|
|
|
|
}
|
|
|
|
else
|
2013-06-11 07:08:15 +00:00
|
|
|
{
|
2013-07-06 04:37:13 +00:00
|
|
|
cpu65_vmem[0xC055].r =
|
|
|
|
cpu65_vmem[0xC055].w =
|
|
|
|
read_switch_secondary_page;
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* HIRES switch */
|
2013-07-06 04:37:13 +00:00
|
|
|
if (apple_mode == IIE_MODE)
|
|
|
|
{
|
|
|
|
cpu65_vmem[0xC01D].r =
|
|
|
|
iie_check_hires;
|
|
|
|
cpu65_vmem[0xC056].r =
|
|
|
|
cpu65_vmem[0xC056].w =
|
|
|
|
iie_hires_off;
|
|
|
|
cpu65_vmem[0xC057].r =
|
|
|
|
cpu65_vmem[0xC057].w =
|
|
|
|
iie_hires_on;
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-07-06 04:37:13 +00:00
|
|
|
cpu65_vmem[0xC056].r =
|
|
|
|
cpu65_vmem[0xC056].w =
|
|
|
|
read_switch_lores;
|
|
|
|
cpu65_vmem[0xC057].r =
|
|
|
|
cpu65_vmem[0xC057].w =
|
|
|
|
read_switch_hires;
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* game I/O switches */
|
|
|
|
cpu65_vmem[0xC061].r =
|
2013-07-06 04:37:13 +00:00
|
|
|
cpu65_vmem[0xC069].r =
|
|
|
|
read_button0;
|
2013-06-11 07:08:15 +00:00
|
|
|
cpu65_vmem[0xC062].r =
|
2013-07-06 04:37:13 +00:00
|
|
|
cpu65_vmem[0xC06A].r =
|
|
|
|
read_button1;
|
2013-06-11 07:08:15 +00:00
|
|
|
cpu65_vmem[0xC063].r =
|
2013-07-06 04:37:13 +00:00
|
|
|
cpu65_vmem[0xC06B].r =
|
|
|
|
read_button2;
|
2013-06-11 07:08:15 +00:00
|
|
|
cpu65_vmem[0xC064].r =
|
2013-07-06 04:37:13 +00:00
|
|
|
cpu65_vmem[0xC06C].r =
|
|
|
|
read_gc0;
|
2013-06-11 07:08:15 +00:00
|
|
|
cpu65_vmem[0xC065].r =
|
2013-07-06 04:37:13 +00:00
|
|
|
cpu65_vmem[0xC06D].r =
|
|
|
|
read_gc1;
|
|
|
|
if (apple_mode == IIE_MODE)
|
|
|
|
{
|
|
|
|
cpu65_vmem[0xC066].r =
|
|
|
|
iie_read_gc2;
|
|
|
|
cpu65_vmem[0xC067].r =
|
|
|
|
iie_read_gc3;
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
2013-07-06 04:37:13 +00:00
|
|
|
|
2013-06-11 07:08:15 +00:00
|
|
|
for (i = 0xC070; i < 0xC080; i++)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
|
|
|
cpu65_vmem[i].r =
|
|
|
|
cpu65_vmem[i].w =
|
|
|
|
read_gc_strobe;
|
|
|
|
}
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2013-07-06 04:37:13 +00:00
|
|
|
if (apple_mode == IIE_MODE)
|
|
|
|
{
|
|
|
|
/* IOUDIS switch & read_gc_strobe */
|
|
|
|
cpu65_vmem[0xC07E].w =
|
|
|
|
iie_ioudis_on;
|
|
|
|
cpu65_vmem[0xC07F].w =
|
|
|
|
iie_ioudis_off;
|
|
|
|
cpu65_vmem[0xC07E].r =
|
|
|
|
iie_check_ioudis;
|
|
|
|
cpu65_vmem[0xC07F].r =
|
|
|
|
iie_check_dhires;
|
|
|
|
|
|
|
|
/* DHIRES/Annunciator switches */
|
|
|
|
cpu65_vmem[0xC05E].w =
|
|
|
|
cpu65_vmem[0xC05E].r =
|
|
|
|
iie_dhires_on;
|
|
|
|
cpu65_vmem[0xC05F].w =
|
|
|
|
cpu65_vmem[0xC05F].r =
|
|
|
|
iie_dhires_off;
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
2013-07-06 04:37:13 +00:00
|
|
|
|
2013-06-11 07:08:15 +00:00
|
|
|
/* language card softswitches */
|
|
|
|
cpu65_vmem[0xC080].r = cpu65_vmem[0xC080].w =
|
2013-07-06 04:37:13 +00:00
|
|
|
cpu65_vmem[0xC084].r = cpu65_vmem[0xC084].w =
|
|
|
|
(apple_mode == IIE_MODE) ? iie_c080 : lc_c080;
|
2013-06-11 07:08:15 +00:00
|
|
|
cpu65_vmem[0xC081].r = cpu65_vmem[0xC081].w =
|
2013-07-06 04:37:13 +00:00
|
|
|
cpu65_vmem[0xC085].r = cpu65_vmem[0xC085].w =
|
|
|
|
(apple_mode == IIE_MODE) ? iie_c081 : lc_c081;
|
2013-06-11 07:08:15 +00:00
|
|
|
cpu65_vmem[0xC082].r = cpu65_vmem[0xC082].w =
|
2013-07-06 04:37:13 +00:00
|
|
|
cpu65_vmem[0xC086].r = cpu65_vmem[0xC086].w =
|
|
|
|
lc_c082;
|
2013-06-11 07:08:15 +00:00
|
|
|
cpu65_vmem[0xC083].r = cpu65_vmem[0xC083].w =
|
2013-07-06 04:37:13 +00:00
|
|
|
cpu65_vmem[0xC087].r = cpu65_vmem[0xC087].w =
|
|
|
|
(apple_mode == IIE_MODE) ? iie_c083 : lc_c083;
|
2013-06-11 07:08:15 +00:00
|
|
|
|
|
|
|
cpu65_vmem[0xC088].r = cpu65_vmem[0xC088].w =
|
2013-07-06 04:37:13 +00:00
|
|
|
cpu65_vmem[0xC08C].r = cpu65_vmem[0xC08C].w =
|
|
|
|
(apple_mode == IIE_MODE) ? iie_c088 : lc_c088;
|
2013-06-11 07:08:15 +00:00
|
|
|
cpu65_vmem[0xC089].r = cpu65_vmem[0xC089].w =
|
2013-07-06 04:37:13 +00:00
|
|
|
cpu65_vmem[0xC08D].r = cpu65_vmem[0xC08D].w =
|
|
|
|
(apple_mode == IIE_MODE) ? iie_c089 : lc_c089;
|
2013-06-11 07:08:15 +00:00
|
|
|
cpu65_vmem[0xC08A].r = cpu65_vmem[0xC08A].w =
|
2013-07-06 04:37:13 +00:00
|
|
|
cpu65_vmem[0xC08E].r = cpu65_vmem[0xC08E].w =
|
|
|
|
lc_c08a;
|
2013-06-11 07:08:15 +00:00
|
|
|
cpu65_vmem[0xC08B].r = cpu65_vmem[0xC08B].w =
|
2013-07-06 04:37:13 +00:00
|
|
|
cpu65_vmem[0xC08F].r = cpu65_vmem[0xC08F].w =
|
|
|
|
(apple_mode == IIE_MODE) ? iie_c08b : lc_c08b;
|
2013-06-11 07:08:15 +00:00
|
|
|
|
|
|
|
/* slot i/o area */
|
2013-07-06 04:37:13 +00:00
|
|
|
for (i = 0xC100; i < 0xC300; i++)
|
|
|
|
{
|
|
|
|
cpu65_vmem[i].r =
|
|
|
|
iie_read_slotx; /* slots 1 & 2 (x) */
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
2013-07-06 04:37:13 +00:00
|
|
|
|
|
|
|
for (i = 0xC300; i < 0xC400; i++)
|
|
|
|
{
|
|
|
|
cpu65_vmem[i].r =
|
|
|
|
iie_read_slot3; /* slot 3 (80col) */
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
2013-07-06 04:37:13 +00:00
|
|
|
|
2013-11-23 07:40:24 +00:00
|
|
|
for (i = 0xC400; i < 0xC500; i++)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
|
|
|
cpu65_vmem[i].r =
|
2013-11-23 07:40:24 +00:00
|
|
|
iie_read_slot4; /* slot 4 - MB or Phasor */
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0xC500; i < 0xC600; i++)
|
|
|
|
{
|
|
|
|
cpu65_vmem[i].r =
|
|
|
|
iie_read_slot5; /* slot 5 - MB #2 */
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0xC600; i < 0xC800; i++)
|
|
|
|
{
|
|
|
|
cpu65_vmem[i].r =
|
|
|
|
iie_read_slotx; /* slots 6 - 7 (x) */
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
2013-07-06 04:37:13 +00:00
|
|
|
|
|
|
|
for (i = 0xC800; i < 0xD000; i++)
|
|
|
|
{
|
|
|
|
cpu65_vmem[i].r =
|
|
|
|
iie_read_slot_expansion; /* expansion rom */
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
2013-07-06 04:37:13 +00:00
|
|
|
|
2013-06-11 07:08:15 +00:00
|
|
|
cpu65_vmem[0xCFFF].r =
|
2013-07-06 04:37:13 +00:00
|
|
|
cpu65_vmem[0xCFFF].w =
|
|
|
|
iie_disable_slot_expansion;
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2013-07-06 04:46:58 +00:00
|
|
|
video_set(0);
|
2013-06-19 07:07:41 +00:00
|
|
|
|
2013-11-06 06:11:27 +00:00
|
|
|
// Peripheral card slot initializations ...
|
|
|
|
|
|
|
|
// HACK TODO FIXME : this needs to be tied to the UI/configuration system (once we have more/conflicting options)
|
|
|
|
|
2014-01-23 04:42:34 +00:00
|
|
|
#ifdef AUDIO_ENABLED
|
2013-11-06 06:11:27 +00:00
|
|
|
mb_io_initialize(4, 5); /* Mockingboard(s) and/or Phasor in slots 4 & 5 */
|
2014-01-23 04:42:34 +00:00
|
|
|
#endif
|
2013-11-06 06:11:27 +00:00
|
|
|
disk_io_initialize(6); /* Put a Disk ][ Controller in slot 6 */
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------------
|
|
|
|
c_initialize_apple_ii_memory()
|
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
void c_initialize_apple_ii_memory()
|
|
|
|
{
|
2013-07-06 04:37:13 +00:00
|
|
|
FILE *f;
|
|
|
|
int i;
|
|
|
|
static int ii_rom_loaded = 0;
|
|
|
|
static int iie_rom_loaded = 0;
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2013-07-06 04:37:13 +00:00
|
|
|
for (i = 0; i < 0x10000; i++)
|
|
|
|
{
|
|
|
|
apple_ii_64k[0][i] = 0;
|
|
|
|
apple_ii_64k[1][i] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < 8192; i++)
|
|
|
|
{
|
|
|
|
language_card[0][i] = language_card[1][i] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < 8192; i++)
|
|
|
|
{
|
|
|
|
language_banks[0][i] = language_banks[1][i] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!ii_rom_loaded)
|
|
|
|
{
|
|
|
|
snprintf(temp, TEMPSIZE, "%s/apple_II.rom", system_path);
|
2014-01-25 22:13:38 +00:00
|
|
|
if ((f = fopen(temp, "r")) == NULL) {
|
2013-07-06 04:37:13 +00:00
|
|
|
printf("OOPS!\n");
|
|
|
|
printf("Cannot find file '%s'.\n",temp);
|
2014-01-25 22:13:38 +00:00
|
|
|
//exit(0);
|
|
|
|
} else {
|
|
|
|
if (fread(apple_ii_rom, 0x3000, 1, f) != 0x3000)
|
|
|
|
{
|
|
|
|
// ERROR ...
|
|
|
|
}
|
|
|
|
fclose(f);
|
2013-07-06 04:37:13 +00:00
|
|
|
}
|
|
|
|
ii_rom_loaded = 1;
|
|
|
|
}
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2013-07-06 04:37:13 +00:00
|
|
|
if (!iie_rom_loaded)
|
|
|
|
{
|
|
|
|
snprintf(temp, TEMPSIZE, "%s/apple_IIe.rom", system_path);
|
|
|
|
if ((f = fopen(temp, "r")) == NULL)
|
|
|
|
{
|
|
|
|
printf("Cannot find file '%s'.\n",temp);
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fread(apple_iie_rom, 32768, 1, f) != 32768)
|
|
|
|
{
|
|
|
|
// ERROR ...
|
|
|
|
}
|
|
|
|
|
|
|
|
fclose(f);
|
|
|
|
iie_rom_loaded = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0xD000; i < 0x10000; i++)
|
|
|
|
{
|
|
|
|
apple_ii_64k[0][i] = apple_ii_rom[i - 0xD000];
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < 0x1000; i++)
|
|
|
|
{
|
|
|
|
language_banks[0][i] = apple_ii_rom[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < 0x2000; i++)
|
|
|
|
{
|
|
|
|
language_card[0][i] = apple_ii_rom[i + 0x1000];
|
|
|
|
}
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2013-07-06 04:37:13 +00:00
|
|
|
if (apple_mode == IIE_MODE)
|
|
|
|
{
|
|
|
|
/* load the rom from 0xC000, slot rom main, internal rom aux */
|
|
|
|
for (i = 0xC000; i < 0x10000; i++)
|
|
|
|
{
|
|
|
|
apple_ii_64k[0][i] = apple_iie_rom[i - 0xC000];
|
|
|
|
apple_ii_64k[1][i] = apple_iie_rom[i - 0x8000];
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < 0x1000; i++)
|
|
|
|
{
|
|
|
|
language_banks[0][i] = apple_iie_rom[i + 0x1000];
|
|
|
|
language_banks[1][i] = apple_iie_rom[i + 0x5000];
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < 0x2000; i++)
|
|
|
|
{
|
|
|
|
language_card[0][i] = apple_iie_rom[i + 0x2000];
|
|
|
|
language_card[1][i] = apple_iie_rom[i + 0x6000];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
/* softswitch memory HACK - why this? */
|
|
|
|
{
|
|
|
|
for (i = 0xC100; i < 0xD000; i++)
|
|
|
|
{
|
|
|
|
apple_ii_64k[0][i] = i & 0xFF;
|
|
|
|
apple_ii_64k[1][i] = i & 0xFF;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
apple_ii_64k[0][0xC000] = 0x00;
|
|
|
|
apple_ii_64k[1][0xC000] = 0x00;
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------------
|
2013-10-06 08:31:58 +00:00
|
|
|
void c_initialize_sound_hooks()
|
2013-06-11 07:08:15 +00:00
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
|
2013-10-06 08:31:58 +00:00
|
|
|
void c_initialize_sound_hooks()
|
2013-06-11 07:08:15 +00:00
|
|
|
{
|
2014-01-23 04:42:34 +00:00
|
|
|
#ifdef AUDIO_ENABLED
|
2013-12-07 06:55:00 +00:00
|
|
|
SpkrSetVolume(sound_volume * (SPKR_DATA_INIT/10));
|
2014-01-23 04:42:34 +00:00
|
|
|
#endif
|
2013-10-06 08:31:58 +00:00
|
|
|
for (int i = 0xC030; i < 0xC040; i++)
|
|
|
|
{
|
2014-01-23 04:42:34 +00:00
|
|
|
cpu65_vmem[i].r = cpu65_vmem[i].w =
|
|
|
|
#ifdef AUDIO_ENABLED
|
|
|
|
(sound_volume > 0) ? read_speaker_toggle_pc :
|
|
|
|
#endif
|
|
|
|
ram_nop;
|
2013-10-06 08:31:58 +00:00
|
|
|
}
|
|
|
|
}
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2013-10-06 08:31:58 +00:00
|
|
|
void c_disable_sound_hooks()
|
|
|
|
{
|
|
|
|
for (int i = 0xC030; i < 0xC040; i++)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
2013-10-06 08:31:58 +00:00
|
|
|
cpu65_vmem[i].r = ram_nop;
|
2013-07-06 04:37:13 +00:00
|
|
|
}
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------------
|
|
|
|
c_initialize_iie_switches
|
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
void c_initialize_iie_switches() {
|
|
|
|
|
|
|
|
base_stackzp = apple_ii_64k[0];
|
|
|
|
base_d000_rd = apple_ii_64k[0];
|
|
|
|
base_d000_wrt = language_banks[0] - 0xD000;
|
|
|
|
base_e000_rd = apple_ii_64k[0];
|
|
|
|
base_e000_wrt = language_card[0] - 0xE000;
|
|
|
|
|
|
|
|
base_ramrd = apple_ii_64k[0];
|
|
|
|
base_ramwrt = apple_ii_64k[0];
|
|
|
|
base_textrd = apple_ii_64k[0];
|
|
|
|
base_textwrt = apple_ii_64k[0];
|
|
|
|
base_hgrrd = apple_ii_64k[0];
|
|
|
|
base_hgrwrt= apple_ii_64k[0];
|
|
|
|
|
2013-07-06 04:37:13 +00:00
|
|
|
base_c3rom = apple_ii_64k[1]; /* c3rom internal */
|
2013-11-23 07:40:24 +00:00
|
|
|
base_c4rom = apple_ii_64k[1]; /* c4rom internal */
|
|
|
|
base_c5rom = apple_ii_64k[1]; /* c5rom internal */
|
2013-07-06 04:37:13 +00:00
|
|
|
c8rom_offset = 0x10000; /* c8rom internal */
|
|
|
|
base_cxrom = apple_ii_64k[0]; /* cxrom peripheral */
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------------
|
|
|
|
void c_initialize_vm()
|
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
void c_initialize_vm() {
|
2013-07-06 04:37:13 +00:00
|
|
|
c_initialize_font(); /* font already read in */
|
|
|
|
c_initialize_apple_ii_memory(); /* read in rom memory */
|
|
|
|
c_initialize_tables(); /* read/write memory jump tables */
|
2013-10-06 08:31:58 +00:00
|
|
|
c_initialize_sound_hooks(); /* sound system */
|
2013-07-06 04:37:13 +00:00
|
|
|
c_init_6(); /* drive ][, slot 6 */
|
|
|
|
c_initialize_iie_switches(); /* set the //e softswitches */
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------------
|
|
|
|
void c_initialize_firsttime()
|
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
|
2013-10-06 08:31:58 +00:00
|
|
|
void reinitialize(void)
|
2013-06-11 07:08:15 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2013-07-06 04:37:13 +00:00
|
|
|
c_initialize_vm();
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2013-07-06 04:37:13 +00:00
|
|
|
softswitches = SS_TEXT | SS_IOUDIS | SS_C3ROM | SS_LCWRT | SS_LCSEC;
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2013-07-06 04:37:13 +00:00
|
|
|
video_setpage( 0 );
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2013-07-06 04:37:13 +00:00
|
|
|
video_redraw();
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2013-07-06 04:37:13 +00:00
|
|
|
if (apple_mode == IIE_MODE)
|
|
|
|
{
|
|
|
|
cpu65_set(CPU65_C02);
|
|
|
|
}
|
2013-07-07 20:16:08 +00:00
|
|
|
else if (apple_mode == IIU_MODE)
|
2013-07-06 04:37:13 +00:00
|
|
|
{
|
|
|
|
cpu65_set(CPU65_NMOS);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cpu65_set(CPU65_NMOS|CPU65_FAULT);
|
|
|
|
}
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2013-10-06 08:31:58 +00:00
|
|
|
timing_initialize();
|
2013-11-24 00:00:07 +00:00
|
|
|
|
2014-01-23 04:42:34 +00:00
|
|
|
#ifdef AUDIO_ENABLED
|
2013-11-24 00:00:07 +00:00
|
|
|
MB_Reset();
|
2014-01-23 04:42:34 +00:00
|
|
|
#endif
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
|
|
|
|
2014-01-25 22:13:38 +00:00
|
|
|
void c_initialize_firsttime()
|
2013-06-11 07:08:15 +00:00
|
|
|
{
|
2014-03-23 21:25:28 +00:00
|
|
|
#ifdef INTERFACE_CLASSIC
|
2013-06-11 07:08:15 +00:00
|
|
|
/* read in system files and calculate system defaults */
|
|
|
|
c_load_interface_font();
|
2014-03-23 21:25:28 +00:00
|
|
|
#endif
|
2013-06-11 07:08:15 +00:00
|
|
|
|
|
|
|
/* initialize the video system */
|
|
|
|
video_init();
|
|
|
|
|
2013-10-06 08:31:58 +00:00
|
|
|
// TODO FIXME : sound system never released ...
|
2014-01-23 04:42:34 +00:00
|
|
|
#ifdef AUDIO_ENABLED
|
2013-10-06 08:31:58 +00:00
|
|
|
DSInit();
|
|
|
|
SpkrInitialize();
|
2013-11-06 06:11:27 +00:00
|
|
|
MB_Initialize();
|
2014-01-23 04:42:34 +00:00
|
|
|
#endif
|
2013-10-06 08:31:58 +00:00
|
|
|
|
2014-03-30 17:53:57 +00:00
|
|
|
#ifdef DEBUGGER
|
|
|
|
c_debugger_init();
|
|
|
|
#endif
|
|
|
|
|
2013-07-06 04:37:13 +00:00
|
|
|
reinitialize();
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
|
|
|
|
2013-12-21 21:55:40 +00:00
|
|
|
// Read Game Controller (paddle) strobe ...
|
|
|
|
// From _Understanding the Apple IIe_ :
|
|
|
|
// * 7-29, discussing PREAD : "The timer duration will vary between 2 and 3302 usecs"
|
|
|
|
// * 7-30, timer reset : "But the timer pulse may still be high from the previous [strobe access] and the timers are
|
|
|
|
// not retriggered by C07X' if they have not yet reset from the previous trigger"
|
|
|
|
#define JOY_STEP_USEC (3300.0 / 256.0)
|
|
|
|
#define CYCLES_PER_USEC (CLK_6502 / 1000000)
|
|
|
|
#define JOY_STEP_CYCLES (JOY_STEP_USEC / CYCLES_PER_USEC)
|
|
|
|
extern short joy_x;
|
|
|
|
extern short joy_y;
|
|
|
|
GLUE_C_READ(read_gc_strobe)
|
|
|
|
{
|
|
|
|
if (gc_cycles_timer_0 <= 0)
|
|
|
|
{
|
|
|
|
gc_cycles_timer_0 = (int)(joy_x * JOY_STEP_CYCLES) + 2;
|
|
|
|
}
|
|
|
|
if (gc_cycles_timer_1 <= 0)
|
|
|
|
{
|
|
|
|
gc_cycles_timer_1 = (int)(joy_y * JOY_STEP_CYCLES) + 2;
|
|
|
|
}
|
|
|
|
// NOTE: unimplemented GC2 and GC3 timers since they were not wired on the //e ...
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
GLUE_C_READ(read_gc0)
|
|
|
|
{
|
|
|
|
if (gc_cycles_timer_0 <= 0)
|
|
|
|
{
|
|
|
|
gc_cycles_timer_0 = 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return 0xFF;
|
|
|
|
}
|
|
|
|
|
|
|
|
GLUE_C_READ(read_gc1)
|
|
|
|
{
|
|
|
|
if (gc_cycles_timer_1 <= 0)
|
|
|
|
{
|
|
|
|
gc_cycles_timer_1 = 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return 0xFF;
|
|
|
|
}
|
|
|
|
|
2013-11-06 06:11:27 +00:00
|
|
|
// HACK FIXME TODO : candidate for GLUE_C_READ(...)
|
2013-06-11 07:08:15 +00:00
|
|
|
void c_read_random() {
|
2014-01-23 04:42:34 +00:00
|
|
|
static time_t seed=0;
|
2013-07-07 20:07:26 +00:00
|
|
|
if (!seed) {
|
|
|
|
seed = time(NULL);
|
2014-01-23 04:42:34 +00:00
|
|
|
srandom(seed);
|
2013-07-07 20:07:26 +00:00
|
|
|
}
|
2014-01-23 04:42:34 +00:00
|
|
|
random_value = (unsigned char)random();
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
|
|
|
|
2014-01-25 22:13:38 +00:00
|
|
|
#if !defined(TESTING)
|
2013-07-06 04:37:13 +00:00
|
|
|
static void main_thread(void *dummyptr) {
|
2013-10-06 08:31:58 +00:00
|
|
|
struct timespec sleeptime = { .tv_sec=0, .tv_nsec=8333333 }; // 120Hz
|
2013-12-15 22:59:18 +00:00
|
|
|
|
|
|
|
c_keys_set_key(kF8); // show credits
|
2013-07-06 04:37:13 +00:00
|
|
|
do
|
|
|
|
{
|
2013-12-28 21:08:35 +00:00
|
|
|
video_sync(0);
|
2013-12-15 22:59:18 +00:00
|
|
|
nanosleep(&sleeptime, NULL);
|
2013-07-02 08:10:57 +00:00
|
|
|
} while (1);
|
|
|
|
}
|
|
|
|
|
2013-10-06 08:31:58 +00:00
|
|
|
extern void cpu_thread(void *dummyptr);
|
|
|
|
|
2013-06-11 07:08:15 +00:00
|
|
|
int main(int sargc, char *sargv[])
|
|
|
|
{
|
|
|
|
argc = sargc;
|
|
|
|
argv = sargv;
|
|
|
|
|
2013-07-06 04:37:13 +00:00
|
|
|
load_settings(); /* user prefs */
|
|
|
|
c_initialize_firsttime(); /* init svga graphics and vm */
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2013-07-02 08:10:57 +00:00
|
|
|
// spin off cpu thread
|
|
|
|
pthread_t thread1;
|
|
|
|
pthread_create(&thread1, NULL, (void *) &cpu_thread, (void *)NULL);
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2013-10-06 08:31:58 +00:00
|
|
|
// continue with main render thread
|
2013-07-02 08:10:57 +00:00
|
|
|
main_thread(NULL);
|
2013-06-11 07:08:15 +00:00
|
|
|
}
|
2014-01-25 22:13:38 +00:00
|
|
|
#endif // TESTING
|
|
|
|
|