8Fermer10
Mega ShockedLe 18/05/2021 à 21:07
Thank you for seeing my SOS and reviewing my message in a bottle.

I tried your suggestion and of creating a P2 rom with some data in it.
Upon doing this I was met with challenges and revelations.

1. In my working directory I created a folder called P2 in that folder another folder titled P2_1
P2>P2_1
etc P2_2 (later on)

The folder contains:

common_crt0_cart.s
crt0_cart.s
LevelCollisionMap.c (Data File I am attempting to include in the P2 makefile)
tmp (directory)
build (directory)
makefile

Sad makefile so far.
# $Id: Makefile,v 1.4 2001/05/03 13:43:42 fma Exp $ ####################################### # Base dir of your m68k gcc toolchain # ####################################### BASEDIR = $(NEODEV) AS = as LD = gcc CC = gcc AR = ar OBJC = objcopy BIN2O = bin2elf GFXCC = gfxcc FIXCNV = fixcnv ####################################### # Path to libraries and include files # ####################################### INCDIR = $(BASEDIR)/m68k/include LIBDIR = $(BASEDIR)/m68k/lib TMPDIR = tmp ################################### # Output: {cart, cd} *lower case* # ################################### OUTPUT = cart #OUTPUT = cd ############################ # Settings for cart output # ############################ ROMSIZE = 0x100000 PADBYTE = 0x00 ############################## # Object Files and Libraries # ############################## OBJS = $(TMPDIR)/crt0_$(OUTPUT).o $(TMPDIR)/LevelCollisionMap.o LIBS = -lDATlib -lprocess -lc -lgcc ##################### # Compilation Flags # ##################### ASFLAGS = -m68000 --register-prefix-optional #LDFLAGS = -Wl,-T$(BASEDIR)/src/system/neo$(OUTPUT).x -Xlinker -Map=output.map CCFLAGS = -m68000 -O3 -Wall -fomit-frame-pointer -ffast-math -fno-builtin -nostartfiles -nodefaultlibs -D__$(OUTPUT)__ ARFLAGS = cr DEBUG = -g ############## # Make rules # ############## Build/dev_p2.bin : Build/test.o $(OBJC) --gap-fill=$(PADBYTE) --pad-to=$(ROMSIZE) -R .data -O binary $< $@ #test.o : test.fix $(OBJS) Build/test.o : $(OBJS) $(LD) -L$(LIBDIR) $(CCFLAGS) $(OBJS) $(LIBS) -o $@ $(TMPDIR)/%.o: %.c $(CC) -I$(INCDIR) $(CCFLAGS) -c $< -o $@ $(TMPDIR)/%.o: %.s $(AS) $(ASFLAGS) $< -o $@ clean: rm -f $(TMPDIR)/*.* rm -f palettes.pal rm -f test.o rm -f test.prg rm -f test.fix rm -f test.spr rm -f dev_p2.rom
"common_crt0_cart.s" - this is an altered version of the NeoDev file provided by DATLib when I run the makefile there are errors related to this file.
I guess the big question is can I somehow use the makefile and ignore incorporating this file into the build process?

c:\NeoDev\src\samples\GAME\P2\P2_1>make gcc -Lc:\neodev/m68k/lib -m68000 -O3 -Wall -fomit-frame-pointer -ffast-math -fno-builtin -nostartfiles -nodefaultlibs -D__cart__ tmp/crt0_cart.o tmp/LevelCollisionMap.o -lDATlib -lprocess -lc -lgcc -o Build/test.o tmp/crt0_cart.o: In function `__security_code': tmp/crt0_cart.o(.text+0x10e): undefined reference to `bkp_data' tmp/crt0_cart.o: In function `_entry_user': tmp/crt0_cart.o(.text+0x1f4): undefined reference to `USER' tmp/crt0_cart.o: In function `_entry_player_start': tmp/crt0_cart.o(.text+0x1fa): undefined reference to `PLAYER_START' tmp/crt0_cart.o: In function `_entry_demo_end': tmp/crt0_cart.o(.text+0x202): undefined reference to `DEMO_END' tmp/crt0_cart.o: In function `_entry_coin_sound': tmp/crt0_cart.o(.text+0x20a): undefined reference to `COIN_SOUND'
common_crt0_cart.s

* ++====================================================================++ * || common_crt0_cart.s - C Run Time Startup Code for Neo Geo Cartridge || * ++--------------------------------------------------------------------++ * || $Id: common_crt0_cart.s,v 1.5 2001/07/13 14:46:31 fma Exp $ || * ++--------------------------------------------------------------------++ * || This is the startup code needed by programs compiled with GCC || * ++--------------------------------------------------------------------|| * || BGM: Guitar Vader - S.P.Y. || * ++====================================================================++ _ZERO_DIVIDE = 0x00c00426 _CHK_CMD = 0x00c00426 _TRAPV_CMD = 0x00c00426 _NPC_1010 = 0x00c00426 _NPC_1111 = 0x00c00426 _IRQ4 = 0x00c00426 _IRQ5 = 0x00c00426 _IRQ6 = 0x00c00426 _IRQ7 = 0x00c00426 ********************** Exported Symbols ********************** .globl _start .globl atexit ********************** Imported Symbols ********************** .globl __do_global_ctors .globl __do_global_dtors .globl main .globl memset .globl __bss_start .globl _end ********************** Program Start ************************* ** NOTE: Cartridge systems have swapped IRQ1 and IRQ2 .org 0x0000 .long 0x0010f300 |;reset stack ptr .long 0x00c00402 /*;reset ptr*/ .long 0x00c00408 /*;bus error*/ .long 0x00c0040e /*;address error*/ .long 0x00c00414 /*;illegal instruction*/ .long _ZERO_DIVIDE /*;division by 0*/ .long _CHK_CMD /*;CHK command*/ .long _TRAPV_CMD /*;TRAPV command*/ .long 0x00c0041a /*;illegal privilege*/ .long 0x00c00420 /*;trace exception handling*/ .long _NPC_1010 /*;no package command (1010)*/ .long _NPC_1111 /*;no package command (1111)*/ .long 0x00c00426, 0x00c00426, 0x00c00426 /*;unused*/ .long 0x00c0042c /*;uninitialized interrupt*/ .long 0x00c00426, 0x00c00426, 0x00c00426, 0x00c00426 /*;unused*/ .long 0x00c00426, 0x00c00426, 0x00c00426, 0x00c00426 /*;unused*/ .long 0x00c00432 /*;virtual interrupt*/ |; 0x64 .long _IRQ2, _IRQ1, _IRQ3, _IRQ4, _IRQ5, _IRQ6, _IRQ7 /*;4-7 unused*/ __security_code: .long 0x76004a6d, 0x0a146600, 0x003c206d, 0x0a043e2d .long 0x0a0813c0, 0x00300001, 0x32100c01, 0x00ff671a .long 0x30280002, 0xb02d0ace, 0x66103028, 0x0004b02d .long 0x0acf6606, 0xb22d0ad0, 0x67085088, 0x51cfffd4 .long 0x36074e75, 0x206d0a04, 0x3e2d0a08, 0x3210e049 .long 0x0c0100ff, 0x671a3010, 0xb02d0ace, 0x66123028 .long 0x0002e048, 0xb02d0acf, 0x6606b22d, 0x0ad06708 .long 0x588851cf, 0xffd83607 .word 0x4e75 .org 0x100 .ascii "NEO-GEO\0" .word _NGH .long _PROGRAM_SIZE .long _WRK_BCKP_AREA .word _WRK_BCKP_AREA_SIZE .byte _EYE_CATCHER .byte _EYE_CATCHER_TILES .long JPConfig .long USConfig .long EUConfig jmp _ENTRY_USER jmp _ENTRY_PLAYER_START jmp _ENTRY_DEMO_END jmp _ENTRY_COIN_SOUND _irq3_handler: move.w #1, 0x3C000C _dummy_exc_handler: rte atexit: |;Dummy atexit (does nothing for now) moveq #0, d0 _dummy_config_handler: rts _irq1_handler: |;Standard IRQ1 handler move.w #2, 0x3C000C rte .org 0x182 .long __security_code _dummyTIdata: .word 0x0000 |;* Entry point of our program _start: |;* Setup stack pointer and 'system' pointer |;lea 0x10F300,a7 |;lea 0x108000,a5 |;* Reset watchdog move.b d0, 0x300001 |;* Flush interrupts move.b #7, 0x3C000C move.l #0, TInextTable |;* Enable interrupts move.w #0x2000,sr |;* Initialize BSS section move.l #_end, d0 sub.l #__bss_start, d0 move.l d0, -(a7) clr.l -(a7) pea __bss_start jbsr memset jsr 0xc004c2 |; FIX_CLEAR jsr 0xc004c8 |; LSP_1st |;* Jump to main |;* jbsr main |;* Call global destructors jbsr __do_global_dtors |;* For cart systems, infinite loop 9: jmp 9b(pc) _entry_user: |;* Setup stack pointer and 'system' pointer |;* stack is set up by bios |;* Reset watchdog move.b d0, 0x300001 |;* Flush interrupts move.b #7, 0x3C000C move.l #0, TInextTable |;* Enable interrupts move.w #0x2000,sr jmp USER _entry_player_start: jmp PLAYER_START rts _entry_demo_end: jmp DEMO_END rts _entry_coin_sound: jmp COIN_SOUND rts

2. DATLib ships with neocart.x and neocartBank.x

I realize I have only been using neocart.x in my P1 makefile I have never actually used neocartBank.x (What the heck!?)
It looks like neocartBank.x focuses on building the 1mb P2 rom (I could be wrong)

So all these years I have only been using a P1 rom to access my gfx banks I guess...??

I wish I could see an example of a makefile using neocartBank.x to see if I can somehow work it into my setup.

I commented out the inclusion of the .x file in P2 makefile to see if I could get it to build but no dice.

Here are those files listed as a reference:

neocart.x

/* $Id: neocart.x,v 1.2 2001/04/13 09:36:11 fma Exp $ */ OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k") OUTPUT_ARCH(m68k) ENTRY(_start) SEARCH_DIR(/usr/m68k/m68k-elf/lib); /* Do we need any of these for elf? __DYNAMIC = 0; */ MEMORY { /*roma (rx) : ORIGIN = 0x00000000, LENGTH = 0x100000 ram (rwx) : ORIGIN = 0x00100000, LENGTH = 0xE000 romb (rx) : ORIGIN = 0x00110000, LENGTH = 0xF0000 */ roma (rx) : ORIGIN = 0x00000000, LENGTH = 0x100000 ram (rwx) : ORIGIN = 0x00100000, LENGTH = 0xF000 romb (rx) : ORIGIN = 0x00200000, LENGTH = 0x100000 } SECTIONS { /* Read-only sections, merged into text segment: */ . = 0x80000000 + SIZEOF_HEADERS; .interp : { *(.interp) } .hash : { *(.hash) } .dynsym : { *(.dynsym) } .dynstr : { *(.dynstr) } .gnu.version : { *(.gnu.version) } .gnu.version_d : { *(.gnu.version_d) } .gnu.version_r : { *(.gnu.version_r) } .rel.init : { *(.rel.init) } .rela.init : { *(.rela.init) } .rel.text : { *(.rel.text) *(.rel.text.*) *(.rel.gnu.linkonce.t*) } .rela.text : { *(.rela.text) *(.rela.text.*) *(.rela.gnu.linkonce.t*) } .rel.fini : { *(.rel.fini) } .rela.fini : { *(.rela.fini) } .rel.rodata : { *(.rel.rodata) *(.rel.rodata.*) *(.rel.gnu.linkonce.r*) } .rela.rodata : { *(.rela.rodata) *(.rela.rodata.*) *(.rela.gnu.linkonce.r*) } .rel.data : { *(.rel.data) *(.rel.data.*) *(.rel.gnu.linkonce.d*) } .rela.data : { *(.rela.data) *(.rela.data.*) *(.rela.gnu.linkonce.d*) } .rel.ctors : { *(.rel.ctors) } .rela.ctors : { *(.rela.ctors) } .rel.dtors : { *(.rel.dtors) } .rela.dtors : { *(.rela.dtors) } .rel.got : { *(.rel.got) } .rela.got : { *(.rela.got) } .rel.sdata : { *(.rel.sdata) *(.rel.sdata.*) *(.rel.gnu.linkonce.s*) } .rela.sdata : { *(.rela.sdata) *(.rela.sdata.*) *(.rela.gnu.linkonce.s*) } .rel.sbss : { *(.rel.sbss) } .rela.sbss : { *(.rela.sbss) } .rel.bss : { *(.rel.bss) } .rela.bss : { *(.rela.bss) } .rel.plt : { *(.rel.plt) } .rela.plt : { *(.rela.plt) } .init : { KEEP (*(.init)) } =0x4e75 .plt : { *(.plt) } .text : { *(.text) *(.text.*) *(.stub) /* .gnu.warning sections are handled specially by elf32.em. */ *(.gnu.warning) *(.gnu.linkonce.t*) . = ALIGN(0x4); __CTOR_LIST__ = .; LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) *(.ctors) LONG(0) __CTOR_END__ = .; __DTOR_LIST__ = .; LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) *(.dtors) LONG(0) __DTOR_END__ = .; } =0x4e75 _etext = .; PROVIDE (etext = .); .fini : { KEEP (*(.fini)) } =0x4e75 .rodata : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r*) } .rodata1 : { *(.rodata1) } .gcc_except_table : { *(.gcc_except_table) } /* Adjust the address for the data segment. We want to adjust up to the same address within the page on the next page up. */ .ctors ALIGN(4): { /* 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 (*crtbegin.o(.ctors)) /* We don't want to include the .ctor section from from the crtend.o file until after the sorted ctors. The .ctor section from the crtend file contains the end of ctors marker and it must be last */ KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors)) KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) } .dtors : { KEEP (*crtbegin.o(.dtors)) KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors)) KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) } . = ALIGN(0x10) + (. & (0x10 - 1)); .data : { *(.data) *(.data.*) *(.gnu.linkonce.d*) } .data1 : { *(.data1) } .eh_frame : { *(.eh_frame) } .got : { *(.got.plt) *(.got) } .dynamic : { *(.dynamic) } /* We want the small data sections together, so single-instruction offsets can access them all, and initialized data all before uninitialized, so we can shorten the on-disk segment size. */ .sdata : { *(.sdata) *(.sdata.*) *(.gnu.linkonce.s.*) } _edata = .; PROVIDE (edata = .); __bss_start = .; .sbss : { *(.dynsbss) *(.sbss) *(.sbss.*) *(.scommon) } .bss : { *(.dynbss) *(.bss) *(.bss.*) *(COMMON) /* Align here to ensure that the .bss section occupies space up to _end. Align after .bss to ensure correct alignment even if the .bss section disappears because there are no input sections. */ . = ALIGN(32 / 8); } . = ALIGN(32 / 8); _end = .; PROVIDE (end = .); /* Stabs debugging sections. */ .stab 0 : { *(.stab) } .stabstr 0 : { *(.stabstr) } .stab.excl 0 : { *(.stab.excl) } .stab.exclstr 0 : { *(.stab.exclstr) } .stab.index 0 : { *(.stab.index) } .stab.indexstr 0 : { *(.stab.indexstr) } .comment 0 : { *(.comment) } /* 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 : { *(.debug) } .line 0 : { *(.line) } /* GNU DWARF 1 extensions */ .debug_srcinfo 0 : { *(.debug_srcinfo) } .debug_sfnames 0 : { *(.debug_sfnames) } /* DWARF 1.1 and DWARF 2 */ .debug_aranges 0 : { *(.debug_aranges) } .debug_pubnames 0 : { *(.debug_pubnames) } /* DWARF 2 */ .debug_info 0 : { *(.debug_info) } .debug_abbrev 0 : { *(.debug_abbrev) } .debug_line 0 : { *(.debug_line) } .debug_frame 0 : { *(.debug_frame) } .debug_str 0 : { *(.debug_str) } .debug_loc 0 : { *(.debug_loc) } .debug_macinfo 0 : { *(.debug_macinfo) } /* SGI/MIPS DWARF 2 extensions */ .debug_weaknames 0 : { *(.debug_weaknames) } .debug_funcnames 0 : { *(.debug_funcnames) } .debug_typenames 0 : { *(.debug_typenames) } .debug_varnames 0 : { *(.debug_varnames) } /* These must appear regardless of . */ }

neocartBank.x

/* $Id: neocart.x,v 1.2 2001/04/13 09:36:11 fma Exp $ */ OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k") OUTPUT_ARCH(m68k) ENTRY(_start) SEARCH_DIR(/usr/m68k/m68k-elf/lib); /* Do we need any of these for elf? __DYNAMIC = 0; */ MEMORY { roma (rx) : ORIGIN = 0x00200000, LENGTH = 0x100000 } SECTIONS { /* Read-only sections, merged into text segment: */ . = 0x80000000 + SIZEOF_HEADERS; .interp : { *(.interp) } .hash : { *(.hash) } .dynsym : { *(.dynsym) } .dynstr : { *(.dynstr) } .gnu.version : { *(.gnu.version) } .gnu.version_d : { *(.gnu.version_d) } .gnu.version_r : { *(.gnu.version_r) } .rel.init : { *(.rel.init) } .rela.init : { *(.rela.init) } .rel.text : { *(.rel.text) *(.rel.text.*) *(.rel.gnu.linkonce.t*) } .rela.text : { *(.rela.text) *(.rela.text.*) *(.rela.gnu.linkonce.t*) } .rel.fini : { *(.rel.fini) } .rela.fini : { *(.rela.fini) } .rel.rodata : { *(.rel.rodata) *(.rel.rodata.*) *(.rel.gnu.linkonce.r*) } .rela.rodata : { *(.rela.rodata) *(.rela.rodata.*) *(.rela.gnu.linkonce.r*) } .rel.data : { *(.rel.data) *(.rel.data.*) *(.rel.gnu.linkonce.d*) } .rela.data : { *(.rela.data) *(.rela.data.*) *(.rela.gnu.linkonce.d*) } .rel.ctors : { *(.rel.ctors) } .rela.ctors : { *(.rela.ctors) } .rel.dtors : { *(.rel.dtors) } .rela.dtors : { *(.rela.dtors) } .rel.got : { *(.rel.got) } .rela.got : { *(.rela.got) } .rel.sdata : { *(.rel.sdata) *(.rel.sdata.*) *(.rel.gnu.linkonce.s*) } .rela.sdata : { *(.rela.sdata) *(.rela.sdata.*) *(.rela.gnu.linkonce.s*) } .rel.sbss : { *(.rel.sbss) } .rela.sbss : { *(.rela.sbss) } .rel.bss : { *(.rel.bss) } .rela.bss : { *(.rela.bss) } .rel.plt : { *(.rel.plt) } .rela.plt : { *(.rela.plt) } .init : { KEEP (*(.init)) } =0x4e75 .plt : { *(.plt) } .text : { *(.text) *(.text.*) *(.stub) /* .gnu.warning sections are handled specially by elf32.em. */ *(.gnu.warning) *(.gnu.linkonce.t*) . = ALIGN(0x4); __CTOR_LIST__ = .; LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) *(.ctors) LONG(0) __CTOR_END__ = .; __DTOR_LIST__ = .; LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) *(.dtors) LONG(0) __DTOR_END__ = .; } =0x4e75 _etext = .; PROVIDE (etext = .); .fini : { KEEP (*(.fini)) } =0x4e75 .rodata : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r*) } .rodata1 : { *(.rodata1) } .gcc_except_table : { *(.gcc_except_table) } /* Adjust the address for the data segment. We want to adjust up to the same address within the page on the next page up. */ .ctors ALIGN(4): { /* 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 (*crtbegin.o(.ctors)) /* We don't want to include the .ctor section from from the crtend.o file until after the sorted ctors. The .ctor section from the crtend file contains the end of ctors marker and it must be last */ KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors)) KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) } .dtors : { KEEP (*crtbegin.o(.dtors)) KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors)) KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) } . = ALIGN(0x10) + (. & (0x10 - 1)); .data : { *(.data) *(.data.*) *(.gnu.linkonce.d*) } .data1 : { *(.data1) } .eh_frame : { *(.eh_frame) } .got : { *(.got.plt) *(.got) } .dynamic : { *(.dynamic) } /* We want the small data sections together, so single-instruction offsets can access them all, and initialized data all before uninitialized, so we can shorten the on-disk segment size. */ .sdata : { *(.sdata) *(.sdata.*) *(.gnu.linkonce.s.*) } _edata = .; PROVIDE (edata = .); __bss_start = .; .sbss : { *(.dynsbss) *(.sbss) *(.sbss.*) *(.scommon) } .bss : { *(.dynbss) *(.bss) *(.bss.*) *(COMMON) /* Align here to ensure that the .bss section occupies space up to _end. Align after .bss to ensure correct alignment even if the .bss section disappears because there are no input sections. */ . = ALIGN(32 / 8); } . = ALIGN(32 / 8); _end = .; PROVIDE (end = .); /* Stabs debugging sections. */ .stab 0 : { *(.stab) } .stabstr 0 : { *(.stabstr) } .stab.excl 0 : { *(.stab.excl) } .stab.exclstr 0 : { *(.stab.exclstr) } .stab.index 0 : { *(.stab.index) } .stab.indexstr 0 : { *(.stab.indexstr) } .comment 0 : { *(.comment) } /* 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 : { *(.debug) } .line 0 : { *(.line) } /* GNU DWARF 1 extensions */ .debug_srcinfo 0 : { *(.debug_srcinfo) } .debug_sfnames 0 : { *(.debug_sfnames) } /* DWARF 1.1 and DWARF 2 */ .debug_aranges 0 : { *(.debug_aranges) } .debug_pubnames 0 : { *(.debug_pubnames) } /* DWARF 2 */ .debug_info 0 : { *(.debug_info) } .debug_abbrev 0 : { *(.debug_abbrev) } .debug_line 0 : { *(.debug_line) } .debug_frame 0 : { *(.debug_frame) } .debug_str 0 : { *(.debug_str) } .debug_loc 0 : { *(.debug_loc) } .debug_macinfo 0 : { *(.debug_macinfo) } /* SGI/MIPS DWARF 2 extensions */ .debug_weaknames 0 : { *(.debug_weaknames) } .debug_funcnames 0 : { *(.debug_funcnames) } .debug_typenames 0 : { *(.debug_typenames) } .debug_varnames 0 : { *(.debug_varnames) } /* These must appear regardless of . */ }
I know it sounds and feels like you are helping a delinquent because you are!