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};
}
}
}
}