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 8 Guests are viewing this topic.

PT_

I had finally a free day off, which means I had a lot of time for programming :D

Today, I added Asm(, ReturnIf, remainder(, Lbl, Goto, Output( and Disp. The days before, in my spare free time, I added strings + string concatenation (like "ABC"+Str1) and length(. I have the framework done for sub( and toString(, both will be implemented soon :)

As far as I know, this is my to-do-list until the first C version release:
  • Integer types and pointers
  • sub(, toString(
  • For( loops
  • prgmX
  • DefineSprite(, ExecHex(, Call , CompilePrgm(, SetBASICVar(, GetBASICVar(
  • Eventually some sort of lists/data ish
  • More C functions
  • More random functions
If you have suggestions on what to add more, feel free to nag me, I'm now in the mood for adding things :)

Dream of Omnimaga

I'm kinda late but have you gotten any luck adding any of the above features since your post, especially pointers?
  • 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_

Good news! I added GetPixel( in the ASM version! :D
It's still a bit primitive, the syntax should look like this: det(7,<expression>,<expression>)-><variable>. You do need the closing parenthesis, otherwise it won't work.

Download: https://www.cemetech.net/programs/index.php?mode=file&path=/84pce/asm/programs/ICECompiler.zip


Dream of Omnimaga

GetPixel will be very handy o.o . I remember many games in the past used such collision detection. Can it pixel test from both VRAM?
  • 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_

Yes, it's the same as the C lib function, so it should work fine.

PT_

I'm ready with implementing everything, so it's time for bugtesting. I've tested all the non-expression functions, like If, Repeat, Call etc.
Also, it seems the icon and description works :D


Dream of Omnimaga

Yay, icons! Maybe someday I should update Opossum Massage Simulator so that it features highscores and an icon.
  • 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: xlibman on September 27, 2017, 05:47:32 PM
Yay, icons! Maybe someday I should update Opossum Massage Simulator so that it features highscores and an icon.
I bet that OMS is now 5% smaller due to more heavy optimizations in ICE :P Anyway, I'm planning to add tilemaps soon, and then the final bugtesting can begin, which means the C version will probably be released within some weeks.

_iPhoenix_

How does Cesium know that an ice program is written in ice, not assembly?
  • Calculators owned: Two TI-84+ CE's
Please spam here: https://legend-of-iphoenix.github.io/spam/

"walruses are better than tuxedo chickens, all hail the great :walrii:" ~ me
Evolution of my avatar:

MateoConLechuga

Quote from: _iPhoenix_ on September 27, 2017, 09:06:45 PM
How does Cesium know that an ice program is written in ice, not assembly?
The same way it knows a C program is written in C not assembly. ;)

_iPhoenix_

Quote from: MateoConLechuga on September 27, 2017, 09:36:52 PM
Quote from: _iPhoenix_ on September 27, 2017, 09:06:45 PM
How does Cesium know that an ice program is written in ice, not assembly?
The same way it knows a C program is written in C not assembly. ;)

I thought so. (That was actually more help than it may have seemed.)
  • Calculators owned: Two TI-84+ CE's
Please spam here: https://legend-of-iphoenix.github.io/spam/

"walruses are better than tuxedo chickens, all hail the great :walrii:" ~ me
Evolution of my avatar:

PT_

#386
I'm finally done with bugtesting, at least all my test programs work fine (during testing I solved another bug or 2), so it's time to share it with you guys. Feel free to download this ICE, please test all the edgy cases, and if there's an ICE ERROR: Please report it, please send me your source code, then I can try it as well :)

Things I still want to fix but that are not really important:
- Max label/variable name length
- More syntax errors at impossible cases
- All the remaining bugs lol

https://www.dropbox.com/s/ehk81xwu4foeil8/ICE.zip?dl=0

There is an .exe in the folder, it works exactly the same as the C version. Just run it with ice <input program>, i.e. ice SUM.8xp, and it will compile your program and output the program in the main directory. I know, I still need to rewrite the entire commands.html and documentation.pdf, but will do that later, so you guys have to do it without documentation ;)
Let me explain the most important changes, some others should be straightforward:
- Pointers. *{ } for 1-byte dereference, **{ } for 2-byte dereference and ***{ } or just { } for 3-byte dereference. The amount of nested { } is the level, so {{A}} gets the word at address at word at address A.
- Copy( copies arg3 bytes from arg1 to arg2. If there are 4 arguments, the first argument will be ignored, but the copy will be reversed (lddr instead of ldir)
- Data( returns a pointer to the data section in the program data. First argument should be the size of the next elements (1 = 8-bits, 2 = 16-bits, 3 = 24-bits). All the remaining elements will be inserted in the program data and it returns a pointer to this.
- L1-L6 are now pointers, so accessing the first element of L1 will be ***{L1+0} instead of L1(0).
- Alloc( allocated some memory, for example for rotating or enlarging sprites. Returns a pointer to the data.
- sum(... all the same as det(, but sum( is used for the FILEIOC lib. Sorry, won't show all the arguments needed, but you can select the right function in the program editor by pressing [TRACE].
- sin( cos(, range is [0, 255] (so 256 = 2*pi)
- String concatenation, storing, displaying
- for displaying a new line

And much more which I can't tell now. But have fun exploring ICE, and hopefully I can make it an official release soon! :D

_iPhoenix_

#387
Quote from: PT_ on September 29, 2017, 07:47:13 PM
so {{A}} gets the word at address at word at address A.

So it goes to the location stored in pointer A, gets the location stored there, and returns what it finds at the location?

Edit: I may be able to help with/do the commands file, if you want.
  • Calculators owned: Two TI-84+ CE's
Please spam here: https://legend-of-iphoenix.github.io/spam/

"walruses are better than tuxedo chickens, all hail the great :walrii:" ~ me
Evolution of my avatar:

MateoConLechuga

Quote from: _iPhoenix_ on September 29, 2017, 11:36:34 PM
Quote from: PT_ on September 29, 2017, 07:47:13 PM
so {{A}} gets the word at address at word at address A.

So it goes to the location stored in pointer A, gets the location stored there, and returns what it finds at the location?

Edit: I may be able to help with the commands file, if you want.
I think you are along the right lines. There is still a lot of confusion I feel on the difference between words and pointers; so here's how it works really quick: (Let's assume the variable A holds the value 5).

A is a pointer to an address, in this case 5.
{{A}} Returns the pointer stored at address 5. Let's say at address 5 this pointer holds the value 10.

So 30->*{A} would store the 1-byte value 30 to address 5.
But 30->*{{A}} would store the 1-byte value 30 to address 10.

_iPhoenix_

That's what I meant.

I've read enough Assembly topics that I knew it was possible to do so, and inferenced (that's a word, right?) my post from the info in those threads.

Multi-level pointers are things I never knew existed, but desperately need...
  • Calculators owned: Two TI-84+ CE's
Please spam here: https://legend-of-iphoenix.github.io/spam/

"walruses are better than tuxedo chickens, all hail the great :walrii:" ~ me
Evolution of my avatar:

Powered by EzPortal