Exemple #1
0
static void print_checkpoint_info(breakpoint_t *bp)
{
    if (bp->trace) {
        mon_out("TRACE: ");
    } else if (bp->watch_load || bp->watch_store) {
        mon_out("WATCH: ");
    } else {
        if (bp->temporary)
            mon_out("UNTIL: ");
        else
            mon_out("BREAK: ");
    }
    mon_out("%d %s:$%04x",bp->brknum,
        mon_memspace_string[addr_memspace(bp->start_addr)],addr_location(bp->start_addr));
    if (mon_is_valid_addr(bp->end_addr) && (bp->start_addr != bp->end_addr))
        mon_out("-$%04x",addr_location(bp->end_addr));

    if (bp->watch_load)
        mon_out(" load");
    if (bp->watch_store)
        mon_out(" store");

    mon_out("   %s\n", (bp->enabled==e_ON) ? "enabled" : "disabled");

    if (bp->condition) {
        mon_out("\tCondition: ");
        mon_print_conditional(bp->condition);
        mon_out("\n");
    }
    if (bp->command)
        mon_out("\tCommand: %s\n", bp->command);
}
static void print_checkpoint_info(checkpoint_t *cp)
{
    if (!cp->stop) {
        mon_out("TRACE: ");
    } else if (cp->check_load || cp->check_store) {
        mon_out("WATCH: ");
    } else {
        if (cp->temporary) {
            mon_out("UNTIL: ");
        } else {
            mon_out("BREAK: ");
        }
    }
    mon_out("%d  %s:$%04x", cp->checknum,
            mon_memspace_string[addr_memspace(cp->start_addr)], addr_location(cp->start_addr));
    if (mon_is_valid_addr(cp->end_addr) && (cp->start_addr != cp->end_addr)) {
        mon_out("-$%04x", addr_location(cp->end_addr));
    }

    mon_out(cp->stop ? "  (Stop on" : "  (Trace");
    if (cp->check_load) {
        mon_out(" load");
    }
    if (cp->check_store) {
        mon_out(" store");
    }
    if (cp->check_exec) {
        mon_out(" exec");
    }

    mon_out(")");
    if (cp->enabled != e_ON) {
        mon_out(" disabled");
    }
    mon_out("\n");

    if (cp->condition) {
        mon_out("\tCondition: ");
        mon_print_conditional(cp->condition);
        mon_out("\n");
    }
    if (cp->command) {
        mon_out("\tCommand: %s\n", cp->command);
    }
}
void mon_memory_fill(MON_ADDR start_addr, MON_ADDR end_addr,
                     unsigned char *data)
{
    WORD start;
    MEMSPACE dest_mem;
    unsigned int i, mon_index;
    int len;

    len = mon_evaluate_address_range(&start_addr, &end_addr, FALSE,
                                     (WORD)data_buf_len);
    if (len < 0) {
        mon_out("Invalid range.\n");
        return;
    }
    start = addr_location(start_addr);

    if (!mon_is_valid_addr(start_addr)) {
        mon_out("Invalid start address\n");
        return;
    }

    dest_mem = addr_memspace(start_addr);

    i = 0;
    mon_index = 0;
    while ((int)i < len) {
        mon_set_mem_val(dest_mem, (WORD)ADDR_LIMIT(start + i),
                        data_buf[mon_index++]);
        if (mon_index >= data_buf_len) {
            mon_index = 0;
        }
        i++;
    }

    mon_clear_buffer();
}
void mon_drive_block_cmd(int op, int track, int sector, MON_ADDR addr)
{
    vdrive_t *vdrive;

    mon_evaluate_default_addr(&addr);

    vdrive = file_system_get_vdrive(8);

    if (!vdrive || vdrive->image == NULL) {
        mon_out("No disk attached\n");
        return;
    }

    if (!op) {
        BYTE readdata[256];
        int i, j, dst;
        MEMSPACE dest_mem;

        /* We ignore disk error codes here.  */
        if (vdrive_read_sector(vdrive, readdata, track, sector)
            < 0) {
            mon_out("Error reading track %d sector %d\n", track, sector);
            return;
        }

        if (mon_is_valid_addr(addr)) {
            dst = addr_location(addr);
            dest_mem = addr_memspace(addr);

            for (i = 0; i < 256; i++) {
                mon_set_mem_val(dest_mem, ADDR_LIMIT(dst + i), readdata[i]);
            }

            mon_out("Read track %d sector %d into address $%04x\n", track, sector, dst);
        } else {
            for (i = 0; i < 16; i++) {
                mon_out(">%04x", i * 16);
                for (j = 0; j < 16; j++) {
                    if ((j & 3) == 0) {
                        mon_out(" ");
                    }
                    mon_out(" %02x", readdata[i * 16 + j]);
                }
                mon_out("\n");
            }
        }
    } else {
        BYTE writedata[256];
        int i, src;
        MEMSPACE src_mem;

        src = addr_location(addr);
        src_mem = addr_memspace(addr);

        for (i = 0; i < 256; i++) {
            writedata[i] = mon_get_mem_val(src_mem, ADDR_LIMIT(src + i));
        }

        if (vdrive_write_sector(vdrive, writedata, track, sector)) {
            mon_out("Error writing track %d sector %d\n", track, sector);
            return;
        }

        mon_out("Write data from address $%04x to track %d sector %d\n",
                src, track, sector);
    }
}