Path: utzoo!utgpu!water!watmath!clyde!bellcore!rutgers!mailrus!uwmcsd1!dogie!terranova From: terranova@vms.macc.wisc.edu Newsgroups: comp.sys.apple Subject: Re: If the GS meant business... Message-ID: <493@dogie.edu> Date: 24 Jul 88 01:13:00 GMT Sender: news@dogie.edu Organization: University of Wisconsin Academic Computing Center Lines: 67 In article <24361@think.UUCP>, whitney@think.COM (David Whitney) writes... > >Well, the 68000 (and 68020 and if I guess right, the 8088 and >derivatives) have real microprocessor instructions, and then something >called 'traps'. Traps are undefined microprocessor instructions. It >happens that the Mac sets up what is supposed to happen when specific >traps occur. For example (this is hypothetical as I really don't know >any trap #s), A8E0, an undefined 68000 opcode may very well start up >Quickdraw. IBM machines have INT instructions, which basically do the >same sort of thing. One does INT 28 to make the IBM do something >interesting. Macsbug, and other Mac debuggers can have any and all >toolbox calls stop the machine and pop up the debugger. This is easy, >as all Macsbug has to do is replace the trap code that the 68000 would >normally execute. > >So, in this sense, the 68000 and 8088 are kinda like interpreters - >but only when it comes across an opcode which is undefined. I believe I am not familiar with the Intel processors so the following discussion regards the MC68000 microprocessor found in the Mac+/SE: There are two types of traps: A-line and F-line. They are identified by the high nibble of the opcode. These traps are used to extend the instruction set of the 68000. I forget exactly how it works but, the effect is that the the following 12 bits of the opcode is used as an offset into a jump table. (I forget if Apple's system code strips the high nibble and jumps or if the 68000 does it itself). If you want to call these two steps interpreting (1. strip the high nibble 2. jump) then be my guest. The point is that the overhead to do this is minimal. Yes, the Mac does more garbage after encountering the A-trap but before the jump but, that is easily circumvented when speed is an issue. To do what the trap dispatcher does (use the offset to get the address to jump to, check various flag bits in the opcode, etc.) would be a lot of extra work for the programmer. BTW, you will notice that all developers who use the 68000 traps use only the A-line traps. Coincidence? I think not. Motorola has explicitly stated that anyone using F-line traps will promptly be taken into the back alley and shot. (No, not really, but you get the idea.) Motorola has reserved F-line traps for their own use to extend the processors with extra little frills like the 68881 numeric co-processor and the 68851 PMMU. These co-processors are accessed through F-line traps. P.S. I am a Mac man, myself, but I would appreciate any info GS hackers/ programmers can give me regarding similarities and differences between it and the Mac (when the GS is running in the graphics/window mode). o Do programs get and handle events like the Mac? o What is the TaskMaster? I have read a little about it on the net but don't understand too well. o How are the toolbox (toolsets?) calls handled/dispatched? o Someone said that the GS tries to imitate the 68000 - how? THANKS much. > >David Whitney, MIT '90 Still learning about my Apple //GS >{out there}!harvard!think!whitney and all of its secrets. Any and all >whitney@think.com technical info appreciated. >DISCLAIMER: You think they even know I'm doing this? --------------------------------+---------------------------------------- John C. Terranova | I said it. CS, BS to be | So, flame me. terranova@vms.macc.wisc.edu | No one else. --------------------------------+---------------------------------------- Where's the orchestra? -Billy Joel, "Where's the Orchestra?"