OSDN Git Service

[VM][COMMON_VM] (Re) Add I8253 and Z80CTC to libCSPcommon_vm.
authorK.Ohta <whatisthis.sowhat@gmail.com>
Tue, 30 May 2017 11:47:37 +0000 (20:47 +0900)
committerK.Ohta <whatisthis.sowhat@gmail.com>
Tue, 30 May 2017 11:47:37 +0000 (20:47 +0900)
28 files changed:
source/build-cmake/cmake/config_emufmr50.cmake
source/build-cmake/cmake/config_emupasopia.cmake
source/build-cmake/cmake/config_emupc9801.cmake
source/build-cmake/cmake/config_mz2500.cmake
source/build-cmake/cmake/config_mz5500.cmake
source/build-cmake/cmake/config_mz700.cmake
source/build-cmake/cmake/config_mz80.cmake
source/build-cmake/cmake/config_pc8801.cmake
source/build-cmake/cmake/config_pc98ha.cmake
source/build-cmake/cmake/config_qc10.cmake
source/build-cmake/cmake/config_x1.cmake
source/build-cmake/fm16pi/CMakeLists.txt
source/build-cmake/fmr30_i286/CMakeLists.txt
source/build-cmake/fmr30_i86/CMakeLists.txt
source/build-cmake/j3100gt/CMakeLists.txt
source/build-cmake/j3100sl/CMakeLists.txt
source/build-cmake/jx/CMakeLists.txt
source/build-cmake/m5/CMakeLists.txt
source/build-cmake/mz2800/CMakeLists.txt
source/build-cmake/mz3500/CMakeLists.txt
source/build-cmake/n5200/CMakeLists.txt
source/src/vm/common_vm/CMakeLists.txt
source/src/vm/hd46505.cpp
source/src/vm/i8253.cpp
source/src/vm/i8253.h
source/src/vm/io.h
source/src/vm/z80ctc.cpp
source/src/vm/z80ctc.h

index 561243c..11ee989 100644 (file)
@@ -12,8 +12,6 @@ set(WITH_JOYSTICK OFF)
 set(WITH_MOUSE ON)
 
 set(VMFILES
-
-                  i8253.cpp
                   msm58321.cpp
                   scsi_dev.cpp
                   scsi_host.cpp
@@ -30,8 +28,7 @@ set(VMFILES_LIB
                   mb8877.cpp
                   hd46505.cpp
                   upd71071.cpp
-#                 i8253.cpp
-
+                  i8253.cpp
                   i8251.cpp
                   i8253.cpp
                   i8259.cpp
index daf966b..a3cde29 100644 (file)
@@ -13,9 +13,6 @@ set(WITH_MOUSE OFF)
 set(FLAG_USE_Z80 ON)
 set(VMFILES
                   i8255.cpp
-                  
-                  z80ctc.cpp
-                  
                   io.cpp
                   event.cpp
 )
@@ -24,6 +21,7 @@ set(VMFILES_LIB
                   ls393.cpp
                   not.cpp
                   z80pio.cpp
+                  z80ctc.cpp
                   pcm1bit.cpp
                   upd765a.cpp
                   disk.cpp
index e1b1e60..cd63417 100644 (file)
@@ -6,7 +6,6 @@ set(WITH_MOUSE ON)
 
 set(VMFILES
                   i8237.cpp
-                  i8253.cpp
                   upd7220.cpp
 
                   event.cpp
index 146b815..025c7e6 100644 (file)
@@ -22,7 +22,6 @@ set(VMFILES_LIB_2500
 )
 
 set(VMFILES_BASE
-                  i8253.cpp               
                   mz1p17.cpp
 
                   event.cpp
@@ -32,7 +31,7 @@ set(VMFILES_BASE
                   )
 set(VMFILES_LIB
                   datarec.cpp
-#                 i8253.cpp
+                  i8253.cpp
                   i8255.cpp
 
                   pcm1bit.cpp
index 87cd1d9..05b011f 100644 (file)
@@ -8,12 +8,10 @@ set(WITH_MOUSE ON)
 
 set(VMFILES
 #                 i286.cpp
-                  
                   i8237.cpp
+                  mz1p17.cpp
                   
                   upd7220.cpp
-                  z80ctc.cpp
-                  mz1p17.cpp
                   
                   event.cpp
                   io.cpp
@@ -31,6 +29,7 @@ set(VMFILES_LIB
                   upd7220_base.cpp
                   upd765a.cpp
                   ym2203.cpp
+                  z80ctc.cpp
                   z80sio.cpp
                   
                   disk.cpp
index df6a8a1..6a38fd5 100644 (file)
@@ -11,7 +11,6 @@ set(WITH_MOUSE ON)
 
 set(FLAG_USE_Z80 ON)
 set(VMFILES_BASE
-                  i8253.cpp
                   event.cpp
                   io.cpp
                   memory.cpp
@@ -29,7 +28,7 @@ set(VMFILES_MZ1500 ${VMFILES_MZ800}
 set(VMFILES_LIB
           datarec.cpp
           i8255.cpp
-#         i8253.cpp
+          i8253.cpp
                   
           beep.cpp
           pcm1bit.cpp
index 5ed2057..8ddc0b7 100644 (file)
@@ -14,9 +14,6 @@ set(WITH_JOYSTICK OFF)
 set(WITH_MOUSE OFF)
 
 set(VMFILES_BASE
-                  i8253.cpp
-                  i8255.cpp
-                  prnfile.cpp
                   mz1p17.cpp
                   event.cpp
                   io.cpp
@@ -25,10 +22,12 @@ set(VMFILES_BASE
 
 set(VMFILES_LIB
           beep.cpp
-#         i8253.cpp
           datarec.cpp
+          i8253.cpp
+          i8255.cpp
           ls393.cpp
           pcm1bit.cpp
+          prnfile.cpp
 )                 
 set(FLAG_USE_Z80 ON)              
 
index 6bb001d..74b88cb 100644 (file)
@@ -8,10 +8,9 @@ set(WITH_JOYSTICK ON)
 set(WITH_MOUSE ON)
 
 set(VMFILES
-                  z80ctc.cpp
-                  event.cpp
-                  io.cpp
-                  memory.cpp
+               event.cpp
+               io.cpp
+               memory.cpp
 )
 set(VMFILES_LIB
                beep.cpp
@@ -24,8 +23,9 @@ set(VMFILES_LIB
                upd1990a.cpp
                upd765a.cpp
                ym2203.cpp
-               z80pio.cpp
+               z80ctc.cpp
                z80dma.cpp
+               z80pio.cpp
                z80sio.cpp
                disk.cpp
                
@@ -68,7 +68,7 @@ endif()
 add_definitions(-DPC88_EXRAM_BANKS=${PC88_EXTRAM_PAGES})
 
 if(USE_PCG)
-  set(VMFILES ${VMFILES}
+  set(VMFILES_LIB ${VMFILES_LIB}
             i8253.cpp
       )      
   add_definitions(-DSUPPORT_PC88_PCG8100)
index aa7c0fa..ba204b7 100644 (file)
@@ -5,7 +5,6 @@ set(WITH_JOYSTICK ON)
 set(WITH_MOUSE ON)
 
 set(VMFILES
-                  i8253.cpp
                   event.cpp
                   io.cpp
                   memory.cpp
@@ -13,7 +12,7 @@ set(VMFILES
 set(VMFILES_LIB
                   beep.cpp
                   i8251.cpp
-#                 i8253.cpp
+                  i8253.cpp
                   i8255.cpp
                   i8259.cpp
                   ls244.cpp
index d391b14..4c3e1a8 100644 (file)
@@ -6,16 +6,13 @@ set(WITH_MOUSE OFF)
 set(FLAG_USE_Z80 ON)
 set(VMFILES
                   i8237.cpp
-                  i8253.cpp
                   upd7220.cpp
-                  
                   io.cpp
-                  
                   event.cpp
 )
 set(VMFILES_LIB
                   i8237_base.cpp
-#                 i8253.cpp
+                  i8253.cpp
                   i8255.cpp
                   i8259.cpp
                   upd7220_base.cpp
index 0666bf6..9ba8e63 100644 (file)
@@ -13,10 +13,7 @@ set(USE_FMGEN ON)
 set(WITH_JOYSTICK ON)
 set(WITH_MOUSE ON)
 set(VMFILES
-                  z80ctc.cpp
-
                   event.cpp
-                  
                   io.cpp
                   mz1p17.cpp
 )
@@ -30,6 +27,7 @@ set(VMFILES_LIB
                   upd1990a.cpp
                   ym2151.cpp
 #                 ym2203.cpp
+                  z80ctc.cpp
                   z80sio.cpp
                   z80pio.cpp
                   
index 57bae09..a171c93 100644 (file)
@@ -22,7 +22,6 @@ set(WITH_MOUSE ON)
 
 set(VMFILES
 #                 i286.cpp
-                  i8253.cpp
                   msm58321.cpp
                   event.cpp
                   io.cpp
index 2ef27f6..5a80261 100644 (file)
@@ -18,7 +18,6 @@ set(USE_FMGEN OFF)
 set(VMFILES
 #                 i286.cpp     
                   i8237.cpp
-                  i8253.cpp
                   fmr50/bios.cpp
                   
                   scsi_dev.cpp
@@ -32,7 +31,7 @@ set(VMFILES
 set(VMFILES_LIB
                   pcm1bit.cpp
                   i8251.cpp
-#                 i8253.cpp
+                  i8253.cpp
                   i8259.cpp
                   i8237_base.cpp
                   sn76489an.cpp
index dd9f7f0..88c0282 100644 (file)
@@ -18,7 +18,6 @@ set(USE_FMGEN OFF)
 set(VMFILES
 #                 i286.cpp
                   i8237.cpp
-                  i8253.cpp
                   fmr50/bios.cpp
                   
                   scsi_dev.cpp
@@ -32,7 +31,7 @@ set(VMFILES
 set(VMFILES_LIB
                   pcm1bit.cpp
                   i8251.cpp
-#                 i8253.cpp
+                  i8253.cpp
                   i8259.cpp
                   i8237_base.cpp
                   sn76489an.cpp
index 8ca8bee..b507dbb 100644 (file)
@@ -21,13 +21,12 @@ set(WITH_MOUSE ON)
 
 set(VMFILES
                   i8237.cpp
-                  i8253.cpp
                   io.cpp
                   event.cpp
 )
 set(VMFILES_LIB
                   i8237_base.cpp
-#                 i8253.cpp
+                  i8253.cpp
                   i8259.cpp
                   hd46505.cpp
                   pcm1bit.cpp
index b0fa8e0..7a36dfd 100644 (file)
@@ -21,14 +21,13 @@ set(WITH_MOUSE ON)
 
 set(VMFILES
                   i8237.cpp
-                  i8253.cpp
                   io.cpp
                   event.cpp
 )
 
 set(VMFILES_LIB
                   i8237_base.cpp
-#                 i8253.cpp
+                  i8253.cpp
                   i8259.cpp
                   hd46505.cpp
                   pcm1bit.cpp
index 620f553..fb7df3e 100644 (file)
@@ -23,15 +23,13 @@ set(WITH_MOUSE ON)
 
 set(VMFILES_BASE
 #      i86.cpp
-
-      i8253.cpp
       io.cpp
       memory.cpp
       event.cpp
 )
 set(VMFILES_LIB
       i8251.cpp
-#      i8253.cpp
+      i8253.cpp
       i8255.cpp
       i8259.cpp
          
index dd59910..267db24 100644 (file)
@@ -23,7 +23,6 @@ set(WITH_MOUSE ON)
 
 set(FLAG_USE_Z80 ON)
 set(VMFILES_BASE
-      z80ctc.cpp
       memory.cpp
   
       io.cpp
@@ -34,6 +33,7 @@ set(VMFILES_LIB
       datarec.cpp
       sn76489an.cpp
       tms9918a.cpp
+      z80ctc.cpp
 )
 set(USE_OPENMP ON CACHE BOOL "Build using OpenMP")
 set(USE_OPENGL ON CACHE BOOL "Build using OpenGL")
index 325a2a2..8ab9241 100644 (file)
@@ -19,14 +19,13 @@ set(WITH_JOYSTICK ON)
 set(WITH_MOUSE ON) 
 
 set(VMFILES
-                  i8253.cpp
                   mz1p17.cpp
                   
                   event.cpp
                   io.cpp
 )
 set(VMFILES_LIB
-#                 i8253.cpp
+                  i8253.cpp
                   i8255.cpp
                   i8259.cpp
                   rp5c01.cpp
index 7a7309c..0f9b912 100644 (file)
@@ -20,7 +20,6 @@ set(WITH_MOUSE ON)
 
 set(VMFILES
 #         z80.cpp
-          i8253.cpp
           
           upd7220.cpp
    
@@ -30,7 +29,7 @@ set(VMFILES
 )
 set(VMFILES_LIB
           i8251.cpp
-#         i8253.cpp
+          i8253.cpp
           i8255.cpp
                   
           ls244.cpp
index 0f229d4..de92d8f 100644 (file)
@@ -24,7 +24,6 @@ set(WITH_MOUSE ON)
 set(VMFILES_BASE
 #                  i386.cpp
                   i8237.cpp
-                  i8253.cpp
                   upd7220.cpp
                   
                   io.cpp
@@ -34,7 +33,7 @@ set(VMFILES_LIB
                   beep.cpp
                   i8237_base.cpp
                   i8251.cpp
-#                 i8253.cpp
+                  i8253.cpp
                   i8255.cpp
                   i8259.cpp
                   upd1990a.cpp
index b1c19ff..77fd1b3 100644 (file)
@@ -21,7 +21,7 @@ set(s_vm_common_vm_srcs
        ../i8155.cpp
        ../i8237_base.cpp
        ../i8251.cpp
-#      ../i8253.cpp
+       ../i8253.cpp
        ../i8255.cpp
        ../i8259.cpp
 #      ../i86.cpp
@@ -85,7 +85,7 @@ set(s_vm_common_vm_srcs
        ../ym2203.cpp
        ../ym2413.cpp
        ../z80_base.cpp
-#      ../z80ctc.cpp
+       ../z80ctc.cpp
        ../z80dma.cpp
        ../z80pio.cpp
        ../z80sio.cpp
@@ -144,8 +144,8 @@ else()
     ${s_vm_common_vm_srcs}
   )
   set_target_properties(CSPcommon_vm PROPERTIES 
-     SOVERSION 1.1.11
-     VERSION 1.1.11
+     SOVERSION 1.1.12
+     VERSION 1.1.12
   )
   INSTALL(TARGETS CSPcommon_vm DESTINATION ${LIBCSP_INSTALL_DIR})
 endif()
index 30a7e39..d779769 100644 (file)
@@ -21,10 +21,10 @@ void HD46505::initialize()
        } else {
                _CHARS_PER_LINE = -1;
        }
-       if(osd->cehck_feature(_T("SCREEN_WIDTH"))) {
+       if(osd->check_feature(_T("SCREEN_WIDTH"))) {
                _SCREEN_WIDTH = osd->get_feature_int_value(_T("SCREEN_WIDTH"));
        }
-       if(osd->cehck_feature(_T("SCREEN_HEIGHT"))) {
+       if(osd->check_feature(_T("SCREEN_HEIGHT"))) {
                _SCREEN_HEIGHT = osd->get_feature_int_value(_T("SCREEN_HEIGHT"));
        }
        if(osd->check_feature(_T("LINES_PER_FRAME"))) {
@@ -32,11 +32,11 @@ void HD46505::initialize()
        } else {
                _LINES_PER_FRAME = 64;
        }
-       if(osd->chack_keature(_T("HD46505_CHAR_CLOCK"))) {
+       if(osd->check_feature(_T("HD46505_CHAR_CLOCK"))) {
                _E_HD46505_CHAR_CLOCK = true;
                _HD46505_CHAR_CLOCK = osd->get_feature_double_value(_T("HD46505_CHAR_CLOCK"));
        }
-       if(osd->chack_keature(_T("HD46505_HORIZ_FREQ"))) {
+       if(osd->check_feature(_T("HD46505_HORIZ_FREQ"))) {
                _E_HD46505_HORIZ_FREQ = true;
                _HD46505_HORIZ_FREQ = osd->get_feature_double_value(_T("HD46505_HORIZ_FREQ"));
        }
@@ -80,7 +80,7 @@ void HD46505::reset()
        disp_end_clock = 0;
        
 //#if defined(HD46505_CHAR_CLOCK)
-       if(_E__HD46505_CHAR_CLOCK) {
+       if(_E_HD46505_CHAR_CLOCK) {
                char_clock = 0;
                next_char_clock = _HD46505_CHAR_CLOCK;
        } else 
@@ -174,7 +174,7 @@ void HD46505::update_timing(int new_clocks, double new_frames_per_sec, int new_l
 {
        cpu_clocks = new_clocks;
 //#if !defined(HD46505_CHAR_CLOCK) && !defined(HD46505_HORIZ_FREQ)
-       if((!_E_HD46505_CHAR_CLOCK) && (!_E_HD46505_HORIZ_FREQ) {
+       if((!_E_HD46505_CHAR_CLOCK) && (!_E_HD46505_HORIZ_FREQ)) {
                frames_per_sec = new_frames_per_sec;
        }
 //#endif
index 9ee59df..543005d 100644 (file)
@@ -11,6 +11,8 @@
 
 void I8253::initialize()
 {
+       DEVICE::initialize();
+       __HAS_I8254 = osd->check_feature(_T("HAS_I8254"));
        for(int ch = 0; ch < 3; ch++) {
                counter[ch].prev_out = true;
                counter[ch].prev_in = false;
@@ -24,11 +26,13 @@ void I8253::initialize()
                counter[ch].low_write = counter[ch].high_write = false;
                counter[ch].delay = false;
                counter[ch].start = false;
-#ifdef HAS_I8254
-               // 8254 read-back command
-               counter[ch].null_count = true;
-               counter[ch].status_latched = false;
-#endif
+//#ifdef HAS_I8254
+               if(__HAS_I8254) {
+                       // 8254 read-back command
+                       counter[ch].null_count = true;
+                       counter[ch].status_latched = false;
+               }
+//#endif
        }
 }
 
@@ -69,9 +73,9 @@ void I8253::write_io8(uint32_t addr, uint32_t data)
                        }
                        counter[ch].high_write = false;
                }
-#ifdef HAS_I8254
-               counter[ch].null_count = true;
-#endif
+//#ifdef HAS_I8254
+               if(__HAS_I8254) counter[ch].null_count = true;
+//#endif
                // set signal
                if(counter[ch].mode == 0) {
                        set_signal(ch, false);
@@ -95,25 +99,27 @@ void I8253::write_io8(uint32_t addr, uint32_t data)
                
        case 3: // ctrl reg
                if((data & 0xc0) == 0xc0) {
-#ifdef HAS_I8254
-                       // i8254 read-back command
-                       for(ch = 0; ch < 3; ch++) {
-                               uint8_t bit = 2 << ch;
-                               if(!(data & 0x10) && !counter[ch].status_latched) {
-                                       counter[ch].status = counter[ch].ctrl_reg & 0x3f;
-                                       if(counter[ch].prev_out) {
-                                               counter[ch].status |= 0x80;
+//#ifdef HAS_I8254
+                       if(__HAS_I8254) {
+                               // i8254 read-back command
+                               for(ch = 0; ch < 3; ch++) {
+                                       uint8_t bit = 2 << ch;
+                                       if(!(data & 0x10) && !counter[ch].status_latched) {
+                                               counter[ch].status = counter[ch].ctrl_reg & 0x3f;
+                                               if(counter[ch].prev_out) {
+                                                       counter[ch].status |= 0x80;
+                                               }
+                                               if(counter[ch].null_count) {
+                                                       counter[ch].status |= 0x40;
+                                               }
+                                               counter[ch].status_latched = true;
                                        }
-                                       if(counter[ch].null_count) {
-                                               counter[ch].status |= 0x40;
+                                       if(!(data & 0x20) && !counter[ch].count_latched) {
+                                               latch_count(ch);
                                        }
-                                       counter[ch].status_latched = true;
-                               }
-                               if(!(data & 0x20) && !counter[ch].count_latched) {
-                                       latch_count(ch);
                                }
                        }
-#endif
+//#endif
                        break;
                }
                ch = (data >> 6) & 3;
@@ -137,9 +143,9 @@ void I8253::write_io8(uint32_t addr, uint32_t data)
                                stop_count(ch);
                                counter[ch].count_reg = 0;
 //                     }
-#ifdef HAS_I8254
-                       counter[ch].null_count = true;
-#endif
+//#ifdef HAS_I8254
+                               if(__HAS_I8254) counter[ch].null_count = true;
+//#endif
                } else if(!counter[ch].count_latched) {
                        latch_count(ch);
                }
@@ -155,12 +161,14 @@ uint32_t I8253::read_io8(uint32_t addr)
        case 0:
        case 1:
        case 2:
-#ifdef HAS_I8254
-               if(counter[ch].status_latched) {
-                       counter[ch].status_latched = false;
-                       return counter[ch].status;
+//#ifdef HAS_I8254
+               if(__HAS_I8254) {
+                       if(counter[ch].status_latched) {
+                               counter[ch].status_latched = false;
+                               return counter[ch].status;
+                       }
                }
-#endif
+//#endif
                // if not latched, through current count
                if(!counter[ch].count_latched) {
                        if(!counter[ch].low_read && !counter[ch].high_read) {
@@ -242,9 +250,9 @@ void I8253::input_clock(int ch, int clock)
                clock -= 1;
                counter[ch].delay = false;
                counter[ch].count = COUNT_VALUE(ch);
-#ifdef HAS_I8254
-               counter[ch].null_count = false;
-#endif
+//#ifdef HAS_I8254
+               if(__HAS_I8254) counter[ch].null_count = false;
+//#endif
        }
        
        // update counter
@@ -267,9 +275,9 @@ loop:
        if(counter[ch].count <= 0) {
                if(counter[ch].mode == 0 || counter[ch].mode == 2 || counter[ch].mode == 3) {
                        counter[ch].count += tmp;
-#ifdef HAS_I8254
-                       counter[ch].null_count = false;
-#endif
+//#ifdef HAS_I8254
+                       if(__HAS_I8254) counter[ch].null_count = false;
+//#endif
                        goto loop;
                } else {
                        counter[ch].start = false;
@@ -429,11 +437,13 @@ void I8253::save_state(FILEIO* state_fio)
                state_fio->FputInt32(counter[i].mode);
                state_fio->FputBool(counter[i].delay);
                state_fio->FputBool(counter[i].start);
-#ifdef HAS_I8254
-               state_fio->FputBool(counter[i].null_count);
-               state_fio->FputBool(counter[i].status_latched);
-               state_fio->FputUint8(counter[i].status);
-#endif
+//#ifdef HAS_I8254
+               if(__HAS_I8254) {
+                       state_fio->FputBool(counter[i].null_count);
+                       state_fio->FputBool(counter[i].status_latched);
+                       state_fio->FputUint8(counter[i].status);
+               }
+//#endif
                state_fio->FputUint64(counter[i].freq);
                state_fio->FputInt32(counter[i].register_id);
                state_fio->FputUint32(counter[i].input_clk);
@@ -467,11 +477,13 @@ bool I8253::load_state(FILEIO* state_fio)
                counter[i].mode = state_fio->FgetInt32();
                counter[i].delay = state_fio->FgetBool();
                counter[i].start = state_fio->FgetBool();
-#ifdef HAS_I8254
-               counter[i].null_count = state_fio->FgetBool();
-               counter[i].status_latched = state_fio->FgetBool();
-               counter[i].status = state_fio->FgetUint8();
-#endif
+//#ifdef HAS_I8254
+               if(__HAS_I8254) {
+                       counter[i].null_count = state_fio->FgetBool();
+                       counter[i].status_latched = state_fio->FgetBool();
+                       counter[i].status = state_fio->FgetUint8();
+               }
+//#endif
                counter[i].freq = state_fio->FgetUint64();
                counter[i].register_id = state_fio->FgetInt32();
                counter[i].input_clk = state_fio->FgetUint32();
index a54ca00..125d9ea 100644 (file)
@@ -10,8 +10,8 @@
 #ifndef _I8253_H_
 #define _I8253_H_
 
-#include "vm.h"
-#include "../emu.h"
+//#include "vm.h"
+//#include "../emu.h"
 #include "device.h"
 
 #define SIG_I8253_CLOCK_0      0
@@ -38,11 +38,11 @@ private:
                int mode;
                bool delay;
                bool start;
-#ifdef HAS_I8254
+//#ifdef HAS_I8254
                bool null_count;
                bool status_latched;
                uint8_t status;
-#endif
+//#endif
                // constant clock
                uint64_t freq;
                int register_id;
@@ -53,6 +53,8 @@ private:
                outputs_t outputs;
        } counter[3];
        uint64_t cpu_clocks;
+
+       bool __HAS_I8254;
        
        void input_clock(int ch, int clock);
        void input_gate(int ch, bool signal);
@@ -69,6 +71,7 @@ public:
                        initialize_output_signals(&counter[i].outputs);
                        counter[i].freq = 0;
                }
+               __HAS_I8254 = false;
                set_device_name(_T("8253 PIT"));
        }
        ~I8253() {}
index 7667dd1..452207b 100644 (file)
@@ -59,7 +59,7 @@ public:
 #ifdef _IO_DEBUG_LOG
                cpu_index = 0;
 #endif
-               set_device_name(_T("Generic I/O" Bus));
+               set_device_name(_T("Generic I/O Bus"));
        }
        ~IO() {}
        
index 9590537..733fe63 100644 (file)
 #define EVENT_COUNTER  0
 #define EVENT_TIMER    4
 
+void Z80CTC::initialize()
+{
+       DEVICE::initialize();
+       _E_Z80CTC_CLOCKS = osd->check_feature(_T("Z80CTC_CLOCKS"));
+       if(_E_Z80CTC_CLOCKS) {
+               __Z80CTC_CLOCKS = osd->get_feature_double_value(_T("Z80CTC_CLOCKS"));
+       }
+}
+
 void Z80CTC::reset()
 {
        for(int ch = 0; ch < 4; ch++) {
@@ -90,11 +99,15 @@ uint32_t Z80CTC::read_io8(uint32_t addr)
                }
        } else if(counter[ch].sysclock_id != -1) {
                int passed = get_passed_clock(counter[ch].prev);
-#ifdef Z80CTC_CLOCKS
-               uint32_t input = (uint32_t)(passed * Z80CTC_CLOCKS / cpu_clocks);
-#else
-               uint32_t input = passed;
-#endif
+               uint32_t input;
+//#ifdef Z80CTC_CLOCKS
+               if(_E_Z80CTC_CLOCKS) {
+                       input = (uint32_t)(passed * __Z80CTC_CLOCKS / cpu_clocks);
+               } else {                
+//#else
+                       input = passed;
+               }
+//#endif
                if(counter[ch].input <= input) {
                        input = counter[ch].input - 1;
                }
@@ -233,11 +246,14 @@ void Z80CTC::update_event(int ch, int err)
                }
                if(counter[ch].sysclock_id == -1) {
                        counter[ch].input = counter[ch].count * counter[ch].prescaler - counter[ch].clocks;
-#ifdef Z80CTC_CLOCKS
-                       counter[ch].period = (uint32_t)(counter[ch].input * cpu_clocks / Z80CTC_CLOCKS) + err;
-#else
-                       counter[ch].period = counter[ch].input + err;
-#endif
+//#ifdef Z80CTC_CLOCKS
+                       if(_E_Z80CTC_CLOCKS) {
+                               counter[ch].period = (uint32_t)(counter[ch].input * cpu_clocks / __Z80CTC_CLOCKS) + err;
+                       } else {
+//#else
+                               counter[ch].period = counter[ch].input + err;
+                       }
+//#endif
                        counter[ch].prev = get_current_clock() + err;
                        register_event_by_clock(this, EVENT_TIMER + ch, counter[ch].period, false, &counter[ch].sysclock_id);
                }
index b1a86cd..80b7c5a 100644 (file)
@@ -10,8 +10,8 @@
 #ifndef _Z80CTC_H_
 #define _Z80CTC_H_
 
-#include "vm.h"
-#include "../emu.h"
+//#include "vm.h"
+//#include "../emu.h"
 #include "device.h"
 
 #define SIG_Z80CTC_TRIG_0      0
@@ -49,6 +49,9 @@ private:
                outputs_t outputs;
        } counter[4];
        uint64_t cpu_clocks;
+
+       bool   _E_Z80CTC_CLOCKS;
+       double __Z80CTC_CLOCKS;
        
        void input_clock(int ch, int clock);
        void input_sysclock(int ch, int clock);
@@ -70,6 +73,8 @@ public:
                        counter[i].prev_in = false;
                }
                d_cpu = d_child = NULL;
+               _E_Z80CTC_CLOCKS = false;
+               __Z80CTC_CLOCKS = 1.0;
                set_device_name(_T("Z80 CTC"));
        }
        ~Z80CTC() {}