The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: MBeckford05 on April 02, 2008, 11:53:13 AM

Title: Writing a program to input and Output a Name
Post by: MBeckford05 on April 02, 2008, 11:53:13 AM
Hi everyone,

Newbie.  Please how would I go about writing a program to input output a persons name.

I am new to Masm32.

Running Windows XP,Pentium 4, 2megabyte of RAM.


Thank you.

Title: Re: Writing a program to input and Output a Name
Post by: Tedd on April 02, 2008, 12:08:31 PM
1. Write a program that does nothing.
2. Modify it so it prints a message.
3. Add in code to allow someone to type in some letters.
4. Print the letters that were typed instead of the inane message.

So first you need to learn how to write a program :wink
Title: Re: Writing a program to input and Output a Name
Post by: Vortex on April 02, 2008, 05:34:42 PM
Hi MBeckford05,

Welcome to the forum. You should make an effort to study the documentation supplied with Masm32.

Here is an example :

include     InputOutputName.inc

SIZE_OF_BUFFER = 100

.data
output1     db 'Please type your name : ',0
output2     db 13,10,'Your name is %s',0

.data?
buffer      db SIZE_OF_BUFFER dup(?)

.code

start:

    invoke  crt_printf,ADDR output1
    invoke  StdIn,ADDR buffer,SIZE_OF_BUFFER
    invoke  crt_printf,ADDR output2,ADDR buffer
    invoke  ExitProcess,0

END start

[attachment deleted by admin]
Title: Re: Writing a program to input and Output a Name
Post by: MBeckford05 on April 02, 2008, 09:07:24 PM
Thank you. I will look at the documentation that goes with masm32.

MBeckford05.