/* ; Vorlage war: ; forth.h: Register, Model, and Macro declarations - MSP430F1611 ; B. Rodriguez 3 Jan 09 ; ---------------------------------------------------------------------- */ // ; FORTH MEMORY USAGE // ; for Flash memory operations - this includes information and main // ; ROM, but not the main ROM used by the kernel (above E000h) #define INFOSTART (0x1000) // ok mk #define INFOEND (0x10FF) // ok mk #define RAMSTART (0x0200) // ok mk #define RAMEND (0x03FF) // ok mk #define FLASHSTART (0xC000) // ok mk #define FLASHEND (0xDFFF) // ok mk #define MAINSEG (512) // wozu ?? mk #define INFOSEG (128) // ?? mk // ; FORTH REGISTER USAGE // ; Forth virtual machine #define RSP SP #define PSP R4 #define IP R5 #define W R6 #define TOS R7 // ; Loop parameters in registers #define INDEX R8 #define LIMIT R9 // ; Scratch registers #define X R10 #define Y R11 #define Q R12 #define T R13 // ; T.I. Integer Subroutines Definitions #define IROP1 TOS #define IROP2L R10 #define IROP2M R11 #define IRACL R12 #define IRACM R13 #define IRBT W #define fcpu (8000) ; Takt in KHz, siehe se-init430G2553.s43 // ; INDIRECT-THREADED NEXT NEXT MACRO MOV @IP+,W // ; fetch word address into W MOV @W+,PC // ; fetch code address into PC, W=PFA ENDM // ; BRANCH DESTINATION (RELATIVE BRANCH) // ; For relative branch addresses, i.e., a branch is ADD @IP,IP DEST MACRO label DW label-$ ENDM // ; HEADER CONSTRUCTION MACROS HEADER MACRO asmname,length,litname,action PUBLIC asmname DW link DB 0FFh ; not immediate link SET $ DB length DB litname EVEN IF 'action'='DOCODE' asmname: DW $+2 ELSE asmname: DW action ENDIF ENDM HEADLESS MACRO asmname,action PUBLIC asmname IF 'action'='DOCODE' asmname: DW $+2 ELSE asmname: DW action ENDIF ENDM IMMED MACRO asmname,length,litname,action PUBLIC asmname DW link DB 0FEh // ; immediate (LSB=0) link SET $ DB length DB litname EVEN IF 'action'='DOCODE' asmname: DW $+2 ELSE asmname: DW action ENDIF ENDM HEADERLESS MACRO asmname,length,litname,action PUBLIC asmname IF 'action'='DOCODE' asmname: DW $+2 ELSE asmname: DW action ENDIF ENDM