public static ReadHandlerPtr neo_control_r = new ReadHandlerPtr() { public int handler(int offset)
	{
		int line,irq_bit;
	
		/*
			The format of this very important location is:  AAAA AAAA B??? CDDD
	
			A is most likely the video beam line, however from how it is used it
			  doesn't seem to be a 0-255 direct map: the top bit is often masked out.
			  I think the top bit of A is: (vblank OR irq2). sdodgeb loops waiting for
			  it to be 1; zedblade heavily depends on it to work correctly.
			B is used together with A in one place, so most likely video beam position
			  Maybe AAAAAAAAB is a 9-bit video line counter.
			  It is tested individually in many cases (e.g. samsho3) so it might not be
			  the low bit of the raster line.
			C is definitely a PAL/NTSC flag. Evidence:
			  1) trally changes the position of the speed indicator depending on
				 it (0 = lower 1 = higher).
			  2) samsho3 sets a variable to 60 when the bit is 0 and 50 when it's 1.
				 This is obviously the video refresh rate in Hz.
			  3) samsho3 sets another variable to 256 or 307. This could be the total
				 screen height (including vblank), or close to that.
			  Some game (e.g. lstbld2, samsho3) do this (or similar):
			  bclr    #$0, $3c000e.l
			  when the bit is set, so 3c000e (whose function is unknown) has to be
			  related
			D is unknown (counter of some kind, used in a couple of places).
			  in blazstar, this controls the background speed in level 2.
		*/
	//if (errorlog) fprintf(errorlog,"PC %06x: neo_control_r\n",cpu_get_pc());
	
		line = RASTER_LINES - cpu_getiloops();
		irq_bit = ((irq2enable!=0 && (line == irq2start || line == lastirq2line + irq2repeat)) ||
			(line == RASTER_LINES))?1:0;
	
		return  ((cpu_getscanline() * 0x80) & 0x7f80)	/* scanline */
				| (irq_bit << 15)						/* vblank or irq2 */
				| (neogeo_frame_counter & 0x0007);		/* frame counter */
	
	} }