Skip to content
This repository was archived by the owner on Jan 26, 2022. It is now read-only.
TheLastMillennial edited this page Apr 23, 2019 · 9 revisions

Lists in ICE are very different to lists in TI-BASIC, mainly because of ICE's pointers. You can no longer store data directly into lists using {1,2,3,4,5}→L1 and instead have to use the Copy( and/or CopyData( commands to load data into lists. CopyData( allows you to copy data from one place to another (hence the name), and when used with lists can be used to emulate TI-BASIC list syntax. The syntax for CopyData( is:

CopyData(DESTINATION,SIZE,DATA1,DATA2...) 

With DESTINATION being a memory address, and SIZE being the size in bytes for each entry, all other arguments are the data that is to be copied into the destination. Using this to store {1,2,3,4,5} into L1 would look like this:

CopyData(L1,3,1,2,3,4,5

This has one small detail you'll need to understand. The second argument in the example above, 3, says that each entry will be copied as a 3-byte number. The size of each entry in a list is very important to how you will access data from a list. There are many different ways to access data from a list, but these are the main 5:

  • L1(X)
  • {L1+X}
  • ***{L1+X}
  • **{L1+X}
  • *{L1+X}

The first three work exactly the same way and are just different ways of typing it out, they access the Xth byte, the Xth+1 byte, and the Xth+2 byte, and return them as a single number. This means that if your list has 3-byte entries in it and you want to access one of those 3-byte entries, you want to use a multiple of 3 in your command. So let's say you previously used the example command, CopyData(L1,3,1,2,3,4,5), accessing your list after this would look like:

TI-BASIC syntax ICE syntax 1 ICE syntax 2 Result
L1(0) {L1+0} ***{L1+0} All return 1.
L1(3) {L1+3} ***{L1+3} All return 2.
L1(6) {L1+6} ***{L1+6} All return 3.
L1(9) {L1+9} ***{L1+9} All return 4.
L1(12) {L1+12} ***{L1+12} All return 5.

Notice how the numbers you are putting inside the parentheses are multiples of 3, starting at 0. This is because the L1(X) method of accessing a list returns 3-byte numbers. If you were to use CopyData(L1,2,1,2,3,4,5) instead of the previous command, you would then store that data into list 1 as 2-byte entries, and then have to use:

ICE syntax Result
**{L1+0} Returns 1.
**{L1+2} Returns 2.
**{L1+4} Returns 3.
**{L1+6} Returns 4.
**{L1+8} Returns 5.

Now notice that to access 2-byte data from a list, you need to use curly brackets with two asterisks before them, and multiples of 2, starting at 0. Lastly, if you were to use CopyData(L1,1,1,2,3,4,5) instead of the previous command, you would then store that data into list 1 as 1-byte entries, and then have to use:

ICE syntax Result
*{L1+0} Returns 1.
*{L1+1} Returns 2.
*{L1+2} Returns 3.
*{L1+3} Returns 4.
*{L1+4} Returns 5.

For that list of 1-byte data, you need to use curly brackets with one asterisk before them, and multiples of 1, starting at 0. The point here is, when storing data in 3-byte, you need to use multiples of 3 starting at 0 to access data with L1(X), {L1+X}, or ∗∗∗{L1+X}. When storing data in 2-byte, you need to use multiples of 2 starting at 0 to access data with ∗∗{L1+X}. When storing data in 1-byte, you need to use multiples of 1 starting at 0 to access data with ∗{L1+X}. If in doubt, just use 3-byte values as they will give you the largest range of values (0-16777215), but if you’re an optimizing type of person, use the smallest byte sizes anywhere you can, just remember:

  • 3-byte = 0 - 16777215
  • 2-byte = 0 - 65535
  • 1-byte = 0 - 255

If you're still confused on how L1(X) works, remember that X is the offset, in bytes, from the beginning of the list. So because L1(X) accesses 3-byte values, you need to use offsets of multiples of 3, otherwise you'll be reading 3 bytes in between two values.

Note: each list variable has a total size limit of 2000 bytes.

Clone this wiki locally