Пример #1
0
/* M-W - Memory Write */
static int fsdevice_flush_mw(vdrive_t *vdrive, char *realarg)
{
    unsigned int dnr = vdrive->unit - 8;
    unsigned int length;
    WORD addr;

    addr = fsdevice_dev[dnr].cmdbuf[3] | (fsdevice_dev[dnr].cmdbuf[4] << 8);
    length = 6 + ((realarg != NULL) ? strlen(realarg) : 0); /* FIXME */
    return vdrive_command_memory_write(vdrive, &fsdevice_dev[dnr].cmdbuf[5], addr, length);
}
Пример #2
0
/*
    The buffer pointer passed to this function points to the character
    following '-' in the memory command.

    The buffer pointer passed to the sub-functions points to the byte
    after the first argument (address) which is passed separately.
*/
static int vdrive_command_memory(vdrive_t *vdrive, BYTE *buffer,
                                 unsigned int length)
{
    WORD addr;

    if (length < 5) {
        return CBMDOS_IPE_SYNTAX;
    }

    addr = util_le_buf_to_word(buffer + 1);

    switch (*buffer) {
      case 'W':
        return vdrive_command_memory_write(vdrive, buffer + 3, addr, length);
      case 'R':
        return vdrive_command_memory_read(vdrive, buffer + 3, addr, length);
      case 'E':
        return vdrive_command_memory_exec(vdrive, NULL, addr, length);
      default:
        break;
    }
    return CBMDOS_IPE_INVAL;
}