Built a big loop that looks for the first data on serial port. This is the command byte, each command is put through case statement to run a function. Some commands will wait for 1 to 4 bytes for parameters. All commands must return something, this could be 1 to 4 bytes of data this may change if future.
List of current commands
| Name | Command code | Parameter | Return Value | Description |
|---|---|---|---|---|
| NOP | $00 | None | 1 byte | Awake Command will always return $00 manly here to see we get some kind of response. |
| STATUS | $01 | None | 1 byte | Get status so far we $01 port A is open and $02 port B open for reading and writing. |
| RESET | $02 | None | 4 bytes | Reset the Address Counter. This should always return four $00 bytes 32 bits |
| READ | $03 | None | 1 byte | Reads the data in memory at the address of counter |
| READINC | $04 | None | 1 byte | Reads the data in memory at the address of counter then increment address counter. |
| ADDRESS | $05 | None | 4 bytes | Get the current address from the counter shadow 32 bits |
| OPEN | $06 | 1 byte | 1 byte | $01 Open port A for reading and writing, $02 open port B for reading writing. Returns the status e.g. command $01 |
| CLOSE | $07 | None | 1 byte | Closes access to all port and goes into ROM Emulation mode. |
| WRITE | $08 | 1 byte | 1 byte | Write to memory addressed by counter, a read of memory is performed after write and read data is returned. |
| WRITEINC | $09 | 1 byte | 1 byte | Write to memory addressed by counter, read of memory after write is returned and address counter is incremented. |
| READU30 | $0A | None | 1 byte | Get the shadow value of U30 latch output |
| READU4 | $0B | None | 1 byte | Get the shadow value of U4 latch output |
| READU5 | $0C | None | 1 byte | Get the shadow value of U5 latch output |
| READU6 | $0D | None | 1 byte | Get the shadow value of U6 latch output |
| WRITEU30 | $0E | 1 byte | 1 byte | Write a value to U30 shadow latch and return the new shadow value |
| WRITEU4 | $0F | 1 byte | 1 byte | Write a value to U4 shadow latch and return the new shadow value. |
| WRITEU5 | $10 | 1 byte | 1 byte | Write a value to U5 shadow latch and return the new shadow value |
| WRITEU6 | $11 | 1 byte | 1 byte | Write a value to U6 shadow latch and return the new shadow value |
Forthnutter
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.