Searching \ for 'Useful Macros for Store Allocation on 16Cxx Chips ' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=16C
Search entire site for: 'Useful Macros for Store Allocation on 16Cxx Chips '.

Truncated match.
PICList Thread
'Useful Macros for Store Allocation on 16Cxx Chips '
1994\07\01@112019 by john

flavicon
picon face

Here are a couple of MPALC macros I found useful for storage
allocation on PICs.  They're for when you wat a register allocated
but don't care which; you can choose whether to allocate from the
top or bottom end of the register set.  The parameters given here
do for 16C71 and 16C84 PICs, for others change RAM_Start and MAX_RAM.

If you like these, I also have some code for implementing timed finite
state machine dispatch (a machine is a set of states;  the current state
is executed after a delay specified as a number of calls of the dispatcher;
states can set the next state and next delay to dispatch to;  for N instances
of machines, it uses 2N+2 registers, 2N of them permanently and 2 as temps
for dispatch).  I also have a master transmitter and slave receiver I^2 C
implementation for PICs (16C84 or 16C71) running at > 6MHz that supports
multimaster operation (in theory).  If you are interested, say so, and I'll
post the code.

John Hallam, AI Dept., Edinburgh University.

-------------------cut here for MPALC code---------------------------

;******************************** Register File Store Allocation
;
; These macros allocate store from the register file.  If there is
; enough store they succeed, defining the specified label.  If not,
; they fail, leaving the label undefined and so inducing errors.

       RAM_Start       equ     0Ch             ; First GP Register
       MAX_RAM         equ     30h             ; Last GP Register + 1

       RAM_Lo          set     RAM_Start       ; Current low water mark
       RAM_Hi          set     MAX_RAM         ; Current high water mark

       AllocHi macro   label,amount            ; Allocate store called <label>

               if      RAM_Lo+amount > RAM_Hi  ; Not enough registers  
               exitm                           ; ERROR EXIT
               else
               RAM_Hi  set     RAM_Hi-amount   ; Adjust mark
               label   equ     RAM_Hi          ; Allocate at high end
               endif
               endm

       AllocLo macro   label,amount            ; Allocate store called <label>

               if      RAM_Lo+amount > RAM_Hi  ; Not enough registers  
               exitm                           ; ERROR EXIT
               else
               label   equ     RAM_Lo          ; Allocate at low end
               RAM_Lo  set     RAM_Lo+amount   ; Adjust mark
               endif
               endm


More... (looser matching)
- Last day of these posts
- In 1994 , 1995 only
- Today
- New search...