Sunday, 14 June 2015

Box Of Asterisks Without Loop In Assembly Language In Assembly Language Solution.

Write a program to (a) display "?" (b) read a initials, (c) display them in the middle of an 11*11 box of asterisks in assembly language.

Easy Solution without Using Loop.
/*
    *
    * Prosen Ghosh
    * American International University - Bangladesh (AIUB)
    *
*/

Solution:

.model small
.stack 200h
.data
line db '***********$'
nl1 db 0ah,0dh,'*         *'
nl2 db 0ah,0dh,'*         *'
nl3 db 0ah,0dh,'*         *'
nl4 db 0ah,0dh,'*         *'
nl5 db 0ah,0dh,'*         *'
nl6f db 0ah,0dh,'*    '
val db ?
nl6l db '    *'

nl7 db 0ah,0dh,'*         *'
nl8 db 0ah,0dh,'*         *'
nl9 db 0ah,0dh,'*         *'
nl10 db 0ah,0dh,'*         *'
nl11 db 0ah,0dh,'*         *$'


.code

main proc
 
    mov ax,@data
    mov ds,ax
 
    mov ah,1
    int 21h
    mov val,al
 
    mov ah,9
    lea dx,line
    int 21h
 
    mov ah,9
    lea dx,nl1
    int 21h
 
    mov ah,2
    mov dl,0ah
    int 21h
    mov dl,0dh
    int 21h
   
    mov ah,9
    lea dx,line
    int 21h
 
    mov ah,4ch
    int 21h

    main endp
end main

No comments:

Post a Comment