GunnerInc's Profile User Rating: *****

Reputation: 866 Master
Active Posts:
2,434 (1.78 per day)
28-March 11
Profile Views:
Last Active:
User is offline Today, 12:45 PM

Previous Fields

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

Latest Visitors

Icon   GunnerInc Please don't bother PM'ing me for help!! Post your questions in the correct forum for all to benifit from!!!

Posts I've Made

  1. In Topic: Figure I would share a happy life event.

    Posted 21 Dec 2014

    Thank you all!

    No2, I was told a few times that when I do get a ring for her, that it should be bigger than any of her cousins.
  2. In Topic: MASM assignment help

    Posted 16 Dec 2014

    I swapped something from one line with another to get the correct output:
    Attached File  12-16-2014 10-05-43 PM.png (6.11K)
    Number of downloads: 2
    Your variable names are a bit out of whack... You call it sourceStr, but in reality it is the target buffer, no? That being said, your sourceStr (AHEM, target buffer) is not big enough to hold the concatenated strings, so you are overwriting what is after your sourceStr (I mean your target buffer), how would you fix that?

    Another thing, registers have functions to them. For instance, si is the source index register (esi - Extended Source Index) di is the destination index register (edi - Extended Source Index Register) So, your source string would go into esi and your target buffer/string would go into edi. One can look at the code and know what is going on. When you put the source into edi, and target into esi, it is a bit confusing.

    Let's look at the strcat prototype from the C Library:
    char * strcat ( char * destination, const char * source );

    So, to be intuitive, your proto should look like:
    Str_concat PROTO, destination:ptr byte, source:ptr byte 

    Next, while programing in Assembly, you need to be aware of what is called an ABI (Application Binary Interface), this dictates what how parameters are passed, where the return value is, if things need to be aligned, who cleans up the stack, and a biggie, what registers need to be saved across a function call and which do not.

    The x86 ABI states that if your function uses the non-volatile registers: esi, edi, ebx, ebp, and of course, esp, you must save these in the prologue and restore them in the epilogue. The volatile registers are: eax, ecx, edx and these do not need to be saved. You can save them if you want. This is easy with MASM, you just add uses <registers to save and restore> right after proc. So since your Str_concat uses esi and edi, it should look like:
    Str_concat PROC uses esi edi, destination:PTR BYTE, source:PTR BYTE
        ; your code here
    Str_concat ENDP  

    and behind the scenes, MASM will do:
        push    ebp         ; prologue
        mov     ebp, esp    ; 
        push    esi         ;
        push    edi         ;
        ; your code here
        pop     edi         ; epilogue
        pop     esi         ; 
        leave               ; 

    All in all, your on the right track, just fix that buffer issue, and you will be good to go.
  3. In Topic: Printing specific word backwards

    Posted 3 Dec 2014

    Moved to Assembly...
  4. In Topic: Assembly 8086: Files

    Posted 3 Dec 2014

    Why would you not close the file once you are done?
  5. In Topic: Simple help

    Posted 27 Nov 2014

    First thing you don't need to do is save the registers eax, and ecx, they are one of the volatile registers and are allowed to be trashed across function calls.

    What terminates almost all strings? A NUL (ASCII 0) right? So how would you check for that? I would make this its own function and use the return value instead of a variable.

    Using MASM:
    sstr        BYTE "oNe 1 tWO 2 THREE 3 ", 0
        push    offset sstr
        call    CountCapitals
        print str$(eax), 13, 10
        invoke  ExitProcess, 0
        mov     edx, [esp + 4]      ; get pointer to string
        sub     edx, 1              ; decrease pointer by 1
        xor     eax, eax            ; zero out 
        add     edx, 1              ; increase pointer by 1
        mov     cl, byte ptr [edx]  ; move current char into cl
        test    cl, cl              ; cl && cl
        jz      Done                ; if 0, we are at end of string
        cmp     cl, "A"             ;
        jl      NextChar            ; if current char is < A (65), repeat loop
        cmp     cl, "Z"             ; 
        jg      NextChar            ; if current char is > Z (90), repeat loop
        add     eax, 1              ; made it here, must be uppercase, increase our counter
        jmp     NextChar            ; repeat loop
        ret     4 * 0               ; adjust stack for 1 parameter, capital count is in eax.

    Using your string a input to CountCapitals, line 12 will print 8

My Information

Member Title:
"Hurry up and wait"
40 years old
June 30, 1974
In my head
Forum Leader:
Full Name:
Years Programming:
Programming Languages:
x86 Win32 Assembly (MASM, FASM, NASM)

Contact Information

Click here to e-mail me
Website URL:
Website URL


Page 1 of 1
  1. Photo

    BenignDesign Icon

    06 May 2013 - 06:44
    How goes things, sunshine?
  2. Photo

    BenignDesign Icon

    02 Nov 2012 - 20:34
  3. Photo

    codeprada Icon

    25 Jun 2012 - 07:11
    Congratz on Mod status. Seems like I'm really late to this party. Better late than never right. =D
  4. Photo

    GunnerInc Icon

    26 May 2012 - 18:21
    Thanks No2, it was totally unexpected! Honored really!
  5. Photo

    no2pencil Icon

    26 May 2012 - 18:12
    Welcome to the team!
  6. Photo

    DimitriV Icon

    20 Nov 2011 - 19:22
    Good on you man, you are a DIC ++. That's skilled.
  7. Photo

    ishkabible Icon

    17 Oct 2011 - 13:33
    congratz!! if you get 15 rep this month(only 5 away!!) you can also get the assembly award!
  8. Photo

    Gungnir Icon

    17 Oct 2011 - 06:42
    Congratulations on becoming an expert!!
  9. Photo

    ishkabible Icon

    12 Oct 2011 - 18:36
    hey, i was about tell you how good a job you were doing then i saw i already had :P
  10. Photo

    GunnerInc Icon

    08 Oct 2011 - 08:04
    HeHe, thanks!
  11. Photo

    ishkabible Icon

    07 Oct 2011 - 21:05
    keep up the awesome work in the assembly forums! you're really doing an awesome job!
Page 1 of 1