Hi all,
I have 2 questions:
1) Can I run an asm programs in DOS if I do not make any Windows related references in it?
2) How can I use the IN and OUT instructions withouth being canceled for using privileged instructions?
Thanks,
Firmo
I have 2 questions:
1) Can I run an asm programs in DOS if I do not make any Windows related references in it?
2) How can I use the IN and OUT instructions withouth being canceled for using privileged instructions?
Thanks,
Firmo
Hi firmo,
QUESTION 2)
You can't. To access serial port you can use API-function CreateFile and ReadFile.
For Example:
; Initialized data ================================
.data
;The DCB structure defines the control setting for a serial communications device
dcb DCB <>
;The COMMTIMEOUTS structure is used to set and query the time-out parameters for a communications device
TO COMMTIMEOUTS <>
.code
; Connect to commport=============================
mov dcb.BaudRate,4800
mov dcb.ByteSize,8
mov dcb.Parity,0
mov dcb.StopBits,0
mov TO.ReadTotalTimeoutConstant,2000 ;2 sek
INVOKE CreateFile,SADD('COM1'),GENERIC_READ,NULL,NULL,OPEN_EXISTING,NULL,NULL
mov hComm,eax
; Reading from commport==========================
INVOKE ReadFile,hComm,pMemory,MEMSIZE,ADDR nBits,NULL
; Timeout ?======================================
mov eax,pMemory
mov eax,
cmp al,0
je @stop
I hope this example can be of any help for you,
Regards
QUESTION 2)
You can't. To access serial port you can use API-function CreateFile and ReadFile.
For Example:
; Initialized data ================================
.data
;The DCB structure defines the control setting for a serial communications device
dcb DCB <>
;The COMMTIMEOUTS structure is used to set and query the time-out parameters for a communications device
TO COMMTIMEOUTS <>
.code
; Connect to commport=============================
mov dcb.BaudRate,4800
mov dcb.ByteSize,8
mov dcb.Parity,0
mov dcb.StopBits,0
mov TO.ReadTotalTimeoutConstant,2000 ;2 sek
INVOKE CreateFile,SADD('COM1'),GENERIC_READ,NULL,NULL,OPEN_EXISTING,NULL,NULL
mov hComm,eax
; Reading from commport==========================
INVOKE ReadFile,hComm,pMemory,MEMSIZE,ADDR nBits,NULL
; Timeout ?======================================
mov eax,pMemory
mov eax,
cmp al,0
je @stop
I hope this example can be of any help for you,
Regards
Question 1: :stupid:
Question 2: Depends on your linker; there is an linker on the download page that will allow you to use MASM32 for dos projects.
Question 2: Depends on your linker; there is an linker on the download page that will allow you to use MASM32 for dos projects.
#2: Well... it depends....
Under W95/8, certain I/O addresses (such as the COM ports) are virtualized, so you need a VxD to access them.
However, other I/O addresses not so virtualized you can bang freely with IN and OUT instructions. I've done so many times when accessing an 8255 based I/O card (which gives you 3 bytes of either IN or OUT physical electrical lines).
Under any of the NT variants, all I/O is virtualized, and you need an appropiate driver. WinIO (freeware package)can be very helpful here.
Under W95/8, certain I/O addresses (such as the COM ports) are virtualized, so you need a VxD to access them.
However, other I/O addresses not so virtualized you can bang freely with IN and OUT instructions. I've done so many times when accessing an 8255 based I/O card (which gives you 3 bytes of either IN or OUT physical electrical lines).
Under any of the NT variants, all I/O is virtualized, and you need an appropiate driver. WinIO (freeware package)can be very helpful here.
Hi guys,
First of all thanks for the replies.
However, since posting my questions I read somewere that using .386P (instead of just .386) would give one access to privileged instructions.
I guess thats not true then!
Best, Firmo
First of all thanks for the replies.
However, since posting my questions I read somewere that using .386P (instead of just .386) would give one access to privileged instructions.
I guess thats not true then!
Best, Firmo
Typing .386p will allow MASM to assemble them without errors, but windows still won't let them run so it terminates your program :)
Thanks Qweerdy.
I will eventually learn all these details.
Best, Firmo
I will eventually learn all these details.
Best, Firmo
INVOKE CreateFile,SADD('COM1'),GENERIC_READ,NULL,NULL,OPEN_EXISTING,NULL,NULL
SADD macro?????
SADD macro?????
korte,
The SADD macro returns an address for the string 'COM1'
You could just as easily use addr szCom1
where szCom1 is a string defined in your data section
szCom1 db 'COM1', 0
farrier
The SADD macro returns an address for the string 'COM1'
You could just as easily use addr szCom1
where szCom1 is a string defined in your data section
szCom1 db 'COM1', 0
farrier
thanx
how to help and list of macros masm32 macros.asm file?
how to help and list of macros masm32 macros.asm file?