1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
| ; 屏幕中间显示三行彩色字 ; sy9.asm assume cs:code
data segment db 'welcome to masm!' ; 16字节 db 00000010b ; 绿字 db 00100100b ; 绿底红字 db 01110001b ; 白底蓝字 db 11,12,13,64 ; 三行的位置 (25-3)/2=11 每行开始位置 (80-16)/2*2=64 data ends
stack segment dw 8 dup (0) stack ends
code segment start: mov ax,data mov ds,ax mov ax,stack mov ss,ax mov sp,16 mov cx,3 row: mov dx,cx mov si,3 sub si,cx mov ch,0 mov cl,19[si] mov bp,0 col: add bp,160 loop col
mov ah,0 mov al,ds:[22] add bp,ax ; 每行字符起始位置 mov si,3 sub si,dx mov ah,16[si] mov bx,0 mov cx,16 fill: mov al,[bx] push ds mov si,0b800h mov ds,si mov ds:[bp],ax pop ds inc bx add bp,2 loop fill
mov cx,dx loop row
mov ax,4c00h int 21h code ends end start
|