mirror of
https://github.com/elliotnunn/mac-rom.git
synced 2024-12-22 23:29:27 +00:00
4325cdcc78
Resource forks are included only for .rsrc files. These are DeRezzed into their data fork. 'ckid' resources, from the Projector VCS, are not included. The Tools directory, containing mostly junk, is also excluded.
137 lines
4.5 KiB
Plaintext
137 lines
4.5 KiB
Plaintext
;
|
|
; File: XFLine.a
|
|
;
|
|
; Contains: Routines for handle F-Line traps in general
|
|
;
|
|
; Originally Written by: Motorola Inc.
|
|
; Adapted to Apple/MPW: Jon Okada
|
|
;
|
|
; Copyright: © 1990, 1991 by Apple Computer, Inc., all rights reserved.
|
|
;
|
|
; This file is used in these builds: Mac32
|
|
;
|
|
; Change History (most recent first):
|
|
;
|
|
; <2+> 6/24/91 BG Folded in Motorola version 2.0 fixes for handling FMOVECR
|
|
; instructions with non-zero <ea> fields.
|
|
; <2> 3/30/91 BG Rolling in Jon Okada's latest changes.
|
|
; <1> 12/14/90 BG First checked into TERROR/BBS.
|
|
|
|
; xfline.a
|
|
|
|
; Based upon Motorola file 'x_fline.sa'.
|
|
|
|
; CHANGE LOG:
|
|
; 08 Jan 91 JPO Inserted label "fline" at top of code. Modified code
|
|
; for branching to system fline handler. Streamlined
|
|
; code for reading fline instruction. Renamed label
|
|
; "ck_rev" to "flck_rev".
|
|
; 13 Jun 91 JPO Folded in Motorola version 2.0 fixes for handling FMOVECR
|
|
; instructions with non-zero <ea> fields.
|
|
;
|
|
|
|
*
|
|
* x_fline.sa 3.3 1/10/91
|
|
*
|
|
* fpsp_fline --- FPSP handler for fline exception
|
|
*
|
|
* First determine if the exception is one of the unimplemented
|
|
* floating point instructions. If so, let fpsp_unimp handle it.
|
|
* Next, determine if the instruction is an fmovecr with a non-zero
|
|
* <ea> field. If so, handle here and return. Otherwise, it
|
|
* must be a real F-line exception.
|
|
*
|
|
|
|
* Copyright (C) Motorola, Inc. 1990
|
|
* All Rights Reserved
|
|
*
|
|
* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
|
|
* The copyright notice above does not evidence any
|
|
* actual or intended publication of such source code.
|
|
|
|
* X_FLINE IDNT 2,1 Motorola 040 Floating Point Software Package
|
|
|
|
|
|
fline: ; <1/8/91, JPO>
|
|
fpsp_fline:
|
|
*
|
|
* check for unimplemented vector first. Use EXC_VEC-4 because
|
|
* the equate is valid only after a 'link a6' has pushed one more
|
|
* long onto the stack.
|
|
*
|
|
cmp.w #UNIMP_VEC,EXC_VEC-4(a7)
|
|
beq fpsp_unimp
|
|
|
|
*
|
|
* fmovecr with non-zero <ea> handling here
|
|
*
|
|
sub.l #4,a7 ;4 accounts for 2-word difference
|
|
* ;between six word frame (unimp) and
|
|
* ;four word frame
|
|
link a6,#-LOCAL_SIZE
|
|
fsave -(a7) ; ADDED <6/13/91, JPO> <T3>
|
|
movem.l d0-d1/a0-a1,USER_DA(a6)
|
|
movea.l EXC_PC+4(a6),a0 ;get address of fline instruction
|
|
|
|
; lea.l L_SCR1(a6),a1 ;use L_SCR1 as scratch - deleted <1/8/91, JPO>
|
|
; move.l #4,d0 ; deleted <1/8/91, JPO>
|
|
; bsr.l mem_read ; deleted <1/8/91, JPO>
|
|
; move.l L_SCR1(a6),d0 ;d0 contains the fline and command word - deleted <1/8/91, JPO>
|
|
|
|
move.l (a0),d0 ; d0 contains the fline and command word <1/8/91, JPO>
|
|
|
|
bfextu d0{4:3},d1 ;extract coprocessor id
|
|
cmpi.b #1,d1 ;check if cpid=1
|
|
bne.b not_mvcr ;exit if not
|
|
bfextu d0{16:6},d1
|
|
cmpi.b #$17,d1 ;check if it is an FMOVECR encoding
|
|
bne.b not_mvcr
|
|
* ;if an FMOVECR instruction, fix stack
|
|
* ;and go to FPSP_UNIMP
|
|
;fix_stack: ; label deleted <1/8/91, JPO>
|
|
cmpi.b #VER_40,(a7) ;test for orig unimp frame
|
|
bne.b flck_rev ; label renamed <1/8/91, JPO>
|
|
; sub.l #UNIMP_40_SIZE,a7 ;emulate an orig fsave - DELETED <6/13/91, JPO> <T3>
|
|
sub.l #UNIMP_40_SIZE-4,a7 ;emulate an orig fsave - ADDED <6/13/91, JPO> <T3>
|
|
move.b #VER_40,(a7)
|
|
; clr.b 1(a7) ; DELETED <6/13/91, JPO> <T3>
|
|
move.b #UNIMP_40_SIZE-4,1(a7) ; ADDED <6/13/91, JPO> <T3>
|
|
clr.w 2(a7)
|
|
bra.b fix_con
|
|
flck_rev: ; label renamed <1/8/91, JPO>
|
|
cmpi.b #VER_41,(a7) ;test for rev unimp frame
|
|
bne fpsp_fmt_error ;if not $40 or $41, exit with error
|
|
; sub.l #UNIMP_41_SIZE,a7 ;emulate a rev fsave - DELETED <6/13/91, JPO> <T3>
|
|
sub.l #UNIMP_41_SIZE-4,a7 ;emulate a rev fsave - ADDED <6/13/91, JPO> <T3>
|
|
move.b #VER_41,(a7)
|
|
; clr.b 1(a7) ; DELETED <6/13/91, JPO> <T3>
|
|
move.b #UNIMP_41_SIZE-4,1(a7) ; ADDED <6/13/91, JPO> <T3>
|
|
clr.w 2(a7)
|
|
fix_con:
|
|
move.w EXC_SR+4(a6),EXC_SR(a6) ;move stacked sr to new position
|
|
move.l EXC_PC+4(a6),EXC_PC(a6) ;move stacked pc to new position
|
|
fmove.l EXC_PC(a6),FPIAR ;point FPIAR to fline inst
|
|
move.l #4,d1
|
|
add.l d1,EXC_PC(a6) ;increment stacked pc value to next inst
|
|
move.w #$202c,EXC_VEC(a6) ;reformat vector to unimp
|
|
clr.l EXC_EA(a6) ;clear the EXC_EA field
|
|
move.w d0,CMDREG1B(a6) ;move the lower word into CMDREG1B
|
|
clr.l E_BYTE(a6)
|
|
bset.b #UFLAG,T_BYTE(a6)
|
|
movem.l USER_DA(a6),d0-d1/a0-a1 ;restore data registers
|
|
bra uni_2
|
|
|
|
not_mvcr:
|
|
movem.l USER_DA(a6),d0-d1/a0-a1 ;restore data registers
|
|
frestore (a7)+ ; ADDED <6/13/91, JPO> <T3>
|
|
unlk a6
|
|
add.l #4,a7
|
|
|
|
; bra.l real_fline ; deleted <1/8/91, JPO>
|
|
|
|
move.l (FLINE_VEC040).W,-(sp) ; push vector to user's handler <1/8/91, JPO>
|
|
rts ; execute user's handler <1/8/91, JPO>
|
|
|
|
|
|
|