Completed Script
// Append strings "Product Name:" and "Price".
_strset(databuf0, "") // Initialize data buffer 0.
_strset(databuf0, "Product Name:") // Store text to data buffer 0.
_bin2decasc(databuf1, [w:[#MEMLINK]0500]) // Convert value to text and store in data buffer 1.
_strcat(databuf0, databuf1) // Append data buffer 1 to end of data buffer 0.
_strset(databuf1, "") // Initilalize data buffer 1.
_strset(databuf1, "Price") // Store text to data buffer 1.
_strcat(databuf0, databuf1) // Append data buffer 1 to end of data buffer 0.
// Initilialize temporary address.
[t:0001]=0
[t:0002]=0
// Text strings stored in internal memory in consecutive word units. Store again in byte units (30 characters).
loop()
{
[w:[#MEMLINK]2000]#[t:0002]=[w:[#MEMLINK]1000]#[t:0001]>>8 // Move top byte to bottom byte and store.
[w:[#MEMLINK]2001]#[t:0002]=[w:[#MEMLINK]1000]#[t:0001]&0xFF // Delete top byte and store in next address.
[t:0001]=[t:0001]+1 // Address offset + 1.
[t:0002]=[t:0002]+2 // Address offset +2.
if([t:0001]==15) // Store 2 bytes in 2 words. Repeat 15 times.
{
break
}
endif
}
endloop
_ldcopy(databuf2, [w:[#MEMLINK]2000], 30) // Store internal memory 2000 to 2029 to data buffer as text string.
// Add text "Product Name:"
_strset(databuf1, "") // Initialize data buffer 1.
_strset(databuf1, "Product Name:") // Store text in data buffer 1.
_strcat(databuf1, databuf2) // Append data buffer 2 to end of data buffer 1.
// Add price to product name.
_strcat(databuf1, databuf0) // Append value in data buffer 0 to data buffer 1.
Function Summary
Append the text "Price:" and "Yen" to the price data in internal memory 0500.
Change the data format in order to send print data to the printer. Divide the string data (Product Name) stored sequentially in internal memory 1000 into byte units, and store into internal memory 2000 to 2030 as low order byte string data.
Use the function _ldcopy and store the data in databuf2 in order of the consecutive word address's lowest byte.
The _ldcopy function takes data stored as Words, and stores only the lower order bytes in the buffer, while higher order byte data is ignored.
Add the strings "Product Name:" and "Price" to databuf2.