⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 strcmp.asm

📁 计算二位无符号数平方的程序,将用户从键盘输入的十进制数转换成为十六进制数并显示。对键盘输入的两个字符串进行比较
💻 ASM
字号:
; program compare two strings
; code by brvman	2008/06/08

.model small
.data
		  first db 80, 0, 80 dup(?)
		  second db 80, 0, 80 dup(?)
		  prompt1 db 'Enter the first string:$'
		  prompt2 db 0dh, 0ah, 'Enter the second string:$'
		  identical db 0dh, 0ah, 'The two strings are identical$'
		  diff db 0dh, 0ah, 'The two strings are not identical$'
		  
.stack

compare macro src, dst
		  local next
		  local next2
		  lea si, src
		  lea di, dst
		  cld
		  inc si
		  inc di
		  mov cl, [si]
		  mov ch, [di]
		  inc si
		  inc di
		  cmp cl, ch
		  jnz next2
		  movzx cx, cl
		  repe cmpsb
		  jnz next2
next:
		  call iden_print
next2:
		  call diff_print
endm

.code
.386
start:
		  mov ax, @data
		  mov ds, ax
		  mov es, ax
		  ; input two strings
		  lea dx, prompt1
		  mov ah, 09h
		  int 21h
		  lea dx, first
		  mov ah, 0ah
		  int 21h
		  mov dx, offset prompt2
		  mov ah, 09h
		  int 21h
		  mov dx, offset second
		  mov ah, 0ah
		  int 21h
		  
		  compare first, second
		  
iden_print proc
		  lea dx, identical
		  mov ah, 09h
		  int 21h
		  mov ah, 4ch
		  int 21h
iden_print endp

diff_print proc
		  lea dx, diff
		  mov ah, 09h
		  int 21h
		  mov ah, 4ch
		  int 21h
diff_print endp

end start

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -