Re: [ASM] OUT on XP
- From: Frank Kotler <fbkotler@xxxxxxxxxxx>
- Date: Tue, 27 Mar 2007 09:53:00 GMT
Rémy wrote:
Hello,
I have an old ms-dos software running on DOS and XP, but on XP the serial com don't work...
I have a piece of code who i think can't run on XP
I think you're right. XP "emulates" dos... it won't let you near ports. In Linux, we have the same "problem", but can get around it with sys_iopl... I *think* there's a "give_io.dll" (or similar name) which *may* let you at those ports in XP. (XP *may* not block all ports - it blocks some we could use in Win98)
If you just want to get old dos code running, boot real dos, if that's an option. If you want to use the serial port in XP, look for an appropriate API to do the job.
(sorry for my bad english) :
Not a problem. The CPU doesn't speak English :)
<code>
vide_port proc far
PUSH BP
PUSH DS
push ax
push dx
mov dx,ad_pcom
IN AL,DX
IN AL,DX
pop dx
pop ax
POP DS
POP BP
RET
vide_port endp
</code>
what do you think about it ?
I don't understand what it's supposed to do. You save/restore dx - that makes sense. You save/restore bp and ds, which don't appear to be modified. You save/restore ax... which is where I would expect you'd return some "result"... In essence, this code reads two bytes from some port - we don't see what "ad_pcom" is - without first determining that there's "valid" data available... but it doesn't matter 'cause we throw 'em away anyway.
how can I modify it
Change it to just "ret"? :)
Seriously, you probably want to remove the "push ax" and "pop ax" (both!!!)... then at least you'll be returning the second of the two bytes read to the caller. "What next" depends on what you're trying to do. Typically, we need to read ("in") a byte from a "status" port and test some bit, looping until it's set or cleared indicating "data ready". Then read ("in") from a "data" port... maybe do something further, maybe just return the byte we read.. Might want to write ("out") a command or two, to set up the port the way we want, before we even start.
(i don't know very well asm)...
Well, messing with ports isn't the easiest thing to start with - *especially* under XP.
thank you for suggestion
If starting with something "easier" and working your way up will suit you, that's what I'd suggest. If you need/want to get *this* particular program going... I'd suggest booting to real dos, or writing a win32 "equivalent" to it. If you really need/want to meddle with ports under XP... I think it *is* possible, but not a "beginner project".
Tell us more about what you need/want to do!
Best,
Frank
.
- Follow-Ups:
- Re: [ASM] OUT on XP
- From: Rémy
- Re: [ASM] OUT on XP
- References:
- [ASM] OUT on XP
- From: Rémy
- [ASM] OUT on XP
- Prev by Date: Re: Arithmetic shift right
- Next by Date: Re: ascii to tword - help
- Previous by thread: Re: [ASM] OUT on XP
- Next by thread: Re: [ASM] OUT on XP
- Index(es):
Relevant Pages
|
|