Since December 2016, the further development of the Pascal compiler has become much easier, because now changes to the compiler (first pass) and tests can be done all at the Windows platform. "Ports" to Hercules and VM only need to be done, if changes to the PRR format or extensions to the P-Code translator are needed, and at a very late stage. Not all changes or extensions to the compiler require extensions to the P-Code.
From some discussions on the FPC mailing list, I got the idea to support bit operations on integer operands, too.
The operations AND, OR, NOT have been extended to do bit operations, when being used with integers (an error 134 was issued before, if these "logical" operations were used with integer operands).
Another operation XOR is provided (a new reserved symbol) for exclusive or operation; it can be used with integer or boolean operands.
A new P-Code instruction XOR has been created; the P-Code instructions AND, IOR, NOT and XOR now have a type parameter, which can be B for boolean or I for integer. B defines the (old) logical operation, I is for bit operations (on integers).
Sample program:
|
You may notice the integer constants in hexadecimal notation, which were introduced with this change, too.
The output of the sample program:
|