Ejemplo n.º 1
0
static void discovery_read_raw(
    struct disk *d, unsigned int tracknr, struct tbuf *tbuf)
{
    struct track_info *ti = &d->di->track[tracknr];
    uint16_t sum, val, *dat = (uint16_t *)ti->dat;
    unsigned int i;

    tbuf_bits(tbuf, SPEED_AVG, bc_raw, 16, dat[ti->len/2+2]);

    val = (ti->type == TRKTYP_sword_sodan) ? 0 :
          (ti->type == TRKTYP_hybris) ? 0 : dat[ti->len/2+2];

    tbuf_bits(tbuf, SPEED_AVG, bc_mfm_even_odd, 16, val);
    tbuf_bits(tbuf, SPEED_AVG, bc_mfm_even_odd, 16, dat[ti->len/2]);
    tbuf_bits(tbuf, SPEED_AVG, bc_mfm_even_odd, 16, ti->len);
    tbuf_bits(tbuf, SPEED_AVG, bc_mfm_even_odd, 16, dat[ti->len/2+1]);
    tbuf_bytes(tbuf, SPEED_AVG, bc_mfm_even_odd, ti->len, dat);
    tbuf_bits(tbuf, SPEED_AVG, bc_mfm_even_odd, 16, 0xdead);

    sum = discovery_sum(be16toh(val), 0);
    sum = discovery_sum(be16toh(dat[ti->len/2]), sum);
    sum = discovery_sum(be16toh(ti->len), sum);
    sum = discovery_sum(be16toh(dat[ti->len/2+1]), sum);

    for (i = 0 ; i < ti->len/2; i++)
        sum = discovery_sum(dat[i], sum);
    sum = discovery_sum(be16toh(0xdead), sum);

    tbuf_bits(tbuf, SPEED_AVG, bc_mfm_even_odd, 16, sum);
}
Ejemplo n.º 2
0
static void rtype_a_read_raw(
    struct disk *d, unsigned int tracknr, struct tbuf *tbuf)
{
    struct track_info *ti = &d->di->track[tracknr];
    uint32_t csum;

    tbuf_bits(tbuf, SPEED_AVG, bc_raw, 16, 0x9521);
    tbuf_bits(tbuf, SPEED_AVG, bc_mfm, 8, 0);

    csum = amigados_checksum(ti->dat, ti->len);
    tbuf_bits(tbuf, SPEED_AVG, bc_mfm_odd, 32, csum);

    tbuf_bytes(tbuf, SPEED_AVG, bc_mfm_even_odd, ti->len, ti->dat);
}
Ejemplo n.º 3
0
static void bat_read_raw(
    struct disk *d, unsigned int tracknr, struct tbuf *tbuf)
{
    struct track_info *ti = &d->di->track[tracknr];
    uint32_t csum, dat[0x629];
    unsigned int i;

    tbuf_bits(tbuf, SPEED_AVG, bc_raw, 16, 0x8945);

    memcpy(dat, ti->dat, ti->len);
    csum = tracknr ^ 1;
    for (i = 0; i < 0x628; i++)
        csum += be32toh(dat[i]);
    dat[0x628] = htobe32(csum);

    tbuf_bytes(tbuf, SPEED_AVG, bc_mfm_even_odd, 0x629*4, dat);
}
Ejemplo n.º 4
0
static void speedball_read_raw(
    struct disk *d, unsigned int tracknr, struct tbuf *tbuf)
{
    struct track_info *ti = &d->di->track[tracknr];
    uint32_t csum = 0, *dat = (uint32_t *)ti->dat;
    unsigned int i;

    tbuf_bits(tbuf, SPEED_AVG, bc_raw, 32, 0x44894489);
    tbuf_bits(tbuf, SPEED_AVG, bc_mfm, 16, 0xfefe);
    tbuf_bits(tbuf, SPEED_AVG, bc_mfm_even_odd, 32, ID_THBB);
    tbuf_bits(tbuf, SPEED_AVG, bc_mfm_even_odd, 32, ti->len);

    for (i = 0; i < ti->len/4; i++)
        csum ^= be32toh(dat[i]);
    tbuf_bits(tbuf, SPEED_AVG, bc_mfm_even_odd, 32, csum);

    tbuf_bytes(tbuf, SPEED_AVG, bc_mfm_even_odd, ti->len, dat);
}
Ejemplo n.º 5
0
static void rtype_b_read_raw(
    struct disk *d, unsigned int tracknr, struct tbuf *tbuf)
{
    struct track_info *ti = &d->di->track[tracknr];
    uint32_t csum, *dat = (uint32_t *)ti->dat;
    unsigned int i;

    tbuf_bits(tbuf, SPEED_AVG, bc_raw, 16, 0x9521);
    tbuf_bits(tbuf, SPEED_AVG, bc_mfm, 8, 0);

    for (i = 0; i < ti->len/4; i++) 
        tbuf_bytes(tbuf, SPEED_AVG, bc_mfm_even_odd, 4, &dat[i]);

    csum = amigados_checksum(dat, ti->len);
    csum &= 0x55555555u;
    csum |= 0xaaaaaaaau;
    
    tbuf_bits(tbuf, SPEED_AVG, bc_mfm_even_odd, 32, csum);
}
Ejemplo n.º 6
0
static void psygnosis_a_read_raw(
    struct disk *d, unsigned int tracknr, struct tbuf *tbuf)
{
    struct track_info *ti = &d->di->track[tracknr];
    uint32_t *dat = (uint32_t *)ti->dat;
    unsigned int dat_len = ti->len - 4;
    uint16_t sync;

    sync = be16toh(*(uint16_t *)&ti->dat[dat_len]);
    tbuf_bits(tbuf, SPEED_AVG, bc_raw, 16, sync);
    sync = be16toh(*(uint16_t *)&ti->dat[dat_len+2]);
    if (sync)
        tbuf_bits(tbuf, SPEED_AVG, bc_raw, 16, sync);

    tbuf_bits(tbuf, SPEED_AVG, bc_mfm_even_odd, 32, (~0u << 8) | tracknr);

    tbuf_bits(tbuf, SPEED_AVG, bc_mfm_even_odd, 32,
              amigados_checksum(dat, dat_len));

    tbuf_bytes(tbuf, SPEED_AVG, bc_mfm_even_odd, dat_len, dat);
}
Ejemplo n.º 7
0
static void sensible_read_raw(
    struct disk *d, unsigned int tracknr, struct tbuf *tbuf)
{
    struct track_info *ti = &d->di->track[tracknr];
    uint32_t *dat = (uint32_t *)ti->dat, csum;
    unsigned int i, enc;

    tbuf_bits(tbuf, SPEED_AVG, bc_raw, 32, 0x44894489);

    csum = SOS_SIG + (tracknr ^ 1);
    for (i = 0; i < ti->len/4; i++)
        csum += be32toh(dat[i]);

    for (i = 0; i < 2; i++) {
        enc = (i == 0) ? bc_mfm_odd : bc_mfm_even;
        tbuf_bits(tbuf, SPEED_AVG, enc, 32, SOS_SIG);
        tbuf_bits(tbuf, SPEED_AVG, enc, 32, csum);
        tbuf_bits(tbuf, SPEED_AVG, enc, 32, tracknr^1);
        tbuf_bytes(tbuf, SPEED_AVG, enc, ti->len, dat);
    }
}
Ejemplo n.º 8
0
static void phantom_fighter_read_raw(
    struct disk *d, unsigned int tracknr, struct tbuf *tbuf)
{
    struct track_info *ti = &d->di->track[tracknr];
    uint16_t csum, *dat = (uint16_t *)ti->dat;
    unsigned int i, j;

    tbuf_bits(tbuf, SPEED_AVG, bc_raw, 32, 0x44894489);
    tbuf_bits(tbuf, SPEED_AVG, bc_mfm, 8, 0xff);

    for (i = csum = 0; i < ti->len/2; i++)
        csum += be16toh(dat[i]);

    for (j = 0; j < 2; j++) {
        unsigned int type = j ? bc_mfm_odd : bc_mfm_even;
        for (i = 0; i < 4; i++) {
            tbuf_bytes(tbuf, SPEED_AVG, type, 2 * ((i == 3) ? 0x2eb : 0x2ec),
                       &dat[0x2ec*i]);
            if (i == 3)
                tbuf_bits(tbuf, SPEED_AVG, type, 16, csum);
            tbuf_bits(tbuf, SPEED_AVG, bc_mfm, 16, 0xffff);
        }
    }
}
Ejemplo n.º 9
0
static void firebird_read_raw(
    struct disk *d, unsigned int tracknr, struct tbuf *tbuf)
{
    struct track_info *ti = &d->di->track[tracknr];

    if (ti->type == TRKTYP_ikplus)
        tbuf_bits(tbuf, SPEED_AVG, bc_mfm, 16, 0xf72a);

    tbuf_start_crc(tbuf);

    tbuf_bits(tbuf, SPEED_AVG, bc_raw, 32, 0x89448944);
    tbuf_bits(tbuf, SPEED_AVG, bc_raw, 16, 0x8944);

    if (ti->type == TRKTYP_firebird) {
        tbuf_bits(tbuf, SPEED_AVG, bc_mfm, 8, 0xff);
    } else if (ti->type == TRKTYP_afterburner_data) {
        tbuf_bits(tbuf, SPEED_AVG, bc_mfm, 16, 0x4142);
        tbuf_bits(tbuf, SPEED_AVG, bc_mfm, 8, tracknr/2);
    }

    tbuf_bytes(tbuf, SPEED_AVG, bc_mfm, ti->len, ti->dat);

    tbuf_emit_crc16_ccitt(tbuf, SPEED_AVG);
}