Page 1 of 1

Anyone know how to do this with Z80ASM?

Posted: Wed Oct 23, 2013 2:43 pm
by Rink
I'm hoping someone here is familiar with Interlogic's Z80ASM assembler (distributed with z88dk).

I need to fill a space from the current instruction count to the next 255-byte block (e.g. $0100, $0200, $0300 etc. etc.) but all my attempts to create expressions and use defs or .fill etc. are resulting in syntax errors.

Any help would be seriously appreciated.

Re: Anyone know how to do this with Z80ASM?

Posted: Wed Oct 23, 2013 2:56 pm
by stefano
You can put in a filler with size coputed using a label, i.e. for an interrupt handler in ROM you coud do:

(...)

dummy_label:
defs 56-dummy_label

if (ASMPC<>$0038)
defs CODE_ALIGNMENT_ERROR
endif

Re: Anyone know how to do this with Z80ASM?

Posted: Wed Oct 23, 2013 3:12 pm
by Rink
Brilliant! Thank you very much.

It was the use of a dummy label that I didn't think of and it has given me something workable.

Re: Anyone know how to do this with Z80ASM?

Posted: Wed Oct 23, 2013 4:13 pm
by PokeMon
Normally this is done with the "align" statement, followed with the desired boundary.

align $100

would fill with the necessary bytes (nop) up to next address divideable by $100 without any rest. ;)

Re: Anyone know how to do this with Z80ASM?

Posted: Wed Oct 23, 2013 4:19 pm
by Rink
PokeMon wrote:Normally this is done with the "align" statement, followed with the desired boundary.
Unfortunately, the assembler doesn't like that one.

Don't ask me. :D