===========================
Compressed Firmware in TS01
===========================

The normal (TS01) firmware for the drive includes compressed sections which
seem to be higher-level code specific to particular types of discs. There are
two firmware images:

    18e000          Loaded at boot. dest=1f77000 size=7c558

Function chain

    d1da8           Includes logging, and creates a RAM overlay for part of the decompressor
    168928          Decompression function

These take r0=src, r1=dest.

Firmware decompression is slow, even on real hardware. The decompressor can be
run directly in the shell:

%ec ((int(*)(int, int))(0xd1da9))(0x18e000, 0x1f77000)

Header:

    uint32_t    decompressed_size;      
    uint32_t    compressed_size;
    uint8_t     table_a[0x120];         // Tables processed by function 168620
    uint8_t     table_b[0x20];
    ...

Sample:

0018e000  58 c5 07 00 e9 2a 05 00 

                                  05 06 06 07 06 07 07 07   X....*..........
0018e010  06 07 07 08 08 09 08 08 07 08 08 09 09 09 09 09   ................
0018e020  07 08 08 09 08 09 08 09 06 07 08 08 08 08 08 09   ................
0018e030  06 08 08 09 08 09 09 09 07 08 09 09 09 09 09 0a   ................
0018e040  07 08 09 0a 09 0a 09 09 07 09 08 07 09 0a 08 09   ................
0018e050  06 06 07 08 08 08 08 08 09 0a 09 0a 09 0a 09 0a   ................
0018e060  09 09 09 0a 09 0a 0a 0a 07 09 09 09 09 0a 0a 0a   ................
0018e070  07 09 09 08 09 09 0a 0a 07 09 09 0a 09 0a 0a 0a   ................
0018e080  06 08 09 0a 09 0a 0a 0a 07 09 09 0a 09 0a 0a 0a   ................
0018e090  07 08 09 0a 0a 0a 0a 0a 07 09 09 0a 0a 0a 0a 0b   ................
0018e0a0  08 08 09 0a 0a 0a 0a 0b 09 0a 0a 0b 0a 0a 0a 0b   ................
0018e0b0  09 0a 09 0a 0a 0b 0a 0b 09 0a 0a 0a 0a 09 0a 0a   ................
0018e0c0  09 0a 0a 0b 0a 09 0a 0b 08 09 0a 0a 09 0b 0a 0b   ................
0018e0d0  09 09 0a 0b 0a 0b 0a 0b 07 06 08 08 09 09 0a 0b   ................
0018e0e0  09 09 09 0a 09 0a 0a 0b 06 09 09 0a 09 0a 09 08   ................
0018e0f0  07 07 07 07 07 07 07 08 06 0a 0a 0a 09 0a 0a 0a   ................
0018e100  08 0a 09 0a 09 0a 09 08 04 05 05 06 07 08 08 09   ................
0018e110  09 0a 09 0b 0a 0b 0b 0c 0c 0d 0c 0d 0d 0e 0d 0d   ................
0018e120  0d 0e 0d 0e 0e 0e 0e 0a 02 04 04 04 05 05 05 05   ................
0018e130  04 05 06 06 06 06 06 06 06 05 05 06 06 07 06 06   ................
0018e140  06 06 06 06 06 07 07 07 

                                  57 2f 89 88 27 3b 4e 2a   ........W/..';N*
0018e150  e1 6d 3e 7f a0 42 e5 18 2d a7 17 f9 f2 bb af c1   .m>..B..-.......
0018e160  af 4b fa c0 1f e2 7d 18 

                                  0e c7 f5 fd 18 0d 17 eb   .K....}.........
0018e170  fa 1f 0b bc fa 0c 69 fd c0 29 d2 7c f8 51 3f 9b   ......i..).|.Q?.
0018e180  00 86 07 3e 2f d4 01 0e ef e8 bb d7 7e bf a2 ef   ...>/.......~...
0018e190  65 fa fe 8c 40 85 14 64 0f 60 08 06 08 62 cc c7   e...@..d.`...b..
0018e1a0  ce 04 4c 08 c6 02 17 75 81 10 bc 5f a3 17 3a 2f   ..L....u..._..:/
0018e1b0  c0 65 8e 23 d1 89 36 9c 5f 47 ff 22 cf 10 0b 90   .e.#..6._G."....
0018e1c0  3e 81 a1 0f 97 f3 28 24 27 3c d1 23 4b 4f a0 a1   >.....($'<.#KO..
0018e1d0  39 50 00 9c 60 32 7d 03 32 18 27 fc 61 a1 81 83   9P..`2}.2.'.a...
0018e1e0  2f f2 8e 16 c0 70 fc 83 85 0b 5f c6 bc 72 20 06   /....p...._..r .
0018e1f0  70 81 22 66 b8 b0 af 2f 36 77 a9 40 68 a3 50 60   p."f.../6w.@h.P`
0018e200  b9 56 c0 a5 3c 8e 29 51 86 a8 04 00 cf 57 67 ae   .V..<.)Q.....Wg.
0018e210  8c 34 20 ae 5f 75 0e d7 8a 54 55 72 b8 98 86 4d   .4 ._u...TUr...M
0018e220  8d 54 27 f4 6f 04 2e 31 80 88 15 2b f5 af 13 98   .T'.o..1...+....
0018e230  4b e8 04 26 63 0c 43 00 c3 c0 0c 5f 84 29 de 21   K..&c.C...._.).!
0018e240  43 16 42 fa 38 33 5f af e8 bf 8d 26 39 4f e8 6a   C.B.83_....&9O.j
0018e250  01 8f 86 69 62 21 84 4c 09 e0 57 8b 31 7f 05 0b   ...ib!.L..W.1...
0018e260  3a 34 48 03 88 b7 a4 8d ab 6f d7 f4 3d 01 c3 39   :4H......o..=..9
0018e270  45 c5 40 28 a0 17 3c 31 9d 05 09 79 42 68 b9 70   E.@(..<1...yBh.p
0018e280  0e 20 01 a3 6e 28 5c 55 93 00 10 1c db fd 15 bd   . ..n(.U........
0018e290  20 22 87 9b 4f 9c a7 db 4f 9e 7d e7 f2 fa 0b 7d    "..O...O.}....}
0018e2a0  fc be 89 89 4c c2 b0 18 22 e0 08 6d a6 45 ca 1a   ....L..."..m.E..
0018e2b0  e4 9f 7d fc b0 20 1c 9d 18 73 2c 30 e0 0c 3e e9   ..}.. ...s,0..>.
0018e2c0  a1 ac 8c c7 ce 69 10 c6 5a 52 bc cd 7c f2 6f 2f   .....i..ZR..|.o/
0018e2d0  27 4b 05 50 50 bf 97 d0 35 48 58 0b 15 d6 ee a1   'K.PP...5HX.....
0018e2e0  8d 58 7f 4b be eb 94 2c af eb fa 26 99 82 f4 69   .X.K...,...&...i
0018e2f0  e1 82 f4 cc 04 34 0b 66 30 e6 f0 03 84 0c 0b 5e   .....4.f0......^
