Re: [ASM] OUT on XP



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
.



Relevant Pages

  • Re: [ASM] OUT on XP
    ... I have an old ms-dos software running on DOS and XP, ... Because XP don't let you get a direct acces of the serial ports, only DOS ... PUSH BP ...
    (alt.lang.asm)
  • Re: [ASM] OUT on XP
    ... I have an old ms-dos software running on DOS and XP, ... PUSH BP ... XP doesn't allow you to directly access hardware. ...
    (alt.lang.asm)
  • [ASM] OUT on XP
    ... I have an old ms-dos software running on DOS and XP, ... PUSH BP ...
    (alt.lang.asm)
  • Re: Need Some Syntax Clarification (NASM)
    ... This assigns a word comprised of 10 to the variable port. ... If I want to push 10 onto the stack, ... In Linux, Nasm assembles that without complaint, but ld warns that it's truncated. ... With an "assembler", *we* have to choose appropriate instructions, so the assembler has less need to know. ...
    (comp.lang.asm.x86)
  • Re: Change COM port
    ... > XP is the result of quantum leaps forward since those heady days of DOS ... > tinker/tweak the system.. ... > and again with some crap that just might recover 6k of wasted memory and ... >> be set, and sometimes jumpered, for appropriate COM port. ...
    (microsoft.public.windowsxp.basics)