assembler creating twice the output

Other misc things
Post Reply
codifies
New member
Posts: 7
Joined: Sat Jan 30, 2016 5:45 pm

assembler creating twice the output

Post by codifies »

given the (very) simple test

Code: Select all

    ld      a,0x12
    ld      b,0x23
    add     a,b
    ld      (0x200),a
    halt
When I execute

Code: Select all

z88dk/bin/z80asm -b test1.bin test1.asm
I get:

Code: Select all

00000000  3e 12 06 23 80 32 00 02  76 3e 12 06 23 80 32 00  |>..#.2..v>..#.2.|
00000010  02 76                                             |.v|
it's being repeated for some reason ? (should only be 9 bytes...)
alvin
Well known member
Posts: 1872
Joined: Mon Jul 16, 2007 7:39 pm

Post by alvin »

Code: Select all

z88dk/bin/z80asm -b test1.bin test1.asm
The -b does not take a parameter; it only means "make a binary" as opposed to an object file. So I think what is happening is z80asm is assembling "test1.asm" and is generating "test1.bin" then it is putting together test1.bin with the result of assembling test1.asm, which is also test1.bin, and you get two copies of test1.bin.

It might be a bit strange but z80asm will accept a list of asm files and object files when generating a binary so I guess raw binaries are acceptable too. Since there's nothing to do with a raw binary it just gets tacked onto the result.

The correct assemble line should be:

z80asm -b -o=test1.bin test1.asm

I have always found z80asm's command line parsing a bit finicky (Paulo is working on z80asm now and will correct this eventually). I always put the options before the source files list and usually there isn't a space between an option and its argument.
codifies
New member
Posts: 7
Joined: Sat Jan 30, 2016 5:45 pm

Post by codifies »

lol - odd, thanks
Post Reply