Path: utzoo!mnetor!uunet!cbmvax!grr From: grr@cbmvax.UUCP (George Robbins) Newsgroups: comp.sys.amiga Subject: Re: Piggyback CPU boards (also legal C expressions) Message-ID: <3032@cbmvax.UUCP> Date: 28 Dec 87 00:13:13 GMT References: <8712111630.AA17999@cory.Berkeley.EDU> <638@tekig.TEK.COM> Reply-To: grr@cbmvax.UUCP (George Robbins) Organization: Commodore Technology, West Chester, PA Lines: 42 In article <638@tekig.TEK.COM> phils@tekig.UUCP (Phil Staub) writes: > In article <8712111630.AA17999@cory.Berkeley.EDU> dillon@CORY.BERKELEY.EDU (Matt Dillon) writes: > > I know of no compilers which use MOVE SR, it is strickly a > >hand-programmed opcode. The SR contains the condition codes, supervisor > >state, > >trace mode, and interrupt mask. The only reason anybody uses MOVE SR,x is > >to check the trace mode, supervisor state, or interrupt mask. The condition > >codes can be read/written with MOVE CCR. Motorola decided MOVE SR should > >become privilaged (user programs should not know about supervisor flags) > >under the 68010 and 68020. > > Check the edge of the page describing the MOVE CCR, instruction in > the 68000 Programmers Reference Manual, and you'll see a little black > bar indicating that a MOVE with a source operand of CCR is a > 68010/68012 only instruction. This is the real problem. 68000 programs > often use MOVE SR, to read the condition codes, since the MOVE > CCR, instruction does not exist. 68010 programs *should* use MOVE > CCR, to achieve the same purpose (i.e., if *all* they're interested > in is the condition codes). There is no single solution which works on > both processors, hence the GetCC() function. AmigaDOS determines which > processor is installed on bootup and ensures that the right instruction > (MOVE CCR, or MOVE SR,) gets executed as a result of branching to the > GetCC vector in the jump table for the Exec library. Yes, Motorola screwed up on this, not implementing the MOV CCR register in the first places, and then deciding MOV SR should be illegal in user mode, rather than just masking off the bits that the user shouldn't be concerned with. In either case, one might argue that storing the condition codes, rather than testing them is a unusual activity, best left to system software, but once people have started using the instruction it's a little late. I belive either case can be handled adequatly with a trap handler, but for some reason (effiency? religion?) this is not built into the Amiga software. -- George Robbins - now working for, uucp: {uunet|ihnp4|rutgers}!cbmvax!grr but no way officially representing arpa: cbmvax!grr@uunet.uu.net Commodore, Engineering Department fone: 215-431-9255 (only by moonlite)