Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HLASM plugin does flag some long displacement (RXY) intructions as error #38

Closed
cybersorcerer opened this issue Apr 24, 2020 · 5 comments · Fixed by #39
Closed

HLASM plugin does flag some long displacement (RXY) intructions as error #38

cybersorcerer opened this issue Apr 24, 2020 · 5 comments · Fixed by #39
Labels
bug Something isn't working
Milestone

Comments

@cybersorcerer
Copy link

cybersorcerer commented Apr 24, 2020

The instructions marked as bold are recognized as Syntax error by the Plugin. The error description is: Error at LAY instruction: value of address Operand displacement value must be between -2048 and 2047.
Example:

DoItAgain MVCOS 0(R14),0(R2),R10 Move data to output area
LAY R2,4096(,R2) Prepare source > 4 K
LAY R14,4096(,R14) Prepare target for > 4k
AHI R10,-4096 Check if bytes left
JP DoItAgain

There are two Problems with this.

  1. The error would be correct if i had something like LA R2,4096 BUT the range in the error message i.e. -2048 and 2047 is wrong cause LA does not allow signed values. So if i had something like LA R2,-100(,R2) in my Code, the Plugin would be happy but HLASM would throw an "Invalid displacement" error, cause a 12 Bit displacement has to be between 0 and 4095.

  2. The z990 processors support “long displacement (20-Bit)” RX-format instructions (RXY-a), with a displacement field range of -524288 to +524287 (± 0.5 Megabyte). All of the z/Architecture RX-format instructions introduced by the z900 are “long displacement” except for the floating point instructions. There are “Y” (long displacement) forms of most of the ESA/390 RX-format instructions except branch and as already mentioned floating Point intructions. Examples: AY, AHY, LY, LAY, STY

So the LAY instructions in the above example are perfectly valid and should never be flagged as error. For 12-Bit displacement intructions the error message text is wrong.

@michalbali256
Copy link
Contributor

Thank you for nicely described bug!
I have already found it in code - unfortunately all 20 bit displacements were validated as if they were signed 12 bit displacements.

@michalbali256 michalbali256 linked a pull request Apr 24, 2020 that will close this issue
@michalbali256 michalbali256 added the bug Something isn't working label Apr 24, 2020
@michalbali256 michalbali256 added this to the 0.10.1 milestone Apr 24, 2020
@cybersorcerer
Copy link
Author

cybersorcerer commented Apr 24, 2020

That was fast Michal, thanks! Found some other quirks today but i thought i collect them first and open one Report with what i have found so far. Did you also fix the wrong error message text? 12-Bit displacement have Always to be positiv numbers with a valid range of 0 to 4095.

@michalbali256
Copy link
Contributor

Yes, the message is generated from the characteristic of the operand: number of bits and whether it is signed or unsigned.

@cybersorcerer
Copy link
Author

Perfect!

@fox0r fox0r modified the milestones: 0.10.1, 0.11.0 May 11, 2020
@michalbali256
Copy link
Contributor

The issue should be resolved by 0.11.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants