[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding MOVEM to LAP



At  0:14 11/21/92 +0000, Erann Gat wrote:
>The LAP assembler doesn't seem to handle the MOVEM instruction.  LAP is
>supposed to be extensible (via the DEFLAPGEN macro).  Has anyone added
>MOVEM before I start reinventing the wheel?

It works fine for me. Maybe you're getting the form of the arguments
wrong. The first arg is a vector of register names. The second is a
standard destination addressing mode (usually "areg@+" or "-@areg").
Here's an example from the file "ccl:lib;windoids.lisp" which is on
the MCL 2.0 CD:

(in-package :ccl)

(defun windoid-wdef (&lap 0)
  (lap
    @lispA5
    (dc.w 0 0)
    @defpascal
    (dc.w 0 0)
    (sub.l ($ 4) sp)                    ; space for defpascal address
    (link a6 ($ 0))
    (equate _variation 12)
    (equate _wptr (+ _variation 2))
    (equate _message (+ _wptr 4))
    (equate _parameter (+ _message 2))
    (equate _return (+ _parameter 4))
    (movem.l #(a5 d0 a0) -@sp)          ; <========== MOVEM ************
    (lea (^ @defpascal) a5)
    (move.l @a5 (a6 4))                 ; defpascal entry point
    (move.l -@a5 a5)                    ; Lisp's A5
    (if# (ne (tst.b (a5 $gcON)))
      (move.w (a6 _message) d0)
      (if# (ne (cmp.w ($ #.$wHit) d0))
        ; Maybe we should frame the strucRgn on a draw command
        (move.l ($ 0) (a6 _return))
       else#
        (sub.w ($ 2) sp)                ; result from _PtInRgn
        (spush (a6 _parameter))
        (move.l (a6 _wptr) a0)
        (spush (a0 #.(get-field-offset :windowrecord.strucrgn)))
        (dc.w #_PtInRgn)
        (if# (ne (tst.w sp@+))
          (move.l ($ #.$wInContent) (a6 _return))
          else#
          (move.l ($ #.$wNoHit) (a6 _return))))
      (movem.l sp@+ #(a5 d0 a0))        ; ; <========== MOVEM ************
      (unlk a6)
      (add.l ($ 4) sp)
      (move.l sp@+ (sp (- _return 12)))
      (lea (sp (- _return 8)) sp)
      (rts)
     else#
      (movem.l sp@+ #(a5 d0 a0))
      (unlk a6)
      (rts))))