ASM with MOV instruction.

This is a discussion on ASM with MOV instruction. within the Tech Board forums, part of the Community Boards category; I know that this question is VERY misplaced, but I coundn't find anywhere else to post this question. So, I ...

  1. #1
    Registered User kinghajj's Avatar
    Join Date
    Jun 2003
    Posts
    218

    ASM with MOV instruction.

    I know that this question is VERY misplaced, but I coundn't find anywhere else to post this question. So, I say now that I'm sorry.

    The question is simple: what's wrong?
    Code:
    org     100h                    ; code starts at offset 100h
    use16                           ; use 16-bit code
    
    mov     ah,09h
    mov     dx,mello
    int     21h
    mov     word [hello],word mello
    mov     dx,hello
    int     21h
    
    int     20h
    
    hello dd ?
    mello db 'Mello world!',0Dh,0Ah,24h
    I want the output to be:
    Mello, world!
    Mello, world!

    But, instead, it comes out as:
    Mello world!
    ☺ Mello world!

    I can't find out what is wrong with the second printing. I suspect that it has todo with the statement "mov word [hello],word mello"

    By the way, I'm using FASM to assemble this.

  2. #2
    Registered User Draco's Avatar
    Join Date
    Apr 2002
    Posts
    463
    Here you go, this is a message board for all kinds of ASM programming. They'll be able to answer your question easily.

    http://www.programmersheaven.com/c/M...ID=11&Setting=

  3. #3
    Registered User kinghajj's Avatar
    Join Date
    Jun 2003
    Posts
    218

    Thanks

    I've been looking for a while! Thanks

  4. #4
    Registered User Draco's Avatar
    Join Date
    Apr 2002
    Posts
    463
    No problem. A lot of the time a couple minutes on google will take you where you need, but I do realize that some things can be hard to find.

  5. #5
    Registered User
    Join Date
    Oct 2003
    Posts
    49
    Hi,
    The line
    mov dx,hello
    should be
    mov dx,[hello]

  6. #6
    Registered User kinghajj's Avatar
    Join Date
    Jun 2003
    Posts
    218

    Thanks!

    Thanks Zoidberg!

    Edit:
    for me, it was:
    mov dx,word [hello]

    but, now it works! Thanks again.

  7. #7
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    >>mov word [hello],word mello

    Moving from a memory location to another memory location in 1 instruction is also wrong.......that would account for the jibberish before the second line

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help calling function is asm
    By brietje698 in forum C++ Programming
    Replies: 24
    Last Post: 12-06-2007, 03:48 PM
  2. Inline asm
    By brietje698 in forum C++ Programming
    Replies: 5
    Last Post: 11-11-2007, 01:54 PM
  3. Getting position from game..
    By brietje698 in forum C++ Programming
    Replies: 1
    Last Post: 10-26-2007, 12:15 PM
  4. Assembly Tutorials
    By JoshR in forum A Brief History of Cprogramming.com
    Replies: 13
    Last Post: 06-11-2005, 09:56 AM
  5. My graphics library
    By stupid_mutt in forum C Programming
    Replies: 3
    Last Post: 11-26-2001, 05:05 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21