]> Vexing Labs - forthdeck.git/commitdiff
minor changes to wordle, begin exploring uart
authorAdam Shamblin <adam@vexingworkshop.com>
Fri, 24 Jun 2022 03:48:08 +0000 (21:48 -0600)
committerAdam Shamblin <adam@vexingworkshop.com>
Fri, 24 Jun 2022 03:48:08 +0000 (21:48 -0600)
src/uart.fs [new file with mode: 0644]
src/wordle.fs

diff --git a/src/uart.fs b/src/uart.fs
new file mode 100644 (file)
index 0000000..62b90f3
--- /dev/null
@@ -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 ) ; 
index f09c41ace7cc5faa45c0061e6d0da38e79cba3b8..b0dccc560c6bce1c726ea1f9d9ab1c757d36ee30 100644 (file)
@@ -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 ;