CodeGuru Forums -
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic Newsletters VB Forums Developer.com


Newest CodeGuru.com Articles:

  • Installing SQL Server 2008
  • Writing UDFs for Firebird Embedded SQL Server
  • [Updated] Shutdown Manager
  • Building Windows Azure Cloud Service Applications with Azure Storage and the Azure SDK

  • Search CodeGuru:
     



    Go Back   CodeGuru Forums > Other Programming > Assembly
    FAQ Members List Calendar Search Today's Posts Mark Forums Read

    Assembly Questions and Answers for Assembly here!

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1    
    Old December 29th, 2004, 05:23 PM
    Fatboy Fatboy is offline
    Member
     
    Join Date: Aug 2004
    Posts: 138
    Fatboy is on a distinguished road (10+)
    I'm a beginner, I was a higher level language programmer, this is a beginner question

    This is the code.................


    dosseg
    .model small
    .stack 200h
    .data
    .code

    start:
    mov ax, 0a000h
    mov es, ax

    mov ax, 100
    mov bx, 100
    mov cx, 200

    sub cx, ax
    mov di, ax
    mov dx, bx
    shl bx, 8h
    shl dx, 6h
    add dx, bx
    add di, dx

    mov al, 1
    rep stosb
    end start


    The assembler is masm32, the file name is simple.asm, and here is my problem................


    Assembling: simple.asm
    simple.asm(19) : error A2070: invalid instruction operands
    simple.asm(20) : error A2070: invalid instruction operands






    Please help, it's easy right? Thanks.
    Reply With Quote
      #2    
    Old December 30th, 2004, 07:07 AM
    NoHero's Avatar
    NoHero NoHero is offline
    Moderator
     
    Join Date: Mar 2004
    Location: (Upper-) Austria
    Posts: 2,899
    NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)
    Re: I'm a beginner, I was a higher level language programmer, this is a beginner ques

    Line 19 and 20 are these:

    Code:
    add dx, bx
    add di, dx
    But those instruction seems alright though; Is this the correct code?
    __________________
    I am not offering technical guidiance via email or IM
    Come on share your photo with us! CG members photo album!
    Use the Code Tags!
    Reply With Quote
      #3    
    Old December 30th, 2004, 09:30 AM
    Fatboy Fatboy is offline
    Member
     
    Join Date: Aug 2004
    Posts: 138
    Fatboy is on a distinguished road (10+)
    Re: I'm a beginner, I was a higher level language programmer, this is a beginner question

    Sorry, I think the assembler meant these lines:

    shl bx, 8h
    shl dx, 6h
    Reply With Quote
      #4    
    Old December 30th, 2004, 09:44 AM
    NoHero's Avatar
    NoHero NoHero is offline
    Moderator
     
    Join Date: Mar 2004
    Location: (Upper-) Austria
    Posts: 2,899
    NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)
    Re: I'm a beginner, I was a higher level language programmer, this is a beginner ques

    My assembler does not complain about your code. Have you posted the right one, because I think this code is fine.
    __________________
    I am not offering technical guidiance via email or IM
    Come on share your photo with us! CG members photo album!
    Use the Code Tags!
    Reply With Quote
      #5    
    Old December 30th, 2004, 05:03 PM
    Fatboy Fatboy is offline
    Member
     
    Join Date: Aug 2004
    Posts: 138
    Fatboy is on a distinguished road (10+)
    Re: I'm a beginner, I was a higher level language programmer, this is a beginner question

    hmmmmmm.................wait....................


    Hey NoHero, I feel like I owe you something now.
    Reply With Quote
      #6    
    Old January 1st, 2005, 08:27 AM
    NoHero's Avatar
    NoHero NoHero is offline
    Moderator
     
    Join Date: Mar 2004
    Location: (Upper-) Austria
    Posts: 2,899
    NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)
    Re: I'm a beginner, I was a higher level language programmer, this is a beginner ques

    Quote:
    Originally Posted by Fatboy
    Hey NoHero, I feel like I owe you something now.
    a good reputation?

    / kidding
    __________________
    I am not offering technical guidiance via email or IM
    Come on share your photo with us! CG members photo album!
    Use the Code Tags!
    Reply With Quote
      #7    
    Old February 19th, 2005, 11:46 AM
    SuperKoko's Avatar
    SuperKoko SuperKoko is offline
    Elite Member
    Power Poster
     
    Join Date: Feb 2005
    Location: Normandy in France
    Posts: 4,590
    SuperKoko has a brilliant future (2000+)SuperKoko has a brilliant future (2000+)SuperKoko has a brilliant future (2000+)SuperKoko has a brilliant future (2000+)SuperKoko has a brilliant future (2000+)SuperKoko has a brilliant future (2000+)SuperKoko has a brilliant future (2000+)SuperKoko has a brilliant future (2000+)SuperKoko has a brilliant future (2000+)SuperKoko has a brilliant future (2000+)SuperKoko has a brilliant future (2000+)
    Re: I'm a beginner, I was a higher level language programmer, this is a beginner ques

    Hello.

    incorrects instructions are :

    shl bx, 8h
    shl dx, 6h

    You cannot use immediate operands non equal to 1 with shl for 8086!
    Just introduce a .186 or .286 after the dosseg directive!

    I think that it would work for Turbo Assembler and maybe MASM !
    Reply With Quote
    Reply

    Bookmarks
    Go Back   CodeGuru Forums > Other Programming > Assembly


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 03:48 AM.



    Acceptable Use Policy

    internet.comMediabistrojusttechjobs.comGraphics.com

    WebMediaBrands Corporate Info


    Advertise | Newsletters | Feedback | Submit News

    Legal Notices | Licensing | Permissions | Privacy Policy


    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
    Copyright WebMediaBrands Inc. 2002-2009