Bona Fide OS Developer
View unanswered posts | View active topics It is currently Thu Mar 28, 2024 3:42 am



Post new topic Reply to topic  [ 4 posts ] 
 Brainfuck interpreter for my os does not work 
Author Message
Post 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};
}
}
}
}




Sat Feb 20, 2010 3:32 pm

Joined: Sat Jul 25, 2009 11:26 am
Posts: 81
Post Re: Brainfuck interpreter for my os does not work
And I once stepped in a nail... :roll:

Cheers,
Bogdan


Sun Feb 21, 2010 9:47 pm
Profile
Site Admin

Joined: Sat Jul 25, 2009 7:44 am
Posts: 274
Location: United Kingdom
Post Re: Brainfuck interpreter for my os does not work
lmao

_________________
Thank you for reading,

Kieran C G Foot


Mon Feb 22, 2010 1:31 am
Profile WWW

Joined: Wed Oct 14, 2009 9:39 am
Posts: 198
Location: United States
Post 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.

_________________
Charles Timko
push %esp ;Musings of a computer addict


Wed Apr 21, 2010 10:12 am
Profile WWW
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin and tweaked by the BF Team.