Many thanks to Quadrescence for co-authoring this project with me. Bored of BASIC? Confused by ASM? Sick of C? Now you too can develop on the Megadrive/Genesis with the easy to learn brainfuck language! Released under the WTFPL, Megafuck provides you with an interpreter with full support for all 8 (yes, 8!) brainfuck commands. Download Code (Text): /* AUTH: Kirjava and Quadrescence * DATE: 11 Aug 2009 * DESC: Fuck your brain, MD style! * * Licensed under the WTFPL Version 2, which proceeds. * DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE * Version 2, December 2004 * * Copyright (C) 2009 Kirjava and Quadrescence * Everyone is permitted to copy and distribute verbatim or modified * copies of this license document, and changing it is allowed as long * as the name is changed. * * DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE * TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION * * 0. You just DO WHAT THE FUCK YOU WANT TO. */ #include "genesis.h" #define charstr(_c) (buf[0]=(_c),buf) #define in_ch(_p) (*(_p)=getChar()) #define out_ch(_p) ((*(_p)!='\n')?(VDP_drawText(APLAN, charstr(*(_p)), 0x8000, \ xcord=xcord%38+1, 3+(ycord=(ycord+xcord/38)%23)),0) \ :(VDP_drawText(APLAN, charstr(*(_p)), 0x8000, \ xcord=0, 3+(ycord++)%23),0)) #define MAX_MEM 8192 #define GRID_SIZE 2000 #define push(_x) (*++stack=(_x)) #define pop() (--stack,r) #define peek() (*stack) #define fall() depth++ #define rise() depth-- #define q *p #define fucks VDP_fillTileRect #define fuckz VDP_setTileRect #define FUUUCK VDP_drawText #define shits TILE_FONTINDEX char buf[2]={'\','\'}; int xcord=0,ycord=0; int interp(const char *str); static void joyEvent( u16 joy, u16 changed, u16 state);void drawChar (const char *str, u16 x, u16 y);char getChar();int x=0,y=0, c=0, co_x=0, status=0; int codez [GRID_SIZE ];char get_ch[1] ;int main() {char* cmdz = " +-[]><.," ;char str [GRID_SIZE ];int I=0; JOY_setEventHandler( joyEvent); VDP_drawText (APLAN, "Megafuck" ,0x8000 ,1,1);while(1) {wait(50);drawChar (&cmdz[c], /*by:K+*/co_x+1, y+3);if (status) break;}if( codez[0]==9){ FUUUCK /*Q*/(APLAN, "Needs " "moar " "input", 0x8000, 1, 3); return 0; }fucks (APLAN, 0, 1, 3, 38, 25) ;while (codez[I] !=9){ switch (codez[I]) {case 1: str[I] =43;break ;case 2: str[I] =45;break; case 3: str[I] =91;break ;case 4: str[I] =93;break; case 5: str[I] =62;break ;case 6: str[I] =60;break; case 7: str[I] =46;break ;case 8: str[I] =44;break; case 0: str[I] =32;break ;}I++;} str[I] ='\';interp (str); return 0;}char getChar (){for (status=2; status ==2;) wait(50) ;fucks( APLAN, 0,1,2,38,1); return get_ch [0];}void drawChar (const char *str,u16 x, u16 y){u16 data[1]; data[0]= shits+ (str[0] - 32); fuckz( APLAN, data, 0x8000, x,y,1, 1);}int interp (const char *str){ char mem [MAX_MEM ],*nest[99],*r =mem,q =mem+ MAX_MEM/ 2,**stack = nest, depth =0,ch; strcpy (r,str) ;for(;(ch =*r); r++ ){ch-']' ||(depth>1|| (r=q?peek ():pop ()),!depth || rise()) , ch-'[' ||fall()|| push(r), depth|| (q += ( ch=='+'),q -= (ch== '-'),p +=(ch =='>'),p/*omgwtf is*/ -= (ch==/*going on?*/'<')),ch- '.'||out_ch (p),ch-',' || in_ch(p);} return 0;}static void joyEvent(u16 joy, u16 changed, u16 state) {int I=0; if(!status){if ( changed & state & BUTTON_START){codez[x]=c;while (codez[x] !=0){x++; }codez[x] = 9; status=1;} else if ( changed & state & BUTTON_UP){ if(c>=8) c=1;else c++;}else if(changed & state & BUTTON_DOWN) {if(c<=1) c=8;else c--;}else if (changed &state & BUTTON_RIGHT){if (c!=0) {codez[x] = c;c=codez [x+1];x++;}}else if(changed & state & BUTTON_LEFT ){if(x!=0){codez[x] =c;c =codez[x-1];x--;}}else if (changed & state & BUTTON_A) {if(x>=0 && c!=0 && codez[x+1]==0){c=0;}}co_x =x%38;I=x;y=0;while(I >=38){y++;I-=38;}}if (status==2){if(c<10) c = 32;if (changed&state&BUTTON_START) {status=1;} else if( changed & state & BUTTON_UP){if (c>=122)c =32;else c++ ;}else if(changed & state& BUTTON_DOWN){if(c<=32) c=122;else c--;}get_ch[0]=c;VDP_drawText (APLAN, "Select a character to use" " as input; ", 0x8000, 1, 2);VDP_drawText(APLAN,get_ch, 0x8000, 37, 2);}}
Hah, nice. Any chance you could also release more human-readable source code? And... I noticed this in your other topic as well. You're using Fusion 3.6 and not 3.61. :P http://www.eidolons-inn.net/tiki-read_arti...p?articleId=152
Am I the only one that thinks this sounds worse than a bad porno? LOL Also, I loved the Sega-ascii-art-source-code thing :3.