Home > other >  Assembler output of the characters
Assembler output of the characters

Time:11-18

In the length of 8 byte array (unsigned), find the number of unsigned number is more than 42 h in byte units up; Is equal to the number of unsigned number 42 h in equa byte units; Number of unsigned number is less than 42 h in byte units down, and put these digital print (characters), and turn to how to print out the characters of each category?

The DATA SEGMENT
31 h DATA1 DB, 21 h, 42 h, h, 87 h, h, 98 h, 01 h
COUNT the DB 8 h
SEARCH the DB 42 h
UP the DB 0
DOWN the DB 0
EQUA DB 0
UPSTRING DB ah 0, 0 dh, 'UP Number: $'
DOWNSTRING DB ah 0, 0 dh, 'Down Number: $'
EQUASTRING DB ah 0, 0 dh, 'Eqau Number: $'
The DATA ENDS
CODE SEGMENT
ASSUME CS: CODE, DS: DATA
START:
MOV AX, DATA
MOV DS, AX
MOV BX, 0
AGAIN:
MOV AL, [DATA1 + BX]
MOV DL, SEARCH


CMP AL, DL
JZ EQUAL
JNS LARGER
JS SMALLER
EQUAL:
INC EQUA
INC BX


CMP BX, 8
JNZ AGAIN
JZ NEXT
LARGER:
INC UP
INC BX
CMP BX, 8
JNZ AGAIN
JZ NEXT


SMALLER:
INC DOWN
INC BX
CMP BX, 8
JNZ AGAIN
JZ NEXT

NEXT:
MOV DX, OFFSET UPSTRING
MOV AH, 09 h
INT 21 h
ADD UP to 30 h
MOV DL, UP
MOV AH, 2
INT 21 h

MOV DX, OFFSET DOWNSTRING
MOV AH, 09 h
INT 21 h
ADD the DOWN, 30 h
MOV DL, DOWN
MOV AH, 2
INT 21 h

MOV DX, OFFSET EQUASTRING
MOV AH, 09 h
INT 21 h
The ADD EQUA, 30 h
MOV DL, EQUA
MOV AH, 2
INT 21 h




MOV AX, 4 c00h
INT 21 h
CODE ENDS
The END START

CodePudding user response:

What is to get the corresponding such as greater than the number printed, rather than as you code now this is the number of print?
If it is, first of all, the practice of this print number, you are flawed, in this case, you have no problem, but if the data is increased more than 10 May 10 a number? This, there is a general numerical display character turn corresponding output, usually assembly are some example database, some auxiliary parts is also common Irvine classes; Is commonly used in addition to the 10 method, and can refer to https://blog.csdn.net/qq_36931762/article/details/84780659 (this is just to search), secondly, it must be output symbols condition data, see the appearance of the data in the source code, the output word is output in the form of hexadecimal, roughly like a problem before, otherwise output hex, actually is more simple, is to convert the output bit by bit, you can refer to https://bbs.csdn.net/topics/398201666 reply, although that is a word you is byte,
  • Related