Skip to content

Commit 08f264c

Browse files
committed
Improve man page
1 parent b41fd88 commit 08f264c

File tree

1 file changed

+56
-12
lines changed

1 file changed

+56
-12
lines changed

patchrom.1.txt

Lines changed: 56 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,70 @@ Description
1818
Patches a ROM file with a jump table and generates the necessary jump table
1919
index definitions.
2020

21-
Reads the symbols for _ROM_ from stdin, keeping only those listed in _CONFIG_
22-
and generates a jump table in the order of the symbols in _CONFIG_. Symbol
23-
definition assembler code is sent to stdout. The end of the _PATH_'th page of
24-
_ROM_ is populated with the jump table.
21+
The symbols for _ROM_ are read from _stdin_, and those listed in the _CONFIG_ file
22+
are used to generate a jump table. the generated jump table is written to the end
23+
of _PAGE_ in the ROM file, and an include file for use in assemblers is written to
24+
stdout.
2525

26-
Each entry in the jump table is 3 octets long and consists of the opcode for
27-
the JP instruction and the target address: 0xC3XXXX. The table grows backwards
28-
from the end of the page.
26+
Symbol Format
27+
-------------
2928

30-
The output sent to stdout consists of lines of assembler code assigning names
31-
to the indicies for the jump table: .equ METHOD 0xIIPP. _II_ represents the
32-
index and _PP_ the page for _METHOD_.
29+
The symbols must be in a rather basic format, namely the format supported by the
30+
sass assembler. It looks like this:
3331

32+
.equ sym1 0x8
33+
.equ sym2 0x10
34+
.equ sym3 0x77
35+
.equ sym4 0x7A
3436

37+
Comments are supported by a single line starting with ; and extending to the end
38+
of the line.
39+
40+
ROM Patch Format
41+
----------------
42+
43+
The ROM file is patched with a jump table at the end of the specified page. The
44+
first entry in the config file is written to the end of the page. The table
45+
consists of the z80 JP instruction repeated for each symbol. For the symbol file
46+
above, that would look something like this:
47+
48+
C3 7A 00
49+
C3 77 00
50+
C3 10 00
51+
C3 08 00 # This is the end of the Flash page
52+
53+
Generated Include Format
54+
------------------------
55+
56+
An include file will be written to stdout. Each exported symbol will have one
57+
entry in the include file, taking the form of:
58+
59+
.equ symbol_name 0xIIPP
60+
61+
Where _II_ is the __I__ndex of the function (where 0 is the end of the page), and
62+
_PP_ is the Flash __P__age it appears on.
63+
64+
Config File Format
65+
------------------
66+
67+
The config file provided must simply be a list of symbols to export. It supports
68+
arbituary whitespace at the start of each line and you may include comments
69+
starting with # and extending to the end of the line. An example may look like
70+
this:
71+
72+
# This is a comment
73+
sym1
74+
sym2
75+
sym3
76+
sym4
77+
78+
Empty lines are ignored.
3579

3680
Examples
3781
--------
3882

39-
patchrom 00.config example.rom 0x00 <00.sym >00.inc::
40-
Patch example.rom with a jump table containing symbols listed in 00.config
83+
patchrom 00.config example.rom 0x00 < 00.sym > 00.inc::
84+
Patches example.rom with a jump table containing symbols listed in 00.config
4185
and output the jump table index definitions to 00.inc
4286

4387
Authors

0 commit comments

Comments
 (0)