]> Vexing Labs - forthdeck.git/commitdiff
Add to docs
authorAdam Shamblin <adam@vexingworkshop.com>
Sun, 26 Jun 2022 21:54:53 +0000 (15:54 -0600)
committerAdam Shamblin <adam@vexingworkshop.com>
Sun, 26 Jun 2022 21:54:53 +0000 (15:54 -0600)
README.md
doc/README.md [new file with mode: 0644]
doc/index.md [deleted file]
doc/terminal.md [new file with mode: 0644]
doc/uart.md [new file with mode: 0644]
src/uart.fs

index 262677acac68d4aac88951ace818babda3fd1bb2..45b621c155466c77dfaa86aea9c05e8396797bf8 100644 (file)
--- a/README.md
+++ b/README.md
@@ -12,7 +12,7 @@ keywords:
 The purpose of this project is to build a general purpose, interactive computer
 out of an rp2040, while learning practical programming using the Forth language.
 
-[Documentation](doc/index.md)
+[Documentation](doc/README.md)
 
 
 ## TODO
diff --git a/doc/README.md b/doc/README.md
new file mode 100644 (file)
index 0000000..a6ad8b0
--- /dev/null
@@ -0,0 +1,13 @@
+---
+title: Documentation
+---
+
+# Documentation
+
+Here may be found the documentation for the words and capabilities made
+available using the `forthdeck` project.
+
+* [GPIO](gpio.md)
+* [Terminal](terminal.md)
+* [UART](uart.md)
+* [Wordle](wordle.fs)
diff --git a/doc/index.md b/doc/index.md
deleted file mode 100644 (file)
index a50ead8..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Documentation
----
-
-* [GPIO](gpio.md)
diff --git a/doc/terminal.md b/doc/terminal.md
new file mode 100644 (file)
index 0000000..708ab42
--- /dev/null
@@ -0,0 +1,58 @@
+---
+title: Terminal
+file: terminal.fs
+---
+
+# Terminal
+
+The Terminal library provides words for working with serial input and output,
+including screen management and color display.
+
+## Escape Characters & Color Codes
+
+### ESC[ ( -- )
+
+Send an ANSI escape character to the terminal. This is intended to precede ANSI
+escape codes.
+
+## Terminal UI
+
+### TI ( -- ), TE ( -- )
+
+Enter or exit TUI mode.
+
+### at-xy ( column, row )
+
+Place the cursor at the specified column and row on screen.
+
+```forth
+5 5 at-xy
+```
+
+### \[home\] ( -- )
+
+Place the cursor at the 1,1 position on screen.
+
+### page ( -- )
+
+Clear the screen and place the cursor at the 1,1 position on screen.
+
+### hide-cursor ( -- ), show-cursor (--)
+
+Hide or show the cursor.
+
+### cleanup ( -- )
+
+After completing a TUI application, clear the screen, exit TUI mode and display
+the cursor.
+
+## Colors
+
+Terminal text may be formatted using typical ANSI color and formatting codes.
+
+```forth
+[black][red/bg]Black on red text[reset]
+```
+
+Further "true color" words may be created using `ESC[` and extended ANSI color
+codes.
diff --git a/doc/uart.md b/doc/uart.md
new file mode 100644 (file)
index 0000000..1e6db07
--- /dev/null
@@ -0,0 +1,50 @@
+---
+title: UART
+file: uart.fs
+---
+
+# UART
+
+The UART library provides words for working with the rp2040's two UART serial
+interfaces. This includes matters of hardware flow control.
+
+The rp2040 has two UART serial interfaces, referred to by the constants UART0
+and UART1.
+
+## Diagram
+
+**TODO** Put ASCII diagram connecting FTDI module and Pico here
+
+## Enabling & Disabling Interfaces
+
+### enabled? ( addr -- flag )
+
+Determine if a UART interface is enabled.
+
+```forth
+UART0 enabled?
+```
+
+### transmit-enabled? ( addr -- flag )
+
+Determine if a UART interface has transmit enabled.
+
+```forth
+UART0 transmit-enabled?
+```
+
+### rts-enabled? ( addr -- flag ), cts-enabled? ( addr -- flag )
+
+Determine if RTS or CTS are enabled for the given interface.
+
+```forth
+UART0 rts-enabled?
+```
+
+### rts-toggle ( addr -- ), cts-toggle ( addr -- )
+
+Enable or disable RTS or CTS for the given interface.
+
+```forth
+UART0 rts-toggle
+```
index 5d6765ee5f6e9be3dfd3d6f224b3dfffb0b25bb5..d9b13b979883605d0d82ea3ffa75c98717b48b37 100644 (file)
@@ -11,8 +11,12 @@ $030 constant UARTCR
 UART0_BASE UARTCR + constant UART0_CR
 UART1_BASE UARTCR + constant UART1_CR
 
+\ Convenience words for referencing control registers
+: UART0 ( -- addr ) UART0_CR ;
+: UART1 ( -- addr ) UART1_CR ;
+
 \ Determine if UART is enabled at this interface
-\ example: UART0_CR enabled?
+\ example: UART0 enabled?
 : enabled? ( addr -- flag ) @ 1 AND 0 > ;
 : transmit-enabled? ( addr -- flag ) @ 1 8 lshift AND 0 > ;
 
@@ -20,5 +24,5 @@ UART1_BASE UARTCR + constant UART1_CR
 : rts-enabled? ( addr -- flag ) @ 1 14 lshift AND 0 > ;
 : cts-enabled? ( addr -- flag ) @ 1 15 lshift AND 0 > ;
 
-: rts-toggle ( addr -- flag ) dup @ 1 14 lshift XOR swap ! ;
-: cts-toggle ( addr -- flag ) dup @ 1 15 lshift XOR swap ! ;
+: rts-toggle ( addr -- ) dup @ 1 14 lshift XOR swap ! ;
+: cts-toggle ( addr -- ) dup @ 1 15 lshift XOR swap ! ;