Omnimaga
Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: zero44 on December 23, 2012, 03:55:36 pm
-
Hey,
I made a parser and an emulator for BrainFuck language on calc.
Parser is not completed, so there are bugs : never use [][]
Feel free to send me bug reports / improvements ideas.
Enjoy
-
nice, i guess 9 is > and 8 is < ?
And is there , ?
-
My brainfuck interpreters all have a break function. When you have an infinite loop you simply press a key and you break from the program.
-
Yes, I made a break function too.
Interpreter is fully complete (?) and supports ',' command, but it's badly done :(
I forgot to say that I added the * func (exit program) to the brainfuck, so when you compile a program it's recognized by parser as "hey, stop me NOW !" ;)
But the input fonction doesn't work actually in the parser.
And I fixed parser's loop bug, but not uploaded it .__.
-
I started brainfuck madness >.<
lol
and it sounds cool, the interpreters/compilers
-
You know what would be interesting, a BrainFuck compiler that takes brainfuck code and converts it into Axe code. Then you would compile the generated Axe code for super speed!
-
Brain=fucked
Do it Builderboy. NOW
Wait
That isn't too hard
lol, because of pointers :D
-
Indeed, the wikipedia page even has a C equivalent to each of the symbols, and it's super easy haha.
-
bf compiler which compiles to axe source ? for speed ? too easy and slow ^^ I'll surely do it.
but I have a bf compiler which compiles directly to hexa asm :) that's epic ..
you mean for example ++++++++ is compiled to +1+1+1+1+1+1+1+1 or to +8 ?
-
it would output something like
first
get some free space and point it to P
and set N equal to 0
and then for +
it would be {A+N}++
for - {A+N}--
for >
N++
for <
N--
for , some input to store to {A+N}
for .
text({A+N}>Char
for []
while {A+N}
code
end
-
this is what I said, easy.
in asm :
> 2C increase L register
< 2D decrease L
+ 56257E or somthing like this : take byte from address pointed by HL, increases and replace it
- guess it
. 7EEF0445 takes it to A and disps A as a char
, nothing yet
[ 7ECA**** jumps after ] if pointing zero
] 7EC2**** jumps after [ if pointing non-zero
Easy, I said. :)
-
Yeah making a Brainfuck to Asm compiler would probably be much easier now that I think about it haha. The compiler could still be in Axe too! It just would have to do some annoying byte counting for the jumps.
-
How do you create executables using axe software?
-
...
I'm asking me if you understood ...
I created an on-calc compiler, written in Axe, which takes a BrainFuck source code program (prgmBF) and automatically compiles it to an asm program (prgmCALCFUCK) which is veryveryvery fast : you cannot see it displaying letters, for Hello World. And this compiler takes care of [[]] loops, but the online-released version creates a crashing asm program with [][] loops (a bug I've fixed yet, but not released)
Keoni29 : GetCalc(Name,Size)→Pointer example : GetCalc("prgmBF",1600)→P
And to make it an asm program, you'll have to be serious... and read an hexadecimal assembly tutorial (a sort of thing which can say you some things like saying that $C9 returns and $21 assign the 2-bytes following value to HL ...
-
I know how machine code works, but I never learned z80 asm. Perhaps because I can't work with tasm/spasm/whichever outdated z-80 asm assemblers are out there. It'd be interesting to see a more modern interface for those. Iirc there was an oncalc assembler released.
-
Iirc there was an oncalc assembler released.
It is called mimas.
-
Iirc there was an oncalc assembler released.
It is called mimas.
There is also ASMDREAM.
-
Really good project, it gave me the idea of doing my own but for TI-Nspire : http://ourl.ca/18020/331338 (http://ourl.ca/18020/331338) ;D