示例#1
0
文件: 6502dis.c 项目: james7780/jum52
// disassemble from address 1 to address 2
unsigned int disassemble(uint16 addr1, uint16 addr2)
{
	uint8 instr;
	int count, line;
    char string1[128];
    char string2[128];

	addr = addr1;

	count = (addr2 == 0) ? 24 : 0;
    line = 0;
    memory = memory5200;

    clrEmuScreen(0x00);
	while ((addr < addr2 || count > 0) && (addr < 0xFFFC)) {
		sprintf(msg, "%x: ", addr);
		printXY(msg, 0, line * 8, 11);

		instr = memory[addr];
		addr++;

        sprintf(string2, "  ");
		show_opcode(string1, instr);
		show_operand(string2, instr);
		sprintf(msg, "%s    %s", string1, string2);
		printXY(msg, 48, line * 8, 12);
		line++;
		if (count > 0)
			count--;
	}
	BlitBuffer(0, 240);

	return addr;
}
示例#2
0
文件: 6502dis.c 项目: james7780/jum52
void hexview(uint16 viewaddr) {
     int i, count;
     count = 0;
     memory = memory5200;
     clrEmuScreen(0x00);
     for(i=viewaddr; i < viewaddr + 160; i++) {
         if((count % 8) == 0) {
			 sprintf(msg, "%4X: ", i);
			 printXY(msg, 0, (count / 8) * 8, 14);
		 }
		 sprintf(msg, "%02X", memory[i]);
         printXY(msg, 48 + 32 * (count % 8), (count / 8) * 8, 14);
         count++;
     }
	 printXY("Press any key to continue...", 0, 230, 15);
	 BlitBuffer(0, 240);
}
示例#3
0
文件: 6502dis.c 项目: james7780/jum52
//List interrupt vectors
void listvectors(void) {
/*                      Page Two Vectors
$200 Immediate IRQ vector
$202 Immediate VBI vector
$204 Deferred VBI vector
$206 DLI vector
$208 Keyboard IRQ vector
$20A Keypad routine continuation vector
$20C BREAK key IRQ vector
$20E BRK instruction IRQ vector
$210 Serial Input Data Ready IRQ vector
$212 Serial Output Data Needed IRQ vector
$214 Serial Output Finished IRQ vector
$216 POKEY Timer 1 IRQ vector
$218 POKEY Timer 2 IRQ vector
$21A POKEY Timer 4 IRQ vector
*/
	memory = memory5200;
	clrEmuScreen(0x00);
	printXY("Page Two IRQ Vectors:", 8, 0, 15);
	sprintf(msg, "$200 Imm IRQ: %02X%02X", memory[0x201], memory[0x200]);
	printXY(msg, 8, 16, 15);
	sprintf(msg, "$202 Imm VBI: %02X%02X", memory[0x203], memory[0x202]);
	printXY(msg, 8, 24, 15);
	sprintf(msg, "$204 Def VBI: %02X%02X", memory[0x205], memory[0x204]);
	printXY(msg, 8, 32, 15);
	sprintf(msg, "$206 DLI Vec: %02X%02X", memory[0x207], memory[0x206]);
	printXY(msg, 8, 40, 15);
	sprintf(msg, "$208 Key IRQ:  %02X%02X", memory[0x209], memory[0x208]);
	printXY(msg, 8, 48, 15);
	sprintf(msg, "$20A Key cont: %02X%02X", memory[0x20B], memory[0x20A]);
	printXY(msg, 8, 56, 15);
	sprintf(msg, "$20C BREAK Key IRQ: %02X%02X", memory[0x20D], memory[0x20C]);
	printXY(msg, 8, 64, 15);
	sprintf(msg, "$20E BRK instr IRQ: %02X%02X", memory[0x20F], memory[0x20E]);
	printXY(msg, 8, 72, 15);
	//textprintf(buffer, font, 8, 80, 15, "$210 Ser Inp Data Rdy: %02X%02X", memory[0x211], memory[0x210]);
	//textprintf(buffer, font, 8, 88, 15, "$212 Ser Out Data Req: %02X%02X", memory[0x213], memory[0x212]);
	//textprintf(buffer, font, 8, 96, 15, "$214 Ser Out Complete: %02X%02X", memory[0x215], memory[0x214]);
	//textprintf(buffer, font, 8, 104, 15, "$216 Pokey T1: %02X%02X", memory[0x217], memory[0x216]);
	//textprintf(buffer, font, 8, 112, 15, "$218 Pokey T2: %02X%02X", memory[0x219], memory[0x218]);
	//textprintf(buffer, font, 8, 120, 15, "$21A Pokey T3: %02X%02X", memory[0x21B], memory[0x21A]);
	printXY("Press any key to continue...", 0, 230, 15);
	BlitBuffer(0, 240);
}
示例#4
0
文件: 6502dis.c 项目: james7780/jum52
void printhelp(void) {
	clrEmuScreen(0x00);
	printXY("AVAILABLE COMMANDS:", 0, 0, 13);
	printXY("<Enter>     Disassemble at current address.", 16, 8, 13);
	printXY("s           Step thru current instruction.", 16, 16, 13);
	printXY("S           Step thru current scanline.", 16, 24, 13);
	printXY("f           run till next frame / VBI", 16, 32, 13);
	printXY("r           Run / Resume", 16, 40, 13);
	printXY("D <addr>    disassemble address <addr>", 16, 48, 13);
	printXY("v           View hexdump at current address", 16, 56, 13);
	printXY("V <addr>    View hexdump at address <addr>", 16, 64, 13);
	printXY("l           View display list data", 16, 72, 13);
	printXY("c           View character set", 16, 80, 13);
	printXY("p           View player/missile data", 16, 88, 13);
	printXY("1           Show collision registers", 16, 96, 13);
	printXY("i           List interrupt vectors", 16, 104, 13);
	printXY("T <addr>    run to <addr>", 16, 112, 13);
	printXY("K           trigger Keyboard interrupt", 16, 120, 13);
	printXY("B           trigger Break interrupt", 16, 128, 13);
	printXY("0           Set TRIG0 to 0", 16, 136, 13);
	printXY("Q or quit   Quit / Exit", 16, 144, 13);
	printXY("Press any key to continue...", 0, 230, 15);
	BlitBuffer(0, 240);
}
示例#5
0
// Initializes the output module, allocating neccessary buffers and such.
void OutputModInit()
{
    // If VGA or VBE is present, then, prepare for it.
    if(BIT.Video.VideoFlags & GRAPHICAL_USED)
    {
        BMPHeader_t *BMPHeader = (BMPHeader_t*)BIT.Video.BackgroundImg.Location;
        
        // We draw in 24BPP.
        // Allocate a extra line as the temperrorline.
        uint32_t NoPages = (BIT.Video.XRes * (BIT.Video.YRes + 1) * 24)/8;
        NoPages = (NoPages + 0xFFF)/0x1000;
        
        // If we can't allocate space for the "draw board", then gracefully return...
        // ...to text mode :P
        DrawBoard = (uint32_t*)PMMAllocContigFrames(POOL_STACK, NoPages);
        
        // We only need a temporary buffer in 8bpp mode. 
        if(BIT.Video.BPP == 8)
        {
			// 8BPP for the temporary buffer.
            NoPages = BIT.Video.XRes * BIT.Video.YRes;
            NoPages = (NoPages + 0xFFF)/0x1000;
            TempBuffer = (uint32_t*)PMMAllocContigFrames(POOL_STACK, NoPages);
        }
        
        if(!DrawBoard || (!TempBuffer && (BIT.Video.BPP == 8)))
        {
            // Free the image buffer.
            // TODO: Implement this.
            //PMMFreeContigFrames(BIT.Video.BackgroundImg, (BIT.Video.BackgroundImg.Size + 0xFFF)/0x1000);
            
            // TODO: Implement this.
            // Revert back to a usable text mode.
            //BIT.Video.Revert();                                                                                             
            return;
        }
                
        // Go to the last line for the temporary error line.
        TempErrorLine = (uint8_t*)DrawBoard + (BIT.Video.XRes * BIT.Video.YRes * 3);
        
        NoPages = (BIT.Video.XRes * BIT.Video.YRes * BIT.Video.BPP)/8;
        if(BIT.Video.BPP == 15)
            NoPages += (BIT.Video.XRes * BIT.Video.YRes)/8;
        
        NoPages = (NoPages + 0xFFF)/0x1000;
        // If the call fails, then other blitting code realizes it, and directly blits.
        OldBuffer = (uint32_t*)PMMAllocContigFrames(POOL_STACK, NoPages);
        if(OldBuffer)
        {
            memset(OldBuffer, 0, NoPages * 0x1000);
        }
        
        // If we haven't opened the background image file, return.
        if(!BIT.Video.BackgroundImg.Size)
            return;
            
        // Resize the image to the scaled buffer.
        ResizeBilinear((uint8_t*)BIT.Video.BackgroundImg.Location + BMPHeader->Offset,
                       (uint8_t*)DrawBoard, BMPHeader->XSize, BMPHeader->YSize,
                       BIT.Video.XRes, BIT.Video.YRes);
        
        //TODO: Implement this.
        //PMMFreeContigFrames(BIT.Video.BackgroundImg.Location, (BIT.Video.BackgroundImg.Size + 0xFFF)/0x1000);
               
        // Blit the background image.
        BlitBuffer(DrawBoard);
    }
} 
示例#6
0
main(int argc,char *argv[])
{
	CoolImage *image;
	int x,y;
	int i,j;
	PtWidget_t *win;
	PtArg_t args[3];
	PhDim_t dim={m_W,m_H};
	PhPoint_t pos={50,250};
	int fd; //Bt878 driver file descriptor
	int fd_temp;
	int size_read;
	struct timeval tv;
    fd_set rfd;
    int n;
	int error;
	int counter = 0;
	int counter_mean = 0;
	int file = 0;


	//Timing calculation
    uint64_t cps, cycle1, cycle2, ncycles;
    float sec;
    float msec;

	// if a paramater was passed, grab it as the blit type 
	if (argc>1) blittype=atoi(argv[1]);

	// initialize our connection to Photon, and create/realize a window 
	//PtInit("/net/irene2/dev/photon");
	PtInit("/dev/photon");
	PtSetArg(&args[0],Pt_ARG_POS,&pos,0);
	PtSetArg(&args[1],Pt_ARG_DIM,&dim,0);
	win=PtCreateWidget(PtWindow,Pt_NO_PARENT,2,args);
	PtRealizeWidget(win);

	// Allocate and fill a series of NUMIMAGES images with a little 
	// fading type animation.  Put your own animation in here if you like.


	/*
     *    Set a 5 second timeout.
     */
    tv.tv_sec = 5;
    tv.tv_usec = 0;

	image = AllocBuffer(m_W,m_H,fd);	
	assert(image!=0);
	
	if (file != 2)
	{
	init_bttvx(2,0, m_W,m_H,0,0);
	open_bttvx();
	
	BttvxSetImageBuffer(0, image->buffer);
	}
	fd_temp = fd;
	FD_ZERO( &rfd );
	FD_SET( fd, &rfd );
	
	
	while(1)
	{
		//fd = open("/net/europa/dev/bttvx0",O_RDWR);
		//if ( fd > 0 )
		//{
			
			///switch ( n = select( 1 + max( fd,0 ),
			///   &rfd, 0, 0, &tv ) ) 
			///{
			///  case -1:
			///	perror( "select" );
			///	return EXIT_FAILURE;
			///  case  0:
			///	puts( "select timed out" );
			///	break;
			///  default:
				//printf( "descriptor ready ...\n");
				//if( FD_ISSET( console, &rfd ) )
				//  puts( " -- console descriptor has data pending" );
				//if( FD_ISSET( serial, &rfd ) )
				//  puts( " -- serial descriptor has data pending" );
				/* Read the text */

				cycle1=ClockCycles( );

				//lseek(fd,0L,SEEK_SET);
			///	size_read = read( fd, image->buffer, W*H*deep );
		   if (file != 2)
		   {
		   BttvxWaitEvent();
		   BttvxAcquireBuffer(image->buffer);	
		    }
		   
		   switch(file)
		   {
		   	case 0:
		   		BlitBuffer(win,image);
		   		break;
		   	case 1:
		   		SaveImage(counter,image);
		   		break;
		   	case 2:
		   		
		   		LoadImage(counter,image);
		   		BlitBuffer(win,image);
		   		getchar();
		   		break;
		   };
		   
		   if (file!=2)
		   	BttvxReleaseBuffer();
		   cycle2=ClockCycles( );
		   counter++;
		   counter_mean++;

		   
		   ncycles=cycle2-cycle1;
		   //printf("%lld cycles elapsed \n", ncycles);

		   /* find out how many cycles per second */
		
		   cps = SYSPAGE_ENTRY(qtime)->cycles_per_sec;
		   //printf( "This system has %lld cycles/sec.\n",cps );
		   sec=(float)ncycles/cps;
		   msec +=sec;
		   if (counter_mean == 250 )
		   {
		   	msec = msec/counter_mean;
		   	printf("The cycles in seconds is %f \n",msec);
		   	counter_mean = 0;
		   	msec = 0;
		   }
		//}else
			//sleep(2);
		}

	//printf("Blitted %d frames using method %d\n",REPS*NUMIMAGES,blittype);

	// now free the images
	FreeBuffer(image);
	close( fd );
	/// hide the window and destroy it.
	PtUnrealizeWidget(win);
	PtDestroyWidget(win);
}