Skip to content

Commit 08a4480

Browse files
author
matt
committed
v1.0.11 - fixed parallel port code so it will run on x64 windows
git-svn-id: https://www.daphne-emu.com:9443/daphnesvn/branches/v_1_0@3411 c98d566b-fa28-4d4c-8a7b-932307ef5c1a
1 parent 7044d5b commit 08a4480

File tree

4 files changed

+39
-5
lines changed

4 files changed

+39
-5
lines changed

inpout32.dll

64 KB
Binary file not shown.

src/io/inpout32.h

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#pragma once
2+
3+
//Functions exported from DLL.
4+
//For easy inclusion is user projects.
5+
//Original InpOut32 function support
6+
void _stdcall Out32(short PortAddress, short data);
7+
short _stdcall Inp32(short PortAddress);
8+
9+
//My extra functions for making life easy
10+
BOOL _stdcall IsInpOutDriverOpen(); //Returns TRUE if the InpOut driver was opened successfully
11+
BOOL _stdcall IsXP64Bit(); //Returns TRUE if the OS is 64bit (x64) Windows.
12+
13+
//DLLPortIO function support
14+
UCHAR _stdcall DlPortReadPortUchar (USHORT port);
15+
void _stdcall DlPortWritePortUchar(USHORT port, UCHAR Value);
16+
17+
USHORT _stdcall DlPortReadPortUshort (USHORT port);
18+
void _stdcall DlPortWritePortUshort(USHORT port, USHORT Value);
19+
20+
ULONG _stdcall DlPortReadPortUlong(ULONG port);
21+
void _stdcall DlPortWritePortUlong(ULONG port, ULONG Value);
22+
23+
//WinIO function support (Untested and probably does NOT work - esp. on x64!)
24+
PBYTE _stdcall MapPhysToLin(PBYTE pbPhysAddr, DWORD dwPhysSize, HANDLE *pPhysicalMemoryHandle);
25+
BOOL _stdcall UnmapPhysicalMemory(HANDLE PhysicalMemoryHandle, PBYTE pbLinAddr);
26+
BOOL _stdcall GetPhysLong(PBYTE pbPhysAddr, PDWORD pdwPhysVal);
27+
BOOL _stdcall SetPhysLong(PBYTE pbPhysAddr, DWORD dwPhysVal);
28+
29+
30+
31+
32+

src/io/parallel.cpp

+7-5
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
*/
2222

2323
#include "parallel.h"
24+
#include "numstr.h"
2425

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

3839
#ifdef WIN32
3940

40-
void _stdcall Out32(short PortAddress, short data);
41+
#include <windows.h>
42+
#include "inpout32.h"
4143

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

5456
m_uPortIdx = port;
5557

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

62-
return(true);
62+
bool bRes = (IsInpOutDriverOpen() != 0);
63+
64+
return(bRes);
6365
}
6466

6567
// writes a byte to the port at base+0

src/lib/inpout32.lib

2.88 KB
Binary file not shown.

0 commit comments

Comments
 (0)