OSDN Git Service

[VM][FMTOWNS] Start to try building.Maybe imcomplete a lot.
authorK.Ohta <whatisthis.sowhat@gmail.com>
Sun, 19 Jan 2020 13:20:53 +0000 (22:20 +0900)
committerK.Ohta <whatisthis.sowhat@gmail.com>
Sun, 19 Jan 2020 13:20:53 +0000 (22:20 +0900)
16 files changed:
source/src/vm/fmtowns/CMakeLists.txt
source/src/vm/fmtowns/adpcm.cpp
source/src/vm/fmtowns/adpcm.h
source/src/vm/fmtowns/cdc.h
source/src/vm/fmtowns/floppy.cpp
source/src/vm/fmtowns/floppy.h
source/src/vm/fmtowns/fmtowns.cpp
source/src/vm/fmtowns/keyboard.cpp
source/src/vm/fmtowns/keyboard.h
source/src/vm/fmtowns/rf5c68.cpp
source/src/vm/fmtowns/scsi.cpp
source/src/vm/fmtowns/scsi.h
source/src/vm/fmtowns/timer.cpp
source/src/vm/fmtowns/timer.h
source/src/vm/fmtowns/towns_cdrom.cpp
source/src/vm/fmtowns/towns_cdrom.h

index d933970..9d7199f 100644 (file)
@@ -2,26 +2,37 @@ cmake_minimum_required (VERSION 2.6)
 
 message("* vm/fm-towns")
 
-add_library(vm_fmtowns
-
+set(VM_FMTOWNS_DEV_SRCS
        ad7820kr.cpp
        rf5c68.cpp
        
        adpcm.cpp
+       cdc.cpp
        floppy.cpp
        keyboard.cpp
        scsi.cpp
        timer.cpp
-
-       serialrom.cpp
-       towns_sysrom.cpp
-       towns_dictionary.cpp
-       msdosrom.cpp
+       towns_dmac.cpp
        
        fontroms.cpp
+       msdosrom.cpp
+       serialrom.cpp
+       townd_dictionary.cpp
        
+       towns_cdrom.cpp
        towns_crtc.cpp
        towns_memory.cpp
        towns_sprite.cpp
+       towns_sysrom.cpp
        towns_vram.cpp
+
+       fmtowns.cpp
 )
+
+if(BUILD_WITH_20PIX)
+  set(VM_FMTOWNS_DEV_SRCS ${VM_FMTOWNS_DEV_SRCS} fontrom_20pix.cpp)
+endif()
+
+add_library(vm_fmtowns
+       ${VM_FMTOWNS_DEV_SRCS}
+)      
index e35699e..037e3d1 100644 (file)
@@ -45,7 +45,8 @@ void ADPCM::reset()
        if(event_adpcm_clock >= 0) {
                cancel_event(this, event_adpcm_clock);
        }
-       register_event(this, EVENT_ADPCM_CLOCK, 16.0e6 / (384.0 * 2.0), true, &event_adpcm_clock); // Is this true?
+       // Tick is (8.0e6 / 384.0)[Hz] .. Is this true?
+       register_event(this, EVENT_ADPCM_CLOCK, 1.0e6 / (16.0 / (384.0 * 2.0)), true, &event_adpcm_clock);
 }
 
 void ADPCM::initialize_adc_clock(int freq)
@@ -154,7 +155,7 @@ void ADPCM::write_io8(uint32_t addr, uint32_t data)
        case 0xd5:
                opn2_mute = ((data & 0x02) == 0) ? true : false;
                adpcm_mute =  ((data & 0x01) == 0) ? true : false;
-               //d_opn2->write_signal(SIG_YM2612_MUTE, (opn2_mute) ? 0xffffffff : 0x00000000, 0xffffffff);
+               d_opn2->write_signal(SIG_YM2612_MUTE, (opn2_mute) ? 0xffffffff : 0x00000000, 0xffffffff);
                d_rf5c68->write_signal(SIG_RF5C68_MUTE, (adpcm_mute) ? 0xffffffff : 0x00000000, 0xffffffff);
                break;
        case 0xe8:
index 224a2b9..3643f44 100644 (file)
@@ -57,6 +57,11 @@ public:
                initialize_output_signals(&outputs_intr);
                initialize_output_signals(&outputs_led_control);
                initialize_output_signals(&outputs_allmute);
+               d_rf5c68 = NULL;
+               d_opn2 = NULL;
+               d_pic = NULL;
+               d_adc = NULL;
+
                for(int i = 0; i < 8; i++) {
                        dac_intr[i] = false;
                        dac_intr_mask[i] = true;
index ad55763..5f257e6 100644 (file)
 
 class SCSI_HOST;
 class FIFO;
-namespace TOWNS {
+namespace FMTOWNS {
        class TOWNS_CDROM;
 }
 
-namespace TOWNS {
+namespace FMTOWNS {
 class CDC : public DEVICE {
 protected:
        outputs_t output_dma_line;
index ed0c4e3..39fb3dd 100644 (file)
@@ -11,7 +11,7 @@
 #include "floppy.h"
 #include "../i8259.h"
 #include "../mb8877.h"
-
+namespace FMTOWNS {
 void FLOPPY::initialize()
 {
        drvreg = drvsel = 0;
@@ -108,4 +108,4 @@ bool FLOPPY::load_state(FILEIO* state_fio)
        state_fio->Fread(changed, sizeof(changed), 1);
        return true;
 }
-
+}
index 3a6da6c..d1725bf 100644 (file)
@@ -19,6 +19,7 @@
 
 class MB8877;
 
+namespace FMTOWNS {
 class FLOPPY : public DEVICE
 {
 private:
@@ -55,6 +56,7 @@ public:
                changed[drv] = true;
        }
 };
+}
 
 #endif
 
index 25d63df..a1a7c24 100644 (file)
 #include "../scsi_host.h"
 #include "../upd71071.h"
 
+#include "towns_cdrom.h"
 #include "towns_crtc.h"
+#include "towns_dictionary.h"
+#include "towns_dmac.h"
+#include "towns_memory.h"
+#include "towns_sprite.h"
+#include "towns_sysrom.h"
+#include "towns_vram.h"
 // Electric Volume
 //#include "mb87078.h"
 //YM-2612 "OPN2"
 #include "../debugger.h"
 #endif
 
-#include "cmos.h"
-#include "floppy.h"
-#include "keyboard.h"
-#include "memory.h"
-#include "scsi.h"
-//#include "serial.h"
-#include "timer.h"
+#include "./floppy.h"
+#include "./keyboard.h"
+#include "./msdosrom.h"
+#include "./scsi.h"
+#include "./serialrom.h"
+#include "./timer.h"
 
 // ----------------------------------------------------------------------------
 // initialize
 // ----------------------------------------------------------------------------
+using FMTOWNS::ADPCM;
+using FMTOWNS::CDC;
+using FMTOWNS::DICTIONARY;
+using FMTOWNS::FLOPPY;
+using FMTOWNS::FONT_ROMS;
+using FMTOWNS::KEYBOARD;
+using FMTOWNS::MSDOSROM;
+using FMTOWNS::SCSI;
+using FMTOWNS::SERIAL_ROM;
+using FMTOWNS::SYSROM;
+using FMTOWNS::TIMER;
+
+using FMTOWNS::TOWNS_CDROM;
+using FMTOWNS::TOWNS_CRTC;
+using FMTOWNS::TOWNS_DMAC;
+using FMTOWNS::TOWNS_MEMORY;
+using FMTOWNS::TOWNS_SPRITE;
+using FMTOWNS::TOWNS_VRAM;
+
 
 VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu)
 {
@@ -649,6 +674,12 @@ void VM::initialize_sound(int rate, int samples)
        // init sound gen
        beep->initialize_sound(rate, 8000);
 
+       // init OPN2
+       opn2->initialize_sound(rate, 1.0e6 / (16.0 / (384.0 * 2.0)), samples, 0.0, 0.0);
+
+       // init PCM
+       rf5c68->initialize_sound(rate, samples);
+       
        // add_sound_in_source() must add after per initialize_sound().
        adc_in_ch = event->add_sound_in_source(rate, samples, 2);
        mixer->set_context_out_line(adc_in_ch);
index 68bbfa0..c254727 100644 (file)
@@ -12,6 +12,7 @@
 #include "../i8259.h"
 #include "../../fifo.h"
 
+namespace FMTOWNS {
 void KEYBOARD::initialize()
 {
        key_buf = new FIFO(64);
@@ -132,4 +133,5 @@ bool KEYBOARD::load_state(FILEIO* state_fio)
        state_fio->Fread(table, sizeof(table), 1);
        return true;
 }
+}
 
index 47306a3..fe7db90 100644 (file)
 #include "../device.h"
 
 /*
-       \82Ð\82ç\82ª\82È/\83\8d\81[\83}\8e\9a       \82Ð\82ç\82ª\82È
-       \94¼\8ap/\91S\8ap               \94¼\8ap/\91S\8ap
-       \95Ï\8a·                    \95Ï\8a·
-       \96³\95Ï\8a·                  \96³\95Ï\8a·
-       \82©\82È/\8a¿\8e\9a
-       \83J\83^\83J\83i
-       \91O\8ds                    PgUp
-       \8e\9f\8ds                    PgDn
-       \8eÀ\8ds                    F12
-       \8eæ\8fÁ                    F11
+       ひらがな/ローマ字       ひらがな
+       半角/全角           半角/全角
+       変換                  変換
+       無変換                       無変換
+       かな/漢字
+       カタカナ
+       前行                  PgUp
+       次行                  PgDn
+       実行                  F12
+       取消                  F11
        COPY
 */
+namespace FMTOWNS {
 
 static const int key_table[256] = {
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x10,0x00,0x00,0x00,0x1D,0x00,0x00,
@@ -47,9 +48,11 @@ static const int key_table[256] = {
        0x00,0x00,0x34,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
 };
+}
 
 class FIFO;
 
+namespace FMTOWNS {
 class KEYBOARD : public DEVICE
 {
 private:
@@ -81,5 +84,6 @@ public:
        void key_down(int code);
        void key_up(int code);
 };
+}
 
 #endif
index 2c6a998..b3aa0f8 100644 (file)
@@ -359,6 +359,9 @@ void RF5C68::initialize_sound(int sample_rate, int samples)
                        event_dac_sample = -1;
                }
                if(mix_rate > 0) {
+                       // TOWNS::ADPCM::event_callback() -> SIG_RF5C68_DAC_PERIOD(=DRIVE CLOCK from VM)
+                       // -> RF5C68::event_callback()(=AUDIO MIXING CLOCK by EMU)
+                       // -> RF5C68::mix() -> OSD::SOUND
                        sample_tick_us = 1.0e6 / ((double)mix_rate);
                        register_event(this, EVENT_DAC_SAMPLE, sample_tick_us, true, &event_dac_sample);
                }
index 7d07d17..5559847 100644 (file)
@@ -29,6 +29,8 @@
 #define STATUS_INT     0x02
 #define STATUS_PERR    0x01
 
+namespace FMTOWNS {
+       
 void SCSI::reset()
 {
        ctrl_reg = CTRL_IMSK;
@@ -135,4 +137,4 @@ bool SCSI::load_state(FILEIO* state_fio)
        irq_status = state_fio->FgetBool();
        return true;
 }
-
+}
index 3f27b11..9be5e58 100644 (file)
@@ -18,6 +18,7 @@
 #define SIG_SCSI_IRQ   0
 #define SIG_SCSI_DRQ   1
 
+namespace FMTOWNS {
 class SCSI : public DEVICE
 {
 private:
@@ -54,6 +55,7 @@ public:
        void save_state(FILEIO* state_fio);
        bool load_state(FILEIO* state_fio);
 };
+}
 
 #endif
 
index 4afc043..4405867 100644 (file)
@@ -8,11 +8,13 @@
        [ timer ]
 */
 
-#include "timer.h"
+#include "./timer.h"
 #include "../i8259.h"
 #include "../msm58321.h"
 #include "../pcm1bit.h"
 
+namespace FMTOWNS {
+       
 void TIMER::initialize()
 {
        free_run_counter = 0;
@@ -113,3 +115,5 @@ bool TIMER::load_state(FILEIO* state_fio)
        return true;
 }
 
+}
+
index 1fbbd52..6503bd0 100644 (file)
@@ -19,6 +19,7 @@
 #define SIG_TIMER_CH1  1
 #define SIG_TIMER_RTC  2
 
+namespace FMTOWNS {
 class TIMER : public DEVICE
 {
 private:
@@ -55,6 +56,7 @@ public:
                d_rtc = device;
        }
 };
+}
 
 #endif
 
index 285067b..5d01891 100644 (file)
@@ -232,19 +232,15 @@ void TOWNS_CDROM::start_command()
        switch(command[0]) {
        case TOWNS_CDROM_CDDA_PLAY:
                play_cdda_from_cmd();
-               return;
                break;
        case TOWNS_CDROM_CDDA_PAUSE:
                pause_cdda_from_cmd();
-               return;
                break;
        case TOWNS_CDROM_CDDA_UNPAUSE:
                unpause_cdda_from_cmd();
-               return;
                break;
        case TOWNS_CDROM_CDDA_STOP:
                stop_cdda_from_cmd();
-               return;
                break;
        case SCSI_CMD_TST_U_RDY:
        case SCSI_CMD_INQUIRY:
@@ -257,12 +253,10 @@ void TOWNS_CDROM::start_command()
        case SCSI_CMD_READ12:
                SCSI_CDROM::start_command();
                set_subq(); // First
-               return;
                break;
        case 0xff:
                // End of List
                set_dat(SCSI_STATUS_CHKCOND);
-               return;
                break;
        default:
                #ifdef _SCSI_DEBUG_LOG
@@ -297,8 +291,6 @@ void TOWNS_CDROM::stop_cdda_from_cmd()
        set_subq();
 }
 
-
-
 void TOWNS_CDROM::play_cdda_from_cmd()
 {
        uint8_t m_start = command[3]; 
index 9bd60b3..f1685b0 100644 (file)
@@ -22,7 +22,6 @@
 #define TOWNS_CDROM_CDDA_UNPAUSE 0xf2
 #define TOWNS_CDROM_CDDA_STOP    0xf3
 
-
 class SCSI_HOST;
 class FIFO;
 class FILEIO;