943,723 Members | Top Members by Rank

Ad:
  • Assembly Discussion Thread
  • Unsolved
  • Views: 624
  • Assembly RSS
May 3rd, 2009
0

16-2- 32

Expand Post »
Learning assembly and 'am trying to move from 16-bit to 32-bit.
i have this assembly code to display a string in a message box.
Assembly Syntax (Toggle Plain Text)
  1. ;tasm32/tlink32
  2. .386
  3. .model flat
  4. extrn MessageBoxA:proc
  5. extrn ExitProcess:proc
  6.  
  7. .data
  8. head db " 'Heard melodies are sweet,",0
  9. body db " but those unheard Are sweeter;'",0
  10.  
  11. .code
  12. begin:
  13. push 0
  14. push offset head
  15. push offset body
  16. push 0
  17. call MessageBoxA
  18.  
  19. push 0
  20. call ExitProcess
  21. end begin
How do i get the very string displayed in command line without using the api MessageBoxA ; what would be the assembly code like? Please give a suggestion, probably i could get going from there.
thank you.
Last edited by eniwe; May 3rd, 2009 at 11:09 pm.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
eniwe is offline Offline
17 posts
since Jan 2009
May 3rd, 2009
0

Re: 16-2- 32

If I'm understanding you correctly you just want to print the string to command line without using the o/s api MessageBox?
Well let's see you could use the interrupt interface; a quick google search for dos print interrupt or the like should lead you to a multitude of tutorials.
You could also just print directly into the video buffer, once again lots of tutorials available and will take a little bit more thinking on your part.
Last edited by sysop_fb; May 4th, 2009 at 12:09 am.
Reputation Points: 57
Solved Threads: 5
Light Poster
sysop_fb is offline Offline
42 posts
since Apr 2009
May 4th, 2009
0

Re: 16-2- 32

Quote ...
If I'm understanding you correctly you just want to print the string to command line without using the o/s API MessageBox?
Well let's see you could use the interrupt interface
int 21h DOS interrupt, displays a message on the screen out of a .com file.
Assembly Syntax (Toggle Plain Text)
  1. org 100h
  2. mov ah, 9h
  3. mov dx, offset msg
  4. int 21h
  5. msg db "Thanks you... $"
if you imply the above DOS Function Code pattern by the term ’interrupt interface‘ , iam afraid, that, they are/may not be compatible with 32-bit programming environment; also with processor .386 (as specified as the directive in the code).

However, i thank you for taking the time to respond to my uncertainty.

Regards…
Reputation Points: 10
Solved Threads: 0
Newbie Poster
eniwe is offline Offline
17 posts
since Jan 2009
May 4th, 2009
0

Re: 16-2- 32

To write text to the console, first use GetStdHandle:

http://msdn.microsoft.com/en-us/libr...31(VS.85).aspx

Use that to get the handle for the StdOut device. Then you can use this handle in a call to WriteFile:

http://msdn.microsoft.com/en-us/libr...47(VS.85).aspx

There are some tutotials and examples:

http://www.deinmeister.de/wasmtute.htm

http://win32assembly.online.fr/index.html
Reputation Points: 99
Solved Threads: 5
Junior Poster
Evenbit is offline Offline
140 posts
since Mar 2005
May 4th, 2009
0

Re: 16-2- 32

Or with the handle just use WriteConsole() http://www.daniweb.com/code/snippet1165.html Doesn't really matter.
Reputation Points: 888
Solved Threads: 114
Nearly a Posting Virtuoso
MosaicFuneral is offline Offline
1,270 posts
since Nov 2008
May 5th, 2009
0

Re: 16-2- 32

Evenbit..

i haven’t tried to do it yet...but 'am more or less certain the direction, that you have pointed out, is the right one with those helpful links and suggestions passed on.
Thank you.
regards...
Reputation Points: 10
Solved Threads: 0
Newbie Poster
eniwe is offline Offline
17 posts
since Jan 2009
May 5th, 2009
0

Re: 16-2- 32

MosaicFuneral...

The accompanying information you have provided is appreciated and
such useful additional tips make learning more meaningful and satisfying.

After crossing this initial barrier, i like to go to ‘find matching file’.
Thank you.

regards...
Reputation Points: 10
Solved Threads: 0
Newbie Poster
eniwe is offline Offline
17 posts
since Jan 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Assembly Forum Timeline: Assembly fatal ........
Next Thread in Assembly Forum Timeline: XY position





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC