Bona Fide OS Development
http://forums.osdever.net/

Brainfuck interpreter for my os does not work
http://forums.osdever.net/viewtopic.php?f=6&t=185
Page 1 of 1

Author:  smeezekitty [ Sat Feb 20, 2010 3:32 pm ]
Post subject:  Brainfuck interpreter for my os does not work

I wrote a brainfuck interpreter for my OS and it does not do anything it all (just returns to shell):
Code:
#include <CRUN.C>
int feof(){
_SI = 10;
_AX = 0;
asm {int 0x32};
return _CH;
}
void main(){
static unsigned char ticker[145];
static int p;
static unsigned char get[3];
_ES = FP_SEG("");
_DI = FP_OFF("test.bf");
_SI = 7;
asm {int 0x32};
while(!feof()){
_SI = 9;
_ES = FP_SEG(get);
_DI = FP_OFF(get);
_CX = 0;
_DX = 1;
asm {int 0x32};
static int fp;
switch(get[0]){
case '>':
p++;
break;
case '<':
p--;
break;
case '+':
ticker[p]++;
break;
case '-':
ticker[p]--;
break;
case '.':
print(".");
_SI = 1;
_CX = ticker[p];
asm {int 0x32};
break;
case ',':
_SI = 0;
asm {int 0x32};
ticker[p]=_CH;
break;
case '[':
_SI = 12;
_AX = 0;
asm {int 0x32};
fp=_AX;
if(ticker[p] == 0){
static unsigned char k[3];
while(k[0] != ']') {
_SI = 9;
_ES = FP_SEG(k);
_DI = FP_OFF(k);
_CX = 0;
_DX = 1;
asm {int 0x32};
}
}
break;
case ']':
if(ticker[p]){
_SI = 11;
_AX = 0;
_CX = fp;
asm {int 0x32};
}
}
}
}



Author:  Love4Boobies [ Sun Feb 21, 2010 9:47 pm ]
Post subject:  Re: Brainfuck interpreter for my os does not work

And I once stepped in a nail... :roll:

Cheers,
Bogdan

Author:  Kieran [ Mon Feb 22, 2010 1:31 am ]
Post subject:  Re: Brainfuck interpreter for my os does not work

lmao

Author:  ctimko [ Wed Apr 21, 2010 10:12 am ]
Post subject:  Re: Brainfuck interpreter for my os does not work

Interesting to see someone actually attempt to make the interpreter. I was planning on making an OS written entirely in BF.

Page 1 of 1 All times are UTC - 6 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/