0 Members and 1 Guest are viewing this topic.

* In addin.ld change "rom : o = 0x00300200" by "rom : o = 0x00300000"

Great! I can't really check this out now, since I don't have a Prizm yet... But it certainly does look nice. Is this mostly for assembly, or is it for C?Quote from: Kristaba on February 15, 2011, 08:43:56 am* In addin.ld change "rom : o = 0x00300200" by "rom : o = 0x00300000"Shouldn't this be 0x00307000 on the Prizm?

I totally like the display routine!

static unsigned int lastrandom=0x12345678;unsigned short random( int seed = 0 ){ if (seed) lastrandom=seed; lastrandom = ( 0x41C64E6D*lastrandom ) + 0x3039; return ( lastrandom >> 16 );}#define NSHAPES 100//int MoveOne( TBdispFillArea a[], TShapeProps sp[], int idx ){int vy1, vy2, j, k;int xoverlap, yoverlap, overlap;int xd, yd; a[idx].x1 += sp[idx].dx; if ( a[idx].x1 >= 384 - sp[idx].wx){ sp[idx].dx = -sp[idx].dx; a[idx].x1 += sp[idx].dx; sp[idx].dx = -1; // cold wall return 0; } if ( a[idx].x1 <= 1){ sp[idx].dx = -sp[idx].dx; a[idx].x1 += sp[idx].dx; sp[idx].dx = 3; // hot wall return 0; } for (j=0;j<NSHAPES;j++){ overlap = 0; if ( j != idx ){ xd = a[idx].x1 - a[j].x1; yd = a[idx].y1 - a[j].y1; if ( xd * xd + yd * yd < 100 ) overlap = 1; if ( overlap ) break; } } if ( overlap ){ sp[idx].dx = -sp[idx].dx; a[idx].x1 += sp[idx].dx; k = sp[idx].dx; sp[idx].dx = sp[j].dx; sp[j].dx = -k; return 0; } a[idx].y1 += sp[idx].dy; if ( a[idx].y1 >= 216 - sp[idx].wy){ sp[idx].dy = -sp[idx].dy; a[idx].y1 += sp[idx].dy; return 0; } if ( a[idx].y1 <= 1){ sp[idx].dy = -sp[idx].dy; a[idx].y1 += sp[idx].dy; return 0; } for (j=0;j<NSHAPES;j++){ overlap = 0; if ( j != idx ){ xd = a[idx].x1 - a[j].x1; yd = a[idx].y1 - a[j].y1; if ( xd * xd + yd * yd < 100 ) overlap = 1; if ( overlap ) break; } } if ( overlap ){ sp[idx].dy = -sp[idx].dy; a[idx].y1 += sp[idx].dy; k = sp[idx].dy; sp[idx].dy = sp[j].dy; sp[j].dy = -k; return 0; } k = 0; if (sp[idx].dy<0) k -= sp[idx].dy; else k += sp[idx].dy; if (sp[idx].dx<0) k -= sp[idx].dx; else k += sp[idx].dx; switch (k){ case 2 : sp[idx].color = 0x001F ; break; case 3 : sp[idx].color = 0x03FF ; break; case 4 : sp[idx].color = 0x07E0 ; break; case 5 : sp[idx].color = 0xFFC0 ; break; case 6 : sp[idx].color = 0xF800 ; break; } a[idx].mode = 0; Bdisp_AreaClr( &sp[idx].saved, 1, -1 ); a[idx].mode = 1; a[idx].x2 = a[idx].x1 + sp[idx].wx; a[idx].y2 = a[idx].y1 + sp[idx].wy; Bdisp_AreaClr( &a[idx], 1, sp[idx].color ); memcpy( &sp[idx].saved, &a[idx], sizeof( TBdispFillArea ) );/* vy1 = a[idx].y1 - sp[idx].wy / 2; vy2 = a[idx].y2 + sp[idx].wy / 2; if ( vy1 < 0 ) vy1 = 0; if ( vy2 > 215 ) vy2 = 215; Bdisp_PutDisp_DD_stripe( vy1, vy2 );*/ return 1;}#define V 1void F7_Handler(){TBdispFillArea ar[NSHAPES];TShapeProps mp[NSHAPES];int ticks, i, iwork; ticks = RTC_GetTicks(); random( ticks ); while (!RTC_Elapsed_ms( ticks, 100 )); for ( i=0;i<NSHAPES;i++){ ar[i]. mode = 1; memset( &mp[i], 0, sizeof( TShapeProps ) ); mp[i].wx = 10; mp[i].wy = 10; ar[i].x1 = 11 * ((i >> 2)+1); mp[i].color = random(); ar[i].y1 = 10 + 11 * ( i & 0x3 ); iwork = random(); iwork = ( 3 * iwork ) / 0x10000 + 1; if ( random() & 0x8000 ) iwork = -iwork; mp[i].dx = iwork; iwork = random(); iwork = ( 3 * iwork ) / 0x10000 + 1; if ( random() & 0x8000 ) iwork = -iwork; mp[i].dy = iwork; ar[i].x2 = ar[i].x1 + mp[i].wx; ar[i].y2 = ar[i].y1 + mp[i].wy; } while ( !(*(unsigned short*)0xA44B0000) ){ for (i=0;i<NSHAPES;i++){ MoveOne( ar, mp, i ); } Bdisp_PutDisp_DD(); }}