**Dear Friend wrote:**

I think it's very rare to definitively screw up a calculator just with a program.

Do you know an link for exemple ?

PT_ did say in his ICE documentation that if you mess with memory pointers wrong, you could mess up your calculator.
**commandblockguy wrote:**

What would this do, exactly?
**De2290 wrote:**

**commandblockguy wrote:**

What would this do, exactly?

"00" does no operation.

The program would crash because it does not return to the TI-OS, instead would just execute code past the end of the file.

"00C9" however, would not crash. (iirc) It would do nothing for one clock cycle, then return to the TI-OS
Can you add 16bpp functions to ICE or it will take to much space?

**Alvajoy123 wrote:**

Can you add 16bpp functions to ICE or it will take to much space?

No. The toolchain doesn't support 16bpp graphics routines and I don't feel like writing them myself. Plus, who ever uses graphics while in 16bpp mode?
**PT_ wrote:**

**Alvajoy123 wrote:**

Can you add 16bpp functions to ICE or it will take to much space?

No. The toolchain doesn't support 16bpp graphics routines and I don't feel like writing them myself. Plus, who ever uses graphics while in 16bpp mode?

It was used in DoorsCE

https://www.cemetech.net/img/dcs/dce9/firstscreen.jpg
**Alvajoy123 wrote:**

**PT_ wrote:**

**Alvajoy123 wrote:**

Can you add 16bpp functions to ICE or it will take to much space?

No. The toolchain doesn't support 16bpp graphics routines and I don't feel like writing them myself. Plus, who ever uses graphics while in 16bpp mode?

It was used in DoorsCE

https://www.cemetech.net/img/dcs/dce9/firstscreen.jpg

Which was written before the toolchain was released, and I think PT_ meant that it is less efficient, and therefore generally not desirable, rather than that it is not possible.
Sorry to be slightly off topic here, but I just want to say that I am super excited for floats in ice 3

With some mathematical tricks you dont need float in ICE.

And for a lot of games you dont need float mainly because integers are some bits faster.

There is also the possibility to use ICE for graphical procedure and chain with Basic and after chain again with ICE...

Problems are like walls. You spend more energy to break them than getting around them.

I have tried that trick where you store integers at 1000x of their actual value to avoid truncation but usually I run into an issue when I am trying to convert negative numbers back to their actual value because dividing negative numbers gets freaky

**Dear Friend wrote:**

With some mathematical tricks you dont need float in ICE.

And for a lot of games you dont need float mainly because integers are some bits faster.

Totally agree. People are too reliant on floating point numbers, when fixed point would do the job just as well.
@johnbchron:

For negative numbers you can manage in your prgram a flag variable wich contain the sign value, 1 if positive and -1 if negative. Like that you avoid negative numbers problem. No?

@c4ooo:

I agree with you but sometime it's difficult for beginners to find method to manage

prblems. With experience they will arrive but the experience is something you forge when you encounter problems. I hope what i said will be usefull to forge experience for beginners.

**johnbchron wrote:**

I have tried that trick where you store integers at 1000x of their actual value to avoid truncation but usually I run into an issue when I am trying to convert negative numbers back to their actual value because dividing negative numbers gets freaky

Try this code for negative numbers:

**Code:** ```
```

1→NP

If N▪|E800000

1-N→N

0→NP

End

N*4→N

If not(NP

1-N→N

0→NP

End

"▪" is the plotsquare token (bitwize 'and' in ICE)

The way I used it is to tell if the highest bit (0x800000) is set, indicating a negative number.

I store the 'positivity' of the number to another variable, and use this to affect other calculations which would be affected unexpectedly when a number overflows.

In a multiplication or division operation, this is critical, else the number will appear to change in the opposite direction than expected. (division will behave like mutiplication, and vice-versa)

The reason for this is that all numbers in ICE are positive. 'Negative' numbers are simply very large positive numbers.

In order to 'flip the sign' of a number, do 1-N, which is the two's compliment of N.

Hope this helps explain negative arithmetic in ICE.

EDIT: I should probably stick to my own territory, especially for things that I do not know very well, like Asm and C.

I've been using this method a lot lately, mostly in programming that requires sine and cosine.
Can a function be added to generate rando numbers in a given inclusive or exclusive interval without repeating?

rand Returns a random number between 0 and 16777215.

By a simple rule by 3 and a constant you can adjust.

Mathematically you have a topologic closed set of integer {a1...a2}

and you want to obtain another one {b1..b2} with a different cardinal.

A good divide, an appropriate constant and INT function can help you.

I have no idea what exactly you said/mean by that.

Dear Friend meant to say that you can adjust any rand function to support a different range. If, say, your rand function returns a number from 0 to 1, such as rand in TI-Basic, you can do rand * (range_max - range_min) + range_min to adjust the range. If your rand returns a number from a to b, you can accordingly do ((rand - a) / (b - a) - b) * (range_max - range_min) + range_min to adjust the range to be from range_min to range_max.

This works by linearly "mapping" one range to the other (Google keyword hint!), which you may find great articles on.

This is exactly true Nik.

XpointView22, dont miss the occasion to learn fishing in place of eating a fish.

**XpointView22 wrote:**

Can a function be added to generate rando numbers in a given inclusive or exclusive interval without repeating?

the newest ICE has randInt(A,B), but it might repeat, so you might want to try some sort of loop to see if the new randInt that was generated is the same as any others, if it is, then repeat the randInt until it isn't the same as any existing ones. I'm sure someone else here might be able to "codify" this, but if you have a larger range, naturally, the chance for repetition drops.

hope this helps...
**SM84CE wrote:**

**XpointView22 wrote:**

Can a function be added to generate rando numbers in a given inclusive or exclusive interval without repeating?

the newest ICE has randInt(A,B), but it might repeat, so you might want to try some sort of loop to see if the new randInt that was generated is the same as any others, if it is, then repeat the randInt until it isn't the same as any existing ones. I'm sure someone else here might be able to "codify" this, but if you have a larger range, naturally, the chance for repetition drops.

hope this helps...

Depending on the range and how many random values you want in that range, a more efficient method might be to write all the different values in your range into a buffer and then "scramble" the order of the data in the buffer.

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

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