Identifier not found "MEMW"

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Identifier not found "MEMW"

nitinjain
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Identifier not found "MEMW"

leledumbo
Administrator
> whenever i compiled unit file in free pascal, compiler showing error message "Identifier not found "MEMW"". can anybody help me on this?

AFAIK it's a direct memory access which is not possible in 32-bit (or higher) protected mode OS. Figure out what the code wants to do and implement it in a way possible in your OS.
Reply | Threaded
Open this post in threaded view
|

Re: Identifier not found "MEMW"

Karoly Balogh (Charlie/SGR)
In reply to this post by nitinjain
Hi,

On Thu, 8 May 2014, nitinjain wrote:

> I am migrating Turbo Pascal application into Free Pascal 32 bit operating
> system. whenever i compiled unit file in free pascal, compiler showing error
> message "Identifier not found "MEMW"". can anybody help me on this?.

About TP to FPC porting, see this page:
http://www.freepascal.org/port.var

To quote from there:
"You can access the realmode memory using MEM[seg:ofs], as well as MemW
and MemL (only available under Dos/Go32v2)"

Due to memory organization of modern operating systems, the Mem, MemW and
MemL are only supported under DOS and *cannot* be supported elsewhere.
This is legacy, non-portable code, which you have to rewrite to work with
a modern operating system, or any other CPU than i386.

Charlie
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Identifier not found "MEMW"

Jim Leonard
On 5/8/2014 2:35 PM, Karoly Balogh (Charlie/SGR) wrote:
> Due to memory organization of modern operating systems, the Mem, MemW and
> MemL are only supported under DOS and *cannot* be supported elsewhere.
> This is legacy, non-portable code, which you have to rewrite to work with
> a modern operating system, or any other CPU than i386.

This might be easy to port, however, if the original programmer used
mem[] as a shortcut (for example, writing a character directly into
video RAM).  For some cases, it's easy to rewrite.

If the OP could post a short snippet of the code that uses mem[], we
could advise how difficult it would be to port...
--
Jim Leonard ([hidden email])
Check out some trippy MindCandy: http://www.mindcandydvd.com/
A child borne of the home computer wars: http://trixter.oldskool.org/
You're all insane and trying to steal my magic bag!
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Identifier not found "MEMW"

nitinjain
In reply to this post by leledumbo
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Identifier not found "MEMW"

Tomas Hajny-2
On Fri, May 9, 2014 09:00, nitinjain wrote:

> Thanks for your prompt reply on this.
> my code is like below, is there any option to implemet the same thing?
>
> -------------------------------------------------------------------
> PROCEDURE window_object.appear;
>
> VAR
>    width_offset,
>    height_offset    : BYTE;
>    current_location : location_pointer;
>
> BEGIN
>      current_location:=first_location;
>      FOR height_offset:=y TO (y+y_offset-1) DO
>      BEGIN
>           FOR width_offset:=x TO (x+x_offset-1) DO
>           BEGIN
>                *MEMW[$B800:(width_offset-1)*2
>                          +(height_offset-1)*160]:=current_location^.code;*
> current_location:=current_location^.next;
>           END;
>      END;
>      current_location^.next:=NIL;
> END;
> -------------------------------------------------------------------

This type of code would be probably best ported using unit Video - after
initializing of this unit, you can write to the provided screen buffer and
have the console window (or full screen if you use that) updated based
based on content of that screen buffer.

Which platform do you target?

Tomas


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Identifier not found "MEMW"

Marco van de Voort
In reply to this post by nitinjain
In our previous episode, nitinjain said:

> Thanks for your prompt reply on this.
> my code is like below, is there any option to implemet the same thing?
>
> -------------------------------------------------------------------
> PROCEDURE window_object.appear;
>
> VAR
>    width_offset,
>    height_offset    : BYTE;
>    current_location : location_pointer;
>
> BEGIN
>      current_location:=first_location;
>      FOR height_offset:=y TO (y+y_offset-1) DO
>      BEGIN
>           FOR width_offset:=x TO (x+x_offset-1) DO
>           BEGIN
>                *MEMW[$B800:(width_offset-1)*2
>                          +(height_offset-1)*160]:=current_location^.code;*              
> current_location:=current_location^.next;
>           END;
>      END;
>      current_location^.next:=NIL;
> END;

Best to rework it to use unit Video and the videobuf variable, which
provides a virtual console screen abstraction.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Identifier not found "MEMW"

Mark Morgan Lloyd-5
In reply to this post by nitinjain
nitinjain wrote:
> Thanks for your prompt reply on this.
> my code is like below, is there any option to implemet the same thing?

>                *MEMW[$B800:(width_offset-1)*2
>                          +(height_offset-1)*160]:=current_location^.code;*              

What /exactly/ does the program do? Do you need fancy screen handling or
could you at least initially make do with it as a simple console app
which you later prettied up (see Marco and Tomas's suggestion of using
the Video unit). What OS are you using?

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Identifier not found "MEMW"

nitinjain
This post has NOT been accepted by the mailing list yet.
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Identifier not found "MEMW"

Karoly Balogh (Charlie/SGR)
In reply to this post by nitinjain
Hi,

On Fri, 9 May 2014, nitinjain wrote:

>                *MEMW[$B800:(width_offset-1)*2
>                          +(height_offset-1)*160]:=current_location^.code;*

For the sake of completeness, this piece of code is just writing a
character to the text mode memory of the display hardware directly.

That memory area starts at a fixed address of $B800:0000 in 16bit DOS.
So, the second part after the colon is just a normal X/Y coordinate to
address (offset) calculation where the width values are multiplied by 2,
because the hardware stores a character on 2 bytes (this is also why MEMW
is used). The 160 there is really just the width of the screen (80
characters) multiplied by 2.

Hope this helps a bit. As others suggested, it's possible to rewrite such
code using the video unit to work with modern systems.

Charlie
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Identifier not found "MEMW"

nitinjain
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Identifier not found "MEMW"

Tomas Hajny-2
On Mon, May 12, 2014 08:58, nitinjain wrote:
> Thanks to all of you for your`s reply !,
>
> do me a Favour, can anybody guide me how to implement video unit with my
> code.

Well, I believe that you already have all the needed components in the
provided responses:

1) Add unit Video to your uses clause.

2) Call InitVideo at the beginning of your application.

3) Change your original "MEMW[$B800:(width_offset-1)*2
+(height_offset-1)*160]:=current_location^.code" to "VideoBuf^
[(width_offset-1) + (height_offset-1) * ScreenWidth] :=
current_location^.code". I hope that I didn't make any mistake here - I
haven't tested it because you didn't post a complete compilable source.

4) Add call to UpdateScreen(false) after the outer for loop (either before
or after "current_location^.next:=NIL").

5) Call DoneVideo at the end of your program.

Tomas


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Identifier not found "MEMW"

nitinjain
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Identifier not found "MEMW"

Marco van de Voort
In our previous episode, nitinjain said:
> I used same (Video Unit) but throwing runtime error* "Program Received
> Signal SIGSEGV Segmentation fault"*.

Did you follow all steps in

http://stackoverflow.com/questions/23563834/freepascal-identifier-not-found-memw/23700057#comment36526285_23700057

and called initvideo?

What target are you on?
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal