static uae_u32 REGPARAM2 dev_beginio (TrapContext *context) { uae_u32 request = m68k_areg (&context->regs, 1); uae_u8 flags = get_byte (request + 30); int command = get_word (request + 28); struct priv_devstruct *pdev = getpdevstruct (request); struct devstruct *dev = getdevstruct (pdev->unit); put_byte (request+8, NT_MESSAGE); if (!dev || !pdev) { put_byte (request + 31, 32); return get_byte (request + 31); } put_byte (request+31, 0); if ((flags & 1) && dev_canquick (dev, request)) { if (dev_do_io (dev, request)) write_log ("device %s command %d bug with IO_QUICK\n", getdevname (pdev->type), command); return get_byte (request + 31); } else { add_async_request (dev, request, ASYNC_REQUEST_TEMP, 0); put_byte (request+30, get_byte (request + 30) & ~1); write_comm_pipe_u32 (&dev->requests, request, 1); return 0; } }
static uae_u32 REGPARAM2 dev_beginio (TrapContext *context) { uae_u32 request = m68k_areg (regs, 1); uae_u8 flags = get_byte (request + 30); int command = get_word (request + 28); struct priv_s2devstruct *pdev = getps2devstruct (request); struct s2devstruct *dev; put_byte (request + 8, NT_MESSAGE); if (!pdev) { write_log (_T("%s unknown iorequest (1) %08x\n"), getdevname (), request); put_byte (request + 31, 32); return get_byte (request + 31); } dev = gets2devstruct (pdev->unit); if (!dev) { write_log (_T("%s unknown iorequest (2) %08x\n"), getdevname (), request); put_byte (request + 31, 32); return get_byte (request + 31); } put_byte (request + 31, 0); if ((flags & 1) && dev_canquick (dev, request)) { if (dev_do_io (dev, request, 1)) write_log (_T("%s: command %d bug with IO_QUICK\n"), SANA2NAME, command); return get_byte (request + 31); } else { if (command == CMD_WRITE || command == S2_BROADCAST || command == S2_MULTICAST) { struct s2packet *s2p; if (!pdev->copyfrombuff || !pdev->copytobuff) { put_long (request + 32, S2ERR_BAD_ARGUMENT); put_byte (request + 31, S2WERR_BUFF_ERROR); } else { if (command == S2_BROADCAST) { uaecptr dstaddr = request + 32 + 4 + 4 + SANA2_MAX_ADDR_BYTES; put_byte (dstaddr + 0, 0xff); put_byte (dstaddr + 1, 0xff); put_byte (dstaddr + 2, 0xff); put_byte (dstaddr + 3, 0xff); put_byte (dstaddr + 4, 0xff); put_byte (dstaddr + 5, 0xff); } s2p = createwritepacket (context, request); if (s2p) { uae_sem_wait (&async_sem); add_async_packet (dev, s2p, request); uae_sem_post (&async_sem); } if (!s2p) { put_long (request + 32, S2WERR_BUFF_ERROR); put_byte (request + 31, S2ERR_NO_RESOURCES); } } } put_byte (request + 30, get_byte (request + 30) & ~1); write_comm_pipe_u32 (&dev->requests, request, 1); return 0; } }
static uint32_t REGPARAM2 dev_beginio (TrapContext *context) { uint32_t request = m68k_areg (regs, 1); uint8_t flags = get_byte (request + 30); int32_t command = get_word (request + 28); struct devstruct *dev = getdevstruct (get_long (request + 24)); put_byte (request + 8, NT_MESSAGE); if (!dev) { put_byte (request + 31, 32); return get_byte (request + 31); } put_byte (request + 31, 0); if ((flags & 1) && dev_canquick (dev, request)) { if (dev_do_io (dev, request, 1)) write_log (_T("device %s:%d command %d bug with IO_QUICK\n"), getdevname(), dev->unit, command); return get_byte (request + 31); } else { put_byte (request + 30, get_byte (request + 30) & ~1); write_comm_pipe_u32 (&dev->requests, request, 1); return 0; } }