Omnimaga
Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: PT_ on March 25, 2016, 04:21:23 am
-
Hello everyone!
I can imagine many, many people are waiting for this post, but yeah, one must be the first to start such project ;)
I want to introduce this program:
ICE - an interpreter/compiler of CE-BASIC
Hooray! It would look like Axe Parser, but then for the newest calculator, the TI-84+CE.
Now are there many people who have questions, about what is possible with it, how long would it take to complete, what are the pros/cons?
Let me answer some questions.
What is ICE?
ICE is an interpreter/compiler of CE-BASIC. Normally, the OS reads a BASIC programs, and compiles it to some ASM commands, and then execute it. ICE does almost the same, but only read it, and compiles it to ASM commands, but instead of executing, it stores them into another program! In that way, you can turn your BASIC program into an ASM one, which is 1000x faster.
Why ICE?
Because I want to make a cool project (and not only games), and I think this program would be very useful for many people, so I decided to give it a try :)
What is possible with ICE?
I've no details yet, because I'm in an early stage, but I want to make it possible to keep it as BASIC as possible. I mean, you should be able in the future to compile all the BASIC programs to ASM. I never gonna reach that.... Like Axe Parser, it doesn't work with the TI-OS variables, because they are sloooowwwww. Instead, all the variables are in the RAM.
What are the pros and cons of ICE?
You can compile almost all the BASIC programs to ASM, which is 1000x faster. Since the CE has a memory-mapped screen, I'm going to implement a bunch of graph routines as well. A disadvantage is that you're a bit limited with the BASIC commands. I hope I can explain this later
When will you finish it?
In these weeks, I'm busy with school stuff, so I can't really do something with programming. But after that, I hope to finish it as fast as possible. Depending on the difficulties, I hope to finish it in some monts :)
How works ICE?
The hardest part is to express a string (and eventually store it to a variable). I will implement the Shunting-Yard-Algorithm for that (I will explain later). Once I got that ready, I need to write routines that replaces BASIC commands, like ClrHome would be call _HomeUp / call _ClrTxtShdw or whatever. Once THAT is ready, or enough of them, I will release a beta :)`
How smart is ICE?
For now, it is pretty smart, and by "smart" I mean, that if you display 2 strings which are exactly the same, it will be only once in RAM, an example:
Disp "ICE","ICE"
would be this:
call _NewLine
ld hl, _pointer_disp_0
call _PutS
call _NewLine
ld hl, _pointer_disp_0
call _PutS
ret
_pointer_disp_0:
.db "ICE", 0
which saves some RAM.
Example of Shunting-Yard-Algorithm:
Let's say I have this code:
F/2+3->A
The algorithm converts this to:
F 2 / 3 + A ->
Now I gonna read this sentence, and convert it to this (for example code)
ld a, (address_of_variable_F)
// Now I now that I need to divide A by 2, which is a power of 2, so just rotate the byte
or a
rra
// Now to add 3, which is a value, not a variable
add a, 3
// Now store it to variable A, so
ld (address_of_variable_A), a
This is basically how the algorithm works, but then a bit more complicated :P especially when you have a long string.
Progress:
As some of you may know, it's very hard to work in ASM :P. That is why I decided to first create this in PHP (that's why I asked how to read .8xp with PHP). After I finished that, I will port it to ASM. I'm now in the stage for developing the Shunting-Yard-Algorithm, which is the main and hardest part.
I know, there are still a ton of questions, so feel free to ask anything if you don't understand it, or whatever you want to say! :)
Originally posted on Cemetech: https://www.cemetech.net/forum/viewtopic.php?t=12616&highlight=
-
This sounds pretty interesting/fun, I wish you good luck with it!
I sure hope it'll go far :)
-
Hi PT_!
Programmers (of any sort) will always be welcome to Omnimaga (questionably 'simply the best', hehe!). I'm a somewhat oldish guy that happens to have done a lot of Z80 work in past, from OSes development to IDEs (no games, tho), but oh well, that was like 30 years ago and let's say I'm not in the mood anymore to return to that programming model.
That said, I'm aware that many, mostly young people, still like to program for that hardware platform. Mind you, there are also quite a few around here, so, I must admit that Z80 (or direct derivatives: ez80 or an ARM emulating a z80) is/are still very popular. And "against evidences there are no (plausible) arguments", period! An 'old saying', BTW.
Your nick 'PT_' also took me a bit by surprise, probably you don't know (?) that 'pt' suffix is the Portugal internet country code (Yeah, I'm Portuguese, but I've also spent a couple of years in Holland. By now, I already know that your are 'a sweet Dutch boy' ;) ).
Well, all this talk just to say hello to you seems a bit much to me. I'm not going to dive into the technical advantages of your proposal for now, but I want to wish you good luck with your project and 'Tot ziens'.
-
Hi PT_!
Programmers (of any sort) will always be welcome to Omnimaga (questionably 'simply the best', hehe!). I'm a somewhat oldish guy that happens to have done a lot of Z80 work in past, from OSes development to IDEs (no games, tho), but oh well, that was like 30 years ago and let's say I'm not in the mood anymore to return to that programming model.
That said, I'm aware that many, mostly young people, still like to program for that hardware platform. Mind you, there are also quite a few around here, so, I must admit that Z80 (or direct derivatives: ez80 or an ARM emulating a z80) is/are still very popular. And "against evidences there are no (plausible) arguments", period! An 'old saying', BTW.
Your nick 'PT_' also took me a bit by surprise, probably you don't know (?) that 'pt' suffix is the Portugal internet country code (Yeah, I'm Portuguese, but I've also spent a couple of years in Holland. By now, I already know that your are 'a sweet Dutch boy' ;) ).
Well, all this talk just to say hello to you seems a bit much to me. I'm not going to dive into the technical advantages of your proposal for now, but I want to wish you good luck with your project and 'Tot ziens'.
I would say "Dank u wel!" for your response :)
Probably you saw this post on CodeWalrus too? ;) I'm indeed a sweet Dutch boy, 17 years old, and I love programming and math. PT are the shortcuts of my full name ::) and because I think a username with 2 letters is too small, I added the _ :hyper:
Anyway, I hope to make good progress with this project in the next weeks!
-
Sounds pretty snazzy, good luck!
-
Sounds pretty snazzy, good luck!
Thanks! :)
While I had some free time, I wrote some pseudocode for the main algorithm, evaluating a mathematical expression. You can find it here (http://pastebin.com/4mC0Gtz2).
And I have a question for you: what is the best code to represent the BASIC " and "? Let's say I have 3 in register A and 0 in register B, how can I know if both registers are not zero? Just "and b" doesn't work, because if you have 1 in A, and 2 in B, the result is still 0 :|
Any help is appreciated! :)
-
I would do something like:
or a \ jr z,$+4 \ xor a \ or b
It returns the z flag set (z) if one or both are zero, else it returns (nz) if both are non-zero.
-
Today I've started creating an image, as for the homescreen of the ASM port, and as a logo for my documentation. This is the result:
(http://i.imgur.com/SjWk6PV.png)
Do you like it? Wanna change something? :)
-
It's looking awesome! Just the "OPTIONS:" text is kinda useless IMO
-
While I had much free time today, I've implemented the operators in the Shunting Yard Algorithm in ASM, including their precedence. It now builds 2 stacks, one at (saveSScreen), the other at (saveSScreen+1000), one for the actual stack, and the first one for the output, which I need to read after that. Unfortunately, I have no screenshots of that :(
I hope to make good progress these weeks! :thumbsup: :)
-
I love that title screen. :o
-
Small post despite my final exams: I've 'implemented' an API. That is, when running ICE from an ASM program, it will skip the header and directly search and compile the program. An example would be this:
ld hl, ICEname
call _Mov9ToOP1
call _ChkFindSym
ex de, hl
; skip header
inc hl
inc hl
push hl ; save for later
ld hl, varname
call _Mov9ToOP1
pop hl
ld (callAdress), hl
callAdress = $+1
call $000000
; continue
Of course, you can modify it for your own, but the program name should be in OP1 and to skip the ICE header, increment twice the starting data point.
My ICE program would look like this:
jr noAPI
jr APIContinue
noAPI:
header....
APIContinue:
call _ChkFindSym
etc
-
The 84 and 84CE BASIC are pretty similar. How hard would it be to port this the 84? I don't have any color calcs but this would be really cool! I don't know how different the z80 and the ez80 chips are though... Either way great work!
-
The 84 and 84CE BASIC are pretty similar. How hard would it be to port this the 84? I don't have any color calcs but this would be really cool! I don't know how different the z80 and the ez80 chips are though... Either way great work!
That is what we have Axe Parser for :)
If there wasn't something like Axe, the processors are totally different, so porting this would be the same as starting from scratch.
-
The processors are actually the same. All that would need to be changed are graphics and maybe some memory management.
-
I'm very happy to say that parsing a mathematical expression is almost done! :)
It now 'chains' operators, i.e. A*B+3, instead of the seperate routines for A*B and A+3 for example. Out of the 14 booleans/operators (+ - * / or xor and -> => <= > < = !=) I've finished 10. I only need >= <= > < to do, and after that, I'm ready with parsing such string (yet without functions). I haven't implemented auto-opt yet, but I will definitely do. Here is an example of what it can do:
String = A+4*B/(1-C)+3
Output = ld a, ($D05301) ; B
add a, a
add a, a
push af
ld a, 1
ld hl, $D05302 ; C
sub a, (hl)
pop hl
ld l, 1
mlt hl
call _DivHLByA
ld a, l
ld hl, $D05300 ; A
add a, (hl)
add a, 3
ret
The only good optimization I see is replacing the "push af" with "ld h, a" and remove the "pop hl".
-
Sounds cool!
Congrats on getting this far on a project that (seems) really difficult!
-
Wow, fantastic!
-
I DID IT!!!!!!!!!
I'm so happy now :) I succesfully compiled a normal program, without any errors :D
Ofc, I've finally a gif for you guys!
(http://i.imgur.com/nqqGMr5.gif)
The program is still far from perfect, but I'm more than happy with this now :D
EDIT:
(http://i.imgur.com/FsfbUQw.png)
(http://i.imgur.com/1TEcnXR.png)
-
Version 1.1.0: July XX, 2016
☑ Custom compiled program name
☑ Compile archived program
☑ getKey, rand
☑ Pause
☑ Direct incrementing/decrementing variables
☑ Changed accessing variables using ix, located at $E30800
☐ Input
☐ Lbl/Goto
☐ Display strings
-
I good feature for disp function:
if the string contain i (the imaginary i), the string placed after this character is puted at a new line ;)
-
ICE v1.1 is ready! Input, Lbl/Goto and Disp <string> now works too!
Here's an example program:
(https://i.imgur.com/I5GLBr4.gif)
rand->A
Repeat A=B
Input B
If B>A
Goto TOOHIGH
Disp "TOOLOW"
Goto GETNEXT
Lbl TOOHIGH
Disp "TOOHIGH"
Lbl GETNEXT
1->C
While C
IS>(C
Pause 5
End
End
Asm(CD8C0D02 // call _GetKey
Disp A
Pretty good, right? Size = 104 vs 211 bytes. WOW :D :D :D
I can't say it's bugless (notice the wrong value of A at the end), but yeah, I'm super happy with this. I hope to upload it very soon! :)
-
Okay..... IT'S FINALLY READYYYYYY :) :) :D
Compiling is now much easier (not faster), and better understandable.
Download:
https://www.cemetech.net/programs/index.php?mode=file&path=/84pce/asm/ICE.zip
https://tiplanet.org/forum/archives_voir.php?id=587211
"ICE Compiler is a program that compiles TI-BASIC-like language to ASM, the machine code. Create insane games, use the color screen, and make the step to ASM smaller! Speed up your BASIC programs and it's super easy to use! Type your program in the normal editor, compile it within seconds, and you have hours of fun! It doesn't require any shell."
Have fun and don't hesitate to post anything!
Also, it will be open-source, I will upload it soon to GitHub
(https://i.imgur.com/BO02SMr.gif)
-
Looks really awesome! :o
If I ever get a color calculator Ice is definitely going on it!
Is it finished or will there be more updates? (besides bugfixes)
;D
-
Yesss, this is looking quite awesome indeed!
do you plan to add built-in functions for drawing sprites and thelike?
-
Time for a M-M-M-M-MONSTER bump!
So I'm currently busy with a really big update, ICE v1.2, and I want to show you the most important updates (I don't want to discuss each update, it should be self-explanotary :) )
- 3-byte integers
- GUI
- C functions
- GUI
- For loop
- List support
- String support
- Smoother compiling
- If:Else:End
- Call a label
- Return
- Remainder(
- A little bit auto-optimization
- not(
- Pause (time)
- Doubles the size (close to 15K now)
- Multiplication with number <= 20 is now a special routine
There are even more updates, take a look at Cemetech, TI-Planet or CodeWalrus for more updates, screenshots and discuss points :)
-
Holy, crud, wow!
-
So I'm super happy to announce that ICE v1.2 is finally released!
When it's being accepted, you can download it at
https://www.cemetech.net/programs/index.php?mode=file&path=/84pce/asm/ICECompiler.zip
or directly at https://tiplanet.org/forum/archives_voir.php?id=587211
-
Are you also going to upload to ticalc.org?
-
Are you also going to upload to ticalc.org?
Yep: http://www.ticalc.org/archives/files/fileinfo/467/46751.html
-
In case you did not follow my Cemetech or TI-Planet thread, I've made a lot of progress since then, resulting in (almost) v2.0 one of the next days/weeks. I can't simply explain what I changed everywhere, but it's a lot :P When v2.0 is ready, I will make a nice post :)
-
I'm more than happy to finally officially announce ICE v2.0.0! It has been a long road to this version, because pretty much everything changed. I want to thank EVERYONE who has contributed to this long project, writing the documentation, and finding many bugs. I hope you all enjoy this new version, and if there's anything you want to be changed, feel free to poke or PM me! :D
(https://www.cemetech.net/img/icon/dl.gif) ICE Compiler v2.0.0 (https://www.cemetech.net/programs/index.php?mode=file&id=1481)
-
Congratulations! I have been lurking around project boards for some times, slightly jealous of CE owners, and I have to say, I would be using ICE in a heartbeat if I had a CE! It looks like a very adaptable and simple compiled-language, and it seems to have a solid implementation to boot! I'm sure it feels great to finally hit that v2.0.0 milestone, so keep on going and don't forget to look back on the leaps you made with this project!
-
Same here, it seems like it's on it's way to Axe-tier popularity, good job PT_!
-
Congratulations! I have been lurking around project boards for some times, slightly jealous of CE owners, and I have to say, I would be using ICE in a heartbeat if I had a CE! It looks like a very adaptable and simple compiled-language, and it seems to have a solid implementation to boot! I'm sure it feels great to finally hit that v2.0.0 milestone, so keep on going and don't forget to look back on the leaps you made with this project!
Same here, it seems like it's on it's way to Axe-tier popularity, good job PT_!
Thanks! :)
-
In case you wasn't aware yet, I've started with developing ICE v3.0. This major update will include floats, matrices and much more! It also includes a more powerful prescanner (i.e. more optimized code) and more auto-optimization. I also hope to make it more stable, and maybe more options to auto-archive programs when compiling etc. Follow the Github repo (https://github.com/PeterTillema/ICE/tree/better-ice) for all the things I added. Stay tuned! :)
-
I would ask that, if it is possible to parse in sub programs, when you add an auto-backup feature, could you also have it back up sub programs? So many times, I have had a ram clear where my skeleton src is saved but none of the real code is because it is all in sub programs. Thanks! (I don't own a CE)
-
Seems fine to me. I will check what I can do. :)