1. Not finding help here? Sign up for a free 30min 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!

16 Bit Assembler Vertical Bar Loop

  1. Feb 27, 2014 #1
    1. The problem statement, all variables and given/known data
    Create a program that displays a vertical bar character ‘|’ moving left to right in 79 positions across the screen, then back right to left across the screen.


    2. Relevant equations
    (16 bit Assembler)


    3. The attempt at a solution
    Code (Text):

        .model small
        .stack 100h
        .data
    bar db  8,' ','|','$'
    bar2    db  8,' ',8,8,'|','$'
            x dw 500

        .code
    bars    proc
        mov     AX, @data
        mov     ds, AX

        mov     dl,'|' 
        mov ah,2h
        int 21h

        mov cl,79

        again:

        mov ah,9h
        lea     dx,bar
        int 21h

        call    waste
        dec cl
        Jnz again

        mov ah,9h
        lea     dx,bar2
        int 21h

        call    waste
        dec cl
        Jnz again

    bars    endp
        waste   proc

        push    ax
        push    bx
        push    cx
        push    dx

        again2:

        mov cx,79
       
        again3:

        mov ax,79
        mul x
        dec cx
        jnz again3
        dec ax
        jnz again2
       
        pop dx
        pop     cx
        pop bx
        pop     ax

        ret
    waste   endp
        end     waste
        end     bars
     
  2. jcsd
  3. Feb 27, 2014 #2
    So "waste" just wastes time.
    You do have a bug. Your loop for reversing the direction goes to "again" instead of the top of the second "mov ah,9h".
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: 16 Bit Assembler Vertical Bar Loop
Loading...