;Examole Exam Question 4

;consts:
column equ 3  ;initial column
row equ 5     ;initial row
length equ 19 ;length of top side= 13h

.model small
.stack 100h
.data
chr db 0  ;input character
initial dw 0 ;initial position that will be determoned by column and row

.code
    mov ax, @data
    mov ds, ax
    mov ax, 0b800h
    mov es, ax
    
    ;getting char from user to al
    mov ah, 01h
    int 21h
    
    mov chr, al   
    call print1
    
    mov ah, 04ch
    int 21h
    
print1:
    ;saving input char in ax
    mov al, chr

    ;delete
    mov di, 2*column+row*160    
    mov initial, di
    
    cont1:
    mov cx, length
    
    ;drawing upper side
	drawline:
        mov es:[di], al
        add di, 2
        loop drawline
        
    mov bx, di
    sub bx, 2
    mov di, initial
        
    mov cx, length
    shr cx, 1
    
    ;drawing rest of thw triangle
	draw_down:
        add di, 162
        add bx, 158
        
        mov es:[di], al
        mov es:[bx], al
        loop draw_down        
    ret
end