;If they are the same, output 'match'; if they are different, output 'no match'.
;The modified code can loop through
DATAS SEGMENT
data1 DB 100 DUP(?)
data2 DB 100 DUP(?)
string DB 0DH,0AH,'$'
tital1 DB 'Please input the first string :',0DH,0AH,'$'
tital2 DB 'Please input the second string :',0DH,0AH,'$'
tital3 db 'Do you want to have a try again(if yes,input y, else input n ): ',0dh,0ah,'$'
result1 db 'match',0dh,0ah,'$'
result2 db 'no match',0dh,0ah,'$'
temp DW 0
DATAS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS
START: MOV AX,DATAS
MOV DS,AX
MOV si,0
tip1: ;Output header 1
LEA dx,tital1
MOV ah,09h
INT 21H
first: ; input the first string
MOV ah,01h ; input characters are placed in AL
INT 21H ; end with carriage return
cmp al,0dh
je tip2
MOV data1[si],AL ; save in memory
INC si
JMP first
tip2:
LEA dx,string
MOV AH,09H
INT 21H
MOV temp,si ; save si so that the next string can be compared with it
MOV si,0 ; output header 2
LEA dx,tital2 MOV ah,09h INT 21H second: ; input the second string MOV AH,01H ; input characters are placed in AL INT 21H ; also end with carriage return CMP AL,0DH je output mov data2[si],al ; save in memory inc si
jmp second output: LEA dx,string MOV AH,09H INT 21H CMP temp,si ;Judge whether the lengths are equal JNE nomatch MOV si,0 pipei:MOV AL,DATA1[si];Judge whether each character is equal MOV AH,DATA2[si] INC si CMP AL,AH JNE nomatch CMP si,temp JE MATCH JMP pipei MATCH: LEA DX,result1 ;If no match, output conclusion 1 MOV AH,09H INT 21H JMP EXIT nomatch:LEA DX,result2 ;If match, output conclusion 2 MOV AH,09H INT 21H EXIT: ;Ask whether to continue lea dx,tital3 mov ah,09h int 21h mov ah,01h int 21h cmp al,'y' lea dx,string mov ah,09h int 21h je start cmp al,'n' je over jmp exit over: ;End MOV AH,4CH INT 21H CODES ENDS END START
Previous article:Implementing quick sorting with VC++ class (and outputting the process)
Next article:Assembly: Count the number of various characters in a string
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- CGD and Qorvo to jointly revolutionize motor control solutions
- CGD and Qorvo to jointly revolutionize motor control solutions
- Keysight Technologies FieldFox handheld analyzer with VDI spread spectrum module to achieve millimeter wave analysis function
- Infineon's PASCO2V15 XENSIV PAS CO2 5V Sensor Now Available at Mouser for Accurate CO2 Level Measurement
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- A new chapter in Great Wall Motors R&D: solid-state battery technology leads the future
- Naxin Micro provides full-scenario GaN driver IC solutions
- Interpreting Huawei’s new solid-state battery patent, will it challenge CATL in 2030?
- Are pure electric/plug-in hybrid vehicles going crazy? A Chinese company has launched the world's first -40℃ dischargeable hybrid battery that is not afraid of cold
- [GigaDevice GD32F310 Review] + UART Application
- Designing efficient, powerful, and fast electric vehicle charging stations
- 《GitHub Introduction and Practice》
- I would like to ask how to calculate the gain of the PCB antenna
- Multi-channel RF transceiver clocking for radar and wireless 5G testers
- CC2541 cannot receive data sent by Bluetooth main module
- EEWORLD University Hall - FPGA Simple Design Principles and Applications
- Several analysis methods that you must know about transistor circuits!
- [GD32L233C] + 5. Use RTThread's Finsh component
- Do you know these three special PCB routing techniques?