retitle 423910 z80asm: Should warn when truncating values to 8 bit
severity 423910 wishlist
tags 423910 upstream
thanks

Hi,

Thanks for reporting this issue.  However, I do not agree it is a bug.

"ld b, (0xbeef)" is an instruction of the form "ld b, expression".  In
this case the expression is in parenthesis, which is strange, but not
invalid.  For example, "ld b, 2 * (1 + 4)" is also allowed.  In that
case only part of the expression is in parenthesis, so it looks less
strange (and confusing).

"ld b, (0xbeef)" is equal to "ld b, 0xbeef", but since b is an 8-bit
register, the upper bits are truncated.  That leaves
"ld b, 0xbeef & 0xff", which is "ld b, 0xef".

I agree that a warning is appropriate when this truncation takes place.
Therefore I am changing this bug into a feature request for that.

In most cases, that will lead to an unexpected warning when trying to
assemble "ld b, (0xbeef)", which should make debugging such a problem
much easier.

Thanks,
Bas Wijnen

On Tue, May 15, 2007 at 12:21:18AM +0200, Tomaz Solc wrote:
> z80asm does not report an error when an input file contains invalid
> Z80 instructions.
> 
> Example source file that demonstrates this bug:
> 
> ld a,(0xbeef) ; valid
> ld b,(0xbeef) ; invalid (no such instruction exists on Z80)
> 
> z80asm will produce the following machine code (hex dump):
> 
> 3a ef be 06 ef
> 
> "3a ef be" is the correct code for "ld a,(0xbeef)".
> 
> "06 ef" is code for "ld b,0xef".
> 
> The correct behavior would be to print an error message instead of producing
> code that does not match the source file.

-- 
I encourage people to send encrypted e-mail (see http://www.gnupg.org).
If you have problems reading my e-mail, use a better reader.
Please send the central message of e-mails as plain text
   in the message body, not as HTML and definitely not as MS Word.
Please do not use the MS Word format for attachments either.
For more information, see http://pcbcn10.phys.rug.nl/e-mail.html

Attachment: signature.asc
Description: Digital signature

Reply via email to