home *** CD-ROM | disk | FTP | other *** search
- 2nd September 1992
- A fragment from one of my source code header files
- showing how to use #MACRO
-
- The computer is an 8051..
-
-
-
- ;
- ; --------------------------------------------------
- ; Data-Base.
- ;
- #MACRO SET addr,nbyt
- addr .EQU $
- $=$+nbyt
- #MEND
- ;
- #MACRO BIT name,base,bno
- name .EQU ((base-BIT_BASE)*8)+bno
- #MEND
- ;
- STACK_BASE .EQU 050H ; Program Stack origin.
- STACK_RAM .EQU 030H ; Top Ram store.
- DOG_ADDR .EQU 0800H
- BIT_BASE .EQU 20H
- START_BYTES .EQU 08H
- END_BYTES .EQU (STACK_BASE-1)
- ;
- ; --------------------------------------------------
- ; INPUTS
- ;
- Pkey .EQU P1+0
- Pfn1 .EQU P1+1
- Pvin .EQU P1+2
- Prd0 .EQU P1+3
- Pfn0 .EQU P1+4
- Pign .EQU P1+5
- Tmpr .EQU P1+7
- Prd1 .EQU P3+0
- ;
- ; Synonyms.
- ;
- Pbut .EQU Pfn1
- Pfn2 .EQU Prd1
- Puin .EQU Prd0
- ;
- ; --------------------------------------------------
- ; OUTPUTS
- ;
- Trm .EQU P1+6
- Led .EQU P3+1
- Alm .EQU P3+2
- Imo .EQU P3+3
- Ksw .EQU P3+4 ;Keyswitch Drive Voltage
- Usw .EQU P3+5 ; T:13 User Accessory Port Output
- ;
- ; Synonyms.
- ;
- Relay .EQU Alm
- Buzz .EQU Led
- Vidas .EQU Usw
- ;
- .ORG START_BYTES
-
- SET Keycnt,1
-
- ;
- ; Guard against overflow into Bit Map area.
- ;
- #IF ($>BIT_BASE)
- +++++++++++++ Overflow
- #ENDIF
- .ORG STACK_RAM
- SET Pancnt,2
- SET Faucnt,2
- ;
- ; Extra Counters for volts & Tamper.
- ;
- SET Tampcnt,1
- SET Voltcnt,1
- SET Scount,1
- ;
- ; STORAGE SPACE for individual programs
- ;
- PRJ_BYTES .EQU $
- ;
- #IF ($>STACK_BASE)
- +++++++++++++ Overflow
- #ENDIF
-
- ;
- ; Bit Flags for filters Map 020H.
- ;
- .ORG BIT_BASE
- SET BM0,1
- BIT Key,BM0,0 ;Keyswitch Value
- BIT Fn0,BM0,1 ;Front Door 0
- BIT Fn1,BM0,2 ;Front Door 1
- BIT Rd0,BM0,3 ;Rear Door 0
- BIT Rd1,BM0,4 ;Rear Door 1
- BIT Vin,BM0,5 ;V supply
- BIT Ign,BM0,6 ;Ignition
- ;
- ; Synonyms.
- ;
- But .EQU Fn1
- Fn2 .EQU Rd1
- Uin .EQU Rd0
- ;
- PRJ_BITS .EQU $
- ;
- ; Bit Storage for projects
- ;
- #IF ($>STACK_RAM)
- +++++++++++++ Overflow
- #ENDIF
- ;
-
-
-
-