assembly language loop

This is a discussion on assembly language loop within the Tech Board forums, part of the Community Boards category; Can anyone tell me what is wrong with this simple program, I want it to loop 5 times and add ...

  1. #1
    Registered User camel-man's Avatar
    Join Date
    Jan 2011
    Location
    Under the moon
    Posts
    611

    assembly language loop

    Can anyone tell me what is wrong with this simple program, I want it to loop 5 times and add the total amount of inputs together then output the total.


    Code:
    begin, input
    store x
    load x
    add total
    store total
    load count
    subt one
    store count
    skipcond 000
    jump begin
    output total
    halt
    x, dec 0
    count, dec 4
    one, dec 1
    total, dec 0

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,551
    So what does it do at the moment.

    Not loop at all?
    Loop, but not 5 times?
    Not input?
    Wrong sum?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User camel-man's Avatar
    Join Date
    Jan 2011
    Location
    Under the moon
    Posts
    611
    Edit never mind I got it too work, for some reason I think I had to load total before I could output it.
    Last edited by camel-man; 10-27-2011 at 07:40 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Assembly Language Help ;)
    By shrink_tubing in forum C++ Programming
    Replies: 24
    Last Post: 03-10-2011, 11:47 PM
  2. assembly language
    By spongefreddie in forum C Programming
    Replies: 15
    Last Post: 02-12-2011, 07:36 PM
  3. help in assembly language
    By ema in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 12-14-2002, 01:22 AM
  4. Assembly Language...
    By Yoshi in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 12-20-2001, 09:04 AM
  5. Assembly Language
    By Breach23 in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 10-21-2001, 11:31 AM

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