News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

write macro

Started by Neil, July 05, 2010, 06:02:50 PM

Previous topic - Next topic

Neil

What if any is the advantage of the write MACRO as against using just plain StdOut

jj2007

Quote from: Neil on July 05, 2010, 06:02:50 PM
What if any is the advantage of the write MACRO as against using just plain StdOut
It avoids Repetitive Stress Injury.

oex

We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

Neil

So it's a physical advantage rather than better code Hmm!

Neil

Getting a bit more serious I have number of strings  each one having its own label, the list of labels (Addresses) will be be put in a list & esi will be used as a pointer to one of the labels something like this :-

txt1 db "some text",0
txt2 db "some text",0
txt3 db "some text",0
txt4 db "some text",0

List DD txt1
      DD txt2
      DD txt3
      DD txt4

Is it feasable to then use Invoke StdOut,esi

Tedd

Most things are feasible, but that doesn't mean they're sensible :lol

Use GetStdHandle to get STD_OUTPUT_HANDLE, save it, and then use that as the file handle in WriteFile and write each string as you get its pointer.
No snowflake in an avalanche feels responsible.

jj2007

include \masm32\include\masm32rt.inc

.data
List DD txt1, txt2, txt3, txt4, 0
txt1 db "some text A",0
txt2 db "some text B",0
txt3 db "some text C",0
txt4 db "some text D",0

.code
start: mov esi, offset List
.Repeat
lodsd
.Break .if !eax
print eax, 13, 10
.Until 0
inkey "We are done"
exit

end start


Now if you want to see nice little StdOut, pardon: WriteFile calls, run the exe with Olly :bg

Neil

Thanks for your suggestions, I'll do some tests when I've written some more code, I'm in the planning stage at the moment.