Re: machine ports

new topic     » goto parent     » topic index » view thread      » older message » newer message

>>Does anyone here know how to input data from a machine port?  I'm tryingto
>>wait for a vertical retrace and I know it's value 8 at port #3DA but I don't
>>know how to read it.
>
>Pete Eberlein's ports.e should do the job. It's available from the
>RDS web site, or my web site:
>http://www.mindspring.com/~mountains

ports.e isn't mine.  Jacques Deschenes is the author of that one.

But ports.e is too slow to use for the vertical retrace, so I rewrote the
wait for retrace in machine code.

global constant wait_retrace = allocate(20)
poke(wait_retrace, {
    #50,        -- PUSH EAX
    #52,        -- PUSH EDX
    #BA,#DA,3,0,0,-- MOV EDX, 0x03DA
    #EC,        -- IN AL, DX
    #24,#08,    -- AND AL, 0x08
    #75,#FB,    -- JNZ -5
    #EC,        -- IN AL, DX
    #24,#08,    -- AND AL, 0x08
    #74,#FB,    -- JZ -5
    #5A,        -- POP EDX
    #58,        -- POP EAX
    #C3 } )     -- RET

The do "call(wait_retrace)" whenever you want.

 _______  ______  _______  ______
[    _  \[    _ ][ _   _ ][    _ ]
[/| [_] |[/| [_\][/ | | \][/| [_\]
  |  ___/  |  _]    | |     |  _]
[\| [/]  [\| [_/] [\| |/] [\| [_/]
[_____]  [______] [_____] [______]
       xseal at harborside.com

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu