flat assembler
Message board for the users of flat assembler.

Index > DOS > Trying to make a program that stores your name and Password

Author
Thread Post new topic Reply to topic
Vertex78



Joined: 22 Feb 2004
Posts: 12
Vertex78
I am trying to make a simple program that stores your name and password. So far it works fine up till it tries to display the name you typed back onto the screen. Here's my code:

Code:
org 256

mov ah,9
mov dx,greeting ;enter your name

int 21h
mov dx,buffer ;buffer for keyboard
mov [name],dx  ; stores name
mov ah,0Ah
int 21h

mov dx,greeting2 ;enter your password
mov ah,9
int 21h

mov dx,buffer ;buffer for keyboard

mov [password],dx  ;stores password
mov ah,0Ah
int 21h

mov dx,greeting3  ;re-enter password
mov ah,9
int 21h

mov dx,buffer ;buffer for keyboard
mov ah,0Ah
int 21h

mov dx,greeting4  ; welcome message
mov ah,9
int 21h

mov dx,[name+24h]
mov ah,9
int 21h
int 20h

newline db 10,13,'',24h
msg db 10,13,'testline',24h
greeting db 'What is your name?',24h
greeting2 db 10,13,'Choose a Password:',24h
greeting3 db 10,13,'Enter your password for verification:',24h
greeting4 db 10,13,'Welcome',24h
name dw 80h,0
     rw 80h
password dw 80h,0
         rw 80h
buffer db 80h,0
       rb 80h                
    


thanks for the help
Post 22 Feb 2004, 18:39
View user's profile Send private message Reply with quote
Tommy



Joined: 17 Jun 2003
Posts: 489
Location: Norway
Tommy
Here's some procedures to use (click "Simple DOS I/O procedures"): http://www.microasm.net/prog/index.php Wink
Post 22 Feb 2004, 18:53
View user's profile Send private message Visit poster's website Reply with quote
Bitdog



Joined: 18 Jan 2004
Posts: 97
Bitdog
Do a www.google.com search for Ralf Browns interrupt list and download
all the files INTER A-Z (P?) .ZIP
and look up INT 21h function AH=0x0A
the buffered input requires DS:DX point to a buffer that starts with
the first byte being the buffers max size, then INT 21h AH=10
loads your key presses into the DS:DX buffer,
at that point it is up to you the programmer to do something with it,
you are saveing the address of the buffer,
then over writting the buffer with more input.

mov dx,buffer ;buffer for keyboard ;---THIS LOADS DX with the adr of buffer
mov [password],dx ;stores password ; THIS moves the buff adr offset word into the first two bytes of what ever is at the label, "password"

There just isn't anything to print when it's time to print.

Might I suggest that you just move DX=adr of a different buffer each time.
Code:
 MOV DX,NAME
 MOV AH,0x0A
 INT 21h

 MOV DX,PASSWORD
 MOV AH,0x0A
 INT 21h

 MOV DX,BUFFER
 MOV AH,0x0A
 INT 21h

;then use that data.
    

I hope that helped some how.
Post 22 Feb 2004, 18:58
View user's profile Send private message Reply with quote
Vertex78



Joined: 22 Feb 2004
Posts: 12
Vertex78
Bitdog - Tommy, thanks for the info, i realize what i was doing wrong now. I am new to assembly and this board but it's nice to see that the members here don't mind helping out the newbs. Thanks!
Post 22 Feb 2004, 23:06
View user's profile Send private message Reply with quote
Tommy



Joined: 17 Jun 2003
Posts: 489
Location: Norway
Tommy
You're welcome! Wink
Post 23 Feb 2004, 09:18
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.