Recent

Author Topic: Change old cods from turbo pascal into free pascal  (Read 20844 times)

Nokiarody

  • New Member
  • *
  • Posts: 21
Change old cods from turbo pascal into free pascal
« on: February 14, 2017, 11:21:48 pm »
Hi everybody
I only have a short question on how I can write the kods programm that was written in Turbo Pascal ver 5,5 into
The program Free Pascal using  Lazarus
I have written in the mind Cods of Pascal 5.5 and I want to write Free Pascal and how to do it if possible
I have the mind need each code individually rewritten or i have to find the program that makes this task easier
Grateful for earlier for your answer

derek.john.evans

  • Guest
Re: Change old cods from turbo pascal into free pascal
« Reply #1 on: February 14, 2017, 11:26:52 pm »
FreePascal has a TurboPascal syntax mode which will help.
http://www.freepascal.org/docs-html/user/userse33.html

You may have other proplems depending on what TP units you are using. ie: CRT/Graph/Dos

If you want to give a program a new lease on life, then yes its worth the effort. But, times have changed since DOS

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: Change old cods from turbo pascal into free pascal
« Reply #2 on: February 15, 2017, 10:28:20 am »
Clearly programmed Turbo Pascal programs usually compile nearly perfect in TP mode.

However in Dos time, unclean programming was the rule, and deep dos system interfacing and 16-bit assembler is not very portable. So it depends a bit.

Nokiarody

  • New Member
  • *
  • Posts: 21
Re: Change old cods from turbo pascal into free pascal
« Reply #3 on: February 15, 2017, 10:33:24 am »
Thank you for your answer

My idea was to use the codes which that have been written in order to  old program to win the time .
yes true  as you said
You may have other problems depending on what TP units you are using. ie: CRT/Graph/Dos
For that I want to try written in FRC und I try to use Lazarus
The questions    is,
1-Can I use the old codes in new FPC using without changes in Form of codes
I mean just copy and paste
Or the structures of old codes are different of code for FPC??
2-are there one program or application which can help me these changes doing?
3-what  and how the best way to use PasDoc like a generator for FPC?
 
 

Nitorami

  • Sr. Member
  • ****
  • Posts: 481
Re: Change old cods from turbo pascal into free pascal
« Reply #4 on: February 15, 2017, 09:46:00 pm »
1 - normally, yes. Use {$mode tp} for maximum compatibility
2 - I don't think you'll need any tools
3 - what ? PasDoc is a documentation tool, not a code generator

Nokiarody

  • New Member
  • *
  • Posts: 21
Re: Change old cods from turbo pascal into free pascal
« Reply #5 on: February 20, 2017, 10:06:48 am »
1 - normally, yes. Use {$mode tp} for maximum compatibility
2 - I don't think you'll need any tools
3 - what ? PasDoc is a documentation tool, not a code generator

Thanks for the answer
and here  about code Generator
where i can find somthing like that

Thaddy

  • Hero Member
  • *****
  • Posts: 14205
  • Probably until I exterminate Putin.
Re: Change old cods from turbo pascal into free pascal
« Reply #6 on: February 20, 2017, 10:59:28 am »
TP lex/yacc?
Specialize a type, not a var.

Nitorami

  • Sr. Member
  • ****
  • Posts: 481
Re: Change old cods from turbo pascal into free pascal
« Reply #7 on: February 20, 2017, 06:10:58 pm »
Oh my god, look at these units !
If you still have all of them e.g. Windows1, Windows2, Globals, MouseLib, DeskTop1, then you should be able to compile it with FPC.  BUT, you need the sourcecode, i.e. .pas files. Precompiled formats (.tpu) will be useless.

If you do not have these, then I suggest you only keep the core routines but throw away all the old stuff related to mouse handling, buttons, graph, and re-write the GUI in Lazarus. I don't know if it's worth the effort though.

Or you dig out an old turbo pascal  compiler and try your luck. I doubt it will work with nowadays windows, whch won't allow direct access to the mouse for instance (your mouselib will certainly try that and cause an access violation !).

Maybe if you compile it all with turbo pascal and try to run it in Dos BOX, or a virtual machine, it may work... good luck !

Edit: You better stop thinking about code generators. No generator will magically port these old units to modern operating systems. You'll have to do it yourself.
« Last Edit: February 20, 2017, 06:40:34 pm by Nitorami »

Nokiarody

  • New Member
  • *
  • Posts: 21
Re: Change old cods from turbo pascal into free pascal
« Reply #8 on: February 21, 2017, 09:54:50 am »
Oh my god, look at these units !
If you still have all of them e.g. Windows1, Windows2, Globals, MouseLib, DeskTop1, then you should be able to compile it with FPC.  BUT, you need the sourcecode, i.e. .pas files. Precompiled formats (.tpu) will be useless.

If you do not have these, then I suggest you only keep the core routines but throw away all the old stuff related to mouse handling, buttons, graph, and re-write the GUI in Lazarus. I don't know if it's worth the effort though.

Or you dig out an old turbo pascal  compiler and try your luck. I doubt it will work with nowadays windows, whch won't allow direct access to the mouse for instance (your mouselib will certainly try that and cause an access violation !).

Maybe if you compile it all with turbo pascal and try to run it in Dos BOX, or a virtual machine, it may work... good luck !

Edit: You better stop thinking about code generators. No generator will magically port these old units to modern operating systems. You'll have to do it yourself.


Thank u very much for the answer

1-can u for exampel for this part of Programm do   what you had said ?
(I suggest you only keep the core routines but throw away all the old stuff related to mouse handling, buttons, graph)
2-(and re-write the GUI in Lazarus)
u mean i have to to use the begining from Lazrus

program Project1;

{$mode objfpc}{$H+}

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Classes
  { you can add units after this };

begin
end.     


3-(Or you dig out an old turbo pascal  compiler and try your luck)

old Turbo Pascal Compiler  if i find can help porting in Lazrus either or only in nowadays Windows



4-(Maybe if you compile it all with turbo pascal and try to run it in Dos BOX, or a virtual machine, it may work... good luck !)

please can u more deitels about that


5-(Edit: You better stop thinking about code generators. No generator will magically port these old units to modern operating systems. You'll have to do it yourself)

ok no problemm no (MAGIC)
 
that is mean no way (i have to rewrite all lines of codes to be Compatible with new Windows )that is nearly 100000 lines!!1??? :( :( :o :o :'( :'(









molly

  • Hero Member
  • *****
  • Posts: 2330
Re: Change old cods from turbo pascal into free pascal
« Reply #9 on: February 21, 2017, 10:38:44 am »
please can u more deitels about that
This is really not the place to ask for help about emulation.

Nonetheless, something like DosBox can be found here and it has it's own wiki here.

In case you do not fancy dosbox or wish to run an emulator on another host plaform (unsupported by dosbox) then just do a google search on "list of msdos emulators", take a pick and read the corresponding documentation.

The basics are the same.
1 - Install the emulator on your machine
2 - configure your emulator
3 - install ms dos or equivalent
4 - install your old turbo pascal program
5 - run your old Pascal program just as you would have done on a real ms-dos machine

With regards to virtualization software, you could follow a guide such as listed here.

If you are able to run your old software this way without any issues then you just bought yourself time.



You could then use that time to start doing an inventory on what your old program uses, e.g. what kind of screens, windows, editboxes etc are used and which match those from Lazarus.

You said that your program has more than 100000 lines of code but, in turbo vision you almost had to modify every existing object manually to accommodate your needs.

Even though this is also true for the 'matching' components in Lazarus, most of the component in Lazarus are much more flexible and offer most functionality out of the box (or with little programming effort).

However, porting your old turbo vision application over to Lazarus is (and always will be) manual labour. There is no automated process that is able to help you there.

In case you have your 'working' code separated from your (Turbo Vision) gui then it is often quite possible that you are able to copy parts of your code. In case you have a tight integration with Turbo Vvision's GUI then you have a long road ahead of you.

Point being that there can't be anything said unless having seen the actual code. You really need to analyze and make an inventory about what would need to be ported or not.

In case you do not have any experience with Lazarus then i strongly suggest to start with playing with Lazarus instead of trying to port your code right away.

Only if you know what Lazarus can do _then_ you are able to tell what is required to port your old Turbo Vision application.

just 2 cents.
« Last Edit: February 21, 2017, 10:41:16 am by molly »

Thaddy

  • Hero Member
  • *****
  • Posts: 14205
  • Probably until I exterminate Putin.
Re: Change old cods from turbo pascal into free pascal
« Reply #10 on: February 21, 2017, 11:16:16 am »
Note I run DosBox on a RPi 3 and TP1 , TP3 (from the Embarcadero museum) and TP5.5 (from myself, but also can be obtained free from the museum) . Works like a charm....
Also note the the 8088 dos cross-compiler is a very good FPC alternative! TP also runs on a $15,- Orange Pi, but the (my?) orange pi is a bit of a head-ache.

Freevision is good and even reasonably compatible on other platforms than Dos, (I use it on 32/64 bit windows and linux ) as long as there is not much hardware interaction code in your application.
« Last Edit: February 21, 2017, 11:23:25 am by Thaddy »
Specialize a type, not a var.

jacmoe

  • Full Member
  • ***
  • Posts: 249
    • Jacmoe's Cyber SoapBox
Re: Change old cods from turbo pascal into free pascal
« Reply #11 on: February 21, 2017, 03:13:27 pm »
I am not using Windows, but if I was, then I would use vDosPlus (or vDos) instead of DosBox, because DosBox is optimized for games and doesn't handle long filenames properly.
I use Dosemu for WordPerfect and Turbo Pascal on Linux.
If you can use vDosPlus with Turbo Pascal, of course. According to this, you can: https://sourceforge.net/p/vdosplus/discussion/bug_reports/thread/f253dde7/?limit=25
WinWorld has TP7.1 as far as I know.
more signal - less noise

Thaddy

  • Hero Member
  • *****
  • Posts: 14205
  • Probably until I exterminate Putin.
Re: Change old cods from turbo pascal into free pascal
« Reply #12 on: February 21, 2017, 04:12:42 pm »
It isn't supposed to have long filename.... It is a DOS box.
Specialize a type, not a var.

jacmoe

  • Full Member
  • ***
  • Posts: 249
    • Jacmoe's Cyber SoapBox
Re: Change old cods from turbo pascal into free pascal
« Reply #13 on: February 21, 2017, 04:28:37 pm »
Yes, but it's 2017 now:
Quote
vDosPlus is a general-purpose DOS emulator derived from vDos created by Jos Schaars, which in turn was derived from DOSBox, the cross-platform DOS emulator focused on DOS games. vDosPlus has all features of original vDos, but compared with original vDos, it also has many more useful features and other improvements, such as direct support for long filenames (LFN) and their corresponding short filenames (SFN), enhanced keyboard and mouse support, visual display for bold and italic texts, plus many more. However, if you don't need any of these extra features, you can simply use original vDos instead. Also, unlike DOSBox, both vDosPlus and original vDos are NOT for gaming. If you want to run or play DOS games in Windows, please use DOSBox instead, which is specifically designed for DOS gaming.
http://www.vdosplus.org/
 :D
more signal - less noise

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: Change old cods from turbo pascal into free pascal
« Reply #14 on: February 21, 2017, 04:35:42 pm »
Yes, but it's 2017 now:
Of course it is. so we use graphical user interfaces that display nicely on windows, gtk etc.

Back in 1989 there did not exist something called long file names  ;)

 

TinyPortal © 2005-2018