OSDN Git Service

V308
[fast-forth/master.git] / inc / MSP430FR5739.pat
index 52fd6dc..057f04f 100644 (file)
 ! C200-FF7F = code memory (FRAM 15743 B)
 ! FF80-FFFF = interrupt vectors (FRAM 127 B)
 ! ----------------------------------------------
-! ----------------------------------------------
-! FRAM                          ! INFO B, TLV
-! ----------------------------------------------
-INFO_ORG=\$1800!
-INFO_LEN=\$0100!
-INFOB_ORG=\$1800!
-INFOB_LEN=\$0080!
-INFOA_ORG=\$1880!
-INFOA_LEN=\$0080!
-TLV_ORG=\$1A00!         Device Descriptor Info (Tag-Lenght-Value)
-TLV_LEN=\$0080!
-DEVICEID=\$1A04!
-! ----------------------------------------------
-! RAM
-! ----------------------------------------------
-RAM_ORG=\$1C00!
-RAM_LEN=\$0400!
-! ----------------------------------------------
-! FRAM
-! ----------------------------------------------
-MAIN_ORG=\$C200!        Code space start
-
-SLEEP=\$C200! 
-BODYSLEEP=\$C204!
-VECT_RESET=\$C20E! 
-LIT=\$C224! 
-NEXT_ADR=\$C22C!
-XSQUOTE=\$C22E! 
-QTBRAN=\$C242! 
-BRAN=\$C248! 
-QFBRAN=\$C24C! 
-SKIPBRAN=\$C252! 
-XDO=\$C256! 
-XPLOOP=\$C266! 
-XLOOP=\$C278! 
-MUSMOD=\$C27E!          unsigned 32/16 division
-SETIB=\$C2C4!           Set Input Buffer with org len values, reset >IN 
-REFILL=\$C2D4!          accept one line from input and leave org len of input buffer
-CIB_ADR=\$C2E4!         contents currently TIB_ORG; may be redirected to SDIB_ORG
-XDODOES=\$C2EC!         restore rDODOES: MOV #XDODOES,rDODOES
-XDOCON=\$C2FA!          restore rDOCON: MOV #XDOCON,rDOCON
-XDOVAR=\$C306!          restore rDOVAR: MOV #XDOCON,rDOVAR  
-RFROM=\$C306!           
-XDOCOL=\$C310!          restore rDOCOL: MOV #XDOCOL,rDOCOL      only for DTC model = 1
-
-DODOES=\$1284!          CALL rDODOES
-DOCON=\$1285!           CALL rDOCON
-DOVAR=\$1286!           CALL rDOVAR
-DOCOL=\$1287!
-
-! 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.
-! ----------------------------------------------
-! Interrupt Vectors and signatures - MSP430FR5739
-! ----------------------------------------------
-FRAM_FULL=\$FF30!       80 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
-BSL_SIG1=\$FF84!
-BSL_SIG2=\$FF86!
-JTAG_PASSWORD=\$FF88!   256 bits
-BSL_PASSWORD=\$FFE0!    256 bits
-VECT_ORG=\$FFCE!        FFCE-FFFF
-VECT_LEN=\$32!
-
 
-RTC_Vec=\$FFCE!
-P4_Vec=\$FFD0!
-P3_Vec=\$FFD2!
-TB2_x_Vec=\$FFD4!
-TB2_0_Vec=\$FFD6!
-P2_Vec=\$FFD8!
-TB1_x_Vec=\$FFDA!
-TB1_0_Vec=\$FFDC!
-P1_Vec=\$FFDE!
-TA1_x_Vec=\$FFE0!
-TA1_0_Vec=\$FFE2!
-DMA_Vec=\$FFE4!
-eUSCI_A1_Vec=\$FFE6!
-TA0_x_Vec=\$FFE8!
-TA0_0_Vec=\$FFEA!
-ADC10_B_Vec=\$FFEC!
-eUSCI_B0_Vec=\$FFEE!
-eUSCI_A0_Vec=\$FFF0!
-WDT_Vec=\$FFF2!
-TB0_x_Vec=\$FFF4!
-TB0_0_Vec=\$FFF6!
-COMP_D_Vec=\$FFF8!
-U_NMI_Vec=\$FFFA!
-S_NMI_Vec=\$FFFC!
-RST_Vec=\$FFFE!
-
-
-
-
-LPM4=\$F8! SR(LPM4+GIE)
-LPM3=\$D8! SR(LPM3+GIE)
-LPM2=\$98! SR(LPM2+GIE)
-LPM1=\$58! SR(LPM1+GIE)
-LPM0=\$18! SR(LPM0+GIE)
-
-
-! ============================================
-! SR bits :
 ! ============================================
-\#C=\#1!        = SR(0) Carry flag
-\#Z=\#2!        = SR(1) Zero flag
-\#N=\#4!        = SR(2) Negative flag
-\#GIE=\#8!      = SR(3) Enable Int
-\#CPUOFF=\#\$10!= SR(4) CPUOFF    
-\#OSCOFF=\#\$20!= SR(5) OSCOFF
-\#SCG0=\#\$40!  = SR(6) SCG0     
-\#SCG1=\#\$80!  = SR(7) SCG1
-\#V=\#\$100!    = SR(8) oVerflow flag
-\#UF9=\#\$200!  = SR(9) User Flag 1 used by ?NUMBER --> INTERPRET --> LITERAL to process double numbers, else free for use.  
-\#UF10=\#\$400! = SR(10) User Flag 2  
-\#UF11=\#\$800! = SR(11) User Flag 3  
-
-! ============================================
-! PORTx, Reg  bits :
+! BSL
 ! ============================================
-BIT0=1!
-BIT1=2!
-BIT2=4!
-BIT3=8!
-BIT4=\$10!
-BIT5=\$20!
-BIT6=\$40!
-BIT7=\$80!
-BIT8=\$100!
-BIT9=\$200!
-BIT10=\$400!
-BIT11=\$800!
-BIT12=\$1000!
-BIT13=\$2000!
-BIT14=\$4000!
-BIT15=\$8000!
+BSL1=\$1000!
 
 ! ============================================
-! symbolic codes :
+! FRAM INFO
 ! ============================================
-RET=MOV \@R1+,R0!   \ MOV @RSP+,PC
-NOP=MOV \#0,R3!     \                one word one cycle
-NOP2=\$3C00 ,!      \ compile JMP 0  one word two cycles
-NOP3=MOV R0,R0!     \ MOV PC,PC      one word three cycles
-NEXT=MOV \@R13+,R0! \ MOV @IP+,PC   
-SEMI=MOV \@R1+,R13\nMOV \@R13+,R0!
-
-! =================================================
-! MSP430FR57xx DEVICES HAVE SPECIFIC RAM ADDRESSES!
-! =================================================
-
-
+INFO_ORG=\$1800!
+INFO_LEN=\$0100!
 
 ! You can check the addresses below by comparing their values in DTCforthMSP430FRxxxx.lst
 ! those addresses are usable with the symbolic assembler
@@ -178,86 +33,109 @@ SEMI=MOV \@R1+,R13\nMOV \@R13+,R0!
 ! ============================================
 ! FastForth INFO(DCBA) memory map (256 bytes):
 ! ============================================
-
-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!
+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
+RSTIV_MEM=\$1808!       SYSRSTIV memory, set to -1 to do Deep RESET
+RST_DP=\$180A!          RST value for DP
+RST_VOC=\$180C!         RST value for VOClink
+VERSION=\$180E!
+THREADS=\$1810!         THREADS
 KERNEL_ADDON=\$1812!
-RXON=\$1814!
-RXOFF=\$1816!
-ReadSectorWX=\$1818!    call with W = SectorLO  X = SectorHI
-WriteSectorWX=\$181A!   call with W = SectorLO  X = SectorHI
+
+WIPE_INI_=\$1814!       MOV #WIPE_INI,X
+WIPE_COLD=\$1814!       WIPE value for PFA_COLD
+WIPE_INI_FORTH=\$1816!  WIPE value for PFA_INI_FORTH
+WIPE_SLEEP=\$1818!      WIPE value for PFA_SLEEP
+WIPE_WARM=\$181A!       WIPE value for PFA_WARM
+WIPE_TERM_INT=\$181C!   WIPE value for TERMINAL vector
+WIPE_DP=\$182E!         WIPE value for RST_DP   
+WIPE_VOC=\$1820!        WIPE value for RST_VOC
+
+INI_FORTH_INI=\$1822!   MOV #INI_FORTH_INI,X    \ >BODY instruction of INI_FORTH subroutine
+INIT_ACCEPT=\$1822!     WIPE value for PFAACCEPT
+INIT_CR=\$1824!         WIPE value for PFACR
+INIT_EMIT=\$1826!       FORTH value for PFAEMIT
+INIT_KEY=\$1828!        WIPE value for PFAKEY
+INIT_CIB=\$182A!        WIPE value for CIB_ADR
+HALF_FORTH_INI=\$182C!  to preserve the state of DEFERed words, used by user INI_SOFT_APP as:
+!                       ADD #4,0(RSP)           \ skip INI_FORTH >BODY instruction "MOV #INI_FORTH_INI,X"
+!                       MOV #HALF_FORTH_INI,X   \ replace it by "MOV #HALF_FORTH_INI,X"
+!                       MOV @RSP+,PC            \ then RET
+INIT_DOCOL=\$182C!      FORTH value for rDOCOL   (R4)
+INIT_DODOES=\$182E!     FORTH value for rDODOES  (R5)
+INIT_DOCON=\$1830!      FORTH value for rDOCON   (R6)
+INIT_DOVAR=\$1832!      FORTH value for rDOVAR   (R7)
+INIT_CAPS=\$1834!       FORTH value for CAPS
+INIT_BASE=\$1836!       FORTH value for BASE
+!                       free EPROM
 
 ! ---------------------------------------
-! FAT16 FileSystemInfos 
+! FAT16 FileSystemInfos
 ! ---------------------------------------
-FATtype=\$182C!
-BS_FirstSectorL=\$182E!
-BS_FirstSectorH=\$1830!
-OrgFAT1=\$1832!
-FATSize=\$1834!
-OrgFAT2=\$1836!
-OrgRootDir=\$1838!
-OrgClusters=\$183A!         Sector of Cluster 0
-SecPerClus=\$183C!
+FATtype=\$185A!
+BS_FirstSectorL=\$185C!
+BS_FirstSectorH=\$185E!
+OrgFAT1=\$1860!
+FATSize=\$1862!
+OrgFAT2=\$1864!
+OrgRootDir=\$1866!
+OrgClusters=\$1868!         Sector of Cluster 0
+SecPerClus=\$186A!
 
 ! ---------------------------------------
 ! SD command
 ! ---------------------------------------
-SD_CMD_FRM=\$183E!  6 bytes SD_CMDx inverted frame \${CRC,ll,LL,hh,HH,CMD}
-SD_CMD_FRM0=\$183E! CRC:ll  word access
-SD_CMD_FRM1=\$183F! ll      byte access
-SD_CMD_FRM2=\$1840! LL:hh   word access
-SD_CMD_FRM3=\$1841! hh      byte access
-SD_CMD_FRM4=\$1842! HH:CMD  word access
-SD_CMD_FRM5=\$1843! CMD     byte access
-SectorL=\$1844!     2 words
-SectorH=\$1846!
+SD_CMD_FRM=\$186C!  6 bytes SD_CMDx inverted frame \${CRC,ll,LL,hh,HH,CMD}
+SD_CMD_FRM0=\$186C! CRC:ll  word access
+SD_CMD_FRM1=\$186D! ll      byte access
+SD_CMD_FRM2=\$186E! LL:hh   word access
+SD_CMD_FRM3=\$186F! hh      byte access
+SD_CMD_FRM4=\$1870! HH:CMD  word access
+SD_CMD_FRM5=\$1871! CMD     byte access
+SectorL=\$1872!     2 words
+SectorH=\$1874!
 
 ! ---------------------------------------
 ! BUFFER management
 ! ---------------------------------------
-BufferPtr=\$1848! 
-BufferLen=\$184A!
+BufferPtr=\$1876!
+BufferLen=\$1878!
 
 ! ---------------------------------------
 ! FAT entry
 ! ---------------------------------------
-ClusterL=\$184C!     16 bits wide (FAT16)
-ClusterH=\$184E!     16 bits wide (FAT16)
-NewClusterL=\$1850!  16 bits wide (FAT16) 
-NewClusterH=\$1852!  16 bits wide (FAT16) 
-CurFATsector=\$1854!
+ClusterL=\$187A!     16 bits wide (FAT16)
+ClusterH=\$187C!     16 bits wide (FAT16)
+NewClusterL=\$187E!  16 bits wide (FAT16)
+NewClusterH=\$1880!  16 bits wide (FAT16)
+CurFATsector=\$1882!
 
 ! ---------------------------------------
 ! DIR entry
 ! ---------------------------------------
-DIRclusterL=\$1856!  contains the Cluster of current directory ; 1 if FAT16 root directory
-DIRclusterH=\$1858!  contains the Cluster of current directory ; 1 if FAT16 root directory
-EntryOfst=\$185A!  
+DIRclusterL=\$1884!  contains the Cluster of current directory ; 1 if FAT16 root directory
+DIRclusterH=\$1886!  contains the Cluster of current directory ; 1 if FAT16 root directory
+EntryOfst=\$1888!
 
 ! ---------------------------------------
 ! Handle Pointer
 ! ---------------------------------------
-CurrentHdl=\$185C!  contains the address of the last opened file structure, or 0
+CurrentHdl=\$188A!  contains the address of the last opened file structure, or 0
 
 ! ---------------------------------------
 ! Load file operation
 ! ---------------------------------------
-pathname=\$185E!    address of pathname string
-EndOfPath=\$1860!
+pathname=\$188C!    address of pathname string
+EndOfPath=\$188E!
 
 ! ---------------------------------------
 ! Handle structure
 ! ---------------------------------------
-! three handle tokens : 
+! three handle tokens :
 ! token = 0 : free handle
 ! token = 1 : file to read
 ! token = 2 : file updated (write)
@@ -280,26 +158,31 @@ HDLW_BUFofst=22!    BUFFER offset ; used by LOAD" and by WRITE"
 HDLW_PrevLEN=24!    previous LEN
 HDLW_PrevORG=26!    previous ORG
 
-
 !OpenedFirstFile     ; "openedFile" structure 
-HandleMax=5!
+HandleMax=4!
 HandleLenght=28!
-FirstHandle=\$1862!
-HandleEnd=\$18EE!
-
-SD_END=\$18EE!
-SD_LEN=\$C2!
+FirstHandle=\$1890!
+HandleEnd=\$1900!
 
-!SD_card Input Buffer = PAD
-SDIB_I2CADR=\$1CE0!
-SDIB_I2CCNT=\$1CE2!
-SDIB_ORG=\$1CE4!
-SDIB_LEN=\$54!
+SD_END=\$1900!
+SD_LEN=\$A6!
 
+! ============================================
+! FRAM TLV
+! ============================================
+TLV_ORG=\$1A00!         Device Descriptor Info (Tag-Lenght-Value)
+TLV_LEN=\$0080!
+DEVICEID=\$1A04!
 
 ! ============================================
-! FORTH RAM areas :
+! RAM
 ! ============================================
+RAM_ORG=\$1C00!
+RAM_LEN=\$0400!
+
+! ---------------------------------------
+! FORTH RAM areas :
+! ---------------------------------------
 LSTACK_SIZE=\#16! words
 PSTACK_SIZE=\#48! words
 RSTACK_SIZE=\#48! words
@@ -307,10 +190,15 @@ PAD_LEN=\#84! bytes
 TIB_LEN=\#84! bytes
 HOLD_SIZE=\#34! bytes
 
-! ============================================
-! FastForth RAM memory map (= 1k):
-! ============================================
+!SD_card Input Buffer = PAD
+SDIB_I2CADR=\$1CE0!
+SDIB_I2CCNT=\$1CE2!
+SDIB_ORG=\$1CE4!
+SDIB_LEN=\$54!
 
+! ----------------------------------------------
+! 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
@@ -363,6 +251,95 @@ SD_BUF_I2CNT=\$1DFE!
 SD_BUF=\$1E00!      \ SD_Card buffer
 BUFEND=\$2000!
 
+! ============================================
+! FRAM MAIN
+! ============================================
+MAIN_ORG=\$C200!        Code space start
+MAIN_LEN=\$3E00!        15.5 k FRAM
+! ----------------------------------------------
+
+SLEEP=\$C200!               CODE_WITHOUT_RETURN, CPU shutdown
+LIT=\$C20A!                 CODE compiled by LITERAL
+XSQUOTE=\$C214!             CODE compiled by S" and S_
+HEREXEC=\$C228!             CODE HERE and BEGIN execute address
+QFBRAN=\$C234!              CODE compiled by IF UNTIL
+BRAN=\$C23A!                CODE compiled by ELSE REPEAT AGAIN
+NEXT_ADR=\$C23C!            CODE NEXT instruction (MOV @IP+,PC)
+XDO=\$C23E!                 CODE compiled by DO
+XPLOOP=\$C24E!              CODE compiled by +LOOP
+XLOOP=\$C260!               CODE compiled by LOOP
+MUSMOD=\$C266!              ASM CODE 32/16 unsigned division, used by ?NUMBER, UM/MOD
+MDIV1DIV2=\$C278!           ASM CODE input for 48/16 unsigned division with DVDhi=0, see DOUBLE M*/
+MDIV1=\$C280!               ASM CODE input for 48/16 unsigned division, see DOUBLE M*/
+RET_ADR=\$C2AA!             ASM CODE of INI_FORTH_PFA and MARKER+8 definitions,
+SETIB=\$C2AC!               CODE Set Input Buffer with org & len values, reset >IN pointer
+REFILL=\$C2BC!              CODE accept one line from input and leave org len of input buffer
+CIB_ADR=\$C2CA!             [CIB_ADR] = TIB_ORG by default; may be redirected to SDIB_ORG
+XDODOES=\$C2D4!             to restore rDODOES: MOV #XDODOES,rDODOES
+XDOCON=\$C2E2!              to restore rDOCON: MOV #XDOCON,rDOCON
+XDOVAR=\$C2EE!              to restore rDOVAR: MOV #XDOVAR,rDOVAR
+!                           to restore rDOCOL: MOV &INIT_DOCOL,rDOCOL
+INI_FORTH=\$C2F8!           asm CODE common part of RST and QABORT, starts FORTH engine
+QABORT=\$C32A!              CODE_WITHOUT_RETURN run-time part of ABORT"
+ABORT_TERM=\$C336!          CODE_WITHOUT_RETURN, called by QREVEAL and INTERPRET  
+!-------------------------------------------------------------------------------
+UART_COLD_TERM=\$C394!      ASM CODE, content of COLD+2 by default
+UART_INIT_TERM=\$C39C!      ASM CODE, content of WARM+2 by default
+UART_RXON=\$C3C6!           ASM CODE, content of SLEEP+2 by default
+UART_RXOFF=\$C3C8!          ASM CODE, called by ACCEPT before RX char LF.
+!-------------------------------------------------------------------------------
+I2C_COLD_TERM=\$C3B8!       ASM CODE, content of COLD_PFA by default
+I2C_INIT_TERM=\$C38E!       ASM CODE, content of WARM_PFA by default
+I2C_RXON=\$C3BA!            ASM CODE, content of SLEEP_PFA by default
+I2C_CTRL_CH=\$C3BC!         ASM CODE, used as is: MOV.B #CTRL_CHAR,Y
+!                                                 CALL #I2C_CTRL_CH
+!-------------------------------------------------------------------------------
+
+
+! ----------------------------------------------
+! Interrupt Vectors and signatures - MSP430FR5739
+! ----------------------------------------------
+FRAM_FULL=\$FF30!       80 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
+BSL_SIG1=\$FF84!
+BSL_SIG2=\$FF86!
+I2CSLA0=\$FFA2!         UCBxI2COA0 default value address
+I2CSLA1=\$FFA4!         UCBxI2COA1 default value address
+I2CSLA2=\$FFA6!         UCBxI2COA2 default value address
+I2CSLA3=\$FFA8!         UCBxI2COA3 default value address
+JTAG_PASSWORD=\$FF88!   256 bits
+BSL_PASSWORD=\$FFE0!    256 bits
+VECT_ORG=\$FFCE!        FFCE-FFFF
+VECT_LEN=\$32!
+
+
+RTC_VEC=\$FFCE!
+P4_VEC=\$FFD0!
+P3_VEC=\$FFD2!
+TB2_X_VEC=\$FFD4!
+TB2_0_VEC=\$FFD6!
+P2_VEC=\$FFD8!
+TB1_X_VEC=\$FFDA!
+TB1_0_VEC=\$FFDC!
+P1_VEC=\$FFDE!
+TA1_X_VEC=\$FFE0!
+TA1_0_VEC=\$FFE2!
+DMA_VEC=\$FFE4!
+EUSCI_A1_VEC=\$FFE6!
+TA0_X_VEC=\$FFE8!
+TA0_0_VEC=\$FFEA!
+ADC10_B_VEC=\$FFEC!
+EUSCI_B0_VEC=\$FFEE!
+EUSCI_A0_VEC=\$FFF0!
+WDT_VEC=\$FFF2!
+TB0_X_VEC=\$FFF4!
+TB0_0_VEC=\$FFF6!
+COMP_D_VEC=\$FFF8!
+U_NMI_VEC=\$FFFA!
+S_NMI_VEC=\$FFFC!
+RST_VEC=\$FFFE!
 
 ! ============================================
 ! Special Fonction Registers (SFR)