diff --git a/docs.py b/docs.py index dc2e0d0..e97d687 100644 --- a/docs.py +++ b/docs.py @@ -1,3 +1,4 @@ +from dataclasses import dataclass import datetime import re import os @@ -19,7 +20,7 @@ TOC_HTAG_LEVELS = {"1", "2"} HOST = "https://bsnk.me" TEMPLATES = "templates" PAGES_BASE = "pages" -STATIC = ["images"] +STATIC = ["images", "static"] ROOT = os.environ.get("EA_ROOT", "") @@ -42,6 +43,7 @@ SEGA_CONTENTS = { "intro.html": ("Introduction to RingEdge 2", ()), "hardware": ("Hardware", ()), "software": ("Software", { + "jvs.html": "JVS", "drivers": ("Device drivers", { "columba.html": "columba", "mxsram.html": "mxsram", @@ -51,16 +53,15 @@ SEGA_CONTENTS = { "mxparallel.html": "mxparallel", "mxsmbus.html": "mxsmbus", }), - "jvs.html": "JVS", "security": ("Security", { "game.html": "Game encryption", "dongle.html": "Dongles", "keychip.html": "Keychips", - }) + }), }), "network": ("Networking", { "allnet.html": "ALL.Net" - }) + }), } CONTENTS = { "": EAMUSE_CONTENTS, @@ -68,6 +69,25 @@ CONTENTS = { } +@dataclass +class Part: + id: str + name: str + description: str = None + page: str = None + + +PARTS = { + "838-14971": Part("838-14971", "Aime NFC daughter board", "NFC RW BD TN32MSEC003S") +} + + +def part(id): + if (part := PARTS.get(id)): + return f'{part.name}Part number{part.id}Description{part.description}' + return f'{id}' + + def generate_xrpc_list(): output = "
Note: This page assumes you have read the documentation regarding the JAMMA video + standard. If you have not, it is recommended to read that first.
+ +E0h | +n | +Dest | +Seq | +CMD | +D0 | +D1 | +D2 | +... | +Dn-5 | +SUM | +
E0h | +n | +Src | +Seq | +Status | +CMD | +Report | +D0 | +D1 | +D2 | +... | +Dn-7 | +SUM | +
Response packets of this format include a source address, which should match the destination in the request. The + sequence number of both the request and response should be the same (? todo: verify this), and should be modulo 32 + (20h).
+While the packet format would suggest it supports multiple commands, I have never observed more than a single command + per packet. Response packets include the command number between their packet status and report status bytes. +
+ +The following is a reference table for communication with an {{ part("838-14971")|safe }}. Endpoints required for + MIFARE cards are marked with M, FeliCa F, and LEDs L.
+Req | +Name | +Code | +Description | +Request Size | +Response Size | +
MF | +Get Firmware Version | +30 |
+ Retrive the firmware version string | +0 | +1+ | +
MF | +Get Hardware Version | +32 |
+ Retrive the hardware version string | +0 | +1+ | +
MF | +Radio On | +40 |
+ Enable the NFC radio | +2 | +0 | +
MF | +Radio Off | +41 |
+ Disable the NFC radio | ++ | 0 | +
MF | +Poll | +42 |
+ Retreive a list of NFC devices | +0 | +3+ | +
M | +Select MIFARE tag | +43 |
+ + | 1+ | +0 | +
+ | + | 44 |
+ + | 1+ | ++ |
MF | +Set MIFARE Classic key | +50 |
+ Provide the key used for MIFARE decryption | +1+ | +0 | +
+ | + | 51 |
+ + | 1+ | ++ |
M | +Read MIFARE block | +52 |
+ Read a secified block from a MIFARE Classic device | ++ | + |
MF | +Set Aime key?? | +54 |
+ /shrug | +1+ | +0 | +
+ | + | 55 |
+ + | + | + |
+ | + | 60 |
+ + | + | + |
+ | + | 61 |
+ + | + | + |
MFL | +Reset | +62 |
+ Reset the device to an initial state | ++ | 0 | +
+ | + | 70 |
+ + | + | + |
F | +FeliCa communication | +72 |
+ Proxy the enframed command to a present FeliCa device | +Variable | +Variable | +
LED commands (address 08 ) |
+ |||||
L | +Reset | +10 |
+ + | + | + |
+ | Set timeout | +11 |
+ + | + | + |
+ | Set timeout response | +14 |
+ + | + | + |
L | +Set LED colour | +82 |
+ + | + | + |
+ | Set LED count | +86 |
+ + | + | + |
L | +Get board info | +f0 |
+ + | + | + |
+ | Get board status | +f1 |
+ + | + | + |
+ | Get firmware sum | +f2 |
+ + | + | + |
+ | Get protocol version | +f3 |
+ + | + | + |
+ | Bootloader | +fd |
+ + | + | + |
JVS is a communication standard designed for I/O devices in arcade macines. It typically operates over RS485 serial, + however the framing format can and sometimes is used outside of this context.
+This page documents the canonical JVS structure. Some devices, notably the {{ part("838-14971")|safe }}, use a slight + variant on the format. The differences between the two formats are document here. +
+ +Every packet sent begins with the SYNC byte, 0xe0
. Read buffers should be continually
+ flushed until this
+ byte is observed.
As such, 0xe0
is reserved, and is escaped. A byte is escaped using MARK, 0xd0
,
+ followed by
+ the byte's value subtract one. While any byte can be escaped, the only two that require escaping are
+ SYNC and MARK, escaped as D0 DF
and D0 CF
respectively. All
+ operations on packets, such as checksums and length calculation, are performed on the unescaped packet.
+
E0h | +Dest | +n | +D0 | +D1 | +D2 | +... | +Dn-2 | +SUM | +
E0h | +Dest | +n | +Status | +D0 | +D1 | +D2 | +... | +Dn-3 | +SUM | +
SUM is calculated by summing all bytes in the packet, excluding SYNC and SUM
+ itself. n
indicates the number of bytes succeeding itself. Due to the existance of the checksum,
+ n=0
is nonsensical.
+
A request packet may contain multiple commands within it. D0
always contains the first
+ command. It is followed by m
bytes of data, typically a constant number per command but not always (see
+ the command reference), at which point either we have consumed n-1
bytes and the next byte is
+ SUM, or the next byte is another command and we repeat.
+
CMD0 | +D0,0 | +D0,1 | +... | +CMD1 | +D1,0 | +D1,1 | +... | +CMD2 | +D2,0 | +D2,1 | +... | +SUM | +
Response packets are structured similarly, however the CMD byte is not present, instead relying on the + response to be ordered exactly the same as the request. The data of each command is preceeded by a report code, + indicating that individual command's status. The below diagram also includes the entire-packet status byte too for + clarity.
+Status | +Report0 | +D0,0 | +D0,1 | +... | +Report1 | +D1,0 | +D1,1 | +... | +Report2 | +D2,0 | +D2,1 | +... | +SUM | +
I may document these at some point in the future, but honestly the translated reference linked at the top of this page does a + great job.
{% endblock %} \ No newline at end of file