home *** CD-ROM | disk | FTP | other *** search
/ World of A1200 / World_Of_A1200.iso / programs / develop / galer / reqlibrary / reqlib.lha / ReqLib / include / macros.i
Text File  |  1990-12-18  |  2KB  |  89 lines

  1. ;------------------------------------------------------
  2.  
  3. ; This is a REALLY handly macro, that allows you to pop up messages at debugging
  4. ;points in your code. This was necessary to allow working on a multithreaded
  5. ; program, since you don't have a way of tracing the new threads.
  6.  
  7. ; If you don't define 'Debug', then this macro assembles to nothing, otherwise
  8. ;you get the requester.
  9. ;
  10. ; If you wish to display multiple paramters, simply push them on the stack
  11. ;IN REVERSE ORDER of how you wish to display them, then put the stack pointer in
  12. ;A1
  13.  
  14. ; To use this macro, you MUST link with lreqglue.o or areqglue.o.
  15. ;
  16.  
  17. ;    MOVE.L    Val2,-(SP)
  18. ;    MOVE.W    Val1,-(SP)
  19. ;    MOVE.L    String,-(SP)
  20. ;    MOVE.L    SP,A1
  21. ;    showf    <%s is a string, Val1: %d is a word, Val2: %ld is a long.> 
  22. ;    LEA    10(SP),SP
  23.  
  24. showf    MACRO
  25.     IFD    Debug
  26.  
  27.     IFD    .A68K
  28.     MOVEM.L    D0-A6,-(SP)
  29.     LEA    \\@showftext,A0
  30.     CALL    SimpleRequest
  31.     BRA    \\@around
  32.  
  33. \\@showftext    DC.B    "\1",0
  34.     EVEN
  35. \\@around
  36.     MOVEM.L    (SP)+,D0-A6
  37.     ENDC
  38.  
  39.     IFND    .A68K
  40.     MOVEM.L    D0-A6,-(SP)
  41.     LEA    \@showftext,A0
  42.     CALL    SimpleRequest
  43.     BRA    \@around
  44.  
  45. \@showftext    DC.B    "\1",0
  46.     EVEN
  47. \@around
  48.     MOVEM.L    (SP)+,D0-A6
  49.     ENDC
  50.  
  51.     ENDC
  52.     ENDM
  53.  
  54. ; The reason for two definitions is the difference between A68K (the PD
  55. ;assembler),which allows named local labels, and the Aztec assembler which
  56. ;doesn't.
  57. ; If you have a local label, and then this macro, and then a reference to that
  58. ;local variable, then under the Aztec version you would get an error, because
  59. ;the showf version (under Aztec) uses GLOBAL labels, which break up locals.
  60. ; That means that if you wish to use this macro while under Aztec, you can't use
  61. ;local labels in the same function.
  62.  
  63. ;-------------------------------------------------------------------------
  64.  
  65. CALL    MACRO
  66.     public    \1
  67.     JSR    \1
  68.     ENDM
  69.  
  70. LOADLIB    MACRO
  71.     MOVE.L    _\1Base,A6
  72.     ENDM
  73.  
  74. SYS    MACRO
  75.     XREF    _LVO\1
  76.     JSR    _LVO\1(A6)
  77.     ENDM
  78.  
  79. PUSH    MACRO
  80.     MOVEM.L    \1,-(SP)
  81.     ENDM
  82.  
  83. PULL    MACRO
  84.     MOVEM.L    (SP)+,\1
  85.     ENDM
  86.  
  87. AllRegs    REG    D0-A6
  88.  
  89.