Skip to content

ZD2 ELF Dissection

mungewell edited this page Jan 10, 2023 · 8 revisions

ZD2 ELF Dissection

The ZD2 file contains a few sections, one of which is the CODE that actually runs on the pedal. That CODE is actually an ELF binary and can be inspected with standard tools.

The ELF contains a number of 'sections', which we will explain below.

$ python3 decode_effect.py -c ZNR.ZD2.code ZNR.ZD2
$ objdump -t ZNR.ZD2.code

ZNR.ZD2.code:     file format elf32-little

SYMBOL TABLE:
00000000 l    d  .audio	00000000 .audio
00000000 l    d  .text	00000000 .text
00000000 l    d  .stack	00000000 .stack
00000000 l    d  .args	00000000 .args
00000000 l    d  .neardata	00000000 .neardata
00000000 l    d  .rodata	00000000 .rodata
00000000 l    d  .bss	00000000 .bss
00000000 l    d  .text	00000000 .text
00000000 l    d  .cinit	00000000 .cinit
00000000 l    d  .cio	00000000 .cio
80000000 l    d  .const	00000000 .const
00000000 l    d  .data	00000000 .data
...

.const section

The .const section contains 'constant' values, data that will be used by the effect. We have already identified a few.

Effect parameter table

Each effect has a table of what parameters are used to control it, this is nominally the same name as the effect and located at the start of the .const section (although that is not true for every effect).

0000000 l     O .const	00000150 .hidden ZNR

Most parameters are linear range of numbers, however some are arbitrary or a combination of numbers followed by 'note lengths'. The parameters in this table are 'raw' values, they are not corrected with an offset for minimal value.

ICEDLY3S.ZD2 : INTVL parameter: -OCT, -11->-1, -0.5, -0.25, 0, 0.25, 0.5, 1->11, OCT, OCT+5, 2-OCT (31 total). Default is 'OCT'

00000580  49 4e 54 56 4c 00 00 00  00 00 00 00 1e 00 00 00  |INTVL...........|
                                               ^^ ^^ ^^ ^^ 'raw' max 0x001e = 30
                                   ^^ ^^ ^^ ^^ 'raw' min = 0
00000590  1c 00 00 00 00 00 00 00  00 00 00 00 74 17 00 00  |............t...|
          ^^ ^^ ^^ ^^ 'raw' default 0x001c = 28 => "OCT"
000005a0  00 00 00 00 60 22 00 00  00 00 00 00 00 00 00 00  |....`"..........|
000005b0  00 00 00 00 00 00 00 00  

ICEDLY3S.ZD2 : Time parameter: 60-980ms, followed by some 12 different note settings. Default is 'note-dot'.

000005b0                           54 69 6d 65 00 00 00 00  |........Time....|
000005c0  00 00 00 00 a3 03 00 00  a0 03 00 00 00 00 00 00  |................|
                                               ^^ ^^ ^^ ^^ correction table?
                                   ^^ ^^ ^^ ^^ 'raw' default 0x03a0 = 928 (offset +60?)
                      ^^ ^^ ^^ ^^ 'raw' max 0x03a3 = 931
          ^^ ^^ ^^ ^^ 'raw' min
000005d0  98 03 00 00 34 19 00 00  00 00 00 00 b4 22 00 00  |....4........"..|
                      ^^ ^^ ^^ ^^ 0x1934 = 6452?
          ^^ ^^ ^^ ^^ 0x0398 = 920, reference to correction table?
000005e0  00 00 00 00 00 00 00 00  28 00 00 00 00 00 00 00  |........(.......|

ICEDLY3S.ZD2 : FB parameter: simply 0-100...

000005f0  46 2e 42 00 00 00 00 00  00 00 00 00 64 00 00 00  |F.B.........d...|
                                               ^^ ^^ ^^ ^^ 'raw' max 0x64 = 100
                                   ^^ ^^ ^^ ^^ 'raw' min 0
00000600  2e 00 00 00 00 00 00 00  00 00 00 00 10 1c 00 00  |................|
                      ^^ ^^ ^^ ^^  ^^ ^^ ^^ ^^ All 0's => no correction table?
          ^^ ^^ ^^ ^^ raw default 0x2e = 46
00000610  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000620  00 00 00 00 00 00 00 00                           |........Mix.....|

There is also a Coe symbol, named according to Name and Group of the effect. Purpose is unknown, possibly defines the audio characteristics of the effect (ie stereo in, stereo out).

800002dc l     O .const	00000048 .hidden _Fx_DYN_ZNR_Coe

Further there are sometime tables for specific parameters. The encoding is not yet know, but likely to be when parameter is not just a number (for example note lengths in semitones/beats).

80000448 l     O .const	0000002c .hidden ZNR_decay_rel_tbl
800004a8 l     O .const	0000002c .hidden ZNR_sense_tbl
80000478 l     O .const	0000002c .hidden ZNR_gate_depth_tbl
80000418 l     O .const	0000002c .hidden ZNR_DEPTH_offset_tbl

Effect Images

The 'device icon' is contained within the symbols effectTypeImageInfo and picTotalDisplay_ZNR, the former defines it's size (and presumably other parameters) and the later stores the pixel data. The later is nominally named as per effect, and may have a leading _ underscore.

80000150 l     O .const	00000130 .hidden effectTypeImageInfo
80000280 l     O .const	0000005c .hidden picTotalDisplay_ZNR

Width and height... for the G1Four the icon is 23x30. The pixels in ELF are rotated, presumably as that's how the LCD is memory mapped.

00000150  17 00 00 00 1e 00 00 00  80 02 00 80 14 00 00 00  |................|
                      ^^ ^^ ^^ ^^ height
          ^^ ^^ ^^ ^^ width
00000160  0a 00 00 00 d8 04 00 80  18 00 00 00 16 00 00 00  |................|
00000170  28 03 00 80 00 00 00 00  00 00 00 00 00 00 00 00  |(...............|

There are sometimes smaller image sections, for containing the icons used for each/some parameters (ie within the effect's controls). Guessing that these are 2 stripes, and therefore 28 (0x1C) pixels wide.

80000370 l     O .const	00000038 .hidden _PrmPic_DETCT
800003a8 l     O .const	00000036 .hidden _PrmPic_Depth
800003e0 l     O .const	00000036 .hidden _PrmPic_THRSH

We have implement a crude tool for extracting the 'device icon'.

$ bash extract_device_icon.sh ZNR.ZD2

icon

Clone this wiki locally