Recent

Recent Posts

Pages: [1] 2 3 ... 10
1
FPC development / Re: Warning: Source OS Redefined!
« Last post by Laksen on Today at 11:32:46 am »
Just do something like this. "ps1" would have to match the OS define that you create. But if you follow the same conventions otherwise it should be fine as below

Code: Pascal  [Select][+][-]
  1. initialization
  2. {$ifdef CPUMIPSEL}
  3.   {$ifdef ps1}
  4.     set_source_info(system_mipsel_ps1_info);
  5.   {$endif ps1}
  6. {$endif CPUMIPSEL}
  7.  
2
FPC development / Re: how to see what command string is passed to AS?
« Last post by Laksen on Today at 11:30:25 am »
"-sh" can be used to generate a ppas.sh file which contains the assembler command
3
General / Re: Slow copying of small structures
« Last post by alpine on Today at 11:25:10 am »
Thank you, that all makes sense.
@Alpine: It is about all operations on small structures where the compiler inserts a REP MOVSL, as in an operator or function, or when copying. Thanks for the hint with the hard types to cheat the compiler, that could be useful. In the matter at hand it won't help because the := operator is still an operator with infix notation, and the compiler will insert its REP MOVSL no matter what (inlining it does not change this).
By crafting the expression (see my last 4 lines) you can actually remove the REPs, but that's not the point. Generally, the infix operator notation will always require temporaries, hence operators are suboptimal. And fpc lacks copy constructors, static objects, etc. it's a pity.

Optimizing the copying of structures will be fantastic, but in the context of operators I doubt it will change the situation with regard to the procedures.
4
FPC development / assembler name is longer than 16 chars
« Last post by Key-Real on Today at 11:15:20 am »
cpugas.pas(261,40) Warning: (treated as error) String "mipsel-unknown-elf-as" is longer than "16"
cpugas.pas(293) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted


but my AS is truely called  "mipsel-unknown-elf-as"


what to do?
5
Other / Re: Question for people who have built commercial apps
« Last post by BrassGear on Today at 11:12:50 am »
Personally I like to own something if I have to pay for it. I avoid anything with a subscription model for that reason, and another reason is the inflated cost compounded over years.
I think there are a lot of people that feel this way, but the software industry is trying very hard to move to subscriptions, for obvious financial reasons. In my opinion, it is better to support a model that favours reliability and longevity.
6
i need to see what command string is passed to AS.

is there a switch not to delete the script files

-a only does not delete the .s file
7
FPC development / Re: Warning: Source OS Redefined!
« Last post by Key-Real on Today at 11:07:49 am »
Code: Pascal  [Select][+][-]
  1. unit i_ps1;
  2.  
  3. {$i fpcdefs.inc}
  4.  
  5.   interface
  6.  
  7.     uses
  8.        systems;
  9.  
  10.     const
  11.  
  12.        system_mipsel_ps1_info : tsysteminfo =
  13.           (
  14.             system       : system_mipsel_ps1;
  15.             name         : 'PlayStation 1 for MIPSEL';
  16.             shortname    : 'ps1';
  17.             flags        : [tf_needs_symbol_size,tf_needs_symbol_type,tf_files_case_sensitive,
  18.                             tf_requires_proper_alignment,tf_library_needs_pic,
  19.                             tf_pic_uses_got,tf_safecall_exceptions,
  20.                             tf_smartlink_sections,tf_has_winlike_resources,tf_supports_hidden_symbols];
  21.             cpu          : cpu_mipsel;
  22.             unit_env     : 'LINUXUNITS';
  23.             extradefines : 'UNIX;HASUNIX';
  24.             exeext       : '';
  25.             defext       : '.def';
  26.             scriptext    : '.sh';
  27.             smartext     : '.sl';
  28.             unitext      : '.ppu';
  29.             unitlibext   : '.ppl';
  30.             asmext       : '.s';
  31.             objext       : '.o';
  32.             resext       : '.res';
  33.             resobjext    : '.or';
  34.             sharedlibext : '.so';
  35.             staticlibext : '.a';
  36.             staticlibprefix : 'libp';
  37.             sharedlibprefix : 'lib';
  38.             sharedClibext : '.so';
  39.             staticClibext : '.a';
  40.             staticClibprefix : 'lib';
  41.             sharedClibprefix : 'lib';
  42.             importlibprefix : 'libimp';
  43.             importlibext : '.a';
  44. //            p_ext_support : false;
  45.             Cprefix      : '';
  46.             newline      : #10;
  47.             dirsep       : '/';
  48.             assem        : as_none;
  49.             assemextern  : as_gas;
  50.             link         : ld_none;
  51.             linkextern   : ld_ps1;
  52.             ar           : ar_gnu_ar;
  53.             res          : res_elf;
  54.             dbg          : dbg_dwarf3;
  55.             script       : script_unix;
  56.             endian       : endian_little;
  57.             alignment    :
  58.               (
  59.                 procalign       : 4;
  60.                 loopalign       : 4;
  61.                 jumpalign       : 0;
  62.                 jumpalignskipmax    : 0;
  63.                 coalescealign   : 0;
  64.                 coalescealignskipmax: 0;
  65.                 constalignmin   : 0;
  66.                 constalignmax   : 8;
  67.                 varalignmin     : 0;
  68.                 varalignmax     : 8;
  69.                 localalignmin   : 4;
  70.                 localalignmax   : 8;
  71.                 recordalignmin  : 0;
  72.                 recordalignmax  : 8;
  73.                 maxCrecordalign : 8
  74.               );
  75.             first_parm_offset : 0;
  76.             stacksize    : 32*1024*1024;
  77.             stackalign   : 8;
  78.             abi : abi_default;
  79.             llvmdatalayout : 'e-p:32:32:32-i1:8:8-i8:8:32-i16:16:32-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-n32-S64';
  80.           );
  81.  
  82.   implementation
  83.  
  84. initialization
  85.  
  86.     set_source_info(system_mipsel_ps1_info);
  87.  
  88. end.
  89.  


it's not finished jet, but could You pls take a look?
8
I was originally working on a messaging platform, using fpc+laz to make the client, but then I had this idea for a networked game, and built it on top of the messaging platform.
Today I launched an early release. This time, leading up to the early release, it was a real crunch. It has been difficult, but I am super grateful for freepascal, lazarus, blender, and all the other software that gave me this chance to release something commercially.

Has anyone else experience with something like this? Any advice would be appreciated.
I have at times doubted the decision to not use a game engine. But then I think of my messaging queue made out of records and arrays. How could any generalist game engine compete with that kind of simplicity and efficiency? The simple answer is they can't really.

Today I am working on the windows version. The game is on itch.io if you want to check it out. I would love to hear any thoughts you may have. Do you think the price is good for what it is/what it seems to be?
9
General / Re: How to: create DLL file for Windows 10 64-Bit Pro
« Last post by KodeZwerg on Today at 10:53:20 am »
I did a 1:1 copy of @KodeZwerg's test case.
I am not aware about how you implemented MessageBox() so I added that and GetLastError and two constants to have a minimal feedback.
Now after each operation you get a messagebox saying success or failed.
Code: Pascal  [Select][+][-]
  1. program project1;
  2.  
  3. {$APPTYPE CONSOLE}
  4.  
  5. type
  6.   LPCSTR = PAnsiChar;
  7.   DWORD = Cardinal;
  8.   LongWord = Cardinal;
  9.   ULONG_PTR = UIntPtr;
  10.   LongBool = False..Boolean(4294967295);
  11.   BOOL = LongBool;
  12.   UINT = LongWord;
  13.   HWND = UIntPtr;
  14.   THandle = UIntPtr;
  15.   POverlapped = ^TOverlapped;
  16.   _OVERLAPPED = record
  17.     Internal: ULONG_PTR;
  18.     InternalHigh: ULONG_PTR;
  19.     Offset: DWORD;
  20.     OffsetHigh: DWORD;
  21.     hEvent: THandle;
  22.   end;
  23.   TOverlapped = _OVERLAPPED;
  24.   PSecurityAttributes = ^TSecurityAttributes;
  25.   _SECURITY_ATTRIBUTES = record
  26.     nLength: DWORD;
  27.     lpSecurityDescriptor: Pointer;
  28.     bInheritHandle: BOOL;
  29.   end;
  30.   TSecurityAttributes = _SECURITY_ATTRIBUTES;
  31.  
  32. const
  33.   GENERIC_WRITE = $40000000;
  34.   FILE_SHARE_READ = $00000001;
  35.   FILE_SHARE_WRITE = $00000002;
  36.   CREATE_NEW = 1;
  37.   OPEN_EXISTING = 3;
  38.   FILE_END = 2;
  39.   FILE_ATTRIBUTE_NORMAL = $00000080;
  40.   INVALID_HANDLE_VALUE = THandle(-1);
  41.   INVALID_SET_FILE_POINTER = DWORD(-1);
  42.   NO_ERROR = 0;
  43.  
  44. function WriteFile(hFile: THandle; const Buffer; nNumberOfBytesToWrite: DWORD; var lpNumberOfBytesWritten: DWORD; lpOverlapped: POverlapped): BOOL; stdcall; external 'kernel32.dll' name 'WriteFile';
  45. function CreateFileA(lpFileName: LPCSTR; dwDesiredAccess, dwShareMode: DWORD; lpSecurityAttributes: PSecurityAttributes; dwCreationDisposition, dwFlagsAndAttributes: DWORD; hTemplateFile: THandle): THandle; stdcall; external 'kernel32.dll' name 'CreateFileA';
  46. function SetFilePointer(hFile: THandle; lDistanceToMove: Longint; lpDistanceToMoveHigh: Pointer; dwMoveMethod: DWORD): DWORD; stdcall; external 'kernel32.dll' name 'SetFilePointer';
  47. function CloseHandle(hObject: THandle): BOOL; stdcall; external 'kernel32.dll' name 'CloseHandle';
  48. function MessageBoxA(hWnd: HWND; lpText, lpCaption: LPCSTR; uType: UINT): Integer; stdcall; external 'user32.dll' name 'MessageBoxA';
  49. function GetLastError: DWORD; stdcall; external 'kernel32.dll' name 'GetLastError';
  50.  
  51. procedure PutDataToFile(const AFileName: string; AData: PAnsiChar);
  52. var
  53.   hFile: THandle;
  54.   cnt: Cardinal;
  55.   DataSize: Integer;
  56.   dummy: DWORD;
  57.   error: DWORD;
  58. begin
  59.   DataSize := StrLen(AData);
  60.   hFile := CreateFileA(PAnsiChar(AFileName), GENERIC_WRITE, FILE_SHARE_READ or FILE_SHARE_WRITE, nil,
  61.              OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
  62.   if (hFile = INVALID_HANDLE_VALUE) then
  63.     hFile := CreateFileA(PAnsiChar(AFileName), GENERIC_WRITE, FILE_SHARE_READ or FILE_SHARE_WRITE, nil,
  64.                CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0);
  65.   if (hFile <> INVALID_HANDLE_VALUE) then
  66.     begin
  67.       dummy := MessageBoxA(0, PAnsiChar('CreateFileA() success!'), PAnsiChar('Information'), 0);
  68.       dummy := SetFilePointer(hFile, 0, nil, FILE_END);
  69.       error := GetLastError;
  70.       if ((dummy <> INVALID_SET_FILE_POINTER) and (error = NO_ERROR)) then
  71.         begin
  72.           dummy := MessageBoxA(0, PAnsiChar('SetFilePointer() success!'), PAnsiChar('Information'), 0);
  73.           if WriteFile(hFile, AData^, DataSize, cnt, nil) then
  74.             dummy := MessageBoxA(0, PAnsiChar('WriteFile() success!'), PAnsiChar('Information'), 0)
  75.           else
  76.             dummy := MessageBoxA(0, PAnsiChar('WriteFile() failed.'), PAnsiChar('Information'), 0)
  77.         end
  78.       else
  79.         dummy := MessageBoxA(0, PAnsiChar('SetFilePointer() failed.'), PAnsiChar('Information'), 0);
  80.       if CloseHandle(hFile) then
  81.         dummy := MessageBoxA(0, PAnsiChar('CloseHandle() success!'), PAnsiChar('Information'), 0)
  82.       else
  83.         dummy := MessageBoxA(0, PAnsiChar('CloseHandle() failed.'), PAnsiChar('Information'), 0);
  84.     end
  85.   else
  86.     dummy := MessageBoxA(0, PAnsiChar('CreateFileA() failed.'), PAnsiChar('Information'), 0);
  87. end;
  88.  
  89. begin
  90.   PutDataToFile('test.txt', 'Test file created');
  91.   ReadLn;
  92. end.
You can extend this code with more constants as the MSDN sites showing, right now I just encapsulated SetFilePointer as an example how-to work with the feedback correct and how GetLastError is involved.

Tested successful with Lazarus 3.99 (rev main_3_99-1801-gca71aeb4e4) FPC 3.2.2 x86_64-win64-win32/win64
(all original unmodified files including RTL)
10
General / Re: Assign (textfile) not compiling - sometimes.
« Last post by Thaddy on Today at 10:51:18 am »
Or use AssignFile and CloseFile procedures from the SysUtils.
Those two do not belong there. They are simple aliases to system.assign() and system.close().
Should never have been introduced unless Delphi has them.

Hiding them from being documented in a wood of ifdefs is actually a good idea.... O:-)  Brilliant!
Pages: [1] 2 3 ... 10

TinyPortal © 2005-2018