예제 #1
0
파일: i8271.c 프로젝트: poliva/mame-rr
static void i8271_seek_to_track(device_t *device,int track)
{
	device_t *img = current_image(device);
	i8271_t *i8271 = get_safe_token(device);
	if (track==0)
	{
		/* seek to track 0 */
		unsigned char StepCount = 0x0ff;

        /*logerror("step\n"); */

		/* track 0 not set, not seeked more than 255 tracks */
		while (floppy_tk00_r(img) && (StepCount != 0))
		{
/*            logerror("step\n"); */
			StepCount--;
			floppy_drive_seek(img, -1);
		}

		i8271->CurrentTrack[i8271->drive] = 0;

		/* failed to find track 0? */
		if (StepCount==0)
		{
			/* Completion Type: operator intervation probably required for recovery */
			/* Completion code: track 0 not found */
			i8271->ResultRegister |= (2<<3) | 2<<1;
		}

		/* step out - towards track 0 */
		i8271->drive_control_output &=~(1<<2);
	}
	else
	{

		signed int SignedTracks;

		/* calculate number of tracks to seek */
		SignedTracks = track - i8271->CurrentTrack[i8271->drive];

		/* step towards 0 */
		i8271->drive_control_output &= ~(1<<2);

		if (SignedTracks>0)
		{
			/* step away from 0 */
			i8271->drive_control_output |= (1<<2);
		}


		/* seek to track 0 */
		floppy_drive_seek(img, SignedTracks);

		i8271->CurrentTrack[i8271->drive] = track;
	}
}
예제 #2
0
파일: i8271.c 프로젝트: poliva/mame-rr
static int i8271_find_sector(device_t *device)
{
	device_t *img = current_image(device);
	i8271_t *i8271 = get_safe_token(device);
//  int track_count_attempt;

//  track_count_attempt
	/* find sector within one revolution of the disc - 2 index pulses */

	/* number of times we have seen index hole */
	int index_count = 0;

	/* get sector id's */
	do
    {
		chrn_id id;

		/* get next id from disc */
		if (floppy_drive_get_next_id(img, i8271->side,&id))
		{
			/* tested on Amstrad CPC - All bytes must match, otherwise
            a NO DATA error is reported */
			if (id.R == i8271->ID_R)
			{
				/* TODO: Is this correct? What about bad tracks? */
				if (id.C == i8271->CurrentTrack[i8271->drive])
				{
					i8271->data_id = id.data_id;
					return 1;
				}
				else
				{
					/* TODO: if track doesn't match, the real 8271 does a step */


					return 0;
				}
			}
		}

		 /* index set? */
		if (floppy_drive_get_flag_state(img, FLOPPY_DRIVE_INDEX))
		{
			index_count++;
		}

	}
	while (index_count!=2);

	/* completion type: command/drive error */
	/* completion code: sector not found */
	i8271->ResultRegister |= (3<<3);

	return 0;
}
예제 #3
0
void toggle_t::measure(extents_t& result)
{
    assert(control_m);

    result = extents_t();

    const adobe::toggle_t::image_type& image(current_image(*this));

    result.height() = static_cast<long>(image.height());
    result.width() = static_cast<long>(image.width());
}
int FeaturesDetectionApplication::main_loop(program_options::variables_map &options)
{
    printf("FeaturesDetectionApplication::main_loop says hello world !\n");


    //init_gui(options);
    //run_gui();

	// initialization ---
    gst_video_input_p.reset(new GstVideoInput(options));
    features_detector_p.reset(new SimpleFAST(options));

    // video output ---
    rgb8_cimg_t current_image(gst_video_input_p->get_image_dimensions());
    gst_video_input_p->get_new_image(current_image.view); // copy the data


    CImgDisplay video_display(current_image.dimx(), current_image.dimy(), get_application_title().c_str());
    video_display.show();
    video_display.display(current_image);

    // intermediary image --
    gray8_image_t gray_image(current_image.view.dimensions());

    // main loop ---

    do
    {
        // get new image --
        gst_video_input_p->get_new_image(current_image.view); // copy the data

        // color to gray_image
        copy_and_convert_pixels(current_image.view, boost::gil::view(gray_image));
        
        // compute features
        const vector<FASTFeature> &features =
            features_detector_p->detect_features((const_view(gray_image)));

        // plot features on output image
        draw_features(features, current_image);

        video_display.display(current_image);

        // add a delay ---	
        wait_some_seconds(0.1); // [seconds]


    }
    while (video_display.is_closed == false);

    return 0;

}
예제 #5
0
파일: i8271.c 프로젝트: poliva/mame-rr
static void i8271_do_read_id(device_t *device)
{
	chrn_id	id;
	i8271_t *i8271 = get_safe_token(device);

	/* get next id from disc */
	floppy_drive_get_next_id(current_image(device), i8271->side,&id);

	i8271->pExecutionPhaseData[0] = id.C;
	i8271->pExecutionPhaseData[1] = id.H;
	i8271->pExecutionPhaseData[2] = id.R;
	i8271->pExecutionPhaseData[3] = id.N;

	i8271_initialise_execution_phase_read(device, 4);
}
예제 #6
0
파일: i8271.c 프로젝트: poliva/mame-rr
static void i8271_do_read(device_t *device)
{
	i8271_t *i8271 = get_safe_token(device);
	/* find the sector */
	if (i8271_find_sector(device))
	{
		/* get the sector into the buffer */
		floppy_drive_read_sector_data(current_image(device), i8271->side, i8271->data_id, i8271->pExecutionPhaseData, 1<<(i8271->ID_N+7));

		/* initialise for reading */
        i8271_initialise_execution_phase_read(device, 1<<(i8271->ID_N+7));

		/* update state - gets first byte and triggers a data request */
		i8271_timed_data_request(device);
		return;
	}
	LOG(("error getting sector data\n"));

	i8271_timed_command_complete(device);
}
예제 #7
0
// -------------------------------------------------------------------------------------------------
tResult LaneFilter::processImage(IMediaSample* image_sample) {
// -------------------------------------------------------------------------------------------------
  const tVoid* source_buffer;
  
  bool enable_lights = false;
  
  if (IS_OK(image_sample->Lock(&source_buffer))) {
    int source_width = input_format_.nWidth;
    int source_height = input_format_.nHeight;
    
    Mat current_image(source_height, source_width, CV_8UC3, (uchar*)source_buffer);
    
    enable_lights = calculateImageLuminosity(current_image) < GetPropertyFloat("lum_threshold");
    
    // Detect the edges of the image by using a Canny Algo
    Mat preprocessed;
    lane_preprocessor_.set_gaussian_blur(Size(15,15), 2);
    lane_preprocessor_.preprocess_image(current_image, preprocessed);
    
    std::vector<Vector2> mapped_points;
    Mat mapping_image;
    lane_detector_.detect_lanes(preprocessed, mapping_image, mapped_points);
    image_sample->Unlock(source_buffer);
    
    transmitLanePoints(mapped_points);
  }
  
  if (GetPropertyBool("headlights_enabled")) {
    if(enable_lights != headlights_on_) {
      transmitHeadLight(enable_lights);
      headlights_on_ = enable_lights;
    }
  }
  
  RETURN_NOERROR;
}
예제 #8
0
bool effect::render()
{
	if(disp == NULL) {
		return false;
	}

	if(loc_.x != -1 && loc_.y != -1) {
		if(disp->shrouded(loc_)) {
			return false;
		} else {
			// The location of a halo is an x,y value and not a map location.
			// This means when a map is zoomed, the halo's won't move,
			// This glitch is most visible on [item] haloes.
			// This workaround always recalculates the location of the halo
			// (item haloes have a location parameter to hide them under the shroud)
			// and reapplies that location.
			// It might be optimized by storing and comparing the zoom value.
			set_location(
				disp->get_location_x(loc_) + disp->hex_size() / 2,
				disp->get_location_y(loc_) + disp->hex_size() / 2);
		}
	}

	images_.update_last_draw_time();
	surf_.assign(image::get_image(current_image(),image::SCALED_TO_ZOOM));
	if(surf_ == NULL) {
		return false;
	}
	if(orientation_ == HREVERSE || orientation_ == HVREVERSE) {
		surf_.assign(image::reverse_image(surf_));
	}
	if(orientation_ == VREVERSE || orientation_ == HVREVERSE) {
		surf_.assign(flop_surface(surf_));
	}

	const map_location zero_loc(0,0);
	const int screenx = disp->get_location_x(zero_loc);
	const int screeny = disp->get_location_y(zero_loc);

	const int xpos = x_ + screenx - surf_->w/2;
	const int ypos = y_ + screeny - surf_->h/2;

	SDL_Rect rect = create_rect(xpos, ypos, surf_->w, surf_->h);
	rect_ = rect;
	SDL_Rect clip_rect = disp->map_outside_area();

	// If rendered the first time, need to determine the area affected.
	// If a halo changes size, it is not updated.
	if(overlayed_hexes_.empty()) {
		rect_of_hexes hexes = disp->hexes_under_rect(rect);
		rect_of_hexes::iterator i = hexes.begin(), end = hexes.end();
		for (;i != end; ++i) {
			overlayed_hexes_.push_back(*i);
		}
	}

	if(rects_overlap(rect,clip_rect) == false) {
		buffer_.assign(NULL);
		return false;
	}

	surface screen = disp->get_screen_surface();

	const clip_rect_setter clip_setter(screen, &clip_rect);
	if(buffer_ == NULL || buffer_->w != rect.w || buffer_->h != rect.h) {
		SDL_Rect rect = rect_;
		buffer_.assign(get_surface_portion(screen,rect));
	} else {
		SDL_Rect rect = rect_;
		sdl_blit(screen,&rect,buffer_,NULL);
	}

	sdl_blit(surf_,NULL,screen,&rect);

	return true;
}
예제 #9
0
파일: i8271.c 프로젝트: poliva/mame-rr
static void i8271_command_execute(device_t *device)
{
	i8271_t *i8271 = get_safe_token(device);
	device_t *img = current_image(device);

	/* clear it = good completion status */
	/* this will be changed if anything bad happens! */
	i8271->ResultRegister = 0;

	switch (i8271->Command)
	{
		case I8271_COMMAND_SPECIFY:
		{
			switch (i8271->CommandParameters[0])
			{
				case 0x0d:
				{
					LOG(("Initialization\n"));
					i8271->StepRate = i8271->CommandParameters[1];
					i8271->HeadSettlingTime = i8271->CommandParameters[2];
					i8271->IndexCountBeforeHeadUnload = (i8271->CommandParameters[3]>>4) & 0x0f;
					i8271->HeadLoadTime = (i8271->CommandParameters[3] & 0x0f);
				}
				break;

				case 0x010:
				{
					LOG(("Load bad Tracks Surface 0\n"));
					i8271_load_bad_tracks(device,0);

				}
				break;

				case 0x018:
				{
					LOG(("Load bad Tracks Surface 1\n"));
					i8271_load_bad_tracks(device,1);

				}
				break;
			}

			/* no result */
			i8271_command_complete(device,0,0);
		}
		break;

		case I8271_COMMAND_READ_SPECIAL_REGISTER:
		{
			/* unknown - what is read when a special register that isn't allowed is specified? */
			int data = 0x0ff;

			switch (i8271->CommandParameters[0])
			{
				case I8271_SPECIAL_REGISTER_MODE_REGISTER:
				{
					data = i8271->Mode;
				}
				break;

				case I8271_SPECIAL_REGISTER_SURFACE_0_CURRENT_TRACK:
				{
					data = i8271_read_current_track(device, 0);

				}
				break;

				case I8271_SPECIAL_REGISTER_SURFACE_1_CURRENT_TRACK:
				{
					data = i8271_read_current_track(device, 1);
				}
				break;

				case I8271_SPECIAL_REGISTER_SURFACE_0_BAD_TRACK_1:
				{
					data = i8271_read_bad_track(device, 0,1);
				}
				break;

				case I8271_SPECIAL_REGISTER_SURFACE_0_BAD_TRACK_2:
				{
					data = i8271_read_bad_track(device, 0,2);
				}
				break;

				case I8271_SPECIAL_REGISTER_SURFACE_1_BAD_TRACK_1:
				{
					data = i8271_read_bad_track(device, 1,1);
				}
				break;

				case I8271_SPECIAL_REGISTER_SURFACE_1_BAD_TRACK_2:
				{
					data = i8271_read_bad_track(device, 1,2);
				}
				break;

				case I8271_SPECIAL_REGISTER_DRIVE_CONTROL_OUTPUT_PORT:
				{
					FDC_LOG_COMMAND("Read Drive Control Output port\n");

					i8271_get_drive(device);

					/* assumption: select bits reflect the select bits from the previous
                    command. i.e. read drive status */
					data = (i8271->drive_control_output & ~0x0c0)
						| (i8271->CommandRegister & 0x0c0);


				}
				break;

				case I8271_SPECIAL_REGISTER_DRIVE_CONTROL_INPUT_PORT:
				{
					/* bit 7: not used */
					/* bit 6: ready 1 */
					/* bit 5: write fault */
					/* bit 4: index */
					/* bit 3: wr prot */
					/* bit 2: rdy 0 */
					/* bit 1: track 0 */
					/* bit 0: cnt/opi */

					FDC_LOG_COMMAND("Read Drive Control Input port\n");


					i8271->drive_control_input = (1<<6) | (1<<2);

					/* bit 3 = 0 if write protected */
					i8271->drive_control_input |= floppy_wpt_r(img) << 3;

					/* bit 1 = 0 if head at track 0 */
					i8271->drive_control_input |= floppy_tk00_r(img) << 1;

					/* need to setup this register based on drive selected */
					data = i8271->drive_control_input;
				}
				break;

			}

			i8271->ResultRegister = data;

			i8271_command_complete(device,1,0);
		}
		break;


		case I8271_COMMAND_WRITE_SPECIAL_REGISTER:
		{
			switch (i8271->CommandParameters[0])
			{
				case I8271_SPECIAL_REGISTER_MODE_REGISTER:
				{
					/* TODO: Check bits 6-7 and 5-2 are valid */
					i8271->Mode = i8271->CommandParameters[1];

					if (i8271->Mode & 0x01)
					{
						LOG(("Mode: Non-DMA\n"));
					}
					else
					{
						LOG(("Mode: DMA\n"));
					}

					if (i8271->Mode & 0x02)
					{
						LOG(("Single actuator\n"));
					}
					else
					{
						LOG(("Double actuator\n"));
					}
				}
				break;

				case I8271_SPECIAL_REGISTER_SURFACE_0_CURRENT_TRACK:
				{
					LOG(("Surface 0 Current Track\n"));
					i8271_write_current_track(device, 0, i8271->CommandParameters[1]);
				}
				break;

				case I8271_SPECIAL_REGISTER_SURFACE_1_CURRENT_TRACK:
				{
					LOG(("Surface 1 Current Track\n"));
					i8271_write_current_track(device, 1, i8271->CommandParameters[1]);
				}
				break;

				case I8271_SPECIAL_REGISTER_SURFACE_0_BAD_TRACK_1:
				{
					LOG(("Surface 0 Bad Track 1\n"));
					i8271_write_bad_track(device, 0, 1, i8271->CommandParameters[1]);
				}
				break;

				case I8271_SPECIAL_REGISTER_SURFACE_0_BAD_TRACK_2:
				{
					LOG(("Surface 0 Bad Track 2\n"));
					i8271_write_bad_track(device, 0, 2,i8271->CommandParameters[1]);
				}
				break;

				case I8271_SPECIAL_REGISTER_SURFACE_1_BAD_TRACK_1:
				{
					LOG(("Surface 1 Bad Track 1\n"));


					i8271_write_bad_track(device, 1, 1, i8271->CommandParameters[1]);
				}
				break;

				case I8271_SPECIAL_REGISTER_SURFACE_1_BAD_TRACK_2:
				{
					LOG(("Surface 1 Bad Track 2\n"));

					i8271_write_bad_track(device, 1, 2, i8271->CommandParameters[1]);
				}
				break;

				case I8271_SPECIAL_REGISTER_DRIVE_CONTROL_OUTPUT_PORT:
				{
//                  /* get drive selected */
//                  i8271->drive = (i8271->CommandParameters[1]>>6) & 0x03;

					FDC_LOG_COMMAND("Write Drive Control Output port\n");


					if (i8271->CommandParameters[1] & 0x01)
					{
						LOG(("Write Enable\n"));
					}
					if (i8271->CommandParameters[1] & 0x02)
					{
						LOG(("Seek/Step\n"));
					}
					if (i8271->CommandParameters[1] & 0x04)
					{
						LOG(("Direction\n"));
					}
					if (i8271->CommandParameters[1] & 0x08)
					{
						LOG(("Load Head\n"));
					}
					if (i8271->CommandParameters[1] & 0x010)
					{
						LOG(("Low head current\n"));
					}
					if (i8271->CommandParameters[1] & 0x020)
					{
						LOG(("Write Fault Reset\n"));
					}

					LOG(("Select %02x\n", (i8271->CommandParameters[1] & 0x0c0)>>6));

					/* get drive */
					i8271_get_drive(device);

					/* on bbc dfs 09 this is the side select output */
					i8271->side = (i8271->CommandParameters[1]>>5) & 0x01;

					/* load head - on mini-sized drives this turns on the disc motor,
                    on standard-sized drives this loads the head and turns the motor on */
					floppy_mon_w(img, !BIT(i8271->CommandParameters[1], 3));
					floppy_drive_set_ready_state(img, 1, 1);

					/* step pin changed? if so perform a step in the direction indicated */
					if (((i8271->drive_control_output^i8271->CommandParameters[1]) & (1<<1))!=0)
					{
						/* step pin changed state? */

						if ((i8271->CommandParameters[1] & (1<<1))!=0)
						{
							signed int signed_tracks;

							if ((i8271->CommandParameters[1] & (1<<2))!=0)
							{
								signed_tracks = 1;
							}
							else
							{
								signed_tracks = -1;
							}

							floppy_drive_seek(img, signed_tracks);
						}
					}

					i8271->drive_control_output = i8271->CommandParameters[1];


				}
				break;

				case I8271_SPECIAL_REGISTER_DRIVE_CONTROL_INPUT_PORT:
				{

					FDC_LOG_COMMAND("Write Drive Control Input port\n");

					//                  i8271->drive_control_input = i8271->CommandParameters[1];
				}
				break;

			}

			/* write doesn't supply a result */
			i8271_command_complete(device,0,0);
		}
		break;

		case I8271_COMMAND_READ_DRIVE_STATUS:
		{
			unsigned char status;

			i8271_get_drive(device);

			/* no write fault */
			status = 0;

			status |= (1<<2) | (1<<6);

			/* these two do not appear to be set at all! ?? */

			if (i8271->intf->floppy_drive_tags[0]!=NULL) {
				if (floppy_drive_get_flag_state(device->machine().device(i8271->intf->floppy_drive_tags[0]), FLOPPY_DRIVE_READY))
				{
					status |= (1<<2);
				}
			}

			if (i8271->intf->floppy_drive_tags[1]!=NULL) {
				if (floppy_drive_get_flag_state(device->machine().device(i8271->intf->floppy_drive_tags[1]), FLOPPY_DRIVE_READY))
				{
					status |= (1<<6);
				}
			}

			/* bit 3 = 1 if write protected */
			status |= !floppy_wpt_r(img) << 3;

			/* bit 1 = 1 if head at track 0 */
			status |= !floppy_tk00_r(img) << 1;

			i8271->ResultRegister = status;
			i8271_command_complete(device,1,0);

		}
		break;

		case I8271_COMMAND_SEEK:
		{
			i8271_get_drive(device);


			i8271_seek_to_track(device,i8271->CommandParameters[0]);

			/* check for bad seek */
			i8271_timed_command_complete(device);

		}
		break;

		case I8271_COMMAND_READ_DATA_MULTI_RECORD:
		{
			/* N value as stored in ID field */
			i8271->ID_N = (i8271->CommandParameters[2]>>5) & 0x07;

			/* starting sector id */
			i8271->ID_R = i8271->CommandParameters[1];

			/* number of sectors to transfer */
			i8271->Counter = i8271->CommandParameters[2] & 0x01f;


			FDC_LOG_COMMAND("READ DATA MULTI RECORD");

			LOG(("Sector Count: %02x\n", i8271->Counter));
			LOG(("Track: %02x\n",i8271->CommandParameters[0]));
			LOG(("Sector: %02x\n", i8271->CommandParameters[1]));
			LOG(("Sector Length: %02x bytes\n", 1<<(i8271->ID_N+7)));

			i8271_get_drive(device);

			if (!floppy_drive_get_flag_state(img, FLOPPY_DRIVE_READY))
			{
				/* Completion type: operation intervention probably required for recovery */
				/* Completion code: Drive not ready */
				i8271->ResultRegister = (2<<3);
				i8271_timed_command_complete(device);
			}
			else
			{
				i8271_seek_to_track(device,i8271->CommandParameters[0]);


				i8271_do_read(device);
			}

		}
		break;

		case I8271_COMMAND_READ_DATA_SINGLE_RECORD:
		{
			FDC_LOG_COMMAND("READ DATA SINGLE RECORD");

			i8271->ID_N = 0;
			i8271->Counter = 1;
			i8271->ID_R = i8271->CommandParameters[1];

			LOG(("Sector Count: %02x\n", i8271->Counter));
			LOG(("Track: %02x\n",i8271->CommandParameters[0]));
			LOG(("Sector: %02x\n", i8271->CommandParameters[1]));
			LOG(("Sector Length: %02x bytes\n", 1<<(i8271->ID_N+7)));

			i8271_get_drive(device);

			if (!floppy_drive_get_flag_state(img, FLOPPY_DRIVE_READY))
			{
				/* Completion type: operation intervention probably required for recovery */
				/* Completion code: Drive not ready */
				i8271->ResultRegister = (2<<3);
				i8271_timed_command_complete(device);
			}
			else
			{
				i8271_seek_to_track(device,i8271->CommandParameters[0]);

				i8271_do_read(device);
			}

		}
		break;

		case I8271_COMMAND_WRITE_DATA_MULTI_RECORD:
		{
			/* N value as stored in ID field */
			i8271->ID_N = (i8271->CommandParameters[2]>>5) & 0x07;

			/* starting sector id */
			i8271->ID_R = i8271->CommandParameters[1];

			/* number of sectors to transfer */
			i8271->Counter = i8271->CommandParameters[2] & 0x01f;

			FDC_LOG_COMMAND("READ DATA MULTI RECORD");

			LOG(("Sector Count: %02x\n", i8271->Counter));
			LOG(("Track: %02x\n",i8271->CommandParameters[0]));
			LOG(("Sector: %02x\n", i8271->CommandParameters[1]));
			LOG(("Sector Length: %02x bytes\n", 1<<(i8271->ID_N+7)));

			i8271_get_drive(device);

            i8271->drive_control_output &=~1;

			if (!floppy_drive_get_flag_state(img, FLOPPY_DRIVE_READY))
			{
				/* Completion type: operation intervention probably required for recovery */
				/* Completion code: Drive not ready */
				i8271->ResultRegister = (2<<3);
				i8271_timed_command_complete(device);
			}
			else
			{
				if (floppy_wpt_r(img) == CLEAR_LINE)
				{
					/* Completion type: operation intervention probably required for recovery */
					/* Completion code: Drive write protected */
					i8271->ResultRegister = (2<<3) | (1<<1);
					i8271_timed_command_complete(device);
				}
				else
				{
                    i8271->drive_control_output |=1;

					i8271_seek_to_track(device,i8271->CommandParameters[0]);

					i8271_do_write(device);
				}
			}
		}
		break;

		case I8271_COMMAND_WRITE_DATA_SINGLE_RECORD:
		{
			FDC_LOG_COMMAND("WRITE DATA SINGLE RECORD");

			i8271->ID_N = 0;
			i8271->Counter = 1;
			i8271->ID_R = i8271->CommandParameters[1];


			LOG(("Sector Count: %02x\n", i8271->Counter));
			LOG(("Track: %02x\n",i8271->CommandParameters[0]));
			LOG(("Sector: %02x\n", i8271->CommandParameters[1]));
			LOG(("Sector Length: %02x bytes\n", 1<<(i8271->ID_N+7)));
			i8271_get_drive(device);

            i8271->drive_control_output &=~1;

			if (!floppy_drive_get_flag_state(img, FLOPPY_DRIVE_READY))
			{
				/* Completion type: operation intervention probably required for recovery */
				/* Completion code: Drive not ready */
				i8271->ResultRegister = (2<<3);
				i8271_timed_command_complete(device);
			}
			else
			{
				if (floppy_wpt_r(img) == CLEAR_LINE)
				{
					/* Completion type: operation intervention probably required for recovery */
					/* Completion code: Drive write protected */
					i8271->ResultRegister = (2<<3) | (1<<1);
					i8271_timed_command_complete(device);
				}
				else
				{

                    i8271->drive_control_output |=1;

					i8271_seek_to_track(device,i8271->CommandParameters[0]);

					i8271_do_write(device);
				}
			}

		}
		break;


		case I8271_COMMAND_READ_ID:
		{
			FDC_LOG_COMMAND("READ ID");

			LOG(("Track: %02x\n",i8271->CommandParameters[0]));
			LOG(("ID Field Count: %02x\n", i8271->CommandParameters[2]));

			i8271_get_drive(device);

			if (!floppy_drive_get_flag_state(img, FLOPPY_DRIVE_READY))
			{
				/* Completion type: operation intervention probably required for recovery */
				/* Completion code: Drive not ready */
				i8271->ResultRegister = (2<<3);
				i8271_timed_command_complete(device);
			}
			else
			{

				i8271->Counter = i8271->CommandParameters[2];

				i8271_seek_to_track(device,i8271->CommandParameters[0]);

				i8271_do_read_id(device);
			}
		}
		break;

		default:
			LOG(("ERROR Unrecognised Command\n"));
			break;
	}
}
예제 #10
0
파일: i8271.c 프로젝트: poliva/mame-rr
static void i8271_command_continue(device_t *device)
{
	i8271_t *i8271 = get_safe_token(device);
	switch (i8271->Command)
	{
		case I8271_COMMAND_READ_DATA_MULTI_RECORD:
		case I8271_COMMAND_READ_DATA_SINGLE_RECORD:
		{
			/* completed all sectors? */
			i8271->Counter--;
			/* increment sector id */
			i8271->ID_R++;

			/* end command? */
			if (i8271->Counter==0)
			{

				i8271_timed_command_complete(device);
				return;
			}

			i8271_do_read(device);
		}
		break;

		case I8271_COMMAND_WRITE_DATA_MULTI_RECORD:
		case I8271_COMMAND_WRITE_DATA_SINGLE_RECORD:
		{
			/* put the buffer to the sector */
			floppy_drive_write_sector_data(current_image(device), i8271->side, i8271->data_id, i8271->pExecutionPhaseData, 1<<(i8271->ID_N+7),0);

			/* completed all sectors? */
			i8271->Counter--;
			/* increment sector id */
			i8271->ID_R++;

			/* end command? */
			if (i8271->Counter==0)
			{

				i8271_timed_command_complete(device);
				return;
			}

			i8271_do_write(device);
		}
		break;

		case I8271_COMMAND_READ_ID:
		{
			i8271->Counter--;

			if (i8271->Counter==0)
			{
				i8271_timed_command_complete(device);
				return;
			}

			i8271_do_read_id(device);
		}
		break;

		default:
			break;
	}
}