mirror of
https://github.com/elliotnunn/supermario.git
synced 2024-12-01 02:51:04 +00:00
115 lines
4.1 KiB
Plaintext
115 lines
4.1 KiB
Plaintext
|
;
|
||
|
; File: MemUtils.a
|
||
|
;
|
||
|
; Written by: Ed Tecot
|
||
|
;
|
||
|
; Copyright: © 1987-1990 by Apple Computer, Inc., all rights reserved.
|
||
|
;
|
||
|
; Change History (most recent first):
|
||
|
;
|
||
|
; <3> 7/17/90 dba got rid of most routines, since Memory.h now has in-line
|
||
|
; register-based interfaces; got rid of MemUtils.h because this is
|
||
|
; all compatible with the prototypes in Memory.h; replaced special
|
||
|
; code here with code excerpted from Interface.o source; it would
|
||
|
; be even better to use Interface.o and use dead-code stripping
|
||
|
; <2> 7/7/90 dba change names to match Interface.o
|
||
|
; <1.2> 3/3/89 CCH Added SetHandleSize and HUnlock glue.
|
||
|
; <1.1> 11/10/88 CCH Fixed Header.
|
||
|
; <1.0> 11/9/88 CCH Adding to EASE.
|
||
|
; <•1.3> 9/23/88 CCH Got rid of inc.sum.d and empty nFiles
|
||
|
; <1.2> 5/23/88 BBM Glue broken for three routines (ie. no rts)
|
||
|
; <1.1> 5/19/88 BBM Added more glue for memory manager, OS utils.
|
||
|
; <1.0> 3/22/88 EMT First time adding Notification Manager sources
|
||
|
;
|
||
|
|
||
|
LOAD 'StandardEqu.d'
|
||
|
|
||
|
;
|
||
|
;FUNCTION EqualString(str1,str2: OsStr255; caseSens,diacSens: BOOLEAN):BOOLEAN;
|
||
|
;
|
||
|
|
||
|
EqualString FUNC EXPORT
|
||
|
LINK A6, #0 ; allocate stack frame
|
||
|
|
||
|
MOVE.L 16(A6),A0 ;ptr to str1
|
||
|
MOVE.L 12(A6),A1 ;ptr to str2
|
||
|
MOVEQ #0,D0
|
||
|
MOVE.B (A0)+,D0 ;str1 length
|
||
|
SWAP D0
|
||
|
MOVE.B (A1)+,D0 ;str2 length
|
||
|
|
||
|
;depending on value of booleans, make proper call
|
||
|
TST.B 8(A6) ;value of diacSens
|
||
|
BEQ.S @2 ;strip diacriticals
|
||
|
TST.B 10(A6) ;value of caseSens
|
||
|
BEQ.S @1 ;ignore case
|
||
|
_CmpString ,CASE ;both diacritical and case sensitive
|
||
|
BRA.S strDone
|
||
|
|
||
|
@1 _CmpString ;diacritical sensitive,map to upper case
|
||
|
BRA.S strDone
|
||
|
|
||
|
;strip diacriticals
|
||
|
@2 TST.B 10(A6) ;case sensitive?
|
||
|
BEQ.S @3
|
||
|
_CmpString ,MARKS,CASE ;ignore diacrits, case sensitive
|
||
|
BRA.S strDone
|
||
|
|
||
|
@3 _CmpString ,MARKS ;ignore diacrits and map to upper case
|
||
|
|
||
|
strDone EORI.B #1,D0 ;take opposite of what cmpString returns
|
||
|
MOVE.B D0,20(A6) ;return result
|
||
|
|
||
|
UNLK A6 ; restore stack
|
||
|
MOVE.L (SP)+,A0 ; rtn addr
|
||
|
ADD.L #12,SP ; pop args
|
||
|
JMP (A0)
|
||
|
|
||
|
;FUNCTION NGetTrapAddress(trapNum: INTEGER; tTyp: TrapType): LongInt;
|
||
|
|
||
|
NGetTrapAddress FUNC EXPORT
|
||
|
MOVE.L (SP)+,A1 ;return address
|
||
|
MOVE.B (SP)+,D1 ;trap selector: 0-OSTrap 1-ToolTrap
|
||
|
MOVE.W (SP)+,D0 ;trap number
|
||
|
MOVE.L A1,-(SP) ;restore return address
|
||
|
TST.B D1 ;0-OSTrap 1-ToolTrap
|
||
|
BEQ.S @1
|
||
|
_GetTrapAddress newTool
|
||
|
BRA.S @3
|
||
|
@1
|
||
|
_GetTrapAddress newOs
|
||
|
@3
|
||
|
MOVE.L A0,4(SP) ;return corresponding address
|
||
|
RTS
|
||
|
|
||
|
GetHandleSize FUNC EXPORT
|
||
|
|
||
|
Move.L (SP)+,A1 ;get return address
|
||
|
Move.L (SP)+,A0 ;get the handle
|
||
|
_GetHandleSize ;let OS do it
|
||
|
Move.L D0,(SP) ;return result on stack
|
||
|
BPl.S @1 ;real sizes are positive
|
||
|
Clr.L (SP) ;on errors, return 0
|
||
|
@1
|
||
|
jmp (a1) ;if result is a size, set 0 result code
|
||
|
|
||
|
BlockMove PROC EXPORT
|
||
|
|
||
|
Move.L (SP)+,D1 ;return address
|
||
|
Move.L (SP)+,D0 ;byte count
|
||
|
Move.L (SP)+,A1 ;destination ptr
|
||
|
Move.L (SP)+,A0 ;source ptr
|
||
|
_BlockMove ;let OS to do it.
|
||
|
Move.L D1,A1 ;return address
|
||
|
JMP (A1) ;save result code and return via A1
|
||
|
|
||
|
StripAddress FUNC EXPORT
|
||
|
|
||
|
MOVE.L (SP)+,A1 ;get the return address
|
||
|
MOVE.L (SP)+,D0 ;get the address
|
||
|
_StripAddress
|
||
|
MOVE.L D0,(SP) ;return the stripped address
|
||
|
JMP (A1)
|
||
|
|
||
|
END
|