DLL_PREFIX_I struct cur_time_s cur_time;
#endif
-void IO::initialize()
+void HC80_IO::initialize()
{
// config
device_type = config.device_type;
register_event_by_clock(this, EVENT_6303, 100, true, NULL);
}
-void IO::release()
+void HC80_IO::release()
{
// save external ram disk
FILEIO* fio = new FILEIO();
delete key_buf;
}
-void IO::reset()
+void HC80_IO::reset()
{
// reset gapnit
bcr = slbcr = isr = ier = ioctlr = 0;
iramdisk_ptr = iramdisk_buf;
}
-void IO::sysreset()
+void HC80_IO::sysreset()
{
// reset 7508
onesec_intr = alarm_intr = false;
res_7508 = true;
}
-void IO::write_signal(int id, uint32_t data, uint32_t mask)
+void HC80_IO::write_signal(int id, uint32_t data, uint32_t mask)
{
if(id == SIG_IO_RXRDY) {
// notify rxrdy is changed from i8251
}
}
-void IO::event_frame()
+void HC80_IO::event_frame()
{
d_beep->write_signal(SIG_BEEP_ON, beep ? 1 : 0, 1);
beep = false;
blink++;
}
-void IO::event_callback(int event_id, int err)
+void HC80_IO::event_callback(int event_id, int err)
{
if(event_id == EVENT_FRC) {
// FRC overflow event
}
}
-void IO::write_io8(uint32_t addr, uint32_t data)
+void HC80_IO::write_io8(uint32_t addr, uint32_t data)
{
//this->out_debug_log(_T("OUT %2x,%2x\n"), addr & 0xff, data);
switch(addr & 0xff) {
}
}
-uint32_t IO::read_io8(uint32_t addr)
+uint32_t HC80_IO::read_io8(uint32_t addr)
{
uint32_t val = 0xff;
// this->out_debug_log(_T("IN %2x\n"), addr & 0xff);
return 0xff;
}
-uint32_t IO::get_intr_ack()
+uint32_t HC80_IO::get_intr_ack()
{
if(isr & BIT_7508) {
isr &= ~BIT_7508;
return 0xff;
}
-void IO::update_intr()
+void HC80_IO::update_intr()
{
// set int signal
bool next = ((isr & ier & 0x3f) != 0);
// 7508
// ----------------------------------------------------------------------------
-void IO::send_to_7508(uint8_t val)
+void HC80_IO::send_to_7508(uint8_t val)
{
int res;
}
}
-uint8_t IO::rec_from_7508()
+uint8_t HC80_IO::rec_from_7508()
{
return rsp7508_buf->read();
}
-void IO::key_down(int code)
+void HC80_IO::key_down(int code)
{
if(code == 0x14) {
// toggle caps lock
}
}
-void IO::key_up(int code)
+void HC80_IO::key_up(int code)
{
if(code == 0x10) {
update_key(0xa3); // break shift
}
}
-void IO::update_key(int code)
+void HC80_IO::update_key(int code)
{
if(code != 0xff) {
// add to buffer
// 6303
// ----------------------------------------------------------------------------
-void IO::process_6303()
+void HC80_IO::process_6303()
{
switch(cmd6303) {
case 0x00:
}
}
-uint8_t IO::get_point(int x, int y)
+uint8_t HC80_IO::get_point(int x, int y)
{
if(0 <= x && x < 480 && 0 <= y && y < 64) {
uint8_t bit = dot_tbl[x & 7];
return 0;
}
-void IO::draw_point(int x, int y, uint16_t dot)
+void HC80_IO::draw_point(int x, int y, uint16_t dot)
{
if(0 <= x && x < 480 && 0 <= y && y < 64) {
uint8_t bit = dot_tbl[x & 7];
}
}
-void IO::draw_line(int sx, int sy, int ex, int ey, uint16_t ope)
+void HC80_IO::draw_line(int sx, int sy, int ex, int ey, uint16_t ope)
{
int next_x = sx, next_y = sy;
int delta_x = abs(ex - sx) * 2;
BANK: 1 or 2
*/
-void IO::iramdisk_write_data(uint8_t val)
+void HC80_IO::iramdisk_write_data(uint8_t val)
{
if(iramdisk_dest == IRAMDISK_IN && iramdisk_count) {
*(iramdisk_ptr++) = val;
}
}
-void IO::iramdisk_write_cmd(uint8_t val)
+void HC80_IO::iramdisk_write_cmd(uint8_t val)
{
iramdisk_cmd = val;
iramdisk_count = 0;
}
}
-uint8_t IO::iramdisk_read_data()
+uint8_t HC80_IO::iramdisk_read_data()
{
if(iramdisk_dest == IRAMDISK_OUT) {
if(iramdisk_count) {
return 0;
}
-uint8_t IO::iramdisk_read_stat()
+uint8_t HC80_IO::iramdisk_read_stat()
{
if(iramdisk_dest == IRAMDISK_OUT) {
return IRAMDISK_WAIT;
// ----------------------------------------------------------------------------
-void IO::draw_screen()
+void HC80_IO::draw_screen()
{
if(lcd_on) {
memset(lcd, 0, sizeof(lcd));
#define STATE_VERSION 1
-#include "../../statesub.h"
-
-void IO::decl_state()
-{
- enter_decl_state(STATE_VERSION);
-
- DECL_STATE_ENTRY_UINT32(cur_clock);
- DECL_STATE_ENTRY_UINT8(bcr);
- DECL_STATE_ENTRY_UINT8(slbcr);
- DECL_STATE_ENTRY_UINT8(isr);
- DECL_STATE_ENTRY_UINT8(ier);
- DECL_STATE_ENTRY_UINT8(ioctlr);
- DECL_STATE_ENTRY_UINT32(icrc);
- DECL_STATE_ENTRY_UINT32(icrb);
- DECL_STATE_ENTRY_BOOL(ear);
- DECL_STATE_ENTRY_UINT8(vadr);
- DECL_STATE_ENTRY_UINT8(yoff);
- DECL_STATE_ENTRY_FIFO(cmd7508_buf);
- DECL_STATE_ENTRY_FIFO(rsp7508_buf);
- DECL_STATE_ENTRY_CUR_TIME_T(cur_time);
- DECL_STATE_ENTRY_INT32(register_id);
- DECL_STATE_ENTRY_BOOL(onesec_intr);
- DECL_STATE_ENTRY_BOOL(onesec_intr_enb);
- DECL_STATE_ENTRY_BOOL(alarm_intr);
- DECL_STATE_ENTRY_BOOL(alarm_intr_enb);
- DECL_STATE_ENTRY_1D_ARRAY(alarm, sizeof(alarm));
- DECL_STATE_ENTRY_FIFO(key_buf);
- DECL_STATE_ENTRY_BOOL(kb_intr_enb);
- DECL_STATE_ENTRY_BOOL(kb_rep_enb);
- DECL_STATE_ENTRY_BOOL(kb_caps);
- DECL_STATE_ENTRY_UINT8(kb_rep_spd1);
- DECL_STATE_ENTRY_UINT8(kb_rep_spd2);
- DECL_STATE_ENTRY_BOOL(beep);
- DECL_STATE_ENTRY_BOOL(res_z80);
- DECL_STATE_ENTRY_BOOL(res_7508);
- DECL_STATE_ENTRY_UINT8(cmd6303);
- DECL_STATE_ENTRY_UINT8(psr);
- DECL_STATE_ENTRY_FIFO(cmd6303_buf);
- DECL_STATE_ENTRY_FIFO(rsp6303_buf);
- DECL_STATE_ENTRY_1D_ARRAY(ram, sizeof(ram));
- DECL_STATE_ENTRY_UINT16(cs_addr);
- DECL_STATE_ENTRY_UINT16(gs_addr);
- DECL_STATE_ENTRY_UINT8(lcd_on);
- DECL_STATE_ENTRY_UINT8(scr_mode);
- DECL_STATE_ENTRY_UINT16(scr_ptr);
- DECL_STATE_ENTRY_UINT8(num_lines);
- DECL_STATE_ENTRY_UINT8(curs_mode);
- DECL_STATE_ENTRY_UINT8(curs_x);
- DECL_STATE_ENTRY_UINT8(curs_y);
- DECL_STATE_ENTRY_UINT8(wnd_ptr_x);
- DECL_STATE_ENTRY_UINT8(wnd_ptr_y);
- DECL_STATE_ENTRY_UINT8(flash_block);
- DECL_STATE_ENTRY_UINT8(cs_blocks);
- DECL_STATE_ENTRY_2D_ARRAY(cs_block, 40, 3);
- DECL_STATE_ENTRY_UINT8(gs_blocks);
- DECL_STATE_ENTRY_2D_ARRAY(gs_block, 144, 3);
- DECL_STATE_ENTRY_1D_ARRAY(font, sizeof(font));
- DECL_STATE_ENTRY_2D_ARRAY(udgc, 256, 255+2);
- DECL_STATE_ENTRY_2D_ARRAY(mov, 64, 80);
- DECL_STATE_ENTRY_2D_ARRAY(lcd, SCREEN_HEIGHT, SCREEN_WIDTH);
- DECL_STATE_ENTRY_INT32(blink);
- DECL_STATE_ENTRY_FIFO(tf20_buf);
- DECL_STATE_ENTRY_INT32(device_type);
- DECL_STATE_ENTRY_1D_ARRAY(ext, sizeof(ext));
- DECL_STATE_ENTRY_UINT32(extar);
- DECL_STATE_ENTRY_UINT8(extcr);
- DECL_STATE_ENTRY_3D_ARRAY(iramdisk_sectors, 15, 64, 128);
- DECL_STATE_ENTRY_UINT8(iramdisk_cmd);
- DECL_STATE_ENTRY_INT32(iramdisk_count);
- DECL_STATE_ENTRY_INT32(iramdisk_dest);
- DECL_STATE_ENTRY_1D_ARRAY(iramdisk_buf, sizeof(iramdisk_buf));
- DECL_STATE_ENTRY_INT32(tmp_iramdisk_size); // (int)(iramdisk_ptr - iramdisk_buf));
-
- leave_decl_state();
-}
-
-void IO::save_state(FILEIO* state_fio)
-{
- tmp_iramdisk_size = (int)(iramdisk_ptr - iramdisk_buf);
-
- if(state_entry != NULL) {
- state_entry->save_state(state_fio);
- }
-// state_fio->FputUint32(STATE_VERSION);
-// state_fio->FputInt32(this_device_id);
-
-// state_fio->FputUint32(cur_clock);
-// state_fio->FputUint8(bcr);
-// state_fio->FputUint8(slbcr);
-// state_fio->FputUint8(isr);
-// state_fio->FputUint8(ier);
-// state_fio->FputUint8(ioctlr);
-// state_fio->FputUint32(icrc);
-/// state_fio->FputUint32(icrb);
-// state_fio->FputBool(ear);
-// state_fio->FputUint8(vadr);
-// state_fio->FputUint8(yoff);
-// cmd7508_buf->save_state((void *)state_fio);
-// rsp7508_buf->save_state((void *)state_fio);
-// cur_time.save_state((void *)state_fio);
-// state_fio->FputInt32(register_id);
-// state_fio->FputBool(onesec_intr);
-// state_fio->FputBool(onesec_intr_enb);
-// state_fio->FputBool(alarm_intr);
-// state_fio->FputBool(alarm_intr_enb);
-// state_fio->Fwrite(alarm, sizeof(alarm), 1);
-// key_buf->save_state((void *)state_fio);
-// state_fio->FputBool(kb_intr_enb);
-// state_fio->FputBool(kb_rep_enb);
-// state_fio->FputBool(kb_caps);
-// state_fio->FputUint8(kb_rep_spd1);
-// state_fio->FputUint8(kb_rep_spd2);
-// state_fio->FputBool(beep);
-// state_fio->FputBool(res_z80);
-// state_fio->FputBool(res_7508);
-// state_fio->FputUint8(cmd6303);
-// state_fio->FputUint8(psr);
-// cmd6303_buf->save_state((void *)state_fio);
-// rsp6303_buf->save_state((void *)state_fio);
-// state_fio->Fwrite(ram, sizeof(ram), 1);
-// state_fio->FputUint16(cs_addr);
-// state_fio->FputUint16(gs_addr);
-// state_fio->FputUint8(lcd_on);
-// state_fio->FputUint8(scr_mode);
-// state_fio->FputUint16(scr_ptr);
-// state_fio->FputUint8(num_lines);
-// state_fio->FputUint8(curs_mode);
-// state_fio->FputUint8(curs_x);
-// state_fio->FputUint8(curs_y);
-// state_fio->FputUint8(wnd_ptr_x);
-// state_fio->FputUint8(wnd_ptr_y);
-// state_fio->FputUint8(flash_block);
-// state_fio->FputUint8(cs_blocks);
-// state_fio->Fwrite(cs_block, sizeof(cs_block), 1);
-// state_fio->FputUint8(gs_blocks);
-// state_fio->Fwrite(gs_block, sizeof(gs_block), 1);
-// state_fio->Fwrite(font, sizeof(font), 1);
-// state_fio->Fwrite(udgc, sizeof(udgc), 1);
-// state_fio->Fwrite(mov, sizeof(mov), 1);
-// state_fio->Fwrite(lcd, sizeof(lcd), 1);
-// state_fio->FputInt32(blink);
-// tf20_buf->save_state((void *)state_fio);
-// state_fio->FputInt32(device_type);
-// state_fio->Fwrite(ext, sizeof(ext), 1);
-// state_fio->FputUint32(extar);
-// state_fio->FputUint8(extcr);
-// state_fio->Fwrite(iramdisk_sectors, sizeof(iramdisk_sectors), 1);
-// state_fio->FputUint8(iramdisk_cmd);
-// state_fio->FputInt32(iramdisk_count);
-// state_fio->FputInt32(iramdisk_dest);
-// state_fio->Fwrite(iramdisk_buf, sizeof(iramdisk_buf), 1);
-// state_fio->FputInt32((int)(iramdisk_ptr - iramdisk_buf));
-}
-
-bool IO::load_state(FILEIO* state_fio)
-{
- bool mb = false;
- if(state_entry != NULL) {
- mb = state_entry->load_state(state_fio);
- }
- if(!mb) {
- return false;
- }
-// if(state_fio->FgetUint32() != STATE_VERSION) {
-// return false;
-// }
-// if(state_fio->FgetInt32() != this_device_id) {
-// return false;
-// }
-// cur_clock = state_fio->FgetUint32();
-// bcr = state_fio->FgetUint8();
-// slbcr = state_fio->FgetUint8();
-// isr = state_fio->FgetUint8();
-// ier = state_fio->FgetUint8();
-// ioctlr = state_fio->FgetUint8();
-// icrc = state_fio->FgetUint32();
-// icrb = state_fio->FgetUint32();
-// ear = state_fio->FgetBool();
-// vadr = state_fio->FgetUint8();
-// yoff = state_fio->FgetUint8();
-// if(!cmd7508_buf->load_state((void *)state_fio)) {
-// return false;
-// }
-// if(!rsp7508_buf->load_state((void *)state_fio)) {
-// return false;
-// }
-// if(!cur_time.load_state((void *)state_fio)) {
-// return false;
-// }
-// register_id = state_fio->FgetInt32();
-// onesec_intr = state_fio->FgetBool();
-// onesec_intr_enb = state_fio->FgetBool();
-// alarm_intr = state_fio->FgetBool();
-// alarm_intr_enb = state_fio->FgetBool();
-// state_fio->Fread(alarm, sizeof(alarm), 1);
-// if(!key_buf->load_state((void *)state_fio)) {
-// return false;
-// }
-// kb_intr_enb = state_fio->FgetBool();
-// kb_rep_enb = state_fio->FgetBool();
-// kb_caps = state_fio->FgetBool();
-// kb_rep_spd1 = state_fio->FgetUint8();
-// kb_rep_spd2 = state_fio->FgetUint8();
-// beep = state_fio->FgetBool();
-// res_z80 = state_fio->FgetBool();
-// res_7508 = state_fio->FgetBool();
-// cmd6303 = state_fio->FgetUint8();
-// psr = state_fio->FgetUint8();
-// if(!cmd6303_buf->load_state((void *)state_fio)) {
-// return false;
-// }
-// if(!rsp6303_buf->load_state((void *)state_fio)) {
-// return false;
-// }
-// state_fio->Fread(ram, sizeof(ram), 1);
-// cs_addr = state_fio->FgetUint16();
-// gs_addr = state_fio->FgetUint16();
-// lcd_on = state_fio->FgetUint8();
-// scr_mode = state_fio->FgetUint8();
-// scr_ptr = state_fio->FgetUint16();
-// num_lines = state_fio->FgetUint8();
-// curs_mode = state_fio->FgetUint8();
-// curs_x = state_fio->FgetUint8();
-// curs_y = state_fio->FgetUint8();
-// wnd_ptr_x = state_fio->FgetUint8();
-// wnd_ptr_y = state_fio->FgetUint8();
-// flash_block = state_fio->FgetUint8();
-// cs_blocks = state_fio->FgetUint8();
-// state_fio->Fread(cs_block, sizeof(cs_block), 1);
-// gs_blocks = state_fio->FgetUint8();
-// state_fio->Fread(gs_block, sizeof(gs_block), 1);
-// state_fio->Fread(font, sizeof(font), 1);
-// state_fio->Fread(udgc, sizeof(udgc), 1);
-// state_fio->Fread(mov, sizeof(mov), 1);
-// state_fio->Fread(lcd, sizeof(lcd), 1);
-// blink = state_fio->FgetInt32();
-// if(!tf20_buf->load_state((void *)state_fio)) {
-// return false;
-// }
-// device_type = state_fio->FgetInt32();
-// state_fio->Fread(ext, sizeof(ext), 1);
-// extar = state_fio->FgetUint32();
-// extcr = state_fio->FgetUint8();
-// state_fio->Fread(iramdisk_sectors, sizeof(iramdisk_sectors), 1);
-// iramdisk_cmd = state_fio->FgetUint8();
-// iramdisk_count = state_fio->FgetInt32();
-// iramdisk_dest = state_fio->FgetInt32();
-// state_fio->Fread(iramdisk_buf, sizeof(iramdisk_buf), 1);
-
- iramdisk_ptr = iramdisk_buf + tmp_iramdisk_size;
- return true;
-}
-
-bool IO::process_state(FILEIO* state_fio, bool loading)
+bool HC80_IO::process_state(FILEIO* state_fio, bool loading)
{
if(!state_fio->StateCheckUint32(STATE_VERSION)) {
return false;