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

Reputation: 900 Master
Group:
Moderators
Active Posts:
2,475 (1.63 per day)
Joined:
28-March 11
Profile Views:
59,426
Last Active:
User is offline May 22 2015 08:17 PM
Currently:
Offline

Previous Fields

Country:
US
OS Preference:
Linux
Favorite Browser:
Opera
Favorite Processor:
AMD
Favorite Gaming Platform:
Classic
Your Car:
Who Cares
Dream Kudos:
1650
Expert In:
Assembly

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: MASM-Irvine32: Array elements get overwritten, completely stumped...

    Posted 2 May 2015

    It's almost 1 am, I will write a good reply that should help you, in about 9 or so hours.
  2. In Topic: MASM-Irvine32: Array elements get overwritten, completely stumped...

    Posted 2 May 2015

    That is because you are using the same buffer (address) for all of the reads. There are a few ways to do this, how do you thing it can be done using a different buffer address for each new ReadString? Then do the same thing for WriteString.
  3. In Topic: i dont understand how to print a value from a procedure in masm

    Posted 24 Apr 2015

    Your variables num1 and num2 are declared wrong. Your declaring them as WORDS (DW = Define WORD), instead you should define them as doublewords (DD = Define DOUBLEWORD).
  4. In Topic: [NASM] C functions on project problem

    Posted 31 Mar 2015

    First off a 64 bit System has well, 64 bit libraries. Since the calling conventions and other things are different, you will need to install the 32bit libraries. Not at a computer so can't gives you my links, but search for and install gcc-multiarch (I think that is what it is called)

    Next, it really isn't an exe without a loader, since you are using ld instead of gcc, you need to tell ld what loader to use. (search for ld 32bit loader on 64 bit Linux)

    Don't use start as your entry point, just use main and make it global.

    Your variables and externs should not be in the text section!

    Lines 3 and 5 should be in the .data section
    Line 4 should be in the .bss section
    Lines 6 and 7 should not be in any archon.
  5. In Topic: 8086 RET Not working

    Posted 25 Mar 2015

    Quote

    The program works fine

    No, you cannot say it works fine if there are issues with it.

    Let me see if I understand what you want to do. You want to take the user input until the carriage return is pressed, and store each character entered? Then, loop through each character of the entered password, and the password that is hard coded into the program and see if they are the same?

    I need to ask, why are you learning ancient 16 bit DOS Assembly?

    Also, please learn to comment your code!

    Let's walk through your code and see what is going on...

    15 MOV AH, 01H
    16 INT 21H
    17
    18 CMP AL, 13
    19 JE END_INPUT
    20
    21 MOV [SI], AL
    22 ADD SI, 1
    23 JMP INPUT
    24 END_INPUT:

    I am not going to check to see if this is the correct interrupt for this task, I will take your word for it.

    So, you get a character typed and check to see if it is a return, if it is, we jump to end_input. If it is not, then we move this character into a buffer pointer to by si and then increment this pointer by 1. WAIT!!!! You have not initialized si with a pointer to a buffer! I am surprised your program did not bomb here.

    Explain what you are doing here:
    26 ADD SI, 1
    27 MOV [SI], 24H
    28 MOV SI, 0

    What you think it is doing and what it is doing are 2 different things.
    What it is doing is:
    On line 26, you are incrementing the imaginary pointer.
    On line 27 you are moving the $ character into the end of this buffer pointed to by si.
    On line 28, you basically zeroed out the pointer.

    Look at this:
    28 MOV SI, 0
    29
    30 CHECK_STRING:
    31 MOV AL, PASSWORD[SI]
    32 CMP AL, [SI]

    Look at it very carefully. Out loud, say to yourself what the code is doing.

    On line 28 I am zeroing out si
    On line 31, I am taking a character from the PASSWORD array indexed by si
    On line 32, I am comparing that character in al, with whatever pointer is in si, which is none.

    Oh hell, I will just give you an example. No, not an example that will finish your homework, but it should guide you in the right direction. It will be from this century and using Linux and NASM.

    %include "../../include/syscalls64.inc"
    ;%define INPUT_LEN 12
    
    section .data
    szPassword      db  "HELLO HUMAN"
    INPUT_LEN       equ $ - szPassword
    
    szEqual         db  `String is OK!\n`
    szEqual_Len     equ $ - szEqual
    szNotEqual      db  `String not OK!!!\n`
    szNotEqual_Len equ $ - szNotEqual
    
    section .bss
    lpBuffer        resb INPUT_LEN + 1
    
    global main
    section .text
    main:
    
        
    .GetInput:
        mov     r15, 0                          ; zero loop counter
        mov     r14, lpBuffer                   ; buffer to store input
        
    .GetChar:
        mov     rdx, 1                          ; read 1 character
        lea     rsi, [rsp]                      ; use stack as temp char buffer
        mov     rdi, stdin                      ; 
        mov     rax, sys_read                   ; 
        syscall                                 ; 
    
        cmp     byte [rsp], 10                  ; input done?
        je      .EndInput                       ; yes
        
        mov     al, byte [rsp]                  ; store char 
        mov     [r14 + r15], al                 ; to our buffer
        add     r15, 1                          ; increament our loop counter
        jmp     .GetChar
        
    .EndInput:
        mov     r15, 0                          ; zero counter/pointer index
        mov     r13, szPassword                 ; get pointer to password string
    
    .Compare:
        mov     al, [r13 + r15]                 ; get char from password string
        cmp     [r14 + r15], al                 ; compare it with char from entered string
        jne     .NoMatch                        ; if no equal, quit loop and inform user
        add     r15, 1                          ; increament counter
        cmp     r15, INPUT_LEN - 1              ; make sure we don't read past our buffer end
        jle     .Compare
    
        mov     rdx, szEqual_Len                                   
        mov     rsi, szEqual
        jmp     done
    
    .NoMatch:
        mov     rdx, szNotEqual_Len                                   
        mov     rsi, szNotEqual
        
    done:
        mov     rdi, stdout
        mov     rax, sys_write                  
        syscall    
        
        mov     rdi, 0
        mov     rax, sys_exit
        syscall
    
    

My Information

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

Contact Information

E-mail:
Click here to e-mail me
Website URL:
Website URL  http://www.gunnerinc.com
Skype:
Skype  gunner.inc
Facebook:
http://www.facebook.com/gunnerinc

Comments

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