Publish VCC Plus OSS source distribution for 3.6.2 build 60

This commit is contained in:
Brian Holman committed 2026-11-13 00:14:03 -07:00
commit c652a5276d
1192 files changed
+272368

No files matched your search

+41
View File
@@ -0,0 +1,41 @@
========================================================================
DYNAMIC LINK LIBRARY : DiskController
========================================================================
AppWizard has created this DiskController DLL for you.
This file contains a summary of what you will find in each of the files that
make up your DiskController application.
DiskController.dsp
This file (the project file) contains information at the project level and
is used to build a single project or subproject. Other users can share the
project (.dsp) file, but they should export the makefiles locally.
DiskController.cpp
This is the main DLL source file.
When created, this DLL does not export any symbols. As a result, it
will not produce a .lib file when it is built. If you wish this project
to be a project dependency of some other project, you will either need to
add code to export some symbols from the DLL so that an export library
will be produced, or you can check the "doesn't produce lib" checkbox in
the Linker settings page for this project.
/////////////////////////////////////////////////////////////////////////////
Other standard files:
StdAfx.h, StdAfx.cpp
These files are used to build a precompiled header (PCH) file
named DiskController.pch and a precompiled types file named StdAfx.obj.
/////////////////////////////////////////////////////////////////////////////
Other notes:
AppWizard uses "TODO:" to indicate parts of the source code you
should add to or customize.
/////////////////////////////////////////////////////////////////////////////
+298
View File
@@ -0,0 +1,298 @@
/*
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/>.
*/
// cc3vhd.c
/****************************************************************************
* Technical specs on the Virtual Hard Disk interface
*
* Address Description
* ------- -----------
* FF80 Logical record number (high byte)
* FF81 Logical record number (middle byte)
* FF82 Logical record number (low byte)
* FF83 Command/status register
* FF84 Buffer address (high byte)
* FF85 Buffer address (low byte)
* FF86 Drive select (0 or 1)
*
* Set the other registers, and then issue a command to FF83 as follows:
*
* 0 = read 256-byte sector at LRN
* 1 = write 256-byte sector at LRN
* 2 = flush write cache (Closes and then opens the image file)
* Note: Vcc just issues a "FlushFileBuffers" command.
*
* Error values:
*
* 0 = no error
* -1 = power-on state (before the first command is recieved)
* -2 = invalid command
* 2 = VHD image does not exist
* 4 = Unable to open VHD image file
* 5 = access denied (may not be able to write to VHD image)
*
* IMPORTANT: The I/O buffer must NOT cross an 8K MMU bank boundary.
* Note: This is not an issue for Vcc.
****************************************************************************/
#include <Windows.h>
#include <stdio.h>
#include "cc3vhd.h"
#include "harddisk.h"
#include <vcc/util/FileOps.h>
typedef union {
unsigned int All;
struct {
unsigned char lswlsb,lswmsb,mswlsb,mswmsb;
} Byte;
} SECOFF;
typedef union {
unsigned int word;
struct {
unsigned char lsb,msb;
} Byte;
} Address;
static int DriveSelect=0;
static HANDLE HardDrive[2]={INVALID_HANDLE_VALUE,INVALID_HANDLE_VALUE};
static SECOFF SectorOffset;
static Address DMAaddress;
static unsigned char SectorBuffer[SECTORSIZE];
static unsigned char Mounted[2]={0,0};
static unsigned char WpHD[2]={0,0};
static unsigned short ScanCount=64;
static unsigned long LastSectorNum=0;
static char DStatus[128]="";
static char Status = HD_PWRUP;
unsigned long BytesMoved=0;
void HDcommand(unsigned char);
int MountHD(const char* FileName, int drive)
{
drive = drive&1; // Drive can be 0 or 1
// Unmount existing
if (HardDrive[drive] != INVALID_HANDLE_VALUE) UnmountHD(drive);
// Assume mount will work for now
WpHD[drive]=0;
Mounted[drive]=1;
Status = HD_OK;
SectorOffset.All = 0;
DMAaddress.word = 0;
HardDrive[drive] = CreateFile( FileName,
GENERIC_READ | GENERIC_WRITE,
0,nullptr,OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,nullptr);
// If can't open read/write try read only.
if (HardDrive[drive] == INVALID_HANDLE_VALUE) {
HardDrive[drive] = CreateFile( FileName,
GENERIC_READ,
0,nullptr,OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,nullptr);
WpHD[drive]=1; // drive is write protected
}
// Give up if can't open either way
if (HardDrive[drive] == INVALID_HANDLE_VALUE) {
WpHD[drive]=0;
Mounted[drive]=0;
Status = HD_NODSK;
return 0;
}
return 1;
}
void UnmountHD(int drive)
{
drive = drive&1; // Drive can be 0 or 1
if (HardDrive[drive] != INVALID_HANDLE_VALUE) {
CloseHandle(HardDrive[drive]);
HardDrive[drive] = INVALID_HANDLE_VALUE;
Mounted[drive] = 0;
Status = HD_NODSK;
}
return;
}
// Clear drive select on reset
void VhdReset() {
MemWrite(0,0xFF86);
}
void HDcommand(unsigned char Command) {
unsigned short Temp=0;
// Verify drive is mounted
if (Mounted[DriveSelect] == 0) {
Status = HD_NODSK;
return;
}
switch (Command) {
case SECTOR_READ:
// Verify desired sector is in range
if (SectorOffset.All > MAX_SECTOR) {
Status = HD_NODSK;
return;
}
// Seek desired sector
SetFilePointer(HardDrive[DriveSelect],SectorOffset.All,nullptr,FILE_BEGIN);
// Read it; zero fill if past end of file
ReadFile(HardDrive[DriveSelect],SectorBuffer,SECTORSIZE,&BytesMoved,nullptr);
for (Temp=0; Temp < SECTORSIZE;Temp++) {
if (Temp > BytesMoved) {
MemWrite(0,Temp+DMAaddress.word);
} else {
MemWrite(SectorBuffer[Temp],Temp+DMAaddress.word);
}
}
Status = HD_OK;
// Put disk status text
sprintf(DStatus,"HD%d: Rd %000000.6X",DriveSelect,SectorOffset.All>>8);
break;
case SECTOR_WRITE:
// Verify desired sector is in range
if (SectorOffset.All > MAX_SECTOR) {
Status = HD_NODSK;
return;
}
// Check for write protect (file opened read only)
if (WpHD[DriveSelect] == 1 ) {
Status = HD_WP;
return;
}
// Copy block from from CoCo RAM
for (Temp=0; Temp <SECTORSIZE;Temp++) {
SectorBuffer[Temp]=MemRead(Temp+DMAaddress.word);
}
// Seek desired sector
SetFilePointer(HardDrive[DriveSelect],SectorOffset.All,nullptr,FILE_BEGIN);
// Write it
WriteFile(HardDrive[DriveSelect],SectorBuffer,SECTORSIZE,&BytesMoved,nullptr);
if (BytesMoved != SECTORSIZE) {
Status = HD_NODSK;
} else {
Status = HD_OK;
}
// Put disk status text
sprintf(DStatus,"HD: Wr Sec %000000.6X",SectorOffset.All>>8);
break;
case DISK_FLUSH:
FlushFileBuffers(HardDrive[DriveSelect]);
SectorOffset.All=0;
DMAaddress.word=0;
Status = HD_OK;
break;
default:
Status = HD_INVLD;
return;
}
}
void DiskStatus(char* text_buffer, size_t buffer_size)
{
strcpy(text_buffer,DStatus);
ScanCount++;
if (SectorOffset.All != LastSectorNum) {
ScanCount=0;
LastSectorNum=SectorOffset.All;
}
if (ScanCount > 63) {
ScanCount=0;
if (Mounted[DriveSelect]==1) {
sprintf(DStatus,"HD%d:IDLE",DriveSelect);
} else {
sprintf(DStatus,"HD%d:No Image!",DriveSelect);
}
}
return;
}
void IdeWrite(unsigned char data,unsigned char port)
{
switch (port-0x80) {
case 0:
SectorOffset.Byte.mswmsb = data;
break;
case 1:
SectorOffset.Byte.mswlsb = data;
break;
case 2:
SectorOffset.Byte.lswmsb = data;
break;
case 3:
HDcommand(data);
break;
case 4:
DMAaddress.Byte.msb=data;
break;
case 5:
DMAaddress.Byte.lsb=data;
break;
case 6:
// Only select drive if data is 0 or 1
if (data == (data&1)) DriveSelect = data;
break;
}
return;
}
unsigned char IdeRead(unsigned char port)
{
switch (port-0x80) {
case 0:
return(SectorOffset.Byte.mswmsb);
case 1:
return(SectorOffset.Byte.mswlsb);
case 2:
return(SectorOffset.Byte.lswmsb);
case 3:
return Status;
case 4:
return(DMAaddress.Byte.msb);
case 5:
return(DMAaddress.Byte.lsb);
case 6:
return DriveSelect;
}
return 0;
}
+47
View File
@@ -0,0 +1,47 @@
#ifndef __CC3VHD_H__
#define __CC3VHD_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/>.
*/
// cc3vhd.h
void UnmountHD(int);
int MountHD(const char*, int);
unsigned char IdeRead(unsigned char);
void IdeWrite (unsigned char, unsigned char);
void DiskStatus(char* text_buffer, size_t buffer_size);
void VhdReset();
constexpr auto DRIVESIZE = 512u; // Mb
constexpr auto MAX_SECTOR = DRIVESIZE * 1024 * 1024;
constexpr auto SECTORSIZE = 256u;
// FIXME: These need should probably be turned into a scoped enum.
constexpr auto HD_OK = 0;
constexpr auto HD_PWRUP = -1;
constexpr auto HD_INVLD = -2;
constexpr auto HD_NODSK = 4;
constexpr auto HD_WP = 5;
// FIXME: These need should probably be turned into a scoped enum.
constexpr auto SECTOR_READ = 0u;
constexpr auto SECTOR_WRITE = 1u;
constexpr auto DISK_FLUSH = 2u;
#endif
+464
View File
@@ -0,0 +1,464 @@
//#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/>.
//
//======================================================================
#include <Windows.h>
#include <stdio.h>
#include<iostream>
#include "resource.h"
#include "cc3vhd.h"
#include <vcc/devices/cloud9.h>
#include <vcc/util/FileOps.h>
#include <vcc/util/DialogOps.h>
#include "../../../src/core/Interrupts.h"
#include <vcc/bus/cpak_cartridge_definitions.h>
#include <vcc/bus/cartridge_menu.h>
#include <vcc/bus/cartridge_messages.h>
#include <vcc/util/fileutil.h>
#include <vcc/util/limits.h>
#include <vcc/util/settings.h>
constexpr auto DEF_HD_SIZE = 132480u;
static char VHDfile0[MAX_PATH] { 0 };
static char VHDfile1[MAX_PATH] { 0 };
static char *VHDfile; // Selected drive file name
static char NewVHDfile[MAX_PATH];
static char HardDiskPath[MAX_PATH];
static ::VCC::Device::rtc::cloud9 cloud9_rtc;
static slot_id_type gSlotId {};
static PakReadMemoryByteHostCallback MemRead8 = nullptr;
static PakWriteMemoryByteHostCallback MemWrite8 = nullptr;
static int ClockEnabled = 1;
static int ClockReadOnly = 1;
LRESULT CALLBACK NewDisk(HWND,UINT, WPARAM, LPARAM);
///void Load_Disk(unsigned char);
void LoadHardDisk(int drive);
void LoadConfig();
void SaveConfig();
int CreateDisk(HWND,int);
static HINSTANCE gModuleInstance;
static HWND hConfDlg = nullptr;
LRESULT CALLBACK Config(HWND, UINT, WPARAM, LPARAM );
// Added for PakGetMenuItem export
bool get_menu_item(menu_item_entry* item, size_t index);
// Added for PakGetMenuItem export
static HWND gVccWnd = nullptr;
// Access the settings object
static VCC::Util::settings* gpSettings = nullptr;
VCC::Util::settings& Setting() {return *gpSettings;}
//=================================================================================
using namespace std;
void MemWrite(unsigned char Data, unsigned short Address)
{
MemWrite8(gSlotId, Data, Address);
}
unsigned char MemRead(unsigned short Address)
{
return MemRead8(gSlotId, Address);
}
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)
{
gSlotId = SlotId;
gVccWnd = hVccWnd;
MemRead8 = callbacks->read_memory_byte;
MemWrite8 = callbacks->write_memory_byte;
gpSettings = new VCC::Util::settings(configuration_path);
LoadConfig();
cloud9_rtc.set_read_only(ClockReadOnly);
VhdReset(); // Selects drive zero
// Request menu rebuild
SendMessage(gVccWnd,WM_VCC_UPD_MENU,(WPARAM) 0,(LPARAM) 0);
}
__declspec(dllexport) bool PakGetMenuItem(menu_item_entry* item, size_t index)
{
return get_menu_item(item, index);
}
__declspec(dllexport) void PakTerminate()
{
CloseCartDialog(hConfDlg);
UnmountHD(0);
UnmountHD(1);
}
}
// Configure the hard drive(s). Called from menu
// Mount or dismount a hard drive and save config
// MountHD and UnmountHD are defined in cc3vhd
extern "C"
{
__declspec(dllexport) void
PakMenuItemClicked(unsigned char MenuID)
{
switch (MenuID)
{
case 10:
LoadHardDisk(0);
break;
case 11:
UnmountHD(0);
*VHDfile0 = '\0';
break;
case 12:
LoadHardDisk(1);
break;
case 13:
UnmountHD(1);
*VHDfile1 = '\0';
break;
case 14:
if (hConfDlg == nullptr)
hConfDlg = CreateDialog(gModuleInstance,(LPCTSTR)IDD_CONFIG,GetActiveWindow(),(DLGPROC)Config);
ShowWindow(hConfDlg,1);
return;
}
SaveConfig();
// FIXME should only rebuild menus if drive is changed
SendMessage(gVccWnd,WM_VCC_UPD_MENU,(WPARAM) 0,(LPARAM) 0);
return;
}
}
LRESULT CALLBACK Config(HWND hDlg, UINT message, WPARAM wParam, LPARAM /*lParam*/)
{
switch (message)
{
case WM_CLOSE:
DestroyWindow(hDlg);
hConfDlg=nullptr;
return TRUE;
case WM_INITDIALOG:
CenterDialog(hDlg);
SendDlgItemMessage(hDlg, IDC_CLOCK, BM_SETCHECK, ClockEnabled, 0);
SendDlgItemMessage(hDlg, IDC_READONLY, BM_SETCHECK, ClockReadOnly, 0);
EnableWindow(GetDlgItem(hDlg, IDC_CLOCK), TRUE);
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDOK:
ClockEnabled = SendDlgItemMessage(hDlg, IDC_CLOCK, BM_GETCHECK, 0, 0) != 0;
ClockReadOnly = SendDlgItemMessage(hDlg, IDC_READONLY, BM_GETCHECK, 0, 0) != 0;
cloud9_rtc.set_read_only(ClockReadOnly);
SaveConfig();
DestroyWindow(hDlg);
hConfDlg=nullptr;
break;
case IDCANCEL:
EndDialog(hDlg, LOWORD(wParam));
DestroyWindow(hDlg);
hConfDlg=nullptr;
break;
}
}
return 0;
}
// Export write to HD control port
extern "C"
{
__declspec(dllexport) void
PakWritePort(unsigned char Port,unsigned char Data)
{
IdeWrite(Data,Port);
return;
}
}
// Export read from HD control port
extern "C"
{
__declspec(dllexport) unsigned char PakReadPort(unsigned char Port)
{
if (((Port == 0x78) | (Port == 0x79) | (Port == 0x7C)) & ClockEnabled)
return cloud9_rtc.read_port(Port);
return(IdeRead(Port));
}
}
// Return disk status. (from cc3vhd)
extern "C"
{
__declspec(dllexport) void
PakGetStatus(char* text_buffer, size_t buffer_size)
{
DiskStatus(text_buffer, buffer_size);
}
}
BOOL WINAPI DllMain( HINSTANCE hinstDLL, // handle to DLL module
DWORD fdwReason, // reason for calling function
LPVOID lpReserved ) // reserved
{
if (fdwReason == DLL_PROCESS_ATTACH) {
gModuleInstance = hinstDLL;
} else if (fdwReason == DLL_PROCESS_DETACH) {
PakTerminate();
}
return TRUE;
}
// Get filename from user and mount harddrive
void LoadHardDisk(int drive)
{
char msg[300];
// Select VHD FileName buffer as per drive
switch (drive) {
case 0:
VHDfile = VHDfile0;
break;
case 1:
VHDfile = VHDfile1;
break;
default:
return;
}
HWND hWnd = GetActiveWindow();
FileDialog dlg;
dlg.setpath(VHDfile);
dlg.setFilter("Hard Disk Images\0*.vhd;*.os9;*.img\0All files\0*.*\0\0");
dlg.setDefExt("vhd");
dlg.setTitle(TEXT("Load HardDisk Image") );
dlg.setInitialDir(HardDiskPath);
dlg.setFlags(OFN_PATHMUSTEXIST);
if (dlg.show(0,hWnd)) {
dlg.getpath(NewVHDfile,MAX_PATH);
// Present new disk dialog if file does not exist
if (GetFileAttributes(NewVHDfile) == INVALID_FILE_ATTRIBUTES) {
// Dialog box returns zero if file is not created
if (DialogBox(gModuleInstance,(LPCTSTR)IDD_NEWDISK,hWnd,(DLGPROC)NewDisk)==0)
return;
}
// Actual file mount is done in cc3vhd
if (MountHD(NewVHDfile,drive)==0) {
snprintf(msg,300,"Can't mount %s",NewVHDfile);
MessageBox(hWnd,msg,"Error",0);
*VHDfile = '\0';
return;
}
strncpy(VHDfile,NewVHDfile,MAX_PATH);
// Save vhd directory for config file
dlg.getdir(HardDiskPath);
SaveConfig();
}
return;
}
// Get configuration items from ini file
void LoadConfig()
{
char ModName[MAX_LOADSTRING]="";
HANDLE hr;
Setting().read("DefaultPaths","HardDiskPath","",HardDiskPath, MAX_PATH);
// Determine module name for config lookups
LoadString(gModuleInstance,IDS_MODULE_NAME, ModName, MAX_LOADSTRING);
// Verify HD0 image file exists and mount it.
Setting().read(ModName,"VHDImage","",VHDfile0,MAX_PATH);
CheckPath(VHDfile0);
hr = CreateFile (VHDfile0,0,FILE_SHARE_READ,nullptr,
OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,nullptr);
if (hr==INVALID_HANDLE_VALUE) {
strcpy(VHDfile0,"");
Setting().write(ModName,"VHDImage","");
} else {
CloseHandle(hr);
MountHD(VHDfile0,0);
}
// Verify HD1 image file exists and mount it.
Setting().read(ModName,"VHDImage1","",VHDfile1,MAX_PATH);
CheckPath(VHDfile1);
hr = CreateFile (VHDfile1,0,FILE_SHARE_READ,nullptr,
OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,nullptr);
if (hr==INVALID_HANDLE_VALUE) {
strcpy(VHDfile1,"");
Setting().write(ModName,"VHDImage1","");
} else {
CloseHandle(hr);
MountHD(VHDfile1,1);
}
ClockEnabled = Setting().read(ModName,"ClkEnable",1);
ClockReadOnly = Setting().read(ModName,"ClkRdOnly",1);
// Create config menu
SendMessage(gVccWnd,WM_VCC_UPD_MENU,(WPARAM) 0,(LPARAM) 0);
return;
}
// Save config saves the hard disk path and vhd file names
void SaveConfig()
{
char ModName[MAX_LOADSTRING]="";
LoadString(gModuleInstance,IDS_MODULE_NAME,ModName, MAX_LOADSTRING);
ValidatePath(VHDfile0);
ValidatePath(VHDfile1);
if (strcmp(HardDiskPath, "") != 0) {
Setting().write("DefaultPaths","HardDiskPath",HardDiskPath);
}
Setting().write(ModName,"VHDImage",VHDfile0);
Setting().write(ModName,"VHDImage1",VHDfile1);
Setting().write(ModName,"ClkEnable",ClockEnabled);
Setting().write(ModName,"ClkRdOnly",ClockReadOnly);
return;
}
// 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("HD Drive 0",0,MIT_Head);
gDllCartMenu.add("Insert",ControlId(10),MIT_Slave);
disk = VCC::Util::GetFileNamePart(VHDfile0);
gDllCartMenu.add("Eject: "+disk,ControlId(11),MIT_Slave);
gDllCartMenu.add("HD Drive 1",0,MIT_Head);
gDllCartMenu.add("Insert",ControlId(12),MIT_Slave);
disk = VCC::Util::GetFileNamePart(VHDfile1);
gDllCartMenu.add("Eject: "+disk,ControlId(13),MIT_Slave);
gDllCartMenu.add("HD Config",ControlId(14),MIT_StandAlone);
}
// return requested list item or false
return gDllCartMenu.copy_item(*item, index);
}
// Dialog for creating a new hard disk
LRESULT CALLBACK NewDisk(HWND hDlg, UINT message, WPARAM wParam, LPARAM /*lParam*/)
{
unsigned int hdsize=DEF_HD_SIZE;
switch (message)
{
case WM_CLOSE:
EndDialog(hDlg,LOWORD(wParam)); //Modal dialog
return TRUE;
case WM_INITDIALOG:
SetDlgItemInt(hDlg,IDC_HDSIZE,DEF_HD_SIZE,0);
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
hdsize=GetDlgItemInt(hDlg,IDC_HDSIZE,nullptr,0);
EndDialog(hDlg,CreateDisk(hDlg,hdsize));
break;
case IDCANCEL:
EndDialog(hDlg,0);
break;
}
break;
}
return FALSE;
}
// Create a new disk file, return 1 on success
int CreateDisk(HWND hDlg, int hdsize)
{
HANDLE hr=CreateFile( NewVHDfile, GENERIC_READ | GENERIC_WRITE,
0,nullptr,CREATE_NEW,FILE_ATTRIBUTE_NORMAL,nullptr);
if (hr==INVALID_HANDLE_VALUE) {
*NewVHDfile='\0';
MessageBox(hDlg,"Can't create File","Error",0);
return 0;
}
if (hdsize>0) {
SetFilePointer(hr, hdsize * 1024, nullptr, FILE_BEGIN);
SetEndOfFile(hr);
}
CloseHandle(hr);
return 1;
}
+23
View File
@@ -0,0 +1,23 @@
#ifndef __HARDDISK_H__
#define __HARDDISK_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/>.
*/
void MemWrite(unsigned char,unsigned short );
unsigned char MemRead(unsigned short );
#endif
+175
View File
@@ -0,0 +1,175 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,1,8,3
PRODUCTVERSION 2,1,8,3
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", "Emulator Hard Disk Controller with 130Mb drive\0"
VALUE "CompanyName", "BitRot Software.\0"
VALUE "FileDescription", "Hard Disk\0"
VALUE "FileVersion", "2.1.8.3\0"
VALUE "InternalName", "Hard Disk\0"
VALUE "LegalCopyright", "Copyright � 2010\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "harddisk.dll\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "Vcc Module file\0"
VALUE "ProductVersion", "2.1.8.3\0"
VALUE "SpecialBuild", "RGB Hard Disk Controller\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_CONFIG DIALOG DISCARDABLE 0, 0, 170, 50
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Virtual Hard Disk Config"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,113,7,50,14
PUSHBUTTON "Cancel",IDCANCEL,113,24,50,14
CONTROL "Clock at 0xFF70",IDC_CLOCK,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,7,7,66,10
CONTROL "Clock is Read-Only",IDC_READONLY,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,18,81,10
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_CONFIG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 163
TOPMARGIN, 7
BOTTOMMARGIN, 55
END
END
#endif // APSTUDIO_INVOKED
IDD_NEWDISK DIALOG 50, 50, 150, 80
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Create Hard Disk Image"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "VHD file does not exist",IDC_STATIC,35,7,90,8
DEFPUSHBUTTON "Create New File",IDOK,14,21,70,14
PUSHBUTTON "Cancel",IDCANCEL,88,21,50,14
LTEXT "Initial Disk Size",IDC_STATIC,23,45,55,10
LTEXT "Kb",IDC_STATIC,107,45,10,10
EDITTEXT IDC_HDSIZE,74,44,32,10,ES_RIGHT
LTEXT "Kb = 1024 bytes",IDC_STATIC,70,60,55,10
END
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_MODULE_NAME "Hard Drive"
IDS_VERSION "2.0.2"
IDS_CATNUMBER "+ Cloud9 RTC"
IDS_DESCRIPTION "Enable virtual hard drive emulation. Uses direct memory acces (DMA) to offload the CPU from data transfer tasks. Two VHD hard disk files can be loaded. Also includes a Cloud9 clock."
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
+115
View File
@@ -0,0 +1,115 @@
<?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>{FC5D90DF-A488-4E57-A4B2-7C74AE861F9E}</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;harddisk_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ResourceCompile />
<Link>
<LinkDLL>true</LinkDLL>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Legacy|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;_USRDLL;harddisk_EXPORTS;_LEGACY_VCC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalOptions>/arch:SSE</AdditionalOptions>
</ClCompile>
<ResourceCompile>
<Culture>0x0409</Culture>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<LinkDLL>true</LinkDLL>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;harddisk_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalOptions>/arch:SSE</AdditionalOptions>
</ClCompile>
<ResourceCompile />
<Link>
<LinkDLL>true</LinkDLL>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="cc3vhd.cpp" />
<ClCompile Include="harddisk.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="cc3vhd.h" />
<ClInclude Include="harddisk.h" />
<ClInclude Include="resource.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="harddisk.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>
+41
View File
@@ -0,0 +1,41 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by harddisk.rc
//
/*
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/>.
*/
#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_CLOCK 1001
#define IDC_READONLY 1002
#define IDC_HDSIZE 1003
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 103
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1010
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif