#include "common.h"
#endif
-#ifdef MAX_MACRO_NOT_DEFINED
+#if defined(MAX_MACRO_NOT_DEFINED)
int max(int a, int b)
{
if(a > b) {
}
#endif
+
#ifndef SUPPORT_SECURE_FUNCTIONS
//errno_t my_tfopen_s(FILE** pFile, const _TCHAR *filename, const _TCHAR *mode)
//{
return 0;
}
+char *my_strtok_s(char *strToken, const char *strDelimit, char **context)
+{
+ return strtok(strToken, strDelimit);
+}
+
_TCHAR *my_tcstok_s(_TCHAR *strToken, const char *strDelimit, _TCHAR **context)
{
return _tcstok(strToken, strDelimit);
}
+int my_sprintf_s(char *buffer, size_t sizeOfBuffer, const char *format, ...)
+{
+ va_list ap;
+ va_start(ap, format);
+ int result = vsprintf(buffer, format, ap);
+ va_end(ap);
+ return result;
+}
+
int my_stprintf_s(_TCHAR *buffer, size_t sizeOfBuffer, const _TCHAR *format, ...)
{
va_list ap;
return result;
}
+int my_vsprintf_s(char *buffer, size_t numberOfElements, const char *format, va_list argptr)
+{
+ return vsprintf(buffer, format, argptr);
+}
+
int my_vstprintf_s(_TCHAR *buffer, size_t numberOfElements, const _TCHAR *format, va_list argptr)
{
return _vstprintf(buffer, format, argptr);
#if !defined(_MSC_VER) && !defined(CSP_OS_WINDOWS)
BOOL MyWritePrivateProfileString(LPCTSTR lpAppName, LPCTSTR lpKeyName, LPCTSTR lpString, LPCTSTR lpFileName)
{
- std::string s;
- std::string v;
- char app_path2[_MAX_PATH], *ptr;
- FILEIO *path = new FILEIO;
-
- if((lpKeyName == NULL) || (lpAppName == NULL) || (lpFileName == NULL)) {
- delete path;
- return FALSE;
- }
- if(path->Fopen(lpFileName, FILEIO_WRITE_APPEND_ASCII) != true) {
- delete path;
- return FALSE;
- }
-
- if(lpString == NULL) {
- v = "";
+// std::string s;
+// std::string v;
+// char app_path2[_MAX_PATH], *ptr;
+// FILEIO *path = new FILEIO;
+ BOOL result = FALSE;
+ FILEIO* fio_i = new FILEIO();
+ if(fio_i->Fopen(lpFileName, FILEIO_READ_ASCII)) {
+ char tmp_path[_MAX_PATH];
+ my_sprintf_s(tmp_path, _MAX_PATH, "%s.$$$", lpFileName);
+ FILEIO* fio_o = new FILEIO();
+ if(fio_o->Fopen(tmp_path, FILEIO_WRITE_ASCII)) {
+ bool in_section = false;
+ char section[1024], line[1024], *equal;
+ my_sprintf_s(section, 1024, "[%s]", lpAppName);
+ while(fio_i->Fgets(line, 1024) != NULL && strlen(line) > 0) {
+ if(line[strlen(line) - 1] == '\n') {
+ line[strlen(line) - 1] = '\0';
+ }
+ if(!result) {
+ if(line[0] == '[') {
+ if(in_section) {
+ fio_o->Fprintf("%s=%s\n", lpKeyName, lpString);
+ result = TRUE;
+ } else if(strcmp(line, section) == 0) {
+ in_section = true;
+ }
+ } else if(in_section && (equal = strstr(line, "=")) != NULL) {
+ *equal = '\0';
+ if(strcmp(line, lpKeyName) == 0) {
+ fio_o->Fprintf("%s=%s\n", lpKeyName, lpString);
+ result = TRUE;
+ continue;
+ }
+ *equal = '=';
+ }
+ }
+ fio_o->Fprintf("%s\n", line);
+ }
+ if(!result) {
+ if(!in_section) {
+ fio_o->Fprintf("[%s]\n", lpAppName);
+ }
+ fio_o->Fprintf("%s=%s\n", lpKeyName, lpString);
+ result = TRUE;
+ }
+ fio_o->Fclose();
+ }
+ delete fio_o;
+ fio_i->Fclose();
+ if(result) {
+ if(!(FILEIO::RemoveFile(lpFileName) && FILEIO::RenameFile(tmp_path, lpFileName))) {
+ result = FALSE;
+ }
+ }
} else {
- v = lpString;
+ FILEIO* fio_o = new FILEIO();
+ if(fio_o->Fopen(lpFileName, FILEIO_WRITE_ASCII)) {
+ fio_o->Fprintf("[%s]\n", lpAppName);
+ fio_o->Fprintf("%s=%s\n", lpKeyName, lpString);
+ fio_o->Fclose();
+ }
+ delete fio_o;
}
- s = lpAppName;
- s.append(".");
- s.append(lpKeyName);
- s.append("=");
- s.append(v);
- s.append("\n");
- path->Fwrite((void *)s.c_str(), s.length(), 1);
- path->Fclose();
- delete path;
- return TRUE;
- // write your compatible function, if possible in standard C/C++ code
+ delete fio_i;
+ return result;
+// if((lpKeyName == NULL) || (lpAppName == NULL) || (lpFileName == NULL)) {
+// delete path;
+// return FALSE;
+// }
+// if(path->Fopen(lpFileName, FILEIO_WRITE_APPEND_ASCII) != true) {
+// delete path;
+// return FALSE;
+// }
+//
+// if(lpString == NULL) {
+// v = "";
+// } else {
+// v = lpString;
+// }
+// s = lpAppName;
+// s.append(".");
+// s.append(lpKeyName);
+// s.append("=");
+// s.append(v);
+// s.append("\n");
+// path->Fwrite((void *)s.c_str(), s.length(), 1);
+// path->Fclose();
+// delete path;
+// return TRUE;
}
static std::string MyGetPrivateProfileStr(const _TCHAR *lpAppName, const _TCHAR *lpKeyName, _TCHAR *lpFileName)
DWORD MyGetPrivateProfileString(LPCTSTR lpAppName, LPCTSTR lpKeyName, LPCTSTR lpDefault, LPCTSTR lpReturnedString, DWORD nSize, LPCTSTR lpFileName)
{
- std::string sp = MyGetPrivateProfileStr(lpAppName, lpKeyName, lpFileName);
- if((!sp.empty()) && (nSize > 1)){
- strncpy(lpReturnedString, sp.c_str(), nSize);
+ if(lpDefault != NULL) {
+ my_strcpy_s(lpReturnedString, nSize, lpDefault);
} else {
- strncpy(lpReturnedString, lpDefault, nSize);
+ lpReturnedString[0] = '\0';
+ }
+ FILEIO* fio = new FILEIO();
+ if(fio->Fopen(lpFileName, FILEIO_READ_ASCII)) {
+ bool in_section = false;
+ char section[1024], line[1024], *equal;
+ my_sprintf_s(section, 1024, "[%s]", lpAppName);
+ while(fio->Fgets(line, 1024) != NULL && strlen(line) > 0) {
+ if(line[strlen(line) - 1] == '\n') {
+ line[strlen(line) - 1] = '\0';
+ }
+ if(line[0] == '[') {
+ if(in_section) {
+ break;
+ } else if(strcmp(line, section) == 0) {
+ in_section = true;
+ }
+ } else if(in_section && (equal = strstr(line, "=")) != NULL) {
+ *equal = '\0';
+ if(strcmp(line, lpKeyName) == 0) {
+ my_strcpy_s(lpReturnedString, nSize, equal + 1);
+ break;
+ }
+ }
+ }
+ fio->Fclose();
}
- return strlen(lpReturnedString);
+ delete fio;
+ return strlen(lpReturnedString);
+// std::string sp = MyGetPrivateProfileStr(lpAppName, lpKeyName, lpFileName);
+// if((!sp.empty()) && (nSize > 1)){
+// strncpy(lpReturnedString, sp.c_str(), nSize);
+// } else {
+// strncpy(lpReturnedString, lpDefault, nSize);
+// }
+// return strlen(lpReturnedString);
}
UINT MyGetPrivateProfileInt(LPCTSTR lpAppName, LPCTSTR lpKeyName, INT nDefault, LPCTSTR lpFileName)
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
#define SUPPORT_SECURE_FUNCTIONS
#endif
+
#ifdef SUPPORT_TCHAR_TYPE
- #include <tchar.h>
+#include <tchar.h>
#endif
#include <stdio.h>
+#include <stdlib.h>
#include <errno.h>
#if defined(_MSC_VER)
// type definition
#ifndef uint8
-typedef unsigned char uint8;
+ typedef unsigned char uint8;
#endif
#ifndef uint16
-typedef unsigned short uint16;
+ typedef unsigned short uint16;
#endif
#ifndef uint32
-typedef unsigned int uint32;
+ typedef unsigned int uint32;
#endif
#ifndef uint64
-#ifdef _MSC_VER
-typedef unsigned __int64 uint64;
-#else
+ #ifdef _MSC_VER
+ typedef unsigned __int64 uint64;
+ #else
//typedef unsigned long long uint64;
-#endif
+ #endif
#endif
#ifndef int8
-typedef signed char int8;
+ typedef signed char int8;
#endif
#ifndef int16
-typedef signed short int16;
+ typedef signed short int16;
#endif
#ifndef int32
-typedef signed int int32;
+ typedef signed int int32;
#endif
#ifndef int64
-#ifdef _MSC_VER
-typedef signed __int64 int64;
-#else
-//typedef signed long long int64;
-#endif
+ #ifdef _MSC_VER
+ typedef signed __int64 int64;
+ #else
+ //typedef signed long long int64;
+ #endif
#endif
#if defined(__LITTLE_ENDIAN__)
} pair;
// max/min from WinDef.h
-#ifndef max
+#ifndef _MSC_VER
+ #undef max
+ #undef min
#define MAX_MACRO_NOT_DEFINED
int max(int a, int b);
unsigned int max(unsigned int a, unsigned int b);
-#endif
-#ifndef min
#define MIN_MACRO_NOT_DEFINED
int min(int a, int b);
unsigned int min(unsigned int a, unsigned int b);
#endif
+//#if defined(__GNUC__) || defined(__CYGWIN__) || defined(Q_OS_CYGWIN)
+// #define stricmp(a,b) strcasecmp(a,b)
+// #define strnicmp(a,b,n) strncasecmp(a,b,n)
+//#endif
+
// _TCHAR
#ifndef SUPPORT_TCHAR_TYPE
#ifndef _tfopen
#ifndef _tremove
#define _tremove remove
#endif
+ #ifndef _trename
+ #define _trename rename
+ #endif
#define __T(x) x
#define _T(x) __T(x)
#define _TEXT(x) __T(x)
#endif
-// secture functions
#ifndef SUPPORT_SECURE_FUNCTIONS
#ifndef errno_t
typedef int errno_t;
// errno_t my_tfopen_s(FILE** pFile, const _TCHAR *filename, const _TCHAR *mode);
errno_t my_strcpy_s(char *strDestination, size_t numberOfElements, const char *strSource);
errno_t my_tcscpy_s(_TCHAR *strDestination, size_t numberOfElements, const _TCHAR *strSource);
+ char *my_strtok_s(char *strToken, const char *strDelimit, char **context);
_TCHAR *my_tcstok_s(_TCHAR *strToken, const char *strDelimit, _TCHAR **context);
- int my_stprintf_s(_TCHAR *buffer, size_t sizeOfBuffer, const _TCHAR *format, ...);
+ #define my_fprintf_s fprintf
+ int my_sprintf_s(char *buffer, size_t sizeOfBuffer, const char *format, ...);
+ int my_stprintf_s(_TCHAR *buffer, size_t sizeOfBuffer, const _TCHAR *format, ...);
+ int my_vsprintf_s(char *buffer, size_t numberOfElements, const char *format, va_list argptr);
int my_vstprintf_s(_TCHAR *buffer, size_t numberOfElements, const _TCHAR *format, va_list argptr);
#else
// #define my_tfopen_s _tfopen_s
#define my_strcpy_s strcpy_s
#define my_tcscpy_s _tcscpy_s
+ #define my_strtok_s strtok_s
#define my_tcstok_s _tcstok_s
+ #define my_fprintf_s fprintf_s
+ #define my_sprintf_s sprintf_s
#define my_stprintf_s _stprintf_s
+ #define my_vsprintf_s vsprintf_s
#define my_vstprintf_s _vstprintf_s
#endif
+// ini file parser
#if!defined(_MSC_VER) && !defined(CSP_OS_WINDOWS)
BOOL MyWritePrivateProfileString(LPCTSTR lpAppName, LPCTSTR lpKeyName, LPCTSTR lpString, LPCTSTR lpFileName);
DWORD MyGetPrivateProfileString(LPCTSTR lpAppName, LPCTSTR lpKeyName, LPCTSTR lpDefault, LPCTSTR lpReturnedString, DWORD nSize, LPCTSTR lpFileName);
#define MyGetPrivateProfileInt GetPrivateProfileInt
#endif
+// win32 api
+#ifndef _MSC_VER
+ #define ZeroMemory(p,s) memset(p,0x00,s)
+ #define CopyMemory(t,f,s) memcpy(t,f,s)
+#endif
+
// rgb color
#define _RGB888
#endif // ENDIAN
+// string
+#if defined(__GNUC__) || defined(__CYGWIN__) || defined(Q_OS_CYGWIN)
+ #define stricmp(a,b) strcasecmp(a,b)
+ #define strnicmp(a,b,n) strncasecmp(a,b,n)
+#endif
+
// _TCHAR
#ifndef SUPPORT_TCHAR_TYPE
typedef char _TCHAR;
#ifdef USE_SOUND_DEVICE_TYPE
sound_device_type = config.sound_device_type;
#endif
-
osd = new OSD();
-
-#if defined(OSD_WIN32) || defined(_USE_QT)
+#if defined(_USE_QT)
osd->main_window_handle = hwnd;
osd->glv = hinst;
#endif
osd->initialize(sound_rate, sound_samples);
+ osd->lock_vm();
osd->vm = vm = new VM(this);
initialize_media();
+ osd->initialize_printer();
vm->initialize_sound(sound_rate, sound_samples);
vm->reset();
+ osd->unlock_vm();
+
now_suspended = false;
}
return (int)(1024. * 1000. / FRAMES_PER_SEC + 0.5);
#endif
#else
- return (int)(1024. * 1000. / FRAMES_PER_SEC + 0.5);
+ return (int)(1024. * 1000. / FRAMES_PER_SEC + 0.5);
#endif
}
osd->restore();
now_suspended = false;
}
- //LockVM();
osd->update_input();
osd->update_printer();
#ifdef USE_SOCKET
// virtual machine may be driven to fill sound buffer
int extra_frames = 0;
osd->update_sound(&extra_frames);
-
// drive virtual machine
if(extra_frames == 0) {
- lock_vm();
+ osd->lock_vm();
vm->run();
extra_frames = 1;
- unlock_vm();
+ osd->unlock_vm();
}
osd->add_extra_frames(extra_frames);
return extra_frames;
// stop sound
osd->stop_sound();
// reinitialize virtual machine
- lock_vm();
+ osd->lock_vm();
delete vm;
osd->vm = vm = new VM(this);
vm->initialize_sound(sound_rate, sound_samples);
vm->reset();
- unlock_vm();
+ osd->unlock_vm();
// restore inserted medias
restore_media();
} else {
// reset virtual machine
- lock_vm();
+ osd->lock_vm();
vm->reset();
- unlock_vm();
+ osd->unlock_vm();
}
// reset printer
void EMU::special_reset()
{
// reset virtual machine
- lock_vm();
+ osd->lock_vm();
vm->special_reset();
- unlock_vm();
+ osd->unlock_vm();
// reset printer
osd->reset_printer();
}
}
+void EMU::lock_vm()
+{
+ osd->lock_vm();
+}
+
+void EMU::unlock_vm()
+{
+ osd->unlock_vm();
+}
+
// ----------------------------------------------------------------------------
// input
// ----------------------------------------------------------------------------
void EMU::save_state_tmp(const _TCHAR* file_path)
{
FILEIO* fio = new FILEIO();
- lock_vm();
+ osd->lock_vm();
if(fio->Fopen(file_path, FILEIO_WRITE_BINARY)) {
// save state file version
fio->FputUint32(STATE_VERSION);
fio->FputInt32(-1);
fio->Fclose();
}
- unlock_vm();
+ osd->unlock_vm();
delete fio;
}
#endif
if(reinitialize) {
// stop sound
- lock_vm();
+ osd->lock_vm();
// reinitialize virtual machine
osd->stop_sound();
delete vm;
osd->vm = vm = new VM(this);
vm->initialize_sound(sound_rate, sound_samples);
vm->reset();
- unlock_vm();
+ osd->unlock_vm();
}
// restore inserted medias
restore_media();
}
fio->Fclose();
}
+ osd->unlock_vm();
delete fio;
return result;
}
#if defined(USE_DIG_RESOLUTION)
void get_screen_resolution(int *w, int *h);
#endif
- void lock_vm(void) {
- osd->lock_vm();
- }
- void unlock_vm(void) {
- osd->unlock_vm();
- }
+ void lock_vm(void);
+ void unlock_vm(void);
+ //{
+ // osd->lock_vm();
+ //}
+ //void unlock_vm(void) {
+ // osd->unlock_vm();
+ //}
void update_config();
// state
#ifdef USE_STATE
#include "fileio.h"
#if !defined(MSC_VER)
#include <stdarg.h>
+#include <fcntl.h>
#include <stdio.h>
#include <iostream>
#include <fstream>
bool FILEIO::IsFileExists(const _TCHAR *file_path)
{
#if defined(_USE_QT) || defined(_USE_SDL)
- std::FILE *f;
- f = std::fopen(file_path, "r");
- if(f >= 0) return true;
+ FILE *f;
+ f = fopen(file_path, "r");
+ if(f != NULL) {
+ fclose(f);
+ return true;
+ }
return false;
#else
# ifdef _MSC_VER
}
return ((attr & FILE_ATTRIBUTE_DIRECTORY) == 0);
# else
- return (_taccess(file_path, 0) == 0); // not supported on wince ???
+ return (_taccess(file_path, 0) == 0);
# endif
#endif
}
# ifdef _MSC_VER
return ((GetFileAttributes(file_path) & FILE_ATTRIBUTE_READONLY) != 0);
# else
- return (_taccess(file_path, 2) != 0); // not supported on wince ???
+ return (_taccess(file_path, 2) != 0);
# endif
#endif
}
-void FILEIO::RemoveFile(const _TCHAR *file_path)
+bool FILEIO::RemoveFile(const _TCHAR *file_path)
{
#if defined(_USE_QT) || defined(_USE_SDL)
- std::remove(file_path);
+ return (remove(file_path) == 0);
#else
# ifdef _MSC_VER
- DeleteFile(file_path);
+ return (DeleteFile(file_path) != 0);
# else
- _tremove(file_path); // not supported on wince ???
+ return (_tremove(file_path) == 0); // not supported on wince ???
# endif
#endif
}
+bool FILEIO::RenameFile(const _TCHAR *existing_file_path, const _TCHAR *new_file_path)
+{
+#if defined(_USE_QT)
+ return (rename(existing_file_path, new_file_path) == 0);
+ #else
+ #ifdef _MSC_VER
+ return (MoveFile(existing_file_path, new_file_path) != 0);
+ #else
+ return (_trename(existing_file_path, new_file_path) == 0);
+ #endif
+#endif
+}
+
bool FILEIO::Fopen(const _TCHAR *file_path, int mode)
{
Fclose();
char buffer[1024];
va_start(ap, format);
-#if defined(MSC_VER)
- vsprintf_s(buffer, 1024, format, ap);
-#else
- vsnprintf(buffer, 1024, format, ap);
-#endif
+ my_vsprintf_s(buffer, 1024, format, ap);
va_end(ap);
-#if defined(MSC_VER)
- return fprintf_s(fp, "%s", buffer);
-#else
- return fprintf(fp, "%s", buffer);
-#endif
+ return my_fprintf_s(fp, "%s", buffer);
}
uint32 FILEIO::Fread(void* buffer, uint32 size, uint32 count)
static bool IsFileExists(const _TCHAR *file_path);
static bool IsFileProtected(const _TCHAR *file_path);
- static void RemoveFile(const _TCHAR *file_path);
+ static bool RemoveFile(const _TCHAR *file_path);
+ static bool FILEIO::RenameFile(const _TCHAR *existing_file_path, const _TCHAR *new_file_path);
bool Fopen(const _TCHAR *file_path, int mode);
void Fclose();
hireso = (vt_total > 400);
}
#endif
+ //printf("IO WRITE:%04x %02x CPU_PC=%04x\n", addr, data & 0xff, d_cpu->get_pc());
if(is_dma) {
d_io->write_dma_io8(addr, data & 0xff);
} else {
}
vdisp = val;
}
+ //printf("IO READ:%04x %02x CPU_PC=%04x\n", addr, val, d_cpu->get_pc());
switch(addr & 0xff00) {
case 0x1900: // sub cpu
case 0x1b00: // psg
0x00, 0x00, 0xdb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
+static const uint8 keycode_kb[256] = { // kana (mode b)
+ 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x08, 0x09, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0xe8, 0x00, 0x00, 0x00,
+ 0x20, 0x0e, 0x0f, 0x11, 0x0b, 0x1d, 0x1e, 0x1c, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x12, 0x08, 0x00,
+ 0xc9, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xc5, 0xc6, 0xc7, 0xc8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0xbb, 0xc4, 0xc2, 0xbd, 0xb8, 0xbe, 0xbf, 0xcf, 0xcc, 0xd0, 0xd1, 0xd2, 0xd5, 0xd4, 0xcd,
+ 0xce, 0xb6, 0xb9, 0xbc, 0xba, 0xcb, 0xc3, 0xb7, 0xc1, 0xca, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x2a, 0x2b, 0xc8, 0x2d, 0x2e, 0xd2,
+ 0x71, 0x72, 0x73, 0x74, 0x75, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xd3, 0xd6, 0xd7, 0xdc, 0xa6,
+ 0xda, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdb, 0xd9, 0xdf, 0xd8, 0x00,
+ 0x00, 0x00, 0xdd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+static const uint8 keycode_ksb[256] = { // kana+shift (mode b)
+ 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x12, 0x09, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0xe8, 0x00, 0x00, 0x00,
+ 0x20, 0x0e, 0x0f, 0x11, 0x0c, 0x1d, 0x1e, 0x1c, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x12, 0x08, 0x00,
+ 0xc9, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xc5, 0xc6, 0xc7, 0xc8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0xbb, 0xc4, 0xaf, 0xbd, 0xb8, 0xbe, 0xbf, 0xcf, 0xcc, 0xd0, 0xd1, 0xd2, 0xad, 0xac, 0xcd,
+ 0xce, 0xb6, 0xb9, 0xbc, 0xba, 0xcb, 0xc3, 0xb7, 0xc1, 0xca, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x2a, 0x2b, 0xa4, 0x2d, 0x2e, 0xa5,
+ 0x76, 0x77, 0x78, 0x79, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0xd3, 0xae, 0xd7, 0xa4, 0xa1,
+ 0xda, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa2, 0x20, 0xa3, 0xd8, 0x00,
+ 0x00, 0x00, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
void PSUB::initialize()
{
}
if(key_kana_locked) {
if(!(l & 0x02)) {
+#ifdef _X1TURBO_FEATURE
+ if(config.device_type != 0) {
+ h = keycode_ksb[code]; // kana+shift (mode b)
+ } else
+#endif
h = keycode_ks[code]; // kana+shift
} else {
+#ifdef _X1TURBO_FEATURE
+ if(config.device_type != 0) {
+ h = keycode_kb[code]; // kana (mode b)
+ } else
+#endif
h = keycode_k[code]; // kana
}
} else {
// sio->set_rx_clock(0, 9600 * 16); // clock is from Z-80CTC ch1 (2MHz/13)
// sio->set_tx_clock(1, 4800 * 16); // 4800 baud for mouse
// sio->set_rx_clock(1, 4800 * 16); // clock is from Z-80CTC ch2 (2MHz/26)
-
+ //event->register_frame_event(crtc);
+ //event->register_vline_event(crtc);
+ //event->register_frame_event(display);
+ //event->register_vline_event(display);
+
if(sound_device_type >= 1) {
ctc1->set_context_zc0(ctc1, SIG_Z80CTC_TRIG_3, 1);
// ctc1->set_constant_clock(1, CPU_CLOCKS >> 1);
io->set_iomap_single_w(0x1fe0, display);
#endif
// 0x1ff0: dipswitch
-// io->set_iovalue_single_r(0x1ff0, 0x00);
+ //io->set_iovalue_single_r(0x1ff0, 0x00);
update_dipswitch();
#endif
io->set_iomap_range_rw(0x2000, 0x3fff, display); // tvram
#endif
// device informations for virtual machine (x1)
-//#ifdef _X1TURBO_FEATURE
+#ifdef _X1TURBO_FEATURE
//24KHz
-//#define FRAMES_PER_SEC 55.49
-//#define LINES_PER_FRAME 448
-//#define CHARS_PER_LINE 56
-//#define HD46505_HORIZ_FREQ 24860
-//#else
+#define FRAMES_PER_SEC 55.49
+#define LINES_PER_FRAME 448
+#define CHARS_PER_LINE 56
+#define HD46505_HORIZ_FREQ 24860
+#else
// 15KHz
#define FRAMES_PER_SEC 61.94
#define LINES_PER_FRAME 258
#define CHARS_PER_LINE 56
#define HD46505_HORIZ_FREQ 15980
-//#endif
+#endif
#define CPU_CLOCKS 4000000
#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 400