12 #include "cbmcopy_int.h"
24 static const unsigned char ppr1541[] = {
25 #include "ppr-1541.inc"
28 static const unsigned char ppr1571[] = {
29 #include "ppr-1571.inc"
32 static const unsigned char ppw1541[] = {
33 #include "ppw-1541.inc"
36 static const unsigned char ppw1571[] = {
37 #include "ppw-1571.inc"
41 static struct drive_prog
43 const unsigned char *
prog;
47 { ppr1541,
sizeof(ppr1541) },
48 { ppw1541,
sizeof(ppw1541) },
49 { ppr1571,
sizeof(ppr1571) },
50 { ppw1571,
sizeof(ppw1571) }
53 static int write_byte(
CBM_FILE,
unsigned char);
54 static unsigned char read_byte(
CBM_FILE);
76 static int write_blk(
CBM_FILE HandleDevice,
const void *Buffer,
unsigned char Count, cbmcopy_message_cb msg_cb)
80 #ifdef LIBCBMCOPY_DEBUG
81 msg_cb( sev_debug,
"send byte count: %d", Count );
83 SETSTATEDEBUG((
void)0);
88 SETSTATEDEBUG((
void)0);
95 #ifdef LIBCBMCOPY_DEBUG
96 msg_cb( sev_debug,
"send block data" );
102 SETSTATEDEBUG((
void)0);
104 return write_block_generic(HandleDevice, Buffer, Count, &write_byte, msg_cb);
127 static int read_blk(
CBM_FILE HandleDevice,
void *Buffer,
size_t Count, cbmcopy_message_cb msg_cb)
134 SETSTATEDEBUG((
void)0);
140 #ifdef LIBCBMCOPY_DEBUG
141 msg_cb( sev_debug,
"received byte count: %d", c );
143 SETSTATEDEBUG((
void)0);
151 if( (Buffer == NULL) || (c > Count) )
159 #ifdef LIBCBMCOPY_DEBUG
160 msg_cb( sev_debug,
"receive block data (%d)", c );
168 return read_block_generic(HandleDevice, Buffer, Count, &read_byte, msg_cb);
172 static int write_byte(
CBM_FILE fd,
unsigned char c)
174 SETSTATEDEBUG((
void)0);
176 SETSTATEDEBUG((
void)0);
178 SETSTATEDEBUG((
void)0);
179 #ifndef USE_CBM_IEC_WAIT
185 SETSTATEDEBUG((
void)0);
187 SETSTATEDEBUG((
void)0);
188 #ifndef USE_CBM_IEC_WAIT
194 SETSTATEDEBUG((
void)0);
198 static unsigned char read_byte(
CBM_FILE fd)
201 SETSTATEDEBUG((
void)0);
203 SETSTATEDEBUG((
void)0);
204 #ifndef USE_CBM_IEC_WAIT
209 SETSTATEDEBUG((
void)0);
211 SETSTATEDEBUG((
void)0);
213 SETSTATEDEBUG((
void)0);
214 #ifndef USE_CBM_IEC_WAIT
220 SETSTATEDEBUG((
void)0);
224 static int check_error(
CBM_FILE fd,
int write)
228 SETSTATEDEBUG((
void)0);
230 SETSTATEDEBUG((
void)0);
232 SETSTATEDEBUG((
void)0);
236 SETSTATEDEBUG((
void)0);
238 SETSTATEDEBUG((
void)0);
240 SETSTATEDEBUG((
void)0);
242 SETSTATEDEBUG((
void)0);
246 SETSTATEDEBUG((
void)0);
250 static int upload_turbo(
CBM_FILE fd,
unsigned char drive,
253 const struct drive_prog *p;
275 p = &drive_progs[dt * 2 + (write != 0)];
277 SETSTATEDEBUG((
void)0);
278 cbm_upload(fd, drive, 0x680, p->prog, p->size);
279 SETSTATEDEBUG((
void)0);
283 static int start_turbo(
CBM_FILE fd,
int write)
285 SETSTATEDEBUG((
void)0);
287 SETSTATEDEBUG((
void)0);
291 static void exit_turbo(
CBM_FILE fd,
int write)
293 SETSTATEDEBUG((
void)0);
295 SETSTATEDEBUG((
void)0);
302 DECLARE_TRANSFER_FUNCS(pp_transfer);
int CBMAPIDECL opencbm_plugin_pp_cc_read_n_t(CBM_FILE HandleDevice, unsigned char *data, unsigned int size)
read a block of data from the OpenCBM backend with protocol parallel/cbmcopy
unsigned char CBMAPIDECL cbm_pp_read(CBM_FILE HandleDevice)
Read a byte from a XP1541/XP1571 cable.
int CBMAPIDECL opencbm_plugin_pp_cc_write_n(CBM_FILE HandleDevice, const unsigned char *data, unsigned int size)
Write data with parallel protocol (cbmcopy)
int CBMAPIDECL opencbm_plugin_pp_cc_write_n_t(CBM_FILE HandleDevice, const unsigned char *data, unsigned int size)
write a block of data to the OpenCBM backend with protocol parallel/cbmcopy
void CBMAPIDECL cbm_iec_set(CBM_FILE HandleDevice, int Line)
Activate a line on the IEC serial bus.
int CBMAPIDECL cbm_iec_get(CBM_FILE HandleDevice, int Line)
Get the (logical) state of a line on the IEC serial bus.
void CBMAPIDECL cbm_iec_release(CBM_FILE HandleDevice, int Line)
Deactivate a line on the IEC serial bus.
int CBMAPIDECL opencbm_plugin_pp_cc_read_n(CBM_FILE HandleDevice, unsigned char *data, unsigned int size)
Read data with parallel protocol (cbmcopy)
int CBMAPIDECL cbm_iec_wait(CBM_FILE HandleDevice, int Line, int State)
Wait for a line to have a specific state.
DLL interface for accessing the driver.
Define makros and functions which account for differences between the different architectures.
void *CBMAPIDECL cbm_get_plugin_function_address(const char *Functionname)
Get the function pointer for a function in a plugin.
int CBMAPIDECL cbm_upload(CBM_FILE HandleDevice, unsigned char DeviceAddress, int DriveMemAddress, const void *Program, size_t Size)
Upload a program into a floppy's drive memory.
void CBMAPIDECL cbm_pp_write(CBM_FILE HandleDevice, unsigned char Byte)
Write a byte to a XP1541/XP1571 cable.