data segment
table db 10 dup(?)
table1 db 'PLEASE INPUT 0-3:$'
table2 db '1:BLOCK 2:LIFT TRIANGLE 3:RIGHT TRIANGLE 0:exit$'
table3 db 'WARNING:PLEASE INPUT 0-3$'
data ends
code segment
assume cs:code
main proc far
push ds
sub ax,ax
push ax
mov ax,data
mov ds,ax
lea dx,table2
mov ah,9
int 21h
call back
t: lea dx,table1
mov ah,9
int 21h
mov ah,1
int 21h
mov bl,al
call back
cmp bl,30h
jz q
cmp bl,31h
jz n
cmp bl,32h
jz m
cmp bl,33h
jz o
lea dx,table3
mov ah,9
int 21h
call back
jmp t
n: call block
jmp t
m: call triangle
jmp t
o: call triangle1
jmp t
q: mov ax,4c00h
int 21h
main endp
block proc near
mov al,1
mov ch,1
mov bl,al
mov bh,10d
mov si,9
x: mul ch
div bh
mov dh,al
mov cl,ah
call output
inc ch
mov al,bl
sub si,1
jnz x
call back
inc bl
mov al,bl
mov ch,1
mov si,9
cmp bl,10
jnz x
ret
block endp
triangle proc near
mov al,1
mov ch,1
mov bl,al
mov bh,bl
y: mov dh,10d
mul ch
div dh
mov dh,al
mov cl,ah
call output
inc ch
mov al,bl
dec bh
jnz y
call back
inc bl
mov al,bl
mov ch,1
mov bh,bl
cmp bl,10
jnz y
ret
triangle endp
triangle1 proc near
mov al,1
mov ch,1
mov bl,al
mov bh,bl
mov dh,56
mov table,dh
z: cmp dh,0
jz w
call space
dec dh
jnz z
w: mov dh,10d
mul ch
div dh
mov dh,al
mov cl,ah
call output
inc ch
mov al,bl
dec bh
jnz w
call back
inc bl
mov al,bl
mov ch,1
mov bh,bl
sub table,7
mov dh,table
cmp bl,10
jnz z
ret
triangle1 endp
output proc near
add bl,30h
mov dl,bl
mov ah,2
int 21h
mov dl,'*'
mov ah,2
int 21h
add ch,30h
mov dl,ch
mov ah,2
int 21h
mov dl,'='
mov ah,2
int 21h
add dh,30h
mov dl,dh
mov ah,2
int 21h
add cl,30h
mov dl,cl
mov ah,2
int 21h
mov dl,' '
mov ah,2
int 21h
sub bl,30h
sub ch,30h
ret
output endp
back proc near
mov dl,0Ah
mov ah,2
int 21h
mov dl,0Dh
mov ah,2
int 21h
ret
back endp
space proc near
push dx
push ax
mov dl,' '
mov ah,2
int 21h
pop ax
pop dx
ret
space endp
code ends
end