Name:
tablecopy
Syntax:

TABLECOPY start_location,block_size

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).

Description:

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.

18M2 Firmware

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.

Applies To:
14M2, 20M2, 18M2+
See Also:
Related Create:
    Share:
    Print:

    Copy data from the table

    Copy data values from a table into variables then report the values in those variables

    Code Example:
    	table 0,("Hello World")		; save values in table
    
    main:	tablecopy 0,5			; copy addresses 0,1,2,3,4
    	debug				; show b0-b4 on screen
    	goto main			; loop
    Copy Code Submit an Example

    Submit Your Own Code!

    You must be logged in to submit code examples. Login now.

    Comments

    • Login to leave a comment.