added v2.0

This commit is contained in:
Michael Schröder
2023-01-11 11:13:09 +01:00
parent 2a5a64ca91
commit 971b323822
584 changed files with 159319 additions and 0 deletions

View File

@@ -0,0 +1 @@
../Array.jack

View File

@@ -0,0 +1 @@
../GPIO.jack

View File

@@ -0,0 +1,70 @@
// This file is part of www.nand2tetris.org
// and the book "The Elements of Computing Systems"
// by Nisan and Schocken, MIT Press.
// File name: projects/12/KeyboardTest/Main.jack
/** Test program for the OS Keyboard class. */
class Main {
/** Gets input from the user and verifies its contents. */
function void main() {
var char c, key;
var String s;
var int i;
var boolean ok;
do StdIO.printString("StdIO test:");
do StdIO.println();
let ok = false;
while (~ok) {
do StdIO.printString("Please press the number '3': ");
let c = UART.readChar();
do StdIO.println();
if (c = 51) {
do StdIO.printString("ok");
do StdIO.println();
let ok = true;
}
}
let ok = false;
do StdIO.printString("readLine test:");
do StdIO.println();
do StdIO.printString("(Verify echo and usage of 'backspace')");
do StdIO.println();
while (~ok) {
let s = StdIO.readLine("Please type 'JACK' and press enter: ");
if (s.length() = 4) {
if ((s.charAt(0) = 74) & (s.charAt(1) = 65) & (s.charAt(2) = 67) & (s.charAt(3) = 75)) {
do StdIO.printString("ok");
do StdIO.println();
let ok = true;
}
}
}
let ok = false;
do StdIO.printString("readInt test:");
do StdIO.println();
do StdIO.printString("(Verify echo and usage of 'backspace')");
do StdIO.println();
while (~ok) {
let i = StdIO.readInt("Please type '-32123' and press enter: ");
if (i = (-32123)) {
do StdIO.printString("ok");
do StdIO.println();
let ok = true;
}
}
do StdIO.println();
do StdIO.printString("Test completed successfully");
return;
}
}

View File

@@ -0,0 +1,18 @@
all: jack vm asm bin sim
jack:
../../tools/JackCompiler/JackCompiler.pyc ./
vm:
../../tools/VMTranslator/VMTranslator.pyc ./
asm:
../../tools/Assembler/assembler.pyc out.asm
bin:
../../tools/AsciiToBin.py out.hack
sim:
cp out.hack ../00_HACK/ROM.hack
upload:
iceprogduino -o 64k -w out.bin
clean:
rm -f *.vm *.asm *.hack *.bin *~
.PHONY: all clean

View File

@@ -0,0 +1 @@
../Math.jack

View File

@@ -0,0 +1 @@
../Memory.jack

View File

@@ -0,0 +1,29 @@
## StdIO.jack
A library of functions for text based input and output over UART.
***
### Project
* Implement `StdIO.jack`.
* Run `StdIO_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
```

View File

@@ -0,0 +1,35 @@
## 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
```

View File

@@ -0,0 +1 @@
../StdIO.jack

View File

@@ -0,0 +1 @@
../String.jack

View File

@@ -0,0 +1 @@
../Sys.jack

View File

@@ -0,0 +1 @@
../UART.jack