|
|
| version 1.28, 2004/01/22 01:10:03 | version 1.34, 2004/01/27 03:24:18 |
|---|---|
| Line 9 | Line 9 |
| #include "pccore.h" | #include "pccore.h" |
| #include "iocore.h" | #include "iocore.h" |
| #include "cbuscore.h" | #include "cbuscore.h" |
| #include "sasiio.h" | |
| #include "scsiio.h" | |
| #include "pc9861k.h" | #include "pc9861k.h" |
| #include "mpu98ii.h" | #include "mpu98ii.h" |
| #include "board14.h" | #include "board14.h" |
| Line 24 | Line 26 |
| #include "fddfile.h" | #include "fddfile.h" |
| #include "fdd_mtr.h" | #include "fdd_mtr.h" |
| #include "sxsi.h" | #include "sxsi.h" |
| #include "calendar.h" | |
| #include "keydisp.h" | #include "keydisp.h" |
| #include "sasiio.h" | |
| #include "scsiio.h" | |
| #include "hostdrv.h" | #include "hostdrv.h" |
| #include "calendar.h" | |
| #if defined(MACOS) | #if defined(MACOS) |
| #define CRCONST str_cr | #define CRCONST str_cr |
| Line 58 enum { | Line 57 enum { |
| #if defined(CGWND_FONTPTR) | #if defined(CGWND_FONTPTR) |
| STATFLAG_CGW, | STATFLAG_CGW, |
| #endif | #endif |
| STATFLAG_CLOCK, | |
| STATFLAG_COM, | STATFLAG_COM, |
| STATFLAG_DISK, | STATFLAG_DISK, |
| STATFLAG_DMA, | STATFLAG_DMA, |
| Line 550 static int flagload_common(STFLAGH sfh, | Line 548 static int flagload_common(STFLAGH sfh, |
| } | } |
| // ----- clock | |
| static int flagload_clock(STFLAGH sfh, const SFENTRY *tbl) { | |
| int ret; | |
| ret = statflag_read(sfh, tbl->arg1, tbl->arg2); | |
| sound_changeclock(); | |
| beep_changeclock(); | |
| return(ret); | |
| } | |
| // ---- memory | // ---- memory |
| static int flagsave_mem(STFLAGH sfh, const SFENTRY *tbl) { | static int flagsave_mem(STFLAGH sfh, const SFENTRY *tbl) { |
| Line 588 static int flagload_mem(STFLAGH sfh, con | Line 573 static int flagload_mem(STFLAGH sfh, con |
| } | } |
| // ---- ext memory | |
| static int flagsave_ext(STFLAGH sfh, const SFENTRY *tbl) { | |
| int ret; | |
| ret = statflag_write(sfh, &extmem, sizeof(extmem)); | |
| if (CPU_EXTMEM) { | |
| ret = statflag_write(sfh, CPU_EXTMEM, CPU_EXTMEMSIZE); | |
| } | |
| (void)tbl; | |
| return(ret); | |
| } | |
| static int flagload_ext(STFLAGH sfh, const SFENTRY *tbl) { | |
| int ret; | |
| int i; | |
| UINT pagemax = 0; | |
| ret = statflag_read(sfh, &extmem, sizeof(extmem)); | |
| if (extmem.maxmem) { | |
| if (extmem.maxmem > (13+1)) { | |
| extmem.maxmem = (13+1); | |
| } | |
| if (!extmemmng_realloc(extmem.maxmem - 1)) { | |
| pagemax = (extmem.maxmem - 1) << 8; | |
| if (CPU_EXTMEM) { | |
| ret |= statflag_read(sfh, CPU_EXTMEM, CPU_EXTMEMSIZE); | |
| } | |
| } | |
| else { | |
| extmem.maxmem = 0; | |
| } | |
| } | |
| for (i=0; i<4; i++) { | |
| if (extmem.page[i] < pagemax) { | |
| extmem.pageptr[i] = CPU_EXTMEM + (extmem.page[i] << 12); | |
| } | |
| else { | |
| extmem.pageptr[i] = mem + 0xc0000 + (i << 14); | |
| } | |
| } | |
| (void)tbl; | |
| return(ret); | |
| } | |
| // ---- cg window | // ---- cg window |
| #if defined(CGWND_FONTPTR) | #if defined(CGWND_FONTPTR) |
| Line 665 static int flagload_cgwnd(STFLAGH sfh, c | Line 602 static int flagload_cgwnd(STFLAGH sfh, c |
| // ---- dma | // ---- dma |
| static int flagsave_dma(STFLAGH sfh, const SFENTRY *t) { | static int flagsave_dma(STFLAGH sfh, const SFENTRY *tbl) { |
| int i; | int i; |
| _DMAC dmabak; | _DMAC dmabak; |
| Line 678 static int flagsave_dma(STFLAGH sfh, con | Line 615 static int flagsave_dma(STFLAGH sfh, con |
| return(STATFLAG_FAILURE); | return(STATFLAG_FAILURE); |
| } | } |
| } | } |
| (void)tbl; | |
| return(statflag_write(sfh, &dmabak, sizeof(dmabak))); | return(statflag_write(sfh, &dmabak, sizeof(dmabak))); |
| } | } |
| Line 870 static int flagload_evt(STFLAGH sfh, con | Line 808 static int flagload_evt(STFLAGH sfh, con |
| } | } |
| // ---- extmem | |
| static int flagsave_ext(STFLAGH sfh, const SFENTRY *tbl) { | |
| int ret; | |
| ret = STATFLAG_SUCCESS; | |
| if (CPU_EXTMEM) { | |
| ret = statflag_write(sfh, CPU_EXTMEM, CPU_EXTMEMSIZE); | |
| } | |
| (void)tbl; | |
| return(ret); | |
| } | |
| static int flagload_ext(STFLAGH sfh, const SFENTRY *tbl) { | |
| int ret; | |
| ret = STATFLAG_SUCCESS; | |
| if (CPU_EXTMEM) { | |
| ret = statflag_read(sfh, CPU_EXTMEM, CPU_EXTMEMSIZE); | |
| } | |
| (void)tbl; | |
| return(ret); | |
| } | |
| // ---- gaiji | // ---- gaiji |
| static int flagsave_gij(STFLAGH sfh, const SFENTRY *tbl) { | static int flagsave_gij(STFLAGH sfh, const SFENTRY *tbl) { |
| Line 1019 static int flagsave_fm(STFLAGH sfh, cons | Line 984 static int flagsave_fm(STFLAGH sfh, cons |
| if (saveflg & FLAG_CS4231) { | if (saveflg & FLAG_CS4231) { |
| ret |= statflag_write(sfh, &cs4231, sizeof(cs4231)); | ret |= statflag_write(sfh, &cs4231, sizeof(cs4231)); |
| } | } |
| (void)tbl; | |
| return(ret); | return(ret); |
| } | } |
| Line 1068 static int flagload_fm(STFLAGH sfh, cons | Line 1034 static int flagload_fm(STFLAGH sfh, cons |
| cs4231_reset(); | cs4231_reset(); |
| ret = statflag_read(sfh, &usesound, sizeof(usesound)); | ret = statflag_read(sfh, &usesound, sizeof(usesound)); |
| fmboard_reset((BYTE)usesound); | fmboard_reset(usesound); |
| fmreg1a = 0x000; | fmreg1a = 0x000; |
| fmreg1b = 0x100; | fmreg1b = 0x100; |
| Line 1318 static int flagload_disk(STFLAGH sfh, co | Line 1284 static int flagload_disk(STFLAGH sfh, co |
| fdd_set(i, st.path, FTYPE_NONE, st.readonly); | fdd_set(i, st.path, FTYPE_NONE, st.readonly); |
| } | } |
| } | } |
| sxsi_trash(); | |
| for (i=0x00; i<0x02; i++) { | for (i=0x00; i<0x02; i++) { |
| ret |= statflag_read(sfh, &st, sizeof(st)); | ret |= statflag_read(sfh, &st, sizeof(st)); |
| if (st.path[0]) { | if (st.path[0]) { |
| Line 1465 const SFENTRY *tblterm; | Line 1430 const SFENTRY *tblterm; |
| ret |= statflag_createsection(sffh, tbl); | ret |= statflag_createsection(sffh, tbl); |
| switch(tbl->type) { | switch(tbl->type) { |
| case STATFLAG_BIN: | case STATFLAG_BIN: |
| case STATFLAG_CLOCK: | |
| case STATFLAG_TERM: | case STATFLAG_TERM: |
| ret |= flagsave_common(&sffh->sfh, tbl); | ret |= flagsave_common(&sffh->sfh, tbl); |
| break; | break; |
| Line 1559 const SFENTRY *tblterm; | Line 1523 const SFENTRY *tblterm; |
| #if defined(CGWND_FONTPTR) | #if defined(CGWND_FONTPTR) |
| case STATFLAG_CGW: | case STATFLAG_CGW: |
| #endif | #endif |
| case STATFLAG_CLOCK: | |
| case STATFLAG_MEM: | case STATFLAG_MEM: |
| ret |= flagcheck_versize(&sffh->sfh, tbl); | ret |= flagcheck_versize(&sffh->sfh, tbl); |
| break; | break; |
| Line 1612 const SFENTRY *tblterm; | Line 1575 const SFENTRY *tblterm; |
| return(STATFLAG_FAILURE); | return(STATFLAG_FAILURE); |
| } | } |
| // PCCORE read! | |
| ret = statflag_readsection(sffh); | |
| if ((ret != STATFLAG_SUCCESS) || | |
| (memcmp(sffh->sfh.hdr.index, np2tbl[0].index, 10))) { | |
| statflag_close(sffh); | |
| return(STATFLAG_FAILURE); | |
| } | |
| soundmng_stop(); | soundmng_stop(); |
| rs232c_midipanic(); | rs232c_midipanic(); |
| mpu98ii_midipanic(); | mpu98ii_midipanic(); |
| pc9861k_midipanic(); | pc9861k_midipanic(); |
| sxsi_trash(); | |
| ret |= flagload_common(&sffh->sfh, np2tbl); | |
| nevent_init(); | |
| CPU_RESET(); | |
| CPU_SETEXTSIZE((UINT32)pccore.extmem); | |
| sound_changeclock(); | |
| beep_changeclock(); | |
| sound_reset(); | sound_reset(); |
| #if defined(SUPPORT_WAVEMIX) | #if defined(SUPPORT_WAVEMIX) |
| wavemix_bind(); | wavemix_bind(); |
| #endif | #endif |
| fmboard_reset(0); | |
| iocore_reset(); // サウンドでpicを呼ぶので… | |
| cbuscore_reset(); | |
| fmboard_reset(pccore.sound); | |
| done = FALSE; | done = FALSE; |
| ret = STATFLAG_SUCCESS; | |
| while((!done) && (ret != STATFLAG_FAILURE)) { | while((!done) && (ret != STATFLAG_FAILURE)) { |
| ret |= statflag_readsection(sffh); | ret |= statflag_readsection(sffh); |
| tbl = np2tbl; | tbl = np2tbl + 1; |
| tblterm = tbl + (sizeof(np2tbl)/sizeof(SFENTRY)); | tblterm = np2tbl + (sizeof(np2tbl)/sizeof(SFENTRY)); |
| while(tbl < tblterm) { | while(tbl < tblterm) { |
| if (!memcmp(sffh->sfh.hdr.index, tbl->index, 10)) { | if (!memcmp(sffh->sfh.hdr.index, tbl->index, 10)) { |
| break; | break; |
| Line 1650 const SFENTRY *tblterm; | Line 1633 const SFENTRY *tblterm; |
| break; | break; |
| #endif | #endif |
| case STATFLAG_CLOCK: | |
| ret |= flagload_clock(&sffh->sfh, tbl); | |
| break; | |
| case STATFLAG_COM: | case STATFLAG_COM: |
| ret |= flagload_com(&sffh->sfh, tbl); | ret |= flagload_com(&sffh->sfh, tbl); |
| break; | break; |