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!

Homework Help: 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
    bar db  8,' ','|','$'
    bar2    db  8,' ',8,8,'|','$'
            x dw 500

    bars    proc
        mov     AX, @data
        mov     ds, AX

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

        mov cl,79


        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


        mov cx,79

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

    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".
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted