Forums: » Register « |  Free Tools |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |

New Free Tools on Dev Shed!

#1
October 5th, 2012, 12:37 AM
 starofstar
Registered User

Join Date: Oct 2012
Posts: 2
Time spent in forums: 11 m 40 sec
Reputation 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
October 5th, 2012, 12:41 PM
 OmegaZero
Contributing User

Join Date: May 2007
Posts: 756
Time spent in forums: 3 Weeks 6 Days 8 h 10 m 8 sec
Reputation Power: 928
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);

 Viewing: Dev Shed Forums > Programming Languages - More > Other Programming Languages > Small Assembler programming help