Is the disassembler discontinued
Is the disassembler discontinued
I have discovered a bug in the disassembler and I was just wondering if the disassembler is still active or discontinued, and whether I need to submit a new issue on github?
The issue is that the disassembler is producing the following statements:
LD (IX+$04),$00
LD (IX+$04),$01
LD (IX-$01),$02
whereas it should be outputting:
LD (IX+$00),$04
LD (IX+$01),$04
LD (IX+$02),$0FF
(the operands have been flipped)
Thanks,
Mike.
The issue is that the disassembler is producing the following statements:
LD (IX+$04),$00
LD (IX+$04),$01
LD (IX-$01),$02
whereas it should be outputting:
LD (IX+$00),$04
LD (IX+$01),$04
LD (IX+$02),$0FF
(the operands have been flipped)
Thanks,
Mike.
Re: Is the disassembler discontinued
Which disassembler are you referring to? I've just checked z88dk-dis and it seems to be handling these correctly.
Re: Is the disassembler discontinued
I don't think it's ever been broken which is odd.
Code: Select all
% cat test.asm
ld (ix+10),2
ld (ix-20),$dd
% hexdump test.bin
0000000 dd 36 0a 02 dd 36 ec dd
% z88dk-dis test.bin
ld (ix+$0a),$02 ;[0000] dd 36 0a 02
ld (ix-$14),$dd ;[0004] dd 36 ec dd
Re: Is the disassembler discontinued
could Mike be disassembling zx81 code? That -ixiy swap trick is sometimes confusing.
Re: Is the disassembler discontinued
Ok, sorry for the delay in getting back to this. These are my steps. My assembly file is as follows:
I assemble it using the command:
This produces a test.bin file, which I disassemble using:
Which produces this:
Unfortunately, as you can see, the opcodes are swapped. My z88dk install is dated 24/03/2021. I don't recall if I downloaded my binaries or built from source code.
Strange. Thanks.
Code: Select all
LD (IX+$00),$04
LD (IX+$01),$04
LD (IX+$02),$0FF
Code: Select all
z88dk-z80asm -mz80 -b test.asm
Code: Select all
z88dk-dis -mz80 test.bin
Code: Select all
ld (ix+$04),$00 ;[0000] dd 36 00 04
ld (ix+$04),$01 ;[0004] dd 36 01 04
ld (ix-$01),$02 ;[0008] dd 36 02 ff
Strange. Thanks.
Re: Is the disassembler discontinued
I rolled back to March to see if I could reproduce this but unfortunately not. Given that there's been no changes since then I'm not too surprised about that.
I've spent a while staring at this line:
And I can only think that we're fallen in the void that is "undefined behaviour". In fact, I'm pretty certain it's that: the order of the evaluation of the arguments is implementation specific. In this case state is mutated (i.e PC incremented) by each of the handle_ functions.
So, I'll fix that, but important questions: CPU, OS and compiler that you've spotted this on.
I've spent a while staring at this line:
Code: Select all
BUF_PRINTF("%-8s%s,%s", "ld", handle_register8(state, y,opbuf1,sizeof(opbuf1)), handle_immed8(state, opbuf2, sizeof(opbuf2)));
So, I'll fix that, but important questions: CPU, OS and compiler that you've spotted this on.
Re: Is the disassembler discontinued
hello,
as nono i like to try and i have an identical outcome
i work with linux debian 10 which natively uses gcc 8.3.0,posix.
as nono i like to try and i have an identical outcome
Code: Select all
$ z88dk-z80asm -mz80 -b test.asm
$ z88dk-dis -mz80 test.bin
ld (ix+$04),$00 ;[0000] dd 36 00 04
ld (ix+$04),$01 ;[0004] dd 36 01 04
ld (ix-$01),$02 ;[0008] dd 36 02 ff
Code: Select all
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/8/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 8.3.0-6' --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-8 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 8.3.0 (Debian 8.3.0-6)
Re: Is the disassembler discontinued
This is working now in my environment. (as you have probably guessed!)
Thanks again for the fix.
Thanks again for the fix.