汇编语言 求检查、修改程序
这个有 难度。比如地址6F17F141的汇编代码 是动态装载的 那么地址6F17F141 程序每次运行时 地址对应的代码不一样。如果不是动态链接的第一步要获取 程序的进程ID;一般代码段不能修改必须更改属性 让他可写入然后 用windows提供的AIP写入代码.
你匿名无法私信,增加了2个新函数INDECS OUTDECS,大多在原函数上改的,改的地方有';'.
DATA SEGMENT
MENU DB 'Please Input your Choice:',0dh,0ah
db '1:Bin -->Dec',0dh,0ah
db '2:Bin -->Hex',0dh,0ah
db '3:Dec -->Bin',0dh,0ah
db '4:Dec -->Hex',0dh,0ah
db '5:Hex -->Dec',0dh,0ah
db '6:Hex -->Bin',0dh,0ah
db '0:Exit. $',0dh,0ah
mess1 db 'Please input a Binnumber:$'
mess2 db 'Please input a Decnumber:$'
mess3 db 'Please input a Hexnumber:$'
mess4 db 'Output Bin is: $'
mess5 db 'Output Dec is: $'
mess6 db 'Output Hex is: $'
TABLE DW L0,L1,L2,L3,L4,L5,L6
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
MAIN PROC FAR
PUSH DS
XOR AX,AX
PUSH AX
MOV AX,DATA
MOV DS,AX
LKS:LEA DX,MENU
MOV AH,09H
INT 21H
CALL CRLF ;
MOV AH,01H
INT 21H
CMP AL,39H
JBE LK1
SUB AL,7
LK1:AND AL,0FH
LEA SI,TABLE
MOV AH,0
SHL AX,1
ADD SI,AX
JMP [SI]
L1:CALL INBIN
CALL CRLF
CALL OUTDEC
CALL CRLF
JMP LKS
L2:CALL INBIN
CALL CRLF
CALL OUTHEX
CALL CRLF
JMP LKS
L3:CALL INDEC
CALL CRLF
CALL OUTBIN
CALL CRLF
JMP LKS
L4:CALL INDECS ;
CALL CRLF
CALL OUTHEX
CALL CRLF
JMP LKS
L5:CALL INHEX
CALL CRLF
CALL OUTDECS ;
CALL CRLF
JMP LKS
L6:CALL INHEX
CALL CRLF
CALL OUTBIN
CALL CRLF
JMP LKS
L0:RET
MAIN ENDP
CRLF PROC
MOV AH,02H
MOV DL,0AH
INT 21H
MOV DL,0DH
INT 21H
RET
CRLF ENDP
INBIN PROC
LEA DX,MESS1
MOV AH,09H
INT 21H
MOV BX,0
INBL1:MOV AH,01H
INT 21H
CMP AL,0DH
JZ INBEXIT
AND AL,01H
SHL BX,1
OR BL,AL
JMP INBL1
INBEXIT:RET
INBIN ENDP
INDEC PROC
LEA DX,MESS2
MOV AH,09H
INT 21H
MOV BX,0
INDL1:MOV AH,01H
INT 21H
CMP AL,0DH
JZ INDEXIT
SUB AL,30H
CMP AL,9
JBE INDL2
SUB AL,7
INDL2:MOV AH,0
XCHG AX,BX
MOV CX,10
MUL CX
ADD BX,AX
JMP INDL1
INDEXIT:RET
INDEC ENDP
INHEX PROC
LEA DX,MESS3
MOV AH,09H
INT 21H
MOV BX,0
IHL1:MOV AH,01H
INT 21H
CMP AL,0DH
JZ IHEXIT
SUB AL,30H
CMP AL,9
JBE IHL2
SUB AL,7
IHL2:MOV CL,4
SHL BX,CL
OR BL,AL
JMP IHL1
IHEXIT:RET
INHEX ENDP
OUTBIN PROC
LEA DX,MESS4
MOV AH,09H
INT 21H
MOV CX,16
OBL1:ROL BX,1
MOV DL,BL
AND DL,01H
OR DL,30H
MOV AH,02H
INT 21H
LOOP OBL1
RET
OUTBIN ENDP
OUTDEC PROC
LEA DX,MESS5
MOV AH,09H
INT 21H
PUSH BX
MOV AX,BX
MOV DX,0;余数
MOV CX,10000
DIV CX
MOV BX,DX
MOV DL,AL
OR DL,30H
MOV AH,02H
INT 21H
MOV AX,BX
MOV DX,0
MOV CX,1000
DIV CX
MOV BX,DX
MOV DL,AL
OR DL,30H
MOV AH,02H
INT 21H
MOV AX,BX
MOV DX,0
MOV CX,100
DIV CX
MOV BX,DX
MOV DL,AL
OR DL,30H
MOV AH,02H
INT 21H
MOV AX,BX
MOV CL,10
DIV CL
MOV BL,AH
MOV DL,AL
OR DL,30H
MOV AH,02H
INT 21H
MOV DL,BL
OR DL,30H
MOV AH,02H
INT 21H
POP BX
RET
OUTDEC ENDP
OUTHEX PROC
LEA DX,MESS6
MOV AH,09H
INT 21H
MOV CX,4
OHL1:ROL BX,1
ROL BX,1
ROL BX,1
ROL BX,1
MOV DL,BL
AND DL,0FH
ADD DL,30H
CMP DL,39H
JBE OHL2
ADD DL,7
OHL2:MOV AH,02H
INT 21H
LOOP OHL1
RET
OUTHEX ENDP
INDECS PROC
LEA DX,MESS2
MOV AH,09H
INT 21H
MOV BX,0
INDLS1:MOV AH,01H
INT 21H
CMP AL, '-' ;
JNZ IDL2 ;
MOV BP, 1 ;
JMP INDLS1 ;
IDL2: ;
CMP AL,0DH
JZ INDEXITS
SUB AL,30H
CMP AL,9
JBE INDLS2
SUB AL,7
INDLS2:MOV AH,0
XCHG AX,BX
MOV CX,10
MUL CX
ADD BX,AX
JMP INDLS1
INDEXITS: ;
CMP BP, 1 ;
JNZ INDEXITS1 ;
XOR BX, 0FFFFH ;
ADD BX, 1 ;
XOR BP, BP ;
INDEXITS1: ;
RET
INDECS ENDP
OUTDECS PROC
LEA DX,MESS5
MOV AH,09H
INT 21H
CMP BX, 8000H ;
JB OTL1 ;
MOV DL, '-' ;
MOV AH, 2 ;
INT 21H ;
MOV AX, 0FFFFH ;
SUB AX, BX ;
ADD AX, 1 ;
XCHG AX, BX ;
OTL1: ;
PUSH BX
MOV AX,BX
MOV DX,0;余数
MOV CX,10000
DIV CX
MOV BX,DX
MOV DL,AL
OR DL,30H
MOV AH,02H
INT 21H
MOV AX,BX
MOV DX,0
MOV CX,1000
DIV CX
MOV BX,DX
MOV DL,AL
OR DL,30H
MOV AH,02H
INT 21H
MOV AX,BX
MOV DX,0
MOV CX,100
DIV CX
MOV BX,DX
MOV DL,AL
OR DL,30H
MOV AH,02H
INT 21H
MOV AX,BX
MOV CL,10
DIV CL
MOV BL,AH
MOV DL,AL
OR DL,30H
MOV AH,02H
INT 21H
MOV DL,BL
OR DL,30H
MOV AH,02H
INT 21H
POP BX
RET
OUTDECS ENDP
CODE ENDS
END MAIN
;从BUF单元开始存有一字符串(长度<255),编程实现统计该字符串中的ASCII码在42H~45H之间的字符个
;数,并将统计结果以二进制形式显示在屏幕。
;
DATA SEGMENT
BUF DB 255
DB ?
DB 255 DUP(?)
crlf db 0dh,0ah,24h ;回车换行
n db 0 ;统计的字符数
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
BEG:
MOV AX,DATA
MOV DS,AX
MOV AH,0AH
MOV DX,OFFSET BUF
INT 21H
mov ah,9
mov dx,offset crlf
int 21h
MOV SI,OFFSET BUF
INC SI
MOV CL,[SI]
MOV Ch,0
inc si
LAST1:
mov al,[si]
cmp al,42h
jb no_1
cmp al,45h
ja no_1
inc n
no_1:
inc si
loop LAST1
mov al,n
MOV CX,8
d_next:
roL aL,1
push ax
mov ah,2
jc disp_1
mov dl,'0'
jmp disp
disp_1:
mov dl,'1'
disp:
int 21h
pop ax
loop d_next
MOV AH,4CH
INT 21H
CODE ENDS
END BEG
用DEBUGER调试一下看看