Re: A89: .s instruction extention


[Prev][Next][Index][Thread]

Re: A89: .s instruction extention




On Mon, Aug 07, 2000 at 03:06:33AM -0500, Matt Waters wrote:
> 
> 	beq.s install
> 
> I am under the impression that the .s extention references a set flag
> [...], how does the 68k know which flag [...]?

".s" tells the assembler to generate a "short" branch, i.e. machine code
$67xx as opposed to a ".l" = "long" branch ($6700xxxx) (xx and xxxx are the
relative offsets to the label). With A68k, you can use ".b" and ".w" instead
of ".s" and ".l" if you want.

The difference between a short and a long branch is: instruction size (of
course), execution speed (long is usually slower) and maximum allowed
distance to target (long branch allows the target to be within (approx.)
+-32K bytes while a short branch only allows the target to be within
(approx.) +-128 bytes).

If you don't supply ".s" or ".l" with the instruction and the target is not
"seen" yet (it's a forward reference), some assemblers (including A68k) will
first generate a long branch but then try change it into a short branch
later if it discovers that this is possible. Not all forward branches will
be changed like this, especially not if changing one branch brings another
into short range.

"BEQ" means "Branch if EQual" (branch if zero flag set), compare "BNE" =
"Branch if Not Equal" (branch if zero flag clear). This tells the CPU what
flag to check. EQ and NE are two out of the 14 different flag combinations
available for branch instructions, plus the unconditional branch BRA and the
unconditional "branch to subroutine" BSR.


/Johan  "100 bytes is enough."



Follow-Ups: References: