33 #include <sys/types.h>
40 #ifdef DEFINE_ULONG_PTR
41 #define ULONG_PTR ULONG
46 # define EXTERN __declspec(dllexport)
48 # define EXTERN __declspec(dllimport)
52 #define CBMAPIDECL __cdecl
53 # define CBM_FILE HANDLE
54 # define CBM_FILE_INVALID INVALID_HANDLE_VALUE
56 #elif defined(__MSDOS__)
62 # define EXTERN extern
66 # define CBM_FILE_INVALID ((CBM_FILE)-1)
68 extern int vdd_init(
void);
69 extern void vdd_uninit(
void);
84 # define EXTERN extern
87 # define CBM_FILE intptr_t
88 # define CBM_FILE_INVALID ((CBM_FILE)-1)
90 #ifndef UNREFERENCED_PARAMETER
91 #define UNREFERENCED_PARAMETER(x)
98 #define IEC_CLOCK 0x02
100 #define IEC_RESET 0x08
104 #define IEE_NDAC 0x01
105 #define IEE_NRFD 0x02
114 enum cbm_device_type_e
185 const char **type_str);
188 unsigned char DeviceAddress,
199 size_t sourceLength,
size_t destLength);
201 size_t sourceLength,
size_t destLength);
216 EXTERN int CBMAPIDECL cbm_parallel_burst_write_n(
CBM_FILE HandleDevice,
unsigned char *Buffer,
unsigned int Length);
EXTERN int CBMAPIDECL cbm_iec_poll(CBM_FILE f)
Read status of all bus lines.
EXTERN int CBMAPIDECL cbm_tap_prepare_write(CBM_FILE f, int *Status)
TAPE: Prepare write.
EXTERN int CBMAPIDECL cbm_srq_burst_read_track(CBM_FILE f, unsigned char *buffer, unsigned int length)
PARBURST: Read a complete track.
EXTERN void CBMAPIDECL cbm_srq_burst_write(CBM_FILE f, unsigned char c)
PARBURST: Write to the parallel port.
EXTERN int CBMAPIDECL cbm_raw_read(CBM_FILE f, void *buf, size_t size)
Read data from the IEC serial bus.
EXTERN int CBMAPIDECL gcr_5_to_4_decode(const unsigned char *source, unsigned char *dest, size_t sourceLength, size_t destLength)
Decode GCR data.
EXTERN int CBMAPIDECL cbm_tap_get_ver(CBM_FILE f, int *Status)
TAPE: Return tape firmware version.
EXTERN int CBMAPIDECL gcr_4_to_5_encode(const unsigned char *source, unsigned char *dest, size_t sourceLength, size_t destLength)
Encode GCR data.
EXTERN int CBMAPIDECL cbm_tap_start_capture(CBM_FILE f, unsigned char *Buffer, unsigned int Buffer_Length, int *Status, int *BytesRead)
TAPE: Start capture.
EXTERN int CBMAPIDECL cbm_iec_get(CBM_FILE f, int line)
Get the (logical) state of a line on the IEC serial bus.
EXTERN unsigned char CBMAPIDECL cbm_pp_read(CBM_FILE f)
Read a byte from a XP1541/XP1571 cable.
EXTERN int CBMAPIDECL cbm_untalk(CBM_FILE f)
Send an UNTALK on the IEC serial bus.
EXTERN char *CBMAPIDECL cbm_petscii2ascii(char *str)
Convert an null-termined PETSCII string to ASCII.
EXTERN void CBMAPIDECL cbm_driver_close(CBM_FILE f)
Closes the driver.
EXTERN int CBMAPIDECL cbm_exec_command(CBM_FILE f, unsigned char dev, const void *cmd, size_t len)
Executes a command in the floppy drive.
EXTERN int CBMAPIDECL cbm_driver_open_ex(CBM_FILE *f, char *adapter)
Opens the driver, extended version.
EXTERN int CBMAPIDECL cbm_identify_xp1541(CBM_FILE HandleDevice, unsigned char DeviceAddress, enum cbm_device_type_e *CbmDeviceType, enum cbm_cable_type_e *CableType)
Identify the cable connected to a specific floppy drive.
EXTERN const char *CBMAPIDECL cbm_get_driver_name(int port)
Get the name of the driver for a specific parallel port.
EXTERN int CBMAPIDECL cbm_tap_upload_config(CBM_FILE f, unsigned char *Buffer, unsigned int Length, int *Status, int *BytesWritten)
TAPE: Upload configuration.
EXTERN int CBMAPIDECL cbm_device_status(CBM_FILE f, unsigned char dev, void *buf, size_t bufsize)
Read the drive status from a floppy.
EXTERN int CBMAPIDECL cbm_parallel_burst_read_track(CBM_FILE f, unsigned char *buffer, unsigned int length)
PARBURST: Read a complete track.
EXTERN int CBMAPIDECL cbm_tap_wait_for_stop_sense(CBM_FILE f, int *Status)
TAPE: Wait for sense.
EXTERN int CBMAPIDECL cbm_parallel_burst_read_track_var(CBM_FILE f, unsigned char *buffer, unsigned int length)
PARBURST: Read a variable length track.
EXTERN int CBMAPIDECL cbm_iec_dbg_read(CBM_FILE HandleDevice)
Read a byte from the parallel port input register.
EXTERN void CBMAPIDECL cbm_pp_write(CBM_FILE f, unsigned char c)
Write a byte to a XP1541/XP1571 cable.
EXTERN int CBMAPIDECL cbm_reset(CBM_FILE f)
RESET all devices.
EXTERN int CBMAPIDECL cbm_get_eoi(CBM_FILE f)
Get EOI flag after bus read.
EXTERN void *CBMAPIDECL cbm_get_plugin_function_address(const char *Functionname)
Get the function pointer for a function in a plugin.
EXTERN int CBMAPIDECL cbm_tap_motor_on(CBM_FILE f, int *Status)
TAPE: Motor on.
EXTERN char *CBMAPIDECL cbm_ascii2petscii(char *str)
Convert an null-termined ASCII string to PETSCII.
EXTERN int CBMAPIDECL cbm_get_debugging_buffer(CBM_FILE HandleDevice, char *buffer, size_t len)
Output contents of the debugging buffer.
EXTERN int CBMAPIDECL cbm_tap_motor_off(CBM_FILE f, int *Status)
TAPE: Motor off.
EXTERN const char *CBMAPIDECL cbm_get_driver_name_ex(char *adapter)
Get the name of the driver for a specific parallel port, extended version.
BOOLEAN vdd_usleep(VOID)
Sleep some microseconds.
EXTERN int CBMAPIDECL cbm_close(CBM_FILE f, unsigned char dev, unsigned char secadr)
Close a file on the IEC serial bus.
EXTERN void CBMAPIDECL cbm_iec_setrelease(CBM_FILE f, int set, int release)
Activate and deactive a line on the IEC serial bus.
EXTERN void CBMAPIDECL cbm_iec_set(CBM_FILE f, int line)
Activate a line on the IEC serial bus.
EXTERN int CBMAPIDECL cbm_talk(CBM_FILE f, unsigned char dev, unsigned char secadr)
Send a TALK on the IEC serial bus.
EXTERN int CBMAPIDECL cbm_tap_prepare_capture(CBM_FILE f, int *Status)
TAPE: Prepare capture.
EXTERN int CBMAPIDECL cbm_open(CBM_FILE f, unsigned char dev, unsigned char secadr, const void *fname, size_t len)
Open a file on the IEC serial bus.
EXTERN int CBMAPIDECL cbm_identify(CBM_FILE f, unsigned char drv, enum cbm_device_type_e *t, const char **type_str)
Identify the connected floppy drive.
EXTERN unsigned char CBMAPIDECL cbm_parallel_burst_read(CBM_FILE f)
PARBURST: Read from the parallel port.
EXTERN int CBMAPIDECL cbm_listen(CBM_FILE f, unsigned char dev, unsigned char secadr)
Send a LISTEN on the IEC serial bus.
BOOLEAN vdd_uninstall_iohook(CBM_FILE HandleDevice)
Uninstall the I/O hook.
EXTERN int CBMAPIDECL cbm_tap_download_config(CBM_FILE f, unsigned char *Buffer, unsigned int Buffer_Length, int *Status, int *BytesRead)
TAPE: Download configuration.
EXTERN int CBMAPIDECL cbm_clear_eoi(CBM_FILE f)
Reset the EOI flag.
EXTERN int CBMAPIDECL cbm_tap_wait_for_play_sense(CBM_FILE f, int *Status)
EXTERN char CBMAPIDECL cbm_petscii2ascii_c(char character)
Convert a PETSCII character to ASCII.
EXTERN int CBMAPIDECL cbm_unlisten(CBM_FILE f)
Send an UNLISTEN on the IEC serial bus.
BOOLEAN vdd_install_iohook(CBM_FILE HandleDevice)
Install the I/O hook.
EXTERN int CBMAPIDECL cbm_parallel_burst_write_track(CBM_FILE f, unsigned char *buffer, unsigned int length)
PARBURST: Write a complete track.
EXTERN int CBMAPIDECL cbm_tap_start_write(CBM_FILE f, unsigned char *Buffer, unsigned int Length, int *Status, int *BytesWritten)
TAPE: Start write.
EXTERN unsigned char CBMAPIDECL cbm_srq_burst_read(CBM_FILE f)
PARBURST: Read from the parallel port.
EXTERN void CBMAPIDECL cbm_parallel_burst_write(CBM_FILE f, unsigned char c)
PARBURST: Write to the parallel port.
EXTERN int CBMAPIDECL cbm_iec_dbg_write(CBM_FILE HandleDevice, unsigned char Value)
Write a byte to the parallel port output register.
EXTERN int CBMAPIDECL cbm_srq_burst_write_track(CBM_FILE f, unsigned char *buffer, unsigned int length)
PARBURST: Write a complete track.
EXTERN void CBMAPIDECL cbm_iec_release(CBM_FILE f, int line)
Deactivate a line on the IEC serial bus.
EXTERN int CBMAPIDECL cbm_tap_get_sense(CBM_FILE f, int *Status)
TAPE: Get tape sense.
EXTERN int CBMAPIDECL cbm_upload(CBM_FILE f, unsigned char dev, int adr, const void *prog, size_t size)
Upload a program into a floppy's drive memory.
EXTERN char CBMAPIDECL cbm_ascii2petscii_c(char character)
Convert an ASCII character to PETSCII.
EXTERN int CBMAPIDECL cbm_driver_open(CBM_FILE *f, int port)
Opens the driver.
EXTERN int CBMAPIDECL cbm_raw_write(CBM_FILE f, const void *buf, size_t size)
Write data to the IEC serial bus.
EXTERN void CBMAPIDECL cbm_unlock(CBM_FILE f)
Unlock the parallel port for the driver.
EXTERN void CBMAPIDECL cbm_lock(CBM_FILE f)
Lock the parallel port for the driver.
EXTERN int CBMAPIDECL cbm_iec_wait(CBM_FILE f, int line, int state)
Wait for a line to have a specific state.