Skip to content

99 Instructions

Geo edited this page Jul 10, 2025 · 6 revisions

Instruction Syntax

The instruction system follows the Bus Pirate syntax and is partially supported.

🧠 Overview

Instructions are sequences enclosed in brackets (e.g., [0xAA r:8]) and parsed into byte-level actions called ByteCodes.
They allow you to directly express sequences of read/write/start/stop/delay in a compact and flexible form.

✅ Supported Syntax Examples

Syntax Meaning
[0xAA 0xBB] Write two bytes
[r:4] Read 4 bytes
[s 0xA1 r S] Start → Write 0xA1 → Read → Stop
['A'] Write ASCII 'A' (char literal)
["ABC"] Write ASCII string ABC
[d:10] Delay 10 microseconds
[D:1] Delay 1 millisecond
[hhhlll] Set AUX high 3 times, low 3 times
[s r:2 S] Start → Read 2 bytes → Stop

⛔ Unsupported Features (for now)

  • Loops and nested brackets
  • Inline macros or expressions
  • Bit-level operations (like .1, .0)
  • Block {} and macro > prefixes

⚙️ Notes

  • Hex values (0xAA) and decimal numbers (123) are supported.
  • Repeats like r:10, hhh, lllll are parsed correctly.
  • Strings in "quotes" are written as ASCII.
  • Characters in 'A' are written as their byte value.

🔗 Parser Behavior

  • Anything inside [] is considered an instruction.
  • Special characters like s, S, r, d, D, h, l map to specific bytecode actions.
  • ByteCode enums are generated per token.

🧪 Example Usages

  • [0xA0 r:1 0xB1 r:1] → Write 0xA0, Read, Write 0xB1, Read
  • [s 'X' r S] → Start, write 'X', read, Stop
  • [d:100 D:2] → Delay 100µs then 2ms

⚠️ This syntax is parsed but not all instructions are currently executed in all modes.

Clone this wiki locally