assembly programming help

Discussion in 'Programmer's Corner' started by mitu2000, Nov 29, 2009.

  1. mitu2000

    Thread Starter New Member

    Nov 29, 2009
    2
    0
    Write a program that will move a character from left to right and then back again across the monitor of the PC a number of times as specified by the user's input. The user is to be prompted for the character to display and how many times to move it back and forth. An input of '?' and 1 would cause the '?' to move back and forth across the monitor 1 trip.

    Your program must only allow entry of numbers from 1 to 5 inclusive. Use a loop that allows an exit only if the value is greater than zero and less than six. If the user enters an illegal value you must remind him/her of the values that are allowed and re-prompt for the numeric value. You do not have to do any error checking on the character as any printable character is fine.

    Remember if you have just displayed a character the cursor will be just to the right of it. In order to display the next character you will have to erase the previous character and then display the character in the new location. The backspace character is character number 8 and a space is character number 32. Do not display a character in the 80th position as this will cause the cursor to advance to the next line. All output must be on the same line.

    You will also have to write a procedure that will slow the cursor movement across the screen. A Pentium CPU will move the cursor so fast that the user will not see it move. Your delay procedure needs to be a loop that does nothing an appropriate number of times.
    we are using intel 80 86, this how I start doing it
    .model small
    .586
    .stack 100h
    .data
    Char db '?'
    Num dw '?'
    .code
    include PCMAC.INC


    main proc
    _Begin
    CallGetChar
    CallGetNum
    CallDisplayChar
    _Exit0
    main endp

    Delay proc
    Push ecx;
    mov ecx,5000000

    CharTop:
    Nop
    Dececx
    JnzCharTop
    Popecx
    Ret

    Delay endp

    GetChar proc
    Ret

    GetChar endp
     
Loading...