Task 1
Write a program to (a) prompt the user, (b) read first, middle, and last initials of a person’s name, and (c) display them duwn the left margin.
Sample execution:
ENTER THRl::E INITIALS: JFK
J
F
K
//Code .MODEL small .STACK 100h .DATA msg db 'Write three initials $' .CODE MAIN PROC mov ax, @data mov ds, ax ;Print initial message mov ah, 9 lea dx, msg int 21h ;Take inputs mov ah, 1 int 21h mov bl, al int 21h mov bh, al int 21h mov cl, al ;Print newline mov ah, 2 mov dl, 0dh int 21h mov dl, 0ah int 21h ;print 1st input mov dl, bl int 21h ;print newline mov dl, 0dh int 21h mov dl, 0ah int 21h ;print 2nd input mov dl, bh int 21h ;print newline mov dl, 0dh int 21h mov dl, 0ah int 21h ;print 3rd input mov dl, cl int 21h ENDP MAIN ;other procs (if any) go here end MAIN
Task 2
Write a program to display a 10 x 10 solid box of asterisks. Hint: declare a string in the data segment that specifies the box, and display it with INT 2lh, function 9h.
//Code .MODEL small .STACK 100h .DATA msg db '**********', 0dh, 0ah, '$' .CODE MAIN PROC mov ax, @data mov ds, ax mov ah, 9 lea dx, msg int 21h int 21h int 21h int 21h int 21h int 21h int 21h int 21h int 21h int 21h ENDP MAIN ;other procs (if any) go here end MAIN
Task 3
Print a 10*10 hollow box of stars
//Code .MODEL small .STACK 100h .DATA msg db '**********', 0dh, 0ah, '$' msg2 db '* *', 0dh, 0ah, '$' .CODE MAIN PROC mov ax, @data mov ds, ax mov ah, 9 lea dx, msg int 21h lea dx, msg2 int 21h int 21h int 21h int 21h int 21h int 21h int 21h int 21h lea dx, msg int 21h ENDP MAIN ;other procs (if any) go here end MAIN
Task 4
Write a program to (a) display”?”, (b) read three initials,(c) display them in the middle of an 11 x 11 box of asterisks,
//Code .MODEL small .STACK 100h .DATA msg db '***********', 0dh, 0ah, '$' msg2 db '*****$' msg3 db '*****', 0dh, 0ah, '$' .CODE MAIN PROC mov ax, @data mov ds, ax ;Take inputs mov ah, 1 int 21h mov bl, al int 21h mov bh, al int 21h mov cl, al mov ah, 2 mov dl, 0dh int 21h mov dl, 0ah int 21h mov ah, 9 lea dx, msg int 21h int 21h int 21h int 21h mov ah, 9 lea dx, msg2 int 21h mov ah,2 mov dl, bl int 21h mov ah, 9 lea dx, msg3 int 21h mov ah, 9 lea dx, msg2 int 21h mov ah,2 mov dl, bh int 21h mov ah, 9 lea dx, msg3 int 21h mov ah, 9 lea dx, msg2 int 21h mov ah,2 mov dl, cl int 21h mov ah, 9 lea dx, msg3 int 21h lea dx, msg int 21h int 21h int 21h int 21h ENDP MAIN ;other procs (if any) go here end MAIN
Task 5
Write a program to read one of the hex digits A-F, and Display it on the next line in decimal.
//code To be done by students