1.
assume cs:codedata segment db 'welcome to masm! ',0data endscode segmentstart: mov ax,cs mov ds,ax mov si,offset capital mov ax,0 mov es,ax mov di,200h mov cx,offset capitalend-offset capital cld rep movsb mov ax,0 mov es,ax mov word ptr es:[7ch*4],200h mov word ptr es:[7ch*4+2],0 mov dh,10 mov dl, 10 mov cl,2 mov ax,data mov ds,ax mov si,0 int 7ch mov ax,4c00h int 21hcapital: push ax push es push di push si mov ax,0b800h mov es,ax mov al,0a0h mul dh mov di,ax mov al,2 mul dl add di,ax mov ah,cls: mov al,[si] cmp al,0 je ok mov word ptr es:[di],ax add di,2 inc si jmp short sok: pop si pop di pop es pop ax iretcapitalend: nopcode endsend start
2.
assume cs:codecode segmentstart: mov ax,cs mov ds,ax mov si,offset capital mov ax,0 mov es,ax mov di,200h mov cx,offset capitalend-offset capital cld rep movsb mov ax,0 mov es,ax mov word ptr es:[7ch*4],200h mov word ptr es:[7ch*4+2],0 mov ax,0b800h mov es,ax mov di,12*160 mov bx,offset s-offset se mov cx,80s: mov byte ptr es:[di],'!' add di,2 int 7chse: nop mov ax,4c00h int 21hcapital: push bp mov bp,sp dec cx jcxz ok add [bp+2],bxok: pop bp iretcapitalend: nopcode endsend start