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

Assembler accepts instructions like cmp [mem], imms8 without size specified #17

Open
ecm-pushbx opened this issue Apr 11, 2024 · 1 comment

Comments

@ecm-pushbx
Copy link

G:\>debug
-a
088A:0100 cmp [100], 12
088A:0105
-r
AX=0000 BX=0000 CX=0000 DX=0000 SP=FFFE BP=0000 SI=0000 DI=0000
DS=088A ES=088A SS=088A CS=088A IP=0100 NV UP EI PL NZ NA PO NC
088A:0100 833E000112        CMP     WORD PTR [0100],+12            DS:0100=3E83
-

MSDebug does not accept this instruction.

This is caused by OP_IMMS8 clearing the VAR_SIZ_NEED flag unconditionally:

DOS-debug/src/LINEASM.INC

Lines 2017 to 2020 in ef6ef10

;--- OP_IMMS8 - Sign-extended immediate byte (PUSH xx)
ao41:
and [ai.varflags],not VAR_SIZ_NEED ;added for v1.09. Ok?

This makes it so that the word size of the memory operand is assumed as there is a form with r/m16 and OP_IMMS8 immediate operand. The flag should actually only be cleared for push imm8 albeit it doesn't cause any problems to clear it for imul with an imm8 operand either.

lDebug introduced the OP_IMMS8_EXTEND for this purpose, it simply doesn't clear this flag: https://hg.pushbx.org/ecm/ldebug/rev/c40bd4d0c8e2 It was introduced in 2021 specifically to fix this bug: https://hg.pushbx.org/ecm/ldebug/rev/e720cb74a547

@Baron-von-Riedesel
Copy link
Owner

Thanks, added this as regression since v1.09 to the todo list.

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

2 participants