cjgone wrote:
How would I go about drawing a 8x8 picture?
This is where it starts to get a bit messy I'm afraid; the best solution currently is to use
MODE 4 (for large 8x8 characters) and
VDU 23 to redefine the characters. If you wish to draw a sprite at any position on the screen, you could then use
VDU 5 to switch to drawing text at the graphics cursor position. It's all a bit slow, though (I acknowledge this!) Take a look at
TILEMAP.8xp for an example of tilemapping using redefined characters.
Quote:
And how do I make a pointer? or even an array of pointers?
Any numeric variable can be used as a pointer when using the indirection operators. You can allocate memory using
DIM.
Quote:
Anyway to define an 8bit variable to make calculations faster?
If anything it will make calculations slower as they're all done in 32-bit anyway, but yes - using
DIM and indirection:
Code:
10 DIM byte 0
20 FOR ?byte=0 TO 255
30 PRINT ?byte
40 NEXT
In terms of speed, the static variables (
A%-
Z% and
@%) are faster than ones allocated on the heap as they are at constant places in memory. It is also faster if you use variables with different first letters as variables are stored in a linked list based on their first letter; if every variable started with the letter 'x' there would be only one (long) linked list in use and that would have to be searched every time a variable was used.
tr1p1ea wrote:
I believe there are already special cases in place to take advantage of integer math if thats all you require.
As tr1p1ea astutely
pointed out, "BBC BASIC (Z80) stores integer values in real variables in a special way which allows the faster integer arithmetic routines to be used if appropriate. The presence of an integer value in a real variable is indicated by the stored exponent being zero. Thus, if the stored exponent is zero, the real variable is being used to hold an integer and the 4 byte mantissa holds the number in normal integer format".