ASM question

Everything else that doesn't fall into one of the other PB categories.
TeddyLM
Enthusiast
Enthusiast
Posts: 133
Joined: Wed Apr 30, 2003 2:04 pm
Location: Germany (French expat)

ASM question

Post by TeddyLM »

Hi all,

how can i use the IN and OUT asm commands within PB ?

(Example)

Procedure ATA_IDENTIFY_DRIVE()
MOV DX, 1F7h
IN AL,DX
EndProcedure

(IN AL,DX is reported as illegal instruction !!
Any idea how to address the IDE controller directly ?)
User avatar
GeoTrail
Addict
Addict
Posts: 2794
Joined: Fri Feb 13, 2004 12:45 am
Location: Bergen, Norway
Contact:

Post by GeoTrail »

Did you enable ASM in the compiler?
I Stepped On A Cornflake!!! Now I'm A Cereal Killer!
TeddyLM
Enthusiast
Enthusiast
Posts: 133
Joined: Wed Apr 30, 2003 2:04 pm
Location: Germany (French expat)

Post by TeddyLM »

Yes

MOV DX, 1F7h is accepted ! (but not IN AL,DX)
VPureBasic
User
User
Posts: 59
Joined: Fri Apr 25, 2003 6:09 pm
Location: Quebec - Canada

Post by VPureBasic »

Hi TeddyLM,

Just and Ideal like that...Maybe the register DX is for WORD value And AL is Byte!

Roger
Everything is possible with PureBASIC... All you're missing is imagination!
TeddyLM
Enthusiast
Enthusiast
Posts: 133
Joined: Wed Apr 30, 2003 2:04 pm
Location: Germany (French expat)

Post by TeddyLM »

Hi VPureBasic

i don't think it's the problem here !
found on the Net :

...
In x86 assembler you use in( ) and out( ) instructions. They move single bytes. There is also inw( ) and outw( ) for moving 16 bit words
The format of the instructions are <instruction name> ( target, source ) Target and source are a port address or data
NOTE: For port addresses below 0x100h you can directly use the port address as a number.
For port addresses above 0xffh you have to load the address into the DX register
Examples:
mov dx, 379h
in al, dx (Reads port 0x379h -LPT1 status register- into al register)
...
Pupil
Enthusiast
Enthusiast
Posts: 715
Joined: Fri Apr 25, 2003 3:56 pm

Post by Pupil »

Have you tried to pass it directly to FASM by using the '!' operator, like this:

Code: Select all

! mov dx, 1f7h
! in al, dx
TeddyLM
Enthusiast
Enthusiast
Posts: 133
Joined: Wed Apr 30, 2003 2:04 pm
Location: Germany (French expat)

Post by TeddyLM »

Yes

nothing changed !
Are these commands prohibited in FASM for windows ?
Pupil
Enthusiast
Enthusiast
Posts: 715
Joined: Fri Apr 25, 2003 3:56 pm

Post by Pupil »

Ok, i missunderstood you, i thought that the compiler complained. I'm pretty sure that on win2k & XP you're not allowed to mess directly with a port, be it com or lpt, you must do it through a driver.
dell_jockey
Enthusiast
Enthusiast
Posts: 767
Joined: Sat Jan 24, 2004 6:56 pm

Post by dell_jockey »

Pupil wrote:I'm pretty sure that on win2k & XP you're not allowed to mess directly with a port, be it com or lpt, you must do it through a driver.
That's correct.
cheers,
dell_jockey
________
http://blog.forex-trading-ideas.com
TeddyLM
Enthusiast
Enthusiast
Posts: 133
Joined: Wed Apr 30, 2003 2:04 pm
Location: Germany (French expat)

Post by TeddyLM »

looks like i'll have to use CreateFile and DeviceIOControl API functions !

thanks for the help anyway

Did somebody write something to get access to device sectors ?
dell_jockey
Enthusiast
Enthusiast
Posts: 767
Joined: Sat Jan 24, 2004 6:56 pm

Post by dell_jockey »

Check out http://www.purearea.net/ and search for "IO_DLL_WRAPPER".
cheers,
dell_jockey
________
http://blog.forex-trading-ideas.com
TeddyLM
Enthusiast
Enthusiast
Posts: 133
Joined: Wed Apr 30, 2003 2:04 pm
Location: Germany (French expat)

Post by TeddyLM »

That's interresting !

Thank you
Post Reply