Anyone know how to do this with Z80ASM?

Any discussions related to the creation of new hardware or software for the ZX80 or ZX81
Post Reply
Rink
Posts: 165
Joined: Wed Jun 27, 2012 5:48 pm

Anyone know how to do this with Z80ASM?

Post 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.
User avatar
stefano
Posts: 542
Joined: Tue Dec 11, 2012 9:24 am
Contact:

Re: Anyone know how to do this with Z80ASM?

Post 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
Rink
Posts: 165
Joined: Wed Jun 27, 2012 5:48 pm

Re: Anyone know how to do this with Z80ASM?

Post 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.
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: Anyone know how to do this with Z80ASM?

Post 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. ;)
Rink
Posts: 165
Joined: Wed Jun 27, 2012 5:48 pm

Re: Anyone know how to do this with Z80ASM?

Post 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
Post Reply