patch places:
1) tables.inc:
instructions:
dw instructions_1-instructions,(instructions_2-instructions_1)/(1+3) ;+
dw instructions_2-instructions,(instructions_3-instructions_2)/(2+3)
dw instructions_3-instructions,(instructions_4-instructions_3)/(3+3)
dw instructions_4-instructions,(instructions_5-instructions_4)/(4+3)
dw instructions_5-instructions,(instructions_6-instructions_5)/(5+3)
dw instructions_6-instructions,(instructions_7-instructions_6)/(6+3)
dw instructions_7-instructions,(instructions_8-instructions_7)/(7+3)
dw instructions_8-instructions,(instructions_9-instructions_8)/(8+3)
dw instructions_9-instructions,(instructions_10-instructions_9)/(9+3)
dw instructions_10-instructions,(instructions_11-instructions_10)/(10+3)
dw instructions_11-instructions,(instructions_12-instructions_11)/(11+3)
dw instructions_12-instructions,(instructions_13-instructions_12)/(12+3)
dw instructions_13-instructions,(instructions_14-instructions_13)/(13+3)
dw instructions_14-instructions,(instructions_15-instructions_14)/(14+3)
dw instructions_15-instructions,(instructions_16-instructions_15)/(15+3)
dw instructions_16-instructions,(instructions_end-instructions_16)/(16+3)
.end_header: ;+
instructions_1: ;+
instructions_2:
2) parser.inc:
get_instruction:
push esi
mov ebp,ecx
call lower_case
mov ecx,ebp
cmp cl,(instructions.end_header-instructions)/4 ; that is more flexible than direct integer value
ja no_instruction
; comparison with substruction 2 from cl is removed at all
movzx ebx,word [instructions+ecx*4-4] ; corrected to new ecx
add ebx,instructions
movzx edx,word [instructions+ecx*4-2] ; corrected to new ecx
scan_instructions:
or edx,edx
jz no_instruction
Effect:
negative: instructions table grows up for 1 element = 4 bytes
for rare errorneus case of 1 symbol instruction processing will be 3 instruction longer
positive: parser code will be more flexible and more adaptive (one less patch will be required for fasmarm addon)
for all normal instruction length cases processing will be 2 instruction faster.
In fasmarm:
ARM_find_instruction:
push esi
mov ebp,ecx
mov byte[characters+CONDITION_SEARCH_CHARACTER],CONDITION_SEARCH_CHARACTER
call lower_case
mov byte[characters+CONDITION_SEARCH_CHARACTER],0
mov ecx,ebp
cmp cl,(instructions.end_header-instructions)/4
ja .no_instruction
sub cl,1
jc .no_instruction ; this never happen cl is always nonzero - sholud be removed from code
; because get_instruction call (ARM_get_instruction & ARM_find_instruction calls as its patch respectively) gets cl value from [esp] - size of token and there is no way to create nullsize token
by analogy change symbols data_directives etc. - it takes 2 instruction faster per almost each token operated in parser state (fasm too fast, I even couldn`t test speed effect)
To be continued...