mirror of
https://github.com/irmen/prog8.git
synced 2024-11-29 17:50:35 +00:00
removed restriction on array indexer expression again from docs and code... :)
This commit is contained in:
parent
b9706a180b
commit
74b5124a42
@ -254,14 +254,6 @@ Array types are also supported. They can be made of bytes, words or floats, stri
|
||||
This means byte arrays should be <= 256 elements, word arrays <= 128 elements, and float
|
||||
arrays <= 51 elements.
|
||||
|
||||
.. note::
|
||||
To avoid slow and complex assembly code generation, Prog8 currently enforces some limits on
|
||||
what you can index the array with. *It is not possible to use an arbitrary expression/calculation as an index value*.
|
||||
You can use a numerical constant value or a single variable as an index value, and simple expressions such as
|
||||
"i+1" or "i*2". If you need more complex indexing expressions, the compiler refuses the statement and
|
||||
will suggest to use a temporary indexer variable instead.
|
||||
|
||||
|
||||
You can split an array initializer list over several lines if you want.
|
||||
|
||||
Note that the various keywords for the data type and variable type (``byte``, ``word``, ``const``, etc.)
|
||||
|
@ -166,8 +166,7 @@ main {
|
||||
else
|
||||
c64.SPRPTR[i] = $2000/64 ; small ball
|
||||
|
||||
ubyte scolor = (zc>>13) as ubyte + 4
|
||||
c64.SPCOL[i] = spritecolors[scolor] ; further away=darker color
|
||||
c64.SPCOL[i] = spritecolors[(zc>>13) as ubyte + 4] ; further away=darker color
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,8 +43,7 @@ main {
|
||||
|
||||
|
||||
while multiple < len(sieve) {
|
||||
ubyte number = lsb(multiple)
|
||||
sieve[number] = true
|
||||
sieve[lsb(multiple)] = true
|
||||
multiple += candidate_prime
|
||||
}
|
||||
return candidate_prime
|
||||
|
@ -314,7 +314,6 @@ market {
|
||||
ubyte[17] units = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 0]
|
||||
str[17] names = ["Food", "Textiles", "Radioactives", "Slaves", "Liquor/Wines", "Luxuries", "Narcotics", "Computers",
|
||||
"Machinery", "Alloys", "Firearms", "Furs", "Minerals", "Gold", "Platinum", "Gem-Stones", "Alien Items"]
|
||||
str[3] unitnames = ["t", "kg", "g"]
|
||||
|
||||
ubyte[17] current_quantity = 0
|
||||
uword[17] current_price = 0
|
||||
@ -360,8 +359,11 @@ market {
|
||||
util.print_10s(current_price[ci])
|
||||
txt.print(" ")
|
||||
txt.print_ub(current_quantity[ci])
|
||||
ubyte unit = units[ci]
|
||||
txt.print(unitnames[unit])
|
||||
when units[ci] {
|
||||
0 -> txt.chrout('t')
|
||||
1 -> txt.print("kg")
|
||||
2 -> txt.chrout('g')
|
||||
}
|
||||
txt.print(" ")
|
||||
txt.print_ub(ship.cargohold[ci])
|
||||
txt.chrout('\n')
|
||||
|
Loading…
Reference in New Issue
Block a user