mirror of
https://github.com/elliotnunn/supermario.git
synced 2024-11-22 04:31:30 +00:00
102 lines
2.8 KiB
Plaintext
102 lines
2.8 KiB
Plaintext
;
|
|
; File: XUnSupp.a
|
|
;
|
|
; Contains: Routines to handle the unsupported data type/format exception
|
|
;
|
|
; 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> 3/30/91 BG Rolling in Jon Okada's latest changes.
|
|
; <1> 12/14/90 BG First checked into TERROR/BBS.
|
|
|
|
; xunsupp.a
|
|
|
|
; Based upon Motorola file 'x_unsupp.sa'.
|
|
|
|
; CHANGE LOG:
|
|
; 09 Jan 91 JPO Inserted label "unsupp" at start of code. Renamed
|
|
; label "end_fix" to "usend_fix".
|
|
;
|
|
|
|
*
|
|
* x_unsupp.sa 3.1 12/10/90
|
|
*
|
|
* fpsp_unsupp --- FPSP handler for unsupported data type exception
|
|
*
|
|
* Trap vector #55 (See table 8-1 Mc68030 User's manual).
|
|
* Invoked when the user program encounters a data format (packed) that
|
|
* hardware does not support or a data type (denormalized numbers or un-
|
|
* normalized numbers).
|
|
* Normalizes denorms and unnorms, unpacks packed numbers then stores
|
|
* them back into the machine to let the 040 finish the operation.
|
|
*
|
|
* Unsupp calls two routines:
|
|
* 1. get_op - gets the operand(s)
|
|
* 2. res_func - restore the function back into the 040 or
|
|
* if fmove.p fpm,<ea> then pack source (fpm)
|
|
* and store in users memory <ea>.
|
|
*
|
|
* Input: Long fsave stack frame
|
|
*
|
|
*
|
|
|
|
* 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_UNSUPP IDNT 2,1 Motorola 040 Floating Point Software Package
|
|
|
|
|
|
|
|
unsupp: ; label inserted <1/9/91, JPO>
|
|
fpsp_unsupp:
|
|
*
|
|
link a6,#-LOCAL_SIZE
|
|
fsave -(a7)
|
|
movem.l d0-d1/a0-a1,USER_DA(a6)
|
|
fmovem.x fp0-fp3,USER_FP0(a6)
|
|
fmovem.l fpcr/fpsr/fpiar,USER_FPCR(a6)
|
|
move.b (a7),VER_TMP(a6) ;save version number
|
|
move.b (a7),d0 ;test for valid version num
|
|
andi.b #$f0,d0 ;test for $4x
|
|
cmpi.b #VER_4,d0 ;must be $4x or exit
|
|
bne fpsp_fmt_error
|
|
|
|
fmove.l #0,FPSR ;clear all user status bits
|
|
fmove.l #0,FPCR ;clear all user control bits
|
|
*
|
|
* The following lines are used to ensure that the FPSR
|
|
* exception byte and condition codes are clear before proceeding,
|
|
* except in the case of fmove, which leaves the cc's intact.
|
|
*
|
|
unsupp_con:
|
|
move.l USER_FPSR(a6),d1
|
|
btst #5,CMDREG1B(a6) ;looking for fmove out
|
|
bne.b fmove_con
|
|
and.l #$FF00FF,d1 ;clear all but aexcs and qbyte
|
|
bra.b usend_fix ; label RENAMED <1/9/91, JPO>
|
|
fmove_con:
|
|
and.l #$0FFF40FF,d1 ;clear all but cc's, snan bit, aexcs, and qbyte
|
|
usend_fix: ; label RENAMED <1/9/91, JPO>
|
|
move.l d1,USER_FPSR(a6)
|
|
|
|
st UFLG_TMP(a6) ;set flag for unsupp data
|
|
|
|
bsr get_op ;everything okay, go get operand(s)
|
|
bsr res_func ;fix up stack frame so can restore it
|
|
clr.l -(a7)
|
|
move.b VER_TMP(a6),(a7) ;move idle fmt word to top of stack
|
|
bra gen_except
|
|
*
|
|
|
|
|