Linux changes for current version of AppleWin.

Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
Andrea Odetti 2019-08-10 16:16:38 +01:00
parent 850ceff343
commit 4d2febfb42
11 changed files with 84 additions and 25 deletions

View file

@ -1052,7 +1052,7 @@ public:
BYTE n = 0;
for (UINT j = 0; j < 8; j++)
{
if (rand() < ((RAND_MAX * 3) / 10)) // ~30% of buffer are 1 bits
if (rand() < (RAND_MAX / 10 * 3)) // ~30% of buffer are 1 bits
n |= 1 << j;
}
m_pWOZEmptyTrack[i] = n;

View file

@ -42,6 +42,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "Memory.h"
#include "Mockingboard.h"
#include "MouseInterface.h"
#include "Video.h"
#include "NTSC.h"
#include "NoSlotClock.h"
#include "ParallelPrinter.h"
@ -50,7 +51,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "SerialComms.h"
#include "Speaker.h"
#include "Tape.h"
#include "Video.h"
#include "RGBMonitor.h"
#include "z80emu.h"

View file

@ -15,8 +15,9 @@
#include "CPU.h"
#include "Frame.h"
#include "Memory.h"
#include "ParallelPrinter.h"
#include "Video.h"
#include "NTSC.h"
#include "ParallelPrinter.h"
#include "SaveState.h"
#include "MouseInterface.h"
@ -166,6 +167,7 @@ namespace
ProcessInput();
const UINT dwClksPerFrame = NTSC_GetCyclesPerFrame();
if (g_dwCyclesThisFrame >= dwClksPerFrame)
{
g_dwCyclesThisFrame -= dwClksPerFrame;

View file

@ -11,6 +11,7 @@
#include "Log.h"
#include "DiskImageHelper.h"
#include "Memory.h"
#include "Applewin.h"
#include "linux/interface.h"
#include "linux/paddle.h"
@ -141,7 +142,7 @@ namespace
void updateSpeaker()
{
const ULONG dCycles = g_nCumulativeCycles - lastUpdate;
const double dt = dCycles / CLK_6502;
const double dt = dCycles / g_fCurrentCLK6502;
const double coeff = exp(- alpha * dt);
F = F * coeff;
lastUpdate = g_nCumulativeCycles;
@ -367,6 +368,8 @@ void FrameRefreshStatus(int x, bool)
void VideoInitialize()
{
VideoReinitialize();
setlocale(LC_ALL, "");
initscr();

View file

@ -13,6 +13,7 @@
#include "MouseInterface.h"
#include "ParallelPrinter.h"
#include "Video.h"
#include "NTSC.h"
#include "SaveState.h"
#include "linux/data.h"
@ -141,7 +142,10 @@ BYTE __stdcall SpkrToggle (WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG uExecu
return 0;
}
void VideoInitialize() {}
void VideoInitialize()
{
VideoReinitialize();
}
// MessageBox
@ -241,6 +245,7 @@ void QApple::on_timer()
const bool bVideoUpdate = false;
int count = 0;
const UINT dwClksPerFrame = NTSC_GetCyclesPerFrame();
do
{
const DWORD uActualCyclesExecuted = CpuExecute(uCyclesToExecute, bVideoUpdate);

View file

@ -23,6 +23,15 @@
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="background">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>102</red>
<green>102</green>
<blue>102</blue>
</color>
</brush>
</property>
</widget>
</item>
</layout>

View file

@ -20,7 +20,7 @@
#include "SaveState.h"
DWORD g_dwSpeed = SPEED_NORMAL; // Affected by Config dialog's speed slider bar
double g_fCurrentCLK6502 = CLK_6502; // Affected by Config dialog's speed slider bar
double g_fCurrentCLK6502 = CLK_6502_NTSC; // Affected by Config dialog's speed slider bar
eApple2Type g_Apple2Type = A2TYPE_APPLE2EENHANCED;
int g_nMemoryClearType = MIP_FF_FF_00_00; // Note: -1 = random MIP in Memory.cpp MemReset()
DWORD g_dwCyclesThisFrame = 0;
@ -73,7 +73,7 @@ void SetCurrentCLK6502(void)
else
g_fMHz = (double)g_dwSpeed / 10.0;
g_fCurrentCLK6502 = CLK_6502 * g_fMHz;
g_fCurrentCLK6502 = CLK_6502_NTSC * g_fMHz;
}
void SetWindowTitle()

View file

@ -7,6 +7,7 @@
#include "Configuration/IPropertySheet.h"
#include "Video.h"
#include "CPU.h"
#include "Applewin.h"
#include "Memory.h"
#include "Keyboard.h"
#include "NTSC.h"
@ -32,6 +33,8 @@ int const kVPresetLine = 256; // line when V state presets
int const kVSyncLines = 4; // lines per VSync duration
int const kVDisplayableScanLines = 192; // max displayable scanlines
static bool g_bVideoScannerNTSC = true;
eApple2Type GetApple2Type(void)
{
return g_Apple2Type;
@ -111,6 +114,11 @@ void FrameSetCursorPosByMousePos()
{
}
UINT GetFrameBufferWidth(void)
{
return 0;
}
// Joystick
void JoyportControl(const UINT uControl)
@ -143,11 +151,6 @@ int g_nAltCharSetOffset = 0; // alternate character set
#define SW_PAGE2 (g_uVideoMode & VF_PAGE2)
#define SW_TEXT (g_uVideoMode & VF_TEXT)
UINT GetFrameBufferWidth(void)
{
return 0;
}
bool IsVideoStyle(VideoStyle_e mask)
{
return (g_eVideoStyle & mask) != 0;
@ -236,12 +239,17 @@ void Video_ResetScreenshotCounter( char *pImageName )
{
}
VideoRefreshRate_e GetVideoRefreshRate(void)
{
return (g_bVideoScannerNTSC == false) ? VR_50HZ : VR_60HZ;
}
//===========================================================================
//
// References to Jim Sather's books are given as eg:
// UTAIIe:5-7,P3 (Understanding the Apple IIe, chapter 5, page 7, Paragraph 3)
//
WORD VideoGetScannerAddress(bool* pbVblBar_OUT, const DWORD uExecutedCycles)
WORD VideoGetScannerAddress(DWORD uExecutedCycles, VideoScanner_e videoScannerAddr)
{
// get video scanner position
//
@ -343,12 +351,6 @@ WORD VideoGetScannerAddress(bool* pbVblBar_OUT, const DWORD uExecutedCycles)
}
}
// update VBL' state
//
if (pbVblBar_OUT != NULL)
{
*pbVblBar_OUT = !v_4 || !v_3; // VBL' = (v_4 & v_3)' (UTAIIe:5-10,#3)
}
return static_cast<WORD>(nAddress);
}
@ -392,15 +394,31 @@ bool VideoGetSWAltCharSet(void)
return g_nAltCharSetOffset != 0;
}
void SetVideoRefreshRate(VideoRefreshRate_e rate)
{
// This version of AppleWin only works at 50Hz
}
void VideoReinitialize(bool bInitVideoScannerAddress)
{
g_dwCyclesThisFrame = 0;
}
// NTSC
void NTSC_VideoUpdateCycles( long cyclesLeftToUpdate )
#define VIDEO_SCANNER_MAX_HORZ 65 // TODO: use Video.cpp: kHClocks
#define VIDEO_SCANNER_MAX_VERT 262 // TODO: use Video.cpp: kNTSCScanLines
static const UINT VIDEO_SCANNER_6502_CYCLES = VIDEO_SCANNER_MAX_HORZ * VIDEO_SCANNER_MAX_VERT;
static UINT g_videoScanner6502Cycles = VIDEO_SCANNER_6502_CYCLES; // default to NTSC
void NTSC_VideoUpdateCycles( UINT cycles6502 )
{
}
uint16_t NTSC_VideoGetScannerAddress( const ULONG uExecutedCycles )
{
return VideoGetScannerAddress(NULL, uExecutedCycles);
return VideoGetScannerAddress(uExecutedCycles);
}
void NTSC_SetVideoMode( uint32_t uVideoModeFlags, bool bDelay )
@ -410,3 +428,8 @@ void NTSC_SetVideoMode( uint32_t uVideoModeFlags, bool bDelay )
void NTSC_SetVideoTextMode( int cols )
{
}
UINT NTSC_GetCyclesPerFrame(void)
{
return g_videoScanner6502Cycles;
}

View file

@ -6,7 +6,7 @@
#include "YamlHelper.h"
#include "Video.h"
void VideoReinitialize(bool bInitVideoScannerAddress) { }
void VideoLoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT version) { }
void KeybLoadSnapshot(YamlLoadHelper&, unsigned int) { }
std::string GetSnapshotCardName() { return ""; }
void SpkrLoadSnapshot(YamlLoadHelper&) { }

View file

@ -14,6 +14,8 @@
#include <iomanip>
#include <ctime>
#include "minizip/mz_os.h"
#include "../resource/resource.h"
#include "Log.h"
@ -273,3 +275,13 @@ int GetTimeFormat(LCID Locale, DWORD dwFlags, CONST SYSTEMTIME *lpTime, LPCSTR l
strncpy(lpTimeStr, str.c_str(), cchTime);
return cchTime; // not 100% sure, but it is never used
}
// function missing from minizip 2.8.8
int zipOpenNewFileInZip(zipFile file, const char *filename, const zip_fileinfo *zipfi,
const void *extrafield_local, uint16_t size_extrafield_local, const void *extrafield_global,
uint16_t size_extrafield_global, const char *comment, uint16_t compression_method, int level)
{
return zipOpenNewFileInZip4_64(file, filename, zipfi, extrafield_local, size_extrafield_local,
extrafield_global, size_extrafield_global, comment, compression_method, level, 0, 0,
0, 0, NULL, 0, MZ_VERSION_MADEBY, 0, 0);
}

View file

@ -1,11 +1,12 @@
#pragma once
#include "linux/wincompat.h"
#include "linux/dummies.h"
#include <string>
#include <string.h>
#include "linux/wincompat.h"
#include "linux/dummies.h"
#include "minizip/unzip.h"
#define FILE_BEGIN SEEK_SET
#define FILE_CURRENT SEEK_CUR
#define FILE_END SEEK_END
@ -141,3 +142,7 @@ int MessageBox(HWND, const char *, const char *, UINT);
int GetDateFormat(LCID Locale, DWORD dwFlags, CONST SYSTEMTIME *lpDate, LPCSTR lpFormat, LPSTR lpDateStr, int cchDate);
int GetTimeFormat(LCID Locale, DWORD dwFlags, CONST SYSTEMTIME *lpTime, LPCSTR lpFormat, LPSTR lpTimeStr, int cchTime);
int zipOpenNewFileInZip(zipFile file, const char *filename, const zip_fileinfo *zipfi,
const void *extrafield_local, uint16_t size_extrafield_local, const void *extrafield_global,
uint16_t size_extrafield_global, const char *comment, uint16_t compression_method, int level);