TASM/turbo assambly

This is a discussion on TASM/turbo assambly within the Tech Board forums, part of the Community Boards category; I had to write program which finds all negative elements in columns and calculates their average values and i had ...

  1. #1
    Registered User
    Join Date
    Dec 2011
    Posts
    1

    TASM/turbo assambly

    I had to write program which finds all negative elements in columns and calculates their average values and i had to do this with index addressing method. My code below:
    Code:
    .model tiny
    .code
    .startup
               Org 100h
               Jmp Short Start
    Vector     Dw  2, -7, -1, 16, -15
    N          Equ 5
    
    
    Start:
     
               Xor Bx, Bx
               Xor Dx, Dx
               Xor Si, Si
               Mov Cx, N
               Dec Cx
    S:
               Mov Ax, Vector[Bx]   
               Add Bx, 2
               Cmp Ax, 0
               Jge _next
               Inc Si
               Add Dx, Ax
               
    _next:     
               Dec Cx
               Loop S
    
    
    AVG:
               Mov Ax, Dx
               Cwd
               Idiv Si
    Could someone help me fix my errors? I would be very thankful.

  2. #2
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,183
    What errors?

  3. #3
    Epy
    Epy is offline
    Fortran lover Epy's Avatar
    Join Date
    Sep 2009
    Location
    California, USA
    Posts
    999
    Not to hijack the thread, but TASM is very outdated...might want to learn The Netwide Assembler: NASM instead. It's cross-platform and will write 16, 32, and 64 bit programs.

  4. #4
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,274
    What the heck is with these two lines:

    Code:
    Cmp Ax, 0
    Jge _next
    You're skipping all non-negative values? Why is this comparison even here?
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How do I setup tasm with borland?
    By lox in forum C Programming
    Replies: 6
    Last Post: 07-11-2005, 10:44 PM
  2. TASM assembler
    By Lurker in forum A Brief History of Cprogramming.com
    Replies: 6
    Last Post: 11-11-2003, 03:52 PM
  3. debugger goes straight to dis-assambly
    By phantom in forum C++ Programming
    Replies: 3
    Last Post: 02-01-2003, 03:15 AM
  4. tasm board
    By Brian in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 12-01-2002, 03:08 PM
  5. Where can I get Turbo C++ 3.0?
    By Unregistered in forum A Brief History of Cprogramming.com
    Replies: 22
    Last Post: 06-14-2002, 01:36 PM

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