MASM Assembly jump instructions printing issue -
.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
when program reads in positive number, how come prints both messages "positive" , "negative" need print message "positive"
any appreciated. !
.....................................................................................................
have @ code follows label message2
- dont have jmp instruction in there. result, after printing "positive" code 'falls-through' next case , prints "negative".
i guess intended jump either forever
or finish
.
Comments
Post a Comment