【8086汇编】判断一个字符串是否有效(不以数字开头的字符串即为有效)

【8086汇编】判断一个字符串是否有效(不以数字开头的字符串即为有效)
图 1 程序运行示意

stack   segment stack
        db 512 dup(?)
stack   ends

data 	segment
		msg1 db "enter the string : $"
		msg2 db "string is not valid $"
		msg3 db "stinrg is valid $"
		str1 db 20 dup('$')
		line db 10,13,'$'
data 	ends

dis		macro str
		mov ah,09h
		lea dx,str
		int 21h
endm

code 	segment
        assume ds:data, cs:code, ss: stack
start:
		mov ax, stack
		mov ss, ax
        mov ax, data
        mov ds, ax
        dis msg1
        mov ah, 0ah
        lea dx, str1
        int 21h
        dis line
        lea si, str1+2
        mov al, '0'
        cmp byte ptr[si],al
        jl l2
        mov al, '9'
        cmp byte ptr[si],al
        jg l2
        dis msg2
        jmp l1
l2: 
		dis msg3   
l1:
		mov ah, 4ch
        int 21h
code 	ends
		end start
上一篇:JavaScript的学习--生成二维码


下一篇:第五十个知识点:什么是BLS基于对的签名方案?