Re: A83: Out of Range.
[Prev][Next][Index][Thread]
Re: A83: Out of Range.
In a message dated 2/7/00 2:29:59 PM Eastern Standard Time, david@acz.org
writes:
> No, they do. He was explaining how they would be used to store jump
> addresses.
>
> A byte is only enough to hold a relative address. A word is enough to
store
> an absolute address.
>
> However, doing a '.db exit' will NOT store the relative address. Relative
> to what? There is no way for the assembler to tell. It will attempt to
> store the absolute address and give a warning (at least it should!) that
> there is unused data. If you really need to store a relative address, it
> can be done as follows:
>
> Label =$+1
> jr 0
>
> .db Exit-Label
Actually that would be one byte off because it offsets from the start of the
opcode. You'd need to do it like this:
ld a,(address)
ld (label+1),a
label:
jr 0
address:
.db exit-label
>
> In this case, the relative address will be used for the JR below 'Label'.
>
> > > db exit = Relative address of exit (like jr)
> > > dw exit = Absolute address of exit (like jp... or ld (...),...)
> >
> > So 'db' and 'dw' have nothing to do with 'data byte' and 'data word'?
>
>
----
Jonah Cohen
<ComAsYuAre@aol.com>
http://linux.hypnotic.org/~jonah/
Follow-Ups: