** Qt porting and FM-7/77/AV/AV40/EX for Common Source Code Project **

                                                       August 01, 2021
                            K.Ohta  (whatisthis.sowhat _at_ gmail.com)

1.About

This package is Qt5 porting of Common Source Code Project (CSP)
and built with Qt5, for Windows, built with MinGW(32bit).

Source Code:

   https://github.com/Artanejp/common_source_project-fm7/releases/tag/SNAPSHOT_20210801
   
Additional INFO:

   Binaries will be available, distibute from osdn.net.
   
   See, https://osdn.net/projects/csp-qt/  and
        https://osdn.net/projects/csp-qt/releases/ .
	
   Released at:


2.Background

Common Source Code Project (CSP) is good emulator writing.
It also distributed with GPLv2, this is good for me.

But codes are specified to M$ Visual C.
I'm using GNU/Linux, and I starting to apply FM-7(or later).

So, I start to port to GNU/Linux and using Qt4/Qt5.

What you need at least:

a. Qt5 (neither Qt3 and Qt4) toolkit: Qt5.3 or later.

b. Some OpenGL implementation, maybe at leaset OpenGL v2.x .

c. gcc / g++ (5.0 or later? ) or llvm clang / clang++ (3.5 or later?) toolchain.

d. SDL2 (not SDL1.x).

e. CMake 2.8 or later.

f. Needs ffmpeg.See https://ffmpeg.org/ .

g. FFMpeg has bundled only for Win32.Please install for other OSs if not working.

h. Built with Qt5.5 (for Ubuntu 16.04LTS) or Qt 5.10 (for Win32 and Debian/Sid).

i. Now, changed default drawing infrastructure to OpenGL ES2.You can change --opengl option via comman line (or GUI).

j. Now for Win32 build, using LLVM CLANG cross toolchains on Docker environment.Because exception handling of MinGW-w64's gcc is very slowly (this cause by *evil* Borland).
  See https://github.com/Artanejp/llvm-mingw and https://hub.docker.com/r/artanejp/llvm-mingw64-ubuntu-cosmic for datails.
  
* TIPS: If emufoo.exe don't show screen drawing, set environment variable QT_OPENGL to software (i.e. Using Windows as VirtualBox's gueat OS).

3.How to build:

After extracting (or git pulled) sourcecodes:

$ cd {srctop}/source/build-cmake/{Machine name}/

$ mkdir build

$ cd build

To configure:

$ cmake ..

or

$ ccmake ..

To build:

$ make

To install:

$ sudo make install

4.Qt specified notice:
   
   ・Config file (scancode.cfg and foo.ini) has placed (moved) to
     "~/.config/CommonSourceCodeProject/emufoo/"
     (for Windows, ".\CommonSourceCodeProject\emudfoo\" ).
   
   ・BIOS, WAVS, BINS and SAVED STATES have placed (moved) to
     "~/CommonSourceCodeProject/emufoo/"
     (for Windows, ".\CommonSourceCodeProject\emudfoo\" ).
   
   ・All of recorded products (PNG Screenshots, MOVIES, SOUNDS) 
     have *temporally* written to "~/.config/CommonSourceCodeProject/emufoo/"
     (for Windows, ".\CommonSourceCodeProject\emudfoo\" ).
   
   ・Added ToolTips and Japanese translations.(2017-01-24)
   
   ・Place R@Ms under $HOME/CommonSourceCodeProject/emu{Machine Name}/ , this directory has made
     after first using.
   
   ・Config file, {foo}.ini is written on $HOME/.config/CommonSourceCodeProject/emu{Machine Name}/ .
   
   ・Saved state file, {foo}.sta is written on $HOME/CommonSourceCodeProject/emu{Machine Name}/ .
   
   ・Key code conversion file is written on $HOME/.config/CommonSourceCodeProject/emu{Machine Name}/scancode.cfg .
   
     This file contains comma separated fields, written at hex-decimal (not decimal), 
       first is M$ Virtual Key Code,
       second is Qt's scan code.
       
   ・Common UI components (at src/qt/gui ) are moved to shared lib. libCSPgui.so .
   
   ・Installer (bash) script is available now; src/tool/installer_unix.sh .
   
   ・When you place specified WAV files(differ per VM) same directory as ROMs, you can sound sounds: i.e. FDD seek, CMT relay and buttons.
  
5.Status

a. I tested to build only under Debian GNU/Linux "sid",Ubuntu Linux 16.04LTS "Xenial" for AMD64 (x86_64)
and MinGW with GCC6 (Windows 32bit).

   But, perhaps, will succed to build another GNU/Linux OSs or BSD OS variants.
   
   * On windows, using MinGW is already okay, but not tested drawing.
   
   * Cross building with GNU/Linux's MinGW32 and Qt5.5.1 (for MinGW) is available. 
     Modify and use build-cmake/config_build_cross_win32.sh and related *.cmake files.
     
   * And, you can also build with M$ Visual Studio 2013 or 2015.

b. Now, I using Qt5 as toolkit, because authors of Qt announced "Qt4 is obsolete, will be updated no longer".

c. All of virtual machines are already ported to Qt (On Oct 29, 2015).

d. Now using GCC-6.1 with Link Time Optimize to build for distrubuted binaries.

e. Implemented socket, networking for MZ-2500, but, not tested yet (；´Д｀)

Repositry:

   https://github.com/Artanejp/common_source_project-fm7

   https://osdn.net/projects/csp-qt/scm/git/common_source_project-fm7


Project Page:

   https://osdn.jp/projects/csp-qt/

Upstream (Takeda Toshiya San's original code):

   http://takeda-toshiya.my.coocan.jp/

Special thanks to:
   Ryu Takegami-san, to assist debugging FM-7/77/AV/40/EX .
   Haserin-san, to assist debugging FM-7/77/AV/40/EX .
   Developers of Ootake, give hints of emuPCEngine (from source code).
   Soji Yamakawa-San, author of TOWNS emulater "津軽",
                      and advice for my development a lot.  

Changes:

* To see older changes, read ChangeLog and 000_gitlog.txt.

* SNAPSHOT August 01, 2021
  * Upstream 2021-05-02.
  * [BUILD/CMAKE] Add *Very Experimental* C++20 build settings.
  * [OSD/EMU][MOUSE/JOYSTICK] Should LOCK/UNLOCK per referring buffers of joystick/mouse.
    Note: This is MAJOR API CHANGE around mouse and joystick.
  * [CONFIG/FMTOWNS] Add config.machine_features[32] to use machine configuration (w/o DIP SWITCH).Still not be bulidable.
    Note: See vm/fmtowns/joystick.cpp, FMTOWNS::JOYSTICK::update_config().
  * [FMTOWNS/KEYBOARD] SPECIAL_RESET: Available to boot with special key code (i.e. "CD" "DEBUG").
  * [FMTOWNS/CDROM] Re-implement parsing CCD image file.Still ugly.
  * [FMTOWNS/VRAM] Add __LIKELY_IF() and __UNLIKELY_IF() to assist compiler's optimization.
    See [read|write]_memory_mapped_io32() and read_memory_mapped_io16() at FMTOWNS::TOWNS_VRAM class.
  * [VM/I386_NP21] Add hints of branch-prediction whether accessing memory (and some of interrupts) is legal.
    This reduces HOST CPU USAGE especially high-VM-clocks.
  * [FMTOWNS/VRAM] More faster vram accessing.
  * [FMTOWNS/MEMORY/VRAM] Add features around CACHE for after i486.Still be dummy.
  * [FMTOWNS/CRTC] Use more SIMDs to be faster rendering.
  * [FMTOWNS/KEYBOARD] Implement AUTO REPEAT.
  * [FMTOWNS/TIMER] Clear OV and INTR when enabling interval timer.
  * [FMTOWNS/VRAM] More faster VRAM access for packed pixel mode.
  * [FMTOWNS/CDROM] Even reply without REQ_STATUS bit (0x20) with PAUSE/RESUME CDDA (85h/87h).
  * [FMTOWNS/CDROM] Falldown intr even stat_reply_intr (04C2:bit6) == 0 on MCU interrupt.
  * [FMTOWNS/CDROM] Reply error when reading beyond track on READ_SECTOR.
  * [FMTOWNS/CDROM] Fix around booting from some version(s?) of TOWNS OS.
	 i.e)AYAYO 4.
  * [FMTOWNS/CRTC/TIMER/MEMORY] Improve around I/O.
  * [FMTOWNS/DMAC] Remove some variables.Update state save version.
  * [FMTOWNS/SCSI] Add a PORT: 0C34h.
  * [FMTOWNS/MEMORY] Revert to use primitive_[read|write]. Fix CDROM's some issues (i.e. Crashing Ayayo4).
  * [FMTOWNS/MEMORY] Add dma read/write functions with wait.
  * [FMTOWNS/ICCARD] Improve logic around open/close.
  * [FMTOWNS/JOYSTICK] Fix confused mouse mask.
  * [FMTOWNS] Split MOUSE and JOYPADs to separate class.
  * [FMTOWNS/FLOPPY] Add support for 1.44MB 2HD (2HC).
  * [I286/I86/V30] Separate namespace CPUTYPE ENUMS.
  * [I286/I86] Fix weird bitmask default value.
  * [VM/UPD71071] Add read_io16(), write_io16() and ACK feature.
  * [PC9801/EGC] Fix FTBFS with C++20 ; "error: ISO C++17 does not allow 'register' storage class specifier".
  * [BUILD/CMake] Add samplescripts supports GCC-11 initially.
  * [BUILD/CMake] Prepare to support LLVM12, but now unable to build Win32 version with llvm12 due to _aligned_alloc() and _aligned_free().
  * [Build/Win32] LLVM12/MinGW-w64/Cross : Add libc++abi and others to toolchain.
  * [Build/Win32] Update revision of ffmpeg to 4.4.
  * [JOY_THREAD/SDL2/GAMECONTROLLER] Fix sample initial value.
  * Built with ab2601af3b0de22bd806ce5312ebf06823a16405 (or later).

-- August 01, 2021 22:34:13 +0900 K.Ohta <whatisthis.sowhat@gmail.com>

Upstream changes:
* To see older upstream's changes, read history.txt.

5/2/2021

[VM/DATAREC] fix mixing sound track
[VM/HD46505] support smooth vertical scroll
[VM/MC6843] fix seek command
[VM/MC6844] fix data chain register to consider 2/4 channel select bit
[VM/MC6844] fix to transfer 64K when byte count register is zero
[VM/Z80CTC] fix to apply written time constant just after reset bit is cleared

[BX1] fix memory map around ram
[BX1] support cartridge rom images
[BX1/DISPLAY] add missing font patterns
[BX1/FLOPPY] support i/o ports around fdc
[BX1/KEYBOARD] support PROG.SELECT switch
[BX1/PRINTER] support AUTO PRINT switch
[MZ1500/JOTSTICK] support joystick (thanks Mr.Koucha-Youkan)
[PC6001] remove some codes from iP6 Plus
[X1TURBO/DISPLAY] support smooth vertical scroll


2/7/2021

[WINMAIN] improve WM_KEYDOW/WM_KEYUP events for VK_PROCESSKEY case
[WIN32/CONSLE] improve routine to change console size

[VM/DISK] fix density flag when loading solid image with fm sectors
[VM/MC6843] fix track zero flag in STRA
[VM/MC6843] fix seek error flag in STRB
[VM/MC6843] fix seek command

[BX1/DISPLAY] improve for drawing digitron display
[BX1/KEYBOARD] improve I/O ports for detecting key pressed/released
[BX1/PRINTER] add ugly patch for printer process

1/24/2021

[VM/I8279] support 8279 (based on MAME)

[MP85] support MITEC MP-85


1/17/2021

[VM/UPD765A] improve for the case tc is asserted while reading/writing sector

[PC8801/PC88] improve to render screen with port params at end of disp timing
[X1TURBO/FLOPPY] fix to change type of all drives (thanks Mr.Sato)


1/3/2021

[WINMAIN] improve for pressing shift key and numpad key

[MZ80K] fix roman/kana conversion
[MZ80K/KEYBOARD] improve for pressing right shift key and numpad key


12/31/2020

[PC8801/PC88] improve crtc to refer reverse setting in start display command


12/21/2020

[VM/SCSI_CDROM] fix start frame of CD-DA playing when track number is specified

[PCENGINE/PCE] fix issue that ADPCM is mistakenly looped


12/19/2020

[VM/SCSI_CDROM] fix pre-gap of first track when it is audio track


12/18/2020

[VM/SCSI_CDROM] improve routine to get start/end frame of CD-DA playing

[PC8801/PC88] support 8inch DMA-type floppy drives for PC-8001mkII/SR
[PC9801/DISPLAY] improve EGC (thanks Mr.Ryuji Okamoto)


12/16/2020

[PC8801/DISKIO] improve to read/write files in initial current directory
[PC8801/PC88] support force ready/drq mask register for DMA-type FDD
[PC8801/PC88] fix PC-8001mkIISR hiragana font when PCG-8100 is enabled


12/15/2020

[PC8801/DISKIO] support M88 DiskDrv (thanks Mr.CISC and Mr.apaslothy)
[PC8801/PC88] support PC-8001mkIISR hiragana font
[PC8801/PC88] support to disable 5inch/8inch-FDD interfaces
[PC8801/PC88] support to disable updating scan line setting automatically
[PC8801/PC88] fix mouse data when position is not latched


12/14/2020

[PC8801/PC88] support 8inch DMA-type floppy drives


12/13/2020

[VM/MC6843] support MC6843 (based on MAME)
[[VM/SCSI_CDROM] fix to reset logical block size in Test Unit Ready command

[BX1] support CANON BX-1 (not work)
[MZ1500/QUICKDISK] improve for BSD record (thanks Mr.Motochan1500)
[PC8801/PC88] fix hireso graphic screen when scan line is disabled


12/12/2020

[PC8801/PC88] fix to clear attibutes at starting new frame
[PC8801/PC88] fix to read status of 2nd OPNA


12/11/2020

[PC8801/PC88] fix to run dma from memory to crtc when (rd,wr)=(0,0)
[PC8801/PC88] fix to run dma from scsi to memory only when count > 0


12/8/2020

[COMMON] fix build error on VC++2019 (thanks Mr.Sato)

[VM/Z80CTC] fix not to clear in-service at software reset (thanks Mr.Sato)
[VM/Z80DMA] fix stall cycles at BUSACK in byte mode (thanks Mr.Sato)

[X1TURBOZ/DISPLAY] fix zpalette in 64 colors, 2 screens mode (thanks Mr.Sato)


12/6/2020-2

[MZ1500] fix inp(0xe8) to detect voice board is missing (thanks Mr.kitahei88)
[X1TURBOZ/DISPLAY] fix to update zpalette at vline=0 (thanks Mr.Sato)


12/6/2020

[OSD/WIN32] import Unity plug-in code (thanks Mr.Marukun)

[VM/I386_NP21] update to Neko Project 21/W ver0.86 rev79 beta4
[VM/UPD765A] fix transfer size to 128 << min(N, 7) (thanks Mr.Kugimoto)

[MZ1500/QUICKDISK] improve for QDF format (thanks Mr.kitahei88)
[MZ1500/QUICKDISK] improve for BSD record (thanks Mr.Yuushi)
[PC9801/MEMORY] fix switching BIOS ROM/RAM
[X1/CZ8RB] support CZ-8RB (thanks Mr.Meister)

-----


Have fun!
-- Ohta.

