OpenCBM
Typedefs | Enumerations | Functions | Variables
vdd.h File Reference

Function prototypes for the VDD. More...

#include <opencbm.h>

Go to the source code of this file.

Typedefs

typedef enum FUNCTIONCODE FUNCTIONCODE
 

Enumerations

enum  FUNCTIONCODE {
  FC_DRIVER_OPEN, FC_DRIVER_CLOSE, FC_LISTEN, FC_TALK,
  FC_OPEN, FC_CLOSE, FC_RAW_READ, FC_RAW_WRITE,
  FC_UNLISTEN, FC_UNTALK, FC_GET_EOI, FC_CLEAR_EOI,
  FC_RESET, FC_PP_READ, FC_PP_WRITE, FC_IEC_POLL,
  FC_IEC_GET, FC_IEC_SET, FC_IEC_RELEASE, FC_IEC_WAIT,
  FC_UPLOAD, FC_DEVICE_STATUS, FC_EXEC_COMMAND, FC_IDENTIFY,
  FC_GET_DRIVER_NAME, FC_VDD_INSTALL_IOHOOK, FC_VDD_UNINSTALL_IOHOOK, FC_VDD_USLEEP,
  FC_IEC_SETRELEASE, FC_IDENTIFY_XP1541
}
 

Functions

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

Variables

HANDLE vdd_handle
 

Detailed Description

Function prototypes for the VDD.



Author
Spiro Trikaliotis

Definition in file vdd.h.

Typedef Documentation

typedef enum FUNCTIONCODE FUNCTIONCODE

the different function codes recognised by the VDD

Enumeration Type Documentation

the different function codes recognised by the VDD

Enumerator
FC_DRIVER_OPEN 

call vdd_driver_open()

FC_DRIVER_CLOSE 

call vdd_driver_close()

FC_LISTEN 

call vdd_listen()

FC_TALK 

call vdd_talk()

FC_OPEN 

call vdd_open()

FC_CLOSE 

call vdd_close()

FC_RAW_READ 

call vdd_raw_read()

FC_RAW_WRITE 

call vdd_raw_write()

FC_UNLISTEN 

call vdd_unlisten()

FC_UNTALK 

call vdd_untalk()

FC_GET_EOI 

call vdd_get_eoi()

FC_CLEAR_EOI 

call vdd_clear_eoi()

FC_RESET 

call vdd_reset()

FC_PP_READ 

call vdd_pp_read()

FC_PP_WRITE 

call vdd_pp_write()

FC_IEC_POLL 

call vdd_iec_poll()

FC_IEC_GET 

call vdd_iec_get()

FC_IEC_SET 

call vdd_iec_set()

FC_IEC_RELEASE 

call vdd_iec_release()

FC_IEC_WAIT 

call vdd_iec_wait()

FC_UPLOAD 

call vdd_upload()

FC_DEVICE_STATUS 

call vdd_device_status()

FC_EXEC_COMMAND 

call vdd_exec_command()

FC_IDENTIFY 

call vdd_identify()

FC_GET_DRIVER_NAME 

call vdd_get_driver_name()

FC_VDD_INSTALL_IOHOOK 

call vdd_install_iohook()

FC_VDD_UNINSTALL_IOHOOK 

call vdd_uninstall_iohook()

FC_VDD_USLEEP 

call vdd_usleep()

FC_IEC_SETRELEASE 

call vdd_setrelease()

FC_IDENTIFY_XP1541 

call vdd_identify_xp1541()

Definition at line 24 of file vdd.h.

Function Documentation

VOID vdd_cbmfile_closeall ( VOID  )

@@@

Todo:
document

Definition at line 143 of file cbmfile.c.

References cbm_driver_close(), and MAX_CBMFILE_VALUES.

Referenced by VDDInitialize().

CBM_FILE vdd_cbmfile_delete ( WORD  a)

@@@

Todo:
document
Parameters
a
Returns

Definition at line 119 of file cbmfile.c.

References CBM_FILE, and MAX_CBMFILE_VALUES.

CBM_FILE vdd_cbmfile_get ( WORD  a)

@@@

Todo:
document
Parameters
a
Returns

Definition at line 62 of file cbmfile.c.

References CBM_FILE, and MAX_CBMFILE_VALUES.

Referenced by VDDDispatch().

WORD vdd_cbmfile_store ( CBM_FILE  cbmfile)

@@@

Todo:
document
Parameters
cbmfile
Returns

Definition at line 87 of file cbmfile.c.

References MAX_CBMFILE_VALUES.

Referenced by vdd_driver_open().

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().

Variable Documentation

HANDLE vdd_handle

The handle of the vdd (for being accessed by the I/O hook install functions

Definition at line 54 of file vdd.c.

Referenced by vdd_install_iohook(), vdd_uninstall_iohook_internal(), and VDDInitialize().