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

Handling of invalid opcodes & C translation #1

Open
RockBrentwood opened this issue Sep 19, 2022 · 0 comments
Open

Handling of invalid opcodes & C translation #1

RockBrentwood opened this issue Sep 19, 2022 · 0 comments

Comments

@RockBrentwood
Copy link

RockBrentwood commented Sep 19, 2022

The "invalid opcode" message may cut off the assembly code generation in mid-stream. A better way to handle it is how DEBUG.EXE originally handled it: which is to treat it as a byte constant, e.g. "db 0fh" for opcode 0f. So, "db" should be added as a pseudo-mnemonic and the table entries set to that, instead of to "nop".

There's no reason to treat the floating point escapes specially - their format is standard, essentially the same as opcodes 84h or 85h (to cite the two most typical cases). In octal, the opcode sequences is \33D \xrm [ExtraBytes], which is "escape D" with (nominal) "register" r=0,1,2,3,4,5,6,7 and (nominal) "address mode" (x,m) and "ExtraBytes" dictated by the values of the octal digits x=0,1,2,3 and m=0,1,2,3,4,5,6,7.

Similarly, "aam" and "aad" do not really need to be treated specially, but could be treated the same way as "int P" (opcode \315, i.e. 0cdh).

I translated what you have - without any of the above-mentioned changes - straight into C. I'll fork off of your version, add the C translation, and then do continual upgrade on it from there. You're welcome to copy back the C translation (or any of its upward revisions), when I put it up.

Edit: 2023-07-18: I forked and put it up on GitHub.

RockBrentwood added a commit to RockBrentwood/Dis86 that referenced this issue Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant