Need some help from someone who knows assembly

This is a discussion on Need some help from someone who knows assembly within the Tech Board forums, part of the Community Boards category; Can't find an assembly board....someone here must be familiar with it Real easy question. Have a project were I need ...

  1. #1
    Registered User
    Join Date
    Aug 2008
    Posts
    10

    Need some help from someone who knows assembly

    Can't find an assembly board....someone here must be familiar with it

    Real easy question. Have a project were I need to use auto incrementation and non auto incrementation.

    Is auto incrementation
    Code:
    LDAA 1,x+                 ;load to acc A the value of x and increment the address of x
    STAA 1,y+                 ;store acc A to the address of y and increment y
    SUBB #1                       ;subtract 1 from the total number of mem trans.
    bne  loop
    and manual incrementation

    Code:
    LDAA 	0,x                      	;load to accumulator A the value of x
    inx                           		;increment the address of x
    STAA 	0,y                      	;store accumulator A to the current y address
    iny                           		;increment the address of y
    SUBB 	#1                       	;subtract 1 from the total number of mem trans.
    bne  	loop
    thanks

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    22,127
    Moved to Tech board.

    So, what is your question?
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    It does look about right, but of course, with you not saying WHICH assembler you are doing this for, and me not recognizing the target processor.

    In PDP-11 you would do:
    Code:
    $1:
        mov   (r0)+, r3
        mov   r3, (r1)+
        dec    r2
        bne   $1
    Code:
    $1:
        mov   (r0), r3
        inc     r0
        mov   r3, (r1)
        inc     r1
        dec    r2
        bne   $1

    In 68K it would be:
    Code:
    $1:
        move  (a0)+, d0
        move  d0, (a1)+
        dec     d1
        bne    $1
    and
    Code:
    $1:
        move  (a0), d0
        addq   #1, a0
        move  d0, (a1)
        addq   #1, a1
        dec     d1
        bne    $1

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  4. #4
    Registered User
    Join Date
    Aug 2008
    Posts
    10
    so basically using the + is auto incrementation? and using inx, iny is not? I've run them both with the HCS12, they both work.

  5. #5
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by thestrapman View Post
    so basically using the + is auto incrementation? and using inx, iny is not? I've run them both with the HCS12, they both work.
    Ok, so WHAT is your question - you obviously have the syntax correct (or your testing isn't very thorough) if you get the right result and both versions of code works.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Learning Assembly
    By mrafcho001 in forum Tech Board
    Replies: 5
    Last Post: 03-12-2006, 05:00 PM
  2. C to assembly interface
    By Roaring_Tiger in forum C Programming
    Replies: 4
    Last Post: 02-04-2005, 03:51 PM
  3. assembly language...the best tool for game programming?
    By silk.odyssey in forum Game Programming
    Replies: 50
    Last Post: 06-22-2004, 02:11 PM
  4. True ASM vs. Fake ASM ????
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 04-02-2003, 04:28 AM
  5. C,C++,Perl,Java
    By brusli in forum C Programming
    Replies: 9
    Last Post: 12-31-2001, 03:35 AM

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