clownassembler icon indicating copy to clipboard operation
clownassembler copied to clipboard

Assembler pads output with zeros when setting ORG.

Open daschewie opened this issue 3 years ago • 3 comments

Issue

Assembling the following with clownassembler -i hello.s -o hello.pgx -l hello.lst produces a 64k binary pre-padded with zeros:

;;;
;;; Sample PGX Program
;;;

                org $010000

                dc.b "PGX", $02
                dc.l start

start:          move.l #$13,d0                      ; sys_chan_write
                clr.l d1                            ; Channel #0
                move.l #greet,d2                    ; Pointer to message
                move.l #greet_end-greet+1,d3        ; Length of message
                trap #15

done:           clr.l d0                            ; sys_exit
                clr.l d1                            ; Return value = 0
                trap #15

greet:          dc.b "Hello, world!"
greet_end:      dc.b 0

The same code assembled with vasmm68k_mot -Fbin -L hello.lst -o hello.pgx hello.s produces a 42b binary.

Request

Could an option be added to strip the pre-padding?

daschewie avatar Nov 15 '23 22:11 daschewie

Thanks for finding this. asm68k, which is the assembler that this aims from drop-in compatibility with, avoids pre-padding too, so my assembler not doing this is a bug.

Clownacy avatar Nov 16 '23 08:11 Clownacy

Has this bug been reintroduced? When I assemble code with an ORG directive, the output file is padded with zeroes. Plus the fix to semantic.c in the commit that originally repaired it seems to have gone.

kbeecher avatar Feb 23 '26 20:02 kbeecher

Yes, I think this was reintroduced when p2bin was added.

Clownacy avatar Feb 23 '26 21:02 Clownacy