Sega Genesis Dev Kit (SGDK)

SGDK only sub forum

Moderator: Stef

Zontar
Very interested
Posts: 55
Joined: Fri Oct 21, 2011 8:58 pm

Post by Zontar »

Chilly Willy wrote:The .o files are made by the compiler from the appropriate .c files using the makefile. As long as you put together the toolchain as explained in the thread on that AND have done the exports mentioned, there shouldn't be any trouble other than convert from zasm to sjasm.

As for that, you might need to change a couple items, but I can't say what as I haven't done it myself. Just look at any errors sjasm gives and correct them. It's pretty straightforward.
Okay then, I got sjasm to work, however, md.o appears not be generating. I get this upon running make:
zontar@BPC-V-L:~/Programs/GenDev/qikexample/src$ make
sjasm z80_drv1.s80
SjASM Z80 Assembler v0.39g6 - www.xl2s.tk
Pass 1 complete (0 errors)
Pass 2 complete
Errors: 0
bintoc z80_drv1.o80
sjasm z80_drv2.s80
SjASM Z80 Assembler v0.39g6 - www.xl2s.tk
Pass 1 complete (0 errors)
Pass 2 complete
Errors: 0
bintoc z80_drv2.o80
make: *** No rule to make target `md.o', needed by `all'. Stop.
Chilly Willy
Very interested
Posts: 2993
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy »

Sorry, that's because I renamed sega.s into md.s. I felt sega.s was not quite descriptive enough since there are many sega consoles and boards.
Zontar
Very interested
Posts: 55
Joined: Fri Oct 21, 2011 8:58 pm

Post by Zontar »

Chilly Willy wrote:Sorry, that's because I renamed sega.s into md.s. I felt sega.s was not quite descriptive enough since there are many sega consoles and boards.
Many thanks. :D I got it.
Mixail
Very interested
Posts: 133
Joined: Thu Nov 18, 2010 4:47 pm

Post by Mixail »

please, give me MakeFile for SGDK 0.9
I use it.
Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef »

Mixail wrote:please, give me MakeFile for SGDK 0.9
I use it.
Why you don't use directly the included makefile ?
Mixail
Very interested
Posts: 133
Joined: Thu Nov 18, 2010 4:47 pm

Post by Mixail »

What files? i don't have it.
May MakeFile:

Code: Select all

GDK= ../../
CC= $(GDK)bin/gcc
OBJC= $(GDK)bin/objcopy
ASMZ80= $(GDK)bin/asmz80
BINTOC= $(GDK)bin/bintoc
NM= $(GDK)bin/nm
NM2WCH= $(GDK)bin/nm2wch
OUTPUT= Game
RESOL=bin


SRC_C= $(wildcard *.c)
SRC_S= $(wildcard *.s)
SRC_SZ80= $(wildcard *.s80)


OBJ= $(SRC_SZ80:.s80=.o)
OBJ+= $(SRC_C:.c=.o)
OBJ+= $(SRC_S:.s=.o)

LINKOBJ= $(GDK)lib/sega.o \
        $(GDK)lib/base.o \
        $(GDK)lib/tools.o \
        $(GDK)lib/vdp.o \
        $(GDK)lib/font.o \
        $(GDK)lib/vdp_bg.o \
        $(GDK)lib/vdp_dma.o \
        $(GDK)lib/vdp_pal.o \
        $(GDK)lib/vdp_spr.o \
        $(GDK)lib/vdp_tile.o \
        $(GDK)lib/bitmap.o \
        $(GDK)lib/z80_ctrl.o \
        $(GDK)lib/psg.o \
        $(GDK)lib/joy.o \
        $(GDK)lib/timer.o \
        $(OBJ)

INCS= -I$(GDK)include
FLAGS= $(OPTION) -m68000 -Wall -O1 -fomit-frame-pointer $(INCS)
FLAGSZ80= -c -i -x1 -x2 -x3 -z -lnul

all: $(OUTPUT).$(RESOL)
		

$(OUTPUT).$(RESOL): $(OUTPUT).out
	$(NM) -n -S -t x $(OUTPUT).out >$(OUTPUT).nm 
	$(NM2WCH) $(OUTPUT).nm $(OUTPUT).wch 
	$(OBJC) --pad-to 131072 -O binary $(OUTPUT).out $(OUTPUT).$(RESOL)

$(OUTPUT).out: $(OBJ)
	$(CC) -T $(GDK)bin/md.ld -nostdlib $(LINKOBJ) $(GDK)bin/libgcc.a -o $(OUTPUT).out


%.o80: %.s80
	$(ASMZ80) $(FLAGSZ80) -o$@ $<

%.c: %.o80
	$(BINTOC) $<

%.o: %.c
	$(CC) $(FLAGS) -c $< -o $@

%.o: %.s
	$(CC) $(FLAGS) -c $< -o $@
	
clean: 
	$(RM) *.o
	
	$(RM) *.out
	$(RM) *.wch
	$(RM) *.nm

But it does not work on SGDK 0.9
Mixail
Very interested
Posts: 133
Joined: Thu Nov 18, 2010 4:47 pm

Post by Mixail »

Mixail wrote:please, give me MakeFile for SGDK 0.9
I use it.
Help me!
KanedaFr
Administrateur
Posts: 1154
Joined: Tue Aug 29, 2006 10:56 am
Contact:

Post by KanedaFr »

the makefile is at the root of the sdk
http://code.google.com/p/sgdk/source/br ... vn%2Ftrunk

its name is makefile.gen
Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef »

And if you download the main SGDK archive and follow the command line compilation tutorial you should get it easily.
Mixail
Very interested
Posts: 133
Joined: Thu Nov 18, 2010 4:47 pm

Post by Mixail »

KanedaFr wrote:the makefile is at the root of the sdk
http://code.google.com/p/sgdk/source/br ... vn%2Ftrunk

its name is makefile.gen
Thank you very much
but, now at compilation gives out an error 127.
Image
What to do?
Mixail
Very interested
Posts: 133
Joined: Thu Nov 18, 2010 4:47 pm

Post by Mixail »

Mixail wrote:
KanedaFr wrote:the makefile is at the root of the sdk
http://code.google.com/p/sgdk/source/br ... vn%2Ftrunk

its name is makefile.gen
Thank you very much
but, now at compilation gives out an error 127.
Image
What to do?
Why is this a bug (error)?
how to fix it?
Chilly Willy
Very interested
Posts: 2993
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy »

'rm' is the *nix command to remove a file. You don't appear to be using a cygwin or mingw command shell, but rather the Windows command shell. Windows' shell won't understand any *nix commands nor the paths used.
Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef »

As far i remember SGDK provides the rm.exe file so you should get it.
You don't use SGDK as it is intended to be used, it's why you have some errors...
Mixail
Very interested
Posts: 133
Joined: Thu Nov 18, 2010 4:47 pm

Post by Mixail »

There is something for a command line?

As my file for the old SGDK.
Mixail wrote:What files? i don't have it.
May MakeFile:

Code: Select all

GDK= ../../
CC= $(GDK)bin/gcc
OBJC= $(GDK)bin/objcopy
ASMZ80= $(GDK)bin/asmz80
BINTOC= $(GDK)bin/bintoc
NM= $(GDK)bin/nm
NM2WCH= $(GDK)bin/nm2wch
OUTPUT= Game
RESOL=bin


SRC_C= $(wildcard *.c)
SRC_S= $(wildcard *.s)
SRC_SZ80= $(wildcard *.s80)


OBJ= $(SRC_SZ80:.s80=.o)
OBJ+= $(SRC_C:.c=.o)
OBJ+= $(SRC_S:.s=.o)

LINKOBJ= $(GDK)lib/sega.o \
        $(GDK)lib/base.o \
        $(GDK)lib/tools.o \
        $(GDK)lib/vdp.o \
        $(GDK)lib/font.o \
        $(GDK)lib/vdp_bg.o \
        $(GDK)lib/vdp_dma.o \
        $(GDK)lib/vdp_pal.o \
        $(GDK)lib/vdp_spr.o \
        $(GDK)lib/vdp_tile.o \
        $(GDK)lib/bitmap.o \
        $(GDK)lib/z80_ctrl.o \
        $(GDK)lib/psg.o \
        $(GDK)lib/joy.o \
        $(GDK)lib/timer.o \
        $(OBJ)

INCS= -I$(GDK)include
FLAGS= $(OPTION) -m68000 -Wall -O1 -fomit-frame-pointer $(INCS)
FLAGSZ80= -c -i -x1 -x2 -x3 -z -lnul

all: $(OUTPUT).$(RESOL)
		

$(OUTPUT).$(RESOL): $(OUTPUT).out
	$(NM) -n -S -t x $(OUTPUT).out >$(OUTPUT).nm 
	$(NM2WCH) $(OUTPUT).nm $(OUTPUT).wch 
	$(OBJC) --pad-to 131072 -O binary $(OUTPUT).out $(OUTPUT).$(RESOL)

$(OUTPUT).out: $(OBJ)
	$(CC) -T $(GDK)bin/md.ld -nostdlib $(LINKOBJ) $(GDK)bin/libgcc.a -o $(OUTPUT).out


%.o80: %.s80
	$(ASMZ80) $(FLAGSZ80) -o$@ $<

%.c: %.o80
	$(BINTOC) $<

%.o: %.c
	$(CC) $(FLAGS) -c $< -o $@

%.o: %.s
	$(CC) $(FLAGS) -c $< -o $@
	
clean: 
	$(RM) *.o
	
	$(RM) *.out
	$(RM) *.wch
	$(RM) *.nm

But it does not work on SGDK 0.9
Chilly Willy
Very interested
Posts: 2993
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy »

Code: Select all

GDK= ../../
CC= $(GDK)bin/gcc
OBJC= $(GDK)bin/objcopy
ASMZ80= $(GDK)bin/asmz80
BINTOC= $(GDK)bin/bintoc
NM= $(GDK)bin/nm
NM2WCH= $(GDK)bin/nm2wch 
See those "/" characters? Windows shell hasn't the slightest idea what to do with those. It's a *nix path character - Windows uses "\" instead. Both cygwin and mingw have a *nix shell that understands BOTH path characters so that you can use *nix paths or Windows paths.
Post Reply