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