[comp.sys.amiga.programmer] Instructions on 68000

koleman@pnet51.orb.mn.org (Kurt "Koleman" Koller) (04/12/91)

Ok, I was looking at some source in Assembly, and I saw some instructions that
I wasn't familiar with.  My assembler (Macro 68) assembles them just fine, and
they ARE mentioned in the 68000 manual, but just MENTIONED.  I have no idea
what they do.  If anyone can help me, so be it.
 
                st       (MemoryLocation)
                sne      d(n)
                sf
                sge
 
etc...
 
 These are not "documented" instructions.  What do they do, and why would
someone use them other than to save cycles or 10?  Are they also used on the
020 030 040 etc?
 
Thanks,

---------------------------  _  _   _   _     ___  __  __    _    __   _
| Kurt "Koleman" Koller   | ( )/ ) /,\ ( )   ( __)(  \/  )  ( )  (  \ ( )
| P.O. Box 50656          | (   \ (   )( )__ ( __)( )\/( ) (_|_) ( )\\( )
| Mendota, MN  55150-0656 | (_)\_) \_/ (____)(___)(_)  (_)(_) ( )(_) \__)
---------------------------
UUCP: {crash tcnet}!orbit!pnet51!koleman
INET: koleman@pnet51.orb.mn.org

ccplumb@rose.waterloo.edu (Colin Plumb) (04/12/91)

koleman@pnet51.orb.mn.org (Kurt "Koleman" Koller) wrote:
>  Ok, I was looking at some source in Assembly, and I saw some instructions
> that I wasn't familiar with.  My assembler (Macro 68) assembles them just
> fine, and they ARE mentioned in the 68000 manual, but just MENTIONED.  I
> have no idea what they do.  If anyone can help me, so be it.
 
>                st       (MemoryLocation)
>                sne      d(n)
>                sf
>                sge

>  These are not "documented" instructions.  What do they do, and why would
> someone use them other than to save cycles or 10?  Are they also used on the
> 020 030 040 etc?

These are the "set conditional" instructions, which are documented under
"Scc" like all the branches are collectively called "Bcc".
If the condition is true ("t" is always true, "f" never is), they
set the destination byte to all 1's, otherwise they clear it to
all 0's.

Obviously, their function can be emulated with other instruction
sequences (conditional branches are easiest), but that's true of
most 68000 instructions.
-- 
	-Colin

dillon@overload.Berkeley.CA.US (Matthew Dillon) (04/13/91)

In article <4577@orbit.cts.com> koleman@pnet51.orb.mn.org (Kurt "Koleman" Koller) writes:
>
>Ok, I was looking at some source in Assembly, and I saw some instructions that
>I wasn't familiar with.  My assembler (Macro 68) assembles them just fine, and
>they ARE mentioned in the 68000 manual, but just MENTIONED.  I have no idea
>what they do.	If anyone can help me, so be it.
>
>		 st	  (MemoryLocation)
>		 sne	  d(n)
>		 sf
>		 sge
>
>etc...
>
> These are not "documented" instructions.  What do they do, and why would
>someone use them other than to save cycles or 10?  Are they also used on the
>020 030 040 etc?

    They're magik, of course!  Actually, they are individual branch codes
    for the Scc instruction (set according to condition).  The format is:

	Scc.b <ea>

    Scc is always a byte operation.  If the specified condition is TRUE,
    the byte destination is set to all 1's (-1).  If it is FALSE, the
    byte destination is set to all 0's.  The 'cc' follows the DBcc
    branch codes which is the same as the Bcc branch codes except for
    the 't' and 'f' code (always true and always fast).

	st  D0	    (always true), sets lower byte of D0 to 1's
	sne D0	    If not equal ...
	sf  D0	    (always false), clears lower byte of D0
	sge D0	    If greater or equal then..

    You can get 0, 1 longword results by following the Scc with a NEG
    instruction, like this (for example):

	moveq.l #0,D0
	  .
	 cmp ...
	  .
	sne.b	D0
	neg.b	D0


>Thanks,
>
>---------------------------  _  _   _	 _     ___  __	__    _    __	_
>| Kurt "Koleman" Koller   | ( )/ ) /,\ ( )   ( __)(  \/  )  ( )  (  \ ( )
>| P.O. Box 50656	   | (   \ (   )( )__ ( __)( )\/( ) (_|_) ( )\\( )
>| Mendota, MN	55150-0656 | (_)\_) \_/ (____)(___)(_)  (_)(_) ( )(_) \__)
>---------------------------
>UUCP: {crash tcnet}!orbit!pnet51!koleman
>INET: koleman@pnet51.orb.mn.org

					-Matt

--

    Matthew Dillon	    dillon@Overload.Berkeley.CA.US
    891 Regal Rd.	    uunet.uu.net!overload!dillon
    Berkeley, Ca. 94708
    USA

conan@ccwf.cc.utexas.edu (Robert Faulkner) (04/13/91)

>From: koleman@pnet51.orb.mn.org (Kurt "Koleman" Koller)
>Ok, I was looking at some source in Assembly, and I saw some instructions that
>I wasn't familiar with.  My assembler (Macro 68) assembles them just fine, and
>they ARE mentioned in the 68000 manual, but just MENTIONED.  I have no idea
>what they do.  If anyone can help me, so be it.
> 
>                st       (MemoryLocation)
>                sne      d(n)
>                sf
>                sge
 
>etc...
> 
> These are not "documented" instructions.  What do they do, and why would
>someone use them other than to save cycles or 10?  Are they also used on the
>020 030 040 etc?
 
These are Set According to Condition commands in the form Scc <ea>
The specified condition code is Tested, if the condition is true, the
byte specified by the effective address is set to TRUE, (all ones),
otherwise that byte is set to False (all zeroes), "CC" may specify the
following conditions

CC	Carry Clear		LS 	Low or Same
CS	Carry Set		LT	Less Than
EQ	Equal			MI	Minus
F	False 			NE	Not Equal
GE	Greater or Equal	PI	Plus
GT	Greater Than		T	True
HI	High			VC	Overflow Clear
LE	Less or Equal		VS	OverFlow Set

This command is a good way to set a Boolean Flag byte in a return value
for a function.  As far as I know it is supported on all of the 680x0
processors.  Feel free to e-mail me with any other questions.

I got all of this information from the S68000 User's Guide, which only
costs about $0.65 at our University Book Store.  You can also call 
Signetics and they will send you one free, plus a bunch of other useful
information on the 68000.

The phone # is 408-739-7700, ask for publications department.

Thanks,

-- 

Robert Faulkner                              conan@ccwf.cc.utexas.edu
            ///                  Recursion:     Thinking
        \\\///    University of Texas                 about
         \\//   Amiga Computers                     Thinking

knurlin@spf.trw.com (Scott Karlin) (04/13/91)

In article <4577@orbit.cts.com> koleman@pnet51.orb.mn.org (Kurt "Koleman" Koller) writes:
>
>Ok, I was looking at some source in Assembly, and I saw some instructions that
>I wasn't familiar with.  My assembler (Macro 68) assembles them just fine, and
>they ARE mentioned in the 68000 manual, but just MENTIONED.  I have no idea
>what they do.  If anyone can help me, so be it.
> 
>                st       (MemoryLocation)
>                sne      d(n)
>                sf
>                sge
These are examples of the Scc (Set According to Condition) instructions.
If the condition specified by "cc" is true then the byte operand is set
to all bits 1, otherwise all bits 0.  The conditions specified by your
four examples are:  always true, not equal, never true, & greater or
equal.  This information can be found in the "8-/16-/32-Bit Microprocessors
User's Manual"  ISBN: 0-13-567074-8.


-- Scott Karlin                    knurlin@spf.trw.com
-- TRW Data Systems Center         Phone: (213) 812-7335
-- One Space Park, O2-1761
-- Redondo Beach, CA 90278-1071

sschaem@starnet.uucp (Stephan Schaem) (04/14/91)

Speaking of Scc, a good way to use it is to set the bliter minterm with
it... For plane Set/Clear.
If you have a color value (x fliped:-) just do an add.b dx,dx and SCC
dy.
Could be use for seting byte flag (using Scc and Tst).
SF can be used instead of clr.b ...
(but same timing, but slower on a 68020)
Anyway, you sould get the Programer's Reference Manual.

							Stephan.

umueller@iiic.ethz.ch (Urban Dominik Mueller) (04/16/91)

To  all  programmers:   This  is a call for submissions to the WHO'S WHO OF
COMP.SYS.AMIGA.   Whoever  has  published anything on the Amiga or has some
special knowledge others might be interested in should be mentioned.  So if
you'd  like yourself or someone else included, please submit the address in
the following format:
 
e-mail address                 name          comment
--------------                 ----          -------
71545.1466@compuserve.com      Jeff Davis    R:Manx technical support
announce@iris.eecs.ucdavis.edu               R:comp.sys.amiga.announce
dillon@Overload.Berkeley.CA.US Matt Dillon   A:DICE, DMouse, DNet, UUCP
fishpond!fnf@phx.mcd.mot.com   Fred Fish     R:Fish disks
jesup@cbmvax.cbm.commodore.com Randell Jesup R:C= AmigaDOS
umueller@iiic.ethz.ch          Urban Mueller A:csh, who's who K:Aztec C 5.0d
 
Remarks:
- A: means "Author of", U="User of", R="Responsible for", K="Knowledgable of"
- Please mention any special knowledge you have, e.g. if you are a C++
  wizard. People who need help with C++ will no longer have to do c.s.a
  postings like "HELP! Can't compile HelloWorld.cp" but can ask someone 
  from the who's who.
- If  you  submit other people's addresses (I hope you'll send me your whole
  address list), please make sure they don't object to publishing them. If 
  someone posts articles on c.s.a, it's sure to be OK to include his address.
- Don't submit any unverified addresses.
- You can also include compuserve addresses, and if you know gateways,
  BIX and GEnie addresses.
- Submit per email to umueller@iiic.ethz.ch, I'll post the list in two
  weeks on comp.sys.amiga.misc
                                          __
 |          Urban Mueller         |      / / |    Urban Mueller    |
 | INTERNET:umueller@iiic.ethz.ch | __  / /  |    Schulhausstr. 83 |
 | FIDONET: 2:302/906 (AUGL)      | \ \/ /   | CH-6312 Steinhausen |
 | "Don't tell my employer"       |  \__/    |    SWITZERLAND      |

koleman@pnet51.orb.mn.org (Kurt "Koleman" Koller) (04/17/91)

sschaem@starnet.uucp (Stephan Schaem) writes:
>Speaking of Scc, a good way to use it is to set the bliter minterm with
>it... For plane Set/Clear.
>If you have a color value (x fliped:-) just do an add.b dx,dx and SCC
>dy.
>Could be use for seting byte flag (using Scc and Tst).
>SF can be used instead of clr.b ...
>(but same timing, but slower on a 68020)
>Anyway, you sould get the Programer's Reference Manual.
>
>							Stephan.

Just to save face here...
 
The reason that I posted this inquiry is because I have 3 books here, one of
which is a Motorola reference on the 68000, none of which have any set
instructions under the heading Scc or any other similar heading.
 
That is why I asked here.  I AM literate.

---------------------------  _  _   _   _     ___  __  __    _    __   _
| Kurt "Koleman" Koller   | ( )/ ) /,\ ( )   ( __)(  \/  )  ( )  (  \ ( )
| P.O. Box 50656          | (   \ (   )( )__ ( __)( )\/( ) (_|_) ( )\\( )
| Mendota, MN  55150-0656 | (_)\_) \_/ (____)(___)(_)  (_)(_) ( )(_) \__)
---------------------------
UUCP: {crash tcnet}!orbit!pnet51!koleman
INET: koleman@pnet51.orb.mn.org