; -----------------------------------
-; RC5toLCD.4th
+; RC5toLCD.f
; -----------------------------------
+\
+\ FastForth Compiling options used :
+\ DTC=2, FREQUENCY=8/16/24MHz, THREADS=16,
+\ nnn bauds, 3WIRES, 4WIRES,
+\ ASSEMBLER, CONDCOMP, NONAME, UTILITY.
\ TARGET SELECTION
\ MSP_EXP430FR5739 MSP_EXP430FR5969 MSP_EXP430FR5994 MSP_EXP430FR6989
\ MSP_EXP430FR2355
-
- \
+\
\ Copyright (C) <2016> <J.M. THOORENS>
\
\ This program is free software: you can redistribute it and/or modify
\
\ You should have received a copy of the GNU General Public License
\ along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-
+\
+\
\ ===========================================================================
\ remember: for good downloading to target, all lines must be ended with CR+LF !
\ ===========================================================================
-
-
+\
+\
\ REGISTERS USAGE
\ R4 to R7 must be saved before use and restored after
\ scratch registers Y to S are free for use
\ under interrupt, IP is free for use
\ interrupts reset SR register !
-
+\
\ PUSHM order : PSP,TOS, IP, S, T, W, X, Y, rEXIT,rDOVAR,rDOCON, rDODOES, R3, SR,RSP, PC
\ PUSHM order : R15,R14,R13,R12,R11,R10, R9, R8, R7 , R6 , R5 , R4 , R3, R2, R1, R0
-
+\
\ example : PUSHM #6,IP pushes IP,S,T,W,X,Y registers to return stack
\
\ POPM order : PC,RSP, SR, R3, rDODOES,rDOCON,rDOVAR,rEXIT, Y, X, W, T, S, IP,TOS,PSP
\ POPM order : R0, R1, R2, R3, R4 , R5 , R6 , R7 , R8, R9,R10,R11,R12,R13,R14,R15
-
+\
\ example : POPM #6,IP pop Y,X,W,T,S,IP registers from return stack
-
+\
\ ASSEMBLER conditionnal usage after IF UNTIL WHILE : S< S>= U< U>= 0= 0<> 0>=
\ ASSEMBLER conditionnal usage before ?JMP ?GOTO : S< S>= U< U>= 0= 0<> 0<
-
+\
\ FORTH conditionnal : 0= 0< = < > U<
-
+\
\ display on a LCD 2x20 CHAR the code sent by an IR remote under philips RC5 protocol
\ target : any TI MSP-EXP430FRxxxx launchpad (FRAM)
\ LPM_MODE = LPM0 because use SMCLK for LCDVo
-
+\
\ DEMO : driver for IR remote compatible with the PHILIPS RC5 protocol
\ plus : driver for 5V LCD 2x20 characters display with 4 bits data interface
\ without usage of an auxiliary 5V to feed the LCD_Vo
\ and without potentiometer to adjust the LCD contrast :
\ to adjust LCD contrast, just press S1 (-) or S2 (+)
\ LCDVo current consumption ~ 500 uA.
-
+\
\ ===================================================================================
\ notice : adjust WDT_TIM_EX0,LCD_TIM_CTL,LCD_TIM_EX0 and 20_us to the target frequency if <> 8MHz !
\ ===================================================================================
-
-
+\
+\
\ layout : I/O are defined in the launchpad.pat file (don't work with ChipStick_FR2433)
-
+\
\ GND <-------+---0V0----------> 1 LCD_Vss
\ VCC >------ | --3V6-----+----> 2 LCD_Vdd
\ | |
\ <------------------------> 12 LCD_DB5
\ <------------------------> 13 LCD_DB5
\ <------------------------> 14 LCD_DB7
-
+\
\ <----- LCD contrast + <--- Sw1 <--- (finger) :-)
\ <----- LCD contrast - <--- Sw2 <--- (finger) :-)
-
+\
\ rc5 <--- OUT IR_Receiver (1 TSOP32236)
[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN] \ remove application
[DEFINED] ASM [IF] \ security test
- \
+
MARKER {RC5TOLCD}
- \
+
[UNDEFINED] MAX [IF] \ MAX and MIN are defined in {ANS_COMP}
- \
+
CODE MAX \ n1 n2 -- n3 signed maximum
CMP @PSP,TOS \ n2-n1
S< ?GOTO FW1 \ n2<n1
BW1 ADD #2,PSP
MOV @IP+,PC
ENDCODE
- \
CODE MIN \ n1 n2 -- n3 signed minimum
CMP @PSP,TOS \ n2-n1
ENDCODE
[THEN]
- \
[UNDEFINED] U.R [IF] \ defined in {UTILITY}
: U.R \ u n -- display u unsigned in n width (n >= 2)
R> OVER - 0 MAX SPACES TYPE
;
[THEN]
- \
\ CODE 20_US \ n -- n * 20 us
\ BEGIN \ 3 cycles loop + 6~
\ MOV @PSP+,TOS \ 2
\ MOV @IP+,PC \ 4
\ ENDCODE
-\ \
CODE 20_US \ n -- n * 20 us
BEGIN \ here we presume that LCD_TIM_IFG = 1...
MOV @PSP+,TOS \ 2
MOV @IP+,PC \ 4
ENDCODE
- \
CODE TOP_LCD \ LCD Sample
\ \ if write : %xxxxWWWW --
AND.B #LCD_DB,TOS \
MOV @IP+,PC
ENDCODE
- \
CODE LCD_W \ byte -- write byte to LCD
SUB #2,PSP \
TOP_LCD 2 20_US \ write high nibble first
TOP_LCD 2 20_US
;
- \
CODE LCD_WrC \ char -- Write Char
BIS.B #LCD_RS,&LCD_CMD_OUT \ lcd_rs=1
JMP LCD_W
ENDCODE
- \
CODE LCD_WrF \ func -- Write Fonction
BIC.B #LCD_RS,&LCD_CMD_OUT \ lcd_rs=0
JMP LCD_W
ENDCODE
- \
: LCD_Clear
$01 LCD_WrF 100 20_us \ $01 LCD_WrF 80 20_us ==> bad init !
;
- \
: LCD_Home
$02 LCD_WrF 100 20_us
;
- \
[UNDEFINED] OR [IF]
- \
+
\ https://forth-standard.org/standard/core/OR
\ C OR x1 x2 -- x3 logical OR
CODE OR
BIS @PSP+,TOS
MOV @IP+,PC
ENDCODE
- \
[THEN]
- \
+
: LCD_Entry_set $04 OR LCD_WrF ;
- \
+
: LCD_DSP_Ctrl $08 OR LCD_WrF ;
- \
+
: LCD_DSP_Shift $10 OR LCD_WrF ;
- \
+
: LCD_Fn_Set $20 OR LCD_WrF ;
- \
+
: LCD_CGRAM_Set $40 OR LCD_WrF ;
- \
+
: LCD_Goto $80 OR LCD_WrF ;
- \
+
CODE LCD_R \ -- byte read byte from LCD
BIC.B #LCD_DB,&LCD_DB_DIR \ LCD_Data as intput
BIS.B #LCD_RW,&LCD_CMD_OUT \ lcd_rw=1
MOV @RSP+,IP \ restore IP saved by COLON
MOV @IP+,PC \
ENDCODE
- \
CODE LCD_RdS \ -- status Read Status
BIC.B #LCD_RS,&LCD_CMD_OUT \ lcd_rs=0
JMP LCD_R
ENDCODE
- \
CODE LCD_RdC \ -- char Read Char
BIS.B #LCD_RS,&LCD_CMD_OUT \ lcd_rs=1
JMP LCD_R
ENDCODE
- \
\ ******************************\
BIC #$78,0(RSP) \ 4 SCG0,OSCOFF,CPUOFF and GIE are OFF in retiSR to force LPM0_LOOP despite pending interrupt
RETI \ 5
ENDASM
- \
\ ******************************\
ASM RC5_INT \ wake up on Px.RC5 change interrupt
\ ******************************\
\ RC5_FirstStartBitHalfCycle: \
\ ******************************\ division in RC5_TIM_CTL (SMCLK/1|SMCLK/1|SMCLK/2|SMCLK/4|SMCLK/8)
-\ MOV #0,&RC5_TIM_EX0 \ predivide by 1 in RC5_TIM_EX0 register ( 125kHz| 1MHz | 2MHZ | 4MHZ | 8MHZ ), reset value
- MOV #1,&RC5_TIM_EX0 \ predivide by 2 in RC5_TIM_EX0 register ( 250kHZ| 2MHz | 4MHZ | 8MHZ | 16MHZ )
-\ MOV #2,&RC5_TIM_EX0 \ predivide by 3 in RC5_TIM_EX0 register ( 375kHz| 3MHz | 6MHZ | 12MHZ | 24MHZ )
+\ FREQ_KHZ @ 8000 = [IF] \ 8 MHz ?
+\ MOV #0,&RC5_TIM_EX0 \ predivide by 1 in RC5_TIM_EX0 register ( 125kHz| 1MHz | 2MHZ | 4MHZ | 8MHZ ), reset value
+\ [THEN]
+FREQ_KHZ @ 16000 = [IF] \ 16 MHz ?
+ MOV #1,&RC5_TIM_EX0 \ predivide by 2 in RC5_TIM_EX0 register ( 250kHZ| 2MHz | 4MHZ | 8MHZ | 16MHZ )
+[THEN]
+FREQ_KHZ @ 24000 = [IF] \ 24 MHz ?
+ MOV #2,&RC5_TIM_EX0 \ predivide by 3 in RC5_TIM_EX0 register ( 375kHz| 3MHz | 6MHZ | 12MHZ | 24MHZ )
+[THEN]
\ MOV #3,&RC5_TIM_EX0 \ predivide by 4 in RC5_TIM_EX0 register ( 500kHZ| 4MHz | 8MHZ | 16MHZ )
\ MOV #4,&RC5_TIM_EX0 \ predivide by 6 in RC5_TIM_EX0 register ( 625kHz| 5MHz | 10MHZ | 20MHZ )
\ MOV #5,&RC5_TIM_EX0 \ predivide by 6 in RC5_TIM_EX0 register ( 750kHz| 6MHz | 12MHZ | 24MHZ )
GOTO BW3
\ ******************************\
ENDASM
- \
\ ------------------------------\
-ASM BACKGROUND \
+ASM BACKGROUND \
\ ------------------------------\
\ ... \ insert here your background task
\ ... \
\ ... \
-MOV #SLEEP,X \ 2 Must be the last statement of BACKGROUND
-ADD #4,X \ 1 X = BODY of SLEEP
-MOV X,PC \ 3
+BIS #LPM_MODE,SR \
ENDASM \
-\ ------------------------------\
- \
+\ ******************************\
+\ here start all interrupts \
+\ ******************************\
+\ here return all interrupts \
+\ ******************************\
+CODENNM \
+JMP BACKGROUND \
+ENDCODE DROP \
CODE START \
\ ------------------------------\
LIT RECURSE IS WARM \ replace WARM by this START routine
ABORT \ and continue with the next word after WARM...
; \ ...until interpreter falls in sleep mode within ACCEPT.
- \
CODE STOP \ stops multitasking, must to be used before downloading app
\ restore default action of primary DEFERred word SLEEP, assembly version
MOV #SLEEP,X \ the ASM word SLEEP is only visible in mode assembler.
ADD #4,X \ X = BODY of SLEEP
MOV X,-2(X) \ restore the default background
-
COLON
\ restore default action of primary DEFERred word WARM, FORTH version
['] WARM >BODY IS WARM \ remove START app from FORTH init process
-
COLD \ because we want to reset CPU and interrupt vectors
;
- \
ECHO
; downloading RC5toLCD.4th is done
RST_HERE ; this app is protected against <reset>
- \
+
[THEN] \ ASM
- \
+
+
+: BS 8 EMIT ; \ 8 EMIT = BackSpace EMIT
+: ESC #27 EMIT ;
+: specs \ to see Fast Forth specifications
+PWR_STATE \ remove specs definition when running, and before bytes free processing
+6 0 DO BS LOOP \ to reach start of line
+ESC ." [7m" \ set reverse video
+." FastForth "
+INI_THREAD @ U. BS ." Threads " \ vocabularies threads
+." DeviceID=$"
+$10 BASE ! $1A04 @ U. #10 BASE !
+FREQ_KHZ @ 0 1000 UM/MOD U. BS
+?DUP
+IF ." ," U. BS \ if remainder
+THEN ." MHz " \ MCLK
+FRAM_FULL HERE - U. ." bytes free"
+ESC ." [0m" \ clear reverse video
+;
+
+specs \ here FastForth type a (volatile) message with some informations
+
+
START
! You should have received a copy of the GNU General Public License
! along with this program. If not, see <http://www.gnu.org/licenses/>.
!
+\.f=\.4th! to change file type
!
+@define{@read{@mergepath{@inpath{};RemoveComments.pat;}}}
!
! ======================================================================
! MSP430FR2433 Config
! ======================================================================
-
@define{@read{@mergepath{@inpath{};MSP430FR2433.pat;}}}
@define{@read{@mergepath{@inpath{};FastForthREGtoTI.pat;}}}
-@define{@read{@mergepath{@inpath{};RemoveComments.pat;}}}
! ---------------------------------------------------
! CHIPSTICK_FR2433 <--> OUTPUT WORLD
TERM_IE=\$21A!
TERM_IFG=\$21C!
+TERM_CTLW0=\$500! \ eUSCI_A control word 0
+TERM_CTLW1=\$502! \ eUSCI_A control word 1
+TERM_BRW=\$506!
+TERM_BR0=\$506! \ eUSCI_A baud rate 0
+TERM_BR1=\$507! \ eUSCI_A baud rate 1
+TERM_MCTLW=\$508! \ eUSCI_A modulation control
+TERM_STATW=\$50A! \ eUSCI_A status
+TERM_RXBUF=\$50C! \ eUSCI_A receive buffer
+TERM_TXBUF=\$50E! \ eUSCI_A transmit buffer
+TERM_ABCTL=\$510! \ eUSCI_A LIN control
+TERM_IRTCTL=\$512! \ eUSCI_A IrDA transmit control
+TERM_IRRCTL=\$513! \ eUSCI_A IrDA receive control
+TERM_IE=\$51A! \ eUSCI_A interrupt enable
+TERM_IFG=\$51C! \ eUSCI_A interrupt flags
+TERM_IV=\$51E! \ eUSCI_A interrupt vector word
+
RTS=4! ; P3.2
CTS=1! ; P3.0
HANDSHAKIN=\$220!
HANDSHAKOUT=\$222!
-SD_CD=8! ; P2.3 as SD_CD
-SD_CS=4! ; P2.2 as SD_CS
-SD_CDIN=\$201!
-SD_CSOUT=\$203!
-SD_CSDIR=\$205!
-
-SD_SEL=\$20C! ; to configure UCB0
-SD_REN=\$206! ; to configure pullup resistors
-SD_BUS=\$0E! ; pins P1.1 as UCB0CLK, P1.2 as UCB0SIMO & P1.3 as UCB0SOMI
-
-
! ============================================
! APPLICATION I/O :
! ============================================
SSCL=\$80! P1.3
S_BUS=\$C0!
+
+SD_CD=8! ; P2.3 as SD_CD
+SD_CS=4! ; P2.2 as SD_CS
+SD_CDIN=\$201!
+SD_CSOUT=\$203!
+SD_CSDIR=\$205!
+
+SD_SEL=\$20C! ; to configure UCB0
+SD_REN=\$206! ; to configure pullup resistors
+SD_BUS=\$0E! ; pins P1.1 as UCB0CLK, P1.2 as UCB0SIMO & P1.3 as UCB0SOMI
+
!BASE=\$1DDC! numeric base, must be defined before first reset !
LINE=\$1DDE! line in interpretation, activated with NOECHO, desactivated with ECHO
-! ---------------------------------------
-!1DE0! 14 RAM bytes free conditionnaly
-! ---------------------------------------
-!SAV_CURRENT=\$21E0! preserve CURRENT when create assembler words
+! -----------------------------------------
+!1DE0! 14 RAM bytes free out of compilation
+! -----------------------------------------
+!SAV_CURRENT=\$1DE0! preserve CURRENT when create assembler words
!ASMBW1=\$1DE2 assembler backward reference 1
!ASMBW2=\$1DE4 assembler backward reference 2
!ASMBW3=\$1DE6 assembler backward reference 3
UCA0BR0=\$5C6! \ eUSCI_A baud rate 0
UCA0BR1=\$5C7! \ eUSCI_A baud rate 1
UCA0MCTLW=\$5C8! \ eUSCI_A modulation control
-UCA0STAT=\$5CA! \ eUSCI_A status
+UCA0STATW=\$5CA! \ eUSCI_A status
UCA0RXBUF=\$5CC! \ eUSCI_A receive buffer
UCA0TXBUF=\$5CE! \ eUSCI_A transmit buffer
UCA0ABCTL=\$5D0! \ eUSCI_A LIN control
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!
! =================================================
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
UCA0BRW=\$5C6!
! You should have received a copy of the GNU General Public License
! along with this program. If not, see <http://www.gnu.org/licenses/>.
!
+\.f=\.4th! to change file type
!
+@define{@read{@mergepath{@inpath{};RemoveComments.pat;}}}
!
! ======================================================================
! MSP430FR2355 Config
! ======================================================================
-
@define{@read{@mergepath{@inpath{};MSP430FR2355.pat;}}}
@define{@read{@mergepath{@inpath{};FastForthREGtoTI.pat;}}}
-!@define{@read{@mergepath{@inpath{};RemoveComments.pat;}}}
! ======================================================================
! INIT MSP-EXP430FR2355 board
TERM_IFG=\$23D!
TERM_Vec=\$FFE2! UCA1
+TERM_CTLW0=\$580! \ eUSCI_A1 control word 0
+TERM_CTLW1=\$582! \ eUSCI_A1 control word 1
+TERM_BRW=\$586!
+TERM_BR0=\$586! \ eUSCI_A1 baud rate 0
+TERM_BR1=\$587! \ eUSCI_A1 baud rate 1
+TERM_MCTLW=\$588! \ eUSCI_A1 modulation control
+TERM_STATW=\$58A! \ eUSCI_A1 status
+TERM_RXBUF=\$58C! \ eUSCI_A1 receive buffer
+TERM_TXBUF=\$58E! \ eUSCI_A1 transmit buffer
+TERM_ABCTL=\$590! \ eUSCI_A1 LIN control
+TERM_IRTCTL=\$592! \ eUSCI_A1 IrDA transmit control
+TERM_IRRCTL=\$593! \ eUSCI_A1 IrDA receive control
+TERM_IE=\$59A! \ eUSCI_A1 interrupt enable
+TERM_IFG=\$59C! \ eUSCI_A1 interrupt flags
+TERM_IV=\$59E! \ eUSCI_A1 interrupt vector word
+
RTS=1! P2.0
CTS=2! P2.1
HANDSHAKIN=\$201!
HANDSHAKOUT=\$203!
-SD_CD=\$10! P4.4 as SD_CD
-SD_CDIN=\$221!
-SD_CS=\$20! P2.5 as SD_CS
-SD_CSOUT=\$203!
-SD_CSDIR=\$205!
-
-SD_SEL=\$22D! P4SEL0 to configure UCB1
-SD_REN=\$227! P4REN to configure pullup resistors
-SD_BUS=\$7000! pins P4.5 as UCB1CLK, P4.6 as UCB1SIMO & P4.7 as UCB1SOMI
-
-
! ============================================
! APPLICATION I/O :
! ============================================
SSCL=8! P1.3
S_BUS=\$0C!
+SD_CD=\$10! P4.4 as SD_CD
+SD_CDIN=\$221!
+SD_CS=\$20! P2.5 as SD_CS
+SD_CSOUT=\$203!
+SD_CSDIR=\$205!
+
+SD_SEL=\$22D! P4SEL0 to configure UCB1
+SD_REN=\$227! P4REN to configure pullup resistors
+SD_BUS=\$7000! pins P4.5 as UCB1CLK, P4.6 as UCB1SIMO & P4.7 as UCB1SOMI
+
+
! -*- coding: utf-8 -*-
-! ChipStick_FR2433.pat
+! MSP_EXP430FR2433.pat
!
-! Fast Forth For M. Ken Boak "ChipStick"
+!
+! FastForth declarations for MSP-EXP430FR2433 launchpad
!
! Copyright (C) <2016> <J.M. THOORENS>
!
! You should have received a copy of the GNU General Public License
! along with this program. If not, see <http://www.gnu.org/licenses/>.
!
+\.f=\.4th! to change file type
!
+@define{@read{@mergepath{@inpath{};RemoveComments.pat;}}}
!
! ======================================================================
! MSP430FR2433 Config
! ======================================================================
-
@define{@read{@mergepath{@inpath{};MSP430FR2433.pat;}}}
@define{@read{@mergepath{@inpath{};FastForthREGtoTI.pat;}}}
-!@define{@read{@mergepath{@inpath{};RemoveComments.pat;}}}
! ======================================================================
! INIT MSP-EXP430FR2433 board
TERM_IE=\$21A!
TERM_IFG=\$21C!
+TERM_CTLW0=\$500! \ eUSCI_A control word 0
+TERM_CTLW1=\$502! \ eUSCI_A control word 1
+TERM_BRW=\$506!
+TERM_BR0=\$506! \ eUSCI_A baud rate 0
+TERM_BR1=\$507! \ eUSCI_A baud rate 1
+TERM_MCTLW=\$508! \ eUSCI_A modulation control
+TERM_STATW=\$50A! \ eUSCI_A status
+TERM_RXBUF=\$50C! \ eUSCI_A receive buffer
+TERM_TXBUF=\$50E! \ eUSCI_A transmit buffer
+TERM_ABCTL=\$510! \ eUSCI_A LIN control
+TERM_IRTCTL=\$512! \ eUSCI_A IrDA transmit control
+TERM_IRRCTL=\$513! \ eUSCI_A IrDA receive control
+TERM_IE=\$51A! \ eUSCI_A interrupt enable
+TERM_IFG=\$51C! \ eUSCI_A interrupt flags
+TERM_IV=\$51E! \ eUSCI_A interrupt vector word
+
RTS=1! ; P1.0
CTS=2! ; P1.1
HANDSHAKIN=\$200!
HANDSHAKOUT=\$202!
-SD_CD=2! ; P2.1 as SD_CD
-SD_CS=1! ; P2.0 as SD_CS
-SD_CDIN=\$201!
-SD_CSOUT=\$203!
-SD_CSDIR=\$205!
-
-SD_SEL=\$20D! ; P2SEL0 to configure UCB0
-SD_REN=\$207! ; P2REN to configure pullup resistors
-SD_BUS=\$070! ; pins P2.4 as UCB0CLK, P2.6 as UCB0SIMO & P25 as UCB0SOMI
-
-
! ============================================
! APPLICATION I/O :
! ============================================
SSCL=\$80! P1.3
S_BUS=\$C0!
+SD_CD=2! ; P2.1 as SD_CD
+SD_CS=1! ; P2.0 as SD_CS
+SD_CDIN=\$201!
+SD_CSOUT=\$203!
+SD_CSDIR=\$205!
+
+SD_SEL=\$20D! ; P2SEL0 to configure UCB0
+SD_REN=\$207! ; P2REN to configure pullup resistors
+SD_BUS=\$070! ; pins P2.4 as UCB0CLK, P2.6 as UCB0SIMO & P25 as UCB0SOMI
+
! You should have received a copy of the GNU General Public License
! along with this program. If not, see <http://www.gnu.org/licenses/>.
!
+\.f=\.4th! to change file type
!
+@define{@read{@mergepath{@inpath{};RemoveComments.pat;}}}
!
! ======================================================================
! MSP430FR4133 Config
! ======================================================================
-
@define{@read{@mergepath{@inpath{};MSP430FR4133.pat;}}}
@define{@read{@mergepath{@inpath{};FastForthREGtoTI.pat;}}}
-@define{@read{@mergepath{@inpath{};RemoveComments.pat;}}}
! ======================================================================
! MSP_EXP430FR4133 board
TERM_IE=\$21A!
TERM_IFG=\$21C!
+TERM_CTLW0=\$500! \ eUSCI_A control word 0
+TERM_CTLW1=\$502! \ eUSCI_A control word 1
+TERM_BRW=\$506!
+TERM_BR0=\$506! \ eUSCI_A baud rate 0
+TERM_BR1=\$507! \ eUSCI_A baud rate 1
+TERM_MCTLW=\$508! \ eUSCI_A modulation control
+TERM_STATW=\$50A! \ eUSCI_A status
+TERM_RXBUF=\$50C! \ eUSCI_A receive buffer
+TERM_TXBUF=\$50E! \ eUSCI_A transmit buffer
+TERM_ABCTL=\$510! \ eUSCI_A LIN control
+TERM_IRTCTL=\$512! \ eUSCI_A IrDA transmit control
+TERM_IRRCTL=\$513! \ eUSCI_A IrDA receive control
+TERM_IE=\$51A! \ eUSCI_A interrupt enable
+TERM_IFG=\$51C! \ eUSCI_A interrupt flags
+TERM_IV=\$51E! \ eUSCI_A interrupt vector word
+
RTS=8! ; P2.3
CTS=\$10! ; P2.4
HANDSHAKIN=\$201!
HANDSHAKOUT=\$203!
-SD_CS=2! ; P8.1 as SD_CS
-SD_CD=1! ; P8.0 as SD_CD
-SD_CDIN=\$261!
-SD_CSOUT=\$263!
-SD_CSDIR=\$265!
-
-SD_SEL1=\$24C! ; to configure UCB0
-SD_REN=\$246! ; to configure pullup resistors
-SD_BUS=\$0E! ; pins P5.1 as UCB0CLK, P5.2 as UCB0SIMO & P5.3 as UCB0SOMI
-
-
! ============================================
! APPLICATION I/O :
! ============================================
SSCL=\$08! P5.3 SCL hadware SLAVE
S_BUS=\$0C!
+
+SD_CS=2! ; P8.1 as SD_CS
+SD_CD=1! ; P8.0 as SD_CD
+SD_CDIN=\$261!
+SD_CSOUT=\$263!
+SD_CSDIR=\$265!
+
+SD_SEL1=\$24C! ; to configure UCB0
+SD_REN=\$246! ; to configure pullup resistors
+SD_BUS=\$0E! ; pins P5.1 as UCB0CLK, P5.2 as UCB0SIMO & P5.3 as UCB0SOMI
+
! along with this program. If not, see <http://www.gnu.org/licenses/>.
!
!
+\.f=\.4th! to change file.f to file.4th
+@define{@read{@mergepath{@inpath{};RemoveComments.pat;}}}
!
! ======================================================================
! MSP430FR5739 Config
! ======================================================================
-
@define{@read{@mergepath{@inpath{};MSP430FR5739.pat;}}}
@define{@read{@mergepath{@inpath{};FastForthREGtoTI.pat;}}}
-!@define{@read{@mergepath{@inpath{};RemoveComments.pat;}}}
-
+!
! ======================================================================
! MSP_EXP430FR5739 board
! ======================================================================
TERM_IE=\$21B!
TERM_IFG=\$21D!
+TERM_CTLW0=\$5C0! \ eUSCI_A control word 0
+TERM_CTLW1=\$5C2! \ eUSCI_A control word 1
+TERM_BRW=\$5C6!
+TERM_BR0=\$5C6! \ eUSCI_A baud rate 0
+TERM_BR1=\$5C7! \ eUSCI_A baud rate 1
+TERM_MCTLW=\$5C8! \ eUSCI_A modulation control
+TERM_STATW=\$5CA! \ eUSCI_A status
+TERM_RXBUF=\$5CC! \ eUSCI_A receive buffer
+TERM_TXBUF=\$5CE! \ eUSCI_A transmit buffer
+TERM_ABCTL=\$5D0! \ eUSCI_A LIN control
+TERM_IRTCTL=\$5D2! \ eUSCI_A IrDA transmit control
+TERM_IRRCTL=\$5D3! \ eUSCI_A IrDA receive control
+TERM_IE=\$5DA! \ eUSCI_A interrupt enable
+TERM_IFG=\$5DC! \ eUSCI_A interrupt flags
+TERM_IV=\$5DE! \ eUSCI_A interrupt vector word
+
RTS=4!
CTS=8!
HANDSHAKIN=\$201!
HANDSHAKOUT=\$203!
-SD_CD=4! P2.2 as SD_CD
-SD_CS=8! P2.3 as SD_CS
-SD_CDIN=\$201!
-SD_CSOUT=\$203!
-SD_CSDIR=\$205!
-
-SD_SEL=\$20D! to configure UCB0
-SD_REN=\$207! to configure pullup resistors
-SD_BUS=\$70! pins P2.4 as UCB0CLK, P2.5 as UCB0SIMO & P2.6 as UCB0SOMI
-
-
! ============================================
! APPLICATION I/O :
! ============================================
SSCL=\$80! P1.7
S_BUS=\$C0!
+SD_CD=4! P2.2 as SD_CD
+SD_CS=8! P2.3 as SD_CS
+SD_CDIN=\$201!
+SD_CSOUT=\$203!
+SD_CSDIR=\$205!
+
+SD_SEL=\$20D! to configure UCB0
+SD_REN=\$207! to configure pullup resistors
+SD_BUS=\$70! pins P2.4 as UCB0CLK, P2.5 as UCB0SIMO & P2.6 as UCB0SOMI
+
+
! You should have received a copy of the GNU General Public License
! along with this program. If not, see <http://www.gnu.org/licenses/>.
!
+\.f=\.4th! to change file type
!
+@define{@read{@mergepath{@inpath{};RemoveComments.pat;}}}
!
! ======================================================================
! MSP430FR5969 Config
! ======================================================================
-
@define{@read{@mergepath{@inpath{};MSP430FR5969.pat;}}}
@define{@read{@mergepath{@inpath{};FastForthREGtoTI.pat;}}}
-@define{@read{@mergepath{@inpath{};RemoveComments.pat;}}}
! ======================================================================
! MSP_EXP430FR5969 board
TERM_IE=\$21B!
TERM_IFG=\$21D!
+TERM_CTLW0=\$5C0! \ eUSCI_A control word 0
+TERM_CTLW1=\$5C2! \ eUSCI_A control word 1
+TERM_BRW=\$5C6!
+TERM_BR0=\$5C6! \ eUSCI_A baud rate 0
+TERM_BR1=\$5C7! \ eUSCI_A baud rate 1
+TERM_MCTLW=\$5C8! \ eUSCI_A modulation control
+TERM_STAT=\$5CA! \ eUSCI_A status
+TERM_RXBUF=\$5CC! \ eUSCI_A receive buffer
+TERM_TXBUF=\$5CE! \ eUSCI_A transmit buffer
+TERM_ABCTL=\$5D0! \ eUSCI_A LIN control
+TERM_IRTCTL=\$5D2! \ eUSCI_A IrDA transmit control
+TERM_IRRCTL=\$5D3! \ eUSCI_A IrDA receive control
+TERM_IE=\$5DA! \ eUSCI_A interrupt enable
+TERM_IFG=\$5DC! \ eUSCI_A interrupt flags
+TERM_IV=\$5DE! \ eUSCI_A interrupt vector word
+
RTS=2! ; P4.1
CTS=1! ; P4.0
HANDSHAKIN=\$221!
! You should have received a copy of the GNU General Public License
! along with this program. If not, see <http://www.gnu.org/licenses/>.
!
-!
+\.f=\.4th! to change file type
+@define{@read{@mergepath{@inpath{};RemoveComments.pat;}}}
!
! ======================================================================
! MSP430FR5994 Config
! ======================================================================
-
@define{@read{@mergepath{@inpath{};MSP430FR5994.pat;}}}
@define{@read{@mergepath{@inpath{};FastForthREGtoTI.pat;}}}
-@define{@read{@mergepath{@inpath{};RemoveComments.pat;}}}
! ======================================================================
! MSP_EXP430FR5994 board
TERM_IE=\$21B!
TERM_IFG=\$21D!
+TERM_CTLW0=\$5C0! \ eUSCI_A control word 0
+TERM_CTLW1=\$5C2! \ eUSCI_A control word 1
+TERM_BRW=\$5C6!
+TERM_BR0=\$5C6! \ eUSCI_A baud rate 0
+TERM_BR1=\$5C7! \ eUSCI_A baud rate 1
+TERM_MCTLW=\$5C8! \ eUSCI_A modulation control
+TERM_STATW=\$5CA! \ eUSCI_A status
+TERM_RXBUF=\$5CC! \ eUSCI_A receive buffer
+TERM_TXBUF=\$5CE! \ eUSCI_A transmit buffer
+TERM_ABCTL=\$5D0! \ eUSCI_A LIN control
+TERM_IRTCTL=\$5D2! \ eUSCI_A IrDA transmit control
+TERM_IRRCTL=\$5D3! \ eUSCI_A IrDA receive control
+TERM_IE=\$5DA! \ eUSCI_A interrupt enable
+TERM_IFG=\$5DC! \ eUSCI_A interrupt flags
+TERM_IV=\$5DE! \ eUSCI_A interrupt vector word
+
RTS=4! ; P4.2
CTS=2! ; P4.1
HANDSHAKIN=\$221!
SD_REN=\$206! ; word access, to configure pullup resistors
SD_BUS=\$04C0! ; pins P2.2 as UCB0CLK, P1.6 as UCB0SIMO & P1.7 as UCB0SOMI
+SD_CTLW0=\$640! \ eUSCI_B control word 0
+SD_CTLW1=\$642! \ eUSCI_B control word 1
+SD_BRW=\$646!
+SD_BR0=\$646! \ eUSCI_B bit rate 0
+SD_BR1=\$647! \ eUSCI_B bit rate 1
+SD_STATW=\$648! \ eUSCI_B status word
+SD_NT0=\$649! \ eUSCI_B hardware count
+SD_TBCNT=\$64A! \ eUSCI_B byte counter threshold
+SD_RXBUF=\$64C! \ eUSCI_B receive buffer
+SD_TXBUF=\$64E! \ eUSCI_B transmit buffer
+SD_I2COA0=\$654! \ eUSCI_B I2C own address 0
+SD_I2COA1=\$656! \ eUSCI_B I2C own address 1
+SD_I2COA2=\$658! \ eUSCI_B I2C own address 2
+SD_I2COA3=\$65A! \ eUSCI_B I2C own address 3
+SD_ADDRX=\$65C! \ eUSCI_B received address
+SD_ADDMASK=\$65E! \ eUSCI_B address mask
+SD_I2CSA=\$660! \ eUSCI I2C slave address
+SD_IE=\$66A! \ eUSCI interrupt enable
+SD_IFG=\$66C! \ eUSCI interrupt flags
+SD_IV=\$66E! \ eUSCI interrupt vector word
+
! ============================================
! APPLICATION I/O :
! You should have received a copy of the GNU General Public License
! along with this program. If not, see <http://www.gnu.org/licenses/>.
!
+\.f=\.4th! to change file type
!
+@define{@read{@mergepath{@inpath{};RemoveComments.pat;}}}
!
! ======================================================================
! MSP430FR6989 Config
! ======================================================================
-
@define{@read{@mergepath{@inpath{};MSP430FR6989.pat;}}}
@define{@read{@mergepath{@inpath{};FastForthREGtoTI.pat;}}}
-@define{@read{@mergepath{@inpath{};RemoveComments.pat;}}}
! ======================================================================
! MSP_EXP430FR6989 board
TERM_IE=\$23A!
TERM_IFG=\$23C!
+TERM_CTLW0=\$5E0! \ eUSCI_A control word 0
+TERM_CTLW1=\$5E2! \ eUSCI_A control word 1
+TERM_BRW=\$5E6!
+TERM_BR0=\$5E6! \ eUSCI_A baud rate 0
+TERM_BR1=\$5E7! \ eUSCI_A baud rate 1
+TERM_MCTLW=\$5E8! \ eUSCI_A modulation control
+TERM_STAT=\$5EA! \ eUSCI_A status
+TERM_RXBUF=\$5EC! \ eUSCI_A receive buffer
+TERM_TXBUF=\$5EE! \ eUSCI_A transmit buffer
+TERM_ABCTL=\$5F0! \ eUSCI_A LIN control
+TERM_IRTCTL=\$5F2! \ eUSCI_A IrDA transmit control
+TERM_IRRCTL=\$5F3! \ eUSCI_A IrDA receive control
+TERM_IE=\$5FA! \ eUSCI_A interrupt enable
+TERM_IFG=\$5FC! \ eUSCI_A interrupt flags
+TERM_IV=\$5FE! \ eUSCI_A interrupt vector word
+
RTS=2! ; P3.1
CTS=1! ; P3.0
HANDSHAKIN=\$220!
-
-! remove comments
-\\*\n=! remove line beginning with \
-\s\\*\n=\n
-
-! remove some lines...
-\n=\N
+! -*- coding: utf-8 -*-
+! RemoveComments.pat
+!
+! Fast Forth For Texas Instrument MSP_EXP430FR5739
+!
+! Copyright (C) <2016> <J.M. THOORENS>
+!
+! This program is free software: you can redistribute it and/or modify
+! it under the terms of the GNU General Public License as published by
+! the Free Software Foundation, either version 3 of the License, or
+! (at your option) any later version.
+!
+! This program is distributed in the hope that it will be useful,
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+! GNU General Public License for more details.
+!
+! You should have received a copy of the GNU General Public License
+! along with this program. If not, see <http://www.gnu.org/licenses/>.
+!
+!
+!
+!========================
+! WINDOWS remove comments
+!========================
+!\\*\n=
+!\s\\*\n=\n
+!
+!========================
+! LINUX remove comments
+!========================
+\\*\n=
+\s\\*\n=\r\n
+!
--- /dev/null
+# Fichier généré automatiquement - utilisez le menu de configuration de
+# minicom pour changer les paramètres.
+pu pname9 YUYNNascii
+pu pprog9 /usr/bin/ascii-xfr -sv
+pu port /dev/ttyUSB0
+pu baudrate 4000000
+pu updir /media/jeanmi/DATA/CloudStation/projets/msp430/MSP430-FORTH
+pu rtscts No
+pu xonxoff Yes
+pu zauto I
+pu mfcolor GREEN
+pu mbcolor BLACK
+pu tfcolor GREEN
+pu sfcolor GREEN
+pu macenab No
+pu histlines 5000
+pu convcap No
+pu askdndir Yes
+pu addlinefeed No
+pu linewrap Yes
+pu addcarreturn Yes
--- /dev/null
+# ~/.profile: executed by the command interpreter for login shells.
+# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
+# exists.
+# see /usr/share/doc/bash/examples/startup-files for examples.
+# the files are located in the bash-doc package.
+
+# the default umask is set in /etc/profile; for setting the umask
+# for ssh logins, install and configure the libpam-umask package.
+#umask 022
+
+# if running bash
+if [ -n "$BASH_VERSION" ]; then
+ # include .bashrc if it exists
+ if [ -f "$HOME/.bashrc" ]; then
+ . "$HOME/.bashrc"
+ fi
+fi
+
+# set PATH so it includes user's private bin if it exists
+if [ -d "$HOME/bin" ] ; then
+ PATH="$HOME/bin:$PATH"
+fi
+
+# set PATH so it includes user's private bin if it exists
+if [ -d "$HOME/.local/bin" ] ; then
+ PATH="$HOME/.local/bin:$PATH"
+fi
+
+FF="/media/jeanmi/DATA/CloudStation"
+export FF
exit
:preprocessF
-@%~d1\prog\gema\gema.exe -nobackup -line -t -f %~dpn2.pat %~dpn1.f %~dpn1.4th
+@%~d1\prog\gema\gema.exe -nobackup -line -t '\n=\r\n;\r\n=\r\n' -f %~dpn2.pat %~dpn1.f %~dpn1.4th
:DownloadF
@taskkill /F /IM ttermpro.exe 1> NULL 2>&1
:: %~d1 is the drive of arg %1
:: %~n2 is your selected template by SelectTarget.bat or your scite $(1)
-IF "%~x1" == "" (
+IF "%~x1" == "" (
echo no file to be preprocessed!
-goto badend
+goto badend
)
IF NOT EXIST %~dpn1.f (
echo %~dpn1.f not found!
-goto badend
+goto badend
)
IF NOT EXIST %~d1\config\gema\%~n2.pat (
echo %~d1\config\gema\%~n2.pat not found!
-goto badend
+goto badend
)
IF /I "%3" == "" GOTO preprocessF
:preprocessF
-@%~d1\prog\gema\gema.exe -nobackup -line -t -f %~d1\config\gema\%~n2.pat %~dpn1.f %~dpn1.4th
+@%~d1\prog\gema\gema.exe -nobackup -line -t '\n=\r\n;\r\n=\r\n' -f %~d1\config\gema\%~n2.pat %~dpn1.f %~dpn1.4th
:DownloadF
@taskkill /F /IM ttermpro.exe 1> NUL 2>&1
IF NOT EXIST %~dpn1.4th (
echo %~dpn1.4th not found!
-goto badend
+goto badend
)
if /I "%2"=="" GOTO Download4th
if /I "%2"=="HALF" GOTO Download4th
echo unexpected 2th parameter %2 !
-goto badend
+goto badend
:Download4th
-gema -nobackup -line -t -f $FF/config/gema/$2.pat $1.f $1.4th
+gema -nobackup -line -t '\n=\r\n;\r\n=\r\n' -f $FF/config/gema/$2.pat $1.f LAST.4th
+
+cat LAST.4th | sed -i -e 's/\n/\r\n/g' LAST.4th > /dev/ttyUSB0
+
:preprocess
-%~d1\prog\gema\gema.exe -nobackup -line -t -f %~d1\config\gema\%~n2.pat %1 %~dp1\last.4th
+%~d1\prog\gema\gema.exe -nobackup -line -t '\n=\r\n;\r\n=\r\n' -f %~d1\config\gema\%~n2.pat %1 %~dp1\last.4th
exit
:: %~dpn1.f is the symbolic source file
-connect param3
+;connect param3
+testlink
+if result=0 connect param3
+
sendln ' $0A BASE ! ECHO STOP' ; blanks are to pass LPMx wake up time...
inputbox 'Send a File' 'Select File : ' param2
-strcompare param4 'ECHO'
+strcompare param4 'NOECHO'
if result = 0 then
- sendln 'ECHO' ; echo from FastForth
- setecho 0 ; no echo from Teraterm
+ send 'NOECHO' ; set no echo from FastForth
+ setecho 1 ; add echo from Teraterm...
+ sendln ; ...to send CR LF
+ setecho 0 ; suppr. echo from Teraterm
showtt 0
- clearscreen 1
+; clearscreen 1
sendfile inputstr 0
showtt 1
+ sendln 'ECHO'
goto end
endif
-strcompare param4 'NOECHO'
+strcompare param4 'HALF'
if result = 0 then
- sendln 'NOECHO' ; no echo from FastForth
+ sendln 'NOECHO'
setecho 1 ; add echo from Teraterm
-; setecho 0 ; don't add echo from Teraterm
showtt 0
- clearscreen 1
+; clearscreen 1
sendfile inputstr 0
- setecho 0
+ setecho 1
showtt 1
- goto end
endif
-strcompare param4 'HALF'
-if result = 0 then
- sendln 'NOECHO'
-; setecho 0 ; don't add echo from Teraterm
- setecho 1
+; default mode = ECHO
+ setecho 0 ; no echo from Teraterm
showtt 0
- clearscreen 1
+; clearscreen 1
sendfile inputstr 0
- setecho 1
showtt 1
-endif
:end
end
-gema -nobackup -line -t -f $FF/config/gema/$2.pat $1.f $1.4th
-
-mate-terminal -x minicom <$1.4th
-#mate-terminal minicom --capturefile=$1.4th
-#minicom -C $1.4th
+gema -nobackup -line -t '\n=\r\n;\r\n=\r\n' -f $FF/config/gema/${2%%\/*}.pat $1.f LAST.4th
+#cp LAST.4th /dev/ttyUSB0
+#sed -i -e 's/\n/\r\n/g' LAST.4th > /dev/ttyUSB0
+cp LAST.4th /dev/ttyUSB0
:: %~d1 is the drive of arg %1
:: %~n2 is your selected template by SelectTarget.bat or your scite $(1)
-IF "%~x1" == "" (
+IF "%~x1" == "" (
echo no file to be preprocessed!
-goto badend
+goto badend
)
IF NOT EXIST %~dpn1.f (
echo %~dpn1.f not found!
-goto badend
+goto badend
)
IF NOT EXIST %~d1\config\gema\%~n2.pat (
echo %~d1\config\gema\%~n2.pat not found!
-goto badend
+goto badend
)
IF /I "%3" == "" GOTO preprocessF
:preprocessF
-@%~d1\prog\gema\gema.exe -nobackup -line -t -f %~d1\config\gema\%~n2.pat %~dpn1.f %~dpn1.4th
+@%~d1\prog\gema\gema.exe -nobackup -line -t '\n=\r\n;\r\n=\r\n' -f %~d1\config\gema\%~n2.pat %~dpn1.f %~dpn1.4th
:DownloadF
@taskkill /F /IM ttermpro.exe 1> NUL 2>&1
IF NOT EXIST %~dpn1.4th (
echo %~dpn1.4th not found!
-goto badend
+goto badend
)
if /I "%2"=="" GOTO Download4th
if /I "%2"=="HALF" GOTO Download4th
echo unexpected 2th parameter %2 !
-goto badend
+goto badend
:Download4th
+
@taskkill /F /IM ttermpro.exe 1> NUL 2>&1
:Win324th
-asl -L $1 -o $2.p
+asl -i $FF/projets/msp430 -L $1 -o $2.p
p2hex $2.p -r 0000h-FFFFh
srec_cat $2.hex -intel -output $2.txt -ti-text
rm $2.p
#!/bin/bash
device=$1
if [ ${device:0:16} == "MSP_EXP430FR5739" ]; then
- device=MSP430FR5739
-elif [ ${device:0:16} == "MSP_EXP430FR5969" ]; then
+ device=MSP430FR5739
+elif [ ${device:0:16} == "MSP_EXP430FR5969" ]; then
device=MSP430FR5969
-elif [ ${device:0:16} == "MSP_EXP430FR5994" ]; then
+elif [ ${device:0:16} == "MSP_EXP430FR5994" ]; then
device=MSP430FR5994
-elif [ ${device:0:16} == "MSP_EXP430FR6989" ]; then
+elif [ ${device:0:16} == "MSP_EXP430FR6989" ]; then
device=MSP430FR6989
-elif [ ${device:0:16} == "MSP_EXP430FR4133" ]; then
+elif [ ${device:0:16} == "MSP_EXP430FR4133" ]; then
device=MSP430FR4133
-elif [ ${device:0:16} == "CHIPSTICK_FR2433" ]; then
+elif [ ${device:0:16} == "CHIPSTICK_FR2433" ]; then
device=MSP430FR2433
-elif [ ${device:0:15} == "MY_MSP430FR5738" ]; then
- device=MSP430FR5738
-elif [ ${device:0:15} == "MY_MSP430FR5948" ]; then
- device=MSP430FR5948
-elif [c${device:0:7} == "JMJ_BOX" ]; then
- device=MSP430FR5738
+elif [ ${device:0:16} == "MSP_EXP430FR2433" ]; then
+ device=MSP430FR2433
+elif [ ${device:0:16} == "MSP_EXP430FR2355" ]; then
+ device=MSP430FR2355
fi
-echo $device
-
+echo $device
-$HOME/MSP430Flasher/MSP430Flasher -s -m SBW2 -n $device -v -w $1.txt -z [RESET,VCC]
MSP430Flasher -s -m SBW2 -n $device -v -w $1.txt -z [RESET,VCC]
-#mspdebug ezfet prog $1.txt
-#mspdebug --allow-fw-update tilib
-
-#mspdebug tilib prog $device $1.txt
-#mspdebug --fet-list tilib
-#mspdebug --fet-list ezfet
#command.compile.*.f=spf.cmd $(FileNameExt)
if PLAT_WIN
- command.name.0.*.f=preprocess file.f with 1:[target].pat then download file.4TH without ECHO
+ command.name.0.*.f=preprocess file.f with 1:[target].pat then download file.4TH
command.0.*.f=*\config\msp430\SendSource.bat $(FileDir)\$(FileName).f $(1) NOECHO
command.name.1.*.f=preprocess file.f with 1:[target].pat then download file.4TH with ECHO
command.4.*.f=*\config\msp430\Preprocess.bat $(FileDir)\$(FileName).f $(1)
command.name.5.*.f=preprocess file.f with for target CurrentSelection then download
- command.5.*.f=\config\msp430\SendSource.bat $(FileDir)\$(FileName).f $(CurrentSelection)
+ command.5.*.f=\config\msp430\SendSource.bat $(FileDir)\$(FileName).f $(CurrentSelection) NOECHO
command.name.6.*.f=preprocess file.f with for target CurrentSelection then download with ECHO
command.6.*.f=\config\msp430\SendSource.bat $(FileDir)\$(FileName).f $(CurrentSelection) ECHO
command.name.11.*.f=convert TI registers to FORTH's ones
command.11.*.f=\prog\gema\gema -line -t -f \config\gema\TiREGtoFastForth.pat $(FileNameExt) $(FileNameExt)
- command.name.0.*.4th=send file.4th to target without ECHO
+ command.name.0.*.4th=send file.4th to target
command.0.*.4th=\config\msp430\SendSource.bat $(FileDir)\$(FileName).4TH NOECHO
command.name.1.*.4th=send file.4th to target with ECHO
if PLAT_GTK
# variable $FF = /media/jeanmi/DATA/CloudStation is defined in my ~.profile
command.name.0.*.f=preprocess file.f with 1:[target].pat then download file.4th without ECHO
- command.0.*.f=*$FF/config/msp430/SendSource $(FileDir)/$(FileName) $(1) NOECHO
+ command.0.*.f=*/media/jeanmi/DATA/CloudStation/config/msp430/SendSource $(FileDir)/$(FileName) $(1) NOECHO
+ #command.0.*.f=*$FF/config/msp430/SendSource $(FileDir)/$(FileName) $(1) NOECHO
command.name.1.*.f=preprocess file.f with 1:[target].pat then download file.4th with ECHO
- command.1.*.f=*$FF/config/msp430/SendSource $(FileDir)/$(FileName) $(1) ECHO
+ command.1.*.f=*/media/jeanmi/DATA/CloudStation/config/msp430/SendSource $(FileDir)/$(FileName) $(1) ECHO
+ #command.1.*.f=*$FF/config/msp430/SendSource $(FileDir)/$(FileName) $(1) ECHO
command.name.2.*.f=preprocess file.f with 1:[target].pat then download file.4th HALFDUPLEX
- command.2.*.f=*$FF/config/msp430/SendSource $(FileDir)/$(FileName) $(1) HALF
+ command.2.*.f=*/media/jeanmi/DATA/CloudStation/config/msp430/SendSource $(FileDir)/$(FileName) $(1) HALF
+ #command.2.*.f=*/media/jeanmi/DATA/CloudStation/config/msp430/SendSource $(FileDir)/$(FileName) $(1) HALF
command.name.3.*.f=preprocess file.f with 1:[target].pat then download file.4th to target SD_CARD
- command.3.*.f=*$FF/config/msp430/CopyTo_SD_Card $(FileDir)/$(FileName) $(1)
+ command.3.*.f=*/media/jeanmi/DATA/CloudStation/config/msp430/CopyTo_SD_Card $(FileDir)/$(FileName) $(1)
+ #command.3.*.f=*$FF/config/msp430/CopyTo_SD_Card $(FileDir)/$(FileName) $(1)
command.name.4.*.f=preprocess file.f with 1:[target].pat to LAST.4th (for debug)
- command.4.*.f=*$FF/config/msp430/Preprocess $(FileDir)/$(FileName) $(1)
+ command.4.*.f=*/media/jeanmi/DATA/CloudStation/config/msp430/Preprocess $(FileDir)/$(FileName) $(1)
+ #command.4.*.f=*$FF/config/msp430/Preprocess $(FileDir)/$(FileName) $(1)
command.name.5.*.f=preprocess file.f with for target CurrentSelection then download
- command.5.*.f=$FF/config/msp430/SendSourceFileToTarget $(FileDir)/$(FileName) $(CurrentSelection)
+ command.5.*.f=/media/jeanmi/DATA/CloudStation/config/msp430/SendSource $(FileDir)/$(FileName) $(CurrentSelection)
+ #command.5.*.f=$FF/config/msp430/SendSource $(FileDir)/$(FileName) $(CurrentSelection)
command.name.6.*.f=preprocess file.f with for target CurrentSelection then download with ECHO
- command.6.*.f=$FF/config/msp430/SendSource $(FileDir)/$(FileName) $(CurrentSelection) ECHO
+ command.6.*.f=/media/jeanmi/DATA/CloudStation/config/msp430/SendSource $(FileDir)/$(FileName) $(CurrentSelection) ECHO
+ #command.6.*.f=$FF/config/msp430/SendSource $(FileDir)/$(FileName) $(CurrentSelection) ECHO
command.name.7.*.f=preprocess file.f with for target CurrentSelection then download file.4th to target SD_CARD
- command.7.*.f=$FF/config/msp430/CopyTo_SD_Card $(FileDir)/$(FileName).f $(CurrentSelection)
+ command.7.*.f=/media/jeanmi/DATA/CloudStation/config/msp430/CopyTo_SD_Card $(FileDir)/$(FileName).f $(CurrentSelection)
+ #command.7.*.f=$FF/config/msp430/CopyTo_SD_Card $(FileDir)/$(FileName).f $(CurrentSelection)
command.name.8.*.f=preprocess file.f with for target CurrentSelection to LAST.4th (for debug)
- command.8.*.f=$FF/config/msp430/Preprocess $(FileDir)/$(FileName) $(CurrentSelection)
+ command.8.*.f=/media/jeanmi/DATA/CloudStation/config/msp430/Preprocess $(FileDir)/$(FileName) $(CurrentSelection)
+ #command.8.*.f=$FF/config/msp430/Preprocess $(FileDir)/$(FileName) $(CurrentSelection)
command.name.9.*.f=convert FORTH registers to TI's ones
- command.9.*.f=gema -line -t -f $FF/config/gema/FastForthREGtoTI.pat $(FileNameExt) $(FileNameExt)
+ command.9.*.f=gema -line -t -f /media/jeanmi/DATA/CloudStation/config/gema/FastForthREGtoTI.pat $(FileNameExt) $(FileNameExt)
+ #command.9.*.f=gema -line -t -f $FF/config/gema/FastForthREGtoTI.pat $(FileNameExt) $(FileNameExt)
command.name.10.*.f=convert TI registers to FORTH's ones
- command.10.*.f=gema -line -t -f $FF/config/gema/tiREGtoFastForth.pat $(FileNameExt) $(FileNameExt)
+ command.10.*.f=gema -line -t -f /media/jeanmi/DATA/CloudStation/config/gema/tiREGtoFastForth.pat $(FileNameExt) $(FileNameExt)
+ #command.10.*.f=gema -line -t -f $FF/config/gema/tiREGtoFastForth.pat $(FileNameExt) $(FileNameExt)
command.name.0.*.4th=send file.4th to target without ECHO
- command.0.*.4th=$FF/config/msp430/SendSource $(FileDir)/$(FileName).4th NOECHO
+ command.0.*.4th=/media/jeanmi/DATA/CloudStation/config/msp430/SendSource $(FileDir)/$(FileName).4th NOECHO
+ #command.0.*.4th=$FF/config/msp430/SendSource $(FileDir)/$(FileName).4th NOECHO
command.name.1.*.4th=send file.4th to target with ECHO
- command.1.*.4th=$FF/config/msp430/SendSource $(FileDir)/$(FileName).4th ECHO
+ command.1.*.4th=/media/jeanmi/DATA/CloudStation/config/msp430/SendSource $(FileDir)/$(FileName).4th ECHO
+ #command.1.*.4th=$FF/config/msp430/SendSource $(FileDir)/$(FileName).4th ECHO
command.name.2.*.4th=send file.4th to target with HALFDUPLEX
- command.2.*.4th=$FF/config/msp430/SendSource $(FileDir)/$(FileName).4th HALF
+ command.2.*.4th=/media/jeanmi/DATA/CloudStation/config/msp430/SendSource $(FileDir)/$(FileName).4th HALF
+ #command.2.*.4th=$FF/config/msp430/SendSource $(FileDir)/$(FileName).4th HALF
command.name.3.*.4th=send file.4th to target SD_CARD
- command.3.*.4th=$FF/config/msp430/CopyTo_SD_Card $(FileDir)/$(FileName).4th
+ command.3.*.4th=$/media/jeanmi/DATA/CloudStation/config/msp430/CopyTo_SD_Card $(FileDir)/$(FileName).4th
+ #command.3.*.4th=$FF/config/msp430/CopyTo_SD_Card $(FileDir)/$(FileName).4th
command.name.4.*.4th=convert TI registers to FORTH's ones
- command.4.*.4th=gema -line -t -f $FF/config/gema/TiREGtoFastForth.pat $(FileNameExt) $(FileNameExt)
+ command.4.*.4th=gema -line -t -f /media/jeanmi/DATA/CloudStation/config/gema/TiREGtoFastForth.pat $(FileNameExt) $(FileNameExt)
+ #command.4.*.4th=gema -line -t -f $FF/config/gema/TiREGtoFastForth.pat $(FileNameExt) $(FileNameExt)
command.name.5.*.4th=convert FORTH registers to TI's ones
- command.5.*.4th=gema -line -t -f $FF/config/gema/FastForthREGtoTI.pat $(FileNameExt) $(FileNameExt)
+ command.5.*.4th=gema -line -t -f /media/jeanmi/DATA/CloudStation/config/gema/FastForthREGtoTI.pat $(FileNameExt) $(FileNameExt)
+ #command.5.*.4th=gema -line -t -f $FF/config/gema/FastForthREGtoTI.pat $(FileNameExt) $(FileNameExt)
;MSP_EXP430FR5969 ; compile for MSP-EXP430FR5969 launchpad ; 26 + 3950 bytes
;MSP_EXP430FR5994 ; compile for MSP-EXP430FR5994 launchpad ; 26 + 3968 bytes
;MSP_EXP430FR6989 ; compile for MSP-EXP430FR6989 launchpad ; 26 + 3978 bytes
-MSP_EXP430FR4133 ;; compile for MSP-EXP430FR4133 launchpad ; 26 + 4012 bytes
-;MSP_EXP430FR2355 ; compile for MSP-EXP430FR2355 launchpad ; 26 + 3944 bytes
+;MSP_EXP430FR4133 ; compile for MSP-EXP430FR4133 launchpad ; 26 + 4012 bytes
+MSP_EXP430FR2355 ;; compile for MSP-EXP430FR2355 launchpad ; 26 + 3944 bytes
;MSP_EXP430FR2433 ; compile for MSP-EXP430FR2433 launchpad ; 26 + 3930 bytes
;CHIPSTICK_FR2433 ; compile for the "CHIPSTICK" of M. Ken BOAK ; 26 + 3922 bytes
; +0, +28, +40, +56, +90, +154 bytes, usefull to speed compilation;
; choose 16
-FREQUENCY .equ 16 ; fully tested at 0.25,0.5,1,2,4,8,16 (and 24 for MSP430FR57xx) MHz
+FREQUENCY .equ 24 ; fully tested at 0.25,0.5,1,2,4,8,16 (and 24 for MSP430FR57xx) MHz
;-------------------------------------------------------------------------------
; KERNEL ADD-ON SWITCHES
MSP430ASSEMBLER ;; + 1814 bytes : adds embedded assembler with TI syntax; without, you can do all but all much more slowly...
CONDCOMP ;; + 324 bytes : adds conditionnal compilation : MARKER [UNDEFINED] [DEFINED] [IF] [ELSE] [THEN] COMPARE
FIXPOINT_INPUT ;; + 78 bytes : adds the interpretation input for S15.16 numbers, mandatory for FIXPOINT
-LOWERCASE ;; + 46 bytes : enables to write strings in lowercase.
+LOWERCASE ;; + 46 bytes : enables to write strings in lowercase (whose VT100 set_up sequences...)
VOCABULARY_SET ;; + 104 bytes : adds words: VOCABULARY FORTH ASSEMBLER ALSO PREVIOUS ONLY DEFINITIONS (FORTH83)
;SD_CARD_LOADER ; + 1748 bytes : to LOAD source files from SD_card
;SD_CARD_READ_WRITE ; + 1192 bytes : to read, create, write and del files + source files direct copy from PC to SD_Card
; Tip: when added here, ADD-ONs become protected against WIPE and Deep Reset... |
;------------------------------------------------------------------------------- v
;UARTtoI2C ; to redirect source file to a I2C TERMINAL FastForth device UART2IIC.f
-;FIXPOINT ; + 422/532 bytes (MPY/noMPY): add HOLDS F+ F- F/ F* F#S F. S>F 2@ 2CONSTANT FIXPOINT.f
+;FIXPOINT ; + 422/528 bytes (MPY/noMPY): add HOLDS F+ F- F/ F* F#S F. S>F 2@ 2CONSTANT FIXPOINT.f
UTILITY ;; + 434/524 bytes (1/16threads) : add .S .RS WORDS U.R DUMP ? UTILITY.f
;SD_TOOLS ; + 142 bytes for trivial DIR, FAT, CLUSTER and SECTOR view, adds UTILITY SD_TOOLS.f
;ANS_CORE_COMPLIANT ; + 876 bytes : required to pass coretest.4th ; (includes items below) ANS_COMP.f
; FAST FORTH TERMINAL configuration
;-------------------------------------------------------------------------------
-TERMINALBAUDRATE .equ 115200 ; choose value considering the frequency and the UART2USB bridge, see explanations below.
+TERMINALBAUDRATE .equ 6000000 ; choose value considering the frequency and the UART2USB bridge, see explanations below.
.include "TERMINALBAUDRATE.inc"
;HALFDUPLEX ; to use FAST FORTH with half duplex terminal
; ANS complement OPTION
;-------------------------------------------------------------------------------
.IFDEF ANS_CORE_COMPLIANT
- .include "ADDON\ANS_COMPLEMENT.asm"
+ .include "ADDON/ANS_COMPLEMENT.asm"
.ELSEIF
;-------------------------------------------------------------------------------
; ALIGNMENT OPERATORS OPTION
;-------------------------------------------------------------------------------
.IFDEF ALIGNMENT ; included in ANS_COMPLEMENT
- .include "ADDON\ALIGNMENT.asm"
+ .include "ADDON/ALIGNMENT.asm"
.ENDIF ; ALIGNMENT
;-------------------------------------------------------------------------------
; PORTABILITY OPERATORS OPTION
;-------------------------------------------------------------------------------
.IFDEF PORTABILITY
- .include "ADDON\PORTABILITY.asm"
+ .include "ADDON/PORTABILITY.asm"
.ENDIF ; PORTABILITY
;-------------------------------------------------------------------------------
; DOUBLE OPERATORS OPTION
;-------------------------------------------------------------------------------
.IFDEF DOUBLE ; included in ANS_COMPLEMENT
- .include "ADDON\DOUBLE.asm"
+ .include "ADDON/DOUBLE.asm"
.ENDIF ; DOUBLE
;-------------------------------------------------------------------------------
; ARITHMETIC OPERATORS OPTION
;-------------------------------------------------------------------------------
.IFDEF ARITHMETIC ; included in ANS_COMPLEMENT
- .include "ADDON\ARITHMETIC.asm"
+ .include "/ADDON/ARITHMETIC.asm"
.ENDIF ; ARITHMETIC
.ENDIF ; ANS_COMPLEMENT
; TERMINAL I/O, input part
; ------------------------------------------------------------------------------
-
;https://forth-standard.org/standard/core/KEY
;C KEY -- c wait character from input device ; primary DEFERred word
FORTHWORD "KEY"
-KEY MOV @PC+,PC
- .word BODYKEY
-BODYKEY MOV &TERMRXBUF,Y ; empty buffer
+KEY MOV @PC+,PC ;3 Code Field Address (CFA) of KEY
+PFAKEY .word BODYKEY ; Parameter Field Address (PFA) of KEY
+BODYKEY ; BODY of KEY = default execution of KEY
+ MOV &TERMRXBUF,Y ; empty buffer
SUB #2,PSP ; 1 push old TOS..
MOV TOS,0(PSP) ; 4 ..onto stack
CALL #RXON
.IFDEF SD_CARD_LOADER
.include "forthMSP430FR_SD_ACCEPT.asm"
-DEFER_INPUT ; CIB (Current Input Buffer) and ACCEPT must to be redirected for SD_LOAD usage
+DEFER_ACCEPT ; CIB (Current Input Buffer) and ACCEPT must to be redirected for SD_LOAD usage
.ENDIF
- .IFDEF DEFER_INPUT
-
-; CIB -- addr of Current Input Buffer
- FORTHWORD "CIB"
-FCIB mDOCON
- .WORD TIB_ORG ; constant, may be redirected as SDIB_ORG by OPEN.
+ .IFNDEF DEFER_ACCEPT
-; : REFILL CIB DUP TIB_LEN ACCEPT ; -- CIB CIB len shared by QUIT and [ELSE]
+; : REFILL TIB DUP TIB_LEN ACCEPT ; -- TIB TIB len shared by QUIT and [ELSE]
REFILL SUB #6,PSP ;2
MOV TOS,4(PSP) ;3
MOV #TIB_LEN,TOS ;2
- MOV &FCIB+2,0(PSP) ;5
+ MOV #TIB_ORG,0(PSP) ;4
MOV @PSP,2(PSP) ;4
JMP ACCEPT ;2
;https://forth-standard.org/standard/core/ACCEPT
;C ACCEPT addr addr len -- addr len' get line at addr to interpret len' chars
FORTHWORD "ACCEPT"
-ACCEPT MOV @PC+,PC ;3
- .word BODYACCEPT
-BODYACCEPT
+ACCEPT
.ELSE
-; : REFILL TIB DUP TIB_LEN ACCEPT ; -- TIB TIB len shared by QUIT and [ELSE]
+; CIB -- addr of Current Input Buffer
+ FORTHWORD "CIB" ; constant, may be redirected as SDIB_ORG by OPEN.
+FCIB mDOCON ; Code Field Address (CFA) of FCIB
+PFACIB .WORD TIB_ORG ; Parameter Field Address (PFA) of FCIB
+
+; : REFILL CIB DUP TIB_LEN ACCEPT ; -- CIB CIB len shared by QUIT and [ELSE]
REFILL SUB #6,PSP ;2
MOV TOS,4(PSP) ;3
MOV #TIB_LEN,TOS ;2
- MOV #TIB_ORG,0(PSP) ;4
+ MOV &PFACIB,0(PSP) ;5
MOV @PSP,2(PSP) ;4
JMP ACCEPT ;2
;https://forth-standard.org/standard/core/ACCEPT
;C ACCEPT addr addr len -- addr len' get line at addr to interpret len' chars
FORTHWORD "ACCEPT"
-ACCEPT
+ACCEPT MOV @PC+,PC ;3 Code Field Address (CFA) of ACCEPT
+PFAACCEPT .word BODYACCEPT ; Parameter Field Address (PFA) of ACCEPT
+BODYACCEPT ; BODY of ACCEPT = default execution of ACCEPT
- .ENDIF ; DEFER_INPUT
+ .ENDIF ; DEFER_ACCEPT
.IFDEF HALFDUPLEX ; to use FAST FORTH with half duplex input terminal (bluetooth or wifi connexion)
; 3- the time between sending XON/RTS_low and clearing UCRXIFG on first received char,
; everything must be done to reduce these times, taking into account the necessity of switching to SLEEP (LPMx mode).
; ----------------------------------;
-; (ACCEPT) I prepare TERMINAL_INT ;
+; ACCEPT part I prepare TERMINAL_INT;
; ----------------------------------;
.IFDEF TOTAL
PUSHM #4,R7 ;6 push R7,R6,R5,R4
; ----------------------------------;
- ASMWORD "SLEEP" ; may be redirected
-SLEEP MOV @PC+,PC ;3
- .word BODYSLEEP ;
-BODYSLEEP BIS &LPM_MODE,SR ;3 enter in LPMx sleep mode with GIE=1
+ ASMWORD "SLEEP" ; may be redirected
+SLEEP MOV @PC+,PC ;3 Code Field Address (CFA) of SLEEP
+PFASLEEP .word BODYSLEEP ; Parameter Field Address (PFA) of SLEEP
+BODYSLEEP ; BODY of SLEEP = default execution of SLEEP
+ BIS &LPM_MODE,SR ;3 enter in LPMx sleep mode with GIE=1
; ----------------------------------; default FAST FORTH mode (for its input terminal use) : LPM0.
;###############################################################################################################
;https://forth-standard.org/standard/core/EMIT
;C EMIT c -- output character to the output device ; primary DEFERred word
FORTHWORD "EMIT"
-EMIT MOV @PC+,PC ;3 15~
- .word BODYEMIT
-BODYEMIT MOV TOS,Y ; 1
+EMIT MOV @PC+,PC ;3 Code Field Address (CFA) of EMIT
+PFAEMIT .word BODYEMIT ; Parameter Field Address (PFA) of EMIT
+BODYEMIT ; BODY of EMIT = default execution of EMIT
+ MOV TOS,Y ; 1
MOV @PSP+,TOS ; 2
JMP YEMIT1 ;9 12~
.ENDIF ; HALFDUPLEX
-
;Z ECHO -- connect console output (default)
FORTHWORD "ECHO"
ECHO MOV #4882h,&YEMIT ; 4882h = MOV Y,&<next_adr>
;https://forth-standard.org/standard/core/CR
;C CR -- send CR to the output device
FORTHWORD "CR"
-CR MOV @PC+,PC
- .word BODYCR
-BODYCR mDOCOL
+CR MOV @PC+,PC ;3 Code Field Address (CFA) of CR
+PFACR .word BODYCR ; Parameter Field Address (PFA) of CR
+BODYCR ; BODY of CR = default execution of CR
+ mDOCOL
.word XSQUOTE
.byte 2,13,10
.word TYPE,EXIT
MOV.B Y,0(TOS) ;3
mNEXT ;4 -- c-addr 40 words Z=1 <==> lenght=0 <==> EOL
-
;https://forth-standard.org/standard/core/FIND
;C FIND c-addr -- c-addr 0 if not found ; flag Z=1
;C xt -1 if found ; flag Z=0
MOV X,4(PSP) ;3 -- ud2lo ud2hi adr2 count2
mNEXT ;4 41 words
-
; ?NUMBER makes the interface between >NUMBER and INTERPRET; it's a subset of INTERPRET.
; convert a string to a signed number; FORTH 2012 prefixes $, %, # are recognized
; 32 bits numbers (with decimal point) and fixed point signed numbers (with a comma) are recognized.
;https://forth-standard.org/standard/core/QUIT
;c QUIT -- interpret line by line the input stream, primary DEFERred word
FORTHWORD "QUIT"
-QUIT MOV @PC+,PC
- .word BODYQUIT ; this word may be replaced by BOOT
-BODYQUIT
+QUIT MOV @PC+,PC ;3 Code Field Address (CFA) of QUIT
+PFAQUIT .word BODYQUIT ; Parameter Field Address (PFA) of QUIT
+BODYQUIT ; BODY of QUIT = default execution of QUIT
.ELSE ; if no BOOTLOADER, QUIT is not DEFERred
JMP QUIT
WIP_DEFER ; WIPE resets ALL factory primary DEFERred words
- MOV #BODYWARM,&WARM+2 ; ' WARM >BODY IS WARM default init
- MOV #SLEEP+4,&SLEEP+2 ; MOV #SLEEP,X ADD #4,X MOV X,-2(X) default background task
+ MOV #BODYWARM,&PFAWARM ; ' WARM >BODY IS WARM default init
+ MOV #BODYSLEEP,&PFASLEEP ; MOV #SLEEP,X ADD #4,X MOV X,-2(X) default background task
QAB_DEFER ; QABORT resets some primary DEFERred words
- MOV #BODYEMIT,&EMIT+2 ;4 ' EMIT >BODY IS EMIT default console output
- MOV #BODYCR,&CR+2 ;4 ' CR >BODY IS CR default CR
- MOV #BODYKEY,&KEY+2 ;4 ' KEY >BODY IS KEY default KEY
+ MOV #BODYEMIT,&PFAEMIT ;4 ' EMIT >BODY IS EMIT default console output
+ MOV #BODYCR,&PFACR ;4 ' CR >BODY IS CR default CR
+ MOV #BODYKEY,&PFAKEY ;4 ' KEY >BODY IS KEY default KEY
- .IFDEF DEFER_INPUT ; true if SD_LOADER
- MOV #BODYACCEPT,&ACCEPT+2 ;4 ' ACCEPT >BODY IS ACCEPT
- MOV #TIB_ORG,&FCIB+2 ;4 TIB_ORG TO CIB (Current Input Buffer)
+ .IFDEF DEFER_ACCEPT ; true if SD_LOADER
+ MOV #BODYACCEPT,&PFAACCEPT ;4 ' ACCEPT >BODY IS ACCEPT
+ MOV #TIB_ORG,&PFACIB ;4 TIB_ORG TO CIB (Current Input Buffer)
.ENDIF
.IFDEF MSP430ASSEMBLER ; reset all 6 branch labels
MOV #10,Y
mNEXT
QABORTYES MOV #4882h,&YEMIT ; restore default YEMIT = set ECHO
+; ----------------------------------;
+QABORT_SDCARD ;
+; ----------------------------------;
.IFDEF SD_CARD_LOADER ; close all handles
MOV &CurrentHdl,T
QABORTCLOSE CMP #0,T
; ----------------------------------;
QABORTYESNOECHO ; <== WARM jumps here, thus, if NOECHO, TERMINAL can be disconnected without freezing the app
; ----------------------------------;
- CALL #QAB_DEFER ; restore default part of primary DEFERred words ....except WARM and SLEEP.
+ CALL #QAB_DEFER
; ----------------------------------;
QABORTTERM ; wait the end of source file downloading
; ----------------------------------;
.IFDEF TERMINAL3WIRES ;
BIT #UCTXIFG,&TERMIFG ; TX buffer empty ?
JZ QABORTTERM ; no
+; ----------------------------------;
MOV #17,&TERMTXBUF ; yes move XON char into TX_buf
.ENDIF ;
.IFDEF TERMINAL4WIRES ;
JNZ QABUSBLOOPI ; 2~ > 4~ loop -+ |
SUB #1,Y ; 1~ |
JNZ QABUSBLOOPJ ; 2~ --> 36~ loop --+
- BIT #UCRXIFG,&TERMIFG ; 4 new char in TERMXBUF after refill time out ?
+ BIT #UCRXIFG,&TERMIFG ; 4 new char in TERMRXBUF after refill time out ?
JNZ QABORTLOOP ; 2 yes, the input stream (download source file) is still active
; ----------------------------------;
-; Display WARM/ABORT message ; no, the input stream is quiet (end of download source file)
+; Display ABORT message ; no, the input stream is quiet (end of download source file)
; ----------------------------------;
mDOCOL ;
.word XSQUOTE ; -- c-addr u c-addr1 u1
- .byte 4,27,"[7m" ;
+ .byte 4,27,"[7m" ; type ESC[7m
.word TYPE ; -- c-addr u set reverse video
ERRLINE .word lit,LINE,FETCH,QDUP; if LINE <> 0
.word QBRAN,ERRLINE_END
+ .word ECHO ;
.word XSQUOTE ; displays the line where error occured
.byte 5,"line:" ;
.word TYPE ;
- .word ONEMINUS,UDOT ;
- .word ECHO ;
+ .word ONEMINUS ;
+ .word UDOT ;
ERRLINE_END .word TYPE ; -- type abort message
.word XSQUOTE ; -- c-addr2 u2
.byte 4,27,"[0m" ;
JMP REVEAL
;https://forth-standard.org/standard/core/toBODY
-; >BODY -- PFA leave BODY of a CREATEd word or of a primary DEFERred word
+; >BODY -- addr leave BODY of a CREATEd word or of a primary DEFERred word
FORTHWORD ">BODY"
ADD #4,TOS
mNEXT
JNZ MOVUP1
MOVE_X mNEXT
+
;-------------------------------------------------------------------------------
; WORDS SET for VOCABULARY, not ANS compliant
;-------------------------------------------------------------------------------
.IFDEF VOCABULARY_SET
FORTHWORD "FORTH"
.ENDIF ; VOCABULARY_SET
-FORTH mDODOES ; leave BODYFORTH on the stack and run VOCDOES
- .word VOCDOES
-BODYFORTH .word lastforthword
+FORTH ; leave BODYFORTH on the stack and run VOCDOES
+ mDODOES ; Code Field Address (CFA) of FORTH
+PFAFORTH .word VOCDOES ; Parameter Field Address (PFA) of FORTH
+BODYFORTH ; BODY of FORTH
+ .word lastforthword
.SWITCH THREADS
.CASE 2
.word lastforthword1
;Z WARM -- ; deferred word used to init your application
; define this word: : START ...init app here... LIT RECURSE IS WARM (WARM) ;
FORTHWORD "WARM"
-WARM MOV @PC+,PC ;3
- .word BODYWARM
-BODYWARM
+WARM MOV @PC+,PC ;3 Code Field Address (CFA) of WARM
+PFAWARM .word BODYWARM ; Parameter Field Address (PFA) of WARM
+BODYWARM ; BODY of WARM (default execution of WARM)
; SUB #4,PSP
; MOV &SYSSNIV,0(PSP)
; MOV &SYSUNIV,2(PSP)
.ELSE
FORTHtoASM
.IF RAM_LEN < 2048 ; case of MSP430FR57xx : SD datas are in FRAM
- MOV #0,&CurrentHDL ; init this FRAM area to pass QABORT
+ MOV #SD_LEN,X ; so are not initialised by COLD/RESET
+ClearSDdata SUB #2,X ;
+ MOV #0,SD_ORG(X) ;
+ JNZ ClearSDdata ;
.ENDIF
BIT.B #SD_CD,&SD_CDIN ; SD_memory in SD_Card module ?
JNZ WARM ; no
- .IFNDEF LOWERCASE
- .WARNING "uncomment LOWERCASE ADD-ON to pass coretest COMPARE !"
- .ENDIF ; LOWERCASE
-
;COMPARE ( c-addr1 u1 c-addr2 u2 -- n )
;https://forth-standard.org/standard/string/COMPARE
;Compare the string specified by c-addr1 u1 to the string specified by c-addr2 u2.
; FirstSectorOfCluster(n) = OrgCluster + n*BPB_SecPerClus ==> cluster(6) = 30368
; ===========================================================
-; 0- Init FRAM SD datas, case of MSP430FR57xx
-; ===========================================================
-
- .IF RAM_LEN < 2048 ; case of MSP430FR57xx : SD datas are in FRAM
- MOV #SD_LEN_DATA,X ; so are not initialised by COLD/RESET
-InitSDdata ;
- SUB #2,X
- MOV #0,SD_ORG_DATA(X) ;
- JNZ InitSDdata ;
- .ENDIF
-
-; ===========================================================
; 1- Init eUSCI dedicated to SD_Card SPI driver
; ===========================================================
JZ INIT_CMD8 ; if idle state
SD_INIT_ERROR ;
MOV #SD_CARD_ERROR,PC ; ReturnError = $04R1, case of defectuous card (or insufficient SD_POWER_ON clk)
-; ----------------------------------;
+; ----------------------------------; see forthMSP430FR_SD_lowLvl.asm
INIT_CMD8 ; mandatory if SD_Card >= V2.x [11:8]supply voltage(VHS)
; ----------------------------------;
CALL #SPI_GET ; (needed to pass SanDisk ultra 8GB "HC I")