Join us on Discord!
You can help CodeWalrus stay online by donating here.

[TI-84+CE] ICE Compiler

Started by PT_, March 25, 2016, 08:14:17 AM

Previous topic - Next topic

0 Members and 4 Guests are viewing this topic.

PT_

Quote from: DJ Omnimaga on July 07, 2016, 03:52:53 AM
Can multiple loops or blocks be nested?


As for Axioms, you could always add support for inline ASM and have people type the hexadecimal inside the Asm() command or something.
Yep. There is a limited count to them, due to the stack, and because I move the stack temporary to vRAM, you can nest about 15000 loops or so. Enough? :trollface:

Asm(<hex> is already supported. And for Axioms, I've zero idea about how they works etc.. so yeah, I doubt I will implement it in the next X versions.


New update: I replaced a big part of the compiler. Instead of using register de as a pointer to the program data (zero safety), I use the OS calls + memory locations: curPC, endPC, _CurFetch and _IncFetch. This takes more time (1/100 s vs 1/101 s :P) but is much safer, and easier to use.

Dream of Omnimaga

Nice to see such high nested block/loop limit. I think i would be fine with just 10 but we never know. :P

Also great work on ICE so far.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

PT_

#167
Okay..... IT'S FINALLY READYYYYYY :) :) :D
Compiling is now much easier (not faster), and better understandable.
The download should be in the first post, but.... the zip is too large... Download it here:
https://www.cemetech.net/programs/index.php?mode=file&path=/84pce/asm/ICE.zip (once it's accepted)
or here:
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



Snektron

Very nice :)
Are you going to implement variables of more letters someday too?
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Dream of Omnimaga

Great! This is v1.1, right?
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

PT_

Quote from: Cumred_Snektron on July 07, 2016, 09:08:20 PM
Very nice :)
Are you going to implement variables of more letters someday too?
Thanks :)
No, only lists, which is equal to a bunch of 'variables'. I can't add more variables if they don't exists :P
Quote from: DJ Omnimaga on July 07, 2016, 09:42:53 PM
Great! This is v1.1, right?
Thanks :) Yeah, sure.

Epharius pointed me to a thing that the compiled program should be a protected program. I thought that was it already, because I had the filename as .db ProtProgObj, "VARNAME", 0 but I used the wrong call to create it. Not important enough to update though ;)

Dream of Omnimaga

Yep, it's better to protect compiled program code. Not that it's urgent but game players might edit the code by accident. Also I did that back in the days with Galaxian, in a trial and error fashion, to make all the enemy ships shoot at the same time every 2 second. :P
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Snektron

Quote from: PT_ on July 08, 2016, 05:32:41 AM
Quote from: Cumred_Snektron on July 07, 2016, 09:08:20 PM
Very nice :)
Are you going to implement variables of more letters someday too?
Thanks :)
No, only lists, which is equal to a bunch of 'variables'. I can't add more variables if they don't exists :P
I mean variable names that consist of more than one letter, so you can do like
8*4->Test

Also are you going to implement storing strings into variables? And if so how will you distinguish string pointers and number arguments?
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


PT_

Time for some important notes/question.

As promised, ICE v1.1 is open source. You can download/view it at https://github.com/PeterTillema/ICE. There is currently no license, but please don't copy/share it, as normal. I hope to find a good one soon :)

I'm going abroad for about 3 weeks, so then I can't work on it.

I will split the main to-do-list in 2 parts. The first part is more focused on compiling, errors, and a good GUI. The second part is more focused on adding stuff, and customs tokens.

That said, about customs tokens, I have some interesting questions for you guys. First, let me explain how I want to do this. What I need: 3 hooks: GetCSC, Menu and Token hook. My goal was
1) check if you are in the program editor
2) if so, check if you pressed [TRACE]
3) if so, force the OS to being [PRGM] pressed
4) set a special bit
5) Menu hook -> bit set, my own menu with
6) customs tokens.

Now some questions:
- if you have the token hook, and you change DE (token number), would it still work somehow?
- when the OS displays a menu, and it reads a token to be displayed as an option, would the Tokenhook run?
- if you enable the recall queue in the program editor, and you insert a *non-existent* token for some reason, would it run the Tokenhook? (call _Get_Tok_Strng or call _GetTokStrng?)
- the Wiki says about the Tokenhook, that you can point hl to the string. Would it start with the string length, or should it be null-terminated?

Thanks in advance! :)

DarkestEx

Quote from: PT_ on July 14, 2016, 08:55:04 PM
There is currently no license, but please don't copy/share it, as normal. I hope to find a good one soon :)
My suggestion is the new 3-clause BSD license. I used the same one in the entire Claw project:
https://tldrlegal.com/license/bsd-3-clause-license-(revised)
  • Calculators owned: TI-84+, Casio 101-S, RPN-Calc, Hewlett-Packard 100LX, Hewlett-Packard 95LX
  • Consoles, mobile devices and vintage computers owned: Original Commodore 64C, C64 DTV, Nintendo GameBoy Color, Nintendo GameCube, Xbox 360, PlayStation 2

Dream of Omnimaga

I can't help you on the hooks PT_ but I'm glad ICE is noe open-source. :) When Quigigo left nobody could continue working on Axe until he handed the source to Runer112 :(
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

PT_

Well, the first step is made to my own custom tokens!!! (Btw, after inserting it in the program, it crashes :()

Dream of Omnimaga

IMHO I think that instead of using new tokens, you should maybe use existing ones, like xLIBC does with real(), but rename them like Axe (ideally such decision should be taken early to avoid confusing ICE programmers), because illegal tokens or ones added via hooks tend to not only become unstable, but they also make it incredibly hard to send programs between the PC and calculator or between two calculators, as I witnessed with early versions of Omnicalc back in the days.

That's unless you found a solution around those issues, though. But yeah, you should try sending a program containing that Hello token to a PC and then vice-versa without ICE compiler installed, so you see what I mean.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Dream of Omnimaga

On a side note, I'M late to this @PT_ but congratulations on the ticalc.org front page feature. :)
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

PT_

Thanks :)

Time for some updates. This week I came back from my holiday, which means I had some time for programming again. And yes, of course, I picked up ICE to start with, outside of some small projects. I'm currently working on 4 parts:
- GUI
- Optimization
- Auto-optimization
- Add custom tokens.

The first part, the GUI, is halfway done, I still need to get all the programs from the VAT, starting with [\i], and display them, and of course select one. The second point is just underway, many thanks to grosged who gave me some tips, and now I can save about 100 bytes, maybe even more. I'm about to start with point 3, the auto-opt. For example I have this peace of code: Repeat A=5
ICE now compiles that into ld a, (ix+variableA)
sub a, 5
add a, $FF
sbc a, a
inc a
or a
jp z, ******

Well, it could be MUCH shorter!
ld a, (ix+variableA)
sub a, 5
jp z, ******

This will be done at the auto-opt part, and I guess it can optimize much stuff! :)

Last part is the custom tokens, or a replacement of uncommon tokens. I've posted earlier how I gonna do that, and I'm only struggling with the extended keypresses for tokens.
Side note, I want to 'create' these tokens:
ExecHex(
Sprite(
Rect(
ReadByte(
ReplaceByte(
AddByte(
DeleteByte(
SetupPrgm(
CreateVar(
ArchiveVar(
UnArchiveVar(
DeleteVar(
Inc(
Dec(

Wanna see things added? Let me know, even if you have questions what they can do! :)

Powered by EzPortal