汇编语言 实验10.1
assume cs:code,ds:datasgdatasg segmentdb 'welcome to masm!',0
datasg endsstack segmentdw 0,0,0,0,0,0,0,0
stack endscode segment ;代码段start: mov dh,8mov dl,3mov cl,2mov ax,datasgmov ds,axmov si,0call show_strmov ax,4c00h ;程序返回int 21hshow_str:mov ax,80mul dhmov dh,0add ax,dxmov dx,2 ; ax * 2mul dx ; ax = start addr of displaymov di,ax ; 将起始地址存在di里mov bl,cl ; 将格式存在bl里mov cx,0s: mov cl, byte ptr ds:[si] ; 数据写入cljcxz zero ; 如果数据是0 跳转mov ax,dspush axmov ax,0b800hmov ds,axmov ds:[di],clmov ds:[di+1],blpop axmov ds,axinc siadd di,2jmp short szero:retcode ends
end start ;start标号处作为程序入口