New update, ICE v1.5. I've added direct key inputting, so very fast checking if a key is pressed, small For loops, which are independant of a variable, and much faster, and CompilePrgm( which compiles a subprogram. Additionally, the graphics library version 3 is supported. Maybe more, but I can't remember Razz

Download ICE Compiler
So I want to create a while loop in which if you hit the UP arrow, X is increased by 1, and when you hit ENTER, the program is ended via a Goto that exits the loop. I couldn't seem to get If loops to work with ICE. The program compiles fine, but when I run this code, the program just ends instantly.



Code:

iA
While 1=1
getKey→A
If A=4
X+1→X
End
If A=9
Goto Stop
End
End
Lbl Stop


I assume you have to have the ends to close the If, because that's what I read on the commands page. It doesn't work without the ends either.
Thanks. ICE has a bug such that "While 1=1" turns into "While 0" which ignores the entire While loop and thus returning directly. Outside of that, please don't have a Lbl/Goto at the last line of the program, that can cause some bad things... 1 of the 39589937497394 bugs I need to solve
In other words, ICE is making 1 equal 0? Whoa.
dankcalculatorbro wrote:
So I want to create a while loop in which if you hit the UP arrow, X is increased by 1, and when you hit ENTER, the program is ended via a Goto that exits the loop. I couldn't seem to get If loops to work with ICE. The program compiles fine, but when I run this code, the program just ends instantly.


Code:

iA
While 1=1
getKey→A
If A=4
X+1→X
End
If A=9
Goto Stop
End
End
Lbl Stop


I assume you have to have the ends to close the If, because that's what I read on the commands page. It doesn't work without the ends either.


Given that your code currently doesn't compile right, use this:

Code:
iA
Repeat A=9
getKey→A
If A=4
X+1→X
End
End
Thank you! To build on the last post, I have programmed a circle that moves left and right with the arrow keys. I just get a slight graphical glitch when moving right where the left side of the circle does not get erased. Is there a reason for this and/or a way to fix it?

EDIT: I fixed my problem, only happens when the clip gets too close to the edge of the screen. Just leaving this here so people are aware.
Guess what?



Took me about 6 hours, and the solution was very simple Razz
Added some stuff and fixed many bugs... the main change is that you don't need an index with DefineSprite(), it will now automatically insert that. To 'compensate' this, you can now display sprites with a variable index, like A+3 or even getKey, but be sure that sprite IS defined, otherwise you will get weird stuff Razz

Download: https://tiplanet.org/forum/archives_voir.php?id=587211
I've uploaded a new version, which adds ReturnIf <exp>, which could be useful, along with many bugfixes nobody knows of. Also I will try to give you some examples about optimization of ICE code:

2+(2*A) can be (A+1)*2

If A=1 can be If not(A-1

For loops where the variable is not used, can maybe be optimized to a 'small For loop', like For(39

Repeat K:getKey->K:End can be Repeat getKey->K:End

66+(32*(B/4)) can be B/4*32+66

Download:
https://www.cemetech.net/programs/index.php?mode=file&path=/84pce/asm/ICECompiler.zip
https://tiplanet.org/forum/archives_voir.php?id=587211
PT_ wrote:
66+(32*(B/4)) can be B/4*32+66


I don't understand how that is better, but okay Razz Anywho; nice work! Keep it up Smile

EDIT: These both should optimize to roughly the same thing:


Code:
ld hl,(B) \ ld c,3 \ call __ishl \ ld bc,-32 \ call __iand \ push hl \ pop iy \ lea hl,iy+66
Is there any way to have a compiled program store persistent data? If there isn't, could you add a command to store data like that?
CodertheBarbarian wrote:
Is there any way to have a compiled program store persistent data? If there isn't, could you add a command to store data like that?

In fact this comes down to external variable storage. Nope, sorry Sad but I'm very hard working on the new version, which will include external variable storage!
I just want to say that pointers are implemented, but almost everything else is broken, and I want to implement a lot more functions, and I'm working on AoCE, so don't expect a new update soon Wink
I've been gone for a while. I took a look at this program and it works amazingly, nice work! Good Idea
I took a look at the documentation and command list, and I didn't see anything related to executing a basic program inside of the ICE program. Is this not possible or am I missing something?
It seems that this could be useful for commands that can't be compiled in ICE, such as using matrices and such.
andressevilla wrote:
I've been gone for a while. I took a look at this program and it works amazingly, nice work! Good Idea
I took a look at the documentation and command list, and I didn't see anything related to executing a basic program inside of the ICE program. Is this not possible or am I missing something?
It seems that this could be useful for commands that can't be compiled in ICE, such as using matrices and such.

Thanks Smile I have put a lot of time and effort in it, so I hope you guys enjoy it Very Happy
Executing a BASIC program is a lot more difficult than expected, like catching the errors etc. Using matrices in another BASIC program also makes no sense, because there is no interaction between ICE variables and BASIC variables. Maybe this comes in the future though Wink
andressevilla wrote:
I've been gone for a while. I took a look at this program and it works amazingly, nice work! Good Idea
I took a look at the documentation and command list, and I didn't see anything related to executing a basic program inside of the ICE program. Is this not possible or am I missing something?
It seems that this could be useful for commands that can't be compiled in ICE, such as using matrices and such.

Okay, so you want to execute a basic program from an ICE compiled program... As PT_ said, ICE currently can't interact with external variables, so for example, compiling something like this:

Code:
iA
10→A
ClrHome
Disp A

Will display 10 on the homescreen, but then, after the program terminates, if you go on the homescreen and enter A, you will see that the value of A was never changed. Now assuming you are aware of this and still would like ICE to execute your Basic program for you, then there might be a way to do it given the fact that there is a command to execute some asm code written in hex which I believe has been implemented called ExecHex(). This would in theory allow you to type in something like ExecCode which is a piece of opcode written to simply execute an asm or ti-basic program given its name. There are two things you will need to do for this to work for now:
    1) You will need to run some opcode to store the name of the program you want to execute to an actual variable (Ans in this case)
    2) You will need to port ExecCode to work on the ti-84 plus CE. The opcode was written for an older model and will not work on the CE, it will most likely crash your calc.

Other than that, I don't see why this would not work. This being said, If I were you, I would wait until the next release, which should include commands that deal with pointers, which should make this kind of process a bit easier.

EDIT: Mateo just informed me that it is unlikely that this will work because ICE. Evil or Very Mad
but it might...
mr womp womp wrote:
andressevilla wrote:
I've been gone for a while. I took a look at this program and it works amazingly, nice work! Good Idea
I took a look at the documentation and command list, and I didn't see anything related to executing a basic program inside of the ICE program. Is this not possible or am I missing something?
It seems that this could be useful for commands that can't be compiled in ICE, such as using matrices and such.

Okay, so you want to execute a basic program from an ICE compiled program... As PT_ said, ICE currently can't interact with external variables, so for example, compiling something like this:

Code:
[i]i[/i]A
10→A
ClrHome
Disp A

Will display 10 on the homescreen, but then, after the program terminates, if you go on the homescreen and enter A, you will see that the value of A was never changed. Now assuming you are aware of this and still would like ICE to execute your Basic program for you, then there might be a way to do it given the fact that there is a command to execute some asm code written in hex which I believe has been implemented called ExecHex(). This would in theory allow you to type in something like ExecCode which is a piece of opcode written to simply execute an asm or ti-basic program given its name. There are two things you will need to do for this to work for now:
    1) You will need to run some opcode to store the name of the program you want to execute to an actual variable (Ans in this case)
    2) You will need to port ExecCode to work on the ti-84 plus CE. The opcode was written for an older model and will not work on the CE, it will most likely crash your calc.

Other than that, I don't see why this would not work. This being said, If I were you, I would wait until the next release, which should include commands that deal with pointers, which should make this kind of process a bit easier.

EDIT: Mateo just informed me that it is unlikely that this will work because ICE. Evil or Very Mad
but it might...

Ok cool, thanks for the clarifications. I think I figured out a better way though, just have the main program be basic and launch different ICE programs. This probably isn't the best way to do it, but it gives me more control and it is easier for my nonexistent knowledge of assembly and hex.
I updated ICE, the size went from 18kB to 10kB using Mateo's program compressor Wink

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

Also, if you still didn't know, I made a new game in ICE, Snowball Struggle
Download: https://www.cemetech.net/programs/index.php?mode=file&path=/84pce/asm/games/SnowballStruggle.zip
ive found a bug (you probbly arleady klnow aboput it):
The display gets messed up if you ask for user input

Code:
PROGRAM:ZZED
iZICE
For(X,0,10)
det(0
det(3
Input C
det(5,C
Pause
det(1
End

See here

note this is a screenshot

note here i took a picture (sorry its big)

I realize you might not be able to fix this it would be great if you did.
Uh right, C functions (det(XXX...)) modifies the register iy, while Input needs it, but it's messed up. Should be easy to fix though, whenever I have time Smile
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
» Goto page Previous  1, 2, 3 ... 9, 10, 11 ... 31, 32, 33  Next
» View previous topic :: View next topic  
Page 10 of 33
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement