Recent

Author Topic: Velthuis.Console.pas - Won't compile in Lazarus  (Read 3783 times)

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2269
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Velthuis.Console.pas - Won't compile in Lazarus
« Reply #15 on: May 26, 2024, 10:27:48 pm »
Still the same error. I'm on win7 x64.
https://i.postimg.cc/0NrQqqCj/Capture.png
To make velthuisconsole2.zip from Thaddy compile, here a tutorial:
1. download velthuisconsole2.zip
2. extract it in its own project folder
3. rename ConsoleDemo.dpr to ConsoleDemo.lpr
4. open lazarus "Project -> Close Project" if anything is opened
5. select "Open Project"
6. change filemask filter from "Lazarus Project (*.lpi)"  to "All Files (*.*)"
7. locate and doubleclick ConsoleDemo.lpr
8. select "Create Project" -> "Simple Program"
9. press F9 so the file "Velthuis.Console" gets opened
10. scroll to start of file "Velthuis.Console" and...
replace this
Code: Pascal  [Select][+][-]
  1. {$IF DEFINED(FPC)}
  2.   {$DEFINE CompilerVersion=17.0}
  3.   {$MODE DELPHI}
  4.   {$DEFINE HASERROUTPUT}
  5. {$ENDIF}
  6.  
with that
Code: Pascal  [Select][+][-]
  1. {$IF DEFINED(FPC)}
  2.   {$DEFINE CompilerVersion=17.0}
  3.   {$MODE DELPHI}
  4.   {$DEFINE HASERROUTPUT}
  5.   {$ASMMODE intel}
  6. {$ENDIF}
  7.  
and save project.

Does it compile and run?
I just quick tested as 64bit windows target with Lazarus 3.99 (rev main_3_99-2053-g3635aa3044) FPC 3.2.2 x86_64-win64-win32/win64

And please in future copy the error message and paste it in here instead of taking a screenshot and upload it not here.
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

Thaddy

  • Hero Member
  • *****
  • Posts: 16661
  • Kallstadt seems a good place to evict Trump to.
Re: Velthuis.Console.pas - Won't compile in Lazarus
« Reply #16 on: May 27, 2024, 09:01:29 am »
@KodeZwerg
In mode delphi asmmode is already intel, because basm is intel. No need.
Indeed you can rename dpr to lpr, but I use Geany so I don't need that.
It does only contain 16 assembly for a hardware sound. I would simply remove that part of the code. I just left it in, but I think Rudy would not have mind if it is removed.
[edit] I found an older working version in which I had actually removed the 16 bit assembler.
Apart from that, the code was the same, though.
« Last Edit: May 27, 2024, 09:12:45 am by Thaddy »
But I am sure they don't want the Trumps back...

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2269
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Velthuis.Console.pas - Won't compile in Lazarus
« Reply #17 on: May 27, 2024, 10:01:29 am »
@KodeZwerg
In mode delphi asmmode is already intel, because basm is intel. No need.
If you say so but why does it not compile saying the register variables are undeclared and with "{$ASMMODE intel}" they are defined so I can compile, a bug found?
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

Thaddy

  • Hero Member
  • *****
  • Posts: 16661
  • Kallstadt seems a good place to evict Trump to.
Re: Velthuis.Console.pas - Won't compile in Lazarus
« Reply #18 on: May 27, 2024, 10:18:10 am »
For {$mode delphi} the asm mode should be intel, because of the basm syntax being Intel style. intel. If it isn't it, is a bug.
« Last Edit: May 27, 2024, 10:20:52 am by Thaddy »
But I am sure they don't want the Trumps back...

Atak_Snajpera

  • New Member
  • *
  • Posts: 31
Re: Velthuis.Console.pas - Won't compile in Lazarus
« Reply #19 on: May 28, 2024, 11:56:08 am »
Still the same error. I'm on win7 x64.
https://i.postimg.cc/0NrQqqCj/Capture.png
To make velthuisconsole2.zip from Thaddy compile, here a tutorial:
1. download velthuisconsole2.zip
2. extract it in its own project folder
3. rename ConsoleDemo.dpr to ConsoleDemo.lpr
4. open lazarus "Project -> Close Project" if anything is opened
5. select "Open Project"
6. change filemask filter from "Lazarus Project (*.lpi)"  to "All Files (*.*)"
7. locate and doubleclick ConsoleDemo.lpr
8. select "Create Project" -> "Simple Program"
9. press F9 so the file "Velthuis.Console" gets opened
10. scroll to start of file "Velthuis.Console" and...
replace this
Code: Pascal  [Select][+][-]
  1. {$IF DEFINED(FPC)}
  2.   {$DEFINE CompilerVersion=17.0}
  3.   {$MODE DELPHI}
  4.   {$DEFINE HASERROUTPUT}
  5. {$ENDIF}
  6.  
with that
Code: Pascal  [Select][+][-]
  1. {$IF DEFINED(FPC)}
  2.   {$DEFINE CompilerVersion=17.0}
  3.   {$MODE DELPHI}
  4.   {$DEFINE HASERROUTPUT}
  5.   {$ASMMODE intel}
  6. {$ENDIF}
  7.  
and save project.

Does it compile and run?
I just quick tested as 64bit windows target with Lazarus 3.99 (rev main_3_99-2053-g3635aa3044) FPC 3.2.2 x86_64-win64-win32/win64

And please in future copy the error message and paste it in here instead of taking a screenshot and upload it not here.
Thank you for all your help! Now everything works fine.

Thaddy

  • Hero Member
  • *****
  • Posts: 16661
  • Kallstadt seems a good place to evict Trump to.
Re: Velthuis.Console.pas - Won't compile in Lazarus
« Reply #20 on: May 28, 2024, 04:57:16 pm »
Glad to be of help. It is a nice piece of code from Rudy. Most of his code is still on-line. There are more gems.
But I am sure they don't want the Trumps back...

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12120
  • FPC developer.
Re: Velthuis.Console.pas - Won't compile in Lazarus
« Reply #21 on: May 28, 2024, 05:31:42 pm »
Except that I warned him (and Jedi) already in 2002-2003 to not use delphi versions directly as a condition in sources.  http://www.stack.nl/~marcov/porting.pdf

Thaddy

  • Hero Member
  • *****
  • Posts: 16661
  • Kallstadt seems a good place to evict Trump to.
Re: Velthuis.Console.pas - Won't compile in Lazarus
« Reply #22 on: May 29, 2024, 07:12:18 am »
Well, that's why I spoof the Delphi version to what is usually compatible with fpc. Saves a lot of work.
You may want to revise your porting.pdf, though: although helpful it is out of date at some points.
Has always been helpful, though.
But I am sure they don't want the Trumps back...

dculp

  • Full Member
  • ***
  • Posts: 132
Re: Velthuis.Console.pas - Won't compile in Lazarus
« Reply #23 on: March 24, 2025, 09:05:39 am »
Corrected version attached. Both of us did not find that in 2008! We also had a Linux version discussed (Kylix), but was never fnished.
Still using 32 bit Windows? Anyway, I kept it still  somewhat Delphi1 compatible.
In honor of the author.
Try this one, I only changed the order of the Winversion test to be exact:

When building ConsoleDemo.lpr (from velthuisconsole2.zip), I get a number of Message hints (attached). Should I be concerned about any of these?

Lazarus 3.8 (rev lazarus_3_8) FPC 3.2.2 i386-win32-win32/win64

Thanks,
Don C.


marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12120
  • FPC developer.
Re: Velthuis.Console.pas - Won't compile in Lazarus
« Reply #24 on: March 24, 2025, 09:37:11 am »
Probably not in low level code. 

Thaddy

  • Hero Member
  • *****
  • Posts: 16661
  • Kallstadt seems a good place to evict Trump to.
Re: Velthuis.Console.pas - Won't compile in Lazarus
« Reply #25 on: March 24, 2025, 10:04:06 am »
No, these are checked by me when I made the FPC version.
Attached a version with hints removed and some slight improvements.
« Last Edit: March 24, 2025, 10:45:37 am by Thaddy »
But I am sure they don't want the Trumps back...

dculp

  • Full Member
  • ***
  • Posts: 132
Re: Velthuis.Console.pas - Won't compile in Lazarus
« Reply #26 on: March 24, 2025, 08:02:02 pm »
Commenting all demos except DemoReadKey; -
DemoReadKey doesn't properly deal with Alt+key. For example with the "q" key (output in italics) --

q lowercase             ==> Normal: 'q' = Chr(113)'
Shift+q (uppercase) ==> Normal: 'Q' = Chr(81)'                                                               
Ctrl+q                     ==> Normal: 17                                                                            
Alt+q                  ==> Normal: 'q' = Chr(113)' [just same as q lowercase]
« Last Edit: March 24, 2025, 08:04:01 pm by dculp »

 

TinyPortal © 2005-2018