任务:在屏幕中间分别显示绿色,绿底红色,白底蓝色的字符串'welcome to masm!'
1 assume cs:codesg,ds:datasg,ss:stack 2 3 datasg segment 4 db 'welcome to masm!' 5 datasg ends 6 7 stack segment 8 db 16 dup (0) 9 stack ends 10 11 codesg segment 12 13 start:mov ax,datasg 14 mov ds,ax 15 mov ax,0B800h 16 mov es,ax 17 mov bx,0 18 mov ax,stack 19 mov ss,ax 20 mov sp,16 21 s: 22 mov cx,16 23 mov si,0 24 s1: 25 mov al,ds:[bx] 26 mov byte ptr es:[380h+si],al 27 mov byte ptr es:[381h+si],2H 28 add si,2 29 inc bx 30 loop s1 31 mov cx,16 32 mov si,0 33 mov bx,0 34 s2: 35 mov al,ds:[bx] 36 mov byte ptr es:[420h+si],al 37 mov byte ptr es:[421h+si],24H 38 add si,2 39 inc bx 40 loop s2 41 mov cx,16 42 mov si,0 43 mov bx,0 44 s3: 45 mov al,ds:[bx] 46 mov byte ptr es:[4c0h+si],al 47 mov byte ptr es:[4c1h+si],71H 48 add si,2 49 inc bx 50 loop s3 51 52 mov ax,4c10H 53 int 21H 54 codesg ends 55 end start