OSDN Git Service

V309 Modified APPEND" in the long run, clusters can become non-contiguous
[fast-forth/master.git] / inc / MSP430FR6989.pat
index fd711b6..65ecd1e 100644 (file)
@@ -38,23 +38,71 @@ INFO_LEN=\$0200!
 ! ----------------------------------------------
 ! FastForth INFO
 ! ----------------------------------------------
-INI_THREAD=\$1800!      .word THREADS
-TERMBRW_RST=\$1802!     .word TERMBRW_RST
-TERMMCTLW_RST=\$1804!   .word TERMMCTLW_RST
-FREQ_KHZ=\$1806!        .word FREQUENCY
-
-SAVE_SYSRSTIV=\$1808!   to enable SYSRSTIV read
-LPM_MODE=\$180A!        LPM0+GIE is the default mode
-INIDP=\$180C!           define RST_STATE, init by wipe
-INIVOC=\$180E!          define RST_STATE, init by wipe
-VERSION=\$1810!
-KERNEL_ADDON=\$1812!
-RXON=\$1814!
-RXOFF=\$1816!
-ReadSectorWX=\$1818!    call with W = SectorLO  X = SectorHI
-WriteSectorWX=\$181A!   call with W = SectorLO  X = SectorHI
-TERMINAL_INT=\$181C!    value for TERMINAL vector
-
+FREQ_KHZ=\$1800!        FREQUENCY (in kHz)
+TERMBRW_RST=\$1802!     TERMBRW_RST
+TERMMCTLW_RST=\$1804!   TERMMCTLW_RST
+I2CSLAVEADR=\$1802!     I2C_SLAVE address
+I2CSLAVEADR1=\$1804!
+LPM_MODE=\$1806!        LPM_MODE value, LPM0+GIE is the default value
+USERSTIV=\$1808!        user SYS variable, defines software RESET, DEEP_RST, INIT_HARWARE, etc.
+VERSION=\$180A!
+THREADS=\$180C!         THREADS
+KERNEL_ADDON=\$180E!    BIT15=FLOORED DIVISION
+!                       BIT14=LF_XTAL
+!                       BIT13=UART CTS
+!                       BIT12=UART RTS
+!                       BIT11=UART XON/XOFF
+!                       BIT10=UART half duplex
+!                       BIT9=I2C_TERMINAL
+!                       BIT8=Q15.16 input
+!                       BIT7=DOUBLE input
+!                       BIT6=assembler 20 bits
+!                       BIT5=assembler 16 bits
+!                       BIT4=assembler 16 bits with 20 bits addr
+!                       BIT3=vocabulary set
+!                       BIT2=
+!                       BIT1=
+!                       BIT0=
+!
+DEEP_ORG=\$1810!        MOV #DEEP_ORG,X
+DEEP_TERM_VEC=\$1810!   to DEEP_INIT TERMINAL vector
+DEEP_COLD=\$1812!       to DEEP_INIT COLD_APP
+DEEP_SOFT=\$1814!       to DEEP_INIT SOFT_APP
+DEEP_HARD=\$1816!       to DEEP_INIT HARD_APP
+DEEP_SLEEP=\$1818!      to DEEP_INIT SLEEP_APP
+DEEP_DP=\$181A!         to DEEP_INIT RST_DP
+DEEP_LASTVOC=\$181C!    to DEEP_INIT RST_LASTVOC
+DEEP_CURRENT=\$181E!    to DEEP_INIT RST_CURRENT
+DEEP_CONTEXT=\$1820!    to DEEP_INIT RST_CONTEXT
+!
+PUC_ABORT_ORG=\$1822!   MOV #PUC_ABORT_ORG,X
+INIT_ACCEPT=\$1822!     to INIT PFA_ACCEPT
+INIT_EMIT=\$1824!       to INIT PFA_EMIT
+INIT_KEY=\$1826!        to INIT PFA_KEY
+INIT_CIB=\$1828!        to INIT CIB_ORG
+FORTH_ORG=\$182A!       MOV #FORTH_ORG,X        \to preserve the state of DEFERed words
+INIT_RSP=\$182A!        to INIT RSP
+INIT_DOCOL=\$182C!      to INIT rDOCOL   (R4) to restore rDOCOL: MOV &INIT_DOCOL,rDOCOL
+INIT_DODOES=\$182E!     to INIT rDODOES  (R5)
+INIT_DOCON=\$1830!      to INIT rDOCON   (R6)
+INIT_DOVAR=\$1832!      to INIT rDOVAR   (R7)
+INIT_CAPS=\$1834!       to INIT CAPS
+INIT_BASE=\$1836!       to INIT BASE
+INIT_LEAVE=\$1838!      to INIT LEAVEPTR
+!
+RST_ORG=\$183A!
+RST_LEN=\$10!
+COLD_APP=\$183A!        COLD_APP
+SOFT_APP=\$183C!        SOFT_APP
+HARD_APP=\$183E!        HARD_APP
+SLEEP_APP=\$1840!       SLEEP_APP
+RST_DP=\$1842!          RST_RET value for (RAM) DDP
+RST_LASTVOC=\$1844!     RST_RET value for (RAM) LASTVOC
+RST_CURRENT=\$1846!     RST_RET value for (RAM) CURRENT
+RST_CONTEXT=\$1848!     RST_RET value for (RAM) CONTEXT (8 CELLS)
+!
+! $185A = free EPROM
+!
 ! ============================================
 ! FRAM TLV
 ! ============================================
@@ -76,54 +124,49 @@ LSTACK_SIZE=\#16! words
 PSTACK_SIZE=\#48! words
 RSTACK_SIZE=\#48! words
 PAD_LEN=\#84! bytes
-TIB_LEN=\#84! bytes
+CIB_LEN=\#84! bytes
 HOLD_SIZE=\#34! bytes
 
 ! ----------------------------------------------
 ! FastForth RAM memory map (>= 1k):
 ! ----------------------------------------------
-LEAVEPTR=\$1C00!    \ Leave-stack pointer, init by QUIT
-LSATCK=\$1C00!      \ leave stack,      grow up
-PSTACK=\$1C80!      \ parameter stack,  grow down
-RSTACK=\$1CE0!      \ Return stack,     grow down
-
-PAD_I2CADR=\$1CE0!  \ RX I2C address
-PAD_I2CCNT=\$1CE2!  \ count max
-PAD_ORG=\$1CE4!     \ user scratch pad buffer, 84 bytes, grow up
-
-TIB_I2CADR=\$1D38!  \ TX I2C address
-TIB_I2CCNT=\$1D3A!  \ count of bytes
-TIB_ORG=\$1D3C!     \ Terminal input buffer, 84 bytes, grow up
-
-HOLDS_ORG=\$1D90!   \ base address for HOLDS
-HOLD_BASE=\$1DB2!   \ BASE HOLD area, grow down
-
-! ----------------------
-! NOT SAVED VARIABLES
-! ----------------------
-
+LEAVEPTR=\$1C00!        Leave-stack pointer, init by QUIT
+LSATCK=\$1C00!          leave stack,      grow up
+PSTACK=\$1C80!          parameter stack,  grow down
+RSTACK=\$1CE0!          Return stack,     grow down
+!
+PAD_I2CADR=\$1CE0!      RX I2C address
+PAD_I2CCNT=\$1CE2!      count max
+PAD_ORG=\$1CE4!         user scratch pad buffer, 84 bytes, grow up
+!
+TIB_I2CADR=\$1D38!      TX I2C address
+TIB_I2CCNT=\$1D3A!      count of bytes
+TIB_ORG=\$1D3C!         Terminal input buffer, 84 bytes, grow up
+!
+HOLDS_ORG=\$1D90!       base address for HOLDS
+HOLD_BASE=\$1DB2!       BASE HOLD area, grow down
+!
 HP=\$1DB2!              HOLD ptr
-CAPS=\$1DB4!            CAPS ON/OFF flag, must be set to -1 before first reset !
-LAST_NFA=\$1DB6!
-LAST_THREAD=\$1DB8!
-LAST_CFA=\$1DBA!
-LAST_PSP=\$1DBC!
-
-STATEADR=\$1DBE!        Interpreter state
-
-SOURCE_LEN=\$1DC0!      len of input stream
-SOURCE_ORG=\$1DC2!      adr of input stream
-TOIN=\$1DC4!            >IN
-DP=\$1DC6!              dictionary ptr
-
-LASTVOC=\$1DC8!         keep VOC-LINK
-CONTEXT=\$1DCA!         CONTEXT dictionnary space (8 CELLS)
-CURRENT=\$1DDA!         CURRENT dictionnary ptr
-
-BASEADR=\$1DDC!           numeric base, must be defined before first reset !
-LINE=\$1DDE!            line in interpretation, activated with NOECHO, desactivated with ECHO
+LAST_NFA=\$1DB4!
+LAST_THREAD=\$1DB6!
+LAST_CFA=\$1DB8!
+LAST_PSP=\$1DBA!
+!
+STATEADR=\$1DBC!        Interpreter state
+BASEADR=\$1DBE!         base
+CAPS=\$1DC0!            CAPS ON/OFF
+!
+SOURCE_LEN=\$1DC2!      len of input stream
+SOURCE_ORG=\$1DC4!      adr of input stream
+TOIN=\$1DC6!            >IN
+DP=\$1DC8!              dictionary ptr
+!
+LASTVOC=\$1DCA!         keep VOC-LINK
+CURRENT=\$1DCC!         CURRENT dictionnary ptr
+CONTEXT=\$1DCE!         CONTEXT dictionnary space (8 CELLS)
+!
 ! ---------------------------------------
-!1DE0! 28 RAM bytes free 
+!1DE0! 28 RAM bytes free
 ! ---------------------------------------
 
 ! ---------------------------------------
@@ -171,9 +214,9 @@ BufferLen=\$2020!
 ! ---------------------------------------
 ClusterL=\$2022!     16 bits wide (FAT16)
 ClusterH=\$2024!     16 bits wide (FAT16)
-NewClusterL=\$2026!  16 bits wide (FAT16)
-NewClusterH=\$2028!  16 bits wide (FAT16)
-CurFATsector=\$202A!
+LastFATsector=\$2026!   Set by FreeAllClusters, used by OPEN_OVERWRITE
+LastFAToffset=\$2028!   Set by FreeAllClusters, used by OPEN_OVERWRITE
+FATsector=\$202A!       used by APPEND"
 
 ! ---------------------------------------
 ! DIR entry
@@ -220,7 +263,7 @@ HDLW_PrevLEN=24!    previous LEN
 HDLW_PrevORG=26!    previous ORG
 
 
-!OpenedFirstFile     ; "openedFile" structure 
+!OpenedFirstFile     ; "openedFile" structure
 HandleMax=8!
 HandleLenght=28!
 FirstHandle=\$2038!
@@ -242,37 +285,57 @@ MAIN_ORG=\$4400!        Code space start
 MAIN_LEN=\$24000!       127 k FRAM
 ! ----------------------------------------------
 
-SLEEP=\$4400! 
-BODYSLEEP=\$4404!
-LIT=\$440E! 
-NEXT_ADR=\$4416!
-XSQUOTE=\$4418! 
-HEREADR=\$442C!
-QTBRAN=\$4438! 
-BRAN=\$443E! 
-QFBRAN=\$4442! 
-SKIPBRAN=\$4448! 
-XDO=\$444C! 
-XPLOOP=\$445C! 
-XLOOP=\$446E! 
-MUSMOD=\$4474!          32/16 unsigned division
-MDIV1=\$448E!           input for 48/16 unsigned division
-SETIB=\$44BA!           Set Input Buffer with org len values, reset >IN 
-REFILL=\$44CA!          accept one line from input and leave org len of input buffer
-CIB_ADR=\$44D8!         contents currently TIB_ORG; may be redirected to SDIB_ORG
-XDODOES=\$44E2!         restore rDODOES: MOV #XDODOES,rDODOES
-XDOCON=\$44F0!          restore rDOCON: MOV #XDOCON,rDOCON
-XDOCOL=\$44FC!          restore rDOCOL: MOV #XDOCOL,rDOCOL      only for DTC model = 1
-
-! to find DTC value, download \MSP430-FORTH\FastForthSpecs.4th
-! if DTC = 1, restore rDOCOL as this : MOV #xdocol,rDOCOL
-! if DTC = 2, restore rDOCOL as this : MOV #EXIT,rDOCOL
-! if DTC = 3, nothing to do, R7 is free for use.
+SLEEP=\$4400!               CODE_WITHOUT_RETURN, CPU shutdown
+LIT=\$440A!                 CODE compiled by LITERAL
+XSQUOTE=\$441E!             CODE compiled by S" and S_
+HEREXEC=\$4432!             CODE HERE and BEGIN execute address
+MUSMOD=\$443E!              asm CODE 32/16 unsigned division, used by ?NUMBER, UM/MOD
+MDIV1DIV2=\$4450!           asm CODE input for 48/16 unsigned division with DVDhi=0, see DOUBLE M*/
+MDIV1=\$4458!               asm CODE input for 48/16 unsigned division, see DOUBLE M*/
+RET_ADR=\$4482!             asm CODE of INIT_SOFT_PFA and MARKER+8 definitions,
+SETIB=\$4484!               CODE Set Input Buffer with org & len values, reset >IN pointer
+REFILL=\$4494!              CODE accept one line from input and leave org len of input buffer
+CIB_ORG=\$44A0!             [CIB_ORG] = TIB_ORG by default; may be redirected to SDIB_ORG
+QFBRAN=\$44AC!              CODE compiled by IF UNTIL
+BRAN=\$44B2!                CODE compiled by ELSE REPEAT AGAIN
+NEXT_ADR=\$44B4!            CODE NEXT instruction (MOV @IP+,PC)
+XDODOES=\$44B6!             to restore rDODOES: MOV #XDODOES,rDODOES
+XDOCON=\$44C4!              to restore rDOCON: MOV #XDOCON,rDOCON
+!                           to restore rDOVAR: MOV &INIT_DOVAR,rDOVAR
+!                           to restore rDOCOL: MOV &INIT_DOCOL,rDOCOL
+INIT_FORTH=\$44D0!          asm CODE common part of RST and QABORT, starts FORTH engine
+QABORT=\$4508!              CODE_WITHOUT_RETURN run-time part of ABORT"
+ABORT_TERM=\$4512!          CODE_WITHOUT_RETURN, called by QREVEAL and INTERPRET
+!-------------------------------------------------------------------------------
+! UART FASTFORTH
+!-------------------------------------------------------------------------------
+UART_INIT_TERM=\$4554!      asm CODE, content of WARM+2 by default (WARM starts with: CALL &HARD_APP)
+UART_COLD_TERM=\$457E!      asm CODE, content of COLD+2 by default (COLD starts with: CALL &STOP_APP)
+UART_INIT_SOFT=\$4584!      asm CODE, content of SLEEP+2 (by default, SLEEP starts with: CALL &SOFT_APP)
+UART_WARM=\$4586!           WARM address
+UART_RXON=KEY\+\$8!         asm CODE, content of SLEEP+2 (by default, SLEEP starts with: CALL &SLEEP_APP)
+UART_RXOFF=ACCEPT\+\$2A!    asm CODE, called by ACCEPT after 'CR' and before 'LF'.
+!-------------------------------------------------------------------------------
+! I2C FASTFORTH
+!-------------------------------------------------------------------------------
+I2C_ACCEPT=\$4544!          asm CODE, default content of SLEEP_APP (SLEEP starts with: CALL &SLEEP_APP)
+I2C_CTRL_CH=\$4546!         asm CODE, used as is: MOV.B #CTRL_CHAR,Y
+!                                                 CALL #I2C_CTRL_CH
+I2C_COLD_TERM=\$4550!       asm CODE, default content of STOP_APP (COLD starts with: CALL &STOP_APP)
+I2C_INIT_SOFT=\$4550!       asm CODE, default content of SOFT_APP (INIT_FORTH starts with: CALL &SOFT_APP)
+I2C_INIT_TERM=\$4552!       asm CODE, default content of HARD_APP (WARM starts with: CALL &HARD_APP)
+I2C_WARM=\$457A!            WARM address
+!-------------------------------------------------------------------------------
+NOPUC=SYS\+\$0A!            NOPUC               with FORTH: ' SYS 10 +
+COLD=SYS\+\$16!             COLD address                    ' SYS 22 +
+ABORT=ALLOT\+\$8!           CODE_WITHOUT_RETURN             ' ALLOT 8 +
+QUIT=ALLOT\+\$0E!           CODE_WITHOUT_RETURN             ' ALLOT 14 +
+
 ! ----------------------------------------------
 ! Interrupt Vectors and signatures - MSP430FR6989
 ! ----------------------------------------------
 MAIN_LEN=\$1FC00!       127 k FRAM
-FRAM_FULL=\$FF30!       80 bytes are sufficient considering what can be compiled in one line and WORD use.
+FRAM_FULL=\$FF40!       64 bytes are sufficient considering what can be compiled in one line and WORD use.
 SIGNATURES=\$FF80!      JTAG/BSL signatures
 JTAG_SIG1=\$FF80!       if 0 (electronic fuse=0) enable JTAG/SBW; must be reset by wipe.
 JTAG_SIG2=\$FF82!       if JTAG_SIG1=\$AAAA, length of password string @ JTAG_PASSWORD
@@ -682,14 +745,14 @@ DMA2DAH=\$538!      \ DMA channel 2 destination address high
 DMA2SZ=\$53A!       \ DMA channel 2 transfer size
 
 
-MPUCTL0=\$5A0!      \ MPU control 0             
-MPUCTL1=\$5A2!      \ MPU control 1             
-MPUSEGB2=\$5A4!     \ MPU Segmentation Border2 
-MPUSEGB1=\$5A6!     \ MPU Segmentation Border1 
-MPUSAM=\$5A8!       \ MPU access management     
-MPUIPC0=\$5AA!      \ MPU IP control 0                      
-MPUIPSEGB2=\$5AC!   \ MPU IP Encapsulation Segment Border 2 
-MPUIPSEGB1=\$5AE!   \ MPU IP Encapsulation Segment Border 1 
+MPUCTL0=\$5A0!      \ MPU control 0
+MPUCTL1=\$5A2!      \ MPU control 1
+MPUSEGB2=\$5A4!     \ MPU Segmentation Border2
+MPUSEGB1=\$5A6!     \ MPU Segmentation Border1
+MPUSAM=\$5A8!       \ MPU access management
+MPUIPC0=\$5AA!      \ MPU IP control 0
+MPUIPSEGB2=\$5AC!   \ MPU IP Encapsulation Segment Border 2
+MPUIPSEGB1=\$5AE!   \ MPU IP Encapsulation Segment Border 1
 
 UCA0CTLW0=\$5C0!    \ eUSCI_A control word 0
 UCA0CTLW1=\$5C2!    \ eUSCI_A control word 1