Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2014-05

Identifier not found "MEMW"

13 messages · 7 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

leledumbo
to nitinjain
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.

View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Identifier-not-found-MEMW-tp5719166p5719170.html Sent from the Free Pascal - General mailing list .

Reply by email

Karoly Balogh (Charlie/SGR
to nitinjain: I am migrating Turbo Pascal application into Free Pascal 32 bit operating system.…

Hi,

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

Reply by email

Jim Leonard
to Karoly Balogh (Charlie/SGR
Karoly Balogh 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 () 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!

Reply by email

nitinjain
to leledumbo: message "Identifier not found "MEMW"". can anybody help me on this? AFAIK it's a direct…

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;

-------------------------------------------------------------------

View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Identifier-not-found-MEMW-tp5719166p5719175.html Sent from the Free Pascal - General mailing list .

Reply by email

Tomas Hajny
to nitinjain
nitinjain wrote 25 lines
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

Reply by email

Marco van de Voort
to nitinjain: Thanks for your prompt reply on this. my code is like below, is there any option to…

In our previous episode, nitinjain said:

Show quoted text 24 lines
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.

Reply by email

Mark Morgan Lloyd
to nitinjain: Thanks for your prompt reply on this. my code is like below, is there any option to…
nitinjain wrote 5 lines
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]

Reply by email

Karoly Balogh (Charlie/SGR
to nitinjain: Thanks for your prompt reply on this. my code is like below, is there any option to…

Hi,

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

Reply by email

Tomas Hajny
to nitinjain
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

Reply by email