This is the first MD ROM I've written from scratch. It's a simple Sieve of Eratosthenes implemented in C. Download I've gotta say thanks to Stef for the great DevKit I used to make this. It's the first one I've come across that I've been actually able to compile shit with Have some source; Code (Text): #include "genesis.h" #include "x.h" const u16 pal_yellow[16] = { 0x0000, 0x0022, 0x0044, 0x0066, 0x0088, 0x00AA, 0x00CC, 0x00EE, 0x0EEE, 0x0EEE, 0x0EEE, 0x0EEE, 0x0EEE, 0x0EEE, 0x0EEE, 0x0EEE }; static void eratosthenes(); int main() { VDP_setPalette(0, pal_yellow); VDP_drawText(APLAN, "Sieve of Eratosthenes MD", 0x8000, 1, 1); VDP_drawText(APLAN, "by snkenjoi", 0x8000, 24, 25); setBitmapMode(BITMAP_WIDTH, BITMAP_HEIGHT); loadGenBmp16ToBitmap(x, 21, 10, 0x10); eratosthenes(); return 0; } void eratosthenes() { char str[255]; int I,k,j = 0; int arr[15999]; //15999 int max = (sizeof(arr)/sizeof(arr[0])); for (I = 0;I<max;I+=2) { arr[I] = 1; } VDP_drawText(APLAN, "2", 0x8000, 1, 2); for (k = 0;k<max;k++){ for (I = 0;I<max;I++) { if(arr[I] == 0) {arr[I] = 1; j = I;wait(5000);intToStr(I+2, str, 1);VDP_drawText(APLAN, str, 0x8000, 1, 2);break;} } for (I = j;I<max;I+=j+2) { arr[I] = 1; } if (j*j>max+2){break;} } for (I = 0;I<max;I++) { if(arr[I] == 0) {arr[I] = 1;wait(5000);intToStr(I+2, str, 1);VDP_drawText(APLAN, str, 0x8000, 1, 2);}; } } Maybe I'll make something useful next time
You're welcome (for linking you to the devkit on IRC). And this is interesting. Perhaps now the Genesis can be used for cryptography? :v: And shameless self-advertising, thanks to Doug McIllroy: http://plan9.bell-labs.com/sources/contrib/pietro/sieve.c. Put that on the Genesis :v:
A C devkit for Megadrive? Nice. Good work on the ROM, too =P Is it supposed to just count up to 15991 in the top left, though, or do a list like the wiki page?
C devkits have existed for a while now: SGCC and XGCC have been around for years. But this is the first to have a full programming API.
Moreover, there's a C devkit for MD from back to 1994. Not to mention that Sega also had its own C devkit (Sonic Spinball, anyone?).
Well, yes. But did the public have access to that? No =P I must admit I was unaware of those 2. But by the sound of it this one is better anyway
The one from 1994? Yes. Spinball was released on 1993 so that should make it obvious that it wasn't the one I was talking about :P
I wonder what C dev kit Megaman: The Wily Wars used. According to Protoman the game was coded in C(he gave up disassembling it for that reason) and was released in late 1994 for all regions.
Once Oerg was messing up with his Mega Drive hardware (overclocking I think) and he tried a game from 1995. The game threw out a "not enough memory available" error and was emitted by some kind of library made by Sega (I don't remember the exact message right now). So I guess Sega made a C library for the Mega Drive.