I have the following instruction in Z80 assembly language:
JP .
It is not clear to me where it jumps.
I have the following instruction in Z80 assembly language:
JP .
It is not clear to me where it jumps.
Many assemblers provide special variables, or other symbols, that can be used to represent useful information available during the assembly process.
For example, one early assembler (this is deep in my past so I'm not sure which one it was), used $
to represent the current location being assembled into, which allowed you to do things like:
msg: ds "This is my message"
msg_sz: equ $ - msg
Given that $
was the next byte to assemble into, the symbol msg_sz
would be set to that minus the start of the message, which is effectively the size of said message. You could then load msg
into one register, msg_sz
into another, then call a function that used both those values to process the message.
It's almost certain that .
in your assembler is performing the same function since that would effectively make the jump
an infinite loop, something we often used in our early assembler assignments to signal the end of a program - most of the stuff we did was on bare metal so there was no operating system to return to :-)
And, in fact, the GNU assembler as
still uses a period as that special symbol:
The special symbol
'.'
refers to the current address that as is assembling into. Thus, the expression'melvin: .long .'
definesMelvin
to contain its own address. Assigning a value to.
is treated the same as a.org
directive. Thus, the expression'.=.+4'
is the same as saying'.space 4'
.