Xaviorin's Profile User Rating: -----

Reputation: 1 Apprentice
Active Posts:
23 (0.02 per day)
17-January 13
Profile Views:
Last Active:
User is offline Nov 18 2015 12:52 PM

Previous Fields

OS Preference:
Favorite Browser:
Favorite Processor:
Favorite Gaming Platform:
Your Car:
Who Cares
Dream Kudos:

Latest Visitors

No latest visitors to show

Icon   Xaviorin //drunk, fix later

Posts I've Made

  1. In Topic: x86 MASM Can't get ecx count to terminate my loop

    Posted 18 Nov 2015

    I just realized I forgot to initialize ecx.... jesus corrections noted below.

    View PostXaviorin, on 18 November 2015 - 12:11 PM, said:

    Basically in a nutshell I have an assignment where I have to ask for input from a user and then sum the input. That part I have no problem. The caveat is I have to have the program loop 3 times. Looping is what is causing my issue. Basically I can get the program to loop, but I can't get it to stop looping. I thought that by assigning 3 to the ecx register and decreasing it on each loop that it would terminate after ecx hit zero however this isn't the case. It changes to FFFFFFFF instead and I can't figure out how to correct it. Any advice greatly appreciated.

    .model flat,stdcall
    .stack 4096
    ExitProcess proto,dwExitCode:dword
    INCLUDE Irvine32.inc 
    askForNum1 BYTE "Type a number and press enter: ",0 
    askForNum2 BYTE "Type another number and press enter: ",0 
    tellSum BYTE "The sum of your numbers is: ",0 
    number1	DWORD ? 
    number2	DWORD ? 
    sum	DWORD ? 
    main PROC 
    call Clrscr ; clear screen 
    mov ecx,3[/b][/i][/u]
    mov dl, 24 ; Move cursor to the right
    mov dh, 12 ; Move cursor down
    call Gotoxy ; move the cursor to center of console
    mov edx,OFFSET askForNum1 ; Ask for first input
    call WriteString 
    call ReadInt ; read first input from user
    mov number1, eax ; move input to number1
    mov dl, 24 ; Move cursor back to the right
    mov dh, 12 ; Move cursor back down
    call Gotoxy ; move the cursor to center of console
    mov edx,OFFSET askForNum2  ; Ask for second input
    call WriteString 
    call ReadInt ; read second input form user
    mov number2, eax ; move input to number2 
    mov eax, number2 ; Add the inputs together
    add eax, number1 
    mov sum, eax  ; place value in sum
    mov dl, 24 ; Move cursor again
    mov dh, 12 
    call Gotoxy 
    mov edx, OFFSET tellSum ; Display sum message on screen
    call WriteString 
    mov eax, sum ; add sum to end of previous message
    call WriteInt 
    call WaitMsg
    call Clrscr
    REMOVED dec ecx REMOVED[/b][/u]
    loop L1
    	invoke ExitProcess,0
    main endp
    end main

My Information

Member Title:
New D.I.C Head
26 years old
August 4, 1989

Contact Information



Xaviorin hasn't added any friends yet.


Xaviorin has no profile comments yet. Why not say hello?