Knowledge Base

<dest> = <X as decimal ASCII>; X=Y; Y=Z; Z=T; I = (dest < 250) ? (I+<no of chars>) : I

“Signed print X, fixed width”

Interprets the 8-bit integer number in X as an signed number in the range -128 to +127. Formats it into an ASCII (readable) character string and sends the result to the destination called for in dest.. Pops X.

The result will be 4 characters with leading spaces for numbers with fewer than 3 digits. There will be a leading minus sign for negative numbers but no leading plus sign for positive numbers.

This instruction is automatically indexed.

When printing to RAM the index register I is added to the dest address and the result is stored in that location. I is then incremented by the number of characters stored. This allows several things to be “printed” to RAM.

“Printing” to RAM is typically used for communicating with an Xwire peripheral.

The dest argument determines where the result of the instruction is directed.

Destination address (dest)Where the result is directed
0 – 249The result is stored in successive RAM locations, starting at dest. It will occupy as many RAM locations as are needed to contain the result, one location per character. For example, the result of iifPrintWFW 25,7,3 will occupy 7 bytes, RAM locations 25 through 31, because the format specifier calls for 7 digits of output. A runtime error will occur if the output over-runs the end of RAM (address 249). Using RAM as the destination is particularly useful for sending data out on Xwire.Note: These addresses are not jndexed. Instead they use I as an offset from the dest address, and automatically increment I by the number of bytes stored in RAM by the instruction.
251 – 254The result is directed to the serial port at the address given, providing the selected protocol is “User programmable”, and that the controller you are programming has a serial port at that address. This is the primary means of generating any arbitrary serial output under program control.

The interpretation of negative numbers is standard “two complement”.

Dialect exclusions: Not available in dialects before 23.

See also iiChrPrintX, iifPrintWFW, iifPrintWVW, iiHexPrintX, iisPrintXVW, iiuPrintXFW, iiuPrintXVW