.model small
.stack 100h
.data
.code
mov ax, 3 ; 80x25, clear screen
int 10h

ulit: mov ax, 0600h ; print top bar with dark green
mov bh, 20h
mov cl,39
mov ch,2
mov dl,42
mov dh,10
int 10h

mov ax, 0600h ; print right bar with dark yellow
mov bh, 60h
mov cl,43
mov ch,11
mov dl,57
mov dh,12
int 10h

mov ax, 0600h ; print bottom bar with light green
mov bh, 0A0h
mov cl,39
mov ch,13
mov dl,42
mov dh,21
int 10h

mov ax, 0600h ; print right bar with dark yellow
mov bh, 0E0h
mov cl,25
mov ch,11
mov dl,38
mov dh,12
int 10h

mov ah,7 ; get a key
int 21h
cmp al, 'r'; for 'right'
je clockwise ; turns the cross clockwise by changing the color of the bars
cmp al, 'l'; for 'left'
je counterclockwise ; turns the cross counterclockwise by changing the colors of the bars
cmp al, 1Bh ; check for ESC
je exit ; exit program if ESC is pressed
jmp ulit ; jump to ulit if none of the three are pressed

clockwise: ; to make the cross appear to rotate clockwise, we just change the colors of the bars

mov ax, 0600h ; this time, the light yellow is on top
mov bh, 0E0h; 0E0 is light yellow, you may type color/? in the command prompt for reference
mov cl,39
mov ch,2
mov dl,42
mov dh,10
int 10h
mov ax, 0600h ; dark green is on the right
mov bh, 20h
mov cl,43
mov ch,11
mov dl,57
mov dh,12
int 10h;

mov ax, 0600h ;dark yellow at the bottom
mov bh, 60h
mov cl,39
mov ch,13
mov dl,42
mov dh,21
int 10h

mov ax, 0600h ; and light green on the left
mov bh, 0A0h
mov cl,25
mov ch,11
mov dl,38
mov dh,12
int 10h
jmp ulit
counterclockwise: ;for counterclockwise, we just do the opposite
mov ax, 0600h ; dark yellow
mov bh, 60h
mov cl,39
mov ch,2
mov dl,42
mov dh,10
int 10h
mov ax, 0600h ; light green
mov bh, 0A0h
mov cl,43
mov ch,11
mov dl,57
mov dh,12
int 10h

mov ax, 0600h ;light yellow
mov bh, 0E0h
mov cl,39
mov ch,13
mov dl,42
mov dh,21
int 10h

mov ax, 0600h ; dark green
mov bh, 20h
mov cl,25
mov ch,11
mov dl,38
mov dh,12
int 10h


exit: ; end program
mov ah, 4ch
int 21h
end





problem is:
everytime i press 'r', the cross rotates clockwise. but when i press 'l', the cross rotates counterclockwise and press ESC, the program exits .When i press any other key, nothing should happen.

but my current program right now , its not workign that way.
Posted on 2010-11-18 22:26:03 by HeavenAbove
HeavenAbove,

counterclockwise branch falls through to int21/4C. Was that intended?
Posted on 2010-11-19 12:09:18 by baldr
i can't get what u mean .

anyways i already finished it , thanks

close.
Posted on 2010-11-22 19:39:55 by HeavenAbove