#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    2
    Rep Power
    0

    Small Assembler programming help


    //Program
    org 100

    mov ax, 2 ;initialize bx to 2(stores successive even numbers)
    mov bx, 2 ;initialize ax(stores sum of successive even numbers)
    mov cx, 3 ;initialize cx to 3 or 5 (number of times loop body executes)

    ;Execute the loop body cx times
    jmp WHILE_CONDITION

    WHILE_TOP:



    WHILE_CONDITION:
    cmp ??
    j? WHILE_TOP
    hlt


    Instructions:

    One number at at time starting with 2, generate successive even integers in bx.
    Total the N even integers in ax.
    If cx is assigned 3, ax should end as 12 (which is C in hex)
    If cx is assigned 5, ax should end as 30 (that is 1E in hex).
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    May 2007
    Posts
    765
    Rep Power
    929
    As the sticky at the top of the forum says, we won't do your homework for you. If you show some effort and ask a question we can help point you in the right direction.

    If you don't know where to start, this page may be helpful: So, You Need to Write a Program but Don't Know How to Start

    To increase the chance of getting help, post your current attempt and any error messages you get. If your program doesn't give the expected output, explain what you think the code should produce and post what it produces instead. If you're stuck, post what exactly you don't understand. When you post source code, paste it between [code]...[/code] tags to make it easy to read.
    sub{*{$::{$_}}{CODE}==$_[0]&& print for(%:: )}->(\&Meh);

IMN logo majestic logo threadwatch logo seochat tools logo