Dump
This code from block 856 is loaded into node 512. It displays 64 words on the monitor. Useful for looking at a node's RAM or external Flash or SRAM. Though it's mostly an exercise in displaying text.
Four other nodes are are involved in this application
- 513 slices characters
- 514 contains the font
- 613 is a wire from 513 to 713
- 713 displays green characters
This application is an example of replacing memory with computation. Rather than store the image in RAM and read it back to display, the image is generated line by line. This has the advantage of providing a dynamic display. If the node was changing its memory, you'd see that happening without further effort.
go
An infinite loop that displays
- A block number
- 16 rows of 5 numbers
- 215 blank lines
Each pixel in this display is ~12 unexts wide by 3 scan-lines high. The character font is 5x7 pixels and may be offset down 2 pixels for a descender. A row of text is 30 scan lines: 3 blank and 27 for 9 pixels.
To display the block number requires 27 repetitions of octal conversion and end-of-line.
With a starting address of 0 on the stack, 16 rows are displayed, incrementing the address by 4 each time.
.o
The number of digits (- 1) is on top of the stack, with the number to be displayed underneath. There are 2 loops, one to shift the octal digits, leaving the high-order digit on top. Another to mask and display the digits. Adding one to a digit (octal, decimal or hex) gives the code for its character.
eol
End-of-line is indicated by a negative character.
bl
A blank character is 0.
row
Again, a row of text must be repeated 27 times.
- First send a packet requesting 4 numbers
- Display the 2-digit address
- Fetch and display 4 6-digit numbers
pkt
Sends an ether packet to a specified node. This is the first instance of a node generating a packet. As is my style, editing this source code selects among many options. Ignored options are commented out, but remain so I can recall them.
Node 512 will send the packet to 511, from whence the path begins. It sends
- Focus. In etherForth, the literal left is a call to the left port. It resides in register a.
- Call to ether code
- Path. Which is generated manually on the PC
- Count word
- high hex digit is reply count divided by 2
- low hex digit is 4 for 5 words of payload
- Payload: the code to return 4 words from node's RAM. The sending code is interspersed with the code to be sent, which is delimited by /. This is convenient, but fiddly to code. @p is used to fetch an instruction word as a literal. There are 3 words of code and 2 literals: address and count.
If the destination node is in the host chip, the path must be thru node 001 and a host path added to the payload.