miaou — le blogv1.0.3

adresses.hex1

← Le code · src/amorce/adresses.hex1 · 823 lignes

# adresses.hex1 : image de l'étage 3a, l'assembleur hex2 (noms longs, positions absolues, alignement), écrite en hex1 (Mach-O, macOS ARM64).
# Construction : etiquettes.macos-arm64 < adresses.hex1 | signeur.macos-arm64 > adresses.macos-arm64.
# hex2 = hex1, plus : noms de 1 à 32 caractères (0-9 A-Z a-z _ .) pour ':', '@' et '%' ; '&a' écrit la position de a sur 4 octets
# (petit-boutiste) et '&a>b' la différence des positions de a et de b (jamais négative) ; '!N' écrit des zéros jusqu'à un multiple de N
# (N hexadécimal, puissance de deux, de 1 à 0x10000). Tout hex1 bien formé est du hex2.
# Codes de sortie : 0 fini, 1 lecture ou écriture, 2 chiffre seul, 3 nom défini deux fois, 4 nom inconnu, 5 champ invalide, 6 plein, 7 mal formé.
# Encore comptés à la main dans ce source : les champs de l'en-tête Mach-O et le remplissage jusqu'à 0x4000 (son jumeau adresses.hex2 les calcule).
 
# ---------------------------------------------------------------------------
# En-tête Mach-O (32 octets)
cf fa ed fe              # 000 magic MH_MAGIC_64
0c 00 00 01              # 004 cputype ARM64
00 00 00 00              # 008 cpusubtype ALL
02 00 00 00              # 00c filetype MH_EXECUTE
0b 00 00 00              # 010 ncmds = 11
38 02 00 00              # 014 sizeofcmds = 568
85 00 20 00              # 018 flags NOUNDEFS DYLDLINK TWOLEVEL PIE
00 00 00 00              # 01c reserved
 
# ---------------------------------------------------------------------------
# LC_SEGMENT_64 __PAGEZERO (72 octets) : 4 Gio sans accès, attrape les pointeurs nuls
19 00 00 00 48 00 00 00  # 020 cmd, cmdsize 72
5f 5f 50 41 47 45 5a 45 52 4f 00 00 00 00 00 00  # 028 "__PAGEZERO"
00 00 00 00 00 00 00 00  # 038 vmaddr 0
00 00 00 00 01 00 00 00  # 040 vmsize 0x100000000
00 00 00 00 00 00 00 00  # 048 fileoff 0
00 00 00 00 00 00 00 00  # 050 filesize 0
00 00 00 00 00 00 00 00  # 058 maxprot 0, initprot 0
00 00 00 00 00 00 00 00  # 060 nsects 0, flags 0
 
# LC_SEGMENT_64 __TEXT (152 octets, une section) : en-tête et code, lecture + exécution
19 00 00 00 98 00 00 00  # 068 cmd, cmdsize 152
5f 5f 54 45 58 54 00 00 00 00 00 00 00 00 00 00  # 070 "__TEXT"
00 00 00 00 01 00 00 00  # 080 vmaddr 0x100000000
00 40 00 00 00 00 00 00  # 088 vmsize 0x4000 (une page de 16 Kio)
00 00 00 00 00 00 00 00  # 090 fileoff 0
00 40 00 00 00 00 00 00  # 098 filesize 0x4000 (toute la page)
05 00 00 00 05 00 00 00  # 0a0 maxprot r-x, initprot r-x
01 00 00 00 00 00 00 00  # 0a8 nsects 1, flags 0
# section __text : là où vit le code
5f 5f 74 65 78 74 00 00 00 00 00 00 00 00 00 00  # 0b0 "__text"
5f 5f 54 45 58 54 00 00 00 00 00 00 00 00 00 00  # 0c0 "__TEXT"
60 02 00 00 01 00 00 00  # 0d0 addr 0x100000260
60 05 00 00 00 00 00 00  # 0d8 size 0x560 (344 instructions)
60 02 00 00 04 00 00 00  # 0e0 offset 0x260, align 2^4
00 00 00 00 00 00 00 00  # 0e8 reloff 0, nreloc 0
00 04 00 80 00 00 00 00  # 0f0 flags PURE_INSTRUCTIONS SOME_INSTRUCTIONS, reserved1
00 00 00 00 00 00 00 00  # 0f8 reserved2, reserved3
 
# LC_SEGMENT_64 __LINKEDIT (72 octets) : données de dyld et signature, lecture seule
19 00 00 00 48 00 00 00  # 100 cmd, cmdsize 72
5f 5f 4c 49 4e 4b 45 44 49 54 00 00 00 00 00 00  # 108 "__LINKEDIT"
00 40 00 00 01 00 00 00  # 118 vmaddr 0x100004000
00 40 00 00 00 00 00 00  # 120 vmsize 0x4000
00 40 00 00 00 00 00 00  # 128 fileoff 0x4000 (doit être aligné sur une page, sinon le noyau tue le processus)
60 01 00 00 00 00 00 00  # 130 filesize 0x160
01 00 00 00 01 00 00 00  # 138 maxprot r--, initprot r--
00 00 00 00 00 00 00 00  # 140 nsects 0, flags 0
 
# LC_DYLD_CHAINED_FIXUPS (16 octets) : correctifs vides, rien à lier
34 00 00 80 10 00 00 00  # 148 cmd, cmdsize 16
00 40 00 00 38 00 00 00  # 150 dataoff 0x4000, datasize 56
 
# LC_SYMTAB (24 octets) : aucun symbole
02 00 00 00 18 00 00 00  # 158 cmd, cmdsize 24
00 00 00 00 00 00 00 00  # 160 symoff 0, nsyms 0
38 40 00 00 00 00 00 00  # 168 stroff 0x4038, strsize 0
 
# LC_DYSYMTAB (80 octets) : tout à zéro
0b 00 00 00 50 00 00 00  # 170 cmd, cmdsize 80
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  # 178
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  # 188
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  # 198
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  # 1a8
00 00 00 00 00 00 00 00  # 1b8
 
# LC_LOAD_DYLINKER (32 octets) : le chargeur est /usr/lib/dyld
0e 00 00 00 20 00 00 00  # 1c0 cmd, cmdsize 32
0c 00 00 00              # 1c8 position du nom 12
2f 75 73 72 2f 6c 69 62 2f 64 79 6c 64 00  # 1cc "/usr/lib/dyld"
00 00 00 00 00 00        # 1da remplissage
 
# LC_MAIN (24 octets) : point d'entrée = début du code
28 00 00 80 18 00 00 00  # 1e0 cmd, cmdsize 24
60 02 00 00 00 00 00 00  # 1e8 entryoff 0x260
00 00 00 00 00 00 00 00  # 1f0 stacksize 0 (par défaut)
 
# LC_LOAD_DYLIB (56 octets) : libSystem, exigée par Apple, rien n'y est importé
0c 00 00 00 38 00 00 00  # 1f8 cmd, cmdsize 56
18 00 00 00 02 00 00 00  # 200 position du nom 24, timestamp 2
03 64 27 05 00 00 01 00  # 208 current_version 1319.100.3, compatibility_version 1.0.0
2f 75 73 72 2f 6c 69 62 2f 6c 69 62 53 79 73 74 65 6d 2e 42 2e 64 79 6c 69 62 00  # 210 "/usr/lib/libSystem.B.dylib"
00 00 00 00 00           # 22b remplissage
 
# LC_BUILD_VERSION (24 octets) : macOS 11.0
32 00 00 00 18 00 00 00  # 230 cmd, cmdsize 24
01 00 00 00              # 238 platform MACOS
00 00 0b 00 00 00 0b 00  # 23c minos 11.0, sdk 11.0
00 00 00 00              # 244 ntools 0
 
# LC_CODE_SIGNATURE (16 octets) : où vit la signature
1d 00 00 00 10 00 00 00  # 248 cmd, cmdsize 16
40 40 00 00 20 01 00 00  # 250 dataoff 0x4040, datasize 0x120
 
00 00 00 00 00 00 00 00  # 258 remplissage jusqu'au code
 
# ---------------------------------------------------------------------------
# Code (ARM64). Les sauts sont écrits avec un champ à zéro suivi de @étiquette : l'étage 1 calcule chaque distance.
# Étiquettes : z mise_a_zero, B boucle, h chiffre, s second, w blanc, c commentaire, C boucle_commentaire, d definir,
# r renvoi_branche, a renvoi_adresse, R renvoi, b pas_b, q pas_bcond, j champ19, A renvoi_adr, e enregistrer,
# K position, U position_ecrire, J aligner, V aligner_chiffre, 3 aligner_ajouter, 4 aligner_fin_nombre, Y aligner_nombre,
# 5 aligner_boucle, 6 aligner_fini, f fin, o resoudre, 0 resoudre_position, 1 ranger_position, y resoudre19,
# x resoudre_adr, g ranger, W ecrire, Q boucle_ecrire, X succes, E echec_lecture_ecriture, i impair, D doublon,
# I inconnue, k champ_invalide, p plein, m mal_forme, Z sortir, N lire_nom, l lire_nom_boucle, 7 nom_ajouter,
# 8 nom_attente, t nom_fini, u chercher, v chercher_suivant, H nom_nouveau, S octet_suivant, 9 lire_octet, F fin_entree.
# Registres : x19 sortie, x20 longueur de sortie, x21 octet courant, x22 table des noms (32 octets par nom),
# x23 positions (4 octets par nom, position + 1, 0 = pas encore définie), x24 renvois (16 octets chacun), x25 nombre de renvois,
# x26 nombre de noms, x27 = 1 si un chiffre haut attend, x28 ce chiffre, x29 zone de lecture (case de lecture en +0, nom courant en +8),
# x10 = 1 si un séparateur est exigé, x11 = 1 en fin d'entrée, x12 = 1 si l'octet courant attend d'être relu,
# x13 index du nom, x14 = 1 pour '%', x15 index du second nom de '&a>b' (0xffff s'il n'y en a pas), x9 retour de lire_nom.
# Renvoi (16 octets) : position (4), index du nom (2), index du second nom (2), sorte (1 : imm26, 2 : imm19, 3 : adr, 4 : position).
 
# début : zones de pile (sortie 1 Mio, noms 32 Kio, positions 4 Kio, renvois 128 Kio, lecture), registres, positions à zéro
ff ab 44 d1              # sub  sp, sp, #0x12a, lsl #12
f3 03 00 91              # mov  x19, sp
76 02 44 91              # add  x22, x19, #0x100, lsl #12
d7 22 40 91              # add  x23, x22, #0x8, lsl #12
f8 06 40 91              # add  x24, x23, #0x1, lsl #12
1d 83 40 91              # add  x29, x24, #0x20, lsl #12
14 00 80 d2              # mov  x20, #0
19 00 80 d2              # mov  x25, #0
1a 00 80 d2              # mov  x26, #0
1b 00 80 d2              # mov  x27, #0
0a 00 80 d2              # mov  x10, #0
0b 00 80 d2              # mov  x11, #0
0c 00 80 d2              # mov  x12, #0
00 00 80 d2              # mov  x0, #0
:z
ff 7a 20 b8              # str  wzr, [x23, x0, lsl #2]
00 04 00 91              # add  x0, x0, #1
1f 00 10 f1              # cmp  x0, #0x400
01 00 00 54 @z           # b.ne mise_a_zero
 
# boucle : lire un octet et le trier
:B
00 00 00 94 @S           # bl   octet_suivant
0b 00 00 b5 @f           # cbnz x11, fin
bf 8e 00 71              # cmp  w21, #0x23 ('#')
00 00 00 54 @c           # b.eq commentaire
bf ee 00 71              # cmp  w21, #0x3b (';')
00 00 00 54 @c           # b.eq commentaire
bf 82 00 71              # cmp  w21, #0x20 (' ')
00 00 00 54 @w           # b.eq blanc
bf 2a 00 71              # cmp  w21, #0xa
00 00 00 54 @w           # b.eq blanc
bf 26 00 71              # cmp  w21, #0x9
00 00 00 54 @w           # b.eq blanc
bf 36 00 71              # cmp  w21, #0xd
00 00 00 54 @w           # b.eq blanc
0a 00 00 b5 @m           # cbnz x10, mal_forme
bf ea 00 71              # cmp  w21, #0x3a (':')
00 00 00 54 @d           # b.eq definir
bf 02 01 71              # cmp  w21, #0x40 ('@')
00 00 00 54 @r           # b.eq renvoi_branche
bf 96 00 71              # cmp  w21, #0x25 ('%')
00 00 00 54 @a           # b.eq renvoi_adresse
bf 9a 00 71              # cmp  w21, #0x26 ('&')
00 00 00 54 @K           # b.eq position
bf 86 00 71              # cmp  w21, #0x21 ('!')
00 00 00 54 @J           # b.eq aligner
a0 c2 00 51              # sub  w0, w21, #0x30
1f 24 00 71              # cmp  w0, #0x9
09 00 00 54 @h           # b.ls chiffre
a0 02 1b 32              # orr  w0, w21, #0x20
00 84 01 51              # sub  w0, w0, #0x61
1f 14 00 71              # cmp  w0, #0x5
08 00 00 54 @m           # b.hi mal_forme
00 28 00 11              # add  w0, w0, #0xa
 
# chiffre : le premier chiffre attend, le second complète l'octet
:h
1b 00 00 b5 @s           # cbnz x27, second
fc 03 00 aa              # mov  x28, x0
3b 00 80 d2              # mov  x27, #0x1
00 00 00 14 @B           # b    boucle
:s
00 10 1c 0b              # add  w0, w0, w28, lsl #4
01 02 a0 d2              # mov  x1, #0x100000
9f 02 01 eb              # cmp  x20, x1
02 00 00 54 @p           # b.hs plein
60 6a 34 38              # strb w0, [x19, x20]
94 06 00 91              # add  x20, x20, #0x1
1b 00 80 d2              # mov  x27, #0
00 00 00 14 @B           # b    boucle
 
# blanc : un séparateur ; un octet ne se coupe pas en deux
:w
1b 00 00 b5 @i           # cbnz x27, impair
0a 00 80 d2              # mov  x10, #0
00 00 00 14 @B           # b    boucle
# commentaire : jusqu'à la fin de la ligne
:c
1b 00 00 b5 @i           # cbnz x27, impair
:C
00 00 00 94 @S           # bl   octet_suivant
0b 00 00 b5 @f           # cbnz x11, fin
bf 2a 00 71              # cmp  w21, #0xa
01 00 00 54 @C           # b.ne boucle_commentaire
0a 00 80 d2              # mov  x10, #0
00 00 00 14 @B           # b    boucle
 
# définir : ':' et un nom ; l'étiquette prend la position de sortie courante
:d
1b 00 00 b5 @i           # cbnz x27, impair
00 00 00 94 @N           # bl   lire_nom
e1 0a 00 8b              # add  x1, x23, x0, lsl #2
22 00 40 b9              # ldr  w2, [x1]
02 00 00 35 @D           # cbnz w2, doublon
82 06 00 11              # add  w2, w20, #0x1
22 00 00 b9              # str  w2, [x1]
2a 00 80 d2              # mov  x10, #0x1
00 00 00 14 @B           # b    boucle
 
# renvoi : '@' (branche) ou '%' (adresse) corrige les 4 octets qui viennent d'être écrits
:r
0e 00 80 d2              # mov  x14, #0
00 00 00 14 @R           # b    renvoi
:a
2e 00 80 d2              # mov  x14, #0x1
:R
1b 00 00 b5 @i           # cbnz x27, impair
00 00 00 94 @N           # bl   lire_nom
ed 03 00 aa              # mov  x13, x0
9f 12 00 f1              # cmp  x20, #0x4
03 00 00 54 @k           # b.lo champ_invalide
9f 06 40 f2              # tst  x20, #0x3
01 00 00 54 @k           # b.ne champ_invalide
81 12 00 d1              # sub  x1, x20, #0x4
62 6a 61 b8              # ldr  w2, [x19, x1]
0e 00 00 b5 @A           # cbnz x14, renvoi_adr
# '@' : b ou bl (imm26 à zéro) ?
43 10 06 12              # and  w3, w2, #0x7c000000
04 80 a2 52              # mov  w4, #0x14000000
7f 00 04 6b              # cmp  w3, w4
01 00 00 54 @b           # b.ne pas_b
43 64 00 12              # and  w3, w2, #0x3ffffff
03 00 00 35 @k           # cbnz w3, champ_invalide
25 00 80 d2              # mov  x5, #0x1
00 00 00 14 @e           # b    enregistrer
# b.cond (octet haut 0x54, bit 4 à zéro) ?
:b
43 7c 18 53              # lsr  w3, w2, #24
7f 50 01 71              # cmp  w3, #0x54
01 00 00 54 @q           # b.ne pas_bcond
43 00 1c 12              # and  w3, w2, #0x10
03 00 00 35 @k           # cbnz w3, champ_invalide
00 00 00 14 @j           # b    champ19
# cbz ou cbnz (32 ou 64 bits) ?
:q
43 14 07 12              # and  w3, w2, #0x7e000000
04 80 a6 52              # mov  w4, #0x34000000
7f 00 04 6b              # cmp  w3, w4
01 00 00 54 @k           # b.ne champ_invalide
:j
43 48 1b 12              # and  w3, w2, #0xffffe0
03 00 00 35 @k           # cbnz w3, champ_invalide
45 00 80 d2              # mov  x5, #0x2
00 00 00 14 @e           # b    enregistrer
# '%' : adr (octet haut 0x10 : op = 0 et immlo à zéro, immhi à zéro)
:A
43 7c 18 53              # lsr  w3, w2, #24
7f 40 00 71              # cmp  w3, #0x10
01 00 00 54 @k           # b.ne champ_invalide
43 48 1b 12              # and  w3, w2, #0xffffe0
03 00 00 35 @k           # cbnz w3, champ_invalide
65 00 80 d2              # mov  x5, #0x3
# enregistrer : ajouter le renvoi (8 192 au plus) ; x1 position, x13 nom, x15 second nom, x5 sorte
:e
3f 0b 40 f1              # cmp  x25, #0x2, lsl #12
02 00 00 54 @p           # b.hs plein
03 13 19 8b              # add  x3, x24, x25, lsl #4
61 00 00 b9              # str  w1, [x3]
6d 08 00 79              # strh w13, [x3, #0x4]
6f 0c 00 79              # strh w15, [x3, #0x6]
65 20 00 39              # strb w5, [x3, #0x8]
39 07 00 91              # add  x25, x25, #0x1
2a 00 80 d2              # mov  x10, #0x1
00 00 00 14 @B           # b    boucle
 
# position : '&a' ou '&a>b' écrit 4 octets à zéro, remplis à la fin par la position de a (moins celle de b)
:K
1b 00 00 b5 @i           # cbnz x27, impair
00 00 00 94 @N           # bl   lire_nom
ed 03 00 aa              # mov  x13, x0
ef ff 9f d2              # mov  x15, #0xffff
0c 00 00 b4 @U           # cbz  x12, position_ecrire
bf fa 00 71              # cmp  w21, #0x3e ('>')
01 00 00 54 @U           # b.ne position_ecrire
0c 00 80 d2              # mov  x12, #0
00 00 00 94 @N           # bl   lire_nom
ef 03 00 aa              # mov  x15, x0
:U
01 02 a0 d2              # mov  x1, #0x100000
21 10 00 d1              # sub  x1, x1, #0x4
9f 02 01 eb              # cmp  x20, x1
08 00 00 54 @p           # b.hi plein
7f 6a 34 b8              # str  wzr, [x19, x20]
e1 03 14 aa              # mov  x1, x20
94 12 00 91              # add  x20, x20, #0x4
85 00 80 d2              # mov  x5, #0x4
00 00 00 14 @e           # b    enregistrer
 
# aligner : '!N' (N hexadécimal, puissance de deux, au plus 0x10000) écrit des zéros jusqu'à un multiple de N
:J
1b 00 00 b5 @i           # cbnz x27, impair
06 00 80 d2              # mov  x6, #0
07 00 80 d2              # mov  x7, #0
:V
00 00 00 94 @S           # bl   octet_suivant
0b 00 00 b5 @Y           # cbnz x11, aligner_nombre
a0 c2 00 51              # sub  w0, w21, #0x30
1f 24 00 71              # cmp  w0, #0x9
09 00 00 54 @3           # b.ls aligner_ajouter
a0 02 1b 32              # orr  w0, w21, #0x20
00 84 01 51              # sub  w0, w0, #0x61
1f 14 00 71              # cmp  w0, #0x5
08 00 00 54 @4           # b.hi aligner_fin_nombre
00 28 00 11              # add  w0, w0, #0xa
:3
ff 14 00 f1              # cmp  x7, #0x5
02 00 00 54 @m           # b.hs mal_forme
06 10 06 8b              # add  x6, x0, x6, lsl #4
e7 04 00 91              # add  x7, x7, #0x1
00 00 00 14 @V           # b    aligner_chiffre
:4
2c 00 80 d2              # mov  x12, #0x1
:Y
07 00 00 b4 @m           # cbz  x7, mal_forme
06 00 00 b4 @k           # cbz  x6, champ_invalide
c1 04 00 d1              # sub  x1, x6, #0x1
df 00 01 ea              # tst  x6, x1
01 00 00 54 @k           # b.ne champ_invalide
21 00 a0 d2              # mov  x1, #0x10000
df 00 01 eb              # cmp  x6, x1
08 00 00 54 @k           # b.hi champ_invalide
:5
c1 04 00 d1              # sub  x1, x6, #0x1
9f 02 01 ea              # tst  x20, x1
00 00 00 54 @6           # b.eq aligner_fini
01 02 a0 d2              # mov  x1, #0x100000
9f 02 01 eb              # cmp  x20, x1
02 00 00 54 @p           # b.hs plein
7f 6a 34 38              # strb wzr, [x19, x20]
94 06 00 91              # add  x20, x20, #0x1
00 00 00 14 @5           # b    aligner_boucle
:6
2a 00 80 d2              # mov  x10, #0x1
00 00 00 14 @B           # b    boucle
 
# fin : aucun octet à moitié écrit, puis résoudre tous les renvois avant de rien écrire
:f
1b 00 00 b5 @i           # cbnz x27, impair
06 00 80 d2              # mov  x6, #0
:o
df 00 19 eb              # cmp  x6, x25
02 00 00 54 @W           # b.hs ecrire
03 13 06 8b              # add  x3, x24, x6, lsl #4
61 00 40 b9              # ldr  w1, [x3]
60 08 40 79              # ldrh w0, [x3, #0x4]
65 20 40 39              # ldrb w5, [x3, #0x8]
e2 7a 60 b8              # ldr  w2, [x23, x0, lsl #2]
02 00 00 34 @I           # cbz  w2, inconnue
42 04 00 51              # sub  w2, w2, #0x1
bf 10 00 f1              # cmp  x5, #0x4
00 00 00 54 @0           # b.eq resoudre_position
47 00 01 cb              # sub  x7, x2, x1
68 6a 61 b8              # ldr  w8, [x19, x1]
bf 0c 00 f1              # cmp  x5, #0x3
00 00 00 54 @x           # b.eq resoudre_adr
ff 04 40 f2              # tst  x7, #0x3
01 00 00 54 @k           # b.ne champ_invalide
e7 fc 42 93              # asr  x7, x7, #2
bf 04 00 f1              # cmp  x5, #0x1
01 00 00 54 @y           # b.ne resoudre19
# imm26 : -2^25 <= écart < 2^25
e9 fc 59 93              # asr  x9, x7, #25
29 05 00 91              # add  x9, x9, #0x1
3f 05 00 f1              # cmp  x9, #0x1
08 00 00 54 @k           # b.hi champ_invalide
e7 64 00 12              # and  w7, w7, #0x3ffffff
08 01 07 2a              # orr  w8, w8, w7
00 00 00 14 @g           # b    ranger
# imm19 : -2^18 <= écart < 2^18
:y
e9 fc 52 93              # asr  x9, x7, #18
29 05 00 91              # add  x9, x9, #0x1
3f 05 00 f1              # cmp  x9, #0x1
08 00 00 54 @k           # b.hi champ_invalide
e7 48 00 12              # and  w7, w7, #0x7ffff
08 15 07 2a              # orr  w8, w8, w7, lsl #5
00 00 00 14 @g           # b    ranger
# adr : -2^20 <= écart < 2^20, immlo = bits 1:0 vers 30:29, immhi = bits 20:2 vers 23:5
:x
e9 fc 54 93              # asr  x9, x7, #20
29 05 00 91              # add  x9, x9, #0x1
3f 05 00 f1              # cmp  x9, #0x1
08 00 00 54 @k           # b.hi champ_invalide
e9 04 00 12              # and  w9, w7, #0x3
08 75 09 2a              # orr  w8, w8, w9, lsl #29
e9 50 02 53              # ubfx w9, w7, #2, #19
08 15 09 2a              # orr  w8, w8, w9, lsl #5
00 00 00 14 @g           # b    ranger
# position : la position de a, moins celle de b s'il y en a une (jamais négative)
:0
60 0c 40 79              # ldrh w0, [x3, #0x6]
e4 ff 9f d2              # mov  x4, #0xffff
1f 00 04 eb              # cmp  x0, x4
00 00 00 54 @1           # b.eq ranger_position
e4 7a 60 b8              # ldr  w4, [x23, x0, lsl #2]
04 00 00 34 @I           # cbz  w4, inconnue
84 04 00 51              # sub  w4, w4, #0x1
42 00 04 eb              # subs x2, x2, x4
03 00 00 54 @k           # b.lo champ_invalide
:1
e8 03 02 2a              # mov  w8, w2
:g
68 6a 21 b8              # str  w8, [x19, x1]
c6 04 00 91              # add  x6, x6, #0x1
00 00 00 14 @o           # b    resoudre
 
# écrire : envoyer toute la sortie sur la sortie standard (les écritures peuvent être partielles)
:W
1a 00 80 d2              # mov  x26, #0
:Q
5f 03 14 eb              # cmp  x26, x20
02 00 00 54 @X           # b.hs succes
20 00 80 d2              # mov  x0, #0x1
61 02 1a 8b              # add  x1, x19, x26
82 02 1a cb              # sub  x2, x20, x26
90 00 80 d2              # mov  x16, #0x4 (écriture)
01 10 00 d4              # svc  #0x80
02 00 00 54 @E           # b.hs echec_lecture_ecriture
00 00 00 b4 @E           # cbz  x0, echec_lecture_ecriture
5a 03 00 8b              # add  x26, x26, x0
00 00 00 14 @Q           # b    boucle_ecrire
 
# sorties : 0 succès, 1 lecture/écriture, 2 chiffre seul, 3 nom en double, 4 nom inconnu, 5 champ invalide, 6 plein, 7 mal formé
:X
00 00 80 d2              # mov  x0, #0
00 00 00 14 @Z           # b    sortir
:E
20 00 80 d2              # mov  x0, #0x1
00 00 00 14 @Z           # b    sortir
:i
40 00 80 d2              # mov  x0, #0x2
00 00 00 14 @Z           # b    sortir
:D
60 00 80 d2              # mov  x0, #0x3
00 00 00 14 @Z           # b    sortir
:I
80 00 80 d2              # mov  x0, #0x4
00 00 00 14 @Z           # b    sortir
:k
a0 00 80 d2              # mov  x0, #0x5
00 00 00 14 @Z           # b    sortir
:p
c0 00 80 d2              # mov  x0, #0x6
00 00 00 14 @Z           # b    sortir
:m
e0 00 80 d2              # mov  x0, #0x7
:Z
30 00 80 d2              # mov  x16, #0x1 (sortie)
01 10 00 d4              # svc  #0x80
 
# lire_nom : lit un nom (1 à 32 caractères parmi 0-9 A-Z a-z _ .) dans la zone x29+8, le cherche ou l'ajoute ; x0 = son index.
# Le caractère qui suit le nom reste à relire (x12 = 1) ; x9 garde l'adresse de retour (lire_nom appelle octet_suivant).
:N
e9 03 1e aa              # mov  x9, x30
bf ff 00 a9              # stp  xzr, xzr, [x29, #0x8]
bf ff 01 a9              # stp  xzr, xzr, [x29, #0x18]
07 00 80 d2              # mov  x7, #0
:l
00 00 00 94 @S           # bl   octet_suivant
0b 00 00 b5 @t           # cbnz x11, nom_fini
a0 c2 00 51              # sub  w0, w21, #0x30
1f 24 00 71              # cmp  w0, #0x9
09 00 00 54 @7           # b.ls nom_ajouter
bf 7e 01 71              # cmp  w21, #0x5f ('_')
00 00 00 54 @7           # b.eq nom_ajouter
bf ba 00 71              # cmp  w21, #0x2e ('.')
00 00 00 54 @7           # b.eq nom_ajouter
a0 02 1b 32              # orr  w0, w21, #0x20
00 84 01 51              # sub  w0, w0, #0x61
1f 64 00 71              # cmp  w0, #0x19
08 00 00 54 @8           # b.hi nom_attente
:7
ff 80 00 f1              # cmp  x7, #0x20
02 00 00 54 @m           # b.hs mal_forme
a0 23 00 91              # add  x0, x29, #0x8
15 68 27 38              # strb w21, [x0, x7]
e7 04 00 91              # add  x7, x7, #0x1
00 00 00 14 @l           # b    lire_nom_boucle
:8
2c 00 80 d2              # mov  x12, #0x1
:t
07 00 00 b4 @m           # cbz  x7, mal_forme
a0 87 40 a9              # ldp  x0, x1, [x29, #0x8]
a2 8f 41 a9              # ldp  x2, x3, [x29, #0x18]
04 00 80 d2              # mov  x4, #0
e5 03 16 aa              # mov  x5, x22
:u
9f 00 1a eb              # cmp  x4, x26
02 00 00 54 @H           # b.hs nom_nouveau
a6 1c 40 a9              # ldp  x6, x7, [x5]
df 00 00 eb              # cmp  x6, x0
01 00 00 54 @v           # b.ne chercher_suivant
ff 00 01 eb              # cmp  x7, x1
01 00 00 54 @v           # b.ne chercher_suivant
a6 1c 41 a9              # ldp  x6, x7, [x5, #0x10]
df 00 02 eb              # cmp  x6, x2
01 00 00 54 @v           # b.ne chercher_suivant
ff 00 03 eb              # cmp  x7, x3
01 00 00 54 @v           # b.ne chercher_suivant
e0 03 04 aa              # mov  x0, x4
20 01 5f d6              # ret  x9
:v
84 04 00 91              # add  x4, x4, #0x1
a5 80 00 91              # add  x5, x5, #0x20
00 00 00 14 @u           # b    chercher
:H
5f 03 10 f1              # cmp  x26, #0x400
02 00 00 54 @p           # b.hs plein
a0 04 00 a9              # stp  x0, x1, [x5]
a2 0c 01 a9              # stp  x2, x3, [x5, #0x10]
e0 03 1a aa              # mov  x0, x26
5a 07 00 91              # add  x26, x26, #0x1
20 01 5f d6              # ret  x9
 
# octet_suivant : w21 = octet suivant (ou l'octet en attente), ou x11 = 1 en fin d'entrée
:S
0c 00 00 b4 @9           # cbz  x12, lire_octet
0c 00 80 d2              # mov  x12, #0
c0 03 5f d6              # ret
:9
00 00 80 d2              # mov  x0, #0
e1 03 1d aa              # mov  x1, x29
22 00 80 d2              # mov  x2, #0x1
70 00 80 d2              # mov  x16, #0x3 (lecture)
01 10 00 d4              # svc  #0x80
02 00 00 54 @E           # b.hs echec_lecture_ecriture
00 00 00 b4 @F           # cbz  x0, fin_entree
b5 03 40 39              # ldrb w21, [x29]
c0 03 5f d6              # ret
:F
2b 00 80 d2              # mov  x11, #0x1
c0 03 5f d6              # ret
 
# ---------------------------------------------------------------------------
# Zéros de 0x7c0 à 0x4000 : __LINKEDIT doit commencer sur une frontière de page de 16 Kio (225 lignes de 64 octets nuls).
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
 
# ---------------------------------------------------------------------------
# __LINKEDIT en 0x4000. Correctifs chaînés vides (56 octets) : en-tête, puis 3 segments sans correctif.
00 00 00 00 20 00 00 00  # 4000 fixups_version 0, starts_offset 32
30 00 00 00 30 00 00 00  # 4008 imports_offset 48, symbols_offset 48
00 00 00 00 01 00 00 00  # 4010 imports_count 0, imports_format 1
00 00 00 00 00 00 00 00  # 4018 symbols_format 0, remplissage
03 00 00 00 00 00 00 00  # 4020 seg_count 3, seg_info_offset[0]
00 00 00 00 00 00 00 00  # 4028 seg_info_offset[1], seg_info_offset[2]
00 00 00 00 00 00 00 00  # 4030 remplissage
00 00 00 00 00 00 00 00  # 4038 remplissage jusqu'à la signature
 
# ---------------------------------------------------------------------------
# Signature ad hoc en 0x4040 (gros-boutiste) : un SuperBlob qui contient un CodeDirectory. Cases d'empreinte à zéro : le signeur les remplit.
fa de 0c c0 00 00 01 15  # 4040 magic EMBEDDED_SIGNATURE, length 277
00 00 00 01              # 4048 count 1
00 00 00 00 00 00 00 14  # 404c type CODEDIRECTORY, offset 20
# CodeDirectory (257 octets)
fa de 0c 02 00 00 01 01  # 4054 magic CODEDIRECTORY, length 257
00 02 04 00              # 405c version 0x20400
00 02 00 02              # 4060 flags ADHOC LINKER_SIGNED
00 00 00 61 00 00 00 58  # 4064 hashOffset 97, identOffset 88
00 00 00 00 00 00 00 05  # 406c nSpecialSlots 0, nCodeSlots 5
00 00 40 40              # 4074 codeLimit 0x4040 (tout ce qui précède la signature)
20 02 00 0c              # 4078 hashSize 32, hashType SHA-256, platform 0, pageSize 2^12
00 00 00 00              # 407c spare2
00 00 00 00 00 00 00 00 00 00 00 00  # 4080 scatterOffset, teamOffset, spare3
00 00 00 00 00 00 00 00  # 408c codeLimit64
00 00 00 00 00 00 00 00  # 4094 execSegBase 0
00 00 00 00 00 00 40 00  # 409c execSegLimit 0x4000
00 00 00 00 00 00 00 01  # 40a4 execSegFlags MAIN_BINARY
61 64 72 65 73 73 65 73 00  # 40ac identifiant "adresses"
# cinq cases SHA-256 (pages 0x0000, 0x1000, 0x2000, 0x3000, 0x4000-0x403f), remplies par le signeur
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  # 40b5
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  # 40d5
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  # 40f5
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  # 4115
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  # 4135
00 00 00 00 00 00 00 00 00 00 00  # 4155 remplissage jusqu'à 0x4160 (fin du fichier)