flat assembler
Message board for the users of flat assembler.
Index
> Compiler Internals > FASMW.ASM |
Author |
|
Tyler 07 Jun 2010, 23:30
Maybe it was to make for easy maintaining/expanding. Maybe vestigial structures Tomasz never calls, but forgot to delete.
|
|||
07 Jun 2010, 23:30 |
|
LocoDelAssembly 07 Jun 2010, 23:35
Quote: useless! this code isn't called if "edx" is different from 0, Code: .scan_syntax: lodsb .check_character: cmp al,20h je .syntax_space cmp al,3Bh je .syntax_comment mov ah,al xlatb or al,al jz .syntax_symbol or edx,edx jnz .syntax_neutral ; THIS PART CONSUMES EDX cmp ah,27h je .syntax_string cmp ah,22h je .syntax_string The way it is now you couldn't enter .syntax_string twice. But maybe there is something more you saw that ensures that EDX is really unneeded? |
|||
07 Jun 2010, 23:35 |
|
ouadji 07 Jun 2010, 23:49
yes, but at the beginning of ". syntax_string", "edx" is always 0.
it's the condition for testing "ah," and to be able to call ". syntax_string" Code: ... or edx,edx jnz .syntax_neutral cmp ah,27h je .syntax_string ;---> edx=0 cmp ah,22h je .syntax_string ;---> edx=0 ... .syntax_string: ... edx is always 0. Quote: THIS PART CONSUMES EDX |
|||
07 Jun 2010, 23:49 |
|
LocoDelAssembly 08 Jun 2010, 01:26
Damn, sorry, I've looked the jmp points wrong and thought that the EDX reset was needed.
Still, I'll complain a little more Is your "ouadji (it's 100% ok too)" code OK? It seems to be using "jmp .scan_syntax" to take advantage of the lodsb there, but note that the original code did something different with AL and AH than the main loop code does. Removing "xor edx, edx" only from the original code is really something that could be done with no trouble. |
|||
08 Jun 2010, 01:26 |
|
bitshifter 08 Jun 2010, 02:37
The EDX is used as a flag for later.
Follow the code into .check_character |
|||
08 Jun 2010, 02:37 |
|
LocoDelAssembly 08 Jun 2010, 03:07
bitshifter wrote: The EDX is used as a flag for later. |
|||
08 Jun 2010, 03:07 |
|
bitshifter 08 Jun 2010, 03:16
It can be non-zero...
Code: .syntax_neutral: or edx,-1 ... |
|||
08 Jun 2010, 03:16 |
|
LocoDelAssembly 08 Jun 2010, 03:26
Yes, I fell into the same trap, follow the code more carefully, you'll see that it is impossible for .syntax_string to be reached with EDX != 0.
|
|||
08 Jun 2010, 03:26 |
|
revolution 08 Jun 2010, 03:28
Hehe, much ado about ...
If there is a bug then say so. Else, what are you all discussing? Code: if there is a bug then say so. else what are you all discussing? end if |
|||
08 Jun 2010, 03:28 |
|
LocoDelAssembly 08 Jun 2010, 03:34
There is no bug at all here, ouadji just proposed the removal of a redundant (but yet not buggy) instruction.
If this is left unpatched nothing wrong will happen, and if patched probably no one will be able to tell the difference without looking into the source |
|||
08 Jun 2010, 03:34 |
|
bitshifter 08 Jun 2010, 03:39
Ok, i see, upon entry its always zero anyway.
I was looking to see if it was needed upon exit thus my post... Maybe i need to get away from this screen and get some air |
|||
08 Jun 2010, 03:39 |
|
ouadji 08 Jun 2010, 11:39
Quote: Is your "ouadji (it's 100% ok too)" code OK? yes. - remove "xor edx,edx" inside, - and at the end ... "jmp .scan_syntax" directly This approach saves code (useless), and this makes the code more consistent with the general algorithm used in "proc fasm_syntax" Code: .syntax_string: mov al,3 stosb dec ecx jz .done lodsb cmp al,ah jne .syntax_string mov al,3 stosb dec ecx jz .done jmp .scan_syntax .syntax_comment: ..... |
|||
08 Jun 2010, 11:39 |
|
LocoDelAssembly 08 Jun 2010, 12:44
The code you omit that way is this:
Code: lodsb
cmp al,ah
je .syntax_string I think the code is not functionally equivalent UNLESS you know of some precondition that you are not telling us. |
|||
08 Jun 2010, 12:44 |
|
ouadji 08 Jun 2010, 15:00
Quote:
it does not matter, the scan of the current string is finished. Code: .syntax_string: mov al,3 stosb dec ecx jz .done lodsb cmp al,ah jne .syntax_string mov al,3 stosb dec ecx jz .done jmp .scan_syntax ;----->> (**) the engine is again ready to detect another string (the next one) or any other characters. Quote:
This makes the code more logical and consistent with the global algorithm. the ending code of ".syntax_string" is illogical ! (and it makes me sick !) |
|||
08 Jun 2010, 15:00 |
|
LocoDelAssembly 08 Jun 2010, 16:26
AAAH!! Now I see. Clearly a trick like this couldn't be done with a string parser, but since this is for highlighting, it doesn't matter if FASMW "thinks" that the string {'ouadji''s patch'} are two strings ({'ouadji', 's patch'}), since visually this will make no difference.
Sorry for wasting your time so many times |
|||
08 Jun 2010, 16:26 |
|
ouadji 08 Jun 2010, 16:53
Quote:
I'm used to it with you ! I am teasing you! |
|||
08 Jun 2010, 16:53 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.