OpenCBM
Macros | Functions
execute.c File Reference

Execution functions of the VDD. More...

#include "config.h"
#include <windows.h>
#include <vddsvc.h>
#include "arch.h"
#include "debug.h"
#include "vdd.h"
#include "opencbm.h"

Go to the source code of this file.

Macros

#define DBG_USERMODE
 
#define DBG_PROGNAME   "OPENCBMVDD.DLL"
 
#define NEW_IMPLEMENTATION_WITH_SETRELEASE
 @@@ More...
 
#define retAX(_x_)   setAX((WORD) _x_)
 @@@ More...
 
#define FUNC_CHECKEDBUFFERACCESS(_offset_, _length_)
 @@@ More...
 
#define CHECKEDBUFFERACCESS_PROLOG()
 @@@ More...
 
#define CHECKEDBUFFERACCESS_EPILOG()
 @@@ More...
 
#define CHECKEDBUFFERACCESS(_func_)
 @@@ More...
 
#define PP_XE_ATN_OUT   0x01
 The ATN OUT bit for XE cables.
 
#define PP_XE_CLK_OUT   0x02
 The CLOCK OUT bit for XE cables.
 
#define PP_XE_RESET_OUT   0x04
 The RESET OUT bit for XE cables.
 
#define PP_XE_DATA_OUT   0x08
 The DATA OUT bit for XE cables.
 
#define PP_XE_OUTEOR   0x00
 eor mask for output for XE cables
 
#define PP_XE_ATN_IN   0x10
 The ATN IN bit for XE cables.
 
#define PP_XE_CLK_IN   0x20
 The CLOCK IN bit for XE cables.
 
#define PP_XE_RESET_IN   0x40
 The RESET IN bit for XE cables.
 
#define PP_XE_DATA_IN   0x80
 The DATA IN bit for XE cables.
 
#define PP_XM_ATN_OUT   PP_XE_ATN_OUT
 The ATN OUT bit for XM cables.
 
#define PP_XM_CLK_OUT   PP_XE_CLK_OUT
 The CLOCK OUT bit for XM cables.
 
#define PP_XM_DATA_OUT   PP_XE_RESET_OUT
 The DATA OUT bit for XM cables.
 
#define PP_XM_RESET_OUT   PP_XE_DATA_OUT
 The RESET OUT bit for XM cables.
 
#define PP_XM_OUTEOR   0x00
 eor mask for output for XM cables
 
#define PP_XM_ATN_IN   PP_XE_ATN_IN
 The ATN IN bit for XM cables.
 
#define PP_XM_CLK_IN   PP_XE_CLK_IN
 The CLOCK IN bit for XM cables.
 
#define PP_XM_DATA_IN   PP_XE_RESET_IN
 The DATA IN bit for XM cables.
 
#define PP_XM_RESET_IN   PP_XE_DATA_IN
 The RESET IN bit for XM cables.
 
#define PP_XA_ATN_OUT   PP_XM_ATN_OUT
 The ATN OUT bit for XM cables.
 
#define PP_XA_CLK_OUT   PP_XM_CLK_OUT
 The CLOCK OUT bit for XM cables.
 
#define PP_XA_DATA_OUT   PP_XM_DATA_OUT
 The DATA OUT bit for XM cables.
 
#define PP_XA_RESET_OUT   PP_XM_RESET_OUT
 The RESET OUT bit for XM cables.
 
#define PP_XA_OUTEOR   0x0F
 eor mask for output for XA cables
 
#define PP_XA_ATN_IN   PP_XM_ATN_IN
 The ATN IN bit for XM cables.
 
#define PP_XA_CLK_IN   PP_XM_CLK_IN
 The CLOCK IN bit for XM cables.
 
#define PP_XA_DATA_IN   PP_XM_DATA_IN
 The DATA IN bit for XM cables.
 
#define PP_XA_RESET_IN   PP_XM_RESET_IN
 The RESET IN bit for XM cables.
 

Functions

BOOLEAN vdd_driver_open (VOID)
 Opens the driver. More...
 
BOOLEAN vdd_driver_close (CBM_FILE HandleDevice)
 Closes the driver. More...
 
BOOLEAN vdd_get_driver_name (VOID)
 Get the name of the driver for a specific parallel port. More...
 
BOOLEAN vdd_raw_write (CBM_FILE HandleDevice)
 Write data to the IEC serial bus. More...
 
BOOLEAN vdd_raw_read (CBM_FILE HandleDevice)
 Read data from the IEC serial bus. More...
 
BOOLEAN vdd_listen (CBM_FILE HandleDevice)
 Send a LISTEN on the IEC serial bus. More...
 
BOOLEAN vdd_talk (CBM_FILE HandleDevice)
 Send a TALK on the IEC serial bus. More...
 
BOOLEAN vdd_open (CBM_FILE HandleDevice)
 Open a file on the IEC serial bus. More...
 
BOOLEAN vdd_close (CBM_FILE HandleDevice)
 Close a file on the IEC serial bus. More...
 
BOOLEAN vdd_unlisten (CBM_FILE HandleDevice)
 Send an UNLISTEN on the IEC serial bus. More...
 
BOOLEAN vdd_untalk (CBM_FILE HandleDevice)
 Send an UNTALK on the IEC serial bus. More...
 
BOOLEAN vdd_get_eoi (CBM_FILE HandleDevice)
 Get EOI flag after bus read. More...
 
BOOLEAN vdd_clear_eoi (CBM_FILE HandleDevice)
 Reset the EOI flag. More...
 
BOOLEAN vdd_reset (CBM_FILE HandleDevice)
 RESET all devices. More...
 
BOOLEAN vdd_pp_read (CBM_FILE HandleDevice)
 Read a byte from a XP1541/XP1571 cable. More...
 
BOOLEAN vdd_pp_write (CBM_FILE HandleDevice)
 Write a byte to a XP1541/XP1571 cable. More...
 
BOOLEAN vdd_iec_poll (CBM_FILE HandleDevice)
 Read status of all bus lines. More...
 
BOOLEAN vdd_iec_set (CBM_FILE HandleDevice)
 Activate a line on the IEC serial bus. More...
 
BOOLEAN vdd_iec_release (CBM_FILE HandleDevice)
 Deactivate a line on the IEC serial bus. More...
 
BOOLEAN vdd_iec_setrelease (CBM_FILE HandleDevice)
 Activate and deactive a line on the IEC serial bus. More...
 
BOOLEAN vdd_iec_wait (CBM_FILE HandleDevice)
 Wait for a line to have a specific state. More...
 
BOOLEAN vdd_iec_get (CBM_FILE HandleDevice)
 Get the (logical) state of a line on the IEC serial bus. More...
 
BOOLEAN vdd_upload (CBM_FILE HandleDevice)
 Upload a program into a floppy's drive memory. More...
 
BOOLEAN vdd_device_status (CBM_FILE HandleDevice)
 Read the drive status from a floppy. More...
 
BOOLEAN vdd_exec_command (CBM_FILE HandleDevice)
 Executes a command in the floppy drive. More...
 
BOOLEAN vdd_identify (CBM_FILE HandleDevice)
 Identify the connected floppy drive. More...
 
BOOLEAN vdd_identify_xp1541 (CBM_FILE HandleDevice)
 Identify the cable connected to a specific floppy drive. More...
 
BOOLEAN vdd_install_iohook (CBM_FILE HandleDevice)
 Install the I/O hook. More...
 
USHORT vdd_uninstall_iohook_internal (VOID)
 Uninstall the I/O hook. More...
 
BOOLEAN vdd_uninstall_iohook (CBM_FILE HandleDevice)
 Uninstall the I/O hook. More...
 
BOOLEAN vdd_usleep (VOID)
 Sleep some microseconds. More...
 

Detailed Description

Execution functions of the VDD.



Author
Spiro Trikaliotis

Definition in file execute.c.

Macro Definition Documentation

#define CHECKEDBUFFERACCESS (   _func_)
Value:
ret = _func_; \
#define CHECKEDBUFFERACCESS_PROLOG()
@@@
Definition: execute.c:87
#define CHECKEDBUFFERACCESS_EPILOG()
@@@
Definition: execute.c:102

@@@

Todo:
document
Parameters
<em>func</em>

Definition at line 113 of file execute.c.

Referenced by vdd_device_status(), vdd_exec_command(), vdd_open(), vdd_raw_read(), vdd_raw_write(), and vdd_upload().

#define CHECKEDBUFFERACCESS_EPILOG ( )
Value:
release_vdm_address(offset, length, buffer); \
retAX(ret); \
} \
#define FUNC_LEAVE_BOOLEAN(_xxx)
Definition: debug.h:356
#define retAX(_x_)
@@@
Definition: execute.c:66

@@@

Todo:
document

Definition at line 102 of file execute.c.

Referenced by vdd_get_driver_name(), and vdd_identify().

#define CHECKEDBUFFERACCESS_PROLOG ( )
Value:
\
buffer = get_vdm_address(offset, length); \
\
if (!buffer) \
{ \
error = TRUE; \
} \
else \
{ \
int ret; \
\
error = FALSE;

@@@

Todo:
document

Definition at line 87 of file execute.c.

Referenced by vdd_get_driver_name(), and vdd_identify().

#define DBG_PROGNAME   "OPENCBMVDD.DLL"

The name of the executable

Definition at line 29 of file execute.c.

#define DBG_USERMODE

Mark: We are in user-space (for debug.h)

Definition at line 26 of file execute.c.

#define FUNC_CHECKEDBUFFERACCESS (   _offset_,
  _length_ 
)
Value:
\
BOOLEAN error; \
PVOID buffer; \
WORD length; \
WORD offset; \
\
offset = _offset_; \
length = _length_;
#define FUNC_ENTER()
Definition: debug.h:347

@@@

Todo:
document
Parameters
<em>offset</em>
<em>length</em>

Definition at line 74 of file execute.c.

Referenced by vdd_device_status(), vdd_exec_command(), vdd_get_driver_name(), vdd_identify(), vdd_open(), vdd_raw_read(), vdd_raw_write(), and vdd_upload().

#define NEW_IMPLEMENTATION_WITH_SETRELEASE

@@@

Todo:
document

Definition at line 38 of file execute.c.

#define retAX (   _x_)    setAX((WORD) _x_)

Function Documentation

BOOLEAN vdd_clear_eoi ( CBM_FILE  HandleDevice)

Reset the EOI flag.

This function resets the EOI ("End of Information") flag which might be still set after reading the IEC serial bus.

Parameters
HandleDevice(BX) A CBM_FILE which contains the file handle of the driver.
Returns
(AX) 0 on success, != 0 means an error has occured.

If vdd_driver_open() did not succeed, it is illegal to call this function.

Definition at line 545 of file execute.c.

References cbm_clear_eoi(), FUNC_ENTER, FUNC_LEAVE_BOOLEAN, and retAX.

Referenced by VDDDispatch().

BOOLEAN vdd_close ( CBM_FILE  HandleDevice)

Close a file on the IEC serial bus.

This function closes a file on the IEC serial bus.

Parameters
HandleDevice(BX) A CBM_FILE which contains the file handle of the driver.
DeviceAddress(CH) The address of the device on the IEC serial bus. This is known as primary address, too.
SecondaryAddress(CL) The secondary address for the device on the IEC serial bus.
Returns
(AX) 0 on success, else failure

If vdd_driver_open() did not succeed, it is illegal to call this function.

Definition at line 429 of file execute.c.

References cbm_close(), FUNC_ENTER, FUNC_LEAVE_BOOLEAN, and retAX.

Referenced by VDDDispatch().

BOOLEAN vdd_device_status ( CBM_FILE  HandleDevice)

Read the drive status from a floppy.

This function reads the drive status of a connected floppy drive.

Parameters
HandleDevice(BX) A CBM_FILE which contains the file handle of the driver.
DeviceAddress(DH) The address of the device on the IEC serial bus. This is known as primary address, too.
Buffer(ES:SI) Pointer to a buffer which will hold the drive's status after successfull calling,
BufferLength(CX) The length of the buffer pointed to by Buffer in bytes.
Returns
(AX) Returns the int representation of the drive status, that is, the numerical value of the first return value from the drive. This is the error number.

This function will never write more than BufferLength bytes. Nevertheless, the buffer will always be terminated with a trailing zero.

If an error occurs, this function returns a "99, DRIVER ERROR,00,00\r" and the value 99.

If vdd_driver_open() did not succeed, it is illegal to call this function.

Definition at line 924 of file execute.c.

References cbm_device_status(), CHECKEDBUFFERACCESS, and FUNC_CHECKEDBUFFERACCESS.

Referenced by VDDDispatch().

BOOLEAN vdd_driver_close ( CBM_FILE  HandleDevice)

Closes the driver.

Closes the driver, which has be opened with vdd_driver_open() before.

Parameters
HandleDevice(BX) A CBM_FILE which contains the file handle of the driver.

vdd_driver_close() should be called to balance a previous call to vdd_driver_open().

If vdd_driver_open() did not succeed, it is illegal to call vdd_driver_close().

Definition at line 186 of file execute.c.

References cbm_driver_close(), FUNC_ENTER, and FUNC_LEAVE_BOOLEAN.

Referenced by VDDDispatch().

BOOLEAN vdd_driver_open ( VOID  )

Opens the driver.

This function Opens the driver.

Parameters
PortNumber(DH) The port number of the driver to open. 0 means "default" driver, while values != 0 enumerate each driver.
Returns
AX: ==0: This function completed successfully
!=0: otherwise
HandleDevice (BX) Handle to the driver

vdd_driver_open() should be balanced with vdd_driver_close().

Definition at line 141 of file execute.c.

References cbm_driver_close(), cbm_driver_open(), CBM_FILE, FUNC_ENTER, FUNC_LEAVE_BOOLEAN, retAX, and vdd_cbmfile_store().

Referenced by VDDDispatch().

BOOLEAN vdd_exec_command ( CBM_FILE  HandleDevice)

Executes a command in the floppy drive.

This function Executes a command in the connected floppy drive.

Parameters
HandleDevice(BX) A CBM_FILE which contains the file handle of the driver.
DeviceAddress(DH) The address of the device on the IEC serial bus. This is known as primary address, too.
Command(ES:SI) Pointer to a string which holds the command to be executed.
Size(CX) The length of the command in bytes. If zero, the Command has to be a null-terminated string.
Returns
(AX) 0 on success.

If vdd_driver_open() did not succeed, it is illegal to call this function.

Definition at line 957 of file execute.c.

References cbm_exec_command(), CHECKEDBUFFERACCESS, and FUNC_CHECKEDBUFFERACCESS.

Referenced by VDDDispatch().

BOOLEAN vdd_get_driver_name ( VOID  )

Get the name of the driver for a specific parallel port.

Get the name of the driver for a specific parallel port.

Parameters
PortNumber(DH) The port number for the driver to open. 0 means "default" driver, while values != 0 enumerate each driver.
Buffer(ES:SI) Buffer which will hold a string which tells the name of the device.
Length(CX) Length of the buffer at ES:SI
Returns
Returns a pointer to a null-terminated string containing the driver name, or NULL if an error occurred.
Bug:
PortNumber is not allowed to exceed 10.

Definition at line 220 of file execute.c.

References cbm_get_driver_name(), CHECKEDBUFFERACCESS_EPILOG, CHECKEDBUFFERACCESS_PROLOG, and FUNC_CHECKEDBUFFERACCESS.

Referenced by VDDDispatch().

BOOLEAN vdd_get_eoi ( CBM_FILE  HandleDevice)

Get EOI flag after bus read.

This function gets the EOI ("End of Information") flag after reading the IEC serial bus.

Parameters
HandleDevice(BX) A CBM_FILE which contains the file handle of the driver.
Returns
(AX) != 0 if EOI was signalled, else 0.

If a previous read returned less than the specified number of bytes, there are two possible reasons: Either an error occurred on the IEC serial bus, or an EOI was signalled. To find out the cause, check with this function.

If vdd_driver_open() did not succeed, it is illegal to call this function.

Definition at line 520 of file execute.c.

References cbm_get_eoi(), FUNC_ENTER, FUNC_LEAVE_BOOLEAN, and retAX.

Referenced by VDDDispatch().

BOOLEAN vdd_identify ( CBM_FILE  HandleDevice)

Identify the connected floppy drive.

This function tries to identify a connected floppy drive. For this, it performs some M-R operations.

Parameters
HandleDevice(BX) A CBM_FILE which contains the file handle of the driver.
DeviceAddress(DH) The address of the device on the IEC serial bus. This is known as primary address, too.
CbmDeviceString(ES:SI) Buffer which will hold a string which tells the name of the device.
Length(CX) Length of the buffer at ES:SI
Returns
(AX) 0 if the drive could be contacted. It does not mean that the device could be identified.
CbmDeviceType (DI) Pointer to an enum which will hold the type of the device.

If vdd_driver_open() did not succeed, it is illegal to call this function.

Definition at line 995 of file execute.c.

References cbm_identify(), CHECKEDBUFFERACCESS_EPILOG, CHECKEDBUFFERACCESS_PROLOG, and FUNC_CHECKEDBUFFERACCESS.

Referenced by VDDDispatch().

BOOLEAN vdd_identify_xp1541 ( CBM_FILE  HandleDevice)

Identify the cable connected to a specific floppy drive.

This function tries to identify if the given floppy drive has an XP1541 cable connected.

Parameters
HandleDevice(BX) A CBM_FILE which contains the file handle of the driver.
DeviceAddress(DH) The address of the device on the IEC serial bus. This is known as primary address, too.
CbmDeviceType(DI) Enum which holds the type of the device. If this tells that the device is unknown, this function calls cbm_identify itself to find out the device type. If
Returns
CableType (DI) An enum holds the cable type of the device.
Carry is clear iff the drive could be contacted. It does not mean that the device could be identified.

If vdd_driver_open() did not succeed, it is illegal to call this function.

Definition at line 1041 of file execute.c.

References cbm_identify_xp1541(), FUNC_ENTER, FUNC_LEAVE_BOOLEAN, and retAX.

Referenced by VDDDispatch().

BOOLEAN vdd_iec_get ( CBM_FILE  HandleDevice)

Get the (logical) state of a line on the IEC serial bus.

This function gets the (logical) state of a line on the IEC serial bus.

Parameters
HandleDevice(BX) A CBM_FILE which contains the file handle of the driver.
Line(CL) The line to be tested. This must be exactly one of IEC_DATA, IEC_CLOCK, IEC_ATN, and IEC_RESET.
Returns
(AX) 1 if the line is set, 0 if it is not

If vdd_driver_open() did not succeed, it is illegal to call this function.

Bug:
This function can't signal an error, thus, be careful!

Definition at line 835 of file execute.c.

References cbm_iec_get(), FUNC_ENTER, FUNC_LEAVE_BOOLEAN, and retAX.

Referenced by VDDDispatch().

BOOLEAN vdd_iec_poll ( CBM_FILE  HandleDevice)

Read status of all bus lines.

This function reads the state of all lines on the IEC serial bus.

Parameters
HandleDevice(BX) A CBM_FILE which contains the file handle of the driver.
Returns
(AX) The state of the lines. The result is an OR between the bit flags IEC_DATA, IEC_CLOCK, IEC_ATN, and IEC_RESET.

This function just reads the port. No handshaking is performed at all.

If vdd_driver_open() did not succeed, it is illegal to call this function.

Bug:
This function can't signal an error, thus, be careful!

Definition at line 674 of file execute.c.

References cbm_iec_poll(), FUNC_ENTER, FUNC_LEAVE_BOOLEAN, and retAX.

Referenced by VDDDispatch().

BOOLEAN vdd_iec_release ( CBM_FILE  HandleDevice)

Deactivate a line on the IEC serial bus.

This function deactivates (sets to 5V) a line on the IEC serial bus.

Parameters
HandleDevice(BX) A CBM_FILE which contains the file handle of the driver.
Line(CL) The line to be deactivated. This must be exactly one of IEC_DATA, IEC_CLOCK, or IEC_ATN.

If vdd_driver_open() did not succeed, it is illegal to call this function.

Bug:
This function can't signal an error, thus, be careful!

Definition at line 731 of file execute.c.

References cbm_iec_release(), FUNC_ENTER, and FUNC_LEAVE_BOOLEAN.

Referenced by VDDDispatch().

BOOLEAN vdd_iec_set ( CBM_FILE  HandleDevice)

Activate a line on the IEC serial bus.

This function activates (sets to 0V) a line on the IEC serial bus.

Parameters
HandleDevice(BX) A CBM_FILE which contains the file handle of the driver.
Line(CL) The line to be activated. This must be exactly one of IEC_DATA, IEC_CLOCK, or IEC_ATN.

If vdd_driver_open() did not succeed, it is illegal to call this function.

Bug:
This function can't signal an error, thus, be careful!

Definition at line 703 of file execute.c.

References cbm_iec_set(), FUNC_ENTER, and FUNC_LEAVE_BOOLEAN.

Referenced by VDDDispatch().

BOOLEAN vdd_iec_setrelease ( CBM_FILE  HandleDevice)

Activate and deactive a line on the IEC serial bus.

This function activates (sets to 0V, L) and deactivates (set to 5V, H) lines on the IEC serial bus.

Parameters
HandleDevice(BX) A CBM_FILE which contains the file handle of the driver.
Set(CH) The mask of which lines should be set. This has to be a bitwise OR between the constants IEC_DATA, IEC_CLOCK, IEC_ATN, and IEC_RESET
Release(CL) The mask of which lines should be released. This has to be a bitwise OR between the constants IEC_DATA, IEC_CLOCK, IEC_ATN, and IEC_RESET

If vdd_driver_open() did not succeed, it is illegal to call this function.

Bug:
This function can't signal an error, thus, be careful!
Remarks
If a bit is specified in the Set as well as in the Release mask, the effect is undefined.

Definition at line 768 of file execute.c.

References cbm_iec_setrelease(), FUNC_ENTER, and FUNC_LEAVE_BOOLEAN.

Referenced by VDDDispatch().

BOOLEAN vdd_iec_wait ( CBM_FILE  HandleDevice)

Wait for a line to have a specific state.

This function waits for a line to enter a specific state on the IEC serial bus.

Parameters
HandleDevice(BX) A CBM_FILE which contains the file handle of the driver.
Line(CL) The line to be deactivated. This must be exactly one of IEC_DATA, IEC_CLOCK, IEC_ATN, and IEC_RESET.
State(CH) If zero, then wait for this line to be deactivated.
If not zero, then wait for this line to be activated.
Returns
(AX) The state of the IEC bus on return (like vdd_iec_poll).

If vdd_driver_open() did not succeed, it is illegal to call this function.

Bug:
This function can't signal an error, thus, be careful!

Definition at line 804 of file execute.c.

References cbm_iec_wait(), FUNC_ENTER, FUNC_LEAVE_BOOLEAN, and retAX.

Referenced by VDDDispatch().

BOOLEAN vdd_install_iohook ( CBM_FILE  HandleDevice)

Install the I/O hook.

This function installs the I/O hook for accessing the VDD via IN and OUT assembler instructions

Parameters
HandleDevice(BX) A CBM_FILE which contains the file handle of the driver.
IoBaseAddress(CX) The I/O base address on which to install the I/O hook
CableType(DH) Decides if the emulated cable should be an XE cable (1), XM cable (2), or an XA cable (3).
Returns
(AX) Returns the I/O base address on which the I/O hook has been installed.
If the hook could not be installed, this return value is zero.

If vdd_driver_open() did not succeed, it is illegal to call this function.

Definition at line 1285 of file execute.c.

References FUNC_ENTER, FUNC_LEAVE_BOOLEAN, PP_XA_ATN_IN, PP_XA_ATN_OUT, PP_XA_CLK_IN, PP_XA_CLK_OUT, PP_XA_DATA_IN, PP_XA_DATA_OUT, PP_XA_OUTEOR, PP_XA_RESET_IN, PP_XA_RESET_OUT, PP_XE_ATN_IN, PP_XE_ATN_OUT, PP_XE_CLK_IN, PP_XE_CLK_OUT, PP_XE_DATA_IN, PP_XE_DATA_OUT, PP_XE_OUTEOR, PP_XE_RESET_IN, PP_XE_RESET_OUT, PP_XM_ATN_IN, PP_XM_ATN_OUT, PP_XM_CLK_IN, PP_XM_CLK_OUT, PP_XM_DATA_IN, PP_XM_DATA_OUT, PP_XM_OUTEOR, PP_XM_RESET_IN, PP_XM_RESET_OUT, and vdd_handle.

Referenced by VDDDispatch().

BOOLEAN vdd_listen ( CBM_FILE  HandleDevice)

Send a LISTEN on the IEC serial bus.

This function sends a LISTEN on the IEC serial bus. This prepares a LISTENer, so that it will wait for our bytes we will write in the future.

Parameters
HandleDevice(BX) A CBM_FILE which contains the file handle of the driver.
DeviceAddress(CH) The address of the device on the IEC serial bus. This is known as primary address, too.
SecondaryAddress(CL) The secondary address for the device on the IEC serial bus.
Returns
(AX) 0 means success, else failure

If vdd_driver_open() did not succeed, it is illegal to call this function.

Definition at line 329 of file execute.c.

References cbm_listen(), FUNC_ENTER, FUNC_LEAVE_BOOLEAN, and retAX.

Referenced by VDDDispatch().

BOOLEAN vdd_open ( CBM_FILE  HandleDevice)

Open a file on the IEC serial bus.

This function opens a file on the IEC serial bus.

Parameters
HandleDevice(BX) A CBM_FILE which contains the file handle of the driver.
DeviceAddress(CH) The address of the device on the IEC serial bus. This is known as primary address, too.
SecondaryAddress(CL) The secondary address for the device on the IEC serial bus.
Filename(ES:SI) Pointer to the filename of the file to be opened
FilenameLength(DI) The size of the Filename. If zero, the Filename has to be a null-terminated string.
Returns
(AX) 0 means success, else failure

If vdd_driver_open() did not succeed, it is illegal to call this function.

Definition at line 400 of file execute.c.

References cbm_open(), CHECKEDBUFFERACCESS, and FUNC_CHECKEDBUFFERACCESS.

Referenced by VDDDispatch().

BOOLEAN vdd_pp_read ( CBM_FILE  HandleDevice)

Read a byte from a XP1541/XP1571 cable.

This function reads a single byte from the parallel portion of an XP1541/1571 cable.

Parameters
HandleDevice(BX) A CBM_FILE which contains the file handle of the driver.
Returns
(AX) the byte which was received on the parallel port. AL contains the byte, AH is zeroed.

This function reads the current state of the port. No handshaking is performed at all.

If vdd_driver_open() did not succeed, it is illegal to call this function.

Bug:
This function can't signal an error, thus, be careful!

Definition at line 612 of file execute.c.

References cbm_pp_read(), FUNC_ENTER, and FUNC_LEAVE_BOOLEAN.

Referenced by VDDDispatch().

BOOLEAN vdd_pp_write ( CBM_FILE  HandleDevice)

Write a byte to a XP1541/XP1571 cable.

This function writes a single byte to the parallel portion of a XP1541/1571 cable.

Parameters
HandleDevice(BX) A CBM_FILE which contains the file handle of the driver.
Byte(CL) the byte to be output on the parallel port

This function just writes on the port. No handshaking is performed at all.

If vdd_driver_open() did not succeed, it is illegal to call this function.

Bug:
This function can't signal an error, thus, be careful!

Definition at line 643 of file execute.c.

References cbm_pp_write(), FUNC_ENTER, and FUNC_LEAVE_BOOLEAN.

Referenced by VDDDispatch().

BOOLEAN vdd_raw_read ( CBM_FILE  HandleDevice)

Read data from the IEC serial bus.

This function retrieves data after a vdd_talk().

Parameters
HandleDevice(BX) A CBM_FILE which contains the file handle of the driver.
Buffer(ES:SI) Pointer to a buffer which will hold the bytes read.
Count(CX) Number of bytes to be read at most.
Returns
(AX) >= 0: The actual number of bytes read.
<0 indicates an error.

At most Count bytes are read.

If vdd_driver_open() did not succeed, it is illegal to call this function.

Definition at line 298 of file execute.c.

References cbm_raw_read(), CHECKEDBUFFERACCESS, and FUNC_CHECKEDBUFFERACCESS.

Referenced by VDDDispatch().

BOOLEAN vdd_raw_write ( CBM_FILE  HandleDevice)

Write data to the IEC serial bus.

This function sends data after a vdd_listen().

Parameters
HandleDevice(BX) A CBM_FILE which contains the file handle of the driver.
Buffer(ES:SI) Pointer to a buffer which hold the bytes to write to the bus.
Count(CX) Number of bytes to be written.
Returns
(AX) >= 0: The actual number of bytes written.
<0 indicates an error.

This function tries to write Count bytes. Anyway, if an error occurs, this function can stop prematurely.

If vdd_driver_open() did not succeed, it is illegal to call this function.

Definition at line 266 of file execute.c.

References cbm_raw_write(), CHECKEDBUFFERACCESS, and FUNC_CHECKEDBUFFERACCESS.

Referenced by VDDDispatch().

BOOLEAN vdd_reset ( CBM_FILE  HandleDevice)

RESET all devices.

This function performs a hardware RESET of all devices on the IEC serial bus.

Parameters
HandleDevice(BX) A CBM_FILE which contains the file handle of the driver.
Returns
(AX) 0 on success, else failure

Don't overuse this function! Normally, an initial RESET should be enough.

Control is returned after a delay which ensures that all devices are ready again.

If vdd_driver_open() did not succeed, it is illegal to call this function.

Definition at line 576 of file execute.c.

References cbm_reset(), FUNC_ENTER, FUNC_LEAVE_BOOLEAN, and retAX.

Referenced by VDDDispatch().

BOOLEAN vdd_talk ( CBM_FILE  HandleDevice)

Send a TALK on the IEC serial bus.

This function sends a TALK on the IEC serial bus. This prepares a TALKer, so that it will prepare to send us some bytes in the future.

Parameters
HandleDevice(BX) A CBM_FILE which contains the file handle of the driver.
DeviceAddress(CH) The address of the device on the IEC serial bus. This is known as primary address, too.
SecondaryAddress(CL) The secondary address for the device on the IEC serial bus.
Returns
(AX) 0 means success, else failure

If vdd_driver_open() did not succeed, it is illegal to call this function.

Definition at line 362 of file execute.c.

References cbm_talk(), FUNC_ENTER, FUNC_LEAVE_BOOLEAN, and retAX.

Referenced by VDDDispatch().

BOOLEAN vdd_uninstall_iohook ( CBM_FILE  HandleDevice)

Uninstall the I/O hook.

This function uninstalls the I/O hook for accessing the VDD via IN and OUT assembler instructions

Parameters
HandleDevice(BX) A CBM_FILE which contains the file handle of the driver.
Returns
(AX) Returns the I/O base address on which the I/O hook was installed before.
If no hook was installed, this return value is zero.

If vdd_driver_open() did not succeed, it is illegal to call this function.

Definition at line 1422 of file execute.c.

References DBG_PREFIX, DBG_PRINT, FUNC_ENTER, FUNC_LEAVE_BOOLEAN, and vdd_uninstall_iohook_internal().

Referenced by VDDDispatch().

USHORT vdd_uninstall_iohook_internal ( VOID  )

Uninstall the I/O hook.

This function uninstalls the I/O hook for accessing the VDD via IN and OUT assembler instructions

Parameters
HandleDevice(BX) A CBM_FILE which contains the file handle of the driver.
Returns
(AX) Returns the I/O base address on which the I/O hook was installed before.
If no hook was installed, this return value is zero.

If vdd_driver_open() did not succeed, it is illegal to call this function.

Definition at line 1383 of file execute.c.

References FUNC_ENTER, FUNC_LEAVE_USHORT, and vdd_handle.

Referenced by vdd_uninstall_iohook(), and VDDInitialize().

BOOLEAN vdd_unlisten ( CBM_FILE  HandleDevice)

Send an UNLISTEN on the IEC serial bus.

This function sends an UNLISTEN on the IEC serial bus. Other than LISTEN and TALK, an UNLISTEN is not directed to just one device, but to all devices on that IEC serial bus.

Parameters
HandleDevice(BX) A CBM_FILE which contains the file handle of the driver.
Returns
(AX) 0 on success, else failure

At least on a 1541 floppy drive, an UNLISTEN also undoes a previous TALK.

If vdd_driver_open() did not succeed, it is illegal to call this function.

Definition at line 459 of file execute.c.

References cbm_unlisten(), FUNC_ENTER, FUNC_LEAVE_BOOLEAN, and retAX.

Referenced by VDDDispatch().

BOOLEAN vdd_untalk ( CBM_FILE  HandleDevice)

Send an UNTALK on the IEC serial bus.

This function sends an UNTALK on the IEC serial bus. Other than LISTEN and TALK, an UNTALK is not directed to just one device, but to all devices on that IEC serial bus.

Parameters
HandleDevice(BX) A CBM_FILE which contains the file handle of the driver.
Returns
(AX) 0 on success, else failure

At least on a 1541 floppy drive, an UNTALK also undoes a previous LISTEN.

If vdd_driver_open() did not succeed, it is illegal to call this function.

Definition at line 489 of file execute.c.

References cbm_untalk(), FUNC_ENTER, FUNC_LEAVE_BOOLEAN, and retAX.

Referenced by VDDDispatch().

BOOLEAN vdd_upload ( CBM_FILE  HandleDevice)

Upload a program into a floppy's drive memory.

This function writes a program into the drive's memory via use of "M-W" commands.

Parameters
HandleDevice(BX) A CBM_FILE which contains the file handle of the driver.
DeviceAddress(DH) The address of the device on the IEC serial bus. This is known as primary address, too.
DriveMemAddress(DI) The address in the drive's memory where the program is to be stored.
Program(ES:SI) Pointer to a byte buffer which holds the program in the caller's address space.
Size(CX) The size of the program to be stored, in bytes.
Returns
(AX) Returns the number of bytes written into program memory. If it does not equal Size, than an error occurred.

If vdd_driver_open() did not succeed, it is illegal to call this function.

Definition at line 881 of file execute.c.

References cbm_upload(), CHECKEDBUFFERACCESS, and FUNC_CHECKEDBUFFERACCESS.

Referenced by VDDDispatch().

BOOLEAN vdd_usleep ( VOID  )

Sleep some microseconds.

This function allows the DOS box to sleep a specified amount of microseconds.

Parameters
Microseconds(CX) The number of microseconds to sleep.

This function only guarantees that the function sleeps at least the specified amount of microseconds! Because of the scheduler, we cannot know when the caller will get control back.

Definition at line 1447 of file execute.c.

References FUNC_ENTER, and FUNC_LEAVE_BOOLEAN.

Referenced by VDDDispatch().