ASM validate user input
#1
Posted 25 August 2004 - 11:15 AM
any help is much appreciated.. thanks ;)
#2
Posted 25 August 2004 - 12:02 PM
what do you mean by user input validation ?
#3
Posted 25 August 2004 - 01:09 PM
#4
Posted 25 August 2004 - 01:15 PM
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!
#5
Posted 25 August 2004 - 01:23 PM
#6
Posted 25 August 2004 - 01:42 PM
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
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)
#7
Posted 25 August 2004 - 02:25 PM
#8
Posted 25 August 2004 - 04:31 PM
errors:
Quote
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
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
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 :)
#9
Posted 25 August 2004 - 05:21 PM
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
try this then
#10
Posted 25 August 2004 - 05:26 PM
Quote
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 :)
#11
Posted 25 August 2004 - 06:08 PM
#12
Posted 25 August 2004 - 06:18 PM
alright, found one, how do I compile with it, I mean what is the syntax to compile and link? I am now using NASM.. ;)
#13
Posted 25 August 2004 - 07:05 PM
In your case it means simply that you should simply check the docs that come with NASM. All lies there :)
#14
Posted 25 August 2004 - 07:16 PM
-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....
#15
Posted 25 August 2004 - 07:17 PM
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..
#16
Posted 26 August 2004 - 04:31 AM
OK. This code is just not going to work.. lol.. is it missing something?
Quote
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 "??????????????????????????????" 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
thank you guys :)
P.s. what goes here:
tmp DB "??????????????????????????????"
I mean what goes in place of the ????????????????????? marks.. thanks
#17
Posted 26 August 2004 - 12:13 PM
and you should remove the first 3 lines.. they aren't needed by the assembler linker
#18
Posted 27 August 2004 - 01:46 AM
Syntax would be great.. :)
#19
Posted 27 August 2004 - 04:23 AM
try typing: nasm -o output.exe input.asm
that should do the rename trick
#20
Posted 27 August 2004 - 04:10 PM
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












