I would like to know if it is possible to adapt this driver for use in conjunction with Xplorer cheat cartridge?
Japan
Google Translator (English)
Driver itself can be downloaded here
Maybe someone else will be interested in the topic and it will help to understand it.
I would like to launch PSDEBUG 1.10 (and other old software) on the Xplorer hardware
Thanks!
If I made a mistake in the section, move the topic to where it should be.
; UPDATE
Added the original and modified drivers for Windows 9x. For the story.
The modified driver includes support for the Xplorer cheat cartridge.
Code: Select all
;------------------------------------------------------------------------------
; vcomslnk.asm - Virtual Pro Comms Link Driver for Xplorer
;
; Version 1.1
;
; Disclaimer: I don't know why I decided to share it, since nobody needs it.
; But whatever.
;
; I want to warn you right away, if you don't know what it is,
; it's better not to use it. I'm not responsible for burned
; equipment, crashed Windows and your other misfortunes.
;
; Description: Driver translating I/O ports from the Action Replay Comms
; Link Card (0x300 / 0x310 / 0x320 / 0x330) port address space
; to the XPLORER (0x378/LPT) address space.
;
; Notes: The I/O protocol seems to work fine, but requires some end-
; software tweaking. So don't expect much more from this driver.
; This work was done just to learn how the communication
; protocol works, to learn x86 assembly language, x86 debugging
; (be damned), to gain experience, and of course for fun.
;
; Based on: Takashi Yano driver work
; no$psx specifications
; some old software (for driver testing)
;
; Used software: 98DDK for driver assembly / SoftIce for debug driver /
; Tiny C Compiler for tests
;
; Tested on: Windows 98
;
; P.S.: For rugged and bearded electronic-programmers only. lOl
;
; Installation:
; - Copy VCOMSLNK.VXD file to C:\Windows\System folder.
; - Open the C:\Windows\System.ini file in a text editor and add
; the following lines to the [386Enh] section:
;------------------------------------------------------------------------------
; [386Enh]
;
; ;Case of XPLORER
; ;--- start ---
; DEVICE=VCOMSLNK.VXD
; VCOMSLNK_XplorerVirtualPort=320
; VCOMSLNK_XplorerTargetPort=378
; ;---- end ----
;------------------------------------------------------------------------------
; Don't forget to specify the port addresses on your system
;------------------------------------------------------------------------------
;
; Greetings to the PSXDEV.NET forum and its inhabitants!!!
;
;------------------------------------------------------------------------------
; Worklog:
; 22.12.23 Starting work on adding XPLORER support
; information gathering, holidays celebration, etc, etc, etc...
;
; 06.01.24 Decompiled transmit & receive functions from XKiller seems
; work fine.
;
; 13.01.24 Rewrite twice transmit & receive test functions.
; 14.01.24 First(&seems last) Release - v1.1
;
; brill ;)
;------------------------------------------------------------------------------
.386p
WIN40COMPAT EQU 1 ; for Windows9X compatibility
;------------------------------------------------------------------------------
;include files
;------------------------------------------------------------------------------
include vmm.inc
;------------------------------------------------------------------------------
; Virtual Device Declaration
;------------------------------------------------------------------------------
VCOMSLNK_VER_HI EQU 1
VCOMSLNK_VER_LO EQU 1
Declare_Virtual_Device VCOMSLNK, VCOMSLNK_VER_HI, VCOMSLNK_VER_LO, VCOMSLNK_Control, Undefined_Device_ID, Undefined_Init_Order
;------------------------------------------------------------------------------
; Local Data
;------------------------------------------------------------------------------
VxD_LOCKED_DATA_SEG
xplorer_virtual_port dd 320h ; ProCommsLink Port No.
xplorer_target_port dd 378h ; LPT1 Port No.
timeout dw 0FFFFh ; some timeout
ack_var db 00h
stp1_var db 00h
stp2_var db 00h
stp3_var db 00h
VxD_LOCKED_DATA_ENDS
;------------------------------------------------------------------------------
; Locked Code
;------------------------------------------------------------------------------
VxD_LOCKED_CODE_SEG
BeginProc VCOMSLNK_Control
Control_Dispatch Device_Init, VCOMSLNK_Device_Init
clc
ret
EndProc VCOMSLNK_Control
VxD_LOCKED_CODE_ENDS
;------------------------------------------------------------------------------
; Initialization Data
;------------------------------------------------------------------------------
VxD_IDATA_SEG
xplorer_virtual_str db 'VCOMSLNK_XplorerVirtualPort',0
xplorer_target_str db 'VCOMSLNK_XplorerTargetPort',0
VxD_IDATA_ENDS
;------------------------------------------------------------------------------
; Initialization Code
;------------------------------------------------------------------------------
VxD_ICODE_SEG
BeginProc VCOMSLNK_Device_Init
; configuration for Xplorer I/F
; Get VirtualPort No.
mov eax, xplorer_virtual_port
mov edi, OFFSET32 xplorer_virtual_str
xor esi, esi ; [386Enh] section
VMMCall Get_Profile_Hex_Int
jc VCOMSLNK_Device_Init_End
mov xplorer_virtual_port, eax
; Get TargetPort No.
mov eax, xplorer_target_port
mov edi, OFFSET32 xplorer_target_str
xor esi, esi ; [386Enh] section
VMMCall Get_Profile_Hex_Int
mov xplorer_target_port, eax
; register I/O Handler for Xplorer I/F
mov esi, Xplorer_DataPort_Handler
mov edx, xplorer_virtual_port
VMMCall Install_IO_Handler
mov esi, Xplorer_StatPort_Handler
mov edx, xplorer_virtual_port
add edx, 2
VMMCall Install_IO_Handler
VCOMSLNK_Device_Init_End:
clc
ret
EndProc VCOMSLNK_Device_Init
VxD_ICODE_ENDS
;------------------------------------------------------------------------------
; Code Segment
;------------------------------------------------------------------------------
VxD_CODE_SEG
;------------------------------------------------------------------------------
; for Xplorer Parallel I/F
;------------------------------------------------------------------------------
XPLORER_DFLT EQU 00h
XPLORER_PSEL EQU 08h ; SELECT_PRN# ; Control Register-3 / DB-25 Pin 17
XPLORER_SLCT EQU 10h ; SELECT ; Status Register-4 / DB-25 Pin 13
XPLORER_POUT EQU 20h ; PAPER END/OUT ; Status Register-5 / DB-25 Pin 12
XPLORER_ACK EQU 40h ; ACK ; Status Register-6 / DB-25 Pin 10
XPLORER_BUSY EQU 80h ; BUSY# ; Status Register-7 / DB-25 Pin 11
;----- I/O Handler for Data Port ----------------------------------------------
BeginProc Xplorer_DataPort_Handler
;==============================================================================
test cl, String_IO
jnz VCOMSLNK_Simulate_IO
cmp cl, Byte_Input
je Xplorer_DataPort_Handler_InB
cmp cl, Byte_Output
jne VCOMSLNK_Simulate_IO
;==============================================================================
;send a byte to psx
;==============================================================================
Xplorer_DataPort_Handler_OutB:
push edx ; save all used in routine regs on stack
push ecx
push ebx
;------------------------------------------------------------------------------
; mov [ack_var], 1 ; ack flag = HIGH (for Status Port Routine)
;------------------------------------------------------------------------------
;DATA send
;------------------------------------------------------------------------------
mov edx, xplorer_target_port
out dx, al ; send Data to 378h ; al = DATA
;------------------------------------------------------------------------------
push eax ; save eax reg to stack
;------------------------------------------------------------------------------
;PSEL=HIGH
;------------------------------------------------------------------------------
add edx, 2 ; CTRL (37Ah)
in al, dx ; read current state of Control Port
and al, 0F7h ; 0F7h = ~XPLORER_PSEL (and modif it)
out dx, al ; PSEL=HIGH
;------------------------------------------------------------------------------
;/ACK=HIGH
;------------------------------------------------------------------------------
mov bx, timeout
dec edx ; STAT (379h)
jmp Xplorer_DataPort_Handler_OutB_Loop2
Xplorer_DataPort_Handler_OutB_Loop1:
mov ax, bx
dec bx
or ax, ax
jz Xplorer_DataPort_Handler_OutB_Loop3
Xplorer_DataPort_Handler_OutB_Loop2:
in al, dx ; al = inp(STAT);
test al, XPLORER_ACK
jz Xplorer_DataPort_Handler_OutB_Loop1
;------------------------------------------------------------------------------
;PSEL=LOW
;------------------------------------------------------------------------------
Xplorer_DataPort_Handler_OutB_Loop3:
inc edx ; CTRL (37Ah)
in al, dx
or al, XPLORER_PSEL
out dx, al
;------------------------------------------------------------------------------
;/ACK=LOW
;------------------------------------------------------------------------------
mov bx, timeout
dec edx ; STAT (379h)
jmp Xplorer_DataPort_Handler_OutB_Loop5
Xplorer_DataPort_Handler_OutB_Loop4:
mov ax, bx
dec bx
or ax, ax
jz Xplorer_DataPort_Handler_OutB_Loop6
Xplorer_DataPort_Handler_OutB_Loop5:
in al, dx ; al = inp(STAT);
mov ah, 0
and ax, XPLORER_ACK
cmp ax, XPLORER_ACK
jz Xplorer_DataPort_Handler_OutB_Loop4
;------------------------------------------------------------------------------
; mov [ack_var], 0 ; ack flag = LOW (for Status Port Routine)
;------------------------------------------------------------------------------
;return
;------------------------------------------------------------------------------
Xplorer_DataPort_Handler_OutB_Loop6:
pop eax ; restore eax reg from stack
pop ebx
pop ecx
pop edx ; restore edx reg from stack
ret ; return
;==============================================================================
;==============================================================================
;get a byte from psx
;==============================================================================
Xplorer_DataPort_Handler_InB:
push ebx
push ecx
push edx
;------------------------------------------------------------------------------
mov [ack_var], 1 ; ack flag = HIGH (for Status Port Routine)
;------------------------------------------------------------------------------
;/ACK=HIGH
;------------------------------------------------------------------------------
mov bx, timeout
mov edx, xplorer_target_port
inc edx ; STAT (379h)
jmp Xplorer_DataPort_Handler_InB_Loop2
Xplorer_DataPort_Handler_InB_Loop1:
mov ax, bx
dec bx
or ax, ax
jz Xplorer_DataPort_Handler_InB_Loop3
Xplorer_DataPort_Handler_InB_Loop2:
in al, dx ; al = inp(STAT);
test al, XPLORER_ACK
jz Xplorer_DataPort_Handler_InB_Loop1
;------------------------------------------------------------------------------
;1 step read
;------------------------------------------------------------------------------
Xplorer_DataPort_Handler_InB_Loop3:
in al, dx ; STAT (379h)
mov [stp1_var], al ; 1st step (D6,D7,HI)
;------------------------------------------------------------------------------
;PSEL=HIGH
;------------------------------------------------------------------------------
inc edx ; CTRL (37Ah)
in al, dx ; read current state of Control Port
and al, 0F7h ; 0F7h = ~XPLORER_PSEL (and modif it)
out dx, al ; PSEL=HIGH
;------------------------------------------------------------------------------
;/ACK=LOW
;------------------------------------------------------------------------------
mov bx, timeout
dec edx ; STAT (379h)
jmp Xplorer_DataPort_Handler_InB_Loop5
Xplorer_DataPort_Handler_InB_Loop4:
mov ax, bx
dec bx
or ax, ax
jz Xplorer_DataPort_Handler_InB_Loop6
Xplorer_DataPort_Handler_InB_Loop5:
in al, dx ; al = inp(STAT);
mov ah, 0
and ax, XPLORER_ACK
cmp ax, XPLORER_ACK
jz Xplorer_DataPort_Handler_InB_Loop4
;------------------------------------------------------------------------------
;2 step read
;------------------------------------------------------------------------------
Xplorer_DataPort_Handler_InB_Loop6:
in al, dx ; STAT (379h)
mov [stp2_var], al
;------------------------------------------------------------------------------
;PSEL=LOW
;------------------------------------------------------------------------------
inc edx ; CTRL (37Ah)
in al, dx ; read current state of Control Port
or al, XPLORER_PSEL ;
out dx, al ; PSEL=LOW
;------------------------------------------------------------------------------
;/ACK=HIGH
;------------------------------------------------------------------------------
mov bx, timeout
dec edx ; STAT (379h)
jmp Xplorer_DataPort_Handler_InB_Loop8
Xplorer_DataPort_Handler_InB_Loop7:
mov ax, bx
dec bx
or ax, ax
jz Xplorer_DataPort_Handler_InB_Loop9
Xplorer_DataPort_Handler_InB_Loop8:
in al, dx
test al, XPLORER_ACK
jz Xplorer_DataPort_Handler_InB_Loop7
;------------------------------------------------------------------------------
;3 step read
;------------------------------------------------------------------------------
Xplorer_DataPort_Handler_InB_Loop9:
in al, dx ; STAT (379h)
mov [stp3_var], al
;------------------------------------------------------------------------------
;PSEL=HIGH
;------------------------------------------------------------------------------
inc edx ; CTRL (37Ah)
in al, dx ; read current state of Control Port
and al, 0F7h ; 0F7h = ~XPLORER_PSEL (and modif it)
out dx, al ; PSEL=HIGH
;------------------------------------------------------------------------------
;/ACK=LOW
;------------------------------------------------------------------------------
mov bx, timeout
dec edx ; STAT (379h)
jmp Xplorer_DataPort_Handler_InB_Loop11
Xplorer_DataPort_Handler_InB_Loop10:
mov ax, bx
dec bx
or ax, ax
jz Xplorer_DataPort_Handler_InB_Loop12
Xplorer_DataPort_Handler_InB_Loop11:
in al, dx ; al = inp(STAT);
mov ah, 0
and ax, XPLORER_ACK
cmp ax, XPLORER_ACK
jz Xplorer_DataPort_Handler_InB_Loop10
;------------------------------------------------------------------------------
;PSEL=LOW
;------------------------------------------------------------------------------
Xplorer_DataPort_Handler_InB_Loop12:
inc edx ; CTRL (37Ah)
in al, dx ; read current state of Control Port
or al, XPLORER_PSEL ;
out dx, al ; PSEL=LOW
;------------------------------------------------------------------------------
;calculate result byte
;------------------------------------------------------------------------------
mov dl, [stp1_var]
and dl, XPLORER_SLCT+XPLORER_POUT
shl dl, 2
mov al, [stp2_var]
mov ah, 0
not ax
and ax, XPLORER_BUSY
sar ax, 2
or dl, al
mov al, [stp2_var]
mov ah, 0
and ax, XPLORER_SLCT+XPLORER_POUT
sar ax, 1
or dl, al
mov al, [stp3_var]
mov ah, 0
not ax
and ax, XPLORER_BUSY
sar ax, 5
or dl, al
mov al, [stp3_var]
mov ah, 0
and ax, XPLORER_SLCT+XPLORER_POUT
sar ax, 4
or dl, al
mov al, dl
;------------------------------------------------------------------------------
mov [ack_var], 0 ; ack flag = LOW (for Status Port Routine)
;------------------------------------------------------------------------------
pop edx
pop ecx
pop ebx
ret
;==============================================================================
EndProc Xplorer_DataPort_Handler
;===== I/O Handler for Status Port ============================================
BeginProc Xplorer_StatPort_Handler
test cl, String_IO
jnz VCOMSLNK_Simulate_IO
cmp cl, Byte_Input
jne VCOMSLNK_Simulate_IO
; push edx ; save edx (322h at this point)
; mov edx, xplorer_target_port
; inc edx ; Status Port (379h)
; in al, dx ; to al
; pop edx ; load edx
mov al, [ack_var]
test al, 1 ; test ACK FLAG
jz Xplorer_StatPort_Handler_Ack ;EXSTAND
; jnz Xplorer_StatPort_Handler_Ack ;FREEWING
mov al, 0FFh ; report no ACK
ret
Xplorer_StatPort_Handler_Ack:
mov al, 0FEh ; report ACK
ret
EndProc Xplorer_StatPort_Handler
;==============================================================================
;===== Default I/O Handler ====================================================
BeginProc VCOMSLNK_Simulate_IO
VMMJmp Simulate_IO
ret
EndProc VCOMSLNK_Simulate_IO
;==============================================================================
VxD_CODE_ENDS
END