flat assembler
Message board for the users of flat assembler.
Index
> DOS > append '$' to dx... How To Do? |
Author |
|
gunblade 23 Jan 2005, 01:03
too lazy to look up the table of DOS interrupts to see what your code is doing.. but if your wanting to add a char to the end of a string, its easy (as long as that string is ended by a 0 (0x00)), or you know the length of it.
just calcutate the length of the string, then mov the char into the buffer+len.. basic example: Code: xor edx, edx cmp byte [buffer+edx], 0 je @f inc edx jmp @b @@: ;edx now contains length of string mov byte [buffer+edx], '$' mov byte [buffer+edx+1], '0' ;only if you need... buffer rb 512 (im sure theres a better length-counting technique.. i'd like to know, if anyone else knows |
|||
23 Jan 2005, 01:03 |
|
cr4ck3r 23 Jan 2005, 06:59
Here you go you can use this
Code: mov ecx,labelend-labelbegin mov byte [labelbegin+ecx],'$' mov ah,9 mov dx,labelbegin int 21h xor ax,ax int 16h ret labelbegin: db 'This is a string' labelend: Regards. |
|||
23 Jan 2005, 06:59 |
|
gumletis 23 Jan 2005, 09:52
hmm, cr4ck3r thats is impossible to do with my code, becuase its one there allready are in a register - not a buffer, ´but i tryed what gumblade sayed... Just can't get it to work, here's my code
Code: org 100h mov ah,1Ah mov dx,find int 21h mov dx,type mov cx,3fh mov ah,0eh int 21h mov dx,[find+30] xor edx,edx cmp byte[buffer+edx],0 je @f ; this i don't know whats means? inc edx jmp @b ; and this i also don't understand @@: mov byte[dx+edx],'$' mov byte[dx+edx+1],0 mov dx,word[find+30] mov [dx+10],byte '$' mov ah,09h int 21h xor ah,ah int 16h RET type db 'c:\winnt\*.exe',0 find rb 128 _________________ LOOOL |
|||
23 Jan 2005, 09:52 |
|
gumletis 23 Jan 2005, 11:40
i've tryed some there was't so hard to make, but still wont work, please help.
Code: org 100h mov ah,01h star: int 21h cmp al,'s' je endy mov byte[path+len],al jmp star endy: mov dx,endl mov ah,9 int 21h mov byte[path+len],'$' mov dx,path mov ah,9 int 21h mov ah,0 int 16h RET path rb 100 len db $-path,0 endl db 13,10,'$',0 _________________ LOOOL |
|||
23 Jan 2005, 11:40 |
|
gumletis 24 Jan 2005, 13:39
i found a way how to do that, just get the size of it, and so append it to it, some like this(not with my home computer, so just write this, donno if its works)
Code: getsize equ call size move eax,type getsize mov byte[type+eax],'$' ... .. .. .. .. RET size: mov ebp,0 star333: inc esi cmp byte[eax+ebpi],0 jne star333 RET donno if its works, i haven't got a compiler on this computer.... _________________ LOOOL |
|||
24 Jan 2005, 13:39 |
|
Matrix 02 Feb 2005, 20:28
gunblade wrote: too lazy to look up the table of DOS interrupts to see what your code is doing.. but if your wanting to add a char to the end of a string, its easy (as long as that string is ended by a 0 (0x00)), or you know the length of it. hello, i'd recommend you these algos to determine the null trerminated string len, then do mov byte [ebx],'$' |
|||
02 Feb 2005, 20:28 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.