;代码如下
org 100h
;有的汇编器不用这一行, 不过nasm需要
;output a string in the middle and colored black ,and bg-colored red
;清屏
mov AH, 06 ; function number
mov AL, 00 ; page number
mov BH, 07 ; normal attribute
mov CH, 00 ; row value of start point
mov CL, 00 ; column value of start point
mov DH, 24 ; row value of ending point
mov DL, 79 ; column value of ending pos
int int 10h;移动光标
mov ah, 02h ; function number
mov DH, row ; cursor
mov DL, column ; position
int 10h;输出;color
mov BH, 00 ; page 0
mov BL, 40h ;bgfo color
mov cx,L-1;len of STRING
mov bp,STRING
mov AX, 1301h ; function number
int 10h
call pause
mov ax,4c00h
int 21h;exit
;data
STRING DB "HELLO,I'm 1123",0
;const
L equ $-STRING
row equ 13-1
column equ (80-L)/2-1
;func
pause:
mov ah,07
int 21h
ret
;汇编过程及调试结果
用汇编语言循环指令在屏幕中间输出蓝色底白字的
“hello I am XXX"