16-2- 32

Reply

Join Date: Jan 2009
Posts: 17
Reputation: eniwe is an unknown quantity at this point 
Solved Threads: 0
eniwe eniwe is offline Offline
Newbie Poster

16-2- 32

 
0
  #1
May 3rd, 2009
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.
  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.
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 39
Reputation: sysop_fb is an unknown quantity at this point 
Solved Threads: 5
sysop_fb sysop_fb is offline Offline
Light Poster

Re: 16-2- 32

 
0
  #2
May 3rd, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 17
Reputation: eniwe is an unknown quantity at this point 
Solved Threads: 0
eniwe eniwe is offline Offline
Newbie Poster

Re: 16-2- 32

 
0
  #3
May 4th, 2009
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.
  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…
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 129
Reputation: Evenbit is on a distinguished road 
Solved Threads: 4
Evenbit's Avatar
Evenbit Evenbit is offline Offline
Junior Poster

Re: 16-2- 32

 
0
  #4
May 4th, 2009
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
while (CPU is present) {some assembly required}
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 949
Reputation: MosaicFuneral is just really nice MosaicFuneral is just really nice MosaicFuneral is just really nice MosaicFuneral is just really nice MosaicFuneral is just really nice 
Solved Threads: 92
MosaicFuneral's Avatar
MosaicFuneral MosaicFuneral is offline Offline
Posting Shark

Re: 16-2- 32

 
0
  #5
May 4th, 2009
Or with the handle just use WriteConsole() http://www.daniweb.com/code/snippet1165.html Doesn't really matter.
"Jedenfalls bin ich überzeugt, daß der Alte nicht würfelt."
"I became very sensitive to what will happen to all this and all of us." -Two geniuses named Albert
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 17
Reputation: eniwe is an unknown quantity at this point 
Solved Threads: 0
eniwe eniwe is offline Offline
Newbie Poster

Re: 16-2- 32

 
0
  #6
May 5th, 2009
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...
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 17
Reputation: eniwe is an unknown quantity at this point 
Solved Threads: 0
eniwe eniwe is offline Offline
Newbie Poster

Re: 16-2- 32

 
0
  #7
May 5th, 2009
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...
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Assembly Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC