Assembly language second edition experiment 9 implementation based on material programming code

assume cs:codesg


datasg segment
	db 'welcome to masm!'   ;16个字节
	db 00000010b,00100100b,01110001b ; 黑底绿字,绿底红色,白底蓝色
datasg ends

stacksg segment
	dw 16 dup (0)
stacksg ends

codesg segment
	
	start:	mov ax,0b800h
			mov ds,ax
			mov bx,0720h
			;屏幕中间位置
			
			mov ax,datasg
			mov es,ax
			mov si,0
			;需要显示的字符串
			
			mov ax,stacksg
			mov ss,ax
			mov sp,16
			;初始化栈
			
			
			mov cx,16
			
		s:	push cx
			push bx
			
			mov cx,3
			mov di,0
			
			s0:	mov al,es:[si]
				mov [bx],al
				;设置字符
			
				mov ah,es:[di+16]
				mov [bx+1],ah
				;设置颜色
				
				inc di
				add bx,160
				loop s0
			
			inc si
			pop bx
			add bx,2
			pop cx
			loop s
			
			mov ax,4c00h
			int 21h
			
		
codesg ends
end	start 

Guess you like

Origin blog.csdn.net/lcy1619260/article/details/132896294