Not a newbie, but a newbie question... 
Author Message
 Not a newbie, but a newbie question...

Well, I'm picking up Forth again for the first time in many years.  I'm
trying to convert some code that was written in LMI 386 Forth to Zimmer
et al's Win32 Forth.

We're using this to bang some bits on the PC's parallel port and, not
wanting to drag out my assembly language manual, I can't see a way to
do

do
I do this with Win32 Forth?

If you could copy me at

I'd be much obliged...

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Sun, 07 Jul 2002 03:00:00 GMT  
 Not a newbie, but a newbie question...

Quote:

>Well, I'm picking up Forth again for the first time in many years.  I'm
>trying to convert some code that was written in LMI 386 Forth to Zimmer
>et al's Win32 Forth.

>We're using this to bang some bits on the PC's parallel port and, not
>wanting to drag out my assembly language manual, I can't see a way to
>do

>do
>I do this with Win32 Forth?



actually write to the port.


these words aren't already in Win32Forth (which was written for Windows NT
where you cannot do this).

I'm sure someone has defined these already, but here's an untested attempt
(I'm using NT so no way to test, at least they compile).


   mov edx, ebx
   xor eax, eax
   in  al, dx
   mov ebx, eax
   next c;

CODE PC!   ( value port-addr -- )
   mov edx, ebx
   pop eax
   out dx, al
   pop ebx
   next c;

Good Luck!

Andrew



Sun, 07 Jul 2002 03:00:00 GMT  
 Not a newbie, but a newbie question...


Quote:
>Well, I'm picking up Forth again for the first time in many years.  I'm
>trying to convert some code that was written in LMI 386 Forth to Zimmer
>et al's Win32 Forth.

>We're using this to bang some bits on the PC's parallel port and, not
>wanting to drag out my assembly language manual, I can't see a way to
>do

>do
>I do this with Win32 Forth?

[ ... ]

Win32Forth were designed to run under WinNT which will not allow you to bit
bang any ports unless you have a special driver for it.  AFAIK Win32Forth
don't even have words for reading and writing ports.  Under Win95 you could
do it but you'll have to write the words yourself as code-words - and then
we're back to using assembly again.

Best regards
Michael S{*filter*}



Mon, 08 Jul 2002 03:00:00 GMT  
 Not a newbie, but a newbie question...
Andrew,

Ah, thanks for the reply.  Yep, I hadn't even thought about the NT problem,
even though we just revamped our new emulator to run under NT with a Windows/16
application.  What I want to do with that example IS read from the BIOS area to
read the current LPT port address before I start I/O.

All I need right now is a Win 95 version.  Thanks for the asm versions.  That
should save me some time.

--
___________________________
|     Darrel Johansen     |
|     tempe,  arizona     |

|_________________________|



Mon, 08 Jul 2002 03:00:00 GMT  
 Not a newbie, but a newbie question...
Darrel Johansen schrieb:

Quote:
> > All I need right now is a Win 95 version.  Thanks for the asm versions.  That
> should save me some time.

If you like you can stay at using WinNT.

Under www.XESS.com/FPGA  Swf. Downloads  i found some time ago a driver
package
called port95nt.exe.

Some lines from readme.txt:

Scientific Software Tools, Inc. is pleased to provide you with this
utility
for performing hardware port I/O under Windows 95 and Windows NT. This
product allows your 32-bit C/C++ or Visual Basic apps (or any language
that
can call a DLL) direct access to the I/O ports over the range 0100H to
FFFFH.

It works also below $0100.
I use it this way:

WinLibrary DLPortIO.DLL

\ get a byte from addr

    call    DlPortReadPortUchar ;

\ set a byte at addr
: PC!   ( byte addr -- )
    call DlPortWritePortUchar
    drop ;      \ drop the returned byte

\ test: read the seconds from the system clock
: RdRtc
    begin
        0 $70 PC!

        1000 ms
    key? until ;

Regards, Norbert Hoppe



Mon, 08 Jul 2002 03:00:00 GMT  
 Not a newbie, but a newbie question...

Andrew McKewan schrieb:

Quote:
> I'm sure someone has defined these already, but here's an untested attempt
> (I'm using NT so no way to test, at least they compile).


>    mov edx, ebx
>    xor eax, eax
>    in  al, dx
>    mov ebx, eax
>    next c;

> CODE PC!   ( value port-addr -- )
>    mov edx, ebx
>    pop eax
>    out dx, al
>    pop ebx
>    next c;

In fkernel.f of Win32Forth there is a note that edx is the "absolute"
user pointer.
So you have to save/restore the contents when using it.
The register ecx is free. Use it as temp. storage for edx.

Regards, Norbert Hoppe



Mon, 08 Jul 2002 03:00:00 GMT  
 Not a newbie, but a newbie question...
Norbert Hoppe wrote

Quote:


>> I'm sure someone has defined these already, but here's an untested
attempt
>> (I'm using NT so no way to test, at least they compile).


>>    mov edx, ebx
>>    xor eax, eax
>>    in  al, dx
>>    mov ebx, eax
>>    next c;

>> CODE PC!   ( value port-addr -- )
>>    mov edx, ebx
>>    pop eax
>>    out dx, al
>>    pop ebx
>>    next c;

>In fkernel.f of Win32Forth there is a note that edx is the "absolute"
>user pointer.
>So you have to save/restore the contents when using it.
>The register ecx is free. Use it as temp. storage for edx.

Yikes!  Thanks, I forgot about that.

Andrew



Mon, 08 Jul 2002 03:00:00 GMT  
 Not a newbie, but a newbie question...

--
___________________________
|     Darrel Johansen     |
|     tempe,  arizona     |

|_________________________|
Thanks for the tip Norbert!

Quote:

> Darrel Johansen schrieb:
> > > All I need right now is a Win 95 version.  Thanks for the asm versions.  That
> > should save me some time.

> If you like you can stay at using WinNT.

> Under www.XESS.com/FPGA  Swf. Downloads  i found some time ago a driver
> package
> called port95nt.exe.

> Some lines from readme.txt:

> Scientific Software Tools, Inc. is pleased to provide you with this
> utility
> for performing hardware port I/O under Windows 95 and Windows NT. This
> product allows your 32-bit C/C++ or Visual Basic apps (or any language
> that
> can call a DLL) direct access to the I/O ports over the range 0100H to
> FFFFH.

> It works also below $0100.
> I use it this way:

> WinLibrary DLPortIO.DLL

> \ get a byte from addr

>     call    DlPortReadPortUchar ;

> \ set a byte at addr
> : PC!   ( byte addr -- )
>     call DlPortWritePortUchar
>     drop ;      \ drop the returned byte

> \ test: read the seconds from the system clock
> : RdRtc
>     begin
>         0 $70 PC!

>         1000 ms
>     key? until ;

> Regards, Norbert Hoppe



Tue, 09 Jul 2002 03:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Newbie Question (Was: Newbie Question...)

2. Newbie Newbie, we are all Newbie to something

3. Trivial Newbie Question (Newbie)

4. not even newbie questions

5. Not even a newbie questions

6. Newbie question - POP not returning what i PUSHed

7. mov ds,seg text why not??? newbie question

8. Building portable data structure (NOT a newbie question?)

9. Newbie question: WinNT Python 1.5.2 - import seems not to work the way I expect

10. Newbie question: Python Not Answering HTTP Page

11. Newbie F90 Question -- or may not be!

12. Newbie question: Package require not working

 

 
Powered by phpBB® Forum Software