Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef _STD_L1_SUB_H
- #define _STD_L1_SUB_H
- ;std/l1_sub.h
- #include "pseudoOps.h"
- ;simple anti-clobbering single-depth subroutine technology
- #define L1ARG 0xea
- #define L1IRG 0xeb
- #define L1CRG 0xec
- #define L1RTA 0xee
- #define l1call_abs(_addr) /* only saves L&H */\
- stc_abs(L1CRG) /* save C (L&H) */ &&\
- ldc_imm(_addr) && jpr /* load subroutine address && jpr */ &&\
- ldc_abs(L1CRG) /* restore C */
- #define l1call_abs_s(_addr) \
- sta $,L1ARG /* save registers to L1_RG */ &&\
- sti $,L1IRG /* ^^ */ &&\
- stc_abs(L1CRG) /* ^^ */ &&\
- ldc_imm(_addr) && jpr /* load subroutine address && jpr there */ &&\
- ldi #,0 /* restore registers after returning */ &&\
- lda @,L1ARG /* ^^ */ &&\
- ldl @,L1CRG && ldh @,1+L1CRG /* ^^ */ &&\
- ldi @,L1IRG /* ^^ */
- #define l1prep stc_abs(L1RTA) //save return address for later
- #define l1rts ldc_abs(L1RTA) && jpr //retrieve return address and return
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement