Re: A89: .s instruction extention


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

Re: A89: .s instruction extention




And to add a useful tidbit about a68k... if you assemble with the -f in
the command line, it will echo any branches it missed (which make me
wonder why it can tell me it missed it, but not fix it). I suppose it
would take longer to assemble if it kept optimizing the branches...

Johan wrote:
> 
> 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."

-- 
Scott "Wrath" Dial
wrath@calc.org
ICQ#3608935
Member of TCPA - tcpa.calc.org
PGP key available

____________NetZero Free Internet Access and Email_________
Download Now     http://www.netzero.net/download/index.html
Request a CDROM  1-800-333-3633
___________________________________________________________



References: