汇编分支程序设计 小写a~z转换成大写,统计‘a’个数

2021-09-24 15:07:01 浏览数 (1)

分支程序设计 HLJU

内存中连续存放着20个ASCII字符,如果时小写a~z转换成大写ASCII字符,并统计原字符中’a’的个数,转换结果,按序存入内存中,之后放字符‘a’的个数。

代码语言:javascript复制
DATAS SEGMENT
            ARRAY DB 10 DUP(?)
            MIN  DB  '9'
            MAX   DB  '0'
DATAS ENDS

STACKS SEGMENT
STACKS ENDS

CODES SEGMENT
            ASSUME CS:CODES,DS:DATAS,SS:STACKS
START:
            MOV AX,DATAS
            MOV DS,AX

            MOV CX,10
            MOV DI,0
REST:    MOV AH,01H
            INT 21H
            MOV ARRAY[DI],AL
            INC DI
            LOOP REST
            
            MOV AL,MAX
            MOV AH,'a'
            MOV CX,10
            MOV DI,0



CONT:  
            CMP AH,ARRAY[DI]
            JNZ NEXT1

            
            ADD MAX,1
            

            
NEXT1:  INC DI
             LOOP CONT

             MOV CX,10
             MOV DI,0

            


CONT2: CMP AL,ARRAY[DI]
             JAE NEXT2

             
             SUB ARRAY[DI],32
             

NEXT2:  INC DI
             LOOP CONT2

             MOV CX,10
             MOV DI,0



AGAIN:MOV DL,ARRAY[DI]
            MOV AH,02H
            INT 21H
            INC DI
            LOOP AGAIN
  



            MOV DH,02H
            mov AX,MAX
            mov DH,AX

            
            MOV AH,02H
            MOV DL,DH
            INT 21H



            MOV AH,4CH
            INT 21H

CODES ENDS
            END START

0 人点赞