OpenCBM
execute.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version
5  * 2 of the License, or (at your option) any later version.
6  *
7  * Copyright 2004 Spiro Trikaliotis
8 */
9 
18 #include "config.h"
19 
20 #include <windows.h>
21 #include <vddsvc.h>
22 
23 #include "arch.h"
24 
26 #define DBG_USERMODE
27 
29 #define DBG_PROGNAME "OPENCBMVDD.DLL"
30 
31 #include "debug.h"
32 
33 #include "vdd.h"
34 #include "opencbm.h"
35 
36 
38 #define NEW_IMPLEMENTATION_WITH_SETRELEASE
39 
40 /*-------------------------------------------------------------------*/
41 /*--------- HELPER FUNCTIONS ----------------------------------------*/
42 
43 static PVOID
44 get_vdm_address(WORD Offset, WORD Length)
45 {
46  PBYTE buffer;
47 
48  buffer = VdmMapFlat(getES(), Offset, getMODE());
49 
50  return buffer;
51 }
52 
53 static VOID
54 release_vdm_address(WORD Offset, WORD Length, PVOID Buffer)
55 {
56  VdmUnmapFlat(getES(), Offset, Buffer, getMODE());
57 }
58 
59 
66 #define retAX( _x_ ) setAX((WORD) _x_)
67 
74 #define FUNC_CHECKEDBUFFERACCESS(_offset_, _length_) \
75 \
76  BOOLEAN error; \
77  PVOID buffer; \
78  WORD length; \
79  WORD offset; \
80 \
81  FUNC_ENTER(); \
82 \
83  offset = _offset_; \
84  length = _length_;
85 
87 #define CHECKEDBUFFERACCESS_PROLOG() \
88 \
89  buffer = get_vdm_address(offset, length); \
90 \
91  if (!buffer) \
92  { \
93  error = TRUE; \
94  } \
95  else \
96  { \
97  int ret; \
98 \
99  error = FALSE;
100 
102 #define CHECKEDBUFFERACCESS_EPILOG() \
103  release_vdm_address(offset, length, buffer); \
104 \
105  retAX(ret); \
106  } \
107  FUNC_LEAVE_BOOLEAN(error);
108 
113 #define CHECKEDBUFFERACCESS(_func_) \
114  CHECKEDBUFFERACCESS_PROLOG(); \
115  ret = _func_; \
116  CHECKEDBUFFERACCESS_EPILOG();
117 
118 
119 /*-------------------------------------------------------------------*/
120 /*--------- DRIVER HANDLING -----------------------------------------*/
121 
140 BOOLEAN
142 {
143  CBM_FILE cbmfile;
144  USHORT translatedhandle;
145  int retValue;
146 
147  FUNC_ENTER();
148 
149  retValue = cbm_driver_open(&cbmfile, getDH());
150 
151  if (retValue == 0)
152  {
153  translatedhandle = vdd_cbmfile_store(cbmfile);
154  if (translatedhandle == (WORD) -1)
155  {
156  cbm_driver_close(cbmfile);
157  translatedhandle = -1;
158  }
159  }
160  else
161  {
162  translatedhandle = -1;
163  }
164 
165  setBX(translatedhandle);
166  retAX(retValue ? 1 : 0);
167 
168  FUNC_LEAVE_BOOLEAN(FALSE);
169 }
170 
185 BOOLEAN
187 {
188  FUNC_ENTER();
189 
190  cbm_driver_close(HandleDevice);
191 
192  FUNC_LEAVE_BOOLEAN(FALSE);
193 }
194 
195 
219 BOOLEAN
221 {
222  const char *returned_string;
223 
224  FUNC_CHECKEDBUFFERACCESS(getSI(), getCX());
225 
227 
228  returned_string = cbm_get_driver_name(getDH());
229 
230  strncpy(buffer, returned_string, length);
231 
232  ret = FALSE;
233 
235 }
236 
237 
238 /*-------------------------------------------------------------------*/
239 /*--------- BASIC I/O -----------------------------------------------*/
240 
265 BOOLEAN
266 vdd_raw_write(CBM_FILE HandleDevice)
267 {
268  FUNC_CHECKEDBUFFERACCESS(getSI(), getCX());
269 
270  CHECKEDBUFFERACCESS(cbm_raw_write(HandleDevice, buffer, length));
271 }
272 
273 
297 BOOLEAN
298 vdd_raw_read(CBM_FILE HandleDevice)
299 {
300  FUNC_CHECKEDBUFFERACCESS(getSI(), getCX());
301 
302  CHECKEDBUFFERACCESS(cbm_raw_read(HandleDevice, buffer, length));
303 }
304 
328 BOOLEAN
329 vdd_listen(CBM_FILE HandleDevice)
330 {
331  FUNC_ENTER();
332 
333  retAX(cbm_listen(HandleDevice, getCH(), getCL()));
334 
335  FUNC_LEAVE_BOOLEAN(FALSE);
336 }
337 
361 BOOLEAN
362 vdd_talk(CBM_FILE HandleDevice)
363 {
364  FUNC_ENTER();
365 
366  retAX(cbm_talk(HandleDevice, getCH(), getCL()));
367 
368  FUNC_LEAVE_BOOLEAN(FALSE);
369 }
370 
399 BOOLEAN
400 vdd_open(CBM_FILE HandleDevice)
401 {
402  FUNC_CHECKEDBUFFERACCESS(getSI(), getDI());
403 
404  CHECKEDBUFFERACCESS(cbm_open(HandleDevice, getCH(), getCL(), buffer, length));
405 }
406 
428 BOOLEAN
429 vdd_close(CBM_FILE HandleDevice)
430 {
431  FUNC_ENTER();
432 
433  retAX(cbm_close(HandleDevice, getCH(), getCL()));
434 
435  FUNC_LEAVE_BOOLEAN(FALSE);
436 }
437 
458 BOOLEAN
459 vdd_unlisten(CBM_FILE HandleDevice)
460 {
461  FUNC_ENTER();
462 
463  retAX(cbm_unlisten(HandleDevice));
464 
465  FUNC_LEAVE_BOOLEAN(FALSE);
466 }
467 
488 BOOLEAN
489 vdd_untalk(CBM_FILE HandleDevice)
490 {
491  FUNC_ENTER();
492 
493  retAX(cbm_untalk(HandleDevice));
494 
495  FUNC_LEAVE_BOOLEAN(FALSE);
496 }
497 
498 
519 BOOLEAN
520 vdd_get_eoi(CBM_FILE HandleDevice)
521 {
522  FUNC_ENTER();
523 
524  retAX(cbm_get_eoi(HandleDevice));
525 
526  FUNC_LEAVE_BOOLEAN(FALSE);
527 }
528 
544 BOOLEAN
545 vdd_clear_eoi(CBM_FILE HandleDevice)
546 {
547  FUNC_ENTER();
548 
549  retAX(cbm_clear_eoi(HandleDevice));
550 
551  FUNC_LEAVE_BOOLEAN(FALSE);
552 }
553 
575 BOOLEAN
576 vdd_reset(CBM_FILE HandleDevice)
577 {
578  FUNC_ENTER();
579 
580  retAX(cbm_reset(HandleDevice));
581 
582  FUNC_LEAVE_BOOLEAN(FALSE);
583 }
584 
585 
586 /*-------------------------------------------------------------------*/
587 /*--------- LOW-LEVEL PORT ACCESS -----------------------------------*/
588 
611 BOOLEAN
612 vdd_pp_read(CBM_FILE HandleDevice)
613 {
614  FUNC_ENTER();
615 
616  setAX(cbm_pp_read(HandleDevice));
617 
618  FUNC_LEAVE_BOOLEAN(FALSE);
619 }
620 
642 BOOLEAN
643 vdd_pp_write(CBM_FILE HandleDevice)
644 {
645  FUNC_ENTER();
646 
647  cbm_pp_write(HandleDevice, getCL());
648 
649  FUNC_LEAVE_BOOLEAN(FALSE);
650 }
651 
673 BOOLEAN
674 vdd_iec_poll(CBM_FILE HandleDevice)
675 {
676  FUNC_ENTER();
677 
678  retAX(cbm_iec_poll(HandleDevice));
679 
680  FUNC_LEAVE_BOOLEAN(FALSE);
681 }
682 
683 
702 BOOLEAN
703 vdd_iec_set(CBM_FILE HandleDevice)
704 {
705  FUNC_ENTER();
706 
707  cbm_iec_set(HandleDevice, getCL());
708 
709  FUNC_LEAVE_BOOLEAN(FALSE);
710 }
711 
730 BOOLEAN
732 {
733  FUNC_ENTER();
734 
735  cbm_iec_release(HandleDevice, getCL());
736 
737  FUNC_LEAVE_BOOLEAN(FALSE);
738 }
739 
767 BOOLEAN
769 {
770  FUNC_ENTER();
771 
772  cbm_iec_setrelease(HandleDevice, getCH(), getCL());
773 
774  FUNC_LEAVE_BOOLEAN(FALSE);
775 }
776 
803 BOOLEAN
804 vdd_iec_wait(CBM_FILE HandleDevice)
805 {
806  FUNC_ENTER();
807 
808  retAX(cbm_iec_wait(HandleDevice, getCL(), getCH()));
809 
810  FUNC_LEAVE_BOOLEAN(FALSE);
811 }
812 
834 BOOLEAN
835 vdd_iec_get(CBM_FILE HandleDevice)
836 {
837  FUNC_ENTER();
838 
839  retAX(cbm_iec_get(HandleDevice, getCL()));
840 
841  FUNC_LEAVE_BOOLEAN(FALSE);
842 }
843 
844 
845 /*-------------------------------------------------------------------*/
846 /*--------- HELPER FUNCTIONS ----------------------------------------*/
847 
848 
880 BOOLEAN
881 vdd_upload(CBM_FILE HandleDevice)
882 {
883  FUNC_CHECKEDBUFFERACCESS(getSI(), getCX());
884 
885  CHECKEDBUFFERACCESS(cbm_upload(HandleDevice, getDH(), getDI(), buffer, length));
886 }
887 
923 BOOLEAN
925 {
926  FUNC_CHECKEDBUFFERACCESS(getSI(), getCX());
927 
928  CHECKEDBUFFERACCESS(cbm_device_status(HandleDevice, getDH(), buffer, length));
929 }
930 
956 BOOLEAN
958 {
959  FUNC_CHECKEDBUFFERACCESS(getSI(), getCX());
960 
961  CHECKEDBUFFERACCESS(cbm_exec_command(HandleDevice, getDH(), buffer, length));
962 }
963 
994 BOOLEAN
995 vdd_identify(CBM_FILE HandleDevice)
996 {
997  enum cbm_devicetype_e devicetype;
998  char *string;
999 
1000  FUNC_CHECKEDBUFFERACCESS(getSI(), getCX());
1001 
1003 
1004  ret = cbm_identify(HandleDevice, getDH(), &devicetype, &string);
1005 
1006  setDI(devicetype);
1007  strncpy(buffer, string, length);
1008 
1010 }
1011 
1040 BOOLEAN
1042 {
1043  BOOLEAN error;
1044  enum cbm_devicetype_e devicetype = getDI();
1045  enum cbm_cabletype_e cabletype;
1046 
1047  FUNC_ENTER();
1048 
1049  devicetype = getDI();
1050  error = cbm_identify_xp1541(HandleDevice, getDH(),
1051  devicetype >= 0 ? &devicetype : NULL,
1052  &cabletype) ? TRUE : FALSE;
1053 
1054  setDI(devicetype);
1055  retAX(error);
1056 
1057  FUNC_LEAVE_BOOLEAN(error);
1058 }
1059 
1060 /*-------------------------------------------------------------------*/
1061 /*--------- FUNCTIONS FOR ACCESS IN THE I/O ADDRESS SPACE -----------*/
1062 
1063 static CBM_FILE VddCbmFileForIoHook;
1064 
1065 static BOOLEAN VddIoHookInstalled = FALSE;
1066 static VDD_IO_PORTRANGE VddIoPortRange;
1067 static VDD_IO_HANDLERS VddIoPortHandlers;
1068 
1069 static BYTE vdd_iohook_lastwrittencontrolregister = 0xFF;
1070 
1071 
1072 /* lpt output lines for XE cables */
1073 #define PP_XE_ATN_OUT 0x01
1074 #define PP_XE_CLK_OUT 0x02
1075 #define PP_XE_RESET_OUT 0x04
1076 #define PP_XE_DATA_OUT 0x08
1077 #define PP_XE_OUTEOR 0x00
1078 
1079 /* lpt input lines for XE cables */
1080 #define PP_XE_ATN_IN 0x10
1081 #define PP_XE_CLK_IN 0x20
1082 #define PP_XE_RESET_IN 0x40
1083 #define PP_XE_DATA_IN 0x80
1084 
1085 
1086 /* lpt output lines for XM cables */
1087 #define PP_XM_ATN_OUT PP_XE_ATN_OUT
1088 #define PP_XM_CLK_OUT PP_XE_CLK_OUT
1089 #define PP_XM_DATA_OUT PP_XE_RESET_OUT
1090 #define PP_XM_RESET_OUT PP_XE_DATA_OUT
1091 #define PP_XM_OUTEOR 0x00
1092 
1093 /* lpt input lines for XM cables */
1094 #define PP_XM_ATN_IN PP_XE_ATN_IN
1095 #define PP_XM_CLK_IN PP_XE_CLK_IN
1096 #define PP_XM_DATA_IN PP_XE_RESET_IN
1097 #define PP_XM_RESET_IN PP_XE_DATA_IN
1098 
1099 
1100 /* lpt output lines for XM cables */
1101 #define PP_XA_ATN_OUT PP_XM_ATN_OUT
1102 #define PP_XA_CLK_OUT PP_XM_CLK_OUT
1103 #define PP_XA_DATA_OUT PP_XM_DATA_OUT
1104 #define PP_XA_RESET_OUT PP_XM_RESET_OUT
1105 #define PP_XA_OUTEOR 0x0F
1106 
1107 /* lpt input lines for XM cables */
1108 #define PP_XA_ATN_IN PP_XM_ATN_IN
1109 #define PP_XA_CLK_IN PP_XM_CLK_IN
1110 #define PP_XA_DATA_IN PP_XM_DATA_IN
1111 #define PP_XA_RESET_IN PP_XM_RESET_IN
1112 
1113 
1114 static unsigned char pp_atn_out;
1115 static unsigned char pp_clk_out;
1116 static unsigned char pp_data_out;
1117 static unsigned char pp_reset_out;
1118 static unsigned char pp_outeor;
1119 
1120 static unsigned char pp_atn_in;
1121 static unsigned char pp_clk_in;
1122 static unsigned char pp_data_in;
1123 static unsigned char pp_reset_in;
1124 
1125 /*
1126  The following accesses are supported:
1127  - +0: Data register (read and write)
1128  - +1: STATUS register (read only, for input)
1129  - +2: Control register (write only, for output)
1130 */
1131 
1132 static VOID
1133 vdd_iohook_inb(WORD iport,BYTE *data)
1134 {
1135  if (iport == VddIoPortRange.First)
1136  {
1137  // read the data port (XP15x1 part)
1138  *data = cbm_pp_read(VddCbmFileForIoHook);
1139  }
1140  else if (iport == VddIoPortRange.First + 1)
1141  {
1142  UINT value;
1143  BYTE ret;
1144 
1145  // read the status register (for Input)
1146  value = cbm_iec_poll(VddCbmFileForIoHook);
1147 
1148  ret = 0;
1149 
1150  if (value & IEC_DATA)
1151  {
1152  ret |= pp_data_in;
1153  }
1154  if (value & IEC_CLOCK)
1155  {
1156  ret |= pp_clk_in;
1157  }
1158  if (value & IEC_ATN)
1159  {
1160  ret |= pp_atn_in;
1161  }
1162 
1163  // as the one line is inverted by the parallel port, behave the same
1164  *data = ret ^ 0x04;
1165  }
1166  else if (iport == VddIoPortRange.First + 2)
1167  {
1168  // reading the control register: Gives the last written state
1169  *data = vdd_iohook_lastwrittencontrolregister & 0xDF | 0xC0;
1170  }
1171  else DBG_ERROR((DBG_PREFIX "Access to unknown address %08x", iport));
1172 }
1173 
1174 static VOID
1175 vdd_iohook_outb(WORD iport,BYTE data)
1176 {
1177  if (iport == VddIoPortRange.First)
1178  {
1179  // write the data port (XP15x1 part)
1180  cbm_pp_write(VddCbmFileForIoHook, data);
1181  }
1182  else if (iport == VddIoPortRange.First + 1)
1183  {
1184  DBG_ERROR((DBG_PREFIX "Writing the status register: UNSUPPORTED!"));
1185  }
1186  else if (iport == VddIoPortRange.First + 2)
1187  {
1188  // writing the control register
1189 
1190 #ifdef NEW_IMPLEMENTATION_WITH_SETRELEASE
1191 
1192  BYTE release = IEC_ATN | IEC_CLOCK | IEC_DATA | IEC_RESET;
1193  BYTE set = 0;
1194 
1195  vdd_iohook_lastwrittencontrolregister = data;
1196 
1197  data ^= 0x04 ^ pp_outeor;
1198 
1199  if (data & pp_atn_out) { set |= IEC_ATN; release &= ~IEC_ATN; }
1200  if (data & pp_data_out) { set |= IEC_DATA; release &= ~IEC_DATA; }
1201  if (data & pp_clk_out) { set |= IEC_CLOCK; release &= ~IEC_CLOCK; }
1202  if (data & pp_reset_out) { set |= IEC_RESET; release &= ~IEC_RESET; }
1203 
1204  #ifdef TEST_BIDIR
1205 
1206  if (data & 0x10)
1207  {
1208  set |= 0x10;
1209  }
1210  else
1211  {
1212  release |= 0x10;
1213  }
1214 
1215  #endif // #ifdef TEST_BIDIR
1216 
1217  cbm_iec_setrelease(VddCbmFileForIoHook, set, release);
1218 
1219 #else // #ifdef NEW_IMPLEMENTATION_WITH_SETRELEASE
1220 
1221  BYTE ret = data ^ vdd_iohook_lastwrittencontrolregister;
1222 
1223  vdd_iohook_lastwrittencontrolregister = data;
1224 
1225  data ^= 0x04 ^ pp_outeor;
1226 
1227  if (ret & pp_atn_out)
1228  {
1229  // ATN was changed
1230  ((data & pp_atn_out) ? cbm_iec_set : cbm_iec_release)
1231  (VddCbmFileForIoHook, IEC_ATN);
1232  }
1233  if (ret & pp_clk_out)
1234  {
1235  // CLOCK was changed
1236  ((data & pp_clk_out) ? cbm_iec_set : cbm_iec_release)
1237  (VddCbmFileForIoHook, IEC_CLOCK);
1238  }
1239  if (ret & pp_data_out)
1240  {
1241  // DATA was changed
1242  ((data & pp_data_out) ? cbm_iec_set : cbm_iec_release)
1243  (VddCbmFileForIoHook, IEC_DATA);
1244  }
1245  if (ret & pp_reset_out)
1246  {
1247  // RESET was changed: Only process it if it was set
1248  if (data & pp_reset_out)
1249  {
1250  cbm_reset(VddCbmFileForIoHook);
1251  }
1252  }
1253 
1254 #endif // #ifdef NEW_IMPLEMENTATION_WITH_SETRELEASE
1255 
1256  }
1257  else DBG_ERROR((DBG_PREFIX "Access to unknown address %08x", iport));
1258 }
1259 
1260 
1284 BOOLEAN
1286 {
1287  BOOLEAN error;
1288 
1289  FUNC_ENTER();
1290 
1291  error = FALSE;
1292 
1293  /* assume that the hook is already installed, thus,
1294  * we cannot install the hook again
1295  */
1296  setAX(0);
1297 
1298  if (!VddIoHookInstalled)
1299  {
1300  VddIoPortRange.First = getCX();
1301  VddIoPortRange.Last = VddIoPortRange.First + 2;
1302 
1303  RtlZeroMemory(&VddIoPortHandlers, sizeof(VddIoPortHandlers));
1304  VddIoPortHandlers.inb_handler = vdd_iohook_inb;
1305  VddIoPortHandlers.outb_handler = vdd_iohook_outb;
1306 
1307  if (VDDInstallIOHook(vdd_handle, 1, &VddIoPortRange, &VddIoPortHandlers))
1308  {
1309  // we had success
1310  VddIoHookInstalled = TRUE;
1311  setAX(VddIoPortRange.First);
1312 
1313  VddCbmFileForIoHook = HandleDevice;
1314 
1315  // pre-occupy the variables for the cable type
1316 
1317  switch (getDH())
1318  {
1319  case 1: // XE cable
1320  pp_atn_out = PP_XE_ATN_OUT;
1321  pp_clk_out = PP_XE_CLK_OUT;
1322  pp_data_out = PP_XE_DATA_OUT;
1323  pp_reset_out = PP_XE_RESET_OUT;
1324  pp_outeor = PP_XE_OUTEOR;
1325  pp_atn_in = PP_XE_ATN_IN;
1326  pp_clk_in = PP_XE_CLK_IN;
1327  pp_data_in = PP_XE_DATA_IN;
1328  pp_reset_in = PP_XE_RESET_IN;
1329  break;
1330 
1331  case 2: // XM cable
1332  pp_atn_out = PP_XM_ATN_OUT;
1333  pp_clk_out = PP_XM_CLK_OUT;
1334  pp_data_out = PP_XM_DATA_OUT;
1335  pp_reset_out = PP_XM_RESET_OUT;
1336  pp_outeor = PP_XM_OUTEOR;
1337  pp_atn_in = PP_XM_ATN_IN;
1338  pp_clk_in = PP_XM_CLK_IN;
1339  pp_data_in = PP_XM_DATA_IN;
1340  pp_reset_in = PP_XM_RESET_IN;
1341  break;
1342 
1343  case 3: // XA cable
1344  pp_atn_out = PP_XA_ATN_OUT;
1345  pp_clk_out = PP_XA_CLK_OUT;
1346  pp_data_out = PP_XA_DATA_OUT;
1347  pp_reset_out = PP_XA_RESET_OUT;
1348  pp_outeor = PP_XA_OUTEOR;
1349  pp_atn_in = PP_XA_ATN_IN;
1350  pp_clk_in = PP_XA_CLK_IN;
1351  pp_data_in = PP_XA_DATA_IN;
1352  pp_reset_in = PP_XA_RESET_IN;
1353  break;
1354 
1355  default:
1356  error = TRUE;
1357  break;
1358  }
1359  }
1360  }
1361 
1362  FUNC_LEAVE_BOOLEAN(error);
1363 }
1364 
1382 USHORT
1384 {
1385  USHORT ret;
1386 
1387  FUNC_ENTER();
1388 
1389  if (VddIoHookInstalled)
1390  {
1391  VDDDeInstallIOHook(vdd_handle, 1, &VddIoPortRange);
1392 
1393  VddIoHookInstalled = FALSE;
1394  ret = VddIoPortRange.First;
1395  }
1396  else
1397  {
1398  ret = 0;
1399  }
1400 
1401  FUNC_LEAVE_USHORT(ret);
1402 }
1403 
1421 BOOLEAN
1423 {
1424  FUNC_ENTER();
1425 
1426  DBG_PRINT((DBG_PREFIX "Entering vdd_uninstall_iohook"));
1427 
1429 
1430  FUNC_LEAVE_BOOLEAN(FALSE);
1431 }
1432 
1446 BOOLEAN
1448 {
1449  FUNC_ENTER();
1450 
1451  arch_usleep(getCX());
1452 
1453  FUNC_LEAVE_BOOLEAN(FALSE);
1454 }
BOOLEAN vdd_listen(CBM_FILE HandleDevice)
Send a LISTEN on the IEC serial bus.
Definition: execute.c:329
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.
Definition: detectxp1541.c:187
int CBMAPIDECL cbm_get_eoi(CBM_FILE HandleDevice)
Get EOI flag after bus read.
Definition: cbm.c:1157
#define PP_XM_RESET_IN
The RESET IN bit for XM cables.
Definition: execute.c:1097
BOOLEAN vdd_device_status(CBM_FILE HandleDevice)
Read the drive status from a floppy.
Definition: execute.c:924
int CBMAPIDECL cbm_talk(CBM_FILE HandleDevice, unsigned char DeviceAddress, unsigned char SecondaryAddress)
Send a TALK on the IEC serial bus.
Definition: cbm.c:976
#define PP_XA_CLK_IN
The CLOCK IN bit for XM cables.
Definition: execute.c:1109
#define PP_XA_ATN_OUT
The ATN OUT bit for XM cables.
Definition: execute.c:1101
BOOLEAN vdd_get_driver_name(VOID)
Get the name of the driver for a specific parallel port.
Definition: execute.c:220
const char *CBMAPIDECL cbm_get_driver_name(int PortNumber)
Get the name of the driver for a specific parallel port.
Definition: cbm.c:650
int CBMAPIDECL cbm_driver_open(CBM_FILE *HandleDevice, int PortNumber)
Opens the driver.
Definition: cbm.c:740
int CBMAPIDECL cbm_listen(CBM_FILE HandleDevice, unsigned char DeviceAddress, unsigned char SecondaryAddress)
Send a LISTEN on the IEC serial bus.
Definition: cbm.c:945
Define makros for debugging purposes.
BOOLEAN vdd_identify(CBM_FILE HandleDevice)
Identify the connected floppy drive.
Definition: execute.c:995
BOOLEAN vdd_pp_write(CBM_FILE HandleDevice)
Write a byte to a XP1541/XP1571 cable.
Definition: execute.c:643
#define PP_XM_CLK_IN
The CLOCK IN bit for XM cables.
Definition: execute.c:1095
unsigned char CBMAPIDECL cbm_pp_read(CBM_FILE HandleDevice)
Read a byte from a XP1541/XP1571 cable.
Definition: cbm.c:1244
#define PP_XE_RESET_IN
The RESET IN bit for XE cables.
Definition: execute.c:1082
int CBMAPIDECL cbm_device_status(CBM_FILE HandleDevice, unsigned char DeviceAddress, void *Buffer, size_t BufferLength)
Read the drive status from a floppy.
Definition: cbm.c:1525
BOOLEAN vdd_iec_wait(CBM_FILE HandleDevice)
Wait for a line to have a specific state.
Definition: execute.c:804
#define PP_XM_ATN_OUT
The ATN OUT bit for XM cables.
Definition: execute.c:1087
#define CHECKEDBUFFERACCESS(_func_)
@@@
Definition: execute.c:113
Definitions for the configuration of the cbm4win driver.
#define PP_XE_ATN_OUT
The ATN OUT bit for XE cables.
Definition: execute.c:1073
int CBMAPIDECL cbm_close(CBM_FILE HandleDevice, unsigned char DeviceAddress, unsigned char SecondaryAddress)
Close a file on the IEC serial bus.
Definition: cbm.c:1072
BOOLEAN vdd_iec_get(CBM_FILE HandleDevice)
Get the (logical) state of a line on the IEC serial bus.
Definition: execute.c:835
BOOLEAN vdd_iec_poll(CBM_FILE HandleDevice)
Read status of all bus lines.
Definition: execute.c:674
#define PP_XE_CLK_IN
The CLOCK IN bit for XE cables.
Definition: execute.c:1081
#define FUNC_LEAVE_BOOLEAN(_xxx)
Definition: debug.h:356
BOOLEAN vdd_iec_set(CBM_FILE HandleDevice)
Activate a line on the IEC serial bus.
Definition: execute.c:703
WORD vdd_cbmfile_store(CBM_FILE cbmfile)
@@@
Definition: cbmfile.c:87
Function prototypes for the VDD.
#define retAX(_x_)
@@@
Definition: execute.c:66
#define PP_XM_ATN_IN
The ATN IN bit for XM cables.
Definition: execute.c:1094
BOOLEAN vdd_clear_eoi(CBM_FILE HandleDevice)
Reset the EOI flag.
Definition: execute.c:545
#define IEC_DATA
Definition: opencbm.h:97
void CBMAPIDECL cbm_iec_set(CBM_FILE HandleDevice, int Line)
Activate a line on the IEC serial bus.
Definition: cbm.c:1341
int CBMAPIDECL cbm_raw_write(CBM_FILE HandleDevice, const void *Buffer, size_t Count)
Write data to the IEC serial bus.
Definition: cbm.c:870
BOOLEAN vdd_iec_release(CBM_FILE HandleDevice)
Deactivate a line on the IEC serial bus.
Definition: execute.c:731
#define PP_XA_RESET_OUT
The RESET OUT bit for XM cables.
Definition: execute.c:1104
#define PP_XE_OUTEOR
eor mask for output for XE cables
Definition: execute.c:1077
BOOLEAN vdd_open(CBM_FILE HandleDevice)
Open a file on the IEC serial bus.
Definition: execute.c:400
int CBMAPIDECL cbm_iec_get(CBM_FILE HandleDevice, int Line)
Get the (logical) state of a line on the IEC serial bus.
Definition: cbm.c:1477
void CBMAPIDECL cbm_driver_close(CBM_FILE HandleDevice)
Closes the driver.
Definition: cbm.c:768
#define IEC_RESET
Definition: opencbm.h:100
#define CBM_FILE
Definition: opencbm.h:87
int CBMAPIDECL cbm_unlisten(CBM_FILE HandleDevice)
Send an UNLISTEN on the IEC serial bus.
Definition: cbm.c:1100
BOOLEAN vdd_close(CBM_FILE HandleDevice)
Close a file on the IEC serial bus.
Definition: execute.c:429
#define IEC_ATN
Definition: opencbm.h:99
void CBMAPIDECL cbm_iec_release(CBM_FILE HandleDevice, int Line)
Deactivate a line on the IEC serial bus.
Definition: cbm.c:1372
BOOLEAN vdd_exec_command(CBM_FILE HandleDevice)
Executes a command in the floppy drive.
Definition: execute.c:957
#define DBG_ERROR(_xxx)
Definition: debug.h:397
BOOLEAN vdd_raw_write(CBM_FILE HandleDevice)
Write data to the IEC serial bus.
Definition: execute.c:266
int CBMAPIDECL cbm_open(CBM_FILE HandleDevice, unsigned char DeviceAddress, unsigned char SecondaryAddress, const void *Filename, size_t FilenameLength)
Open a file on the IEC serial bus.
Definition: cbm.c:1012
BOOLEAN vdd_usleep(VOID)
Sleep some microseconds.
Definition: execute.c:1447
BOOLEAN vdd_upload(CBM_FILE HandleDevice)
Upload a program into a floppy's drive memory.
Definition: execute.c:881
BOOLEAN vdd_talk(CBM_FILE HandleDevice)
Send a TALK on the IEC serial bus.
Definition: execute.c:362
int CBMAPIDECL cbm_clear_eoi(CBM_FILE HandleDevice)
Reset the EOI flag.
Definition: cbm.c:1180
int CBMAPIDECL cbm_raw_read(CBM_FILE HandleDevice, void *Buffer, size_t Count)
Read data from the IEC serial bus.
Definition: cbm.c:906
BOOLEAN vdd_get_eoi(CBM_FILE HandleDevice)
Get EOI flag after bus read.
Definition: execute.c:520
#define FUNC_LEAVE_USHORT(_xxx)
Definition: debug.h:362
#define CHECKEDBUFFERACCESS_PROLOG()
@@@
Definition: execute.c:87
int CBMAPIDECL cbm_reset(CBM_FILE HandleDevice)
RESET all devices.
Definition: cbm.c:1209
#define PP_XA_OUTEOR
eor mask for output for XA cables
Definition: execute.c:1105
int CBMAPIDECL cbm_iec_wait(CBM_FILE HandleDevice, int Line, int State)
Wait for a line to have a specific state.
Definition: cbm.c:1448
#define PP_XE_DATA_OUT
The DATA OUT bit for XE cables.
Definition: execute.c:1076
BOOLEAN vdd_iec_setrelease(CBM_FILE HandleDevice)
Activate and deactive a line on the IEC serial bus.
Definition: execute.c:768
#define PP_XA_DATA_IN
The DATA IN bit for XM cables.
Definition: execute.c:1110
#define PP_XE_ATN_IN
The ATN IN bit for XE cables.
Definition: execute.c:1080
#define PP_XM_DATA_IN
The DATA IN bit for XM cables.
Definition: execute.c:1096
BOOLEAN vdd_raw_read(CBM_FILE HandleDevice)
Read data from the IEC serial bus.
Definition: execute.c:298
int CBMAPIDECL cbm_exec_command(CBM_FILE HandleDevice, unsigned char DeviceAddress, const void *Command, size_t Size)
Executes a command in the floppy drive.
Definition: cbm.c:1599
#define PP_XA_RESET_IN
The RESET IN bit for XM cables.
Definition: execute.c:1111
#define FUNC_ENTER()
Definition: debug.h:347
BOOLEAN vdd_uninstall_iohook(CBM_FILE HandleDevice)
Uninstall the I/O hook.
Definition: execute.c:1422
int CBMAPIDECL cbm_identify(CBM_FILE HandleDevice, unsigned char DeviceAddress, enum cbm_device_type_e *CbmDeviceType, const char **CbmDeviceString)
Identify the connected floppy drive.
Definition: detect.c:66
USHORT vdd_uninstall_iohook_internal(VOID)
Uninstall the I/O hook.
Definition: execute.c:1383
#define DBG_PREFIX
Definition: debug.h:320
DLL interface for accessing the driver.
BOOLEAN vdd_driver_close(CBM_FILE HandleDevice)
Closes the driver.
Definition: execute.c:186
#define PP_XE_DATA_IN
The DATA IN bit for XE cables.
Definition: execute.c:1083
BOOLEAN vdd_identify_xp1541(CBM_FILE HandleDevice)
Identify the cable connected to a specific floppy drive.
Definition: execute.c:1041
int CBMAPIDECL cbm_iec_poll(CBM_FILE HandleDevice)
Read status of all bus lines.
Definition: cbm.c:1314
int CBMAPIDECL cbm_untalk(CBM_FILE HandleDevice)
Send an UNTALK on the IEC serial bus.
Definition: cbm.c:1128
BOOLEAN vdd_pp_read(CBM_FILE HandleDevice)
Read a byte from a XP1541/XP1571 cable.
Definition: execute.c:612
BOOLEAN vdd_install_iohook(CBM_FILE HandleDevice)
Install the I/O hook.
Definition: execute.c:1285
#define CHECKEDBUFFERACCESS_EPILOG()
@@@
Definition: execute.c:102
#define PP_XE_RESET_OUT
The RESET OUT bit for XE cables.
Definition: execute.c:1075
BOOLEAN vdd_unlisten(CBM_FILE HandleDevice)
Send an UNLISTEN on the IEC serial bus.
Definition: execute.c:459
#define PP_XE_CLK_OUT
The CLOCK OUT bit for XE cables.
Definition: execute.c:1074
Define makros and functions which account for differences between the different architectures.
#define PP_XM_OUTEOR
eor mask for output for XM cables
Definition: execute.c:1091
void CBMAPIDECL cbm_iec_setrelease(CBM_FILE HandleDevice, int Set, int Release)
Activate and deactive a line on the IEC serial bus.
Definition: cbm.c:1412
BOOLEAN vdd_untalk(CBM_FILE HandleDevice)
Send an UNTALK on the IEC serial bus.
Definition: execute.c:489
#define FUNC_CHECKEDBUFFERACCESS(_offset_, _length_)
@@@
Definition: execute.c:74
BOOLEAN vdd_reset(CBM_FILE HandleDevice)
RESET all devices.
Definition: execute.c:576
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.
Definition: upload.c:133
void CBMAPIDECL cbm_pp_write(CBM_FILE HandleDevice, unsigned char Byte)
Write a byte to a XP1541/XP1571 cable.
Definition: cbm.c:1282
#define IEC_CLOCK
Definition: opencbm.h:98
#define PP_XA_ATN_IN
The ATN IN bit for XM cables.
Definition: execute.c:1108
#define PP_XM_DATA_OUT
The DATA OUT bit for XM cables.
Definition: execute.c:1089
HANDLE vdd_handle
Definition: vdd.c:54
BOOLEAN vdd_driver_open(VOID)
Opens the driver.
Definition: execute.c:141
#define PP_XA_DATA_OUT
The DATA OUT bit for XM cables.
Definition: execute.c:1103
#define PP_XA_CLK_OUT
The CLOCK OUT bit for XM cables.
Definition: execute.c:1102
#define DBG_PRINT(_xxx)
Definition: debug.h:403
#define PP_XM_RESET_OUT
The RESET OUT bit for XM cables.
Definition: execute.c:1090
#define PP_XM_CLK_OUT
The CLOCK OUT bit for XM cables.
Definition: execute.c:1088