.386
.MODEL FLAT
ExitProcess PROTO NEAR32 stdcall, dwExitCode:DWORD
Include io.h
cr equ 0DH
Lf equ 0AH
.STACK 4096
.DATA
string byte 40 Dup (?)
number dword ?
runningSum dword 0
rejected byte " , Rejected", 0
positive byte cr, Lf, "Positive",0
negative byte cr, Lf, "Negative",0
numaschar byte 11 dup(?),0
newline byte cr,Lf,0
.code
_start:
forever: input string, 40
atod string
mov number, eax
cmp number,0
jne processing
je finish
processing:
cmp number,10
jg message
cmp number,-10
jl message
cmp number,10
jle not_rejected1
cmp number,-10
jge not_rejected2
jmp jumpToTop
message: dtoa numaschar,number
output numaschar
output rejected
output newline
not_Rejected1: cmp number, -10
jge processing2
not_Rejected2: cmp number,10
jle processing2
processing2: cmp number, 0
jg addInstruct
jl subInstruct
addInstruct: add ebx, 1
add edx,number
jmp message2
subInstruct: add ecx, 1
jmp message3
message2: dtoa numaschar, number
output positive
output newline
message3: dtoa numaschar, number
output negative
output newline
jumpToTop: jmp forever
finish:
INVOKE ExitProcess, 0
PUBLIC _start
END
当这个程序读入正数时,它怎么打印两个消息"肯定"和"否定"但我需要它只打印消息"肯定"
感谢任何帮助。谢谢!
............................................... .................................................. ....
答案 0 :(得分:0)
查看标签message2
后面的代码 - 那里没有jmp指令。结果,在印刷之后"积极"代码'直通'到下一个案例,然后打印"否定"。
我猜你打算跳到forever
或finish
。