ASM validate user input

26 replies to this topic

#1fresh

New Member

• Members
• 12 posts

Posted 25 August 2004 - 11:15 AM

Hey, I'm looking for a simple user input validation script coded in assembly, I am using TASM as a compiler, btw.. all the example needs to do is validate user input against a variable or whatever.. I have very little experience with assembly but I do know how to code in C++ and VB, so that's a plus.. :)

any help is much appreciated.. thanks ;)

#2anubis

Senior Member

• Members
• 2225 posts

Posted 25 August 2004 - 12:02 PM

what do you mean by script ???
what do you mean by user input validation ?
If Prolog is the answer, what is the question ?

#3fresh

New Member

• Members
• 12 posts

Posted 25 August 2004 - 01:09 PM

ok sorry, I mean example source.. and I am only assuming you can write a COM file via ASM, which can except user input and then validate it.. like a password protection scheme would in any other language.. is that even possible with assembly and if not, what good is ASM?? thanks :)

#4JSoftware

Member

• Members
• 70 posts

Posted 25 August 2004 - 01:15 PM

i didn't get what you wanted.. i would start out with some easier assembler programs.. i haven't figured int 16 keyboard input all out yet!

you could load a string to the si register and make a loop og cmp's and get some validations that way but try to tell a little more detailed what you need!
Peregrinus, expectavi pedos meos in cymbalis!

#5fresh

New Member

• Members
• 12 posts

Posted 25 August 2004 - 01:23 PM

I know what your saying.. but how to code it is were I am at a loss, what type of example would you say would be a good source to start with? I have already done the Hello World! LOL.. I'm looking to work on something more difficult, but something simple of course.. any suggestions or tutorials I can follow? Thanks and sorry about not fully explaining myself the first time ;)

#6JSoftware

Member

• Members
• 70 posts

Posted 25 August 2004 - 01:42 PM

tmp DB 32 dup('?')
succes DB "Access Granted!",0dh,0ah,"$" getkeyin: MOV AH,0CH MOV AL,01H INT 21H CMP AL, 0DH JE process ADD tmp, AL JMP getkeyin process: CMP tmp, pass jne exit mov dx, succes mov ah,09h int 21h exit: mov ah, 00h int 21h try this.. code made for nasm syntax. maybe you need to add some OFFSET's some where or something.. i suppose it works B) Peregrinus, expectavi pedos meos in cymbalis! #7anubis Senior Member • Members • 2225 posts Posted 25 August 2004 - 02:25 PM oooh... now i get what you mean... i was confused by your terminology If Prolog is the answer, what is the question ? #8fresh New Member • Members • 12 posts Posted 25 August 2004 - 04:31 PM thank you very much, even though right now I don't understand it, I now have a good reference to study from.. so thanks alot.. too bad it isn't TASM ready.. because I tried to compile it but it said this: errors: Quote Illegal memory reference Operand types do not match Unexpected end of file encountered and this is my source: .MODEL SMALL .STACK .CODE tmp DB 32 dup('?') pass DB "Password" succes DB "Access Granted!",0dh,0ah,"$"

getkeyin:
MOV   AH,0CH
MOV   AL,01H
INT   21H
CMP AL, 0DH
JE process
JMP getkeyin
process:
CMP tmp, pass
jne exit

mov dx, succes
mov ah,09h
int 21h
exit:
mov ah, 00h
int 21h

I mean I set that up right? Except for the fact that it isn't made to compile in TASM.. other than that I set the source up correctly right? BTW.. I know what you mean by OFFSETS, but I haven't found a understanding of them, any examples?? thanks :)

#9JSoftware

Member

• Members
• 70 posts

Posted 25 August 2004 - 05:21 PM

tmp DB "??????????????????????????????"
succes DB "Access Granted!",0dh,0ah,"$" getkeyin: MOV AH,0CH MOV AL,01H INT 21H CMP AL, 0DH JE process OUT tmp, al JMP getkeyin process: MOV si, tmp CMP SI, pass jne exit mov dx, succes mov ah,09h int 21h exit: mov ah, 00h int 21h try this then Peregrinus, expectavi pedos meos in cymbalis! #10fresh New Member • Members • 12 posts Posted 25 August 2004 - 05:26 PM nope, still no good, here is my errors: Quote Expecting scalar type Operand types do not match Operand types do not match Operand types do not match Unexpected end of file encountered and of course the current attempt: .MODEL SMALL .STACK .CODE tmp DB "??????????????????????????????" pass DB "Password" succes DB "Access Granted!",0dh,0ah,"$"

getkeyin:
MOV   AH,0CH
MOV   AL,01H
INT   21H
CMP AL, 0DH
JE process
OUT tmp, al
JMP getkeyin
process:
MOV si, tmp
CMP SI, pass
jne exit

mov dx, succes
mov ah,09h
int 21h
exit:
mov ah, 00h
int 21h

BTW: I am using TASM.. thanks :)

#11JSoftware

Member

• Members
• 70 posts

Posted 25 August 2004 - 06:08 PM

Peregrinus, expectavi pedos meos in cymbalis!

#12fresh

New Member

• Members
• 12 posts

Posted 25 August 2004 - 06:18 PM

haha ok.. is it free? and where can I get it... know nay links.. I'll search google i guess, thanks man :)

alright, found one, how do I compile with it, I mean what is the syntax to compile and link? I am now using NASM.. ;)

#13Mihail121

Senior Member

• Members
• 1059 posts

Posted 25 August 2004 - 07:05 PM

Ok, i'll said it only one time so be carefull - RTFM. It's one of the most important programming rules and the abreviature stands for: Read The Fucking Manual.

In your case it means simply that you should simply check the docs that come with NASM. All lies there :)

#14davepermen

Senior Member

• Members
• 1306 posts

Posted 25 August 2004 - 07:16 PM

it's called Read The FRIENDLY Manual, Mihail.. at least..... in public area.. :D
davepermen.net
-Loving a Person is having the wish to see this Person happy, no matter what that means to yourself.
-No matter what it means to myself....

#15JSoftware

Member

• Members
• 70 posts

Posted 25 August 2004 - 07:17 PM

make a simple text document: tmp.txt or tmp.asm

then from dos write:
nasm tmp.txt

and you'll get a nice file called: "tmp"
rename it to "tmp.com" or "tmp.exe"

viola!

(you could make some tricks so you don't have to rename but wtf..
Peregrinus, expectavi pedos meos in cymbalis!

#16fresh

New Member

• Members
• 12 posts

Posted 26 August 2004 - 04:31 AM

well NASM didn't come with a Fucking or Friendly manual.. LOL.. so I thought I'd ask.. Alright, I'll try that, and see what happens.. thanks alot guys :)

OK. This code is just not going to work.. lol.. is it missing something?

Quote

File Name:dis
error: attempt to define a local label before any non-local labels
error: parser: instruction expected
error: attempt to define a local label before any non-local labels
error: attempt to define a local label before any non-local labels

.MODEL SMALL
.STACK
.CODE

tmp DB "??????????????????????????????"
succes DB "Access Granted!",0dh,0ah,"\$"

getkeyin:
MOV   AH,0CH
MOV   AL,01H
INT   21H
CMP AL, 0DH
JE process
OUT tmp, al
JMP getkeyin
process:
MOV si, tmp
CMP SI, pass
jne exit

mov dx, succes
mov ah,09h
int 21h
exit:
mov ah, 00h
int 21h

thank you guys :)

P.s. what goes here:

tmp DB "??????????????????????????????"

I mean what goes in place of the ????????????????????? marks.. thanks

#17JSoftware

Member

• Members
• 70 posts

Posted 26 August 2004 - 12:13 PM

nasm doen'st understand the DUP statement.. that's why we have to declare some space for the incomming text to the tmp variable

and you should remove the first 3 lines.. they aren't needed by the assembler linker
Peregrinus, expectavi pedos meos in cymbalis!

#18fresh

New Member

• Members
• 12 posts

Posted 27 August 2004 - 01:46 AM

hey I got the code compiled finally but how do I call the linker.. I looked threw the help file but it didn't specify.. does it compile and link in all one step or is it like TASM, two different steps?

Syntax would be great.. :)

#19JSoftware

Member

• Members
• 70 posts

Posted 27 August 2004 - 04:23 AM

c++ nerd i suppose.. :) NETWIDE assembler code isn't compiled. it's directly linked. you don't have to output object code first

try typing: nasm -o output.exe input.asm

that should do the rename trick
Peregrinus, expectavi pedos meos in cymbalis!

#20fresh

New Member

• Members
• 12 posts

Posted 27 August 2004 - 04:10 PM

yeah can you tell.. lol

BTW: I compiled the code you gave me and for some reason it wont load, I did exactly what you said, but it just wont work, so I gave up on ASM, and went back to C++, atleast for something of this nature.. I still like ASM and want to learn the basics.. so thanks for giving me a head start man, I appreciate your help.. :)

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users