flat assembler
Message board for the users of flat assembler.
Index
> Tutorials and Examples > String processing routines |
| Author |
|
|
AsmGuru62 15 Dec 2025, 13:51
Very nice looking code!
Especially, I like how you use blank lines. I do that too. |
|||
|
|
FoXx 15 Dec 2025, 14:06
AsmGuru62 wrote: Very nice looking code! Thank you Blank lines separate code into blocks. I follow certain rules in my procedures. My principle is to use registers as often as possible. This speeds up my procedures. |
|||
|
|
FoXx 15 Dec 2025, 14:32
Useful command line splitting procedure.
Applied after the call [GetCommandLine] Code: ;------------------------------------------------ ; * * * Get paramameters of string ;------------------------------------------------ proc GetParamComnandLine ; mov EDI, TableParamameters ; mov ESI, szComnandLine mov EBX, EDI .scan: lodsb cmp AL, '"' je skip cmp AL, "'" je skip dec ESI mov AL, ' ' @@: mov DL, AL mov EAX, ESI stosd @@: lodsb cmp AL, ' ' jb .end cmp AL, DL jne continue mov EDX, ESI dec ESI xor EAX, EAX mov [ESI], AL mov ESI, EDX @@: lodsb cmp AL, ' ' jb .end je continue dec ESI jmp .scan .end: mov ECX, EDI xor EAX, EAX stosd dec ESI mov [ESI], AL mov EAX, ECX sub EAX, EBX shr EAX, 2 ; count of paramameters ret endp |
|||
|
|
AsmGuru62 16 Dec 2025, 01:29
I found out the strange thing about the command line parameters.
In C language, using the double quotes preserves blanks inside of the quotes. Everyone knows that, but what is interesting --- if there is no blank between, say, parameter #2 and parameter #3 --- the parameter includes all text. Here is an example: Code: PROGRAM.EXE -param1 -param2"C:\My Files Are Here\Source.Asm"more When PROGRAM.EXE is a C program, you get the following 2 parameters (not 3 or 4): Code: -param1 -param2C:\My Files Are Here\Source.Asmmore You see? Parameters are stuck together if you have no blanks. Very interesting. And I think, it is not a bug in C. Probably done to put the flag, like "-mydir" together with actual directory name: Code: PROGRAM.EXE -mydir:"C:\My Files Are Here" |
|||
|
|
revolution 16 Dec 2025, 01:42
Quote characters are not generally considered as separators, that's what spaces are for. Quotes are used to "hide" the spaces from the tokeniser.
|
|||
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.