实验10
1 ;name: show_str 2 ;func: 在指定的位置,用指定的颜色,显示一个用‘0‘结束的字符串 3 ;argc: (dh)=行号(取值范围0~24), (dl)=列号(取值范围0~79) 4 ; (cl)=颜色, ds:si指向字符串的首地址 5 ;return: None 6 assume cs:code 7 data segment 8 db ‘Welcome to masm!‘, 0, ‘x‘ 9 data ends 10 11 code segment 12 start: mov dh, 8 13 mov dl, 3 14 mov cl, 2 15 mov ax,data 16 mov ds,ax 17 mov si, 0 18 call show_str 19 20 mov ax, 4c00h 21 int 21h 22 23 show_str: 24 push ax 25 push bx 26 push es 27 push cx 28 push dx 29 push si 30 31 mov ax, 0b800h 32 mov es, ax 33 34 mov bx, 0 35 mov al, 160 36 mul dh 37 add bx, ax 38 mov al, 2 39 mul dl 40 add bx, ax ;print start position 41 42 print: 43 mov cl, 0 ;judge end 44 mov ch, ds:[si] 45 jcxz return 46 47 mov al, [si] ;character 48 mov ah, 02h ;(color) BL RGB I RGB 49 mov es:[bx], ax 50 add bx, 2 51 inc si 52 53 jmp short print 54 55 return: 56 pop si 57 pop dx 58 pop cx 59 pop es 60 pop bx 61 pop ax 62 63 ret 64 65 code ends 66 end start
原文地址:https://www.cnblogs.com/coodyz/p/11749834.html
时间: 2024-10-22 23:02:07