Start_location - is the start address of the block to be copied (0-511).
Block_size - is the number of bytes to be copied to RAM (1-512).
Copy the lookup table to RAM. Each address is copied directly, i.e. table address 0 is copied to RAM address 0 (which is also byte variable b0).
The tablecopy command may be used to rapidly copy the table data to RAM in user defined 'blocks'. This is useful, for instance, to preload string data into RAM. Each copy is made to exactly the same address in RAM, so that it can then be accessed via peek or @bptr.
The copy will cease if the maximum address of the table (511) is exceeded.
Note that the lower bytes of RAM are always shared with the byte variables. Therefore copying locations 0,1,2 etc. will overwrite b0,b1,b2 etc.
When a data table is defined in a program code slot with the X2 parts, the data table is accessible only to the program within that slot. Each program slot using tablecopy commands should have its own 'table' defined.
Please note the 'tablecopy' command is only supported for 18M2 firmware D.x (PICAXE chips labelled 18M2+) and is not available for use with 18M2 firmware 2.x (PICAXE chips labelled 18M2).
The PICAXE compiler will syntax check code for an 18M2 as correct when using the 'tablecopy' command but will generate an error when an attempt is made to download into an 18M2 with firmware 2.x.
Submit Your Own Code!
You must be logged in to submit code examples. Login now.