--- xmil/pccore.c 2004/08/05 11:30:12 1.9 +++ xmil/pccore.c 2004/08/08 17:45:52 1.17 @@ -4,43 +4,42 @@ #include "soundmng.h" #include "sysmng.h" #include "timemng.h" +#include "xmilver.h" #include "z80core.h" #include "pccore.h" #include "iocore.h" -#include "draw.h" +#include "timing.h" +#include "calendar.h" +#include "keystat.h" +#include "palettes.h" +#include "makescrn.h" #include "sound.h" #include "sndctrl.h" -#include "menu.h" #include "font.h" -#include "xmilver.h" #include "fddfile.h" -#include "calendar.h" -#include "timing.h" #include "defrom.res" -#include "keystat.h" const OEMCHAR xmilversion[] = OEMTEXT(XMILVER_CORE); - XMILCFG xmilcfg = { 0, 0, 1, 0, 1, 2, 0, 1, - 22050, 1000, 0, 80, - 0, 0, - 0, 0, - 0, 0, 0, - 1, - 1, 0}; + XMILCFG xmilcfg = { 2, 0, 1, + 1, 0, 0, 0, + 22050, 500, 0, 0, 80, + 0, 0, 0, 0}; PCCORE pccore = {250, 0, 1, 0}; + CORESTAT corestat; BYTE mMAIN[0x10000]; BYTE mBIOS[0x8000]; - BYTE mBANK[16][0x8000]; - WORD v_cnt; - int s_cnt; +#if defined(SUPPORT_EMS) + UINT8 mBANK[16][0x8000]; +#endif + UINT v_cnt; + UINT s_cnt; BYTE *RAM0r; BYTE *RAM0w; DWORD h_cntbase; - BRESULT soundrenewal; @@ -48,7 +47,7 @@ const OEMCHAR xmilversion[] = OEMTEXT(XM IPL-ROM LOAD ***********************************************************************/ -void ipl_load(void) { +static void ipl_load(void) { FILEH hdl; @@ -74,7 +73,7 @@ void ipl_load(void) { ½é´ü²½ ***********************************************************************/ -BYTE reset_x1(BYTE ROM_TYPE, BYTE SOUND_SW, BYTE DIP_SW) { +static BRESULT reset_x1(BYTE ROM_TYPE, BYTE SOUND_SW, BYTE DIP_SW) { pccore.HSYNC_CLK = 250; pccore.ROM_TYPE = ROM_TYPE; @@ -91,7 +90,6 @@ BYTE reset_x1(BYTE ROM_TYPE, BYTE SOUND_ scrnmng_setcolormode(FALSE); } - textdrawproc_renewal(); ipl_load(); Z80_RESET(); @@ -118,6 +116,8 @@ BYTE reset_x1(BYTE ROM_TYPE, BYTE SOUND_ subcpu_reset(); vramio_reset(); + pal_reset(); + makescrn_reset(); timing_reset(); return(SUCCESS); } @@ -133,28 +133,25 @@ static BYTE keyintcnt = 0; void pccore_initialize(void) { sndctrl_initialize(); + makescrn_initialize(); - init_draw(); font_load(NULL, TRUE); crtc_initialize(); pcg_initialize(); ppi_initialize(); - - reset_x1(xmilcfg.ROM_TYPE, xmilcfg.SOUND_SW, xmilcfg.DIP_SW); - -// keystat_initialize(); -// keystat_reset(); } void pccore_reset(void) { soundmng_stop(); - if (soundrenewal) { - soundrenewal = 0; + if (corestat.soundrenewal) { + corestat.soundrenewal = 0; sndctrl_deinitialize(); sndctrl_initialize(); } + sound_reset(); + reset_x1(xmilcfg.ROM_TYPE, xmilcfg.SOUND_SW, xmilcfg.DIP_SW); soundmng_play(); } @@ -205,20 +202,20 @@ void iptrace_out(void) { } #endif - - -void x1r_exec(void) { +void pccore_exec(BRESULT draw) { REG8 inttiming; + corestat.drawframe = draw; + soundmng_sync(); + v_cnt = 0; s_cnt = 0; - xmilcfg.DISPSYNC &= 1; inttiming = xmilcfg.CPU8MHz & 1; while(s_cnt < 266) { while(h_cnt < pccore.HSYNC_CLK) { -#if IPTRACE +#if defined(TRACE) && IPTRACE treip[trpos & (IPTRACE - 1)] = Z80_PC; trpos++; #endif @@ -229,10 +226,10 @@ void x1r_exec(void) { h_cntbase += pccore.HSYNC_CLK; inttiming ^= 2; if (inttiming != 3) { - if (xmilcfg.SOUNDPLY) { - sound_makesample(pcmbufsize[s_cnt]); + sound_makesample(pcmbufsize[s_cnt]); +// if (xmilcfg.SOUNDPLY) { // juliet2_exec(); - } +// } s_cnt++; x1_ctc_int(); if (!((++keyintcnt) & 15)) { @@ -244,20 +241,14 @@ void x1r_exec(void) { } v_cnt++; if (crtc.s.CRT_YL == v_cnt) { -// TRACEOUT(("--->sync")); pcg.r.vsync = 1; - if (xmilcfg.DISPSYNC == 1) { - xmilcfg.DISPSYNC |= 0x80; + if (xmilcfg.DISPSYNC & 1) { scrnupdate(); } } } + scrnupdate(); calendar_inc(); - if (!xmilcfg.SOUNDPLY) { - sound_makesample(framesoundcnt); - } - if (!(xmilcfg.DISPSYNC & 0x80)) { - scrnupdate(); - } + sound_sync(); }