home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / lisp / mcl / 1677 < prev    next >
Encoding:
Text File  |  1992-11-23  |  2.4 KB  |  66 lines

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!sun-barr!ames!data.nas.nasa.gov!taligent!apple!cambridge.apple.com!bill@cambridge.apple.com
  2. From: bill@cambridge.apple.com (Bill St. Clair)
  3. Newsgroups: comp.lang.lisp.mcl
  4. Subject: Re: Adding MOVEM to LAP
  5. Message-ID: <9211231909.AA05627@cambridge.apple.com>
  6. Date: 23 Nov 92 20:15:47 GMT
  7. Sender: info-mcl-request@cambridge.apple.com
  8. Lines: 55
  9. Approved: comp.lang.lisp.mcl@Cambridge.Apple.C0M
  10.  
  11. At  0:14 11/21/92 +0000, Erann Gat wrote:
  12. >The LAP assembler doesn't seem to handle the MOVEM instruction.  LAP is
  13. >supposed to be extensible (via the DEFLAPGEN macro).  Has anyone added
  14. >MOVEM before I start reinventing the wheel?
  15.  
  16. It works fine for me. Maybe you're getting the form of the arguments
  17. wrong. The first arg is a vector of register names. The second is a
  18. standard destination addressing mode (usually "areg@+" or "-@areg").
  19. Here's an example from the file "ccl:lib;windoids.lisp" which is on
  20. the MCL 2.0 CD:
  21.  
  22. (in-package :ccl)
  23.  
  24. (defun windoid-wdef (&lap 0)
  25.   (lap
  26.     @lispA5
  27.     (dc.w 0 0)
  28.     @defpascal
  29.     (dc.w 0 0)
  30.     (sub.l ($ 4) sp)                    ; space for defpascal address
  31.     (link a6 ($ 0))
  32.     (equate _variation 12)
  33.     (equate _wptr (+ _variation 2))
  34.     (equate _message (+ _wptr 4))
  35.     (equate _parameter (+ _message 2))
  36.     (equate _return (+ _parameter 4))
  37.     (movem.l #(a5 d0 a0) -@sp)          ; <========== MOVEM ************
  38.     (lea (^ @defpascal) a5)
  39.     (move.l @a5 (a6 4))                 ; defpascal entry point
  40.     (move.l -@a5 a5)                    ; Lisp's A5
  41.     (if# (ne (tst.b (a5 $gcON)))
  42.       (move.w (a6 _message) d0)
  43.       (if# (ne (cmp.w ($ #.$wHit) d0))
  44.         ; Maybe we should frame the strucRgn on a draw command
  45.         (move.l ($ 0) (a6 _return))
  46.        else#
  47.         (sub.w ($ 2) sp)                ; result from _PtInRgn
  48.         (spush (a6 _parameter))
  49.         (move.l (a6 _wptr) a0)
  50.         (spush (a0 #.(get-field-offset :windowrecord.strucrgn)))
  51.         (dc.w #_PtInRgn)
  52.         (if# (ne (tst.w sp@+))
  53.           (move.l ($ #.$wInContent) (a6 _return))
  54.           else#
  55.           (move.l ($ #.$wNoHit) (a6 _return))))
  56.       (movem.l sp@+ #(a5 d0 a0))        ; ; <========== MOVEM ************
  57.       (unlk a6)
  58.       (add.l ($ 4) sp)
  59.       (move.l sp@+ (sp (- _return 12)))
  60.       (lea (sp (- _return 8)) sp)
  61.       (rts)
  62.      else#
  63.       (movem.l sp@+ #(a5 d0 a0))
  64.       (unlk a6)
  65.       (rts))))
  66.