Am I missing something?
Posted: February 6th, 1985, 6:57 am
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84; site uw-beaver
Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxj!houxm!vax135!cornell!uw-beaver!info-mac
From: info-mac@uw-beaver
Newsgroups: fa.info-mac
Subject: Am I missing something?
Message-ID:
Date: Thu, 17-Jan-85 19:59:42 EST
Article-I.D.: uw-beave.447
Posted: Thu Jan 17 19:59:42 1985
Date-Received: Fri, 18-Jan-85 10:18:15 EST
Sender: daemon@uw-beaver
Organization: U of Washington Computer Science
Lines: 44
From: [email protected] (Eric Olson)
I don't see how the display on the Macintosh could slow it down (by 80%?!?!).
Display memory doesn't take processor time: it may take longer to write to
the display memory (by having the hardware shove wait states onto the bus).
Assuming you aren't writing to the display, there ARE other things which
slow the Mac down. The Vertical Blanking Interrupt updates the tickcount and
cursor every 60th of a second, the SCC generates an interrupt on any received
character and any mouse movement, and the VIA generates an interrupt on
mouse movement. If you have a task that must execute at high speed and
cannot be interrupted, you can turn off interrupts-- but it's not easy.
You must re-vector a TRAP (68000 trap, not Mac Trap) to your code (in order
to get into supervisor mode), execute the TRAP, set the interrupt level
to 7 (no interrupts serviced), execute your routine, and (for completeness
) restore the TRAP vector. Note that the mouse won't work while this is
happening, and the TickCount will not update (I think the clock still
keeps good time, though). This code fragment does the trick:
MOVE.L #$80,A0 ;TRAP 0 Vector Address
MOVE.L (A0),D2 ;Save the old vector
JSR CURLOC ;Call next instruction to get PC
CURLOC: MOVE.L (SP)+,A1 ;Pop CURLOC off the stack
ADD.L #14,A1 ;Add offset to BEGING
MOVE.L A1,(A0) ;Change Trap vector
TRAP #0 ;Execute trap
BRA.S DONE ;Go back to calling routine
BEGING: MOVE.W #2700,SR ;Set interrupt level 7, super mode
.
. ;Your code here
.
RTE ;Return from Exception
DONE: MOVE.L #$80,A0 ;TRAP 0 Vector Address
MOVE.L D2,(A0) ;Restore old vector
RTS ;Return to caller
Note: Since Mac code is relocatable, the PC is determined by JSR and POP off
the stack. The #14 added to A1 is enough to change CURLOC to BEGING. I
assume the code does not move during execution (a valid assumption).
Ciao!
Eric.
Posting-Version: version B 2.10.2 9/18/84; site uw-beaver
Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxj!houxm!vax135!cornell!uw-beaver!info-mac
From: info-mac@uw-beaver
Newsgroups: fa.info-mac
Subject: Am I missing something?
Message-ID:
Date: Thu, 17-Jan-85 19:59:42 EST
Article-I.D.: uw-beave.447
Posted: Thu Jan 17 19:59:42 1985
Date-Received: Fri, 18-Jan-85 10:18:15 EST
Sender: daemon@uw-beaver
Organization: U of Washington Computer Science
Lines: 44
From: [email protected] (Eric Olson)
I don't see how the display on the Macintosh could slow it down (by 80%?!?!).
Display memory doesn't take processor time: it may take longer to write to
the display memory (by having the hardware shove wait states onto the bus).
Assuming you aren't writing to the display, there ARE other things which
slow the Mac down. The Vertical Blanking Interrupt updates the tickcount and
cursor every 60th of a second, the SCC generates an interrupt on any received
character and any mouse movement, and the VIA generates an interrupt on
mouse movement. If you have a task that must execute at high speed and
cannot be interrupted, you can turn off interrupts-- but it's not easy.
You must re-vector a TRAP (68000 trap, not Mac Trap) to your code (in order
to get into supervisor mode), execute the TRAP, set the interrupt level
to 7 (no interrupts serviced), execute your routine, and (for completeness
) restore the TRAP vector. Note that the mouse won't work while this is
happening, and the TickCount will not update (I think the clock still
keeps good time, though). This code fragment does the trick:
MOVE.L #$80,A0 ;TRAP 0 Vector Address
MOVE.L (A0),D2 ;Save the old vector
JSR CURLOC ;Call next instruction to get PC
CURLOC: MOVE.L (SP)+,A1 ;Pop CURLOC off the stack
ADD.L #14,A1 ;Add offset to BEGING
MOVE.L A1,(A0) ;Change Trap vector
TRAP #0 ;Execute trap
BRA.S DONE ;Go back to calling routine
BEGING: MOVE.W #2700,SR ;Set interrupt level 7, super mode
.
. ;Your code here
.
RTE ;Return from Exception
DONE: MOVE.L #$80,A0 ;TRAP 0 Vector Address
MOVE.L D2,(A0) ;Restore old vector
RTS ;Return to caller
Note: Since Mac code is relocatable, the PC is determined by JSR and POP off
the stack. The #14 added to A1 is enough to change CURLOC to BEGING. I
assume the code does not move during execution (a valid assumption).
Ciao!
Eric.