|
|
|||||||||
|
|||||||||
|
|||||||||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
Hey guys,
I have this program which is not working. I have been working on it for sometime.. I mean just staring at the code to see if it makes sense. And I havent got any help to go to see if it works. If you could help me it would be really helpful. Its is an 80*86 problem. Here is the code for it. It is really urgent. It was due last week but I havent been able to work it out. I use Windbg to debug it . But it doesnt like something I m doing here. I have added a few lines of code too just for outputing. ;Puneet Kulkarni ;CS 301 assignment 4 .386 .MODEL FLAT ExitProcess PROTO NEAR32 stdcall, dwExitCode WORDINCLUDE io.h ;header file for input/output cr EQU 0dh ;carriage return character Lf EQU 0ah ;line feed .STACK 4096 ;reserve 4096-byte stack .DATA ;reserve storage for data prompt BYTE "PLEASE ENTER THE NUMBER YOU WANT TO ADD AND ENTER A NEGATIVE NUMBER TO EXIT",0 prompt1 BYTE "Please enter an integer: ", 0 string BYTE 11 DUP (?),0 Num1 Byte 11 Dup(?),0 Num2 Byte 11 Dup(?), 0 Num3 Byte 11 Dup(?), cr,Lf,0 nums WORD 60 DUP (?) Orig Byte 11 DUP(?),0 .CODE _start: output prompt lea ebx,nums ;get address of the nums array Startingpoint: mov cx, 0 mov dx,0 inc cx inc cx output prompt1 input string, 10 cmp string,0 jng finalstart atod string ; put input in eax dtoa Num1,eax output Num1 mov [ebx],eax dtoa Orig,eax ; moves the value in Orig lowerloop: mov cx,2 sub ax, 1 jmp lowerprimetest lowerprimetest: mov dx,0 cmp cx, ax je lowerprime dtoa Orig,eax div cx cmp dx, 0 je lowerloop inc cx atod Orig jmp lowerprimetest lowerprime: dtoa Num2,eax Output Num2 mov [ebx],eax jmp highestloop highestloop: add ax,1 jmp higherprimetest higherprimetest: mov dx,0 cmp cx, ax dtoa Orig,eax je higherprime div cx cmp dx, 0 je highestloop inc cx atod Orig jmp higherprimetest higherprime: dtoa Num3,eax Output Num3 mov [ebx],eax jmp Startingpoint finalstart: lea ebx,nums mov ecx,0 finalout: dtoa num1,[ebx] output num1 dtoa num2,[ebx+2] output num2 dtoa num3,[ebx+4] output num3 inc ecx add ebx,6 cmp ecx,30 je endloop jmp finalout endloop: INVOKE ExitProcess, 0 PUBLIC _start END |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > Help with Assembly Language Program |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|