Skip to content

Commit

Permalink
v1.0.11 - fixed parallel port code so it will run on x64 windows
Browse files Browse the repository at this point in the history
git-svn-id: https://www.daphne-emu.com:9443/daphnesvn/branches/v_1_0@3411 c98d566b-fa28-4d4c-8a7b-932307ef5c1a
  • Loading branch information
matt committed Jun 15, 2011
1 parent 7044d5b commit 08a4480
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 5 deletions.
Binary file modified inpout32.dll
Binary file not shown.
32 changes: 32 additions & 0 deletions src/io/inpout32.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#pragma once

//Functions exported from DLL.
//For easy inclusion is user projects.
//Original InpOut32 function support
void _stdcall Out32(short PortAddress, short data);
short _stdcall Inp32(short PortAddress);

//My extra functions for making life easy
BOOL _stdcall IsInpOutDriverOpen(); //Returns TRUE if the InpOut driver was opened successfully
BOOL _stdcall IsXP64Bit(); //Returns TRUE if the OS is 64bit (x64) Windows.

//DLLPortIO function support
UCHAR _stdcall DlPortReadPortUchar (USHORT port);
void _stdcall DlPortWritePortUchar(USHORT port, UCHAR Value);

USHORT _stdcall DlPortReadPortUshort (USHORT port);
void _stdcall DlPortWritePortUshort(USHORT port, USHORT Value);

ULONG _stdcall DlPortReadPortUlong(ULONG port);
void _stdcall DlPortWritePortUlong(ULONG port, ULONG Value);

//WinIO function support (Untested and probably does NOT work - esp. on x64!)
PBYTE _stdcall MapPhysToLin(PBYTE pbPhysAddr, DWORD dwPhysSize, HANDLE *pPhysicalMemoryHandle);
BOOL _stdcall UnmapPhysicalMemory(HANDLE PhysicalMemoryHandle, PBYTE pbLinAddr);
BOOL _stdcall GetPhysLong(PBYTE pbPhysAddr, PDWORD pdwPhysVal);
BOOL _stdcall SetPhysLong(PBYTE pbPhysAddr, DWORD dwPhysVal);





12 changes: 7 additions & 5 deletions src/io/parallel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/

#include "parallel.h"
#include "numstr.h"

// this code only applies to x86-based systems, I believe
#ifdef NATIVE_CPU_X86
Expand All @@ -37,7 +38,8 @@ short par::m_base2[3] = { 0x37A, 0x27A, 0 };

#ifdef WIN32

void _stdcall Out32(short PortAddress, short data);
#include <windows.h>
#include "inpout32.h"

bool par::init(unsigned int port, ILogger *pLogger)
// initializes parallel port for use
Expand All @@ -53,13 +55,13 @@ bool par::init(unsigned int port, ILogger *pLogger)

m_uPortIdx = port;

char sAddr[81];
sprintf(sAddr, "%x", m_base0[m_uPortIdx]);
string s = "Opening parallel port at address 0x";
s += sAddr;
s += numstr::ToStr(m_base0[m_uPortIdx], 16, 4);
pLogger->Log(s);

return(true);
bool bRes = (IsInpOutDriverOpen() != 0);

return(bRes);
}

// writes a byte to the port at base+0
Expand Down
Binary file modified src/lib/inpout32.lib
Binary file not shown.

0 comments on commit 08a4480

Please sign in to comment.