How to copy sting from command line to data segment? (.exe)

Started by vasant, April 25, 2006, 08:36:23 AM

Previous topic - Next topic

vasant


Shantanu Gadgil

You MUST MUST MUST read the rules!!!  :snooty:

Also, how about some decency while asking the question, i.e. make it a request rather than just telling people to write code for you.

There are ample amount of code examples in the masm32 package, so you can start there. Have you checked those? :tdown  :naughty:

Just show people what you have done so far in trying to achieve what you want to do, then maybe someone might be willing to help you out.

The question is a bit ambigous in itself, could you please clarify it a bit more. What I suspect is you want a readymade answer for some kind of assignment or something....so again...You MUST MUST MUST read the rules!!!   :snooty:
To ret is human, to jmp divine!

Tedd

length q bless glob and print chr oct ord q mkdir m and
print chr ord q xor x and print chr ord q q q and print chr ord uc q
map m and print chr ord q qw q and print chr ord q each le and
print chr ord q my alarm and print chr oct oct ord uc qw q for q
No snowflake in an avalanche feels responsible.

vasant

I want to genral tech for copy it.
If this borad is will no code I write code ,but real time it cannot do it because question is on code.

like...
if I ask about display char.
Someone write
   mov ah,2
   mov dl,'*'
   int 21h        <<  This is code but it don't miss rule.

Goal 's Borad is ask and answer about assembly.
If I cannot start to code to my problem, I must asking?

I know is use es segment will can use 'stosb' command store to Data segment.
But if use .Startup es segment use for arg. will cannot use 'stosb' command Store to data segment .
You can no write code but write tech.

MichaelW

The meaning of the rule is simply: we don't do homework for students. But I do recognize that it is easier for a non-English speaker to understand code, than to understand a technical description written in English.

One solution would be to replace lodsb and stosb with a mov–inc sequence. You could then use any segment register for the destination. This code assumes that ES is set to the PSP and DS to the data segment, and that SI points to the first char of the command line (81h) and DI to the first character of the destination variable in the data segment.

@@:
    mov al, es:[si]   ; get char from command line
    inc si            ; increment command line pointer
    mov [di], al      ; store in data segment (ds is default segment register)   
    inc di            ; increment data segment pointer
    cmp al, 0dh
    jne @B            ; continue until char code == 0Dh

eschew obfuscation


vasant


.model small
.data
Temp db 20 dup('$')
.code
Main    Proc
        mov ax,@data
        mov ds,ax
        lea di,Temp
.startup
        mov si,81h
L:      inc si
        mov al,es:[si]
        mov [di],al
        inc di
        cmp al,0dh
        jne L
        lea dx,temp
        mov ah,9
        int 21h
        mov ah,4ch
        int 21h
Main    Endp
        End

I run program.
Why String show not correct?
I think is char not store to Temp or can't function 9?

Gustav

Hello,

you should possibly add 2 lines (the 13 will just move the cursor to the start of the *current* row):


       mov si,81h
L:      inc si
        mov al,es:[si]
        mov [di],al
        inc di
        cmp al,0dh
        jne L
        mov al,0ah     ;added
        mov [di],al     ;added
        lea dx,temp
        mov ah,9
        int 21h