X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;ds=sidebyside;f=source%2Fsrc%2Fvm%2Fv9938.cpp;h=15a28b611d1b03d673aeccf6bf22843d163b5abe;hb=3703614db7c0e24cdb6e20f91b6fd00c92363baa;hp=4f21c4cd14ac9f7fa08a1b921c0ec593b7519437;hpb=5328467b46323eaa67c5f3af2657aff1481d954c;p=csp-qt%2Fcommon_source_project-fm7.git diff --git a/source/src/vm/v9938.cpp b/source/src/vm/v9938.cpp index 4f21c4cd1..15a28b611 100644 --- a/source/src/vm/v9938.cpp +++ b/source/src/vm/v9938.cpp @@ -64,7 +64,8 @@ enum #define EXPMEM_OFFSET 0x20000 -#define LONG_WIDTH (512 + 32) +// LONG_WIDTH has already defined limits.h for GCC.20180614 K.O +#define _V9938_LONG_WIDTH (512 + 32) static const char *const v9938_modes[] = { "TEXT 1", "MULTICOLOR", "GRAPHIC 1", "GRAPHIC 2", "GRAPHIC 3", @@ -93,7 +94,7 @@ at most 192 KiB RAM (128 KiB base, 64 KiB expansion). //v99x8_device::v99x8_device(const machine_config &mconfig, device_type type, const char *name, const char *shortname, const char *tag, device_t *owner, UINT32 clock) //: device_t(mconfig, type, name, tag, owner, clock, shortname, __FILE__), -v99x8_device::v99x8_device(VM* parent_vm, EMU* parent_emu) +v99x8_device::v99x8_device(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu), // device_memory_interface(mconfig, *this), // device_video_interface(mconfig, *this), @@ -131,7 +132,7 @@ v99x8_device::v99x8_device(VM* parent_vm, EMU* parent_emu) //v9938_device::v9938_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) //: v99x8_device(mconfig, V9938, "V9938 VDP", "v9938", tag, owner, clock) -v9938_device::v9938_device(VM* parent_vm, EMU* parent_emu) +v9938_device::v9938_device(VM_TEMPLATE* parent_vm, EMU* parent_emu) : v99x8_device(parent_vm, parent_emu) { m_model = MODEL_V9938; @@ -141,7 +142,7 @@ v9938_device::v9938_device(VM* parent_vm, EMU* parent_emu) //v9958_device::v9958_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) //: v99x8_device(mconfig, V9938, "V9958 VDP", "v9958", tag, owner, clock) -v9958_device::v9958_device(VM* parent_vm, EMU* parent_emu) +v9958_device::v9958_device(VM_TEMPLATE* parent_vm, EMU* parent_emu) : v99x8_device(parent_vm, parent_emu) { m_model = MODEL_V9958; @@ -961,7 +962,7 @@ void v99x8_device::default_border(const scrntype_t *pens, scrntype_t *ln) int i; pen = pens[m_pal_ind16[(m_cont_reg[7]&0x0f)]]; - i = LONG_WIDTH; + i = _V9938_LONG_WIDTH; while (i--) *ln++ = pen; } @@ -971,7 +972,7 @@ void v99x8_device::graphic7_border(const scrntype_t *pens, scrntype_t *ln) int i; pen = pens[m_pal_ind256[m_cont_reg[7]]]; - i = LONG_WIDTH; + i = _V9938_LONG_WIDTH; while (i--) *ln++ = pen; } @@ -983,7 +984,7 @@ void v99x8_device::graphic5_border(const scrntype_t *pens, scrntype_t *ln) pen1 = pens[m_pal_ind16[(m_cont_reg[7]&0x03)]]; pen0 = pens[m_pal_ind16[((m_cont_reg[7]>>2)&0x03)]]; - i = LONG_WIDTH / 2; + i = _V9938_LONG_WIDTH / 2; while (i--) { *ln++ = pen0; *ln++ = pen1; } } @@ -1886,14 +1887,14 @@ void v99x8_device::refresh_16(int line) if (m_cont_reg[9] & 0x08) { // ln = &m_bitmap.pix16(m_scanline*2+((m_stat_reg[2]>>1)&1)); - ln = screen+(m_scanline*2+((m_stat_reg[2]>>1)&1))*LONG_WIDTH; + ln = screen+(m_scanline*2+((m_stat_reg[2]>>1)&1))*_V9938_LONG_WIDTH; } else { // ln = &m_bitmap.pix16(m_scanline*2); // ln2 = &m_bitmap.pix16(m_scanline*2+1); - ln = screen+(m_scanline*2)*LONG_WIDTH; - ln2 = screen+(m_scanline*2+1)*LONG_WIDTH; + ln = screen+(m_scanline*2)*_V9938_LONG_WIDTH; + ln2 = screen+(m_scanline*2+1)*_V9938_LONG_WIDTH; double_lines = true; } @@ -1912,7 +1913,7 @@ void v99x8_device::refresh_16(int line) } if (double_lines) - memcpy(ln2, ln, (512 + 32) * sizeof(scrntype_t)); + my_memcpy(ln2, ln, (512 + 32) * sizeof(scrntype_t)); } void v99x8_device::refresh_line(int line) @@ -3117,9 +3118,10 @@ void v99x8_device::draw_screen() scrntype_t *dst; int y; if(osd == NULL) return; + emu->set_vm_screen_lines(__SCREEN_HEIGHT); for(y=0; y< __SCREEN_HEIGHT; y++) { if((dst = osd->get_vm_screen_buffer(y)) != NULL) { - memcpy(dst, screen+(y+18)*LONG_WIDTH+2, __SCREEN_WIDTH*sizeof(scrntype_t)); + my_memcpy(dst, screen+(y+18)*_V9938_LONG_WIDTH+2, __SCREEN_WIDTH*sizeof(scrntype_t)); } } } @@ -3161,26 +3163,16 @@ void v99x8_device::write_signal(int id, uint32_t data, uint32_t mask) #define STATE_VERSION 2 -void v99x8_device::save_state(FILEIO* state_fio) +bool v99x8_device::process_state(FILEIO* state_fio, bool loading) { - state_fio->FputUint32(STATE_VERSION); - state_fio->FputInt32(this_device_id); - - save_load_state(state_fio, true); -} - -bool v99x8_device::load_state(FILEIO* state_fio) -{ - if(state_fio->FgetUint32() != STATE_VERSION) { - return false; - } - if(state_fio->FgetInt32() != this_device_id) { - return false; - } - - save_load_state(state_fio, false); - - return true; + if(!state_fio->StateCheckUint32(STATE_VERSION)) { + return false; + } + if(!state_fio->StateCheckInt32(this_device_id)) { + return false; + } + save_load_state(state_fio, !loading); + return true; } void v99x8_device::save_load_state(FILEIO* state_fio, bool is_save)