New to using MASM32, with very tiny bit of understanding with assembly language.
There's a whole story of what I've tried, but the bottom line, can't get this code to work:
main proc
mov dx, 0cf8h
mov eax, 80000090h
out dx,eax
mov dx, 0cfch
in eax,dx
.if eax == 31504d44h
print "S"
.elseif eax == 32504d44h
print "D"
.elseif eax == 33504d44h
print "M"
.else
print "0"
.endif
ret
main endp
hardware I/O instructions (IN, OUT, INS, OUTS) are not permited in user mode under NT operating systems
they are generally permitted in 16-bit real mode, however (some may be emulated by the NT OS)
16-bit can't use eax, is that correct ?
What's the alternative ? any ?
Hi,
Quote from: mocallins on January 03, 2016, 09:55:41 AM
16-bit can't use eax, is that correct ?
No, that is incorrect. 16-bit code for MS-DOS can use 32-bit
registers. See the .386 directive and the USE16 parameter for
the SEGMENT directive.
QuoteWhat's the alternative ? any ?
I have not done this, so I may be mistaken, but you can load
a driver that will allow you to us the I/O instructions.
HTH,
Steve N.
Hmmmm, so I went and looked where I got the assembly code example, that I modified and tried in masm32.
No wonder there's no example for WES2009.
There are examples for DOS, Linux and Windows CE.
Windows CE probably doesn't have the restrictions, like Windows XP, restrictions to accessing hardware directly.
Hmmmmm :(
Ok, so I found a utility that allows my program to run without exception.
And since I used the print command, in a console, I can see that its printing the correct value.
Now since I will call this masm program, how can I get it to return the value its printing, to the calling program ?
it is likely to be in the EAX register
this is the standard (windows ABI) method of returning results or status
Yep, that's what all the examples I've found, show to use.
Here's what its currently set at, trying to use the pointer to the location in EAX:
.if eax == 31504d44h
print "S",13,10
STRING varS,"S"
mov eax, OFFSET varS
hasn't helped :(