home *** CD-ROM | disk | FTP | other *** search
/ HyperLib 1997 Winter - Disc 1 / HYPERLIB-1997-Winter-CD1.ISO.7z / HYPERLIB-1997-Winter-CD1.ISO / オンラインウェア / PRG / ABZmonPPC_ト.sit / ABZmonPPC_ƒ / test_deb_ƒ / macro.set next >
Text File  |  1995-08-13  |  2KB  |  110 lines

  1. # Macro.set, by Alain Birtz
  2.  
  3. ##################################################
  4.  
  5. linkageArea    equ    24
  6. params        equ    32
  7. CALL_STK_SZ    equ    linkageArea+params
  8.  
  9. DEBUG_MAC        equ    $7F810808        # Mac OS debug instruction (tw lt_gt_eq,r1,r1)
  10. DEBUG_1ST        equ    $04000000        # first debug instruction
  11. BRK_1ST        equ    DEBUG_1ST+16    # first break point instruction
  12.  
  13. ##################################################
  14.  
  15.     MACRO
  16.     MAC_OS    &OSname
  17.  
  18.     import    .&OSname
  19.  
  20.     mflr    r0
  21.     stwu    r0,-4(sp)            # save LR
  22.     stwu    sp,-CALL_STK_SZ(sp)        # stack space needed for cross-TOC call
  23.     bl    .&OSname
  24.     nop                # the linker change 'nop' for 'lwz rtoc,$14(sp)'
  25.     lwz    r0,CALL_STK_SZ(sp)
  26.     mtlr    r0            # restore LR
  27.     addi    sp,sp,4+CALL_STK_SZ        # clean stack
  28.  
  29.     ENDM    
  30.  
  31. ##################################################
  32.  
  33.     MACRO
  34.     CALL    &CALLname
  35.  
  36.     import    .&CALLname
  37.  
  38.     mflr    r0
  39.     stwu    r0,-4(sp)            # save LR
  40.     stwu    sp,-CALL_STK_SZ(sp)        # stack space needed for cross-TOC call
  41.     bl    .&CALLname
  42.     nop                # the linker change 'nop' for 'lwz rtoc,$14(sp)'
  43.     lwz    r0,CALL_STK_SZ(sp)
  44.     mtlr    r0            # restore LR
  45.     addi    sp,sp,4+CALL_STK_SZ        # clean stack
  46.  
  47.     ENDM    
  48.  
  49. ###################
  50.  
  51.     MACRO
  52.     JSR    &subroutine
  53.  
  54.     mflr    r0
  55.     stwu    r0,-4(sp)            # save LR
  56.     bl    &subroutine        # jump to subroutine
  57.     lwz    r0,0(sp)
  58.     addi    sp,sp,4
  59.     mtlr    r0            # restore LR
  60.  
  61.     ENDM    
  62.  
  63. ###################
  64.  
  65.     MACRO
  66.     _Debugger
  67.  
  68.     dc.l    DEBUG_1ST            # illegal intruction
  69.  
  70.     ENDM    
  71.  
  72. ###################
  73.  
  74.     MACRO
  75.     _DebugStr
  76.  
  77.     dc.l    DEBUG_1ST+1        # illegal intruction
  78.  
  79.     ENDM    
  80.  
  81. ###################
  82.  
  83.     MACRO
  84.     _DebugNum
  85.  
  86.     dc.l    DEBUG_1ST+2        # illegal intruction
  87.  
  88.     ENDM    
  89.  
  90. ###################
  91.  
  92.     MACRO
  93.     MacDebugger
  94.  
  95.     dc.l    DEBUG_MAC            # tw lt_gt_eq,r1,r1
  96.  
  97.     ENDM    
  98.  
  99. ###################
  100.  
  101.     MACRO
  102.     MacDebugStr
  103.  
  104.     dc.l    DEBUG_MAC            # tw lt_gt_eq,r1,r1
  105.  
  106.     ENDM    
  107.  
  108. ##################################################
  109.  
  110.