home *** CD-ROM | disk | FTP | other *** search
/ APDL Public Domain 1 / APDL_PD1A.iso / program / assembler / tasm / expand_ex / 3p_H next >
Encoding:
Text File  |  1992-09-02  |  2.4 KB  |  121 lines

  1.          2nd September 1992
  2.          A fragment from one of my source code header files
  3.          showing how to use #MACRO
  4.          
  5.          The computer is an 8051..
  6.  
  7.  
  8.  
  9. ;
  10. ;       --------------------------------------------------
  11. ;       Data-Base.
  12. ;
  13. #MACRO  SET     addr,nbyt
  14. addr    .EQU    $
  15.         $=$+nbyt
  16. #MEND
  17. ;
  18. #MACRO  BIT     name,base,bno
  19. name    .EQU    ((base-BIT_BASE)*8)+bno
  20. #MEND
  21. ;
  22. STACK_BASE      .EQU    050H    ; Program Stack origin.
  23. STACK_RAM       .EQU    030H    ; Top Ram store.
  24. DOG_ADDR        .EQU    0800H
  25. BIT_BASE        .EQU    20H
  26. START_BYTES     .EQU    08H
  27. END_BYTES       .EQU    (STACK_BASE-1)
  28. ;
  29. ;       --------------------------------------------------
  30. ;       INPUTS
  31. ;
  32. Pkey    .EQU    P1+0   
  33. Pfn1    .EQU    P1+1 
  34. Pvin    .EQU    P1+2   
  35. Prd0    .EQU    P1+3 
  36. Pfn0    .EQU    P1+4  
  37. Pign    .EQU    P1+5  
  38. Tmpr    .EQU    P1+7   
  39. Prd1    .EQU    P3+0 
  40. ;
  41. ;       Synonyms.
  42. ;
  43. Pbut    .EQU    Pfn1
  44. Pfn2    .EQU    Prd1
  45. Puin    .EQU    Prd0
  46. ;
  47. ;       --------------------------------------------------
  48. ;       OUTPUTS
  49. ;
  50. Trm     .EQU    P1+6    
  51. Led     .EQU    P3+1  
  52. Alm     .EQU    P3+2 
  53. Imo     .EQU    P3+3  
  54. Ksw     .EQU    P3+4    ;Keyswitch Drive Voltage
  55. Usw     .EQU    P3+5    ; T:13 User Accessory Port Output
  56. ;
  57. ;       Synonyms.
  58. ;
  59. Relay   .EQU    Alm
  60. Buzz    .EQU    Led
  61. Vidas   .EQU    Usw
  62. ;
  63.         .ORG    START_BYTES
  64.         
  65.         SET     Keycnt,1   
  66.  
  67. ;
  68. ;       Guard against overflow into Bit Map area.
  69. ;
  70. #IF     ($>BIT_BASE)
  71. +++++++++++++ Overflow
  72. #ENDIF
  73.         .ORG    STACK_RAM
  74.         SET     Pancnt,2    
  75.         SET     Faucnt,2   
  76. ;
  77. ;       Extra Counters for volts & Tamper.
  78. ;
  79.         SET     Tampcnt,1
  80.         SET     Voltcnt,1
  81.         SET     Scount,1
  82. ;
  83. ;       STORAGE SPACE for individual programs
  84. ;
  85. PRJ_BYTES       .EQU    $
  86. ;
  87. #IF     ($>STACK_BASE)
  88. +++++++++++++ Overflow
  89. #ENDIF
  90.  
  91. ;
  92. ;       Bit Flags for filters Map 020H.
  93. ;
  94.         .ORG    BIT_BASE
  95.         SET     BM0,1
  96.         BIT     Key,BM0,0       ;Keyswitch Value
  97.         BIT     Fn0,BM0,1       ;Front Door 0
  98.         BIT     Fn1,BM0,2       ;Front Door 1
  99.         BIT     Rd0,BM0,3       ;Rear Door 0
  100.         BIT     Rd1,BM0,4       ;Rear Door 1
  101.         BIT     Vin,BM0,5       ;V supply
  102.         BIT     Ign,BM0,6       ;Ignition
  103. ;
  104. ;       Synonyms.
  105. ;
  106. But     .EQU    Fn1
  107. Fn2     .EQU    Rd1
  108. Uin     .EQU    Rd0
  109. ;
  110. PRJ_BITS        .EQU    $
  111. ;
  112. ;       Bit Storage for projects
  113. ;
  114. #IF     ($>STACK_RAM)
  115. +++++++++++++ Overflow
  116. #ENDIF
  117. ;
  118.  
  119.  
  120.  
  121.