Page 7 of 7 FirstFirst ... 567
Results 61 to 69 of 69

Thread: GP2X Issues...

  1. #61

    GP2X Issues...

    ok I've upgraded you post to be a news item. With regard to being included FreePascal, I think you just need to contact the team and let them now that the port is ready.

    Also what theme are you using on PGD? When making a post there should be a "Add Image to post" link just below the message body that you can use to embed images.
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  2. #62

    GP2X Issues...

    [quote="savage"]ok I've upgraded you post to be a news item. With regard to being included FreePascal, I think you just need to contact the team and let them now that the port is ready.

    Also what theme are you using on PGD? When making a post there should be a "Add Image to post" ]

    Thanks for the upgrade

    I will contact the freepascal team about the port.

    I am using board style: subSilver.
    Do I need Internet Explorer to get the "Add Image to post" option?
    I am using Firefox...

    cheers,
    Paul
    Games:
    Seafox


    Pages:
    Syntax Error Software itch.io page

    Online Chess
    http://gameknot.com/#paul_nicholls

  3. #63

    GP2X Issues...

    Quote Originally Posted by paul_nicholls
    I am using board style: subSilver.
    Ah, that would be it then. That did not have the proper code. I have just made a change, so you should be able to see it in subSilver now.
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  4. #64

    GP2X Issues...

    Quote Originally Posted by savage
    Quote Originally Posted by paul_nicholls
    I am using board style: subSilver.
    Ah, that would be it then. That did not have the proper code. I have just made a change, so you should be able to see it in subSilver now.
    Thanks! That was quick! :-)

    I have now posted a message on the freepascal community about my work http://community.freepascal.org:1000...forum_id=24081
    cheers,
    Paul.
    Games:
    Seafox


    Pages:
    Syntax Error Software itch.io page

    Online Chess
    http://gameknot.com/#paul_nicholls

  5. #65

    GP2X Issues...

    Hi all :-)

    I need to pick the brains of you freepascal and assembly (ARM) people out there :-)

    If I have an assembly file that is in text format like so:

    asmlib.s
    Code:
    @ gp2x demo article code by Dzz
    @ this code is placed in the public domain.  do anything you want with it.
    
    	.align 4
    	.globl OpenFile
    	.globl CloseFile
    	.globl WriteFile
    	.globl MUnmap
    	.globl ChangeDir
    	.globl ExecuteFile
    	.globl MMap
    	.globl Ioctl3
    
    OpenFile&#58;
    	swi #0x900005
    	mov pc, lr
    
    CloseFile&#58;
    	swi #0x900006
    	mov pc, lr
    
    WriteFile&#58;
    	swi #0x900004
    	mov pc, lr
    
    MUnmap&#58;
    	swi #0x90005B
    	mov pc, lr
    
    ChangeDir&#58;
    	swi #0x90000C
    	mov pc, lr
    
    ExecuteFile&#58;
    	swi #0x90000B
    	mov pc, lr
    
    Ioctl3&#58;
    	swi #0x900036
    	mov pc, lr
    
    MMap&#58;
    	stmdb sp!, &#123;r0, r1, r2, r3&#125;
    	mov r0, sp
    	swi #0x90005A
    	add sp, sp, #16
    	mov pc, lr
    and a c header file like this (Before conversion to pascal)
    library.h
    Code:
    extern int OpenFile&#40;char *pszFile, int nMode&#41;;
    extern void CloseFile&#40;int nFile&#41;;
    extern int WriteFile&#40;int fd, void *pBuffer, int nLen&#41;;
    extern void *MMap&#40;void *pAddr, int nLen, int nProtection, int nFlags, int nFD, int nOff&#41;;
    extern void MUnmap&#40;void *p, int nSize&#41;;
    extern void ChangeDir&#40;char *pszDir&#41;;
    extern void ExecuteFile&#40;char *pszFile, int nZero1, int nZero2&#41;;
    extern int Ioctl3&#40;int fd, unsigned int ulFunction, unsigned int ulParameter&#41;;
    does anyone know how I can compile the asmlib.s file and link the library routines to it so I can call them from freepascal?

    I assume I would need to use the arm-linux-ld.exe, arm-linux-as.exe, etc. programs somehow...

    or possibly the pccrossarm.exe cross-compiler?

    cheers,
    Paul.
    Games:
    Seafox


    Pages:
    Syntax Error Software itch.io page

    Online Chess
    http://gameknot.com/#paul_nicholls

  6. #66

    GP2X Issues...

    I have figured it out (mostly).

    I need to assembly the .s file first

    Code:
    arm-linux-gcc.exe -c libgp2x_asm.s
    this creates the .o file.

    I then have my unit I translated from the header file:

    Code:
    Unit libgp2x;
    &#123;$link libgp2x_asm.o&#125;
    &#123;$linklib c&#125;
    
    Interface
    
    Uses
        CTypes;
        
    Function  OpenFile&#40;pszFile&#58; PChar; nMode&#58; ctypes.cint32&#41;&#58; Integer;                          External;
    Procedure CloseFile&#40;nFile&#58; ctypes.cint32&#41;;                                                  External;
    Function  MMap&#40;pAddr&#58; Pointer; nLen,nProtection,nFlags,nFD,nOff&#58; ctypes.cint32&#41;&#58; Pointer;   External;
    Procedure MUnmap&#40;p&#58; Pointer; nSize&#58; ctypes.cint32&#41;;                                         External;
    Procedure ChangeDir&#40;pszDir&#58; PChar&#41;;                                                         External;
    Procedure ExecuteFile&#40;pszFile&#58; PChar; nZero1,nZero2&#58; ctypes.cint32&#41;;                        External;
    Procedure RestartMenu;
    &#123;
    extern int OpenFile&#40;char *pszFile, int nMode&#41;;
    extern void CloseFile&#40;int nFile&#41;;
    extern void *MMap&#40;void *pAddr, int nLen, int nProtection, int nFlags, int nFD, int nOff&#41;;
    extern void MUnmap&#40;void *p, int nSize&#41;;
    extern void ChangeDir&#40;char *pszDir&#41;;
    extern void ExecuteFile&#40;char *pszFile, int nZero1, int nZero2&#41;;
    extern void RestartMenu&#40;&#41;;
    &#125;
    Implementation
    
    Procedure RestartMenu;
    Begin
        ChangeDir  &#40;PChar&#40;'/usr/gp2x'&#41;&#41;;
        ExecuteFile&#40;PChar&#40;'/usr/gp2x/gp2xmenu'&#41;, 0, 0&#41;;
    End;
    &#123;..............................................................................&#125;
    
    &#123;..............................................................................&#125;
    End.
    The problem I now have is when I try and link in my libgp2x unit I get this error:

    Code:
    Assembling engine3dtest
    Linking engine3dtest
    libgp2x.o&#58; In function `LIBGP2X_RESTARTMENU'&#58;
    libgp2x.pas&#58;&#40;.text+0x14&#41;&#58; undefined reference to `LIBGP2X_CHANGEDIR$PCHAR'
    libgp2x.pas&#58;&#40;.text+0x24&#41;&#58; undefined reference to `LIBGP2X_EXECUTEFILE$PCHAR$LONG
    INT$LONGINT'
    An error occured while linking engine3dtest
    Press any key to continue . . .
    For some reason the linker doesn't like my references in the RestartMenu procedure to the ChangeDir and ExecuteFile external routines...

    Any ideas?
    cheers,
    Paul.
    Games:
    Seafox


    Pages:
    Syntax Error Software itch.io page

    Online Chess
    http://gameknot.com/#paul_nicholls

  7. #67

    GP2X Issues...

    It looks like I have figured it out

    Code:
    Function  OpenFile&#40;pszFile&#58; PChar; nMode&#58; ctypes.cint32&#41;&#58; ctypes.cint32;                    Cdecl; External;
    Procedure CloseFile&#40;nFile&#58; ctypes.cint32&#41;;                                                  Cdecl; External;
    Function  MMap&#40;pAddr&#58; Pointer; nLen,nProtection,nFlags,nFD,nOff&#58; ctypes.cint32&#41;&#58; Pointer;   Cdecl; External;
    Procedure MUnmap&#40;p&#58; Pointer; nSize&#58; ctypes.cint32&#41;;                                         Cdecl; External;
    Procedure ChangeDir&#40;pszDir&#58; PChar&#41;;                                                         Cdecl; External;
    Procedure ExecuteFile&#40;pszFile&#58; PChar; nZero1,nZero2&#58; ctypes.cint32&#41;;                        Cdecl; External;
    I was missing the Cdecl declaration for the external routines!

    I will now be playing around with accessing the hardware of the gp2x directly using the above routines to see if I can get some graphics working faster on the gp2x

    cheers,
    Paul.
    Games:
    Seafox


    Pages:
    Syntax Error Software itch.io page

    Online Chess
    http://gameknot.com/#paul_nicholls

  8. #68

    GP2X Issues...

    You could take a look to my gba and/or nds port. I have resolved issues like that, so you could save alot of time
    Get your fpc4gba copy now!
    Get your fpc4nds copy now!

  9. #69

    GP2X Issues...

    Quote Originally Posted by Legolas
    You could take a look to my gba and/or nds port. I have resolved issues like that, so you could save alot of time
    Thanks!
    I will take a look...I have already downloaded the fpc4nds stuff before but I hadn't had much of a look yet.

    cheers,
    Paul.
    Games:
    Seafox


    Pages:
    Syntax Error Software itch.io page

    Online Chess
    http://gameknot.com/#paul_nicholls

Page 7 of 7 FirstFirst ... 567

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •