DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Assembly (http://www.daniweb.com/forums/forum125.html)
-   -   16-2- 32 (http://www.daniweb.com/forums/thread190227.html)

eniwe May 3rd, 2009 11:03 pm
16-2- 32
 
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.
;tasm32/tlink32
.386
      .model flat
      extrn  MessageBoxA:proc
      extrn ExitProcess:proc

.data
      head  db  " 'Heard melodies are sweet,",0
      body  db  " but those unheard Are sweeter;'",0

.code
      begin:
      push 0
      push offset head
      push offset body
      push 0
      call MessageBoxA
     
      push 0
      call ExitProcess
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.

sysop_fb May 3rd, 2009 11:43 pm
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.

eniwe May 4th, 2009 3:24 am
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.
 org 100h
  mov ah, 9h
  mov dx, offset msg
  int 21h
  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…

Evenbit May 4th, 2009 6:28 pm
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

MosaicFuneral May 4th, 2009 7:00 pm
Re: 16-2- 32
 
Or with the handle just use WriteConsole() http://www.daniweb.com/code/snippet1165.html Doesn't really matter.

eniwe May 5th, 2009 1:23 am
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...

eniwe May 5th, 2009 1:27 am
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...


All times are GMT -4. The time now is 7:47 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC