home *** CD-ROM | disk | FTP | other *** search
/ Compendium Deluxe 1 / LSD Compendium Deluxe 1.iso / a / programming / assembly / talinasm.lha / normalizerect.asm < prev    next >
Encoding:
Assembly Source File  |  1992-03-19  |  887 b   |  31 lines

  1. * ============================================================================ *
  2. *    NormalizeRect: Fix up IBox with negative dimensions
  3. *
  4. *    struct IBox *NormalizeRect(struct IBox *b);
  5. *                      a0
  6. * ============================================================================ *
  7.  
  8.             include        'intuition/intuition.i'
  9.  
  10.             SECTION        normalrect.asm,CODE
  11.  
  12.             xdef        _NormalizeRect
  13.  
  14. _NormalizeRect
  15.             move.w        ibox_Width(a0),d0        ; get width of box
  16.             bpl.s        1$                        ; if negative
  17.             add.w        d0,ibox_Left(a0)        ; adjust left edge
  18.             neg.w        d0                        ; negate width
  19.             move.w        d0,ibox_Width(a0)        ; store back
  20. 1$            
  21.             move.w        ibox_Height(a0),d0        ; get height of box
  22.             bpl.s        2$                        ; if negative
  23.             add.w        d0,ibox_Top(a0)            ; adjust top edge
  24.             neg.w        d0                        ; negate height
  25.             move.w        d0,ibox_Height(a0)        ; store back
  26. 2$            
  27.             move.l        a0,d0                    ; return address of box
  28.             rts
  29.             
  30.             end
  31.