Creating a FAR pointer in MS fortran 
Author Message
 Creating a FAR pointer in MS fortran

HI
I am trying to find a way to read/write to higher memory segments in a PC.
Now I know how o do it for C (lots of ways!) or BASIC (good ol' DEF SEG) but
I cannot get MS-fortran to budge (V5.1). After some help I tried using
LOCFAR to get the memory address for a [FAR] array test(0:1) - OK.
I then subtracted that from #B8000000 (video memory seg) to get the offset
to the video memory (call it memdif). I then tried LOCFAR(test(memdif))
but this gives the same value as LOCFAR(test(0)).

Anyone know how to trick the compiler into letting me assign an address to
a far pointer?

I have sat waiting for hours trying to get through to MS Tech support -
once a guy said he had just the right bit of code and he would fax it to
me - that was last friday - still no fax - I faxed him - still no
fax ........................  

Roll on FORTRAN90

Thanks for your attention
Neil Long



Sun, 01 Jan 1995 22:21:58 GMT  
 Creating a FAR pointer in MS fortran

Quote:
>I have sat waiting for hours trying to get through to MS Tech support -
>once a guy said he had just the right bit of code and he would fax it to
>me - that was last friday - still no fax - I faxed him - still no
>fax ........................  

Sorry I don't have any helpful suggestions, but your travails with Microsoft
customer "support" sound sadly familiar.

Good luck!



Tue, 03 Jan 1995 00:11:17 GMT  
 Creating a FAR pointer in MS fortran

Quote:

>Subject: Re: Creating a FAR pointer in MS fortran
>Date: 16 Jul 92 16:11:17 GMT

>>I have sat waiting for hours trying to get through to MS Tech support -
>>once a guy said he had just the right bit of code and he would fax it to
>>me - that was last friday - still no fax - I faxed him - still no
>>fax ........................  
>Sorry I don't have any helpful suggestions, but your travails with Microsoft
>customer "support" sound sadly familiar.
>Good luck!

Well they came through in the end! and the code fragment works a treat.
I just wish there was some way to access their resources (smile) and search
for keywords, etc for free, via tcp/ip,.......
just dreaming after restless nights pondering on code fragments which didn't
work..............
Neil


Tue, 03 Jan 1995 16:49:52 GMT  
 Creating a FAR pointer in MS fortran

|>
|> Well they came through in the end! and the code fragment works a treat.
|> I just wish there was some way to access their resources (smile) and search
|> for keywords, etc for free, via tcp/ip,.......
|> just dreaming after restless nights pondering on code fragments which didn't
|> work..............
|> Neil

So, what is the solution? And how do you compute the pointer ranges when
you also use a RAM disk for example.
Hans



Tue, 03 Jan 1995 19:32:02 GMT  
 Creating a FAR pointer in MS fortran

Quote:

>Subject: Re: Creating a FAR pointer in MS fortran
>Date: 17 Jul 92 11:32:02 GMT

>|>
>|> Well they came through in the end! and the code fragment works a treat.
>|> I just wish there was some way to access their resources (smile) and search
>|> for keywords, etc for free, via tcp/ip,.......
>|> just dreaming after restless nights pondering on code fragments which didn't
>|> work..............
>|> Neil
>So, what is the solution? And how do you compute the pointer ranges when
>you also use a RAM disk for example.
>Hans

Here is the code fragment. As in all {*filter*} tricks it is up to you to
ensure that the memory segment is excluded from other tasks such as UMB's.

My particular need was to copy data which is dual ported on a data
acquisition board and mapped to page D. The example is for the video memory
in 'CGA' mode (segment B800) and would need to be altered for a 'MONO'
adaptor (segment B000).

I tried it with MS Fortran 5.1 and it works very well. I anticipate
that it will become redundant when F90 is implemented.

c Copyright Microsoft (I assume)
c
c This program demonstrates the use of a pointer in FORTRAN
c 5.00 in DOS. This program loads a far address into an
c integer*4 and passes that to a subroutine.
c
c Next, an INTERFACE TO SUBROUTINE is used to "lie" to FORTRAN
c about what is being passed. The interface tells FORTRAN
c that it is passing an integer*4 by value. The actual
c subroutine, which is referred to by the ALIAS attribute,
c expects a far address to an array. the value of the
c integer*4 is that address. Once inside that subroutine,
c the entire segment can be accessed by specifying the
c correct index to the array.
c
c The subroutine SETPOINT2 changes the screen attribute byte
c to cause the characters on the video display to blink.
c
        interface to subroutine setpoint [alias:'setpoint2'] (abc)
                integer*4 abc [value]
        end
        subroutine setpoint2(abc)
        integer*2 abc(*),n
        do 100,n=1,2000
        abc(n)=ior(abc(n),#8000)
100     continue
        end
        program graphtest
        integer*4 ptr
        ptr=#0b8000000
        write (*,'(z9)') ptr
        call setpoint (ptr)
        end

Neil



Tue, 03 Jan 1995 22:26:48 GMT  
 Creating a FAR pointer in MS fortran

Quote:

>I tried it with MS Fortran 5.1 and it works very well. I anticipate
>that it will become redundant when F90 is implemented.

>c Copyright Microsoft (I assume)
>c

(No, Sir, one does not assume a copyright.  If it isn't there, it is
not there...  And if it were, one presumes you would have asked
for approval before posting?  :-))

But to get to the substance, have you considered getting OS/2 and
say, a Watcom 9.0 Fortran compiler?

And forget about the whole mess of far addresses etc..., getting
a flat 4 GBytes of address space in what they call the 'small
memory model'.

LB.  



Thu, 05 Jan 1995 11:03:45 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Ms Fortran 5.1 or MS Fortran Powerstation

2. Ms Fortran 5.1 or MS Fortran Powerstation

3. MS Fortran compatability with UN*X Fortran (and use with MS C)

4. Using MS FORTRAN Powerstation to create DLLs for VB4.0

5. Far Pointers and String Instructions

6. far pointer in assembler question

7. Please I would appreciate some input, Far pointer from C++ to asm

8. NASM: How to declare a far pointer?

9. Watcom C/C++ & far pointers

10. les, far pointer on linux

11. CallDLL and Long Far Pointer Return

 

 
Powered by phpBB® Forum Software