用汇编实现闪烁显示字符串?

编辑代码如下:

data segment
	show_start db 'hello, world'
	show_end db '$'
data ends

code segment
	assume cs:code, ds:data
start:
	mov ax,data
	mov ds,ax
	mov dx,offset show_start    ;指定字符串段内偏移
	mov bl,11001111b  ; 指定闪烁颜色
	mov cx,offset show_end   ; 控制显示长度, 由于起始为0直接使用偏移
	
	mov ah,9
	int 10h
	int 21h
	
	mov ax,4c00h
	int 21h
	

code ends

end start

一些解释:

  • 使用bl存放要显示的颜色,以8位二进制指定
  • int 10调用bios对显示器提供的功能完成

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注