Sorry to bother you but I want to read from different tables but changing the table name ie tableto read=table xxx or any table doesn't seem to work.
dofortemp=100to200lander_x=temp:lander_y=tempsprite_x=lander_x:sprite_y=lander_y:sprite_width=lander_width:sprite_height=lander_heightend_data=lander_width*lander_heighttabledata=lander; !!! WHICH TABLE NOT WORKING !!!!sprite(sprite_x,sprite_y);draw spritewait100msnexttemploop;subsprite(sprite_x,sprite_y);fills box with sprite dataSetAddressWindow_ILI9341(sprite_x,sprite_y,sprite_x+sprite_width-1,sprite_y+sprite_height-1)forptr=0toend_data;(sprite_width * sprite_height)ReadTabletabledata,ptr,pixel;!!!!! TABLEDATA CAN NOT BE VARIABLE!!!SendWord_ILI9341pixelnextptrendsub;tablelanderspritedatavalues
so how to use a viable for tables ie table to use = table xyz then read table xyz and although the sub uses table to use it uses table xyz
Is an array same memory as a table? I was thinking of an alternative of storing sprite data
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Should I use a var that makes it use one sub and table or another sub and table?
It was for a V flame under the lander sprite but found line works ok, just 2 short lines.
Coming along nice. The sprite is surrounded by background pixels and only moves one pixel at a time so is self erasing,just plot it and the V flame is only plotted when the thrust key is pressed else it gets erased by the sprite. Neat. Simulate gravity and left/right momentum next.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes, use a variable, it doesn't take up much memory for an if around the readtable.
e.g. I used this to test and it worked correctly.
tablexx1,2,6endtabletableyy3,4,9endtabledimaa,ii,jjclsforii=1to2' test 2 tablesforjj=1to3ifii=1thenreadtablexx,jj,aaelseifii=2thenreadtableyy,jj,aaendifprintdataxaanextnextdo:loopsubprintdatax(inval)printinval:print""endsub
If you look at the asm, the if portion looks like this:
Thanks Jim. So there's no readtable variable. I'll use if then.
Previously I had two tables same size, 256 bytes each and used a pointer to read the data.
0 to 256 for first table and add 256 to the pointer to read second table.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
As long as the tables are sequencial they can have different names to.
The following needs explaining but is probably explained somewhere,
is a table part of the program code or it it stored in ram like an array?
Is it faster to read an array than a table ie clock cycles?
Cheers.
ps Anobiums SetAddressWindow_ILI9341 ( sprite_x,sprite_y,sprite_x + sprite_width-1,sprite_y + sprite_height - 1 ) is nice,must use hardware
Last edit: stan cartwright 2020-02-05
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You can't rely on that. If the second table won't fit within the current page boundary, it will probably be put in the next page. Not sure, you'd have to ask Evan or Hugh or ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Which chip? AVR/18F have different memory architectures - so they perform differently to 16F and the others.
Array v Tables. Again what chip? Array use RAM and Table use PROGMEM. I have never tested the performance of array v tables but as stated - it will be dependent on the chip architecture. If some has time - test.. it would be interesting.
Tables as Byte or Words. This should be tested. Is it faster to use a Table of Bytes or a Table of Words. Testing would yield some insights.
Test and find out.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
For this demo I chose a pic18f25k22 at 3.3V.
It's not as versatile as a 328p imho but useful...and no setting up pins.
I'm not very good at reading the pic data sheets or any data sheets really.
Gcb dumbs down all that stuff for me.
I had the idea that ram was continuous not paged and if the program/chip could handle it then maybe faster.
meanwhile the demo now has 3 switches left,vertical,right thrust and the flame is only lit when the button is pressed and auto erased by the sprite when not.
Anobium .hi, many things to test like when does using pset to plot xnumber of pixels become faster or slower than using line xnumber of pixels. one of the things I'm testing.
I think the sprite method of filling a window better than a horizontal loop of pixels inside a vertical loop of rows. like a raster scan using pset.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sorry to bother you but I want to read from different tables but changing the table name ie tableto read=table xxx or any table doesn't seem to work.
so how to use a viable for tables ie table to use = table xyz then read table xyz and although the sub uses table to use it uses table xyz
Is an array same memory as a table? I was thinking of an alternative of storing sprite data
Should I use a var that makes it use one sub and table or another sub and table?
It was for a V flame under the lander sprite but found line works ok, just 2 short lines.
Coming along nice. The sprite is surrounded by background pixels and only moves one pixel at a time so is self erasing,just plot it and the V flame is only plotted when the thrust key is pressed else it gets erased by the sprite. Neat. Simulate gravity and left/right momentum next.
Yes, use a variable, it doesn't take up much memory for an if around the readtable.
e.g. I used this to test and it worked correctly.
If you look at the asm, the if portion looks like this:
so not many bytes.
Last edit: Jim giordano 2020-02-05
Thanks Jim. So there's no readtable variable. I'll use if then.
Previously I had two tables same size, 256 bytes each and used a pointer to read the data.
0 to 256 for first table and add 256 to the pointer to read second table.
That seems like a quite usable solution. Put it all in one table and just read from where you want. No ifs required.
As long as the tables are sequencial they can have different names to.
The following needs explaining but is probably explained somewhere,
is a table part of the program code or it it stored in ram like an array?
Is it faster to read an array than a table ie clock cycles?
Cheers.
ps Anobiums SetAddressWindow_ILI9341 ( sprite_x,sprite_y,sprite_x + sprite_width-1,sprite_y + sprite_height - 1 ) is nice,must use hardware
Last edit: stan cartwright 2020-02-05
You can't rely on that. If the second table won't fit within the current page boundary, it will probably be put in the next page. Not sure, you'd have to ask Evan or Hugh or ?
Its going to depends
Which chip? AVR/18F have different memory architectures - so they perform differently to 16F and the others.
Array v Tables. Again what chip? Array use RAM and Table use PROGMEM. I have never tested the performance of array v tables but as stated - it will be dependent on the chip architecture. If some has time - test.. it would be interesting.
Tables as Byte or Words. This should be tested. Is it faster to use a Table of Bytes or a Table of Words. Testing would yield some insights.
Test and find out.
For this demo I chose a pic18f25k22 at 3.3V.
It's not as versatile as a 328p imho but useful...and no setting up pins.
I'm not very good at reading the pic data sheets or any data sheets really.
Gcb dumbs down all that stuff for me.
I had the idea that ram was continuous not paged and if the program/chip could handle it then maybe faster.
meanwhile the demo now has 3 switches left,vertical,right thrust and the flame is only lit when the button is pressed and auto erased by the sprite when not.
Anobium .hi, many things to test like when does using pset to plot xnumber of pixels become faster or slower than using line xnumber of pixels. one of the things I'm testing.
I think the sprite method of filling a window better than a horizontal loop of pixels inside a vertical loop of rows. like a raster scan using pset.