[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: email@example.com
- Subject: register-trap
- From: firstname.lastname@example.org (Darryn Kozak)
- Date: Thu, 27 Aug 92 17:04:26 CDT
I have some questions regarding the definition of fsopen below.
It is from the MCL 2.0f library/interface.lisp file, the file that
defines "not in ROM" toolbox and os routines from Inside Macintosh".
In particular I'm interested in the call to ccl:register-trap. Acording
to Inside Mac. Volume VI, _HFSDispatch is trap #xA060. ":a0 pb"
indicates that pb (the address of a :hparamblockrec) is put in register
:a0 as an argument to the call. ":d0 26" indicates that 26 is to be put
into register :d0. The 26 is the selector (hex 1A), which, according to
Inside Mac again, selects one of the three routines OpenDF, PBHOpenDF or
PBOpenDF. And "(:signed-integer :d0)" indicate the type of return value
and where it will come from. My questions now are:
1. How do you know what registers to use for arg's?
2. How do you know what registers to use for the selector?
3. How do you know what registers to use for return values?
4. Which routine will be called: OpenDF, PBHOpenDF or
PBOpenDF? (and why?)
5. Why is only one arg. (pb) supplied when OpenDF takes 3,
PBOpenDF takes 2, and PBHOpenDF takes 2.
6. What is the error code -50? (I assume it means the trap call
is not available.)
7. Is this stuff documented somewhere?
; Returns two values instead of taking a var parameter
; 1) The refnum or NIL if error
; 2) The error code.
(defun fsopen (filename vrefnum)
(with-pstring-arg (namep filename)
(ccl:rlet ((pb :hparamblockrec))
(setf (ccl:rref pb :hparamblockrec.ionameptr) namep
(ccl:rref pb :hparamblockrec.iovrefnum) vrefnum
(ccl:rref pb :hparamblockrec.ioMisc) (ccl:%null-ptr)
(ccl:rref pb :hparamblockrec.ioPermssn) 0
(ccl:rref pb :hparamblockrec.ioVersNum) 0)
(let* ((err (ccl:register-trap #xA060 :a0 pb :d0 26 (:signed-integer :d0)))
(if (eql err -50)
(setq err (#_Open pb)))
(setq refnum (ccl:rref pb :hparamblockrec.iorefnum))
(values (unless (eql refnum -1) refnum) err)))))
Darryn J Kozak Cray Research Park
email@example.com 655E Lone Oak Drive
(612) 683-3610 Eagan, MN 55121
FAX (612) 683-3099 USA