📄 capitalreversesmall.asm
字号:
.MODEL SMALL
.STACK 100H
.DATA
PROMPT_1 DB 'Please Enter Capital letters: $'
DISPLAY_1 DB 0DH,0AH,'Small letters in reverse order: $'
LETTERS DB ?
.CODE
MAIN PROC
MOV AX, @DATA ; initialize DS
MOV DS, AX
LEA DX, PROMPT_1 ; load and display PROMPT_1
MOV AH, 9
INT 21H
XOR SI,SI ; SET SI TO 0
MOV CX,5 ; initialize loop counter
MOV AH, 1 ; set input function
CONVERT: ; jump label
INT 21H ; read a digit
ADD AL,20H
MOV AL,LETTERS[SI]
ADD SI,1 ; move pointer to next element by 1(DB)
LOOP CONVERT ; jump to label INPUT
LEA DX, DISPLAY_1 ; load and display PROMPT_1
MOV AH, 9
INT 21H
;display character function
MOV AH,2
REVERSE:
MOV DL,LETTERS[SI];move last element to DL
INT 21H ;display character
SUB SI,1
CMP SI,0
JE EXIT
LOOP REVERSE ; jump to label INPUT ;display character
EXIT:
MOV AH, 4CH ; return control to DOS
INT 21H
MAIN ENDP
END MAIN
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -