What if any is the advantage of the write MACRO as against using just plain StdOut
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 (http://www.google.it/search?q=Repetitive+Stress+Injury&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-GB:official&client=firefox-a).
!RSI (http://en.wikipedia.org/wiki/Repetitive_strain_injury) :lol
So it's a physical advantage rather than better code Hmm!
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
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.
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
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.