z80asm: difference in 'SET b,(IY+d)' binary result #266
-
|
Hi, Applying formats like "(IY+-d)" works well for the LD instructions, but for the SET/RES instructions the result isn't equal to the original binary. Original disassembly: Z80asm code: Result: Here the third byte differs. How can I fix this? Greetings & thank you for z8pack and z80asm, Fred Jan Kraan |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
|
.fr-emoticon.fr-emoticon-img {
background-repeat: no-repeat !important;
font-size: inherit;
height: 1em;
width: 1em;
min-height: 20px;
min-width: 20px;
display: inline-block;
margin: -0.1em 0.1em 0.1em;
line-height: 1;
vertical-align: middle;
}
.fr-emoticon {
font-weight: normal;
font-family: "Apple Color Emoji","Segoe UI Emoji","NotoColorEmoji","Segoe UI Symbol","Android Emoji","EmojiSymbols";
display: inline;
line-height: 0;
}
Hello Fred,
the signedness of the IX/IY+d instructions is well documented, Zilog and Mostek Z80 datasheets mention this.
I world suggest to use z80pack 1.38-dev available from Github: https://github.com/udo-munk/z80pack (https://github.com/udo-munk/z80pack" id="isPasted" rel="noopener noreferrer" target="_blank)and checkout the dev branch. There assembler and disassember and a lot of other things are much improvedand should fix your problem.
Best regards,Udo
…-----ursprüngliche Nachricht-----
Von: ***@***.*** ***@***.***" target="_blank)
Gesendet: 02.03.2023 09:15 Uhr
An: ***@***.*** ***@***.***" target="_blank)
Kopie: ***@***.*** ***@***.***" target="_blank)
Betreff: [udo-munk/z80pack] z80asm: difference in 'SET b,(IY+d)' binary result (Discussion #266)
Hi,
In a disassembly I want to convert to an asm-file for Z80pack/z80asm containing (IX+d) type instructions, at first I was confused about the signedness of the 'd' value, which isn't very well documented.Applying formats like "(IY+-d)" works well for the LD instructions, but for the SET/RES instructions the result isn't equal to the original binary.Original disassembly:4E0E FD CB E9 D6 SET 2,(IY+E9) ;...4E12 FD CB ED B6 RES 6,(IY+ED) ;...Z80asm code: SET 2,(IY+-019h) ;SET 2,(4369) RES 6,(IY+-01Dh) ;RES 6 , (436D) => SYSTEM BC=NResult:4e0e fd cb e7 d6 3914 3914 SET 2,(IY+-019h) ;...4e12 fd cb e3 b6 3915 3915 RES 6,(IY+-01Dh) ;...Here the third byte differs. How can I fix this?Greetings & thank you for z8pack and z80asm,Fred Jan Kraan—
Reply to this email directly, view it on GitHub (#266" target="_blank), or unsubscribe (https://github.com/notifications/unsubscribe-auth/AIYAKFHGIDUGSAHAJTCSRU3W2BJJDANCNFSM6AAAAAAVNBNFNE" target="_blank).
You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AIYAKFGUDV4LAFW6CW64HSTW2BJJDA5CNFSM6AAAAAAVNBNFNGWGG33NNVSW45C7OR4XAZNKIRUXGY3VONZWS33OVJRW63LNMVXHIX3JMTHAASYIJQ.gif" alt="" class="fr-fic fr-dii" width="1" height="1">Message ID: ***@***.***>
-----ursprüngliche Nachricht Ende-----
|
Beta Was this translation helpful? Give feedback.
-
|
Hello Fred, The displacement values you use in your assembler source don't correspond to the values from the disassembly. The displacement d for indexed addressing is a two's complement number in the range -128 <= d <= 127, i.e. 080H..0FFH for -128..-1 and 000H..07FH for 0..127. To get the positive value from a byte x that represents a negative value (080H..0FFH) calculate 0100H - x (or, alternatively NOT x + 1), i.e. 0100H - 0E9H (or, alternatively NOT 0E9H + 1 = 016H + 1) = 017H and If you use these values, you get the expected third bytes. Regards, |
Beta Was this translation helpful? Give feedback.
-
|
Hello Udo, Thomas, Thank you for your fast response. @Udo: @thomas: Greetings, |
Beta Was this translation helpful? Give feedback.
-
|
Hi Thomas, The dev branch (Assembler Release 1.11-dev) does indeed work.; Somewhat close to the original (incorrect) disassembly, but working. Thank you & greetings, Fred Jan |
Beta Was this translation helpful? Give feedback.
Hi Thomas,
The dev branch (Assembler Release 1.11-dev) does indeed work.;
Somewhat close to the original (incorrect) disassembly, but working.
Thank you & greetings,
Fred Jan