Sega Genesis Dev Kit (SGDK)

SGDK only sub forum

Moderator: Stef

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Thu Jul 28, 2011 9:25 pm

Stef wrote:
Chilly Willy wrote: Leave the current function alone and make a new one that takes a separate arguments for flags and tileoffset.
Finally the good name for these arguments :)
I think i should replace "basetile" by "flags" on the previous method and add a new as you said.
Having good names for arguments can really help or hinder and API. Rather than one argument that tries to do two different things, which makes it hard to describe or use properly, splitting it into two that are easy to name seems to be the way to go.

As to keeping old functions, that should be partly based on how much uses it, how easy it is to convert to the new function, and whether keeping the old function may confuse people. Perhaps a define for the old function that converts to the new one is better. Perhaps a compile warning that the function is outdated and a new one is available. There's a number of options here.
8)

sega16
Very interested
Posts: 251
Joined: Sat Jan 29, 2011 3:16 pm
Location: U.S.A.

Post by sega16 » Fri Jul 29, 2011 2:47 am

wait it is the thing that is supposed to define the pallete flipping and so on right because I tried using TILE_ATTAR_FULL to set the start tile and it had the same effect

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Fri Jul 29, 2011 7:31 am

Chilly Willy wrote:
Stef wrote:
Chilly Willy wrote: Leave the current function alone and make a new one that takes a separate arguments for flags and tileoffset.
Finally the good name for these arguments :)
I think i should replace "basetile" by "flags" on the previous method and add a new as you said.
Having good names for arguments can really help or hinder and API. Rather than one argument that tries to do two different things, which makes it hard to describe or use properly, splitting it into two that are easy to name seems to be the way to go.

As to keeping old functions, that should be partly based on how much uses it, how easy it is to convert to the new function, and whether keeping the old function may confuse people. Perhaps a define for the old function that converts to the new one is better. Perhaps a compile warning that the function is outdated and a new one is available. There's a number of options here.
8)
"basetile" was never intended to do the 2 things but only "flags" part as the | operator prevent to use it as a base offset.

Yeah, i do like the java "deprecated" stuff for that type of case... Generally i just change new methods but i know it can be confusing when people try to upgrade to the last version so i'll try to use #warning for deprecated methods.
What i really need is a doxygen doc or something like that for each method (regrouped by section), that would really help. I should take sometime to do it.

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Fri Aug 12, 2011 8:53 pm

Updated the library to version 0.9 ! Many changes though i forgot to do the change just mentionned previously :oops:

sega16
Very interested
Posts: 251
Joined: Sat Jan 29, 2011 3:16 pm
Location: U.S.A.

Post by sega16 » Sat Aug 13, 2011 3:42 pm

Stef wrote:Updated the library to version 0.9 ! Many changes though i forgot to do the change just mentionned previously :oops:
I thought that sgdk + genres could not get any better but somehow it did.I am gonna update it right now thank you so much you have just made my day!!!! :D :) :lol: :D :D :D :D

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Sat Aug 13, 2011 5:41 pm

Glad you hear that, thanks :D
Still it miss a lot of important features to make game develop, stuff as advanced sprites management with collision detection, level layout etc...
I really have to do somethink for that.

letoulousain
Interested
Posts: 42
Joined: Fri Sep 24, 2010 11:32 pm
Location: toulouse

Post by letoulousain » Sat Aug 20, 2011 6:47 am

Stef wrote:Updated the library to version 0.9 ! Many changes though i forgot to do the change just mentionned previously :oops:
Thanks ! :):)

Moon-Watcher
Very interested
Posts: 117
Joined: Sun Jan 02, 2011 9:14 pm
Contact:

Post by Moon-Watcher » Wed Aug 24, 2011 6:40 pm

A new version is always welcome, thanks!
I updated it but I have this error when compiling:

Code: Select all

-------------- Build: default in abbaye ---------------

Using makefile: C:\MDDev\makefile.gen
make: *** [res/classic.asm] Error 53
Process terminated with status 2 (0 minutes, 0 seconds)
0 errors, 0 warnings
I've noticed that happens generating .o resources at res folder.

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Wed Aug 24, 2011 7:30 pm

The error message isn't really revelating anything here. Did you get that error message from Code::Blocks ?
If you're using Code::Blocks, you should set Compiler Logging to "Full Command Line" in the Compiler and debugger settings (be sure you're on the Sega Genesis compiler settings then go to the tab "Others Settings").

As soon this is done, try to compile again your project and report the error message you obtain in the "Build Log" windows.

Moon-Watcher
Very interested
Posts: 117
Joined: Sun Jan 02, 2011 9:14 pm
Contact:

Post by Moon-Watcher » Wed Aug 24, 2011 8:33 pm

Stef wrote:The error message isn't really revelating anything here. Did you get that error message from Code::Blocks ?
If you're using Code::Blocks, you should set Compiler Logging to "Full Command Line" in the Compiler and debugger settings (be sure you're on the Sega Genesis compiler settings then go to the tab "Others Settings").

As soon this is done, try to compile again your project and report the error message you obtain in the "Build Log" windows.
Thank for your help, Stef. It returns:

Code: Select all

-------------- Build: default in abbey ---------------

Running command: make.exe -f C:\MDDev\makefile.gen
c:/MDDev/bin/genres res/abbayemap.rc res/abbayemap.asm
make: *** [res/abbayemap.asm] Error 53
Process terminated with status 2 (0 minutes, 0 seconds)
0 errors, 0 warnings
So I executed genres.exe. Seem it needs MSVCR100.dll file, so I placed it at bin directory and... worked like charm

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Wed Aug 24, 2011 8:54 pm

Hmm ok, probably needs to be reported at Kaneda as he's the author of Genres tool :)

KanedaFr
Administrateur
Posts: 1142
Joined: Tue Aug 29, 2006 10:56 am
Contact:

Post by KanedaFr » Thu Aug 25, 2011 1:17 am

sh$$$$ microsoft....
it's why I hate it...always a dll missing :(

sorry about that :(

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

Post by Zontar » Fri Oct 21, 2011 9:07 pm

Chilly Willy wrote:My own makefile that turns the mini devkit files into a lib looks like this

Code: Select all

CC = m68k-elf-gcc
AR = m68k-elf-ar
RANLIB = m68k-elf-ranlib
OBJC = m68k-elf-objcopy
RM = rm -f
ASMZ80 = zasm
BINTOC = bin2c

OPTION= -Dnologo_

libmd.a_OBJS = base.o tools.o vdp.o font.o vdp_bg.o vdp_dma.o \
	vdp_pal.o vdp_spr.o vdp_tile.o bitmap.o bitmapx.o z80_ctrl.o \
	tab_sin.o tab_log2.o tab_pow2.o maths.o maths3D.o ym2612.o \
	psg.o audio.o joy.o timer.o logo_lib.o z80_drv1.o z80_drv2.o \
	z80_mvst.o

INCS = -I./include
FLAGS = $(OPTION) -m68000 -Wall -O1 -c -fomit-frame-pointer $(INCS)
FLAGSZ80 = -vb2

all: z80_drv1.o80 z80_drv1.c z80_drv2.o80 z80_drv2.c md.o $(libmd.a_OBJS) libmd.a

%.a: $(libmd.a_OBJS)
	$(RM) $@
	$(AR) cru $@ $($@_OBJS)
	$(RANLIB) $@

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

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

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

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

clean:
	$(RM) -rf *.o *.a *.o80 *.log
	$(RM) -f z80_drv1.c z80_drv1.h z80_drv2.c z80_drv2.h

install: all
	cp include/*.h $(GENDEV)/include
	cp libmd.a $(GENDEV)/lib
	cp md.o $(GENDEV)/lib
That assumes GENDEV and the PATH environment vars set as explained in my toolchain thread.

Done that way, you would link md.o first, then the object files for the program, then the libs (including libmd).

bintoc is made by compiling the bintoc source from the devkit and coying the executable to the toolchain binary directory. Zasm is one of a couple Z80 compilers that work fairly well, the other being sjasmplus.

I currently use zasm 3.0.18... the current is 3.0.20. I need to update or move to sjasmplus sometime... :)
Edit: Okay, I realized that it couldn't find the files it was trying to compile, but my next problem is that i appear to be missing a lot of the .o files listed in the Makefile. Are those already in the .a files under the lib/ directory?
Last edited by Zontar on Fri Oct 21, 2011 9:16 pm, edited 1 time in total.

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

Post by Zontar » Fri Oct 21, 2011 9:11 pm

I'm also using sjasm...will there be any changes needed to the Z80 portion?

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Fri Oct 21, 2011 9:25 pm

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.

Post Reply