Publish VCC Plus OSS source distribution for 3.6.2 build 60
This commit is contained in:
commit
c652a5276d
1192 files changed
+272368
No files matched your search
@@ -0,0 +1,356 @@
|
||||
//---------------------------------------------------------------------------------
|
||||
// Copyright 2015 by Joseph Forgione
|
||||
// This file is part of VCC (Virtual Color Computer).
|
||||
//
|
||||
// VCC (Virtual Color Computer) is free software: you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or any later
|
||||
// version.
|
||||
//
|
||||
// VCC (Virtual Color Computer) is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
// more details. You should have received a copy of the GNU General Public License
|
||||
// along with VCC (Virtual Color Computer). If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
//---------------------------------------------------------------------------------
|
||||
//
|
||||
// This code is extracted from the standalone version of becker.dll with gui
|
||||
// deletions, changed external calls, and some variable name changes.
|
||||
//
|
||||
//---------------------------------------------------------------------------------
|
||||
//#define USE_LOGGING
|
||||
#define _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
|
||||
#include <WinSock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#include <Windows.h>
|
||||
#include <process.h>
|
||||
#include <stdio.h>
|
||||
#include <vcc/util/logger.h>
|
||||
#include "becker.h"
|
||||
|
||||
#define BUFFER_SIZE 512
|
||||
#define TCP_RETRY_DELAY 500
|
||||
#define STATS_PERIOD_MS 100
|
||||
|
||||
//------------------------------------------------------
|
||||
// Error returns from SOCKET dw_open(...)
|
||||
//------------------------------------------------------
|
||||
constexpr SOCKET SOCKET_RETRY = (SOCKET)-1;
|
||||
constexpr SOCKET SOCKET_FATAL = (SOCKET)-2;
|
||||
|
||||
//------------------------------------------------------
|
||||
// local functions
|
||||
//------------------------------------------------------
|
||||
void dw_open();
|
||||
void dw_close();
|
||||
SOCKET dw_open(const char *, const char *);
|
||||
unsigned char dw_status();
|
||||
unsigned char dw_read();
|
||||
int dw_write(char);
|
||||
unsigned __stdcall dw_thread(void *);
|
||||
|
||||
//------------------------------------------------------
|
||||
// globals
|
||||
//------------------------------------------------------
|
||||
|
||||
static SOCKET dwSocket = 0;
|
||||
static bool dwEnabled = false;
|
||||
static HANDLE hDWTCPThread;
|
||||
|
||||
// are we retrying tcp conn
|
||||
static bool retry = false;
|
||||
|
||||
// circular buffer for socket io
|
||||
static char InBuffer[BUFFER_SIZE];
|
||||
static int InReadPos = 0;
|
||||
static int InWritePos = 0;
|
||||
|
||||
// hostname and port
|
||||
static char dwaddress[MAX_PATH] = {};
|
||||
static char dwsport[16] = "65504";
|
||||
static char curaddress[MAX_PATH] = {};
|
||||
static char curport[16] = "65504";
|
||||
|
||||
// statistics
|
||||
static int BytesWrittenSince = 0;
|
||||
static int BytesReadSince = 0;
|
||||
static DWORD LastStats;
|
||||
static float ReadSpeed = 0;
|
||||
static float WriteSpeed = 0;
|
||||
|
||||
//------------------------------------------------------
|
||||
// Set becker server address and port
|
||||
// Should default to "127.0.0.1" and "65504"
|
||||
//------------------------------------------------------
|
||||
|
||||
int becker_sethost(const char *bufdwaddr, const char *bufdwport)
|
||||
{
|
||||
strcpy(dwaddress,bufdwaddr);
|
||||
strcpy(dwsport,bufdwport);
|
||||
|
||||
if (strcmp(dwsport,curport) !=0 || (strcmp(dwaddress,curaddress) != 0))
|
||||
dw_close();
|
||||
return 0;
|
||||
}
|
||||
|
||||
//------------------------------------------------------
|
||||
// enable or disable becker port
|
||||
//------------------------------------------------------
|
||||
void becker_enable(bool enable)
|
||||
{
|
||||
if (enable) {
|
||||
if (!dwEnabled) {
|
||||
|
||||
// reset buffer pointers
|
||||
InReadPos = 0;
|
||||
InWritePos = 0;
|
||||
|
||||
// start create thread to handle io
|
||||
HANDLE hEvent;
|
||||
|
||||
unsigned threadID;
|
||||
|
||||
hEvent = CreateEvent( nullptr, FALSE, FALSE, nullptr ) ;
|
||||
|
||||
if (hEvent==nullptr) {
|
||||
DLOG_C("Cannot create DWTCPConnection thread!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// start it up...
|
||||
hDWTCPThread = (HANDLE)_beginthreadex
|
||||
( nullptr, 0, &dw_thread, hEvent, 0, &threadID );
|
||||
|
||||
if (hDWTCPThread==nullptr) {
|
||||
DLOG_C("Cannot start DWTCPConnection thread!\n");
|
||||
return;
|
||||
}
|
||||
dwEnabled = true;
|
||||
DLOG_C("DWTCPConnection thread started with id %d\n",threadID);
|
||||
}
|
||||
} else {
|
||||
dw_close();
|
||||
dwEnabled = false;
|
||||
DLOG_C("DWTCPConnection has been disabled.\n");
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------
|
||||
// write becker port
|
||||
//------------------------------------------------------
|
||||
void becker_write(unsigned char data,unsigned short port)
|
||||
{
|
||||
if (port == 0x42)
|
||||
dw_write(data);
|
||||
return;
|
||||
}
|
||||
|
||||
//------------------------------------------------------
|
||||
// read becker port
|
||||
//------------------------------------------------------
|
||||
unsigned char becker_read(unsigned short port)
|
||||
{
|
||||
switch (port) {
|
||||
// read status
|
||||
case 0x41:
|
||||
if (dw_status() != 0)
|
||||
return 2;
|
||||
else
|
||||
return 0;
|
||||
// read data
|
||||
case 0x42:
|
||||
return(dw_read());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//------------------------------------------------------
|
||||
// get drivewire status for status line
|
||||
//------------------------------------------------------
|
||||
void becker_status(char *DWStatus)
|
||||
{
|
||||
if (dwEnabled) {
|
||||
// calculate speed
|
||||
DWORD sinceCalc = GetTickCount() - LastStats;
|
||||
if (sinceCalc > STATS_PERIOD_MS) {
|
||||
LastStats += sinceCalc;
|
||||
ReadSpeed = 8.0f * (BytesReadSince / (1000.0f - sinceCalc));
|
||||
WriteSpeed = 8.0f * (BytesWrittenSince / (1000.0f - sinceCalc));
|
||||
BytesReadSince = 0;
|
||||
BytesWrittenSince = 0;
|
||||
}
|
||||
if (retry) {
|
||||
sprintf(DWStatus,"DW %s?", curaddress);
|
||||
} else if (dwSocket == 0) {
|
||||
sprintf(DWStatus,"DW ConError");
|
||||
} else {
|
||||
sprintf(DWStatus,"DW OK R:%04.1f W:%04.1f", ReadSpeed , WriteSpeed);
|
||||
}
|
||||
} else {
|
||||
sprintf(DWStatus,"");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
//------------------------------------------------------
|
||||
// Internal functions
|
||||
//------------------------------------------------------
|
||||
|
||||
// coco checks for data
|
||||
unsigned char dw_status( void )
|
||||
{
|
||||
// check for input data waiting
|
||||
if (retry | (dwSocket == 0) | (InReadPos == InWritePos))
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
// coco reads a byte
|
||||
unsigned char dw_read( void )
|
||||
{
|
||||
// increment buffer read pos, return next byte
|
||||
unsigned char dwdata = InBuffer[InReadPos];
|
||||
InReadPos++;
|
||||
if (InReadPos == BUFFER_SIZE) InReadPos = 0;
|
||||
BytesReadSince++;
|
||||
return dwdata;
|
||||
}
|
||||
|
||||
// coco writes a byte
|
||||
int dw_write( char dwdata)
|
||||
{
|
||||
// send the byte if we're connected
|
||||
if ((dwSocket != 0) & (!retry)) {
|
||||
int res = send(dwSocket, &dwdata, 1, 0);
|
||||
if (res != 1) {
|
||||
DLOG_C("dw_write socket error %d\n", WSAGetLastError());
|
||||
closesocket(dwSocket);
|
||||
dwSocket = 0;
|
||||
} else {
|
||||
BytesWrittenSince++;
|
||||
}
|
||||
|
||||
} else {
|
||||
DLOG_C("dw_write null socket\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void dw_close()
|
||||
{
|
||||
// close socket to cause io thread to die
|
||||
DLOG_C("dw_close\n");
|
||||
if (dwSocket != 0) closesocket(dwSocket);
|
||||
dwSocket = 0;
|
||||
InReadPos = 0;
|
||||
InWritePos = 0;
|
||||
hDWTCPThread = nullptr;
|
||||
}
|
||||
|
||||
// try to connect with DW server
|
||||
void dw_open( void )
|
||||
{
|
||||
DLOG_C("dw_open %s:%d\n",dwaddress,dwsport);
|
||||
dwSocket = dw_open(dwaddress,dwsport);
|
||||
if (dwSocket == SOCKET_RETRY) {
|
||||
retry = true;
|
||||
dwSocket = 0;
|
||||
} else if (dwSocket == SOCKET_FATAL) {
|
||||
retry = false;
|
||||
dwSocket = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Override for dw_open(void) replaces gethostbyname with getaddrinfo
|
||||
SOCKET dw_open(const char * server, const char * port)
|
||||
{
|
||||
struct addrinfo hints;
|
||||
ZeroMemory(&hints, sizeof(hints));
|
||||
hints.ai_family = AF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
hints.ai_protocol = IPPROTO_TCP;
|
||||
|
||||
struct addrinfo *result = nullptr;
|
||||
if (getaddrinfo(server, port, &hints, &result) != 0)
|
||||
return SOCKET_FATAL;
|
||||
|
||||
SOCKET s = SOCKET_RETRY;
|
||||
for (auto p = result; p != nullptr; p = p->ai_next) {
|
||||
s = socket(p->ai_family, p->ai_socktype, p->ai_protocol);
|
||||
if (s == INVALID_SOCKET) {
|
||||
freeaddrinfo(result);
|
||||
return SOCKET_FATAL;
|
||||
}
|
||||
if (connect(s, p->ai_addr, p->ai_addrlen) != 0) {
|
||||
closesocket(s);
|
||||
s = SOCKET_RETRY;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
freeaddrinfo(result);
|
||||
return s;
|
||||
}
|
||||
|
||||
// TCP connection thread
|
||||
unsigned __stdcall dw_thread(void* /*Dummy*/)
|
||||
{
|
||||
DLOG_C("dw_thread %d\n",dwEnabled);
|
||||
WSADATA wsaData;
|
||||
|
||||
int sz;
|
||||
int res;
|
||||
|
||||
if (dwEnabled) {
|
||||
// Request Winsock version 2.2
|
||||
if ((WSAStartup(0x202, &wsaData)) != 0) {
|
||||
DLOG_C("dw_thread winsock startup failed, exiting\n");
|
||||
WSACleanup();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
while(dwEnabled) {
|
||||
// get connected
|
||||
dw_open();
|
||||
|
||||
// keep trying...
|
||||
while ((dwSocket == 0) & dwEnabled) {
|
||||
dw_open();
|
||||
// after 2 tries, sleep between attempts
|
||||
Sleep(TCP_RETRY_DELAY);
|
||||
}
|
||||
|
||||
while ((dwSocket != 0) & dwEnabled) {
|
||||
// we have a connection, read as much as possible.
|
||||
if (InReadPos > InWritePos)
|
||||
sz = InReadPos - InWritePos;
|
||||
else
|
||||
sz = BUFFER_SIZE - InWritePos;
|
||||
|
||||
// read the data
|
||||
res = recv(dwSocket,(char *)InBuffer + InWritePos, sz, 0);
|
||||
|
||||
if (res < 1) {
|
||||
// no good, bail out
|
||||
closesocket(dwSocket);
|
||||
dwSocket = 0;
|
||||
} else {
|
||||
// good recv, inc ptr
|
||||
InWritePos += res;
|
||||
if (InWritePos == BUFFER_SIZE) InWritePos = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Not enabled - close socket if necessary
|
||||
if (dwSocket != 0) closesocket(dwSocket);
|
||||
|
||||
dwSocket = 0;
|
||||
|
||||
_endthreadex(0);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
#ifndef __BECKER_H__
|
||||
#define __BECKER_H__
|
||||
|
||||
void becker_enable(bool); // enable or disable
|
||||
int becker_sethost(const char *, const char *); // server ip address, port
|
||||
unsigned char becker_read(unsigned short); // coco port
|
||||
void becker_write(unsigned char,unsigned short); // value, coco port
|
||||
void becker_status(char *); // becker status for status line
|
||||
#endif
|
||||
@@ -0,0 +1,28 @@
|
||||
#ifndef __DEFINES_H__
|
||||
#define __DEFINES_H__
|
||||
/*
|
||||
Copyright 2015 by Joseph Forgione
|
||||
This file is part of VCC (Virtual Color Computer).
|
||||
|
||||
VCC (Virtual Color Computer) is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
VCC (Virtual Color Computer) is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with VCC (Virtual Color Computer). If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// FIXME: These are duplicates from the defines.h file in vcc and should be consolidates.
|
||||
constexpr auto TARGETFRAMERATE = 60u;
|
||||
constexpr auto LINESPERFIELD = 262u;
|
||||
constexpr auto QUERY = 255u;
|
||||
constexpr auto INDEXTIME = LINESPERFIELD * TARGETFRAMERATE / 5;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
Copyright 2015 by Joseph Forgione
|
||||
This file is part of VCC (Virtual Color Computer).
|
||||
|
||||
VCC (Virtual Color Computer) is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
VCC (Virtual Color Computer) is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with VCC (Virtual Color Computer). If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <Windows.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "distortc.h"
|
||||
|
||||
/* Table description: Bit3 Bit2 Bit1 Bit0
|
||||
Write to $FF51 read from $FF50
|
||||
0x00 1-second digit register S8 S4 S2 S1
|
||||
0x01 10-second digit register x S40 S20 S10
|
||||
0x02 1-minute digit register Mi8 Mi4 Mi2 Mi1
|
||||
0x03 10-minute digit register x Mi40 Mi20 Mi10
|
||||
0x04 1-hour digit register H8 H4 H2 H1
|
||||
0x05 PM/AM, 10-hour digit register x P/A H20 H10
|
||||
0x06 1-day digit register D8 D4 D2 D1
|
||||
0x07 10-day digit register x x D20 D10
|
||||
0x08 1-month digit register Mo8 Mo4 Mo2 Mo1
|
||||
0x09 10-month digit register Mo80 Mo40 Mo20 Mo10
|
||||
0x0A 1-year digit register Y8 Y4 Y2 Y1
|
||||
0x0B 10-yead digit register Y80 Y40 Y20 Y10
|
||||
0x0C Week register x W4 W2 W1
|
||||
|
||||
30
|
||||
0x0D Control register D Sec IRQ Busy Hold
|
||||
adj Flag
|
||||
ITRP
|
||||
0x0E Control register E T1 T0 /STND Mask
|
||||
|
||||
|
||||
0x0F Control register F Test 24/12 Stop Rest
|
||||
|
||||
|
||||
Note: Digits are BDC. Registers only four bits wide.
|
||||
X denotes 'not used'
|
||||
*/
|
||||
static unsigned char time_register=0;
|
||||
static SYSTEMTIME now;
|
||||
static unsigned char Hour12=0;
|
||||
|
||||
unsigned char read_time(unsigned short port)
|
||||
{
|
||||
unsigned char ret_val=0;
|
||||
if (port == 0x50)
|
||||
{
|
||||
GetLocalTime(&now);
|
||||
switch (time_register)
|
||||
{
|
||||
|
||||
case 0:
|
||||
ret_val= now.wSecond % 10;
|
||||
break;
|
||||
case 1:
|
||||
ret_val= now.wSecond / 10;
|
||||
break;
|
||||
case 2:
|
||||
ret_val = now.wMinute % 10;
|
||||
break;
|
||||
case 3:
|
||||
ret_val = now.wMinute / 10;
|
||||
break;
|
||||
case 4:
|
||||
ret_val = now.wHour % 10;
|
||||
break;
|
||||
case 5:
|
||||
ret_val = now.wHour / 10;
|
||||
|
||||
break;
|
||||
case 6:
|
||||
ret_val = now.wDay % 10;
|
||||
break;
|
||||
case 7:
|
||||
ret_val = now.wDay /10;
|
||||
break;
|
||||
case 8:
|
||||
ret_val = now.wMonth % 10;
|
||||
break;
|
||||
case 9:
|
||||
ret_val = now.wMonth /10 ;
|
||||
break;
|
||||
case 0xA:
|
||||
ret_val = now.wYear%10;
|
||||
break;
|
||||
case 0xB:
|
||||
ret_val = (now.wYear%100)/10;
|
||||
break;
|
||||
case 0xC:
|
||||
ret_val=(unsigned char)now.wDayOfWeek; //May not be right
|
||||
break;
|
||||
case 0xD:
|
||||
|
||||
break;
|
||||
case 0xE:
|
||||
|
||||
break;
|
||||
case 0xF:
|
||||
// Hour12
|
||||
break;
|
||||
default:
|
||||
ret_val=0;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
void write_time(unsigned char data,unsigned char port)
|
||||
{
|
||||
switch (port)
|
||||
{
|
||||
case 0x50:
|
||||
switch (time_register)
|
||||
{
|
||||
case 0x0F:
|
||||
Hour12=!((data & 4)>>2);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 0x51:
|
||||
time_register=(data & 0xF);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef __DISTORTC_H__
|
||||
#define __DISTORTC_H__
|
||||
/*
|
||||
Copyright 2015 by Joseph Forgione
|
||||
This file is part of VCC (Virtual Color Computer).
|
||||
|
||||
VCC (Virtual Color Computer) is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
VCC (Virtual Color Computer) is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with VCC (Virtual Color Computer). If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
unsigned char read_time(unsigned short);
|
||||
void write_time(unsigned char,unsigned char);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,785 @@
|
||||
//#define USE_LOGGING
|
||||
//======================================================================
|
||||
// This file is part of VCC (Virtual Color Computer).
|
||||
// Vcc is Copyright 2015 by Joseph Forgione
|
||||
//
|
||||
// VCC (Virtual Color Computer) is free software, you can redistribute
|
||||
// and/or modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation, either version 3 of
|
||||
// the License, or (at your option) any later version.
|
||||
//
|
||||
// VCC (Virtual Color Computer) is distributed in the hope that it will
|
||||
// be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
// See the GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with VCC (Virtual Color Computer). If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
//======================================================================
|
||||
|
||||
/********************************************************************************************
|
||||
* fd502.cpp : Defines the entry point for the DLL application. *
|
||||
* DLL for use with Vcc 1.0 or higher. DLL interface 1.0 Beta *
|
||||
* This Module will emulate a Tandy Floppy Disk Model FD-502 With 3 DSDD drives attached *
|
||||
* Copyright 2006 (c) by Joseph Forgione *
|
||||
*********************************************************************************************/
|
||||
|
||||
#pragma warning( disable : 4800 ) // For legacy builds
|
||||
|
||||
#include <Windows.h>
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include "resource.h"
|
||||
#include "wd1793.h"
|
||||
#include "distortc.h"
|
||||
#include "fd502.h"
|
||||
#include <vcc/util/limits.h>
|
||||
#include <vcc/util/FileOps.h>
|
||||
#include <vcc/util/DialogOps.h>
|
||||
#include <vcc/util/logger.h>
|
||||
// Three includes added for PakGetMenuItem
|
||||
#include <vcc/bus/cartridge_menu.h>
|
||||
#include <vcc/bus/cartridge_messages.h>
|
||||
#include <vcc/util/fileutil.h>
|
||||
|
||||
//include becker code if COMBINE_BECKER is defined in fd502.h
|
||||
#ifdef COMBINE_BECKER
|
||||
#include "becker.h"
|
||||
#endif
|
||||
|
||||
// Settings module groups used
|
||||
const std::string MS_FD502 = "FD-502";
|
||||
const std::string MS_BECKER = "DW Becker";
|
||||
const std::string MS_PATHS = "DefaultPaths";
|
||||
|
||||
constexpr auto EXTROMSIZE = 16384u;
|
||||
|
||||
using namespace std;
|
||||
|
||||
extern DiskInfo gVirtualDrive[5];
|
||||
static unsigned char ExternalRom[EXTROMSIZE];
|
||||
static unsigned char DiskRom[EXTROMSIZE];
|
||||
static unsigned char RGBDiskRom[EXTROMSIZE];
|
||||
static char FloppyPath[MAX_PATH];
|
||||
static char RomFileName[MAX_PATH]="";
|
||||
static char TempRomFileName[MAX_PATH]="";
|
||||
slot_id_type gSlotId {};
|
||||
PakAssertInteruptHostCallback AssertInt = nullptr;
|
||||
unsigned char PhysicalDriveA=0,PhysicalDriveB=0,OldPhysicalDriveA=0,OldPhysicalDriveB=0;
|
||||
static unsigned char *RomPointer[3]={ExternalRom,DiskRom,RGBDiskRom};
|
||||
static unsigned char SelectRom=0;
|
||||
unsigned char SetChip(unsigned char);
|
||||
static unsigned char NewDiskNumber=0,CreateFlag=0;
|
||||
static unsigned char PersistDisks=0;
|
||||
static unsigned char TempSelectRom=0;
|
||||
static unsigned char ClockEnabled=1;
|
||||
LRESULT CALLBACK Config(HWND, UINT, WPARAM, LPARAM);
|
||||
LRESULT CALLBACK NewDisk(HWND,UINT, WPARAM, LPARAM);
|
||||
void LoadConfig();
|
||||
void SaveConfig();
|
||||
long CreateDiskHeader(const char *,unsigned char,unsigned char,unsigned char);
|
||||
void Unload_Disk(unsigned char);
|
||||
void Load_Disk(unsigned char);
|
||||
|
||||
static HWND g_hConfDlg = nullptr;
|
||||
static HINSTANCE gModuleInstance;
|
||||
static unsigned long RealDisks=0;
|
||||
long CreateDisk (unsigned char);
|
||||
static char gSelectedDiskFile[MAX_PATH]="";
|
||||
unsigned char LoadExtRom( unsigned char, const char *);
|
||||
|
||||
// Added for PakGetMenuItem export
|
||||
bool get_menu_item(menu_item_entry*, size_t index);
|
||||
|
||||
int BeckerEnabled=0;
|
||||
char BeckerAddr[MAX_PATH]="";
|
||||
char BeckerPort[32]="";
|
||||
|
||||
// Added for PakGetMenuItem export
|
||||
static HWND gVccWnd = nullptr;
|
||||
static VCC::Util::settings* gpSettings = nullptr; // Pointer to settings object
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
extern "C"
|
||||
{
|
||||
|
||||
__declspec(dllexport) const char* PakGetName()
|
||||
{
|
||||
static char string_buffer[MAX_LOADSTRING];
|
||||
|
||||
LoadString(gModuleInstance, IDS_MODULE_NAME, string_buffer, MAX_LOADSTRING);
|
||||
|
||||
return string_buffer;
|
||||
}
|
||||
|
||||
__declspec(dllexport) const char* PakGetCatalogId()
|
||||
{
|
||||
static char string_buffer[MAX_LOADSTRING];
|
||||
|
||||
LoadString(gModuleInstance, IDS_CATNUMBER, string_buffer, MAX_LOADSTRING);
|
||||
|
||||
return string_buffer;
|
||||
}
|
||||
|
||||
__declspec(dllexport) const char* PakGetDescription()
|
||||
{
|
||||
static char string_buffer[MAX_LOADSTRING];
|
||||
|
||||
LoadString(gModuleInstance, IDS_DESCRIPTION, string_buffer, MAX_LOADSTRING);
|
||||
|
||||
return string_buffer;
|
||||
}
|
||||
|
||||
__declspec(dllexport) void PakInitialize(
|
||||
slot_id_type SlotId,
|
||||
const char* const configuration_path,
|
||||
HWND hVccWnd,
|
||||
const cpak_callbacks* const callbacks)
|
||||
{
|
||||
DLOG_C("fd502 callbacks write=%p cart=%p read=%p int=%p\n",
|
||||
callbacks->write_memory_byte,
|
||||
callbacks->assert_cartridge_line,
|
||||
callbacks->read_memory_byte,
|
||||
callbacks->assert_interrupt);
|
||||
gSlotId = SlotId;
|
||||
gVccWnd = hVccWnd;
|
||||
AssertInt = callbacks->assert_interrupt;
|
||||
// Must create settings object before LoadConfig
|
||||
gpSettings = new VCC::Util::settings(configuration_path);
|
||||
RealDisks = InitController();
|
||||
LoadConfig();
|
||||
SendMessage(gVccWnd,WM_VCC_UPD_MENU,(WPARAM) 0,(LPARAM) 0);
|
||||
}
|
||||
|
||||
__declspec(dllexport) void PakReset()
|
||||
{
|
||||
LoadExtRom(External,RomFileName);
|
||||
}
|
||||
|
||||
__declspec(dllexport) void PakTerminate()
|
||||
{
|
||||
#ifdef COMBINE_BECKER
|
||||
becker_enable(0);
|
||||
#endif
|
||||
CloseCartDialog(g_hConfDlg);
|
||||
for (unsigned char dnum = 0; dnum <= 3; dnum++)
|
||||
{
|
||||
unmount_disk_image(dnum);
|
||||
}
|
||||
}
|
||||
|
||||
//PakGetMenuItem export
|
||||
__declspec(dllexport) bool PakGetMenuItem(menu_item_entry* item, size_t index)
|
||||
{
|
||||
return get_menu_item(item, index);
|
||||
}
|
||||
|
||||
__declspec(dllexport) void PakMenuItemClicked(unsigned char MenuID)
|
||||
{
|
||||
HWND h_own = GetActiveWindow();
|
||||
switch (MenuID)
|
||||
{
|
||||
case 10:
|
||||
Load_Disk(0);
|
||||
break;
|
||||
case 11:
|
||||
Unload_Disk(0);
|
||||
break;
|
||||
case 12:
|
||||
Load_Disk(1);
|
||||
break;
|
||||
case 13:
|
||||
Unload_Disk(1);
|
||||
break;
|
||||
case 14:
|
||||
Load_Disk(2);
|
||||
break;
|
||||
case 15:
|
||||
Unload_Disk(2);
|
||||
break;
|
||||
case 17:
|
||||
Load_Disk(3);
|
||||
break;
|
||||
case 18:
|
||||
Unload_Disk(3);
|
||||
break;
|
||||
case 16:
|
||||
if (g_hConfDlg == nullptr)
|
||||
g_hConfDlg = CreateDialog(
|
||||
gModuleInstance,(LPCTSTR)IDD_CONFIG,h_own,(DLGPROC)Config);
|
||||
ShowWindow(g_hConfDlg,1);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
__declspec(dllexport) void PakWritePort(unsigned char Port,unsigned char Data)
|
||||
{
|
||||
#ifdef COMBINE_BECKER
|
||||
if (BeckerEnabled && (Port == 0x42)) {
|
||||
becker_write(Data,Port);
|
||||
} else //if ( ((Port == 0x50) | (Port==0x51)) & ClockEnabled) {
|
||||
#endif
|
||||
if ( ((Port == 0x50) | (Port==0x51)) & ClockEnabled) {
|
||||
write_time(Data,Port);
|
||||
} else {
|
||||
disk_io_write(Data,Port);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
__declspec(dllexport) unsigned char PakReadPort(unsigned char Port)
|
||||
{
|
||||
#ifdef COMBINE_BECKER
|
||||
if (BeckerEnabled && ((Port == 0x41) | (Port== 0x42 )))
|
||||
return(becker_read(Port));
|
||||
#endif
|
||||
if ( ((Port == 0x50) | (Port== 0x51 )) & ClockEnabled)
|
||||
return(read_time(Port));
|
||||
return(disk_io_read(Port));
|
||||
}
|
||||
|
||||
__declspec(dllexport) void PakProcessHorizontalSync()
|
||||
{
|
||||
PingFdc();
|
||||
return;
|
||||
}
|
||||
|
||||
__declspec(dllexport) unsigned char PakReadMemoryByte(unsigned short Address)
|
||||
{
|
||||
return(RomPointer[SelectRom][Address & (EXTROMSIZE-1)]);
|
||||
}
|
||||
|
||||
__declspec(dllexport) void PakGetStatus(char* text_buffer, size_t buffer_size)
|
||||
{
|
||||
char diskstat[64];
|
||||
DiskStatus(diskstat, sizeof(diskstat));
|
||||
strcpy(text_buffer,diskstat);
|
||||
#ifdef COMBINE_BECKER
|
||||
char beckerstat[64];
|
||||
if(BeckerEnabled) {
|
||||
becker_status(beckerstat);
|
||||
strcat(text_buffer," | ");
|
||||
strcat(text_buffer,beckerstat);
|
||||
}
|
||||
#endif
|
||||
return ;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL WINAPI DllMain(
|
||||
HINSTANCE hinstDLL, // handle to DLL module
|
||||
DWORD reason, // reason for calling function
|
||||
LPVOID lpReserved ) // reserved
|
||||
{
|
||||
if (reason == DLL_PROCESS_ATTACH) {
|
||||
gModuleInstance = hinstDLL;
|
||||
} else if (reason == DLL_PROCESS_DETACH) {
|
||||
PakTerminate();
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
LRESULT CALLBACK Config(HWND hDlg, UINT message, WPARAM wParam, LPARAM /*lParam*/)
|
||||
{
|
||||
static unsigned char temp=0,temp2=0;
|
||||
long ChipChoice[3]={IDC_EXTROM,IDC_TRSDOS,IDC_RGB};
|
||||
long gVirtualDrive[2]={IDC_DISKA,IDC_DISKB};
|
||||
char VirtualNames[5][16]={"None","Drive 0","Drive 1","Drive 2","Drive 3"};
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case WM_CLOSE:
|
||||
DestroyWindow(hDlg);
|
||||
g_hConfDlg = nullptr;
|
||||
return TRUE;
|
||||
|
||||
case WM_INITDIALOG:
|
||||
CenterDialog(hDlg);
|
||||
TempSelectRom=SelectRom;
|
||||
if (!RealDisks)
|
||||
{
|
||||
EnableWindow(GetDlgItem(hDlg, IDC_DISKA), FALSE);
|
||||
EnableWindow(GetDlgItem(hDlg, IDC_DISKB), FALSE);
|
||||
PhysicalDriveA=0;
|
||||
PhysicalDriveB=0;
|
||||
}
|
||||
SendDlgItemMessage(hDlg,IDC_CLOCK,BM_SETCHECK,ClockEnabled,0);
|
||||
OldPhysicalDriveA=PhysicalDriveA;
|
||||
OldPhysicalDriveB=PhysicalDriveB;
|
||||
strcpy(TempRomFileName,RomFileName);
|
||||
SendDlgItemMessage(hDlg,IDC_TURBO,BM_SETCHECK,SetTurboDisk(QUERY),0);
|
||||
SendDlgItemMessage(hDlg,IDC_PERSIST,BM_SETCHECK,PersistDisks,0);
|
||||
for (temp=0;temp<sizeof(ChipChoice) / sizeof(*ChipChoice);temp++)
|
||||
SendDlgItemMessage(hDlg,ChipChoice[temp],BM_SETCHECK,(temp==TempSelectRom),0);
|
||||
for (temp=0;temp<2;temp++)
|
||||
for (temp2=0;temp2<5;temp2++)
|
||||
SendDlgItemMessage (hDlg,gVirtualDrive[temp], CB_ADDSTRING, 0, (LPARAM) VirtualNames[temp2]);
|
||||
|
||||
SendDlgItemMessage (hDlg, IDC_DISKA,CB_SETCURSEL,(WPARAM)PhysicalDriveA,(LPARAM)0);
|
||||
SendDlgItemMessage (hDlg, IDC_DISKB,CB_SETCURSEL,(WPARAM)PhysicalDriveB,(LPARAM)0);
|
||||
SendDlgItemMessage (hDlg,IDC_ROMPATH,WM_SETTEXT,0,(LPARAM)(LPCSTR)TempRomFileName);
|
||||
|
||||
SendDlgItemMessage (hDlg,IDC_BECKER_ENAB,BM_SETCHECK,BeckerEnabled,0);
|
||||
SendDlgItemMessage (hDlg,IDC_BECKER_HOST,WM_SETTEXT,0,(LPARAM)(LPSTR)BeckerAddr);
|
||||
SendDlgItemMessage (hDlg,IDC_BECKER_PORT,WM_SETTEXT,0,(LPARAM)(LPCSTR)BeckerPort);
|
||||
|
||||
return TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDOK:
|
||||
ClockEnabled=(unsigned char)SendDlgItemMessage(hDlg,IDC_CLOCK,BM_GETCHECK,0,0);
|
||||
SetTurboDisk((unsigned char)SendDlgItemMessage(hDlg,IDC_TURBO,BM_GETCHECK,0,0));
|
||||
PersistDisks=(unsigned char) SendDlgItemMessage(hDlg,IDC_PERSIST,BM_GETCHECK,0,0);
|
||||
PhysicalDriveA=(unsigned char)SendDlgItemMessage(hDlg,IDC_DISKA,CB_GETCURSEL,0,0);
|
||||
PhysicalDriveB=(unsigned char)SendDlgItemMessage(hDlg,IDC_DISKB,CB_GETCURSEL,0,0);
|
||||
if (!RealDisks)
|
||||
{
|
||||
PhysicalDriveA=0;
|
||||
PhysicalDriveB=0;
|
||||
// MessageBox(0,"Wrong Version or Driver not installed","FDRAWCMD Driver",0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (PhysicalDriveA != OldPhysicalDriveA) //Drive changed
|
||||
{
|
||||
if (OldPhysicalDriveA!=0)
|
||||
unmount_disk_image(OldPhysicalDriveA-1);
|
||||
if (PhysicalDriveA!=0)
|
||||
mount_disk_image("*Floppy A:",PhysicalDriveA-1);
|
||||
}
|
||||
if (PhysicalDriveB != OldPhysicalDriveB) //Drive changed
|
||||
{
|
||||
if (OldPhysicalDriveB!=0)
|
||||
unmount_disk_image(OldPhysicalDriveB-1);
|
||||
if (PhysicalDriveB!=0)
|
||||
mount_disk_image("*Floppy B:",PhysicalDriveB-1);
|
||||
}
|
||||
}
|
||||
SelectRom=TempSelectRom;
|
||||
strcpy(RomFileName,TempRomFileName );
|
||||
CheckPath(RomFileName);
|
||||
LoadExtRom(External,RomFileName); //JF
|
||||
#ifdef COMBINE_BECKER
|
||||
GetDlgItemText(hDlg,IDC_BECKER_HOST,BeckerAddr,MAX_PATH);
|
||||
GetDlgItemText(hDlg,IDC_BECKER_PORT,BeckerPort,32);
|
||||
becker_sethost(BeckerAddr,BeckerPort);
|
||||
BeckerEnabled = SendDlgItemMessage (hDlg,IDC_BECKER_ENAB,BM_GETCHECK,0,0);
|
||||
becker_enable(BeckerEnabled);
|
||||
#endif
|
||||
SaveConfig();
|
||||
DestroyWindow(hDlg);
|
||||
g_hConfDlg = nullptr;
|
||||
return TRUE;
|
||||
|
||||
case IDC_EXTROM:
|
||||
case IDC_TRSDOS:
|
||||
case IDC_RGB:
|
||||
for (temp=0;temp<sizeof(ChipChoice) / sizeof(*ChipChoice);temp++)
|
||||
if (LOWORD(wParam)==ChipChoice[temp])
|
||||
{
|
||||
for (temp2=0;temp2<sizeof(ChipChoice) / sizeof(*ChipChoice);temp2++)
|
||||
SendDlgItemMessage(hDlg,ChipChoice[temp2],BM_SETCHECK,0,0);
|
||||
SendDlgItemMessage(hDlg,ChipChoice[temp],BM_SETCHECK,1,0);
|
||||
TempSelectRom=temp;
|
||||
}
|
||||
break;
|
||||
case IDC_BROWSE:
|
||||
{
|
||||
char dir[MAX_PATH];
|
||||
strncpy(dir,TempRomFileName,MAX_PATH);
|
||||
if (char * p = strrchr(dir,'\\')) *p = '\0';
|
||||
|
||||
FileDialog dlg;
|
||||
dlg.setFilter("Disk Rom Images\0*.rom;\0All files\0*.*\0\0");
|
||||
dlg.setTitle("Select Disk Rom Image");
|
||||
dlg.setInitialDir(dir);
|
||||
if (dlg.show(0,g_hConfDlg)) {
|
||||
dlg.getpath(TempRomFileName,MAX_PATH);
|
||||
SendDlgItemMessage
|
||||
(hDlg,IDC_ROMPATH,WM_SETTEXT,0,(LPARAM)dlg.path());
|
||||
}
|
||||
}
|
||||
break;
|
||||
case IDC_CLOCK:
|
||||
case IDC_READONLY:
|
||||
break;
|
||||
|
||||
case IDCANCEL:
|
||||
DestroyWindow(hDlg);
|
||||
g_hConfDlg = nullptr;
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Access the settings object
|
||||
VCC::Util::settings& Setting()
|
||||
{
|
||||
return *gpSettings;
|
||||
}
|
||||
|
||||
void Unload_Disk(unsigned char disk) {
|
||||
unmount_disk_image(disk);
|
||||
SendMessage(gVccWnd,WM_VCC_UPD_MENU,(WPARAM) 0,(LPARAM) 0);
|
||||
SaveConfig();
|
||||
}
|
||||
|
||||
void Load_Disk(unsigned char disk)
|
||||
{
|
||||
HWND h_own = GetActiveWindow();
|
||||
FileDialog dlg;
|
||||
dlg.setInitialDir(FloppyPath);
|
||||
dlg.setFilter("Disk Images\0*.dsk;*.os9\0\0");
|
||||
dlg.setDefExt("dsk");
|
||||
dlg.setTitle("Insert Disk Image");
|
||||
dlg.setFlags(OFN_PATHMUSTEXIST);
|
||||
if (dlg.show(0,h_own)) {
|
||||
CreateFlag = 1;
|
||||
HANDLE hr = nullptr;
|
||||
dlg.getpath(gSelectedDiskFile,MAX_PATH);
|
||||
// Verify file exists
|
||||
hr = CreateFile
|
||||
(gSelectedDiskFile,0,FILE_SHARE_READ,nullptr,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,nullptr);
|
||||
// Create new disk file if it does not
|
||||
if (hr == INVALID_HANDLE_VALUE) {
|
||||
NewDiskNumber = disk;
|
||||
//DialogBox will set CreateFlag = 0 on cancel
|
||||
DialogBox(gModuleInstance, (LPCTSTR)IDD_NEWDISK, h_own, (DLGPROC)NewDisk);
|
||||
} else {
|
||||
CloseHandle(hr);
|
||||
}
|
||||
// Attempt mount if file existed or file create was not canceled
|
||||
if (CreateFlag==1) {
|
||||
if (mount_disk_image(gSelectedDiskFile,disk)==0) {
|
||||
MessageBox(g_hConfDlg,"Can't open file","Error",0);
|
||||
} else {
|
||||
dlg.getdir(FloppyPath);
|
||||
SendMessage(gVccWnd,WM_VCC_UPD_MENU,(WPARAM) 0,(LPARAM) 0);
|
||||
SaveConfig();
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned char SetChip(unsigned char Tmp)
|
||||
{
|
||||
if (Tmp!=QUERY)
|
||||
SelectRom=Tmp;
|
||||
return SelectRom;
|
||||
}
|
||||
|
||||
// Added for PakGetMenuItem export
|
||||
// Return items for cartridge menu. Called for each item
|
||||
bool get_menu_item(menu_item_entry* item, size_t index)
|
||||
{
|
||||
using VCC::Bus::gDllCartMenu;
|
||||
std::string disk;
|
||||
if (!item) return false;
|
||||
// request zero rebuilds the menu list
|
||||
if (index == 0) {
|
||||
gDllCartMenu.clear();
|
||||
gDllCartMenu.add("", 0, MIT_Seperator);
|
||||
gDllCartMenu.add("FD-502 Drive 0",0,MIT_Head);
|
||||
gDllCartMenu.add("Insert",ControlId(10),MIT_Slave);
|
||||
disk = VCC::Util::GetFileNamePart(gVirtualDrive[0].ImageName);
|
||||
gDllCartMenu.add("Eject: "+disk,ControlId(11),MIT_Slave);
|
||||
gDllCartMenu.add("FD-502 Drive 1",0,MIT_Head);
|
||||
gDllCartMenu.add("Insert",ControlId(12),MIT_Slave);
|
||||
disk = VCC::Util::GetFileNamePart(gVirtualDrive[1].ImageName);
|
||||
gDllCartMenu.add("Eject: "+disk,ControlId(13),MIT_Slave);
|
||||
gDllCartMenu.add("FD-502 Drive 2",0,MIT_Head);
|
||||
gDllCartMenu.add("Insert",ControlId(14),MIT_Slave);
|
||||
disk = VCC::Util::GetFileNamePart(gVirtualDrive[2].ImageName);
|
||||
gDllCartMenu.add("Eject: "+disk,ControlId(15),MIT_Slave);
|
||||
gDllCartMenu.add("FD-502 Drive 3",0,MIT_Head);
|
||||
gDllCartMenu.add("Insert",ControlId(17),MIT_Slave);
|
||||
disk = VCC::Util::GetFileNamePart(gVirtualDrive[3].ImageName);
|
||||
gDllCartMenu.add("Eject: "+disk,ControlId(18),MIT_Slave);
|
||||
gDllCartMenu.add("FD-502 Config",ControlId(16),MIT_StandAlone);
|
||||
}
|
||||
// return requested list item or false
|
||||
return gDllCartMenu.copy_item(*item, index);
|
||||
}
|
||||
|
||||
long CreateDisk (unsigned char Disk)
|
||||
{
|
||||
NewDiskNumber=Disk;
|
||||
HWND h_own = GetActiveWindow();
|
||||
DialogBox(gModuleInstance, (LPCTSTR)IDD_NEWDISK, h_own, (DLGPROC)NewDisk);
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CALLBACK NewDisk(HWND hDlg, UINT message, WPARAM wParam, LPARAM /*lParam*/)
|
||||
{
|
||||
unsigned char temp=0,temp2=0;
|
||||
static unsigned char NewDiskType=JVC,NewDiskTracks=2,DblSided=1;
|
||||
char Dummy[MAX_PATH]="";
|
||||
long DiskType[3]={IDC_JVC,IDC_VDK,IDC_DMK};
|
||||
long DiskTracks[3]={IDC_TR35,IDC_TR40,IDC_TR80};
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case WM_CLOSE:
|
||||
EndDialog(hDlg,LOWORD(wParam)); //Modal dialog
|
||||
return TRUE;
|
||||
|
||||
case WM_INITDIALOG:
|
||||
for (temp=0;temp<=2;temp++)
|
||||
SendDlgItemMessage(hDlg,DiskType[temp],BM_SETCHECK,(temp==NewDiskType),0);
|
||||
for (temp=0;temp<=2;temp++)
|
||||
SendDlgItemMessage(hDlg,DiskTracks[temp],BM_SETCHECK,(temp==NewDiskTracks),0);
|
||||
SendDlgItemMessage(hDlg,IDC_DBLSIDE,BM_SETCHECK,DblSided,0);
|
||||
strcpy(Dummy,gSelectedDiskFile);
|
||||
PathStripPath(Dummy);
|
||||
SendDlgItemMessage(hDlg,IDC_TEXT1,WM_SETTEXT,0,(LPARAM)(LPCSTR)Dummy);
|
||||
return TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDC_DMK:
|
||||
case IDC_JVC:
|
||||
case IDC_VDK:
|
||||
for (temp=0;temp<=2;temp++)
|
||||
if (LOWORD(wParam)==DiskType[temp])
|
||||
{
|
||||
for (temp2=0;temp2<=2;temp2++)
|
||||
SendDlgItemMessage(hDlg,DiskType[temp2],BM_SETCHECK,0,0);
|
||||
SendDlgItemMessage(hDlg,DiskType[temp],BM_SETCHECK,1,0);
|
||||
NewDiskType=temp;
|
||||
}
|
||||
break;
|
||||
|
||||
case IDC_TR35:
|
||||
case IDC_TR40:
|
||||
case IDC_TR80:
|
||||
for (temp=0;temp<=2;temp++)
|
||||
if (LOWORD(wParam)==DiskTracks[temp])
|
||||
{
|
||||
for (temp2=0;temp2<=2;temp2++)
|
||||
SendDlgItemMessage(hDlg,DiskTracks[temp2],BM_SETCHECK,0,0);
|
||||
SendDlgItemMessage(hDlg,DiskTracks[temp],BM_SETCHECK,1,0);
|
||||
NewDiskTracks=temp;
|
||||
}
|
||||
break;
|
||||
|
||||
case IDC_DBLSIDE:
|
||||
DblSided=!DblSided;
|
||||
SendDlgItemMessage(hDlg,IDC_DBLSIDE,BM_SETCHECK,DblSided,0);
|
||||
break;
|
||||
|
||||
case IDOK:
|
||||
{
|
||||
EndDialog(hDlg, LOWORD(wParam));
|
||||
const char *ext = gSelectedDiskFile + strlen(gSelectedDiskFile) - 4;
|
||||
if (ext < gSelectedDiskFile) ext = gSelectedDiskFile;
|
||||
// if it doesn't end with .dsk, append it
|
||||
if (_stricmp(ext, ".dsk") != 0)
|
||||
{
|
||||
PathRemoveExtension(gSelectedDiskFile);
|
||||
strcat(gSelectedDiskFile, ".dsk");
|
||||
}
|
||||
if (CreateDiskHeader(gSelectedDiskFile, NewDiskType, NewDiskTracks, DblSided))
|
||||
{
|
||||
strcpy(gSelectedDiskFile, "");
|
||||
MessageBox(g_hConfDlg, "Can't create File", "Error", 0);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case IDCANCEL:
|
||||
EndDialog(hDlg, LOWORD(wParam));
|
||||
CreateFlag=0;
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
long CreateDiskHeader(const char *FileName,unsigned char Type,unsigned char Tracks,unsigned char DblSided)
|
||||
{
|
||||
HANDLE hr=nullptr;
|
||||
unsigned char Dummy=0;
|
||||
unsigned char HeaderBuffer[16]="";
|
||||
unsigned char TrackTable[3]={35,40,80};
|
||||
unsigned short TrackSize=0x1900;
|
||||
unsigned char IgnoreDensity=0,SingleDensity=0,HeaderSize=0;
|
||||
unsigned long BytesWritten=0,FileSize=0;
|
||||
hr=CreateFile( FileName,GENERIC_READ | GENERIC_WRITE,0,nullptr,CREATE_NEW,FILE_ATTRIBUTE_NORMAL,nullptr);
|
||||
if (hr==INVALID_HANDLE_VALUE)
|
||||
return 1; //Failed to create File
|
||||
|
||||
switch (Type)
|
||||
{
|
||||
case DMK:
|
||||
HeaderBuffer[0]=0;
|
||||
HeaderBuffer[1]=TrackTable[Tracks];
|
||||
HeaderBuffer[2]=(TrackSize & 0xFF);
|
||||
HeaderBuffer[3]=(TrackSize >>8);
|
||||
HeaderBuffer[4]=(IgnoreDensity<<7) | (SingleDensity<<6) | ((!DblSided)<<4);
|
||||
HeaderBuffer[0xC]=0;
|
||||
HeaderBuffer[0xD]=0;
|
||||
HeaderBuffer[0xE]=0;
|
||||
HeaderBuffer[0xF]=0;
|
||||
HeaderSize=0x10;
|
||||
FileSize= HeaderSize + (HeaderBuffer[1] * TrackSize * (DblSided+1) );
|
||||
break;
|
||||
|
||||
case JVC: // has variable header size
|
||||
HeaderSize=0;
|
||||
HeaderBuffer[0]=18; //18 Sectors
|
||||
HeaderBuffer[1]=DblSided+1; // Double or single Sided;
|
||||
FileSize = (HeaderBuffer[0] * 0x100 * TrackTable[Tracks] * (DblSided+1));
|
||||
if (DblSided)
|
||||
{
|
||||
FileSize+=2;
|
||||
HeaderSize=2;
|
||||
}
|
||||
break;
|
||||
|
||||
case VDK:
|
||||
HeaderBuffer[9]=DblSided+1;
|
||||
HeaderSize=12;
|
||||
FileSize = ( 18 * 0x100 * TrackTable[Tracks] * (DblSided+1));
|
||||
FileSize+=HeaderSize;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
HeaderBuffer[0]=0;
|
||||
HeaderBuffer[1]=TrackTable[Tracks];
|
||||
HeaderBuffer[2]=(TrackSize & 0xFF);
|
||||
HeaderBuffer[3]=(TrackSize >>8);
|
||||
HeaderBuffer[4]=((!DblSided)<<4);
|
||||
HeaderBuffer[0xC]=0x12;
|
||||
HeaderBuffer[0xD]=0x34;
|
||||
HeaderBuffer[0xE]=0x56;
|
||||
HeaderBuffer[0xF]=0x78;
|
||||
HeaderSize=0x10;
|
||||
FileSize=1;
|
||||
break;
|
||||
|
||||
}
|
||||
SetFilePointer(hr,0,nullptr,FILE_BEGIN);
|
||||
WriteFile(hr,HeaderBuffer,HeaderSize,&BytesWritten,nullptr);
|
||||
SetFilePointer(hr,FileSize-1,nullptr,FILE_BEGIN);
|
||||
WriteFile(hr,&Dummy,1,&BytesWritten,nullptr);
|
||||
CloseHandle(hr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void LoadConfig() // Called on SetIniPath
|
||||
{
|
||||
unsigned char Index=0;
|
||||
char Temp[16]="";
|
||||
char DiskRomPath[MAX_PATH], RGBRomPath[MAX_PATH];
|
||||
char DiskName[MAX_PATH]="";
|
||||
unsigned int RetVal=0;
|
||||
|
||||
#ifdef COMBINE_BECKER
|
||||
BeckerEnabled=Setting().read(MS_BECKER,"DWEnable", 0);
|
||||
Setting().read(MS_BECKER,"DWServerAddr","127.0.0.1",BeckerAddr,MAX_PATH);
|
||||
Setting().read(MS_BECKER,"DWServerPort","65504",BeckerPort,32);
|
||||
if(*BeckerAddr == '\0') strcpy(BeckerAddr,"127.0.0.1");
|
||||
if(*BeckerPort == '\0') strcpy(BeckerPort,"65504");
|
||||
becker_sethost(BeckerAddr,BeckerPort);
|
||||
becker_enable(BeckerEnabled);
|
||||
#endif
|
||||
|
||||
Setting().read(MS_PATHS, "FloppyPath", "", FloppyPath, MAX_PATH);
|
||||
|
||||
SelectRom = Setting().read(MS_FD502,"DiskRom",1); //0 External 1=TRSDOS 2=RGB Dos
|
||||
Setting().read(MS_FD502,"RomPath","",RomFileName,MAX_PATH);
|
||||
PersistDisks=Setting().read(MS_FD502,"Persist",1);
|
||||
CheckPath(RomFileName);
|
||||
LoadExtRom(External,RomFileName); //JF
|
||||
GetModuleFileName(nullptr, DiskRomPath, MAX_PATH);
|
||||
PathRemoveFileSpec(DiskRomPath);
|
||||
strcpy(RGBRomPath, DiskRomPath);
|
||||
strcat(DiskRomPath, "disk11.rom");
|
||||
strcat(RGBRomPath, "rgbdos.rom");
|
||||
LoadExtRom(TandyDisk, DiskRomPath); // Why load?
|
||||
LoadExtRom(RGBDisk, RGBRomPath); // Why load?
|
||||
if (PersistDisks) // TODO: Fix this, checkbox was removed
|
||||
for (Index=0;Index<4;Index++)
|
||||
{
|
||||
sprintf(Temp,"Disk#%i",Index);
|
||||
Setting().read(MS_FD502,Temp,"",DiskName,MAX_PATH);
|
||||
if (strlen(DiskName))
|
||||
{
|
||||
RetVal=mount_disk_image(DiskName,Index);
|
||||
//MessageBox(0, "Disk load attempt", "OK", 0);
|
||||
if (RetVal)
|
||||
{
|
||||
if (!strcmp(DiskName,"*Floppy A:")) //RealDisks
|
||||
PhysicalDriveA=Index+1;
|
||||
if (!strcmp(DiskName,"*Floppy B:"))
|
||||
PhysicalDriveB=Index+1;
|
||||
}
|
||||
}
|
||||
}
|
||||
ClockEnabled=Setting().read(MS_FD502,"ClkEnable",1);
|
||||
SetTurboDisk(Setting().read(MS_FD502, "TurboDisk", 1));
|
||||
|
||||
SendMessage(gVccWnd,WM_VCC_UPD_MENU,(WPARAM) 0,(LPARAM) 0);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void SaveConfig()
|
||||
{
|
||||
unsigned char Index=0;
|
||||
char Temp[16]="";
|
||||
ValidatePath(RomFileName);
|
||||
Setting().write(MS_FD502,"DiskRom",SelectRom );
|
||||
Setting().write(MS_FD502,"RomPath",RomFileName);
|
||||
Setting().write(MS_FD502,"Persist",PersistDisks );
|
||||
if (PersistDisks)
|
||||
for (Index=0;Index<4;Index++)
|
||||
{
|
||||
sprintf(Temp,"Disk#%i",Index);
|
||||
Setting().write(MS_FD502,Temp,gVirtualDrive[Index].ImageName);
|
||||
}
|
||||
Setting().write(MS_FD502,"ClkEnable",ClockEnabled );
|
||||
Setting().write(MS_FD502, "TurboDisk", SetTurboDisk(QUERY));
|
||||
if (strcmp(FloppyPath, "") != 0) {
|
||||
Setting().write(MS_PATHS, "FloppyPath", FloppyPath);
|
||||
}
|
||||
#ifdef COMBINE_BECKER
|
||||
Setting().write(MS_BECKER,"DWEnable", BeckerEnabled);
|
||||
Setting().write(MS_BECKER,"DWServerAddr", BeckerAddr);
|
||||
Setting().write(MS_BECKER,"DWServerPort", BeckerPort);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned char LoadExtRom( unsigned char RomType,const char *FilePath) //Returns 1 on if loaded
|
||||
{
|
||||
FILE *rom_handle=nullptr;
|
||||
unsigned short index=0;
|
||||
unsigned char RetVal=0;
|
||||
unsigned char *ThisRom[3]={ExternalRom,DiskRom,RGBDiskRom};
|
||||
|
||||
rom_handle=fopen(FilePath,"rb");
|
||||
if (rom_handle==nullptr)
|
||||
memset(ThisRom[RomType],0xFF,EXTROMSIZE);
|
||||
else
|
||||
{
|
||||
while ((feof(rom_handle)==0) & (index<EXTROMSIZE))
|
||||
ThisRom[RomType][index++]=fgetc(rom_handle);
|
||||
RetVal=1;
|
||||
fclose(rom_handle);
|
||||
}
|
||||
|
||||
DLOG_C("load %s %d %d\n",FilePath,RomType,RetVal);
|
||||
return RetVal;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
/*
|
||||
Copyright 2015 by Joseph Forgione
|
||||
This file is part of VCC (Virtual Color Computer).
|
||||
|
||||
VCC (Virtual Color Computer) is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
VCC (Virtual Color Computer) is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with VCC (Virtual Color Computer). If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <vcc/bus/cpak_cartridge_definitions.h>
|
||||
#include <vcc/util/Settings.h>
|
||||
|
||||
extern slot_id_type gSlotId;
|
||||
extern PakAssertInteruptHostCallback AssertInt;
|
||||
|
||||
// Access settings object
|
||||
VCC::Util::settings& Setting();
|
||||
|
||||
// DO NOT REMOVE this or references to ituntil becker.dll is retired.
|
||||
// Then FD502 becker becomes permanant.
|
||||
#define COMBINE_BECKER
|
||||
|
||||
// FIXME: These need to be turned into a scoped enum and the signature of functions
|
||||
// that use them updated.
|
||||
#define External 0
|
||||
#define TandyDisk 1
|
||||
#define RGBDisk 2
|
||||
|
||||
@@ -0,0 +1,226 @@
|
||||
// Protect this file from the resource editor
|
||||
// All edits should be done by hand
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#error Fd502.rc is not editable by Visual C++, edit it by hand.
|
||||
#endif //APSTUDIO_INVOKED
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "winres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (United States) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""winres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
// DO NOT REMOVE until becker.dll is retired. Then FD502 becker becomes permanant.
|
||||
#define COMBINE_BECKER
|
||||
|
||||
IDD_CONFIG DIALOGEX 0, 0, 268, 185
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Floppy Configuration"
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x0
|
||||
BEGIN
|
||||
GROUPBOX "Dos Image",IDC_STATIC,3,3,260,65,BS_CENTER
|
||||
RADIOBUTTON "Disk Basic (disk11.rom file must be present in VCC folder)",IDC_TRSDOS,7,13,195,10,WS_TABSTOP
|
||||
RADIOBUTTON "RGB Dos (rgbdos.rom file must be present in VCC folder)",IDC_RGB,7,25,192,10,WS_TABSTOP
|
||||
RADIOBUTTON "External Rom Image :",IDC_EXTROM,7,37,79,10,WS_TABSTOP
|
||||
EDITTEXT IDC_ROMPATH,9,49,218,14,ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP
|
||||
PUSHBUTTON "Browse",IDC_BROWSE,230,49,29,14
|
||||
CONTROL "OverClock Disk Drive",IDC_TURBO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,75,90,10
|
||||
CONTROL "Persistent Disk Images",IDC_PERSIST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,87,90,10
|
||||
CONTROL "Disto Clock [0xFF50-51]",IDC_CLOCK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,99,90,10
|
||||
|
||||
#ifdef COMBINE_BECKER
|
||||
CONTROL "Becker Drivewire [0xFF41-42]",IDC_BECKER_ENAB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,110,75,130,10
|
||||
LTEXT "Server Address",IDC_STATIC,108,87,50,10
|
||||
LTEXT "Server Port",IDC_STATIC,120,99,40,10
|
||||
EDITTEXT IDC_BECKER_HOST,160,87,103,10,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_BECKER_PORT,160,100,30,10,ES_NUMBER
|
||||
#endif
|
||||
|
||||
GROUPBOX "Physical Disks",IDC_STATIC,3,118,260,43,BS_CENTER
|
||||
LTEXT "A:",IDC_STATIC,10,128,8,8,
|
||||
LTEXT "B:",IDC_STATIC,10,147,8,8,
|
||||
COMBOBOX IDC_DISKA,19,126,59,49,CBS_DROPDOWN | WS_VSCROLL
|
||||
COMBOBOX IDC_DISKB,19,144,59,51,CBS_DROPDOWN | WS_VSCROLL
|
||||
LTEXT "Windows 2000 or higher and FDRAWREAD driver are required for Physical Disk access",IDC_STATIC,85,133,141,22
|
||||
PUSHBUTTON "Cancel",IDCANCEL,40,166,50,14
|
||||
DEFPUSHBUTTON "OK",IDOK,160,166,50,14
|
||||
END
|
||||
|
||||
IDD_NEWDISK DIALOG 0, 0, 186, 70
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Create Disk Image"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "Yes",IDOK,106,52,32,14
|
||||
PUSHBUTTON "No",IDCANCEL,143,52,32,14
|
||||
RADIOBUTTON "JVC",IDC_JVC,8,20,33,10,BS_LEFT | BS_VCENTER
|
||||
GROUPBOX "Image Type",IDC_STATIC,4,10,47,42
|
||||
RADIOBUTTON "DMK",IDC_DMK,8,30,33,10,BS_LEFT | BS_VCENTER
|
||||
RADIOBUTTON "VDK",IDC_VDK,8,40,33,10,BS_LEFT | BS_VCENTER
|
||||
RADIOBUTTON "35",IDC_TR35,62,20,24,10
|
||||
GROUPBOX "Tracks",IDC_STATIC,54,10,41,42,BS_CENTER
|
||||
RADIOBUTTON "40",IDC_TR40,62,30,24,10
|
||||
RADIOBUTTON "80",IDC_TR80,62,40,24,10
|
||||
CONTROL "Double Sided",IDC_DBLSIDE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3,57,61,10
|
||||
LTEXT "",IDC_TEXT1,105,12,68,8
|
||||
LTEXT "File does not exist.",IDC_STATIC,105,25,70,8
|
||||
LTEXT "Create the file?",IDC_STATIC,105,35,48,8
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO
|
||||
BEGIN
|
||||
IDD_CONFIG, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 3
|
||||
RIGHTMARGIN, 286
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 171
|
||||
END
|
||||
|
||||
IDD_NEWDISK, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 3
|
||||
RIGHTMARGIN, 182
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 67
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 2,1,9,2
|
||||
PRODUCTVERSION 2,1,9,2
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x21L
|
||||
#else
|
||||
FILEFLAGS 0x20L
|
||||
#endif
|
||||
FILEOS 0x40004L
|
||||
FILETYPE 0x2L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "Comments", "Tandy FD-502 with 4 Floppy Drives & RAW support"
|
||||
VALUE "CompanyName", "Bitrot Software"
|
||||
VALUE "FileDescription", "DiskController"
|
||||
VALUE "FileVersion", "2.1.8.1"
|
||||
VALUE "InternalName", "DiskController"
|
||||
VALUE "LegalCopyright", "Copyright � 2010"
|
||||
VALUE "OriginalFilename", "fd502.dll"
|
||||
VALUE "ProductName", "Vcc Module file"
|
||||
VALUE "ProductVersion", "26-3133"
|
||||
VALUE "SpecialBuild", "Tandy Floppy Disk Controller"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// AFX_DIALOG_LAYOUT
|
||||
//
|
||||
|
||||
IDD_CONFIG AFX_DIALOG_LAYOUT
|
||||
BEGIN
|
||||
0
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_MODULE_NAME "FD-502"
|
||||
IDS_VERSION "3.0.1"
|
||||
IDS_DESCRIPTION "Emulate FD502 floppy controller with four floppy drives. Loads Disk Extended Color Basic (disl11.rom) or user selectable disk rom. Also includes Becker Port for communicating with Drivewire and a Disto Clock for use with OS-9. Uses SCS selectable disk ports. Plugs into the Program Pak port or Multi-Pak Interface."
|
||||
#ifdef COMBINE_BECKER
|
||||
IDS_CATNUMBER "+ Becker"
|
||||
#else
|
||||
IDS_CATNUMBER "26-3133"
|
||||
#endif
|
||||
END
|
||||
|
||||
#endif // English (United States) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Legacy|Win32">
|
||||
<Configuration>Legacy</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<SccProjectName />
|
||||
<SccLocalPath />
|
||||
<ProjectGuid>{F4DC9499-4FF1-4A56-83DD-6499062972AA}</ProjectGuid>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Legacy|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v141_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Legacy|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\vcc-base.props" />
|
||||
<Import Project="..\vcc-legacy.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\vcc-base.props" />
|
||||
<Import Project="..\vcc-release.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\vcc-base.props" />
|
||||
<Import Project="..\vcc-debug.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Legacy|Win32'">
|
||||
<LibraryPath>C:\Program Files %28x86%29\Windows Kits\8.1\Lib\winv6.3\um\x86;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;fd502_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ResourceCompile />
|
||||
<Link>
|
||||
<LinkDLL>true</LinkDLL>
|
||||
<AdditionalDependencies>WS2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Legacy|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;_USRDLL;fd502_EXPORTS;_LEGACY_VCC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalOptions>/arch:SSE</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0409</Culture>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<LinkDLL>true</LinkDLL>
|
||||
<AdditionalDependencies>WS2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;fd502_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalOptions>/arch:SSE</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<ResourceCompile />
|
||||
<Link>
|
||||
<LinkDLL>true</LinkDLL>
|
||||
<AdditionalDependencies>WS2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="distortc.cpp" />
|
||||
<ClCompile Include="fd502.cpp" />
|
||||
<ClCompile Include="wd1793.cpp" />
|
||||
<ClCompile Include="becker.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="defines.h" />
|
||||
<ClInclude Include="distortc.h" />
|
||||
<ClInclude Include="fd502.h" />
|
||||
<ClInclude Include="fdrawcmd.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="wd1793.h" />
|
||||
<ClInclude Include="becker.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="fd502.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\libcommon\libcommon.vcxproj">
|
||||
<Project>{e0aa25bd-5527-475f-8d8b-b549a6311b0c}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,291 @@
|
||||
#ifndef __FDRAWCMD_SYS__
|
||||
#define __FDRAWCMD_SYS__
|
||||
// fdrawcmd.sys
|
||||
//
|
||||
// Low-level floppy filter, by Simon Owen
|
||||
//
|
||||
// http://simonowen.com/fdrawcmd/
|
||||
|
||||
#ifndef FDRAWCMD_H
|
||||
#define FDRAWCMD_H
|
||||
|
||||
#ifndef CTL_CODE
|
||||
#include <winioctl.h>
|
||||
#endif
|
||||
|
||||
#define FDRAWCMD_VERSION 0x01000109 // Compile-time version, for structures and definitions below
|
||||
// Must be checked with run-time driver for compatibility
|
||||
|
||||
#define FD_CTL_CODE(i,m) CTL_CODE(FILE_DEVICE_UNKNOWN, i, m, FILE_READ_DATA|FILE_WRITE_DATA)
|
||||
|
||||
// If you're not using C/C++, use the IOCTL values below
|
||||
#define IOCTL_FDRAWCMD_GET_VERSION FD_CTL_CODE(0x888, METHOD_BUFFERED) // 0x0022e220
|
||||
|
||||
#define IOCTL_FDCMD_READ_TRACK FD_CTL_CODE(0x802, METHOD_OUT_DIRECT) // 0x0022e00a
|
||||
#define IOCTL_FDCMD_SPECIFY FD_CTL_CODE(0x803, METHOD_BUFFERED) // 0x0022e00c
|
||||
#define IOCTL_FDCMD_SENSE_DRIVE_STATUS FD_CTL_CODE(0x804, METHOD_BUFFERED) // 0x0022e010
|
||||
#define IOCTL_FDCMD_WRITE_DATA FD_CTL_CODE(0x805, METHOD_IN_DIRECT) // 0x0022e015
|
||||
#define IOCTL_FDCMD_READ_DATA FD_CTL_CODE(0x806, METHOD_OUT_DIRECT) // 0x0022e01a
|
||||
#define IOCTL_FDCMD_RECALIBRATE FD_CTL_CODE(0x807, METHOD_BUFFERED) // 0x0022e01c
|
||||
#define IOCTL_FDCMD_SENSE_INT_STATUS FD_CTL_CODE(0x808, METHOD_BUFFERED) // 0x0022e020 // added in 1.0.0.22
|
||||
#define IOCTL_FDCMD_WRITE_DELETED_DATA FD_CTL_CODE(0x809, METHOD_IN_DIRECT) // 0x0022e025
|
||||
#define IOCTL_FDCMD_READ_ID FD_CTL_CODE(0x80a, METHOD_BUFFERED) // 0x0022e028
|
||||
#define IOCTL_FDCMD_READ_DELETED_DATA FD_CTL_CODE(0x80c, METHOD_OUT_DIRECT) // 0x0022e032
|
||||
#define IOCTL_FDCMD_FORMAT_TRACK FD_CTL_CODE(0x80d, METHOD_BUFFERED) // 0x0022e034
|
||||
#define IOCTL_FDCMD_DUMPREG FD_CTL_CODE(0x80e, METHOD_BUFFERED) // 0x0022e038
|
||||
#define IOCTL_FDCMD_SEEK FD_CTL_CODE(0x80f, METHOD_BUFFERED) // 0x0022e03c
|
||||
#define IOCTL_FDCMD_VERSION FD_CTL_CODE(0x810, METHOD_BUFFERED) // 0x0022e040
|
||||
#define IOCTL_FDCMD_SCAN_EQUAL FD_CTL_CODE(0x811, METHOD_IN_DIRECT) // 0x0022e045 (not implemented yet)
|
||||
#define IOCTL_FDCMD_PERPENDICULAR_MODE FD_CTL_CODE(0x812, METHOD_BUFFERED) // 0x0022e048
|
||||
#define IOCTL_FDCMD_CONFIGURE FD_CTL_CODE(0x813, METHOD_BUFFERED) // 0x0022e04c
|
||||
#define IOCTL_FDCMD_LOCK FD_CTL_CODE(0x814, METHOD_BUFFERED) // 0x0022e050
|
||||
#define IOCTL_FDCMD_VERIFY FD_CTL_CODE(0x816, METHOD_BUFFERED) // 0x0022e058
|
||||
#define IOCTL_FDCMD_POWERDOWN_MODE FD_CTL_CODE(0x817, METHOD_BUFFERED) // 0x0022e05c (not implemented yet)
|
||||
#define IOCTL_FDCMD_PART_ID FD_CTL_CODE(0x818, METHOD_BUFFERED) // 0x0022e060
|
||||
#define IOCTL_FDCMD_SCAN_LOW_OR_EQUAL FD_CTL_CODE(0x819, METHOD_IN_DIRECT) // 0x0022e065 (not implemented yet)
|
||||
#define IOCTL_FDCMD_SCAN_HIGH_OR_EQUAL FD_CTL_CODE(0x81d, METHOD_IN_DIRECT) // 0x0022e075 (not implemented yet)
|
||||
#define IOCTL_FDCMD_SAVE FD_CTL_CODE(0x82e, METHOD_BUFFERED) // 0x0022e0b8 (not implemented yet)
|
||||
#define IOCTL_FDCMD_OPTION FD_CTL_CODE(0x833, METHOD_BUFFERED) // 0x0022e0cc (not implemented yet)
|
||||
#define IOCTL_FDCMD_RESTORE FD_CTL_CODE(0x84e, METHOD_BUFFERED) // 0x0022e138 (not implemented yet)
|
||||
#define IOCTL_FDCMD_DRIVE_SPEC_CMD FD_CTL_CODE(0x88e, METHOD_BUFFERED) // 0x0022e238 (not implemented yet)
|
||||
#define IOCTL_FDCMD_RELATIVE_SEEK FD_CTL_CODE(0x88f, METHOD_BUFFERED) // 0x0022e23c
|
||||
#define IOCTL_FDCMD_FORMAT_AND_WRITE FD_CTL_CODE(0x8ad, METHOD_BUFFERED) // 0x0022e2b4 (not implemented yet)
|
||||
|
||||
#define IOCTL_FD_SCAN_TRACK FD_CTL_CODE(0x900, METHOD_BUFFERED) // 0x0022e400
|
||||
#define IOCTL_FD_GET_RESULT FD_CTL_CODE(0x901, METHOD_BUFFERED) // 0x0022e404
|
||||
#define IOCTL_FD_RESET FD_CTL_CODE(0x902, METHOD_BUFFERED) // 0x0022e408
|
||||
#define IOCTL_FD_SET_MOTOR_TIMEOUT FD_CTL_CODE(0x903, METHOD_BUFFERED) // 0x0022e40c
|
||||
#define IOCTL_FD_SET_DATA_RATE FD_CTL_CODE(0x904, METHOD_BUFFERED) // 0x0022e410
|
||||
#define IOCTL_FD_GET_FDC_INFO FD_CTL_CODE(0x905, METHOD_BUFFERED) // 0x0022e414
|
||||
#define IOCTL_FD_GET_REMAIN_COUNT FD_CTL_CODE(0x906, METHOD_BUFFERED) // 0x0022e418 // added in 1.0.0.22
|
||||
#define IOCTL_FD_SET_DISK_CHECK FD_CTL_CODE(0x908, METHOD_BUFFERED) // 0x0022e420
|
||||
#define IOCTL_FD_SET_SHORT_WRITE FD_CTL_CODE(0x909, METHOD_BUFFERED) // 0x0022e424 // added in 1.0.0.22
|
||||
#define IOCTL_FD_SET_SECTOR_OFFSET FD_CTL_CODE(0x90a, METHOD_BUFFERED) // 0x0022e428 // added in 1.0.0.22
|
||||
#define IOCTL_FD_SET_HEAD_SETTLE_TIME FD_CTL_CODE(0x90b, METHOD_BUFFERED) // 0x0022e42c // added in 1.0.0.22
|
||||
#define IOCTL_FD_LOCK_FDC FD_CTL_CODE(0x910, METHOD_BUFFERED) // 0x0022e440 // obsolete from 1.0.1.0
|
||||
#define IOCTL_FD_UNLOCK_FDC FD_CTL_CODE(0x911, METHOD_BUFFERED) // 0x0022e444 // obsolete from 1.0.1.0
|
||||
#define IOCTL_FD_MOTOR_ON FD_CTL_CODE(0x912, METHOD_BUFFERED) // 0x0022e448
|
||||
#define IOCTL_FD_MOTOR_OFF FD_CTL_CODE(0x913, METHOD_BUFFERED) // 0x0022e44c
|
||||
#define IOCTL_FD_WAIT_INDEX FD_CTL_CODE(0x914, METHOD_BUFFERED) // 0x0022e450 // added in 1.0.0.22
|
||||
#define IOCTL_FD_TIMED_SCAN_TRACK FD_CTL_CODE(0x915, METHOD_BUFFERED) // 0x0022e454 // added in 1.0.0.22
|
||||
#define IOCTL_FD_RAW_READ_TRACK FD_CTL_CODE(0x916, METHOD_OUT_DIRECT) // 0x0022e45a // added in 1.0.1.4
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Command flags: multi-track, MFM, sector skip, relative seek direction, verify enable count
|
||||
#define FD_OPTION_MT 0x80
|
||||
#define FD_OPTION_MFM 0x40
|
||||
#define FD_OPTION_SK 0x20
|
||||
#define FD_OPTION_DIR 0x40
|
||||
#define FD_OPTION_EC 0x01
|
||||
|
||||
// FD_FDC_INFO controller types
|
||||
#define FDC_TYPE_UNKNOWN 0
|
||||
#define FDC_TYPE_UNKNOWN2 1
|
||||
#define FDC_TYPE_NORMAL 2
|
||||
#define FDC_TYPE_ENHANCED 3
|
||||
#define FDC_TYPE_82077 4
|
||||
#define FDC_TYPE_82077AA 5
|
||||
#define FDC_TYPE_82078_44 6
|
||||
#define FDC_TYPE_82078_64 7
|
||||
#define FDC_TYPE_NATIONAL 8
|
||||
|
||||
// FD_FDC_INFO supported drive speeds
|
||||
#define FDC_SPEED_250K 0x01
|
||||
#define FDC_SPEED_300K 0x02
|
||||
#define FDC_SPEED_500K 0x04
|
||||
#define FDC_SPEED_1M 0x08
|
||||
#define FDC_SPEED_2M 0x10
|
||||
|
||||
|
||||
#pragma pack(push,1)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4200) // allow zero-sized arrays
|
||||
|
||||
|
||||
typedef struct tagFD_ID_HEADER
|
||||
{
|
||||
BYTE cyl, head, sector, size;
|
||||
}
|
||||
FD_ID_HEADER, *PFD_ID_HEADER;
|
||||
|
||||
typedef struct tagFD_SEEK_PARAMS
|
||||
{
|
||||
BYTE cyl;
|
||||
BYTE head;
|
||||
}
|
||||
FD_SEEK_PARAMS, *PFD_SEEK_PARAMS;
|
||||
|
||||
typedef struct tagFD_RELATIVE_SEEK_PARAMS
|
||||
{
|
||||
BYTE flags; // DIR
|
||||
BYTE head;
|
||||
BYTE offset;
|
||||
}
|
||||
FD_RELATIVE_SEEK_PARAMS, *PFD_RELATIVE_SEEK_PARAMS;
|
||||
|
||||
typedef struct tagFD_READ_WRITE_PARAMS
|
||||
{
|
||||
BYTE flags; // MT MFM SK
|
||||
BYTE phead;
|
||||
BYTE cyl, head, sector, size;
|
||||
BYTE eot, gap, datalen;
|
||||
}
|
||||
FD_READ_WRITE_PARAMS, *PFD_READ_WRITE_PARAMS;
|
||||
|
||||
typedef struct tagFD_CMD_RESULT
|
||||
{
|
||||
BYTE st0, st1, st2;
|
||||
BYTE cyl, head, sector, size;
|
||||
}
|
||||
FD_CMD_RESULT, *PFD_CMD_RESULT;
|
||||
|
||||
typedef struct tagFD_FORMAT_PARAMS
|
||||
{
|
||||
BYTE flags; // MFM
|
||||
BYTE phead;
|
||||
BYTE size, sectors, gap, fill;
|
||||
|
||||
FD_ID_HEADER Header[];
|
||||
}
|
||||
FD_FORMAT_PARAMS, *PFD_FORMAT_PARAMS;
|
||||
|
||||
typedef struct tagFD_READ_ID_PARAMS
|
||||
{
|
||||
BYTE flags; // MFM
|
||||
BYTE head;
|
||||
}
|
||||
FD_READ_ID_PARAMS, *PFD_READ_ID_PARAMS;
|
||||
|
||||
typedef struct tagFD_CONFIGURE_PARAMS
|
||||
{
|
||||
BYTE eis_efifo_poll_fifothr; // b6 = enable implied seek, b5 = enable fifo, b4 = poll disable, b3-b0 = fifo threshold
|
||||
BYTE pretrk; // precompensation start track
|
||||
}
|
||||
FD_CONFIGURE_PARAMS, *PFD_CONFIGURE_PARAMS;
|
||||
|
||||
typedef struct tagFD_SPECIFY_PARAMS
|
||||
{
|
||||
BYTE srt_hut; // b7-b4 = step rate, b3-b0 = head unload time
|
||||
BYTE hlt_nd; // b7-b1 = head load time, b0 = non-DMA flag (unsupported)
|
||||
}
|
||||
FD_SPECIFY_PARAMS, *PFD_SPECIFY_PARAMS;
|
||||
|
||||
typedef struct tagFD_SENSE_PARAMS
|
||||
{
|
||||
BYTE head;
|
||||
}
|
||||
FD_SENSE_PARAMS, *PFD_SENSE_PARAMS;
|
||||
|
||||
typedef struct tagFD_DRIVE_STATUS
|
||||
{
|
||||
BYTE st3;
|
||||
}
|
||||
FD_DRIVE_STATUS, *PFD_DRIVE_STATUS;
|
||||
|
||||
typedef struct tagFD_INTERRUPT_STATUS
|
||||
{
|
||||
BYTE st0; // status register 0
|
||||
BYTE pcn; // present cylinder number
|
||||
}
|
||||
FD_INTERRUPT_STATUS, *PFD_INTERRUPT_STATUS;
|
||||
|
||||
typedef struct tagFD_PERPENDICULAR_PARAMS
|
||||
{
|
||||
BYTE ow_ds_gap_wgate; // b7 = OW, b6 = 0, b5-b2 = drive select, b1 = gap2, b0 = write gate pre-erase loads
|
||||
}
|
||||
FD_PERPENDICULAR_PARAMS, *PFD_PERPENDICULAR_PARAMS;
|
||||
|
||||
typedef struct tagFD_LOCK_PARAMS
|
||||
{
|
||||
BYTE lock; // b7 = lock
|
||||
}
|
||||
FD_LOCK_PARAMS, *PFD_LOCK_PARAMS;
|
||||
|
||||
typedef struct tagFD_LOCK_RESULT
|
||||
{
|
||||
BYTE lock; // b4 = lock
|
||||
}
|
||||
FD_LOCK_RESULT, *PFD_LOCK_RESULT;
|
||||
|
||||
typedef struct tagFD_DUMPREG_RESULT
|
||||
{
|
||||
BYTE pcn0, pcn1, pcn2, pcn3; // present cylinder numbers
|
||||
BYTE srt_hut; // b7-4 = step rate, b3-0 = head unload time
|
||||
BYTE hlt_nd; // b7-1 = head load time, b0 = non-dma mode
|
||||
BYTE sceot; // sector count / end of track
|
||||
BYTE lock_d0123_gap_wgate; // b7 = setting lock, b5-2 = drive selects, b1 = gap 2 (perpendicular), b0 = write gate
|
||||
BYTE eis_efifo_poll_fifothr; // b6 = implied seeks, b5 = fifo enable, b4 = poll disable, b3-0 = fifo threshold
|
||||
BYTE pretrk; // pre-comp start track
|
||||
}
|
||||
FD_DUMPREG_RESULT, *PFD_DUMPREG_RESULT;
|
||||
|
||||
typedef struct tagFD_SECTOR_OFFSET_PARAMS
|
||||
{
|
||||
BYTE sectors; // number of sectors to skip after index
|
||||
}
|
||||
FD_SECTOR_OFFSET_PARAMS, *PFD_SECTOR_OFFSET_PARAMS;
|
||||
|
||||
typedef struct tagFD_SHORT_WRITE_PARAMS
|
||||
{
|
||||
DWORD length; // length to write before interrupting
|
||||
DWORD finetune; // finetune delay in microseconds
|
||||
}
|
||||
FD_SHORT_WRITE_PARAMS, *PFD_SHORT_WRITE_PARAMS;
|
||||
|
||||
typedef struct tagFD_SCAN_PARAMS
|
||||
{
|
||||
BYTE flags; // MFM
|
||||
BYTE head;
|
||||
}
|
||||
FD_SCAN_PARAMS, *PFD_SCAN_PARAMS;
|
||||
|
||||
typedef struct tagFD_SCAN_RESULT
|
||||
{
|
||||
BYTE count; // count of returned headers
|
||||
FD_ID_HEADER Header[]; // array of 'count' id fields
|
||||
}
|
||||
FD_SCAN_RESULT, *PFD_SCAN_RESULT;
|
||||
|
||||
|
||||
typedef struct tagFD_TIMED_ID_HEADER
|
||||
{
|
||||
DWORD reltime; // time relative to index (in microseconds)
|
||||
BYTE cyl, head, sector, size;
|
||||
}
|
||||
FD_TIMED_ID_HEADER, *PFD_TIMED_ID_HEADER;
|
||||
|
||||
typedef struct tagFD_TIMED_SCAN_RESULT
|
||||
{
|
||||
BYTE count; // count of returned headers
|
||||
BYTE firstseen; // offset of first sector detected
|
||||
DWORD tracktime; // total time for track (in microseconds)
|
||||
FD_TIMED_ID_HEADER Header[]; // array of 'count' id fields
|
||||
}
|
||||
FD_TIMED_SCAN_RESULT, *PFD_TIMED_SCAN_RESULT;
|
||||
|
||||
typedef struct tagFD_FDC_INFO
|
||||
{
|
||||
BYTE ControllerType; // FDC_TYPE_*
|
||||
BYTE SpeedsAvailable; // FDC_SPEED_* values ORed together
|
||||
|
||||
BYTE BusType;
|
||||
DWORD BusNumber;
|
||||
DWORD ControllerNumber;
|
||||
DWORD PeripheralNumber;
|
||||
}
|
||||
FD_FDC_INFO, *PFD_FDC_INFO;
|
||||
|
||||
typedef struct tagFD_RAW_READ_PARAMS
|
||||
{
|
||||
BYTE flags; // MFM
|
||||
BYTE head, size;
|
||||
}
|
||||
FD_RAW_READ_PARAMS, *PFD_RAW_READ_PARAMS;
|
||||
|
||||
#pragma warning(pop)
|
||||
#pragma pack(pop)
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
void WriteLog(char *,unsigned char);
|
||||
void CpuDump(void);
|
||||
|
||||
|
||||
#define TOCONS 0
|
||||
#define TOFILE 1
|
||||
@@ -0,0 +1,59 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by fd502.rc
|
||||
//
|
||||
#define IDS_MODULE_NAME 1
|
||||
#define IDS_VERSION 2
|
||||
#define IDS_CATNUMBER 3
|
||||
#define IDS_DESCRIPTION 4
|
||||
#define IDD_CONFIG 101
|
||||
#define IDD_NEWDISK 102
|
||||
#define IDC_DRIVE0 1000
|
||||
#define IDC_DRIVE1 1001
|
||||
#define IDC_DRIVE2 1002
|
||||
#define IDC_EDIT1 1003
|
||||
#define IDC_EDITDRIVE0 1003
|
||||
#define IDC_PATH 1003
|
||||
#define IDC_ROMPATH 1003
|
||||
#define IDC_EDIT2 1004
|
||||
#define IDC_EDITDRIVE2 1004
|
||||
#define IDC_EDIT3 1005
|
||||
#define IDC_EDITDRIVE1 1005
|
||||
#define IDC_MOUNT 1006
|
||||
#define IDC_UNMOUNT 1007
|
||||
#define IDC_CREATE 1008
|
||||
#define IDC_TURBO 1009
|
||||
//#define IDC_KBLEDS 1010
|
||||
#define IDC_RGB 1011
|
||||
#define IDC_DMK 1012
|
||||
#define IDC_JVC 1013
|
||||
#define IDC_VDK 1014
|
||||
#define IDC_TR35 1015
|
||||
#define IDC_TR40 1016
|
||||
#define IDC_TR80 1017
|
||||
#define IDC_DBLSIDE 1018
|
||||
#define IDC_BROWSE 1019
|
||||
#define IDC_RAW 1019
|
||||
#define IDC_TEXT1 1022
|
||||
#define IDC_EXTROM 1023
|
||||
#define IDC_TRSDOS 1024
|
||||
#define IDC_PERSIST 1028
|
||||
#define IDC_DISKA 1029
|
||||
#define IDC_DISKB 1030
|
||||
#define IDC_CLOCK 1031
|
||||
#define IDC_READONLY 1032
|
||||
#define IDC_BECKER_ENAB 1033
|
||||
#define IDC_BECKER_HOST 1034
|
||||
#define IDC_BECKER_PORT 1035
|
||||
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 105
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1036
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,147 @@
|
||||
#ifndef __WD1793_H__
|
||||
#define __WD1793_H__
|
||||
/*
|
||||
Copyright 2015 by Joseph Forgione
|
||||
This file is part of VCC (Virtual Color Computer).
|
||||
|
||||
VCC (Virtual Color Computer) is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
VCC (Virtual Color Computer) is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with VCC (Virtual Color Computer). If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "defines.h"
|
||||
unsigned char disk_io_read(unsigned char port);
|
||||
void disk_io_write(unsigned char data,unsigned char port);
|
||||
int mount_disk_image(const char *,unsigned char );
|
||||
void unmount_disk_image(unsigned char drive);
|
||||
void DiskStatus(char* text_buffer, size_t buffer_size);
|
||||
void PingFdc();
|
||||
unsigned char SetTurboDisk( unsigned char);
|
||||
//unsigned char UseKeyboardLeds(unsigned char);
|
||||
DWORD GetDriverVersion ();
|
||||
unsigned short InitController ();
|
||||
//unsigned long UseRawDisk(unsigned char,unsigned char);
|
||||
// Commands for the wd1793 disk controller $FF48
|
||||
|
||||
struct DiskInfo
|
||||
{
|
||||
HANDLE FileHandle;
|
||||
char ImageName[MAX_PATH];
|
||||
long FileSize;
|
||||
unsigned char HeaderSize;
|
||||
unsigned char Sides; // Number of Sides 1 ot 2
|
||||
unsigned char Sectors; //Sectors Per Track
|
||||
unsigned char SectorSize; //0=128 1=256 2=512 3=1024
|
||||
unsigned char FirstSector; // 0 or 1
|
||||
unsigned char ImageType; //0=JVC 1=VDK 2=DMK 3=OS9
|
||||
unsigned short TrackSize;
|
||||
unsigned char WriteProtect;
|
||||
unsigned char HeadPosition; // The "Physical" Track the head is over
|
||||
unsigned char RawDrive;
|
||||
char ImageTypeName[4];
|
||||
};
|
||||
|
||||
struct SectorInfo
|
||||
{
|
||||
unsigned char Track = 0;
|
||||
unsigned char Side = 0;
|
||||
unsigned char Sector = 0;
|
||||
unsigned short Lenth = 0;
|
||||
unsigned short CRC = 0;
|
||||
long DAM = 0;
|
||||
unsigned char Density = 0;
|
||||
};
|
||||
|
||||
|
||||
#define IDLE 255
|
||||
#define NONE 4
|
||||
#define JVC 0
|
||||
#define VDK 1
|
||||
#define DMK 2
|
||||
#define OS9 3
|
||||
#define RAW 4
|
||||
|
||||
|
||||
//Control register masks
|
||||
#define CTRL_DRIVE0 0x01
|
||||
#define CTRL_DRIVE1 0x02
|
||||
#define CTRL_DRIVE2 0x04
|
||||
#define CTRL_MOTOR_EN 0x08
|
||||
#define CTRL_WRT_PRECMP 0x10
|
||||
#define CTRL_DENSITY 0x20
|
||||
#define CTRL_DRIVE3 0x40
|
||||
#define CTRL_HALT_FLAG 0x80
|
||||
#define SIDESELECT 0x40
|
||||
|
||||
//Status Register return codes
|
||||
#define READY 0
|
||||
#define BUSY 0x01
|
||||
#define DRQ 0x02
|
||||
#define INDEXPULSE 0x02
|
||||
#define TRACK_ZERO 0x04
|
||||
#define LOSTDATA 0x04
|
||||
#define RECNOTFOUND 0x10
|
||||
#define WRITEPROTECT 0x40
|
||||
|
||||
|
||||
#define WAITTIME 5
|
||||
#define STEPTIME 15 // 1 Millisecond = 15.78 Pings
|
||||
#define SETTLETIME 10 // CyclestoSettle
|
||||
|
||||
#define RESTORE 0
|
||||
#define SEEK 1
|
||||
#define STEP 2
|
||||
#define STEPUPD 3
|
||||
#define STEPIN 4
|
||||
#define STEPINUPD 5
|
||||
#define STEPOUT 6
|
||||
#define STEPOUTUPD 7
|
||||
#define READSECTOR 8
|
||||
#define READSECTORM 9
|
||||
#define WRITESECTOR 10
|
||||
#define WRITESECTORM 11
|
||||
#define READADDRESS 12
|
||||
#define FORCEINTERUPT 13
|
||||
#define READTRACK 14
|
||||
#define WRITETRACK 15
|
||||
|
||||
#define HEADERBUFFERSIZE 256
|
||||
|
||||
|
||||
//#define IOCTL_KEYBOARD_SET_INDICATORS CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0002, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||
//#define IOCTL_KEYBOARD_QUERY_TYPEMATIC CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0008, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||
//#define IOCTL_KEYBOARD_QUERY_INDICATORS CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0010, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||
|
||||
//typedef struct _KEYBOARD_INDICATOR_PARAMETERS {
|
||||
// USHORT UnitId; // Unit identifier.
|
||||
// USHORT LedFlags; // LED indicator state.
|
||||
//
|
||||
//} KEYBOARD_INDICATOR_PARAMETERS, *PKEYBOARD_INDICATOR_PARAMETERS;
|
||||
|
||||
//#define KEYBOARD_CAPS_LOCK_ON 4
|
||||
//#define KEYBOARD_NUM_LOCK_ON 2
|
||||
//#define KEYBOARD_SCROLL_LOCK_ON 1
|
||||
|
||||
|
||||
//
|
||||
#define DISK_SIDES 1 // sides per disk
|
||||
#define DISK_TRACKS 35 // tracks per side
|
||||
#define DISK_SECTORS 18 // sectors per track
|
||||
#define DISK_DATARATE 2 // 2 is double-density
|
||||
#define SECTOR_SIZE_CODE 1 // 0=128, 1=256, 2=512, 3=1024, ...
|
||||
#define SECTOR_GAP3 16 // gap3 size between sectors
|
||||
#define SECTOR_FILL 0xFF // fill byte for formatted sectors
|
||||
#define SECTOR_BASE 1 // first sector number on track
|
||||
#define TRACK_SKEW 1 // format skew to the same sector on the next track
|
||||
|
||||
#define TRACK_SIZE ((128<<SECTOR_SIZE_CODE)*DISK_SECTORS)
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user