Author Topic: send characters through serial port  (Read 24600 times)

Mac

  • Guest
send characters through serial port
« on: July 20, 2007, 11:52:00 PM »
how can i use inport/outport from C in nasm?

nobody

  • Guest
Re: send characters through serial port
« Reply #1 on: July 21, 2007, 04:38:42 AM »
I don't know what "inport" and "outport" are. C functions, I suppose? Push the value, push the port (or perhaps other-way-around), and call 'em, I suppose. Strikes me as a very foolish thing to do. Why not use "in" and "out"?

mov dx, 3F8h
mov al, 42
out dx, al

or for ports under 3FFh (?), you can:

mov al, 42
out 3F8h, al

Unless you're in real mode, the OS may have something to say about whether you can actually access the port...

Best,
Frank

nobody

  • Guest
Re: send characters through serial port
« Reply #2 on: July 24, 2007, 01:22:57 AM »
> or for ports under 3FFh (?), you can:
> mov al, 42
> out 3F8h, al

It's ^^^ up to $FF only, not $03FF, IIRC ;-)

> Unless you're in real mode, the OS may have something to
> say about whether you can actually access the port...

Right. You should not access ports except:

1. You are writing a great "driver" and have permission to access ports (experts only)
or
2. You know what DOS is (!!! - note that XP or Vi$ta is NOT DOS and don't have DOS !!!), have DOS (!!!) and are in DOS (!!!) ;-)

nobody

  • Guest
Re: send characters through serial port
« Reply #3 on: July 24, 2007, 01:23:37 AM »
or
3. You're coding an OS ;-)