Sponsored Links

Results 1 to 7 of 7

Thread: Cs401

  1. #1


    Sponsored Links1

    Write an assembly language Program that Compare two arrays of 10 elements. Arrays are given below

    Sponsored Links

    Array1: 10 15 20 25 30 35 40 45 50 55
    Array2: 15 10 20 35 40 30 55 50 25 45

    You have to compare the Array 2 element one by one with array1. Once the matching element found then compare the 2nd element of array 2 with array one and so on until the whole elements of array 2 are compared.

    Due Date: 10-05-2010

  2. #2
    Kindly help me plzzz!

  3. #3
    Senior Member Awais's Avatar
    Join Date
    May 2010
    hey kindly check this out i have no idea about this but it might help u..

    I'd like to know what the exact phrasing of the question was.

    It looks to me like they want you to sort the arrays first, in which case the two lists will agree.
    (Array2 is a jumbled up version of array1.)

    First, you need to specify which assembly language. I'm going to assume x86.
    Then, you need to specify which assembler you're using: TASM? MASM? GASM? I'm going to assume TASM.
    Then, you need to specify whether it is going to be a .COM file, a .EXE file, or a function. I'm going to assume a function called CompareArrays, and the arrays are FIXED, not passed into the function.
    Then, you need to specify the target. 32-bit? 16-bit? I'm going to assume 32-bit.
    Then, you need to know whether the arrays are arrays of bytes? Words? DoubleWords? I'm going to assume bytes.
    Then, you have to say what to do when you FIND the element in Array2. I'm going to assume that you put the index of the element found in Array2 (starting from 0) in a third 10-element array called Result. If it's not found, then the element is -1.

    Array1 DB 10,15,20,25,30,35,40,45,50,55
    NumArray1 EQU $-Array1
    Array2 DB 15,10,20,35,40,30,55,50,25,45
    NumArray2 EQU $-Array2
    Result DB NumArray1 DUP (-1) ; Pre-initialise to -1 (not found)

    CompareArrays PROC

    CLD ; Search forwards
    MOV CH,OFFSET NumArray1 ; Number of elements to search
    MOV EBX,OFFSET Result ; Point to Result
    MOV ESI,OFFSET Array1 ; Point to first element of Array1

    LODSB ; Get first number from ESI into AL
    MOV CL,OFFSET NumArray2 ; Number of elements to compare
    MOV AH,CL ; Save this away
    MOV EDI,OFFSET Array2 ; Compare in Array2

    REPNE SCASB ; Scan through array while NOT equal
    JNE SHORT NextCompare ; Not found, so skip (already at -1)
    SUB AH,CL ; Subtract from original number
    DEC AH ; ...less one more for last compare
    MOV [EBX],AH ; Save away into Result

    INC EBX ; Point to next Result
    DEC CH ; One less to compare
    JNZ CompareLoop

    CompareArrays ENDP
    25 years of x86 assembler programming.

    Please note, I haven't tested (or even assembled!) this - but you should get the idea.

  4. #4
    thanx....its a great help...well v r using NASM instead of TASM so there will a lil bit difference in d output i guess....also v have 2 upload d assignment in .doc format......kindly guide me 4 d same....

  5. #5
    Senior Member Awais's Avatar
    Join Date
    May 2010
    well i dnt have any idea regarding to this i mean what we have to do in the changes in the .doc format..
    Can u simply copy this and paste it in the doc file or u have to do the changes??
    i just find the solution for u so that il could help u to submit ur assignment. Does the solution works for u???

  6. #6
    yeah it works....well i have just submitted it in .doc format.....thanx 4 such gr8 help!

  7. #7
    Senior Member Guru's Avatar
    Join Date
    May 2010
    well just have fun and also stay here we will provide u everything that we can to help u all okay
    take care

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. cs401
    By zaree in forum cs401
    Replies: 9
    Last Post: 11-28-2012, 09:12 PM
  2. CS401 assignment no 4
    By moon13 in forum Mcs
    Replies: 11
    Last Post: 06-24-2011, 10:39 PM
  3. cs401 1st quize
    By msmunirm1 in forum MCQ's & Quiz Discussion
    Replies: 0
    Last Post: 04-23-2011, 02:44 AM
  4. Cs401-assignment no: 05
    By Anya in forum Get Solution In 24 Hour
    Replies: 3
    Last Post: 02-01-2011, 03:17 PM
  5. CS401 Assignment # 3
    By Anya in forum Get Solution In 24 Hour
    Replies: 6
    Last Post: 05-26-2010, 04:44 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
-: Vuhelp Disclaimer :-
None of the files shown here are hosted or transmitted by this server. The links are provided solely by this site's users. The administrator's or staff of Vuhelp.net cannot be held responsible for what its users post, or any other actions of its users. You may not use this site to distribute or download any material when you do not have the legal rights to do so. It is your own responsibility to adhere to these terms. If you have any doubts about legality of content or you have any suspicions, feel free to contact us.
Online Education | JhelumSoft