static void Render() { SetupLinePointers(); RenderNextLineIfNeeded(); WaitVBlank(); CopListActivate(cp[active]); active ^= 1; }
__regargs void CopListActivate(CopListT *list) { /* Enable copper DMA */ custom->dmacon = DMAF_MASTER | DMAF_COPPER | DMAF_SETCLR; /* Write copper list address. */ custom->cop1lc = (ULONG)list->entry; /* Wait for vertical blank to make sure the list is active. */ WaitVBlank(); }
__regargs void CopListActivate(CopListT *list) { WaitVBlank(); /* Write copper list address. */ custom->cop1lc = (ULONG)list->entry; /* Activate it immediately */ custom->copjmp1 = 0; /* Enable copper DMA */ custom->dmacon = DMAF_MASTER | DMAF_COPPER | DMAF_SETCLR; }
static void Render() { BitmapClearArea(screen[active], STRUCT(Area2D, 0, 0, MAX_W * 2 + SIZE, MAX_H * 2 + SIZE)); DrawPlotter(); WaitVBlank(); ITER(i, 0, DEPTH - 1, CopInsSet32(bplptr[i], screen[active]->planes[i])); active ^= 1; }
/** * control LEDC digital block */ void LedBackLight(BYTE on) { WaitVBlank(1); WriteTW88Page(PAGE0_LEDC); if (on) WriteTW88(REG0E0, ReadTW88(REG0E0 ) | 1 ); else WriteTW88(REG0E0, ReadTW88(REG0E0 ) & ~0x01 ); }
static void Render() { // LONG lines = ReadLineCounter(); SetupLines(frameCount * 16); SetupTexture(colors[active], frameCount); // Log("twister: %ld\n", ReadLineCounter() - lines); WaitVBlank(); CopListActivate(cp[active]); active ^= 1; }
static void Render() { // LONG lines = ReadLineCounter(); ClearCliparts(); DrawCliparts(); // Log("neons: %ld\n", ReadLineCounter() - lines); WaitVBlank(); ITER(i, 0, DEPTH - 1, CopInsSet32(bplptr[i], screen[active]->planes[i])); active ^= 1; }
/** * turn on DCDC * * DCDC startup step * SSPLL ON * FP PWC ON * call DCDC_on(0) & DCDC_on(1) * delay * wait VBlank * Enable FP Data Out * delay * call DCDC_on(2) * FP Bias On * * DCDC data out needs more then 200ms delay after SSPLL_PowerUp(ON). */ BYTE DCDC_StartUP_sub(void) { BYTE ret; //------------- //FPPWC ON FP_PWC_OnOff(ON); //ret=DCDC_On(0); //ret=DCDC_On(1); //------------- // wait #ifdef TW8835_EVB_10 delay1ms(100); #endif WaitVBlank(1); //------------- //FP Data Out OutputEnablePin(ON,ON); //Output enable. FP data: enable #ifdef TW8835_EVB_10 delay1ms(15); #endif //DCDC final //ret=DCDC_On(2); ret=ERR_SUCCESS; //------------- //FPBIAS ON FP_BiasOnOff(ON); //disable Blank //WriteTW88Page(PAGE2_SCALER); //WriteTW88(REG21E, ReadTW88(REG21E) & ~0x01); // PrintSystemClockMsg("DCDC_StartUp END"); if(ret!=ERR_SUCCESS) { Puts(" FAIL"); //WriteTW88Page(PAGE0_DCDC); //WriteTW88(REG0E8, 0xF2); Printf("\nREG0E8:F2[%bd]",ReadTW88(REG0EA)>>4); //WriteTW88(REG0E8, 0x02); Printf("\nREG0E8:02[%bd]",ReadTW88(REG0EA)>>4); //WriteTW88(REG0E8, 0x03); Printf("\nREG0E8:03[%bd]",ReadTW88(REG0EA)>>4); //WriteTW88(REG0E8, 0x01); Printf("\nREG0E8:01[%bd]",ReadTW88(REG0EA)>>4); //WriteTW88(REG0E8, 0x11); Printf("\nREG0E8:11[%bd]",ReadTW88(REG0EA)>>4); //WriteTW88(REG0E8, 0x71); Printf("\nREG0E8:71[%bd]",ReadTW88(REG0EA)>>4); } return ret; }
/* the main function */ int main( ) { int x = 0, y = 0; /* we set the mode to mode 0 with background 0 turned on*/ *REG_DISPCNT = MODE_0 | BG0_ENABLE; /* set up background 0 */ REG_BG0_PTR = BG_COLOR256 | TEXTBG_SIZE_256x256 | (31 << SCREEN_SHIFT) | WRAPAROUND; /* load the palette into background palette memory */ dma_memcpy((void*) test_palette, (void*) BG_PALETTE_MEMORY, 256, DMA_32_NOW); /* load the tile image into tile memory */ dma_memcpy((void*) test_data, (void*) CharBaseBlock(0), (test_width * test_height), DMA_16_NOW); /* copy the tile map itself into memory */ unsigned short* bg0map =(unsigned short*)ScreenBaseBlock(31); dma_memcpy((void*)testmap, (void*)bg0map, 1024, DMA_32_NOW); /* we now loop forever displaying the image */ while (1) { //D-pad moves background if(!(BUTTONS & BUTTON_LEFT)) x--; if(!(BUTTONS & BUTTON_RIGHT)) x++; if(!(BUTTONS & BUTTON_UP)) y--; if(!(BUTTONS & BUTTON_DOWN)) y++; // //wait for vertical refresh WaitVBlank(); //use hardware background scrolling REG_BG0VOFS = y ; REG_BG0HOFS = x ; int n; for(n = 0; n < 4000; n++); } }
static void Render() { // LONG lines = ReadLineCounter(); { BlitterClear(screen, active); DrawSpans(screen->planes[active]); BlitterFill(screen, active); } // Log("anim: %ld\n", ReadLineCounter() - lines); WaitVBlank(); { WORD n = DEPTH; while (--n >= 0) { WORD i = (active + n + 1 - DEPTH) % (DEPTH + 1); if (i < 0) i += DEPTH + 1; CopInsSet32(bplptr[n], screen->planes[i]); } } active = (active + 1) % (DEPTH + 1); }
static void Render() { WaitLine(Y(256)); MoveSprite(); WaitVBlank(); }
/** * description * draw image */ void MonOsdImgLoad(BYTE img_n, BYTE sosd_win, WORD item_lut) { struct image_item_info_s *image; menu_image_header_t *header = &header_table; //link header buffer. // BYTE i; WORD sx,sy; Printf("\nMonOsdImgLoad(%bd,%bd,%d)",img_n,sosd_win,item_lut); #if 0 UseSOsdHwBuff=1; #endif sx=sy=0; // SOsd_CleanReg(); image = MonSOsdImgTable[img_n].image; //prepare header MenuPrepareImageHeader(image); //see MenuDrawCurrImage //fill out sosd_buff SOsd_SetSpiStartOffset( sosd_win, header->image_loc); SOsd_SetImageWidthHeight( sosd_win, header->dx, header->dy ); SOsd_SetScreen( sosd_win, sx, sy, header->dx, header->dy ); if(sosd_win==0) { SOsd_SetWin0ImageOffsetXY( 0, 0 ); SOsd_SetWin0Animation( 1, 0, 0, 0); } if(image->alpha != 0xFF) SOsd_SetPixelAlpha( sosd_win, ON ); else { SOsd_SetGlobalAlpha( sosd_win, 0 /*EE_Read(EEP_OSD_TRANSPARENCY)*/); } SOsd_SetPixelWidth(sosd_win, header->bpp); SOsd_SetLutOffset(sosd_win, item_lut); SOsd_Enable( sosd_win, ON ); // //write to HW // if(UseSOsdHwBuff) { if(header->rle) SOsd_SetRlc(sosd_win,header->bpp,header->rle); SOsd_SetLut(sosd_win, header->lut_type, item_lut, header->lut_size, header->lut_loc, image->alpha); //pixel alpha blending. after load Palette //if(image->alpha != 0xFF) // //SOsdHwBuffSetAlpha(sosd_win, item_lut+image->alpha); // SOsd_SetPixelAlphaIndex(sosd_win,image->alpha); SOsd_UpdateReg(sosd_win, sosd_win); //SOsd_show(); UseSOsdHwBuff = 0; #if 1 //void SOsd_UpdateLut(BYTE win, BYTE fAlpha); //void SOsd_UpdatePixelAlpha(BYTE win); SOsd_UpdatePixelAlpha(sosd_win); #else //update ALPHA // if(SOsdHwBuff_alpha_A != 0xFFFF) { // WriteTW88(REG410, 0xc3 ); // LUT Write Mode, En & byte ptr inc. // // if(SOsdHwBuff_alpha_A >> 8) WriteTW88(REG410, ReadTW88(REG410) | 0x08); //support 512 palette // else WriteTW88(REG410, ReadTW88(REG410) & 0xF7); // WriteTW88(REG411, (BYTE)SOsdHwBuff_alpha_A ); // alpha index // WriteTW88(REG412, 0x7F/*value*/ ); // alpha value // // SOsdHwBuff_alpha_A = 0xFFFF; // } // if(SOsdHwBuff_alpha_B != 0xFFFF) { // WriteTW88(REG410, 0xc3 | 0x04); // LUT Write Mode, En & byte ptr inc. // // WriteTW88(REG410, ReadTW88(REG410) & 0xF7); // WriteTW88(REG411, (BYTE)SOsdHwBuff_alpha_B ); // alpha index // WriteTW88(REG412, 0x7F/*value*/ ); // alpha value // // SOsdHwBuff_alpha_B = 0xFFFF; // } #endif } //else { //WaitVBlank(1); if(header->rle) { //need RLE ? SOsd_SetRlc( sosd_win, header->bpp,header->rle); SOsd_UpdateRlc(); } else { //We using RLE only on the background. //if(item == 0) { // SpiOsdDisableRlcReg(??winno) // SpiOsdRlcReg( 0,0,0); //BK110217 //} } WaitVBlank(1); //Load Palette //SpiOsdLoadLUT(header->lut_type, menu_item->lut, header->lut_size, header->lut_loc, image->alpha); //SpiOsdLoadLUT(sosd_win, header->lut_type, item_lut, header->lut_size, header->lut_loc, image->alpha); SOsd_SetLut(sosd_win, header->lut_type, item_lut, header->lut_size, header->lut_loc, image->alpha); SOsd_UpdateLut(sosd_win, 1); //WaitVBlank(1); //update HW SOsd_UpdateReg(sosd_win, sosd_win); } }