Assemble job

xiaoxiao2021-04-09  531

topic:

Enter a string of length N from the keyboard (0

(1) The corresponding prompt information must first be displayed before the input and output; the prompt information must be exclusive; the input must be ended with the carriage return;

(2) Transform uppercase letters in characters into lowercase letters and display the transformed string on the screen;

(3) Number of non-digital characters in the statistical string (characters other than '0' 9 '), with decimal output;

(4) One of the lowercut English characters contained in the output string is the minimum ASCII value;

Code:

Data segment

INPINFO DB 'PLEASE INPUT:', 10, 13, '$'

STR DB 512 DUP (?)

BTL DB 10, 13, 'After Convert Big To Small They Are:', 10, 13, '$'

Numinfo DB 10, 13, 'The Number NOT NUM IS:', 10, 13, '$'

WordInfo DB 10, 13, 'The Smallest Word IS:', 10, 13, '$'

Worderror DB 10, 13, 'NO Small Word Exist!', 10, 13, '$'

Count db 0

Little DW 122; 'Z' 1

Data ends

Assume CS: Code, DS: Data

Code segment

Start:

Mov AX, DATA

MOV DS, AX

MOV Si, 0

****** Input

MOV DX, Offset INPINFO

Mov Ah, 09h

Int 21h

INPUT_T1:

MOV AH, 01H

Int 21h

MOV STR [Si], Al

Inc Si

CMP

Al

13

Je Find

JNE INPUT_T1

***** Find a character in which the ASII code is the smallest

Find:

Dec Si

MOV BX, Si

MOV Si, 0

MOV DH, 123

Find_0:

MOV CL, STR [Si]

CMP CL, 'A'

JB Find_1

CMP CL, 'Z'

Ja Find_1

CMP CL, DH

JB Give

Inc Si

CMP Si, BX

Je Print_It

JNE FIND_0

Give:

MOV DH, CL

Inc Si

CMP Si, BX

Je Print_It

JNE FIND_0

Find_1:

Inc Si

CMP Si, BX

Je Print_It

JNE FIND_0

Print_it:

CMP DH, 123

Je Fail

Push dx

Lea DX, WordInfo

Mov Ah, 09h

Int 21h

POP DX

MOV DL, DH

MOV AH, 02H

Int 21h

JMP Convert

Fail:

Lea DX, Worderror

Mov Ah, 09h

Int 21h

JMP Convert

******* Find OK

******* Turn on the uppercase

CONVERT:

MOV Si, 0

Mov Ah, 09

Lea DX, BTL

Int 21h

ConVT_1:

MOV DL, STR [Si]

CMP DL, 'A'

JB convt_2

CMP DL, 'Z'

JA ConVT_2

Add DL, 20h

MOV STR [Si], DL

Inc Si

CMP Si, BX

JNE ConVT_1

JE OUTPUT

ConVT_2:

Inc Si

CMP Si, BX

JNE ConVT_1

JE OUTPUT

OUTPUT:

MOV Si, 0

OUT_1:

MOV DL, STR [Si]

MOV AH, 02H

Int 21h

Inc Si

CMP BX, Si

JNE OUT_1

Je count_no

********** Week to turn lowercase

; ********** Calculate the number of non-numbers

Count_no:

MOV CL, 0

MOV Si, 0

COUNT_0:

MOV Al, STR [Si]

CMP

Al

, '0'

JB count_1

CMP

Al

,'9'

Ja count_1

Inc Si

CMP Si, BX

JNE COUNT_0

JE OUTPUT_NUM

COUNT_1:

Add Count, 1

Inc Si

CMP Si, BX

JNE COUNT_0

JE OUTPUT_NUM

OUTPUT_NUM:

Lea DX, NumInfo

Mov Ah, 09h

Int 21h

MOV AX, 0

MOV

Al

COUNT

MOV CL, 10

Div Cl

Push AX

MOV DL,

Al

MOV AH, 02H

OR DL, 30H

Int 21h

POP AX

MOV DL, AH

OR DL, 30H

MOV AH, 02H

Int 21h

JMP EXIT00

************** Statistics Over

EXIT00:

MOV AX,

4C

00h

Int 21h

Code ends

End Start

转载请注明原文地址:https://www.9cbs.com/read-133194.html

New Post(0)