--- xmil/pccore.c 2004/08/05 04:53:15 1.8 +++ xmil/pccore.c 2004/08/07 07:19:56 1.12 @@ -7,12 +7,10 @@ #include "z80core.h" #include "pccore.h" #include "iocore.h" -#include "draw.h" +#include "makescrn.h" #include "sound.h" #include "sndctrl.h" -#include "menu.h" #include "font.h" -#include "juliet.h" #include "xmilver.h" #include "fddfile.h" #include "calendar.h" @@ -23,15 +21,16 @@ const OEMCHAR xmilversion[] = OEMTEXT(XMILVER_CORE); - XMILCFG xmilcfg = { 0, 0, 1, 0, 1, 2, 0, 1, + XMILCFG xmilcfg = { 0, 0, 1, + 2, 0, 1, 22050, 1000, 0, 80, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 0}; PCCORE pccore = {250, 0, 1, 0}; + CORESTAT corestat; BYTE mMAIN[0x10000]; BYTE mBIOS[0x8000]; BYTE mBANK[16][0x8000]; @@ -41,7 +40,6 @@ const OEMCHAR xmilversion[] = OEMTEXT(XM BYTE *RAM0r; BYTE *RAM0w; DWORD h_cntbase; - BRESULT soundrenewal; @@ -92,7 +90,6 @@ BYTE reset_x1(BYTE ROM_TYPE, BYTE SOUND_ scrnmng_setcolormode(FALSE); } - textdrawproc_renewal(); ipl_load(); Z80_RESET(); @@ -130,8 +127,6 @@ BYTE reset_x1(BYTE ROM_TYPE, BYTE SOUND_ ***********************************************************************/ static BYTE keyintcnt = 0; -static BYTE flame = 0; -static BYTE inttiming = 0; void pccore_initialize(void) { @@ -153,11 +148,13 @@ void pccore_initialize(void) { 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(); } @@ -208,29 +205,18 @@ void iptrace_out(void) { } #endif +void pccore_exec(BRESULT draw) { + REG8 inttiming; -void x1r_exec(void) { - -extern BYTE disp_flashscreen; + corestat.drawframe = draw; v_cnt = 0; s_cnt = 0; - xmilcfg.DISPSYNC &= 1; inttiming = xmilcfg.CPU8MHz & 1; -// TRACEOUT(("*sync")); while(s_cnt < 266) { while(h_cnt < pccore.HSYNC_CLK) { -#if defined(TRACE) -// TRACEOUT(("%.4x", Z80_PC)); -// if (Z80_PC == 0x8198) { -// TRACEOUT(("---->sound")); -// } -// if (Z80_PC == 0x8188) { -// TRACEOUT(("-- poll sound")); -// } -#endif #if IPTRACE treip[trpos & (IPTRACE - 1)] = Z80_PC; trpos++; @@ -242,10 +228,10 @@ extern BYTE disp_flashscreen; h_cntbase += pccore.HSYNC_CLK; inttiming ^= 2; if (inttiming != 3) { - if (xmilcfg.SOUNDPLY) { - sound_makesample(pcmbufsize[s_cnt]); - juliet2_exec(); - } + sound_makesample(pcmbufsize[s_cnt]); +// if (xmilcfg.SOUNDPLY) { +// juliet2_exec(); +// } s_cnt++; x1_ctc_int(); if (!((++keyintcnt) & 15)) { @@ -257,23 +243,14 @@ extern BYTE disp_flashscreen; } 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(); } } } - if (++flame >= 60) { - flame = 0; - calendar_inc(); - } - if (!xmilcfg.SOUNDPLY) { - sound_makesample(framesoundcnt); - } - if (!(xmilcfg.DISPSYNC & 0x80)) { - scrnupdate(); - } + sound_sync(); + calendar_inc(); + scrnupdate(); }