; reset state : Px{DIR,REN,SEL0,SEL1,SELC,IE,IFG,IV} = 0 ; Px{IN,OUT,IES} = ?
+; PORTA usage
+SD_SEL .equ PASEL0 ; to configure UCB0
+SD_REN .equ PAREN ; to configure pullup resistors
+SD_BUS .equ 0700h ; pins P2.2 as UCB0CLK, P2.0 as UCB0SIMO & P2.1 as UCB0SOMI
+
; PORT1 usage
; P1.0 - LED1 red output low
; P1.1 - Switch S1
; PORT2 usage
+SD_CS .equ 40h ; P2.6 as SD_CS
+SD_CD .equ 80h ; P2.7 as SD_CD
+SD_CDIN .equ P2IN
+SD_CSOUT .equ P2OUT
+SD_CSDIR .equ P2DIR
+
; PORTx default wanted state : pins as input with pullup resistor
MOV #1,&PADIR ; all pins as input else P1.0
; PORTx default wanted state : pins as input with pullup resistor
- .IFDEF TERMINALCTSRTS
+ .IFDEF TERMINAL4WIRES
; RTS output is wired to the CTS input of UART2USB bridge
-; CTS is not used by FORTH terminal
; configure RTS as output high to disable RX TERM during start FORTH
-RTS .equ 1 ; P3.0
-;CTS .equ 2 ; P3.1
HANDSHAKOUT .equ P3OUT
HANDSHAKIN .equ P3IN
+RTS .equ 1 ; P3.0
BIS #00001h,&PBDIR ; all pins as input else P3.0 (RTS)
BIS #-1,&PBREN ; all inputs with resistor
+
+ .IFDEF TERMINAL5WIRES
+
+CTS .equ 2 ; P3.1
+
+ MOV #0FFFDh,&PBOUT ; that acts as pull up, P3.0 as output HIGH, P3.1 input low
+
+ .ELSEIF
+
MOV #-1,&PBOUT ; that acts as pull up, P3.0 as output HIGH
+ .ENDIF ; TERMINAL5WIRES
+
.ELSEIF
BIS #-1,&PBREN ; all inputs with resistor
MOV #-1,&PBOUT ; that acts as pull up
- .ENDIF
+ .ENDIF ; TERMINAL4WIRES
; ----------------------------------------------------------------------
; POWER ON RESET AND INITIALIZATION : PORT5/6
; ----------------------------------------------------------------------