Hi! Basically I'm receiving user input, storing it in a buffer, and then (so far) testing the first of the three digit combination. However, when I CMP the first digit to the first number in the correct serial code it always tell me that I've entered the wrong serial code, even though printing that first digit yields '2'?
Here's the complete code:

org 100h

jmp _start

welcome_msg db "Please enter your serial code: ", "$"
fail_msg db "Wrong serial code!", "$"
success_msg db "Thank you for CRACKING this software!", "$"
serial db 0, 0, 0

fail:
    mov ah, 09h
    lea dx, [fail_msg]
    int 21h
    ret
_start:
    mov ah, 09h
    lea dx, [welcome_msg]
    int 21h
    lea bx, [serial]
get_user_input:
    xor ax, ax
    int 16h
    mov ah, 02h
    mov dl, al
    int 21h
    mov [bx], al
    add bx, 1
    cmp al, 13
    jne get_user_input
confirm:
    mov ah, 02h
    mov dl, 0ah
    int 21h
    cmp byte [serial], 02h
    jne fail
success:
    mov ah, 09h
    lea dx, [success_msg]
    int 21h
    ret

And by the way, before you accuse me of anything, check out this thread: http://www.daniweb.com/software-development/assembly/threads/377671
Also (not my number one priority right now) can anyone tell me why it is that when I enter a 3+ digit combination it crashes, and the 16-bit MS-DOS Subsystem informs me that the CPU has encountered an illegal instruction?

Recommended Answers

All 2 Replies

02h is a control character, not the numeric value of '2'. What you're looking for is 32h.

Thanks a lot Narue! :) ARRRGHH! How could I forget?! And the crash was just a result of me trying to access serial + 3 and thereby going outside the boundaries of the array.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.