使用汇编实现字符串的大小写转换

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

使用汇编实现字符串的大小写转换

  2021-04-02 我要评论

使用汇编编程,可以直接访问内存中的数据,对数据进行相关操作,现在需要通过汇编指令and,or对字符串数据进行大小写转换。如下例,将BaSiC转换成大写,将iNforMaTiOn转换成小写。

例子:

assume cs:codesg,ds:datasg

datasg segment
 db 'BaSiC'
 db 'iNforMaTiOn'
datasg ends

codesg segment
 start: mov ax,datasg
  mov ds,ax
  
  mov cx,5
  mov bx,0
  
 s1: mov al,ds:[bx]
  and al,11011111b
  mov ds:[bx],al
  inc bx
  loop s1
 
  mov cx,11
  mov bx,5
  
 s2: mov al,ds:[bx]
  or al,00100000b
  mov ds:[bx],al
  inc bx
  loop s2
  
  mov ax,4c00h
  int 21h

codesg ends

end start

您可能感兴趣的文章:

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们