BOOL CBMAPIDECL cbm_i_driver_install(OUT PULONG Buffer, IN ULONG BufferLen) { FUNC_ENTER(); FUNC_LEAVE_INT(cbm_i_i_driver_install(Buffer, BufferLen)); }
int cbmarch_close(CBM_FILE HandleDevice, __u_char DeviceAddress, __u_char SecondaryAddress) { FUNC_ENTER(); cbmarch_listen(HandleDevice, DeviceAddress, (__u_char)((SecondaryAddress & 0x0f) | 0xe0)); FUNC_LEAVE_INT(cbmarch_unlisten(HandleDevice)); }
int cbmarch_iec_wait(CBM_FILE HandleDevice, int Line, int State) { /* CBMT_IEC_WAIT_IN parameter; CBMT_IEC_WAIT_OUT result; FUNC_ENTER(); parameter.Line = (UCHAR) Line; parameter.State = (UCHAR) State; cbm_ioctl(HandleDevice, CBMCTRL(IEC_WAIT), ¶meter, sizeof(parameter), &result, sizeof(result)); FUNC_LEAVE_INT(result.Line); */ int state; FUNC_ENTER(); if (State) { while((state = cbm_iec_get(HandleDevice, Line)) == 0) ; } else { while((state = cbm_iec_get(HandleDevice, Line)) != 0) ; } FUNC_LEAVE_INT(state); }
int cbmarch_talk(CBM_FILE HandleDevice, __u_char DeviceAddress, __u_char SecondaryAddress) { unsigned char status = 0; FUNC_ENTER(); do { if (cbmarch_listen(HandleDevice, DeviceAddress, SecondaryAddress)) { status = 1; break; } if (cbmarch_unlisten(HandleDevice)) { status = 1; break; } vicepause(); vicewriteregister(reg_a, DeviceAddress); vicewriteregister(reg_x, SecondaryAddress | 0x60); send_and_wait(addr_talk, data_talk, sizeof(data_talk)); status = (unsigned char) vicereadregister(reg_a); } while (0); FUNC_LEAVE_INT(status ? 1 : 0); }
static int main_o65(int argc, char **argv) { int i; int count; PVOID o65file[10]; FUNC_ENTER(); #if DBG DbgFlags = DBGF_SUCCESS | DBGF_ERROR | DBGF_WARNING | DBGF_ASSERT; #endif count = argc > 10 ? 10 : argc - 1; for (i=0; i < count; i++) { o65_file_load(argv[i+1], &o65file[i]); } for (i=0; i < count; i++) { o65_file_reloc(o65file[i], i*0x204); } for (i=0; i < count; i++) { o65_file_delete(o65file[i]); } FUNC_LEAVE_INT(0); }
int CBMAPIDECL opencbm_plugin_raw_read(CBM_FILE HandleDevice, void *Buffer, size_t Count) { DWORD bytesToRead = Count; DWORD bytesRead; OVERLAPPED overlapped; BOOL result; FUNC_ENTER(); WaitForIoCompletionConstruct(&overlapped); result = ReadFile( HandleDevice, Buffer, bytesToRead, &bytesRead, &overlapped ); WaitForIoCompletion(result, HandleDevice, &overlapped, &bytesRead); FUNC_LEAVE_INT(bytesRead); }
int cbmarch_reset(CBM_FILE HandleDevice) { FUNC_ENTER(); vicereset(); FUNC_LEAVE_INT(0); }
int CBMAPIDECL cbm_get_debugging_buffer(CBM_FILE HandleDevice, char *buffer, size_t len) { FUNC_ENTER(); cbm_ioctl(HandleDevice, CBMCTRL(I_READDBG), NULL, 0, buffer, len); FUNC_LEAVE_INT(0); }
int cbmarch_untalk(CBM_FILE HandleDevice) { FUNC_ENTER(); vicepause(); send_and_wait(addr_untalk, data_untalk, sizeof(data_untalk)); FUNC_LEAVE_INT(0); }
int cbmarch_clear_eoi(CBM_FILE HandleDevice) { FUNC_ENTER(); vicepause(); send_and_wait(addr_cleareoi, data_cleareoi, sizeof(data_cleareoi)); FUNC_LEAVE_INT(0); }
int cbmarch_untalk(CBM_FILE HandleDevice) { int returnValue; FUNC_ENTER(); returnValue = cbm_ioctl(HandleDevice, CBMCTRL(UNTALK), NULL, 0, NULL, 0) ? 0 : 1; FUNC_LEAVE_INT(returnValue); }
int cbmarch_get_eoi(CBM_FILE HandleDevice) { CBMT_GET_EOI_OUT result; FUNC_ENTER(); cbm_ioctl(HandleDevice, CBMCTRL(GET_EOI), NULL, 0, &result, sizeof(result)); FUNC_LEAVE_INT(result.Decision); }
int cbmarch_reset(CBM_FILE HandleDevice) { USHORT returnValue; FUNC_ENTER(); returnValue = cbm_ioctl(HandleDevice, CBMCTRL(RESET), NULL, 0, NULL, 0) ? 0 : 1; FUNC_LEAVE_INT(returnValue); }
int cbmarch_iec_poll(CBM_FILE HandleDevice) { CBMT_IEC_POLL_OUT result; FUNC_ENTER(); cbm_ioctl(HandleDevice, CBMCTRL(IEC_POLL), NULL, 0, &result, sizeof(result)); FUNC_LEAVE_INT(result.Line); }
int CBMAPIDECL opencbm_plugin_clear_eoi(CBM_FILE HandleDevice) { int returnValue; FUNC_ENTER(); returnValue = cbm_ioctl(HandleDevice, CBMCTRL(CLEAR_EOI), NULL, 0, NULL, 0); FUNC_LEAVE_INT(returnValue); }
int CBMAPIDECL opencbm_plugin_untalk(CBM_FILE HandleDevice) { int returnValue; FUNC_ENTER(); returnValue = cbm_ioctl(HandleDevice, CBMCTRL(UNTALK), NULL, 0, NULL, 0) ? 0 : 1; FUNC_LEAVE_INT(returnValue); }
int cbmarch_clear_eoi(CBM_FILE HandleDevice) { int returnValue; FUNC_ENTER(); returnValue = cbm_ioctl(HandleDevice, CBMCTRL(CLEAR_EOI), NULL, 0, NULL, 0); FUNC_LEAVE_INT(returnValue); }
int cbmarch_get_eoi(CBM_FILE HandleDevice) { unsigned char status = 0; FUNC_ENTER(); vicepause(); send_and_wait(addr_geteoi, data_geteoi, sizeof(data_geteoi)); status = (unsigned char) vicereadregister(reg_a); FUNC_LEAVE_INT(status & 0x40 ? 1 : 0); }
/*! \brief Read a byte from the parallel port input register This function reads a byte from the parallel port input register. (STATUS_PORT). It is a helper function for debugging the cable (i.e., for the XCDETECT tool) only! \param HandleDevice A CBM_FILE which contains the file handle of the driver. \return If the routine succeeds, it returns a non-negative value which corresponds to the data in the parallel port input register (status port). If the routine fails, the return value is -1. \remark Do not use this function in anything but a debugging aid tool like XCDETECT! This functions masks some bits off. The bits that are not masked off are defined in PARALLEL_STATUS_PORT_MASK_VALUES. */ int CBMAPIDECL opencbm_plugin_iec_dbg_read(CBM_FILE HandleDevice) { CBMT_IEC_DBG_READ result; int returnValue = -1; FUNC_ENTER(); if ( cbm_ioctl(HandleDevice, CBMCTRL(IEC_DBG_READ), NULL, 0, &result, sizeof(result)) ) { returnValue = result.Value; } FUNC_LEAVE_INT(returnValue); }
int CBMAPIDECL opencbm_plugin_talk(CBM_FILE HandleDevice, unsigned char DeviceAddress, unsigned char SecondaryAddress) { CBMT_TALK_IN parameter; int returnValue; FUNC_ENTER(); parameter.PrimaryAddress = DeviceAddress; parameter.SecondaryAddress = SecondaryAddress; returnValue = cbm_ioctl(HandleDevice, CBMCTRL(TALK), ¶meter, sizeof(parameter), NULL, 0) ? 0 : 1; FUNC_LEAVE_INT(returnValue); }
int cbmarch_talk(CBM_FILE HandleDevice, __u_char DeviceAddress, __u_char SecondaryAddress) { CBMT_TALK_IN parameter; int returnValue; FUNC_ENTER(); parameter.PrimaryAddress = DeviceAddress; parameter.SecondaryAddress = SecondaryAddress; returnValue = cbm_ioctl(HandleDevice, CBMCTRL(TALK), ¶meter, sizeof(parameter), NULL, 0) ? 0 : 1; FUNC_LEAVE_INT(returnValue); }
int CBMAPIDECL opencbm_plugin_reset(CBM_FILE HandleDevice) { USHORT returnValue; FUNC_ENTER(); // // try to cancel any pending io operations. // WaitForIoCompletionCancelAll(); returnValue = cbm_ioctl(HandleDevice, CBMCTRL(RESET), NULL, 0, NULL, 0) ? 0 : 1; FUNC_LEAVE_INT(returnValue); }
/*! \brief Write a byte to the parallel port output register This function writes a byte to the parallel port output register. (CONTROL_PORT). It is a helper function for debugging the cable (i.e., for the XCDETECT tool) only! \param HandleDevice A CBM_FILE which contains the file handle of the driver. \param Value The value to set the control port to \return If the routine succeeds, it returns 0. If the routine fails, it returns -1. \remark Do not use this function in anything but a debugging aid tool like XCDETECT! After this function has been called, it is NOT safe to use the parallel port again unless you close the driver (cbm_driver_close()) and open it again (cbm_driver_open())! This functions masks some bits off. That is, the bits not in the mask are not changed at all. The bits that are not masked off are defined in PARALLEL_CONTROL_PORT_MASK_VALUES. */ int CBMAPIDECL opencbm_plugin_iec_dbg_write(CBM_FILE HandleDevice, unsigned char Value) { CBMT_IEC_DBG_WRITE parameter; int returnValue = -1; FUNC_ENTER(); parameter.Value = Value; if ( cbm_ioctl(HandleDevice, CBMCTRL(IEC_DBG_WRITE), ¶meter, sizeof(parameter), NULL, 0) ) { returnValue = 0; } FUNC_LEAVE_INT(returnValue); }
int CBMAPIDECL opencbm_plugin_iec_wait(CBM_FILE HandleDevice, int Line, int State) { CBMT_IEC_WAIT_IN parameter; CBMT_IEC_WAIT_OUT result; FUNC_ENTER(); parameter.Line = (UCHAR) Line; parameter.State = (UCHAR) State; cbm_ioctl(HandleDevice, CBMCTRL(IEC_WAIT), ¶meter, sizeof(parameter), &result, sizeof(result)); FUNC_LEAVE_INT(result.Line); }
int cbmarch_listen(CBM_FILE HandleDevice, __u_char DeviceAddress, __u_char SecondaryAddress) { unsigned char status; FUNC_ENTER(); vicepause(); vicewriteregister(reg_a, DeviceAddress); vicewriteregister(reg_x, SecondaryAddress | 0x60); send_and_wait(addr_listen, data_listen, sizeof(data_listen)); status = (unsigned char) vicereadregister(reg_a); FUNC_LEAVE_INT(status ? 1 : 0); }
int cbmarch_raw_write(CBM_FILE HandleDevice, const void *Buffer, size_t Count) { DWORD BytesWritten; FUNC_ENTER(); WriteFile( HandleDevice, Buffer, Count, &BytesWritten, NULL ); FUNC_LEAVE_INT(BytesWritten); }
int cbmarch_parallel_burst_write_track(CBM_FILE HandleDevice, __u_char *Buffer, unsigned int Length) { int retval = 0; FUNC_ENTER(); retval = cbm_ioctl(HandleDevice, CBMCTRL(PARBURST_WRITE_TRACK), Buffer, Length, NULL, 0); if (retval == 0) { DBG_WARN((DBG_PREFIX "opencbm: cbm.c: parallel_burst_write_track: ioctl returned with error %u", retval)); } FUNC_LEAVE_INT(retval); }
int cbmarch_iec_wait(CBM_FILE HandleDevice, int Line, int State) { FUNC_ENTER(); if (State) { while(!cbm_iec_get(HandleDevice, Line)) arch_usleep(10); } else { while(cbm_iec_get(HandleDevice, Line)) arch_usleep(10); } FUNC_LEAVE_INT(cbmarch_iec_poll(HandleDevice)); }
int cbmarch_raw_read(CBM_FILE HandleDevice, void *Buffer, size_t Count) { DWORD bytesToRead = Count; DWORD bytesRead; FUNC_ENTER(); ReadFile( HandleDevice, Buffer, bytesToRead, &bytesRead, NULL ); FUNC_LEAVE_INT(bytesRead); }
int cbmarch_raw_read(CBM_FILE HandleDevice, void *Buffer, size_t Count) { unsigned char bytesread = 0; FUNC_ENTER(); DBG_ASSERT(((signed int)Count) >= 0); DBG_ASSERT(Count < 256); vicepause(); vicewriteregister(reg_y, Count); vicepreparereadmemory(0x4000, Count); send_and_wait(addr_rawread, data_rawread, sizeof(data_rawread)); vicereadmemory(0x4000, Count, Buffer); bytesread = (unsigned char) vicereadregister(reg_y); FUNC_LEAVE_INT(Count - bytesread); }