pic18/const.ss
#lang scheme/base
(provide
 (all-defined-out))
(require
 "../coma.ss")


;; The PIC18 kernel uses standard machine register names to implement
;; functionality. However, not all names are defined on all machines,
;; but if they are, they work the same in all practical cases. This
;; file solves the following problems:
;;
;;   * create stub macros that are later redefined when machine
;;     specific macros are loaded.
;;
;;   * create scheme wrapper values in the form of computations to be
;;     evaluated at assembly time.


;; NOTE: there are simply too many such parameters to make this kind
;; of linking static (testable at PIC18 compiler compile time) by
;; making the parameterization explicit. Therefore, each of the names
;; below by default generates an exception when it is invoked. As a
;; result it is possible that during compilation (PIC18 compiler
;; execution time) some macros remain undefined.


(constants

 ;; generic registers
 TOSL TOSH TOSU
 WREG STATUS C Z
 
 ;; multiplier
 PRODL PRODH

 ;; flash access
 TBLPTRL TBLPTRH TABLAT

 ;; indirect addressing
 FSR0L FSR0H POSTDEC0 PREINC0 POSTINC0 INDF0 PLUSW0
 FSR1L FSR1H POSTDEC1 PREINC1 POSTINC1 INDF1 PLUSW1
 FSR2L FSR2H POSTDEC2 PREINC2 POSTINC2 INDF2 PLUSW2

 ;; register access
 TRISC
 TRISD
 TRISE
 
 )