mirror of
https://github.com/elliotnunn/mac-rom.git
synced 2024-11-03 05:04:29 +00:00
154 lines
4.3 KiB
Plaintext
154 lines
4.3 KiB
Plaintext
|
include 'macintosh.a'
|
||
|
;-------------------------------------------------------------------------------
|
||
|
;
|
||
|
; segload.a
|
||
|
;
|
||
|
; Implements the C interface for segment loader register based traps.
|
||
|
; Note: routines appear in same order as "Inside Macintosh"
|
||
|
;
|
||
|
; Copyright Apple Computer, Inc. 1984-1988
|
||
|
; All rights reserved.
|
||
|
; Written by Dan Smith 15-Nov-84 (converted version of the pascal interface)
|
||
|
;
|
||
|
; Modifications:
|
||
|
; 11 Feb 88 KLH Changed C headers to work with new C compiler:
|
||
|
; Changed to using standard glue in Interface.o, so
|
||
|
; much glue removed from CInterface.o.
|
||
|
; *** MPW 3.0d4 ***
|
||
|
|
||
|
|
||
|
;-------------------------------------------------------------------------------------
|
||
|
;
|
||
|
; void CountAppFiles(message,count)
|
||
|
; short *message,*count;
|
||
|
;
|
||
|
|
||
|
|
||
|
BLANKS ON
|
||
|
STRING ASIS
|
||
|
|
||
|
;;CountAppFiles proc EXPORT
|
||
|
;;
|
||
|
;; move.l 8(sp),a1
|
||
|
;; clr (a1) ; set default count to 0
|
||
|
;; move.l AppParmHandle,a0 ; the app parm handle
|
||
|
;; _GetHandleSize ; are we real
|
||
|
;; ble.s CountEnd
|
||
|
;; move.l (a0),a0 ; deref appParm Handle
|
||
|
;; move.l 4(sp),a1 ; ptr to message
|
||
|
;; move.w (a0)+,(a1) ; return the message
|
||
|
;; move.l 8(sp),a1
|
||
|
;; move.w (a0),(a1) ; return the count
|
||
|
;;
|
||
|
;;CountEnd
|
||
|
;; rts
|
||
|
|
||
|
|
||
|
;-------------------------------------------------------------------------------------
|
||
|
;
|
||
|
; void GetAppFiles(index,theFile)
|
||
|
; short index;
|
||
|
; AppFile *theFile;
|
||
|
;
|
||
|
; fType is set to all 0's if no next file was found or there is no file list
|
||
|
|
||
|
; AppFile = RECORD
|
||
|
; vRefNum: INTEGER;
|
||
|
; ftype: OsType;
|
||
|
; versNum: INTEGER; {versNum in high byte}
|
||
|
; fName: str255;
|
||
|
; end; {appFile}
|
||
|
|
||
|
|
||
|
; appParm has format: message (0/1) for load or print (2 bytes)
|
||
|
; # of entries (2 bytes)
|
||
|
; for each entry: volume refNum (2 bytes)
|
||
|
; type (4 bytes)
|
||
|
; version (2 bytes)
|
||
|
; name- padded to even
|
||
|
|
||
|
;;GetAppFiles func EXPORT
|
||
|
;;
|
||
|
;; movem.l a2-a3,-(sp)
|
||
|
;; move.l 8+8(sp),a1 ; ptr to fileListElem
|
||
|
;; clr.l 2(a1) ; assume failure
|
||
|
;; move.l AppParmHandle,a0 ; get the application parameter handle
|
||
|
;; _GetHandleSize ; are we real?
|
||
|
;; ble.s getEnd
|
||
|
;; move.l (a0),a2 ; deref appParm Handle
|
||
|
;; addq #2,a2 ; skip the msg
|
||
|
;; move.w 6+8(sp),d1 ; which entry to go to
|
||
|
;; cmp (a2)+,d1 ; see if index within limit
|
||
|
;; bgt.s getEnd
|
||
|
;; subq #1,d1 ; make index zero based
|
||
|
;;
|
||
|
;;getLoop blt.s getEnd ; are we done?
|
||
|
;; move.l a2,a0 ; where to copy from
|
||
|
;; moveq #2,d0
|
||
|
;; add.b 8(a0),d0 ; length of string
|
||
|
;; and #$FFFE,d0 ; evenize it
|
||
|
;; add #8,d0 ; also move refnum,type,versNum
|
||
|
;; add d0,a2 ; move to next
|
||
|
;; _BlockMove
|
||
|
;; subq #1,d1
|
||
|
;; bra.s getLoop
|
||
|
;;
|
||
|
;;getEnd movem.l (sp)+,a2-a3 ; restore regs
|
||
|
;; rts
|
||
|
|
||
|
;-------------------------------------------------------------------------------------
|
||
|
;
|
||
|
; void ClrAppFiles(index)
|
||
|
; short index;
|
||
|
;
|
||
|
|
||
|
;;ClrAppFiles proc EXPORT
|
||
|
;;
|
||
|
;; move.l AppParmHandle,a0 ; get the application parameter handle
|
||
|
;; _GetHandleSize ; are we real?
|
||
|
;; ble.s clrEnd
|
||
|
;; move.l (a0),a0 ; deref appParm Handle
|
||
|
;; addq #2,a0 ; skip the msg
|
||
|
;;
|
||
|
;; move.w 6(sp),d1 ; which entry to go to
|
||
|
;; cmp (a0)+,d1 ; see if index within limit
|
||
|
;; bgt.s clrEnd
|
||
|
;; subq #1,d1 ; make index zero based
|
||
|
;;
|
||
|
;;clrLoop blt.s clrEnd ; are we done?
|
||
|
;; beq.s ClrType
|
||
|
;; moveq #2,d0
|
||
|
;; add.b 8(a0),d0 ; length of string
|
||
|
;; and #$FFFE,d0 ; evenize it
|
||
|
;; add #8,d0 ; also move refnum,type,versNum
|
||
|
;; add d0,a0 ; move to next
|
||
|
;; subq #1,d1
|
||
|
;; bra.s clrLoop
|
||
|
;;
|
||
|
;;ClrType clr.l 2(a0)
|
||
|
;;clrEnd
|
||
|
;; rts
|
||
|
|
||
|
;-------------------------------------------------------------------------------------
|
||
|
;
|
||
|
; void getappparms(apName,apRefNum,apParam)
|
||
|
; char *apName;
|
||
|
; short *apRefNum;
|
||
|
; Handle *apParam;
|
||
|
|
||
|
getappparms proc EXPORT
|
||
|
import p2cstr ; p2cstr(s) char *s;
|
||
|
|
||
|
move.l d2,-(sp) ; save register d2
|
||
|
move.l 8(sp),-(sp) ; push copy of first parameter
|
||
|
move.l 16(sp),-(sp) ; push copy of second parameter
|
||
|
move.l 24(sp),-(sp) ; push copy of third parameter
|
||
|
_GetAppParms ; trap to getappparms
|
||
|
move.l 8(sp),-(sp) ; push copy of first paramter
|
||
|
jsr p2cstr ; convert to C string
|
||
|
add.w #4,sp ; balance stack
|
||
|
move.l (sp)+,d2 ; restore register d2
|
||
|
rts
|
||
|
|
||
|
END
|