subtwo.asm

来自「从键盘输入一个字符串,先把它原样显示一遍 然后将其中的小写字母转换为大写显示,再」· 汇编 代码 · 共 113 行

ASM
113
字号
.model small
extern highstr:byte,lowstr:byte,sourstr:byte,converstr:byte
.code
public contohigh,contolow,toconverse
;----------------------------------------------
contohigh proc far
push si
push di
push cx
push ax
	lea si,[sourstr+2]
	lea di,[highstr+2]
	xor cx,cx
	mov cl,[si+1]
  again:cmp cl,0
      	je high_exit
      	mov al,[si]
      	mov [di],al
      	cmp al,'a'
      	jb high_con
      	cmp al,'z'
      	ja high_con
      	sub al,20h
      	mov [di],al
	high_con:
	
			inc di
       inc si
       dec cl
       jmp again
  high_exit:
  pop ax
  pop cx
  pop di
  pop si
     ret
contohigh endp
;----------------------------------------------------
contolow proc far
push si
push di
push cx
push ax
	lea si,[sourstr+2]
	lea di,[lowstr+2]
	xor cx,cx
	mov cl,[si+1]
low_again:cmp cl,0
      	je low_exit
      	mov al,[si]
      	mov [di],al
      	cmp al,'A'
      	jb low_con
      	cmp al,'Z'
      	ja low_con
      	add al,20h
      	mov [di],al
	low_con:
	
			inc di
       inc si
       dec cl
       jmp low_again
  low_exit:
  pop ax
  pop cx
  pop di
  pop si
     ret
contolow endp
;----------------------------------------------------
toconverse proc far
push si
push di
push cx
push ax
	lea si,[sourstr+2]
	lea di,[converstr+2]
	xor cx,cx
	mov cl,[si+1]
 conver_again:cmp cl,0
      	je conver_exit
      	mov al,[si]
      	mov [di],al
      	cmp al,'a'
      	jb hightolow
      	cmp al,'z'
      	ja c_com
      	sub al,20h
      	mov [di],al
      	jmp c_com
	hightolow:
			cmp al,'A'
			jb c_com
			cmp al,'Z'
			ja c_com
			add al,20h
			mov [di],al

	c_com:
			inc di
       inc si
       dec cl
       jmp conver_again
  conver_exit:
  pop ax
  pop cx
  pop di
  pop si
     ret

toconverse endp
end

⌨️ 快捷键说明

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