1 ; vim
: set filetype
=fasm foldmethod
=marker commentstring
=;
%s colorcolumn
=101 :
3 ; we don
't follow specs: we will try to go best effort in blk_primitive parsing
4 ; scratch: rax rcx r11 r9
7 define p_finish r12 ; in
8 ;define flags r15 ; in/out
13 je blob.hdr.parse.return_from_blk
14 varint_load r11, p ; key
15 mov r9, r11; = copy key
16 shr r11, 3 ; = field num
17 ; print strings we are aware of
18 cmp r11, 4 ; field num = HeaderBlock.required_features (see specs) ?
20 cmp r11, 5 ; field num = HeaderBlock.optional_features (see specs) ?
22 cmp r11, 16 ; field num = HeaderBlock.writingprogram (see specs) ?
24 cmp r11, 17 ; field num = HeaderBlock.source (see specs) ?
26 cmp r11, 34 ; field num = HeaderBlock.osmosis_replication_base_url (see specs) ?
28 and r9, 111b ; = field type
29 TRACE 'PBF
:BLK
:HDR
:MSG
:FIELD
%lu OF TYPE
%lu', r11, r9
34 varint_load r9, p ; = str_sz
35 TRACE 'PBF
:BLK
:HDR
:MSG
:STRING
%lu of VALUE
"%.*s"', r11, r9, p
36 add p, r9 ; skip the str val
38 ;---------------------------------------------------------------------------------------------------