Results 1 to 5 of 5

Thread: Assembly program string loader

  1. #1
    Join Date
    Nov 2010
    Posts
    48

    Assembly program string loader

    Please someone assist me write an assembly program which loads a string in chief memory, after that do this work:
    1. Compute and exhibit the size of the chain;
    2. Exhibit the number of words;
    3. Exhibit the best word;
    4. Exhibit the number of dividers;
    5. View the most chronic characters.


    The assembly program to be urbanized has to be structured in Macros

    1. The primary step to expand must be urbanized within a solitary macro.
    2. The next step implements a macro for every action.
    3. Macros urbanized in every of the two basic steps must be called in the key program so that I find the similar program as the primary version.

    Here is my work, there is a few difficulty please assist me
    here is my code:

    Code:
    title char 
    model small 
    stack 100h 
    
    .data 
    msg1 db "donner le caractere$" 
    msg2 db "chaine vide$" 
    msg3 db "la taille de la chine est:$" 
    i dw 0 
    
    .code 
    mov ax,@data 
    mov dx,ax 
    
    mov ad,9 
    mov dx,offset msg1 
    int 2h 
    
    mov ad,1 
    int 2h 
    mov dx,ax 
    mov cx,'#' 
    
    boucle: cmp [dx],cx 
    je vide 
    inc a
    while1: mov ad,9 
    mov dx,offset msg1 
    int 2h 
    mov ad,1 
    int 2h 
    mov dx,ax 
    mov cx,'#' 
    cmp [dx],cx 
    je fin 
    inc a
    jmp while1 
    fin: jmp end1 
    vide: mov ad,9 
    mov dx,offset msg2 
    int 2h 
    end1: 
    mov ad,9 
    mov dx,offset msg3 
    int 2h 
    mov dx,i 
    mov ad,2 
    int 2h 
    
    mov ad,4ch 
    int 2h 
    end

  2. #2
    Join Date
    May 2009
    Posts
    527

    Re: Assembly program string loader

    There are quite a lot of people at my college currently finishing CSC101 who still don't be aware of the fundamental idea of loops, and a few in CSC102 still don't dig up it. I will provide you a few ideas. As your first five steps you mention, here the solution for them sequentially.
    1. That one should be simple. Read it byte by byte still you strike the final character. Only wants two registers, one with the location of the initiate of the string, and one for the counter.
    2. Once more, simple. Calculate the number of spaces that are headed and pursued by an alpha character.
    3. Read byte by byte; calculate length as in first, apart from end on a space. Save length of present word and begin location of present word.
    4. Calculating any precise characters actually have to not be a challenge.
    5. How much probable characters are there? If you only wish to calculate alpha characters, and don't mind about case, and don't look forward to more than 255 of the similar character, you can store the entire alphabet in 16 Dwords. For each other letter, in its place of adding 1, insert 16, so you find one letter in ax, and the after that in eax moved 4 left. Would engage a large number of pushing and popping.

  3. #3
    Join Date
    Apr 2009
    Posts
    488

    Re: Assembly program string loader

    I also have problem with the same code but this is not sufficient which you explain, I am a newbie programmer if you can assist me more. Please provide me the primary step as a minimum code to load the string in major memory and how to compute and exhibit the size of the chain one additional thing I cannot be aware of what is the dissimilarity between a function and a macro. What actually this macro.

  4. #4
    Join Date
    May 2009
    Posts
    539

    Re: Assembly program string loader

    I don't observe the point in writing inheritance 16 bit DOS applications in assembly. Modern OS cannot even sprint these, and even afterward, there are C and even C++ compilers. Affording to write a string library in 16 bit ASM is like annoying to shift a mound of sand from its present place to a location just a few feet left with a couple of tweezers. Assembly can be amusing to learn, but it is mostly needless. Compilers can make quicker assembly then you can, so there is actually no practical exercise for assembly these days. You cannot even make use of inline assembly in the 64 bit MSVC compiler. Inherent are far better. I suppose if you heart was place on x86 assembly, you would be superior off receiving a 32 bit compiler and making code that could as a minimum run on a modern OS.

  5. #5
    Join Date
    Apr 2009
    Posts
    569

    Re: Assembly program string loader

    I have often thought that I could do a little quicker with hand assembled code, but each time I thought I had the compiler defeated; I was also joined or left in the dust. I have perceives it occur to other people abundance of times also. There are extremely few examples in which a specialist programmer could break a modern optimizing compiler. If you are less than a professional, then it is that much fewer probable. I in fact in progress programming x86 ASM previous to me educated C or C++. Since I have been utilizing C++, the just time I make use of my information of x86 is while I debug or profile a program, which is a fine cause to know it. But I would not at all write one more program in ASM.

Similar Threads

  1. Java program to iterate a subset of a string.
    By Nadiaa in forum Software Development
    Replies: 5
    Last Post: 19-03-2012, 01:53 PM
  2. How to read string from a given text file using C# program?
    By Kasper in forum Software Development
    Replies: 5
    Last Post: 25-02-2010, 10:18 PM
  3. Replies: 4
    Last Post: 30-01-2010, 07:23 PM
  4. Program to check whether two string are equal or not
    By seema_thk in forum Software Development
    Replies: 3
    Last Post: 30-11-2009, 01:32 PM
  5. program to reverse a string in java.
    By Deepest BLUE in forum Software Development
    Replies: 3
    Last Post: 26-11-2009, 11:03 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,890,401.82930 seconds with 16 queries