Home > other >  Consult bosses wrong code
Consult bosses wrong code

Time:09-22

I think the screen in the input string ASCLL yards in 42 to 45 h h character number of binary number to always is not the right to change the results
The DATA SEGMENT USE16
BUF DB 255
The DB?
The DB 255 DUP (?)
The DATA ENDS
CODE SEGMENT USE16
ASSUME CS: CODE, DS: DATA
BEG: MOV AX, DATA
MOV DS, AX
MOV AH, AH 0
MOV DX, OFFSET BUF
INT 21 h
MOV SI, OFFSET BUF
CX, MOV [SI + 1]
MOV SI, 0
MOV BX, OFFSET BUF + 2

The LAST: CMP BYTE PTR [BX], 42 h
JC NEXT
CMP BYTE PTR [BX], 45 h
JA NEXT
INC SI
NEXT: INC BX
LOOP LAST

DISP: CX, MOV 16
LAST1: MOV AL, '0'
ROL SI, 1
JNC NEXT1
MOV AL, '1'
Eh NEXT1: MOV AH, 0
INT 10 h
LOOP LAST1
MOV AH, 4 ch
INT 21 h
CODE ENDS
END BEG

CodePudding user response:

CX, MOV after input characters [SI + 1] is wrong, that's just a byte domain, the next byte is the input of characters, so the actual number of characters is wrong, lead to the final result is wrong, can value to CL, 0 then CH,
  • Related