If you're reading this and you're not me, you're not self. But anyhow, I'm going to try installing Ubuntu on my laptop, so I'm "backing up" all the useful code I have written right now.. which is nothing but this:
[ORG 0x100]
; strings
cdkey db '0000000000003','$'
valid db 'Valid!',0x0d,0x0a,'$'
invalid db 'Invalid!',0x0d,0x0a,'$'
MOV ECX, cdkey
CALL IS_VALID
CMP EAX, 0
JNZ Valid
JE Invalid
Valid:
MOV DX, valid
JMP Print
Invalid:
MOV DX, invalid
JMP Print
Print:
MOV AH, 9
INT 0x21
Exit:
MOV AH, 0x4C
INT 0x21
IS_VALID:
MOV EAX, 3
MOV ESI, ECX
MOV EBP, EDX
XOR ECX, ECX
Top:
MOVSX EAX, BYTE [ECX+ESI]
SUB EAX, 0x30
LEA EDI, [EAX+EAX]
XOR EDX, EDI
ADD EAX, EDX
INC ECX
CMP ECX, 0x0c
JL Top
XOR EDX, EDX
MOV EDX, 0x0a
DIV ECX
MOVSX EDX, BYTE [ESI+0x0c]
MOVSX EDX, DL
ADD EDX, 0x30
CMP EAX, EDX
JNZ Fail
MOV EAX, 1
Fail:
MOV EAX, 0
RET