Compiler version: 12.2017
When doing some enhancements on the compiler, I had to assign a 20 byte string (a variable identifier) to a 32 byte string (error information of the symbol scanner). "String" at the moment is simply an abbreviation for "array of char", BTW.
But this was not possible until now; the compiler showed an error P129 ("Type conflict of operands").
I tried to make such assignments possible (shorter strings to longer strings); the longer target strings should be filled with blanks.
It turned out that the easiest way will be to create a new P-Code instruction MFI (memory fill). I planned this instruction to have a length argument; it should fetch an address and a char from the stack and fill the storage from the given address with the char pattern, using the (fixed) length from the instruction.
Example:
|
When I started to use the new P-Code in assignments involving different lengths, it turned out that another additional variant of MFI is needed. The two addresses for the MOV instruction are already on the stack (target first, then source address). Then, before MFI, the Blank (the initialization pattern) is loaded on the stack. The second variant of the MFI instruction should then take the target address from the 3rd position of the stack (the 2nd stack position, which is the source address, should be ignored), and after execution of MFI, only the initialization pattern should be popped; the two addresses should remain on the stack for the subsequent MOV instruction.
To control this, a negative length is specified on MFI.
Example:
|
Using the new MFI instruction, assigning shorter strings to longer strings now is possible without problems; see the following example:
|
Warning: this new feature is not yet available for download; it is only present in the working version and only for Windows, at the moment (11.2017).