35 lines
1.3 KiB
Plaintext
35 lines
1.3 KiB
Plaintext
|
## StdIO.jack
|
||
|
A library of functions for textual input and output over UART.
|
||
|
|
||
|
### function void printString(String s)
|
||
|
Print the String s to UART_TX and disposes the String s.
|
||
|
### function void printInt(int i)
|
||
|
Prints the decimal representation of i to UART_TX
|
||
|
### function void println()
|
||
|
Prints the new line character to UART_TX
|
||
|
### function int readInt(String message)
|
||
|
Displays the message on the screen, disposes the message, reads from UART_RX the entered text until a newline character is detected, echoes the text to UART_TX, and returns its integer value (until the first non-digit character in the entered text is detected). Also handles user backspaces.
|
||
|
### function String readLine(String message)
|
||
|
Sends the message to UART_TX, reads from UART_RX the entered text until a newline character is detected, echoes the text to the UART_TX, and returns its value. Also handles user backspaces.
|
||
|
***
|
||
|
## Project
|
||
|
* Implement `StdIO.jack`.
|
||
|
* Run String_Test in real hardware on iCE40HX1K-EVB using a terminal program connected to UART.
|
||
|
|
||
|
* Compare your terminal output with:
|
||
|
|
||
|
```
|
||
|
StdIO test:
|
||
|
Please press the number '3':
|
||
|
ok
|
||
|
readLine test:
|
||
|
(Verify echo and usage of 'backspace')
|
||
|
Please type 'JACK' and press enter: JACK
|
||
|
ok
|
||
|
readInt test:
|
||
|
(Verify echo and usage of 'backspace')
|
||
|
Please type '-32123' and press enter: -32123
|
||
|
ok
|
||
|
|
||
|
Test completed successfully
|
||
|
```
|