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

PT_

Added rand - 400 bytes extra :) The rand routine itself is 28 bytes large, but sometimes the registers shouldn't be overwritten, so push/pop is needed.
I got it from https://www.omnimaga.org/asm-language/ez80-optimized-routines/

Dream of Omnimaga

Ah ok, I was wonderingabout the language apps because I remember that Omnicalc overwrote the Français app parser hooks. Also how fast is the Rand command?
  • 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: DJ Omnimaga on September 26, 2016, 07:28:53 PM
Ah ok, I was wonderingabout the language apps because I remember that Omnicalc overwrote the Français app parser hooks. Also how fast is the Rand command?
According to CEmu exact 181cc, which is pretty fast I would say :) Also, I'm very hard busy, so changes are coming fast ;)

PT_

Well, I had a *little bit* more free time as I thought, so I made some important changes.

First of all I want to show you the speed of ICE. Here it compiles at program with the normal header and 150 lines with the same code: "3+4-L1((3+A)-B->C+3->L1(4". Guess how fast? See it!

It crashes at the end. Debugging would be fun.....

Notice: CEmu seems to be much slower when recording. In real time, compiling takes seriously about 1/3 second, INSANE FAST :D :D :D

I've added the rand-routine, as already said. 28 bytes with a speed of 181cc is not bad, I would say. Again, thousands of bugfixes, it seems I always make errors :P Besides that, I started with the code for my custom tokens, and ReadByte( seems to work.

For all ReadByte, ReplaceByte, AddByte and DeleteByte, I will add a mode option, like ReadByte(<mode>,<address>). Mode = 0 means reading an offset in the program (I will explain later) and mode 1 means reading directly from the memory. I will explain later, and give some code. At last I finished the 2 operators, and I think they are bugless, so happy time!

PT_

Because it's possible, I added again a bunch of thinks.
  • Added operators * and /. Together this took about 15 minutes :) (4/14 done)
  • jacobly and I discussed some main points about where to store the output program (before it will be created). I figured out that if the output program size > 6500 bytes or so, then the calc will crash, because then it's bigger than the size of ICE itself, and other important data get overwritten. Instead, I located the stacks to saveSScreen and the output program to vRAM+320*240. There I will have 76800 bytes of free RAM, enough for a nice program
  • Want to see speed? Here, ICE compiles a program which consists of 1200 lines full of "3+4-L1((3+A)-B->C+3->L1(4".

    (Real speed = ^ speed * 2)
  • I've added a kind of statusbar, as you can see in the image, but it's only useful for pretty large programs.
  • Bugfixes + less output size
  • Fixed important bug with selecting a program from the list if you want to scroll.
  • Added about 1000 bytes, not important
  • If all goes right, ICE now triggers an error if you have not enough RAM to store the program, but I haven't tested it - it's hard to fill the 154kB :P
  • Fixed the bug that added a "push hl" at the end of a program, for some reason.
Hopefully more are coming soon, at least I will try to finish it as soon as possible :D

Dream of Omnimaga

I would be OK if gibberish and static appeared in the LCD during compiling if you were in serious need of space to save a temporary copy of the program. A lot of older programs and shells did that. By the way, is external data such as appvars supported and what about archived ones?
  • 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: DJ Omnimaga on September 27, 2016, 04:04:44 PM
I would be OK if gibberish and static appeared in the LCD during compiling if you were in serious need of space to save a temporary copy of the program. A lot of older programs and shells did that. By the way, is external data such as appvars supported and what about archived ones?
Not really, since the CE has 154kB of free RAM, 170kB of vRAM and 3000kB of Archive, so it's bad if I can't find enouh space to store the program :trollface:
External programs and appvars are both supported. I've these commands for this;
SetupVar( - Load the program/appvar name in OP1 and calls _ChkFindSym and loads the result in memory. If it's archived, the right pointer will be stored.
CreateVar - creates an appvar/program, the starting address of this var will be loaded into memory
ArchiveVar - archives var
UnArchiveVar - unarchives var
DeleteVar - deletes the var.

(Originally I replace Var with Prgm, but to support appvars, these will be replaced with Var

E37

Sounds like it is really getting along!
Are you updating the download on the first post, or will the newest releases be posted along the thread?
  • Consoles, mobile devices and vintage computers owned: Ti83,Ti84!
I've never finished a project, there is always a way to improve!
What's my calc's name? Convert $37 to decimal. Look up that element in the periodic table. Then take the abbreviation of that element and you have it!
Look! A slime!    <(^.^)>

PT_

Well, progress is going faster than you can imagine, and I don't like making 3 times a day a new post with new features  9_9
I will post soon a BIG post with BIG updates :)

And to respond to your question: wit each ICE update, also documentation will be included, and CodeWalrus doesn't like big updates, so either I need to remove the documentation, and upload it, or don't upload it here :/

PT_

#219
Last week I made insane progress, tbh. I've implemented several commands, updated stuff, and of course, fixed many bugs. Let me point out the most important ones:
  • Disp - display both the result of an expression and a string, with only one Disp command! Example: Disp A+3,"ICE"
  • Pause - pauses the program for some time in ms. If you pause a number, like Pause 1337, it waits exactly 48000*number-1 ms (outside of interrupts/DMA)
  • If - exactly as you expected, If <statement>:<code>:End, no need for a Then, also not for a single line between the If statement and If
  • Repeat - again as you expected. Repeat <statement>:<code>:End repeats executing <code> until <statement> is true. <statement> will be checked after <code> (post-test)
  • While - same as Repeat, but then pre-test, just like BASIC
  • ClrHome - clears the homescreen, this is important before you display stuff
  • Input - a full routine to input a variable. Valid syntax is Input <variable>. Because the size is pretty large, this routine will be copied to the program data and called from the main program. Nothing is displayed in front of the input, that will come later
  • For - wow, not recommend to do that :P Valid syntax is For(<variable>,<expression>,<expression>(,<variable/number>). The step-thing is important. If the token right afer the last comma (thus the first token of the step) is ~, then the variable goes backwards. You can add/substract either the value of a variable, or a number from <variable>, so this are the possible options: ~number, ~variable, number, variable.
  • I fixed a main bug in the statusbar, at the last token, it didn't display the line to the right of the screen, but some pixels of.
  • Both optimization and added again 1000 bytes or so, but nobody cares :)
  • A very little bit auto-optimization, only noticable in For-loops ;)
  • Disp displays numbers at the right of the screen
  • One small thing to keep in mind, that I still need 12 operators/booleans, and since = is not implemented, my code to check is A is even...: If A/2*2-A+1 :P
So basically, this was it, and thus time for a nice screenshot!


Oops, I see that the loop step is not 100% correct...

Things to do:
  • Cesium icon+description support
  • Operators
  • (custom) functions
  • Auto-optimization
  • Sprites, If/Else/End
  • MAYBE running assembly subprograms
So that's it! I hope you guys enjoyed it :D

EDIT: fixed that bug that the step in a For loop is a variable, had to reset a bit...

E37

 O.O Again, looks really neat!
Will ICE stay mainly basic focused, or will it become more specialized like Axe?
Some of the features seem true to basic, while others seem specialized like file management.
It is already at the point though, that you can't compile a basic program and have it come out the same but faster right? (that uses only commands that ICE can compile)
I think that ICE would be better breaking from the basic syntax, but that's just my uneducated opinion.
  • Consoles, mobile devices and vintage computers owned: Ti83,Ti84!
I've never finished a project, there is always a way to improve!
What's my calc's name? Convert $37 to decimal. Look up that element in the periodic table. Then take the abbreviation of that element and you have it!
Look! A slime!    <(^.^)>

Dream of Omnimaga

Darn that's a lot of progress! We can now make some games, sort of :). Good job so far @PT_
  • 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_

Sorry for the delay, school and other things were taking my time. But whatever, I can finally say ICE sees the finish line! I've finished all the operators/booleans + big optimization (14000 -> 11000 bytes :P), fixed some stuff with functions, and fixed the function ReadByte(). In fact ICE v1.2 will already work, but when you use another custom tokens, it will generate an error (not a crash!), so basically I'm coming in the stage of both test/debugging and eventually adding/fixing functions. Stay tuned!

PT_

I just want to say that Sprite() is finished, but I'm now busy with huge optimization in it! The sprite command looks like Sprite(x,y,width,height,data) where data is in the same form as ExecHex(, so it compiles every 2 bytes to a byte (color). I'm currently busy with HUGE optimization in the routine, because I could optimize it a lot when for example y is a constant, or the width etc, so I need a different routine for that. ;)

Dream of Omnimaga

Glad to see it's working, but the syntax concerns me. Does this mean that "data" will have to be static, as in we won't be able to store the data in another variable/array/string/pointer then use that copied data instead? There are many situations where variable sprite data instead of constant sprite data might be needed, like this pseudo code:


For(X,0,19
For(Y,0,15
Data(TileID(X+20Y))->SpriteData
Sprite(16X,16Y,16,16,SpriteData
End
End


Otherwise, with only static/constant data, this is what our code would look like:

For(X,0,19
For(Y,0,15
If TileID(X+20Y)=1
Sprite(16X,16Y,16,16,Data1
If TileID(X+20Y)=2
Sprite(16X,16Y,16,16,Data2
If TileID(X+20Y)=3
Sprite(16X,16Y,16,16,Data3
If TileID(X+20Y)=4
Sprite(16X,16Y,16,16,Data4
If TileID(X+20Y)=5
Sprite(16X,16Y,16,16,Data5
If TileID(X+20Y)=6
Sprite(16X,16Y,16,16,Data6
If TileID(X+20Y)=7
Sprite(16X,16Y,16,16,Data7
If TileID(X+20Y)=8
Sprite(16X,16Y,16,16,Data8
If TileID(X+20Y)=9
Sprite(16X,16Y,16,16,Data9
If TileID(X+20Y)=10
Sprite(16X,16Y,16,16,Data10
If TileID(X+20Y)=11
Sprite(16X,16Y,16,16,Data11
If TileID(X+20Y)=12
Sprite(16X,16Y,16,16,Data12
If TileID(X+20Y)=13
Sprite(16X,16Y,16,16,Data13
If TileID(X+20Y)=14
Sprite(16X,16Y,16,16,Data14
If TileID(X+20Y)=15
Sprite(16X,16Y,16,16,Data15
If TileID(X+20Y)=16
Sprite(16X,16Y,16,16,Data16
End
End
  • 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

Powered by EzPortal