flat assembler
Message board for the users of flat assembler.
Index
> Main > working with strings in FASM |
Author |
|
pelaillo 06 Sep 2004, 12:35
Give a look here:
http://board.flatassembler.net/topic.php?t=1483 |
|||
06 Sep 2004, 12:35 |
|
avcaballero 06 Sep 2004, 12:39
Can this one help you?
; Example by avcaballero org 100h ; We move 4 bytes from string01 to string02 and string03 mov cx, 4 mov si, string01 mov di, string02 rep movsb inc si inc di mov cx, 4 rep movsb ; We print string01, string02 and string03 mov ah, 9 mov dx, string01 int 21h mov dx, string02 int 21h mov dx, string03 int 21h ; We return to DOS mov ax, 4C00h int 21h ; Data string01 db 'cool-note','$' string02 rb 4 ;'cool' db '$' string03 rb 4 ;'note' db '$' |
|||
06 Sep 2004, 12:39 |
|
Fagotus 06 Sep 2004, 14:12
avcaballero, sorry - i meant that we scan this string untill we have some symbol (like _ or #, or maybe ) and we save the string before this symbol as STRING01 and the string after that symbol as STRING02.
|
|||
06 Sep 2004, 14:12 |
|
Dragontamer 06 Sep 2004, 14:34
AT runtime or compile time??
|
|||
06 Sep 2004, 14:34 |
|
avcaballero 06 Sep 2004, 14:45
Something like this?
; Example by avcaballero org 100h cld ; We look for '-' xor cx, cx mov si, string01 $_Bucle: cmp byte[si], '-' jz $_Exit inc si inc cx jmp $_Bucle $_Exit: push cx ; We move cx bytes from string01 to string02 and the rest to string03 mov si, string01 mov di, string02 rep movsb inc si inc di pop cx sub cx, lon neg cx rep movsb ; We print string01, string02 and string03 mov ah, 9 mov dx, string01 int 21h mov dx, string02 int 21h mov dx, string03 int 21h ; We return to DOS mov ax, 4C00h int 21h ; Data string01 db 'cool-notess','$' lon = $-string01 string02 rb 4 ;'cool' db '$' string03 rb 4 ;'note' db '$' |
|||
06 Sep 2004, 14:45 |
|
Foamplast 06 Sep 2004, 21:33
Code: string01 db 'cool-note', 0 string01.size = $ - string01 Code: Cld Xor Eax, Eax Mov Ecx, string01.size Mov Al, '-' ; character of interest Mov Edi, string01 Repne Scasb Jecxz .notfound Mov byte [Edi-1], 0 ; now Edi contains pointer to string03 'note' ; string01 contains 'cool' |
|||
06 Sep 2004, 21:33 |
|
Dragontamer 06 Sep 2004, 22:27
You know... He may want this during compile time, not runtime...
|
|||
06 Sep 2004, 22:27 |
|
Fagotus 07 Sep 2004, 03:32
Dragontamer - no, i meant runtime
Thanks everyone!!! i'll try it! |
|||
07 Sep 2004, 03:32 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.