It is currently Fri Jun 05, 2020 3:14 pm

All times are UTC

Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Random 68k questions
PostPosted: Wed Jan 02, 2013 8:41 am 

Joined: Sat Sep 15, 2012 9:49 am
Posts: 8
Location: Brisbane, Australia
Guys, I'm trying to understand some nuances of 68k development. Sorry if the questions are a little esoteric.

1. Do the DFC and SFC registers of the 68010 have any use other than in the context of MOVES, which spoofs a type of address access?

2. Does anyone use the LINK and UNLK instructions?

3. The Easy68k "operating system" implements operating system calls by using TRAP. Yet exceptions take a significant amount of time and stack space and habitually place the CPU in supervisor mode. The Amiga used to implement system calls by using a jump table, where the address of at least the first jump table was at a known memory location (in the vector table, actually). Does anyone wish to comment on whether implementing operating system calls via TRAP is inefficient?


 Post subject: Re: Random 68k questions
PostPosted: Wed Jan 02, 2013 4:45 pm 

Joined: Mon Jul 26, 2010 11:43 pm
Posts: 198
Location: Aurora, IL
LINK and UNLK are used prolifically by compilers, and more generally when you want to set up stack frames.
                     207   _printf:
000005B6  4E56 FFFC  208          link      A6,#-4
000005BA  48E7 2000  209          movem.l   D2,-(A7)
000005BE  41EE 0008  210          lea       8(A6),A0
000005C2  5848       211          addq.w    #4,A0
000005C4  2408       212          move.l    A0,D2
000005C6  2F02       213          move.l    D2,-(A7)
000005C8  2F2E 0008  214          move.l    8(A6),-(A7)
000005CC  42A7       215          clr.l     -(A7)
000005CE  6100 00CA  216          bsr       _vsprintf
000005D2  DEFC 000C  217          add.w     #12,A7
000005D6  2D40 FFFC  218          move.l    D0,-4(A6)
000005DA  4282       219          clr.l     D2
000005DC  202E FFFC  220          move.l    -4(A6),D0
000005E0  4CDF 0004  221          movem.l   (A7)+,D2
000005E4  4E5E       222          unlk      A6
000005E6  4E75       223          rts

Yes TRAPs can be somewhat expensive, but offer memory protection, and task switching opportunities. Accessing IO device tends to be a rather slow and expensive process too. One has to balance what needs to be done in user vs system space, trivial stuff should be done in user space code, if you need to copy memory between tasks a TRAP might be the only safe way of doing it. For a simple memcpy or multiply linking to a static or dynamic library, or inlining, might be the way to go.

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC

Who is online

Users browsing this forum: No registered users and 10 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group