From: Adam Shamblin Date: Fri, 24 Jun 2022 03:48:08 +0000 (-0600) Subject: minor changes to wordle, begin exploring uart X-Git-Url: https://git.vexinglabs.com/?a=commitdiff_plain;h=e0a49ae21355daa65e7e3e3d46a7b49ab0ccff23;p=forthdeck.git minor changes to wordle, begin exploring uart --- diff --git a/src/uart.fs b/src/uart.fs new file mode 100644 index 0000000..62b90f3 --- /dev/null +++ b/src/uart.fs @@ -0,0 +1,20 @@ +\ Words to explore and utilize UART + +\ Base registers +$40034000 constant UART0_BASE +$40038000 constant UART1_BASE + +\ Offsets +$030 constant UARTCR + +\ Addressed registers +UART0_BASE UARTCR + constant UART0_CR + +\ *NOTE* This is getting interesting enough +\ to put on a slide presentation, perhaps for Denhac + +\ ?? What is the difference between CTS and RTS? +\ Clear to Send +\ Ready to Send + +: transfer-enabeled? ( n -- flag ) ; diff --git a/src/wordle.fs b/src/wordle.fs index f09c41a..b0dccc5 100644 --- a/src/wordle.fs +++ b/src/wordle.fs @@ -41,14 +41,27 @@ lexicon VARIABLE lex-ptr s" swack" store s" feens" store ; +\ Select a word from lexicon by index : word. ( index -- ) WORDSIZE * lexicon + WORDSIZE TYPE ; : word@ ( index -- addr ) WORDSIZE * lexicon + ; + +: char. ( word index -- ) + c@ EMIT ; +: char@ ( word index -- char ) + c@ ; +: char= ( char word index -- flag ) char@ = ; + +\ Select a random word from lexicon : randword. ( -- addr ) 2 random word. ; : randword@ ( -- addr ) 2 random word@ ; +\ See if a word contains a letter +: contains ( char addr -- flag ) + WORDSIZE 0 DO + 2DUP I char= IF LEAVE ELSE THEN + LOOP ; + : check-word ( input target -- ) WORDSIZE 0 DO - I + C@ <# # #> type + I + C@ <# # #> TYPE LOOP ; 0 VARIABLE target @@ -58,5 +71,4 @@ lexicon VARIABLE lex-ptr 6 0 DO \ Accept user input \ Show matching letters - LOOP - ; + LOOP ;