1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

TASM/turbo assambly

  1. Dec 11, 2011 #1
    1. The problem statement, all variables and given/known data
    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 (Text):

    .model tiny
               Org 100h
               Jmp Short Start
    Vector     Dw  2, -7, -1, 16, -15
    N          Equ 5


               Xor Bx, Bx
               Xor Dx, Dx
               Xor Si, Si
               Mov Cx, N
               Dec Cx
               Mov Ax, Vector[Bx]  
               Add Bx, 2
               Cmp Ax, 0
               Jge _next
               Inc Si
               Add Dx, Ax
               Dec Cx
               Loop S

               Mov Ax, Dx
               Idiv Si

    .exit 0
    Could someone help me fixing my errors? I would be very thankful.
  2. jcsd
  3. Dec 11, 2011 #2


    User Avatar
    Homework Helper

    Note that loop decrements cx. You don't need the dec cx instruction. Is there a debugger you can use to step through the code one instruction at a time so you can monitor the registers (these also let you view chunks of memory)?
  4. Dec 11, 2011 #3


    Staff: Mentor

    The name of the debugger is tdebug.exe that comes with Turbo. It's pretty easy to use. If you're writing assembly code, it's pretty much essential to use a debugger.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Threads - TASM turbo assambly Date
Turbo Assembler Problem Jul 3, 2012
Pc based digital clock via parallel port using assembly language in tasm Oct 15, 2011