Page 4 of 8 FirstFirst ... 23456 ... LastLast
Results 31 to 40 of 77

Thread: GBA + FPC = Possiblility???

  1. #31
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    GBA + FPC = Possiblility???

    So it is safe to say that 2 things are required of Free Pascal.

    1) THUMB instructions

    2) a way to link the crt0.[o|as] startup code.

    The rest seem like stuff that can be done by a modivated party, which does exist. noeska and {MSX} both have a keen interest aswell as many others.

    If someone can confirm to me that this is all that is required, I can try to track down FPK myself or one of the other members of FPC's development team and make a solid requiest for this. OR the detailed information required to make it happen. Otherwise they will not want to do it for nothing.
    Jason McMillen
    Pascal Game Development
    Co-Founder





  2. #32

    GBA + FPC = Possiblility???

    1) i am not sure about the need for thumb instructions it seems to me both can be handled although thumb is faster when running from cartridge.
    2) linking in the proper crt0.as for booting. This is the part where i fail. If someone get this working i can continue..
    http://3das.noeska.com - create adventure games without programming

  3. #33
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    GBA + FPC = Possiblility???

    I had a small chat with FPK in the #fpc and new #pgd channels...

    <WILL> Umm... will I get hurt if I mention GBA?
    <fpk> no, did you make an fpc port for it ?

    <WILL> no, but I have interested parties!
    <WILL> Seriously...

    <WILL> noeska and MSX were quite interested....

    <WILL> however didn't know what to do to do the required work for it.

    <fpk> WILL: first, they must be able to compile fpc from sources
    <WILL> ok
    <fpk> http://www.freepascal.org/wiki/index.php/How_to_start may help

    <WILL> it is FPC source right? it compiles it's self?
    <WILL> ah...
    <fpk> WILL: yes, see the mention page

    <WILL> sorry didn't see it. Looking it over.

    <fpk> WILL: then they need to make a fpc/compiler/systems/i_gba.pas and fpc/compiler/systems/t_gba.pas
    <fpk> those can be hacked from the other files in that dir

    <WILL> fpk: I think noeska is your man...
    <WILL> he as looking through the source I think. Didn't know what files to add the THUMB instructions to
    <WILL> I'll pass the information you just sent me over to noeska on the thread on PGD
    <fpk> if you need thumb instructions, I think it's easier when I do this
    <WILL> So you'd be willing to add the THUMB is what you're saying?
    <WILL> provided that someone is able to maintain and work on the rest?
    <fpk> yes
    <WILL> ok

    Does this provide you with any insight noeska?


    As for the THUMB... if I recall one way is faster from the cart and another way is faster from memory... then agian it might havebeen something to do with types of memory access instead.

    Next time I see FPK online I'll ask him about the crt0.as linking. But his best suggestion was that you manage to get a compiling version of FPC first and then you can make a port.
    Jason McMillen
    Pascal Game Development
    Co-Founder





  4. #34

    GBA + FPC = Possiblility???

    I will try out the above in the next week. (if i can find time :-) )
    http://3das.noeska.com - create adventure games without programming

  5. #35

    GBA + FPC = Possiblility???

    The whole trick how to link etc. is done in the fpc/compiler/systems/*.pas files. So take one of the files there, e.g. the i_linux.pas and t_linux.pas and use them as template for t_gba.pas and i_gba.pas. fpc/compiler/arm/cpu.

    Include them in the compiler by adding them to fpc/compiler/compiler.pas (i_gba.pas) and fpc/compiler/arm/cputarg.pas.

    About thumb: I guess it's possible for now to make a gba port without thumb instructions first. When the compiler supports it, it can be easily used.
    <a>http://www.freepascal.org</a>

  6. #36
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    GBA + FPC = Possiblility???

    Thanks FPK, I'll try to do as you suggest, however I too am limited to my time. :?

    I already downloaded the 1.9.6 source, unzipped the compiler sources and opened the i_linux.pas and t_linux.pas hoping for an easy task of just renaming or switching a setting here or there, well I can tell right now I'll be asking quite a few questions about the guts of these two bad-boys.

    Am I mistaken in the idea that I should remove all other CPU platforms for the i_gba.pas and t_gba.pas?

    Also what did you mean by adding "fpc/compiler/arm/cpu." at the end of your first paragraph? I got confused by what you were trying to say with that.
    Jason McMillen
    Pascal Game Development
    Co-Founder





  7. #37
    Anonymous
    Guest

    GBA + FPC = Possiblility???

    I always first get crt0.c ported (the static prt0.as first, do the cprt one later), and check all structures (which should be a problem since FPC already supports one arm/linux).
    So

    - The first step is get crt + rtl running for a hello world program,
    - the second the compiler itself.
    - After that I do the target stuff, to ease compiling.
    - and then advance to get shared linking with C working (cprt), and
    create full snapshots.

  8. #38

    GBA + FPC = Possiblility???

    Like Will i have taken a good look at the i and t files, but i do not get an idea from it as to what to change inside it.

    Also i still cannot make sense of the linker script that comes with crt0.s .

    I post it below here in the hope that someone says i understand that (i do not, it obviously is not as simple as linking in crt0.o).

    Also again a link to: http://linux.gbadev.org/gcc-gba/ .

    Code:
    /* Linker Script v1.3 by Jeff Frohwein              */
    /*  v1.0 - Original release                         */
    /*  v1.1 - Added proper .data section support       */
    /*  v1.2 - Added support for c++ & iwram overlays   */
    /*       - Major contributions by Jason Wilkins.    */
    /*  v1.3 - .ewram section now can be used when      */
    /*         compiling for MULTIBOOT mode. This fixes */
    /*         malloc&#40;&#41; in DevKitAdvance which depends  */
    /*         on __eheap_start instead of end to define*/
    /*         the starting location of heap space.     */
    /*         External global variable __gba_iwram_heap*/
    /*         support added to allow labels end, _end, */
    /*         & __end__ to point to end of iwram or    */
    /*         the end of ewram.                        */
    
    /* This file is released into the public domain   */
    /* for commercial or non-commercial use with no   */
    /* restrictions placed upon it.                   */
    
    /* NOTE!!!&#58; This linker script defines the RAM &  */
    /*   ROM start addresses. In order for it to work */
    /*   properly, remove -Ttext and -Tbss linker     */
    /*   options from your makefile if they are       */
    /*   present.                                     */
    
    /* You can use the following to view section      */
    /* addresses in your .elf file&#58;                   */
    /*   objdump -h file.elf                          */
    /* Please note that empty sections may incorrectly*/
    /* list the lma address as the vma address for    */
    /* some versions of objdump.                      */
    
    OUTPUT_FORMAT&#40;"elf32-littlearm", "elf32-bigarm", "elf32-littlearm"&#41;
    OUTPUT_ARCH&#40;arm&#41;
    ENTRY&#40;_start&#41;
    /* SEARCH_DIR&#40;/bin/arm&#41;; */
    
    /* By default this linker script will generate code        */
    /* for flash carts located at 0x8000000. In order to       */
    /* generate code that is compiled at 0x2000000 that        */
    /* will run on flash carts or in multiboot mode then       */
    /* you need to add the following variable to your main     */
    /* project file. It's value is NOT important but           */
    /* IT MUST BE A GLOBAL VARIABLE OR IT WILL NOT WORK&#58;       */
    
    /*   #define MULTIBOOT int __gba_multiboot;                */
    /* Then use it like this&#58; MULTIBOOT                        */
    
    /* By default this linker script will set the labels       */
    /* end, _end, & __end__ at the end of ewram. To force      */
    /* them to be set to the end of iwram then you need to     */
    /* add the following variable to your main                 */
    /* project file. It's value is NOT important but           */
    /* IT MUST BE A GLOBAL VARIABLE OR IT WILL NOT WORK&#58;       */
    
    /*   #define IWRAMHEAP int __gba_iwram_heap;               */
    /* Then use it like this&#58; IWRAMHEAP                        */
    
    /* The linker script function "var1 += var2;" sometimes    */
    /* reports incorrect values in the *.map file but the      */
    /* actual value it calculates is usually, if not always,   */
    /* correct. If you leave out the ". = ALIGN&#40;4&#41;;" at the    */
    /* end of each section then the return value of SIZEOF&#40;&#41;   */
    /* is sometimes incorrect and "var1 += var2;" appears to   */
    /* not work as well. "var1 += var2" style functions are    */
    /* avoided below as a result.                              */
    
    /* The linker script MEMORY directive is not used here due    */
    /* to the fact that __text_start is not always a fixed value. */
    
    __text_start = DEFINED &#40;__gba_multiboot&#41; ? 0x2000000 &#58; 0x8000000;
    /* __ewram_start     = 0x2000000; */ /* Removed in v1.3 */
    __eheap_end       = 0x2040000;
    __iwram_start     = 0x3000000;
    __iheap_end       = 0x3008000 - 0x400;
    __sp_usr          = 0x3008000 - 0x100;
    __sp_irq          = 0x3008000 - 0x60;
    __intr_vector_buf = 0x3008000 - 4;
    __sp_usr_offset   = __sp_usr - __iwram_start;
    __intr_vect_offset = __intr_vector_buf - __sp_usr;
    
    SECTIONS
    &#123;
      .text __text_start &#58;   /* ALIGN &#40;4&#41;&#58; */
      &#123;
        *&#40;EXCLUDE_FILE &#40;*text.iwram*&#41; .text&#41;
        *&#40;.text.*&#41;
        *&#40;.stub&#41;
        /* .gnu.warning sections are handled specially by elf32.em.  */
        *&#40;.gnu.warning&#41;
        *&#40;.gnu.linkonce.t*&#41;
        *&#40;.glue_7&#41;
        *&#40;.glue_7t&#41;
        . = ALIGN&#40;4&#41;;  /* REQUIRED. LD is flaky without it. */
      &#125; = 0xff
    /*  laddr = ADDR&#40;.text&#41; + SIZEOF&#40;.text&#41;; */
      __text_end = .;
    
      .rodata &#58;
      &#123;
        *&#40;.rodata&#41;
        *all.rodata*&#40;*&#41;
        *&#40;.roda&#41;
        *&#40;.rodata.*&#41;
        *&#40;.gnu.linkonce.r*&#41;
        SORT&#40;CONSTRUCTORS&#41;
        . = ALIGN&#40;4&#41;;   /* REQUIRED. LD is flaky without it. */
      &#125; = 0xff
    /*  laddr += SIZEOF&#40;.rodata&#41;; */
    
      .ctors &#58;
      &#123;
        /* gcc uses crtbegin.o to find the start of the constructors, so
           we make sure it is first.  Because this is a wildcard, it
           doesn't matter if the user does not actually link against
           crtbegin.o; the linker won't look for a file to match a
           wildcard.  The wildcard also means that it doesn't matter which
           directory crtbegin.o is in.  */
        KEEP &#40;*crtbegin.o&#40;.ctors&#41;&#41;
        KEEP &#40;*&#40;EXCLUDE_FILE &#40;*crtend.o&#41; .ctors&#41;&#41;
        KEEP &#40;*&#40;SORT&#40;.ctors.*&#41;&#41;&#41;
        KEEP &#40;*&#40;.ctors&#41;&#41;
        . = ALIGN&#40;4&#41;;   /* REQUIRED. LD is flaky without it. */
      &#125; = 0
    /*  laddr += SIZEOF&#40;.ctors&#41;; */
      laddr = ADDR&#40;.text&#41; + SIZEOF&#40;.text&#41; + SIZEOF&#40;.rodata&#41; + SIZEOF&#40;.ctors&#41;;
    
      .dtors &#58;
      &#123;
        KEEP &#40;*crtbegin.o&#40;.dtors&#41;&#41;
        KEEP &#40;*&#40;EXCLUDE_FILE &#40;*crtend.o&#41; .dtors&#41;&#41;
        KEEP &#40;*&#40;SORT&#40;.dtors.*&#41;&#41;&#41;
        KEEP &#40;*&#40;.dtors&#41;&#41;
        . = ALIGN&#40;4&#41;;   /* REQUIRED. LD is flaky without it. */
      &#125; = 0
    /*  laddr += SIZEOF&#40;.dtors&#41;; */
      laddr = ADDR&#40;.text&#41; + SIZEOF&#40;.text&#41; + SIZEOF&#40;.rodata&#41; + SIZEOF&#40;.ctors&#41; + SIZEOF&#40;.dtors&#41;;
    
      .eh_frame &#58;
      &#123;
        KEEP &#40;*&#40;.eh_frame&#41;&#41;
        . = ALIGN&#40;4&#41;;   /* REQUIRED. LD is flaky without it. */
      &#125; = 0
    /*  laddr += SIZEOF&#40;.eh_frame&#41;; */
    
      .gcc_except_table &#58;
      &#123;
        *&#40;.gcc_except_table&#41;
        . = ALIGN&#40;4&#41;;   /* REQUIRED. LD is flaky without it. */
      &#125; = 0
    /*  laddr += &#40;SIZEOF&#40;.gcc_except_table&#41; + 3&#41; & ~ 3; */
    /*  __iwram_lma = laddr; */
      __iwram_lma = &#40;ADDR&#40;.text&#41; + SIZEOF&#40;.text&#41; + SIZEOF&#40;.rodata&#41; + SIZEOF&#40;.ctors&#41; + SIZEOF&#40;.dtors&#41; + SIZEOF&#40;.eh_frame&#41; + SIZEOF&#40;.gcc_except_table&#41; + 3&#41; & ~ 3;
    
      .iwram __iwram_start &#58; AT &#40;__iwram_lma&#41;
      &#123;
        __iwram_start = ABSOLUTE&#40;.&#41; ;
        *&#40;.iwram&#41;
        *iwram.*&#40;.text&#41;
        . = ALIGN&#40;4&#41;;   /* REQUIRED. LD is flaky without it. */
      &#125; = 0xff
    /*  laddr += SIZEOF&#40;.iwram&#41;; */
    /*  __data_lma = laddr; */
      __data_lma = ADDR&#40;.text&#41; + SIZEOF&#40;.text&#41; + SIZEOF&#40;.rodata&#41; + SIZEOF&#40;.ctors&#41; + SIZEOF&#40;.dtors&#41; + SIZEOF&#40;.eh_frame&#41; + SIZEOF&#40;.gcc_except_table&#41; + SIZEOF&#40;.iwram&#41;;
    
      __iwram_end = . ;
    
      .bss ALIGN&#40;4&#41; &#58;
      &#123;
       __bss_start = ABSOLUTE&#40;.&#41;;
       __bss_start__ = ABSOLUTE&#40;.&#41;;
       *&#40;.dynbss&#41;
       *&#40;.gnu.linkonce.b*&#41;
       *&#40;COMMON&#41;
       . = ALIGN&#40;4&#41;;    /* REQUIRED. LD is flaky without it. */
      &#125;
    
      __bss_end = . ;
      __bss_end__ = . ;
    
      .data ALIGN&#40;4&#41; &#58; AT &#40;__data_lma&#41;
      &#123;
        __data_start = ABSOLUTE&#40;.&#41;;
        *&#40;.data&#41;
        *&#40;.data.*&#41;
        *&#40;.gnu.linkonce.d*&#41;
        CONSTRUCTORS
        . = ALIGN&#40;4&#41;;  /* REQUIRED. LD is flaky without it. */
      &#125; = 0xff
    /*  laddr += SIZEOF&#40;.data&#41;; */
    /*  __iwram_overlay_lma = laddr; */
      __iwram_overlay_lma = ADDR&#40;.text&#41; + SIZEOF&#40;.text&#41; + SIZEOF&#40;.rodata&#41; + SIZEOF&#40;.ctors&#41; + SIZEOF&#40;.dtors&#41; + SIZEOF&#40;.eh_frame&#41; + SIZEOF&#40;.gcc_except_table&#41; + SIZEOF&#40;.iwram&#41; + SIZEOF&#40;.data&#41;;
    
      __data_end  =  .;
      PROVIDE &#40;edata = .&#41;;
    /*  __data_lma = LOADADDR&#40;.data&#41;; */
      __iwram_overlay_start = . ;
    
      OVERLAY &#58; NOCROSSREFS AT &#40;__iwram_overlay_lma&#41;
      &#123;
         .iwram0 &#123; *&#40;.iwram0&#41; . = ALIGN&#40;4&#41;;&#125;
         .iwram1 &#123; *&#40;.iwram1&#41; . = ALIGN&#40;4&#41;;&#125;
         .iwram2 &#123; *&#40;.iwram2&#41; . = ALIGN&#40;4&#41;;&#125;
         .iwram3 &#123; *&#40;.iwram3&#41; . = ALIGN&#40;4&#41;;&#125;
         .iwram4 &#123; *&#40;.iwram4&#41; . = ALIGN&#40;4&#41;;&#125;
         .iwram5 &#123; *&#40;.iwram5&#41; . = ALIGN&#40;4&#41;;&#125;
         .iwram6 &#123; *&#40;.iwram6&#41; . = ALIGN&#40;4&#41;;&#125;
         .iwram7 &#123; *&#40;.iwram7&#41; . = ALIGN&#40;4&#41;;&#125;
         .iwram8 &#123; *&#40;.iwram8&#41; . = ALIGN&#40;4&#41;;&#125;
         .iwram9 &#123; *&#40;.iwram9&#41; . = ALIGN&#40;4&#41;;&#125;
      &#125; = 0xff
    /*  laddr += &#40;SIZEOF&#40;.iwram0&#41;+SIZEOF&#40;.iwram1&#41;+SIZEOF&#40;.iwram2&#41;+SIZEOF&#40;.iwram3&#41;+SIZEOF&#40;.iwram4&#41;+SIZEOF&#40;.iwram5&#41;+SIZEOF&#40;.iwram6&#41;+SIZEOF&#40;.iwram7&#41;+SIZEOF&#40;.iwram8&#41;+SIZEOF&#40;.iwram9&#41;&#41;; */
    /*  __ewram_lma = laddr; */
      __ewram_lma = ADDR&#40;.text&#41; + SIZEOF&#40;.text&#41; + SIZEOF&#40;.rodata&#41; + SIZEOF&#40;.ctors&#41; + SIZEOF&#40;.dtors&#41; + SIZEOF&#40;.eh_frame&#41; + SIZEOF&#40;.gcc_except_table&#41; + SIZEOF&#40;.iwram&#41; + SIZEOF&#40;.data&#41; + SIZEOF&#40;.iwram0&#41;+SIZEOF&#40;.iwram1&#41;+SIZEOF&#40;.iwram2&#41;+SIZEOF&#40;.iwram3&#41;+SIZEOF&#40;.iwram4&#41;+SIZEOF&#40;.iwram5&#41;+SIZEOF&#40;.iwram6&#41;+SIZEOF&#40;.iwram7&#41;+SIZEOF&#40;.iwram8&#41;+SIZEOF&#40;.iwram9&#41;;
    
    /*  __iwram_overlay_lma = LOADADDR &#40;.iwram0&#41;; */
      __iwram_overlay_end = . ;
    /*  _end = . ; */
    /*  __end__ = . ; */
    /*  PROVIDE &#40;end = .&#41;; */
      __iheap_start = . ;
    
      /* v1.3 */
      __ewram_start = DEFINED &#40;__gba_multiboot&#41; ? __ewram_lma &#58; 0x2000000;
    
      .ewram __ewram_start &#58; AT &#40;__ewram_lma&#41;
      &#123;
    /*    __ewram_start = ABSOLUTE&#40;.&#41;; */
        *&#40;.ewram&#41;
        . = ALIGN&#40;4&#41;;  /* REQUIRED. LD is flaky without it. */
      &#125; = 0xff
    /*  laddr += SIZEOF&#40;.ewram&#41;; */
    /*  __ewram_overlay_lma = laddr; */
      __ewram_overlay_lma = ADDR&#40;.text&#41; + SIZEOF&#40;.text&#41; + SIZEOF&#40;.rodata&#41; + SIZEOF&#40;.ctors&#41; + SIZEOF&#40;.dtors&#41; + SIZEOF&#40;.eh_frame&#41; + SIZEOF&#40;.gcc_except_table&#41; + SIZEOF&#40;.iwram&#41; + SIZEOF&#40;.data&#41; + SIZEOF&#40;.iwram0&#41;+SIZEOF&#40;.iwram1&#41;+SIZEOF&#40;.iwram2&#41;+SIZEOF&#40;.iwram3&#41;+SIZEOF&#40;.iwram4&#41;+SIZEOF&#40;.iwram5&#41;+SIZEOF&#40;.iwram6&#41;+SIZEOF&#40;.iwram7&#41;+SIZEOF&#40;.iwram8&#41;+SIZEOF&#40;.iwram9&#41; + SIZEOF&#40;.ewram&#41;;
    
    /*  __ewram_lma = LOADADDR&#40;.ewram&#41;; */
      __ewram_end = . ;
      __ewram_overlay_start = . ;
    
      OVERLAY ALIGN&#40;4&#41;&#58; NOCROSSREFS AT &#40;__ewram_overlay_lma&#41;
      &#123;
         .ewram0 &#123; *&#40;.ewram0&#41; . = ALIGN&#40;4&#41;;&#125;
         .ewram1 &#123; *&#40;.ewram1&#41; . = ALIGN&#40;4&#41;;&#125;
         .ewram2 &#123; *&#40;.ewram2&#41; . = ALIGN&#40;4&#41;;&#125;
         .ewram3 &#123; *&#40;.ewram3&#41; . = ALIGN&#40;4&#41;;&#125;
         .ewram4 &#123; *&#40;.ewram4&#41; . = ALIGN&#40;4&#41;;&#125;
         .ewram5 &#123; *&#40;.ewram5&#41; . = ALIGN&#40;4&#41;;&#125;
         .ewram6 &#123; *&#40;.ewram6&#41; . = ALIGN&#40;4&#41;;&#125;
         .ewram7 &#123; *&#40;.ewram7&#41; . = ALIGN&#40;4&#41;;&#125;
         .ewram8 &#123; *&#40;.ewram8&#41; . = ALIGN&#40;4&#41;;&#125;
         .ewram9 &#123; *&#40;.ewram9&#41; . = ALIGN&#40;4&#41;;&#125;
      &#125; = 0xff
    
      __ewram_overlay_end = . ;
    
      __eheap_start = . ;
    
      _end = DEFINED &#40;__gba_iwram_heap&#41; ? __iheap_start &#58; .; /* v1.3 */
      __end__ = _end ; /* v1.3 */
      PROVIDE &#40;end = _end&#41;; /* v1.3 */
    
      /* Stabs debugging sections.  */
      .stab 0 &#58; &#123; *&#40;.stab&#41; &#125;
      .stabstr 0 &#58; &#123; *&#40;.stabstr&#41; &#125;
      .stab.excl 0 &#58; &#123; *&#40;.stab.excl&#41; &#125;
      .stab.exclstr 0 &#58; &#123; *&#40;.stab.exclstr&#41; &#125;
      .stab.index 0 &#58; &#123; *&#40;.stab.index&#41; &#125;
      .stab.indexstr 0 &#58; &#123; *&#40;.stab.indexstr&#41; &#125;
      .comment 0 &#58; &#123; *&#40;.comment&#41; &#125;
      /* DWARF debug sections.
         Symbols in the DWARF debugging sections are relative to the beginning
         of the section so we begin them at 0.  */
      /* DWARF 1 */
      .debug          0 &#58; &#123; *&#40;.debug&#41; &#125;
      .line           0 &#58; &#123; *&#40;.line&#41; &#125;
      /* GNU DWARF 1 extensions */
      .debug_srcinfo  0 &#58; &#123; *&#40;.debug_srcinfo&#41; &#125;
      .debug_sfnames  0 &#58; &#123; *&#40;.debug_sfnames&#41; &#125;
      /* DWARF 1.1 and DWARF 2 */
      .debug_aranges  0 &#58; &#123; *&#40;.debug_aranges&#41; &#125;
      .debug_pubnames 0 &#58; &#123; *&#40;.debug_pubnames&#41; &#125;
      /* DWARF 2 */
      .debug_info     0 &#58; &#123; *&#40;.debug_info&#41; &#125;
      .debug_abbrev   0 &#58; &#123; *&#40;.debug_abbrev&#41; &#125;
      .debug_line     0 &#58; &#123; *&#40;.debug_line&#41; &#125;
      .debug_frame    0 &#58; &#123; *&#40;.debug_frame&#41; &#125;
      .debug_str      0 &#58; &#123; *&#40;.debug_str&#41; &#125;
      .debug_loc      0 &#58; &#123; *&#40;.debug_loc&#41; &#125;
      .debug_macinfo  0 &#58; &#123; *&#40;.debug_macinfo&#41; &#125;
      /* SGI/MIPS DWARF 2 extensions */
      .debug_weaknames 0 &#58; &#123; *&#40;.debug_weaknames&#41; &#125;
      .debug_funcnames 0 &#58; &#123; *&#40;.debug_funcnames&#41; &#125;
      .debug_typenames 0 &#58; &#123; *&#40;.debug_typenames&#41; &#125;
      .debug_varnames  0 &#58; &#123; *&#40;.debug_varnames&#41; &#125;
      .stack 0x80000 &#58; &#123; _stack = .; *&#40;.stack&#41; &#125;
      /* These must appear regardless of  .  */
    &#125;
    http://3das.noeska.com - create adventure games without programming

  9. #39

    GBA + FPC = Possiblility???

    I found somewhere a couple of crt0.s a bit simpler than Jeff Frohwein's one:

    Code:
    @********************************************************************
    @*          crt0.s                                                  *
    @  This file is a hack. It is not meant for serious work.           *
    @********************************************************************
        .TEXT
    
        .GLOBAL     _start
    _start&#58;
            .ALIGN
            .CODE 32
            @ Start Vector
    rom_header&#58;     b       rom_header_end
    
            @ Nintendo Logo Character Data &#40;8000004h&#41;
                    .byte   0x24,0xff,0xae,0x51,0x69,0x9a,0xa2,0x21
                    .byte   0x3d,0x84,0x82,0x0a,0x84,0xe4,0x09,0xad
                    .byte   0x11,0x24,0x8b,0x98,0xc0,0x81,0x7f,0x21
                    .byte   0xa3,0x52,0xbe,0x19,0x93,0x09,0xce,0x20
                    .byte   0x10,0x46,0x4a,0x4a,0xf8,0x27,0x31,0xec
                    .byte   0x58,0xc7,0xe8,0x33,0x82,0xe3,0xce,0xbf
                    .byte   0x85,0xf4,0xdf,0x94,0xce,0x4b,0x09,0xc1
                    .byte   0x94,0x56,0x8a,0xc0,0x13,0x72,0xa7,0xfc
                    .byte   0x9f,0x84,0x4d,0x73,0xa3,0xca,0x9a,0x61
                    .byte   0x58,0x97,0xa3,0x27,0xfc,0x03,0x98,0x76
                    .byte   0x23,0x1d,0xc7,0x61,0x03,0x04,0xae,0x56
                    .byte   0xbf,0x38,0x84,0x00,0x40,0xa7,0x0e,0xfd
                    .byte   0xff,0x52,0xfe,0x03,0x6f,0x95,0x30,0xf1
                    .byte   0x97,0xfb,0xc0,0x85,0x60,0xd6,0x80,0x25
                    .byte   0xa9,0x63,0xbe,0x03,0x01,0x4e,0x38,0xe2
                    .byte   0xf9,0xa2,0x34,0xff,0xbb,0x3e,0x03,0x44
                    .byte   0x78,0x00,0x90,0xcb,0x88,0x11,0x3a,0x94
                    .byte   0x65,0xc0,0x7c,0x63,0x87,0xf0,0x3c,0xaf
                    .byte   0xd6,0x25,0xe4,0x8b,0x38,0x0a,0xac,0x72
                    .byte   0x21,0xd4,0xf8,0x07
    
            @ Software Titles &#40;80000A0h&#41;
                    .byte   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
                    .byte   0x00,0x00,0x00,0x00
    
            @ Initial Code &#40;80000ACh&#41;
                    .byte   0x00,0x00,0x00,0x00
    
            @ Maker Code &#40;80000B0h&#41;
                    .byte   0x30,0x31
    
            @ Fixed Value &#40;80000B2h&#41;
                    .byte   0x96
    
            @ Main Unit Code &#40;80000B3h&#41;
                    .byte   0x00
    
            @ Device Type &#40;80000B4h&#41;
                    .byte   0x00
    
            @ Unused Data &#40;7Byte&#41; &#40;80000B5h&#41;
                    .byte   0x00,0x00,0x00,0x00,0x00,0x00,0x00
    
            @ Software Version No &#40;80000BCh&#41;
                    .byte   0x00
    
            @ Complement Check &#40;80000BDh&#41;
                    .byte   0xf0
    
            @ Check Sum &#40;80000BEh&#41;
                    .byte   0x00,0x00
    
    rom_header_end&#58;
    
    @--------------------------------------------------------------------
    @-                          Reset                                   -
    @--------------------------------------------------------------------
        .EXTERN     AgbMain
        .GLOBAL     start_vector
        .CODE 32
        .ALIGN
    start_vector&#58;
            mov     r0, #0x12               @ Switch to IRQ Mode
            msr     cpsr, r0
            ldr     sp, sp_irq              @ Set SP_irq
            mov     r0, #0x1f               @ Switch to System Mode
            msr     cpsr, r0
            ldr     sp, sp_usr              @ Set SP_usr
            str     r0, &#91;r1&#93;
            ldr     r1, =AgbMain            @ Start & Switch to 16bit Code
            mov     lr, pc
            bx      r1
            b       start_vector            @ Reset
    
        .ALIGN
    sp_usr&#58; .word   0x3008000 - 0x100
    sp_irq&#58; .word   0x3008000 - 0x60
    
        .ALIGN
        .CODE 32
    
        .END
    and

    Code:
        # This code belong to the 'text' section
        .section .text,"ax"
        # All the following code is using ARM instruction set
        .arm
        # Align with word boundaries
        .align 4
    
        # Some external function used later
        .extern main
    
        # The startup code function
        .global _start
    _start&#58;
        b    rom_start
    
        # Above his the ROM header with dummy values
        # and will be override with tools like gba-header
    
        # Nintendo Logo &#40;156 bytes&#41;
        .byte 0,0,0,0,0,0,0,0,0,0
        .byte 0,0,0,0,0,0,0,0,0,0
        .byte 0,0,0,0,0,0,0,0,0,0
        .byte 0,0,0,0,0,0,0,0,0,0
        .byte 0,0,0,0,0,0,0,0,0,0
        .byte 0,0,0,0,0,0,0,0,0,0
        .byte 0,0,0,0,0,0,0,0,0,0
        .byte 0,0,0,0,0,0,0,0,0,0
        .byte 0,0,0,0,0,0,0,0,0,0
        .byte 0,0,0,0,0,0,0,0,0,0
        .byte 0,0,0,0,0,0,0,0,0,0
        .byte 0,0,0,0,0,0,0,0,0,0
        .byte 0,0,0,0,0,0,0,0,0,0
        .byte 0,0,0,0,0,0,0,0,0,0
        .byte 0,0,0,0,0,0,0,0,0,0
        .byte 0,0,0,0,0,0
        # Game Title &#40;12 bytes&#41;
        .ascii "ABCDEFGHIJKL"
        # Game Code &#40;4 bytes&#41;
        .ascii "1234"
        # Maker Code &#40;2 bytes&#41;
        .ascii "_$"
        # Fixed value &#40;1 byte&#41;
        .byte 0x96
        # Main unit code &#40;1 byte&#41;
        .byte 0
        # Device Type &#40;1 byte&#41;
        .byte 0
        # Reserved &#40;7 bytes&#41;
        .byte 0,0,0,0,0,0,0
        # Software version &#40;1 byte&#41;
        .byte 0
        # Complement check &#40;1 byte&#41;
        .byte 0
        # Reserved &#40;2 bytes&#41;
        .byte 0,0
    
        .align 4
    rom_start&#58;
        # Set the User stack
        mov r0, #0x1f
        msr cpsr, r0
        ldr sp, =0x3007ff0
    
        # argc=0 and arg=NULL
        mov r0, #0
        mov r1, r0
    
        # Jump to the main
        bl  main
    
        # Just loop now &#40;the program finished&#41;
    __loop&#58;
        b   __loop
    In the second I think you must replace all '#' with '@', according with your assembler.

    In my gpc-gba attempt I have some problem with direct memory access. Seems like I can't write in $4000000 location when I try to set the screen mode.
    Get your fpc4gba copy now!
    Get your fpc4nds copy now!

  10. #40

    GBA + FPC = Possiblility???

    LEGOLAS: Did you try: pointer(pointername) := pointer($4000000);

    Also using yours seems to get me a little bit further, but now i get warnings about:
    FPC_INITIALIZEUNITS and FPC_DO_EXIT .
    http://3das.noeska.com - create adventure games without programming

Page 4 of 8 FirstFirst ... 23456 ... LastLast

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
  •