|
|
| version 1.10, 2004/08/05 11:46:26 | version 1.20, 2004/08/11 12:08:16 |
|---|---|
| Line 4 | Line 4 |
| #include "soundmng.h" | #include "soundmng.h" |
| #include "sysmng.h" | #include "sysmng.h" |
| #include "timemng.h" | #include "timemng.h" |
| #include "xmilver.h" | |
| #include "z80core.h" | #include "z80core.h" |
| #include "pccore.h" | #include "pccore.h" |
| #include "iocore.h" | #include "iocore.h" |
| #include "draw.h" | #include "nevent.h" |
| #include "ievent.h" | |
| #include "timing.h" | |
| #include "calendar.h" | |
| #include "keystat.h" | |
| #include "palettes.h" | |
| #include "makescrn.h" | |
| #include "sound.h" | #include "sound.h" |
| #include "sndctrl.h" | #include "sndctrl.h" |
| #include "menu.h" | |
| #include "font.h" | #include "font.h" |
| #include "xmilver.h" | |
| #include "fddfile.h" | #include "fddfile.h" |
| #include "calendar.h" | |
| #include "timing.h" | |
| #include "defrom.res" | #include "defrom.res" |
| #include "keystat.h" | |
| const OEMCHAR xmilversion[] = OEMTEXT(XMILVER_CORE); | const OEMCHAR xmilversion[] = OEMTEXT(XMILVER_CORE); |
| XMILCFG xmilcfg = { 0, 0, 1, 0, 1, 2, 0, 1, | XMILCFG xmilcfg = { 2, 0, 1, |
| 22050, 1000, 0, 80, | 1, 0, 0, 0, |
| 0, 0, | 22050, 500, 0, 0, 80, |
| 0, 0, | 0, 0, 0, 0}; |
| 0, 0, 0, | |
| 1, | |
| 1, 0}; | |
| PCCORE pccore = {250, 0, 1, 0}; | PCCORE pccore; |
| CORESTAT corestat; | |
| BYTE mMAIN[0x10000]; | BYTE mMAIN[0x10000]; |
| BYTE mBIOS[0x8000]; | BYTE mBIOS[0x8000]; |
| BYTE mBANK[16][0x8000]; | #if defined(SUPPORT_BANKMEM) |
| WORD v_cnt; | UINT8 mBANK[16][0x8000]; |
| int s_cnt; | #endif |
| BYTE *RAM0r; | BYTE *RAM0r; |
| BYTE *RAM0w; | BYTE *RAM0w; |
| DWORD h_cntbase; | |
| BRESULT soundrenewal; | |
| /*********************************************************************** | /*********************************************************************** |
| IPL-ROM LOAD | IPL-ROM LOAD |
| ***********************************************************************/ | ***********************************************************************/ |
| void ipl_load(void) { | static void ipl_load(void) { |
| FILEH hdl; | FILEH hdl; |
| Line 74 void ipl_load(void) { | Line 70 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.baseclock = 2000000; | |
| pccore.multiple = 2; | |
| pccore.realclock = pccore.baseclock * pccore.multiple; | |
| pccore.HSYNC_CLK = 250; | pccore.HSYNC_CLK = 250; |
| pccore.ROM_TYPE = ROM_TYPE; | pccore.ROM_TYPE = ROM_TYPE; |
| pccore.SOUND_SW = SOUND_SW; | pccore.SOUND_SW = SOUND_SW; |
| Line 90 BYTE reset_x1(BYTE ROM_TYPE, BYTE SOUND_ | Line 89 BYTE reset_x1(BYTE ROM_TYPE, BYTE SOUND_ |
| else { | else { |
| scrnmng_setcolormode(FALSE); | scrnmng_setcolormode(FALSE); |
| } | } |
| sound_changeclock(); | |
| textdrawproc_renewal(); | |
| ipl_load(); | ipl_load(); |
| Z80_RESET(); | Z80_RESET(); |
| Line 99 BYTE reset_x1(BYTE ROM_TYPE, BYTE SOUND_ | Line 98 BYTE reset_x1(BYTE ROM_TYPE, BYTE SOUND_ |
| RAM0r = mBIOS; | RAM0r = mBIOS; |
| RAM0w = mMAIN; | RAM0w = mMAIN; |
| h_cntbase = 0; | |
| sysmng_cpureset(); | sysmng_cpureset(); |
| calendar_initialize(); | calendar_initialize(); |
| Line 118 BYTE reset_x1(BYTE ROM_TYPE, BYTE SOUND_ | Line 116 BYTE reset_x1(BYTE ROM_TYPE, BYTE SOUND_ |
| subcpu_reset(); | subcpu_reset(); |
| vramio_reset(); | vramio_reset(); |
| pal_reset(); | |
| makescrn_reset(); | |
| timing_reset(); | timing_reset(); |
| return(SUCCESS); | return(SUCCESS); |
| } | } |
| Line 128 BYTE reset_x1(BYTE ROM_TYPE, BYTE SOUND_ | Line 128 BYTE reset_x1(BYTE ROM_TYPE, BYTE SOUND_ |
| 実行/終了 | 実行/終了 |
| ***********************************************************************/ | ***********************************************************************/ |
| static BYTE keyintcnt = 0; | |
| void pccore_initialize(void) { | void pccore_initialize(void) { |
| fddfile_initialize(); | |
| sndctrl_initialize(); | sndctrl_initialize(); |
| makescrn_initialize(); | |
| init_draw(); | |
| font_load(NULL, TRUE); | font_load(NULL, TRUE); |
| crtc_initialize(); | crtc_initialize(); |
| pcg_initialize(); | pcg_initialize(); |
| ppi_initialize(); | ppi_initialize(); |
| reset_x1(xmilcfg.ROM_TYPE, xmilcfg.SOUND_SW, xmilcfg.DIP_SW); | |
| // keystat_initialize(); | |
| // keystat_reset(); | |
| } | } |
| void pccore_reset(void) { | void pccore_reset(void) { |
| soundmng_stop(); | soundmng_stop(); |
| if (soundrenewal) { | if (corestat.soundrenewal) { |
| soundrenewal = 0; | corestat.soundrenewal = 0; |
| sndctrl_deinitialize(); | sndctrl_deinitialize(); |
| sndctrl_initialize(); | sndctrl_initialize(); |
| } | } |
| sound_reset(); | sound_reset(); |
| nevent_allreset(); | |
| ievent_reset(); | |
| reset_x1(xmilcfg.ROM_TYPE, xmilcfg.SOUND_SW, xmilcfg.DIP_SW); | reset_x1(xmilcfg.ROM_TYPE, xmilcfg.SOUND_SW, xmilcfg.DIP_SW); |
| soundmng_play(); | soundmng_play(); |
| } | } |
| Line 167 void pccore_deinitialize(void) { | Line 163 void pccore_deinitialize(void) { |
| // keyboard_term(); | // keyboard_term(); |
| fdd_eject(0); | fddfile_eject(0); |
| fdd_eject(1); | fddfile_eject(1); |
| fdd_eject(2); | fddfile_eject(2); |
| fdd_eject(3); | fddfile_eject(3); |
| } | } |
| Line 208 void iptrace_out(void) { | Line 204 void iptrace_out(void) { |
| #endif | #endif |
| #if 0 | |
| void nvitem_raster(UINT id) { | |
| void x1r_exec(void) { | nevent_repeat(id); |
| sound_makesample(pcmbufsize[v_cnt]); | |
| // x1_ctc_int(); | |
| if (!((++keyintcnt) & 15)) { | |
| x1_sub_int(); | |
| if (xmilcfg.MOUSE_SW) { | |
| sio_int(); | |
| } | |
| } | |
| v_cnt++; | |
| if (crtc.s.CRT_YL == v_cnt) { | |
| pcg.r.vsync = 1; | |
| if (xmilcfg.DISPSYNC & 1) { | |
| scrnupdate(); | |
| } | |
| } | |
| } | |
| #endif | |
| UINT pccore_getraster(UINT *h) { | |
| SINT32 work; | |
| UINT vl; | |
| REG8 inttiming; | work = nevent_getwork(NEVENT_FRAMES); |
| vl = work / 250; | |
| if (h) { | |
| *h = work - (vl * 250); | |
| } | |
| if (corestat.vsync) { | |
| vl += corestat.vl; | |
| } | |
| return(vl); | |
| } | |
| v_cnt = 0; | void nvitem_vdisp(UINT id) { |
| s_cnt = 0; | |
| xmilcfg.DISPSYNC &= 1; | corestat.vsync = 1; |
| inttiming = xmilcfg.CPU8MHz & 1; | pcg.r.vsync = 1; |
| if (xmilcfg.DISPSYNC & 1) { | |
| while(s_cnt < 266) { | scrnupdate(); |
| while(h_cnt < pccore.HSYNC_CLK) { | } |
| #if IPTRACE | nevent_set(NEVENT_FRAMES, (corestat.tl - corestat.vl) * 250, |
| nvitem_vsync, NEVENT_RELATIVE); | |
| } | |
| void nvitem_vsync(UINT id) { | |
| corestat.vsync = 2; | |
| } | |
| // #define SINGLESTEPONLY | |
| void pccore_exec(BRESULT draw) { | |
| corestat.drawframe = draw; | |
| soundmng_sync(); | |
| corestat.tl = 266 * pccore.multiple / 2; | |
| corestat.vl = min(corestat.tl, crtc.s.CRT_YL); | |
| corestat.vsync = 0; | |
| nevent_set(NEVENT_FRAMES, corestat.vl * 250, | |
| nvitem_vdisp, NEVENT_RELATIVE); | |
| do { | |
| #if !defined(SINGLESTEPONLY) | |
| if (CPU_REMCLOCK > 0) { | |
| Z80_EXECUTE(); | |
| } | |
| #else | |
| while(CPU_REMCLOCK > 0) { | |
| TRACEOUT(("%.4x", Z80_PC)); | |
| #if defined(TRACE) && IPTRACE | |
| treip[trpos & (IPTRACE - 1)] = Z80_PC; | treip[trpos & (IPTRACE - 1)] = Z80_PC; |
| trpos++; | trpos++; |
| #endif | #endif |
| Z80_EXECUTE(); | Z80_STEP(); |
| z80dmap(); | |
| } | } |
| h_cnt -= pccore.HSYNC_CLK; | #endif |
| h_cntbase += pccore.HSYNC_CLK; | nevent_progress(); |
| inttiming ^= 2; | ievent_progress(); |
| if (inttiming != 3) { | } while(corestat.vsync < 2); |
| sound_makesample(pcmbufsize[s_cnt]); | |
| // if (xmilcfg.SOUNDPLY) { | scrnupdate(); |
| // juliet2_exec(); | |
| // } | |
| s_cnt++; | |
| x1_ctc_int(); | |
| if (!((++keyintcnt) & 15)) { | |
| x1_sub_int(); | |
| if (xmilcfg.MOUSE_SW) { | |
| sio_int(); | |
| } | |
| } | |
| } | |
| v_cnt++; | |
| if (crtc.s.CRT_YL == v_cnt) { | |
| pcg.r.vsync = 1; | |
| if (xmilcfg.DISPSYNC == 1) { | |
| xmilcfg.DISPSYNC |= 0x80; | |
| scrnupdate(); | |
| } | |
| } | |
| } | |
| sound_sync(); | |
| calendar_inc(); | calendar_inc(); |
| if (!(xmilcfg.DISPSYNC & 0x80)) { | sound_sync(); |
| scrnupdate(); | |
| } | |
| } | } |