mirror of
https://github.com/elliotnunn/mac-rom.git
synced 2025-01-14 21:29:53 +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.
166 lines
5.2 KiB
Plaintext
166 lines
5.2 KiB
Plaintext
include 'macintosh.a'
|
|
; toolutils.a
|
|
;
|
|
; Copyright Apple Computer, Inc. 1984-1988
|
|
; All rights reserved.
|
|
;
|
|
; 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 ***
|
|
|
|
|
|
; getindstring(theString,strListID,index)
|
|
; char *theString <stringOut>;
|
|
; short strListID;
|
|
; short index;
|
|
|
|
|
|
BLANKS ON
|
|
STRING ASIS
|
|
|
|
getindstring proc EXPORT
|
|
link a6,#0 ; link
|
|
move.l d2,-(sp) ; save register d2
|
|
subq #4,sp ; GetResource result
|
|
move.l #'STR#',-(sp) ; theType
|
|
move.w 14(a6),-(sp) ; strListID
|
|
_GetResource ; get resource
|
|
move.l 8(a6),a1 ; theString
|
|
clr.b (a1) ; assume empty
|
|
move.l (sp)+,d0 ; handle to string list
|
|
move.l (sp)+,d2 ; restore register d2
|
|
tst.l d0 ; test result
|
|
beq.s gsret ; if empty, just quit
|
|
|
|
move.l d0,a0 ; handle to string list
|
|
move.l (a0),a0 ; pointer to string list
|
|
move.w (a0)+,d0 ; number of strings
|
|
move.w 18(a6),d1 ; index
|
|
ble.s gsret ; return if index <= 0
|
|
|
|
cmp.w d0,d1 ; index > number of strings ?
|
|
bgt.s gsret ; return if index > number
|
|
moveq #0,d0 ; clear for string lengths
|
|
|
|
gsLoop subq.w #1,d1 ; decrement the index
|
|
beq.s gsCopy ; found the one we are looking for
|
|
move.b (a0)+,d0 ; get length of this one
|
|
add.l d0,a0 ; skip over this string
|
|
bra.s gsLoop ; and go on to next
|
|
|
|
gsCopy move.b (a0),d0 ; get the length of this string
|
|
addq.w #1,a0 ; skip length byte in source
|
|
move.w d0,d1 ; save the length
|
|
_BlockMove ; copy it into theString
|
|
clr.b 0(a1,d1) ; set terminator byte
|
|
|
|
gsret unlk a6 ; unlink
|
|
rts ; return
|
|
|
|
|
|
; GetIndPattern(thePattern,patListID,index)
|
|
; Pattern *thePattern;
|
|
; short patListID;
|
|
; short index;
|
|
|
|
;;GetIndPattern proc EXPORT
|
|
;; link a6,#0 ; link
|
|
;; move.l d2,-(sp) ; save register d2
|
|
;; subq #4,sp ; GetResource result
|
|
;; move.l #'PAT#',-(sp) ; theType
|
|
;; move.w 14(a6),-(sp) ; patListID
|
|
;; _GetResource ; get resource
|
|
;; move.l 8(a6),a1 ; thePattern
|
|
;; move.l (sp)+,d0 ; handle to pattern list
|
|
;; move.l (sp)+,d2 ; restore register d2
|
|
;; tst.l d0 ; test result
|
|
;; beq.s gpret ; if empty, just quit
|
|
;;
|
|
;; move.l d0,a0 ; handle to pattern list
|
|
;; move.l (a0),a0 ; pointer to pattern list
|
|
;; move.w (a0)+,d0 ; number of patterns
|
|
;; move.w 18(a6),d1 ; index
|
|
;; ble.s gpret ; return if index <= 0
|
|
;;
|
|
;; cmp.w d0,d1 ; index > number of patterns
|
|
;; bgt.s gpret ; return if index > number
|
|
;;
|
|
;;gpLoop subq.w #1,d1 ; decrement the index
|
|
;; beq.s gpCopy ; found the one we are looking for
|
|
;; addq #8,a0 ; skip over the pattern
|
|
;; bra.s gpLoop ; and go on to next
|
|
;;
|
|
;;gpCopy moveq #8,d0 ; a pattern is 8 bytes
|
|
;; _BlockMove ; copy it into thePattern
|
|
;;
|
|
;;gpret unlk a6 ; unlink
|
|
;; rts ; return
|
|
|
|
|
|
; void ScreenRes(scrnHRes,scrnVRes)
|
|
; short *scrnHRes;
|
|
; short *scrnVRes;
|
|
;
|
|
;;ScreenRes proc EXPORT
|
|
;;
|
|
;; move.l 4(sp),a1 ; get scrnHRes address
|
|
;; move scrHRes,(a1)
|
|
;; move.l 8(sp),a1 ; get scrnVRes address
|
|
;; move scrVRes,(a1)
|
|
;; rts
|
|
|
|
|
|
newstring proc EXPORT
|
|
import c2pstr ; c2pstr(s) char *s;
|
|
import p2cstr ; p2cstr(s) char *s;
|
|
move.l d2,-(sp) ; save register d2
|
|
clr.l -(sp) ; reserve space for result
|
|
move.l 12(sp),-(sp) ; push copy of first parameter
|
|
jsr c2pstr ; convert to Pascal string
|
|
dc.w $A906 ; trap to newstring
|
|
move.l 12(sp),-(sp) ; push copy of first paramter
|
|
jsr p2cstr ; convert back to C string
|
|
add.w #4,sp ; balance stack
|
|
move.l (sp)+,d0 ; load result
|
|
move.l (sp)+,d2 ; restore register d2
|
|
rts
|
|
|
|
setstring proc EXPORT
|
|
import c2pstr ; c2pstr(s) char *s;
|
|
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
|
|
jsr c2pstr ; convert to Pascal string
|
|
dc.w $A907 ; trap to setstring
|
|
move.l 12(sp),-(sp) ; push copy of second paramter
|
|
jsr p2cstr ; convert back to C string
|
|
add.w #4,sp ; balance stack
|
|
move.l (sp)+,d2 ; restore register d2
|
|
rts
|
|
|
|
shieldcursor proc EXPORT
|
|
move.l d2,-(sp) ; save register d2
|
|
move.l 8(sp),-(sp) ; push copy of first parameter
|
|
move.l 16(sp),a0 ; load address of second parameter
|
|
move.l (a0),-(sp) ; push value of second parameter
|
|
dc.w $A855 ; trap to shieldcursor
|
|
move.l (sp)+,d2 ; restore register d2
|
|
rts
|
|
|
|
deltapoint proc EXPORT
|
|
move.l d2,-(sp) ; save register d2
|
|
clr.l -(sp) ; reserve space for result
|
|
move.l 12(sp),a0 ; load address of first parameter
|
|
move.l (a0),-(sp) ; push value of first parameter
|
|
move.l 20(sp),a0 ; load address of second parameter
|
|
move.l (a0),-(sp) ; push value of second parameter
|
|
dc.w $A94F ; trap to deltapoint
|
|
move.l (sp)+,d0 ; load result
|
|
move.l (sp)+,d2 ; restore register d2
|
|
rts
|
|
|
|
END
|