ASSUME CS:CODE
DATA SEGMENT
DB 160 DUP(0)
DATA ENDS
CODE SEGMENT
START:
mov bx,data
mov ds,bx
mov si,0
mov cx,3 ;循环次数
MOV AL,9
s1:
push ax ;ax 入栈
OUT 70H,AL
IN AL,71H
MOV AH,AL
push cx ;cx 入栈
MOV CL,4
SHR AH,CL
AND AL,00001111B;
ADD AH,30H
ADD AL,30H
mov ds:[si],ah
mov ds:[si+1],al
pop cx
pop ax
dec cx
dec al
add si,3
jcxz s2
mov bl,'/'
mov ds:[si-1],bl
jmp s1
s2: mov cx,3
MOV AL,4
s3:
push ax ;ax 入栈
OUT 70H,AL
IN AL,71H
MOV AH,AL
push cx ;cx 入栈
MOV CL,4
SHR AH,CL
AND AL,00001111B;
ADD AH,30H
ADD AL,30H
mov ds:[si],ah
mov ds:[si+1],al
pop cx
pop ax
dec cx
sub al,2
add si,3
jcxz show
mov bl,':'
mov ds:[si-1],bl
jmp s3
show:
mov bl,'
————————————————
版权声明:本文为CSDN博主「Dark Zeus」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:[url]https://blog.csdn.net/qq_45137726/article/details/116270522[/url]
;给data字符串结尾加上($)符号
mov ds:[si],bl
MOV AX,data ;将data首地址赋值给AX
MOV DS,AX ;将AX赋值给DS,使DS指向data
mov DX,0 ;使DX指向字符串首地址
MOV AH,09h ;给AH设置参数09H
INT 21h
MOV AX,4C00H
INT 21H
CODE ENDS
END START