Exemplo n.º 1
0
static libspectrum_error
raw_data_edge( libspectrum_tape_raw_data_block *block,
               libspectrum_tape_raw_data_block_state *state,
	       libspectrum_dword *tstates, int *end_of_block )
{
  int error;

  switch (state->state) {
  case LIBSPECTRUM_TAPE_STATE_DATA1:
    *tstates = state->bit_tstates;
    error = libspectrum_tape_raw_data_next_bit( block, state );
    if( error ) return error;
    break;

  case LIBSPECTRUM_TAPE_STATE_PAUSE:
    /* The pause at the end of the block */
    *tstates = ( block->pause * 69888 )/20; /* FIXME: should vary with tstates
					       per frame */
    *end_of_block = 1;
    break;

  default:
    libspectrum_print_error( LIBSPECTRUM_ERROR_LOGIC,
			     "raw_edge: unknown state %d", state->state );
    return LIBSPECTRUM_ERROR_LOGIC;
  }

  return LIBSPECTRUM_ERROR_NONE;
}
Exemplo n.º 2
0
static void
raw_data_init( libspectrum_tape_raw_data_block *block,
               libspectrum_tape_raw_data_block_state *state )
{
  if( block->data ) {

    /* We're just before the start of the data */
    state->state = LIBSPECTRUM_TAPE_STATE_DATA1;
    state->bytes_through_block = -1; state->bits_through_byte = 7;
    state->last_bit = 0x80 & block->data[0];
    /* Set up the next bit */
    libspectrum_tape_raw_data_next_bit( block, state );

  } else {

    state->state = LIBSPECTRUM_TAPE_STATE_PAUSE;

  }
}