romdisk

If you have any questions on programming, this is the place to ask them, whether you're a newbie or an experienced programmer. Discussion on programming in general is also welcome. We will help you with programming homework, but we will not do your work for you! Any porting requests must be made in Developmental Ideas.
User avatar
Quzar
Dream Coder
Dream Coder
Posts: 7499
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Wed Jul 31, 2002 12:14 am
Location: Miami, FL
Has thanked: 4 times
Been thanked: 10 times
Contact:

romdisk

Post by Quzar »

ok, can someone tell me the proper way to initialize a romdisk in KOS 1.1.9? Since now i have simply been doing this:

Code: Select all

extern uint8 romdisk[]; 
KOS_INIT_ROMDISK(romdisk); 
but files that i load into it arnt being loaded by any of the 5 different sets of file opening routines i have tried. am i doing anything wrong.
"When you post fewer lines of text than your signature, consider not posting at all." - A Wise Man
Ian Micheal
Soul Sold for DCEmu
Soul Sold for DCEmu
Posts: 4865
Joined: Fri Jul 11, 2003 9:56 pm
Has thanked: 2 times
Been thanked: 4 times

Post by Ian Micheal »

Hmm

Code: Select all

#include <kos.h>

Code: Select all

/* romdisk */
extern uint8 romdisk[];
KOS_INIT_ROMDISK(romdisk);
before main

After main path what ever

Code: Select all

/rd/

make file example


Code: Select all

# SDL game port template
# (c)2003 Ian micheal
#   

TARGET = game.elf
OBJS =  game.o loader.o data.o





all: rm-elf $(TARGET)

include $(KOS_BASE)/Makefile.rules

KOS_CFLAGS += -ml -m4-single-only -pipe

clean:
	-rm -f $(TARGET) $(OBJS) romdisk.*

rm-elf:
	-rm -f $(TARGET) romdisk.*

$(TARGET): $(OBJS) romdisk.o
	$(KOS_CC) $(KOS_CFLAGS) $(KOS_LDFLAGS) -o $(TARGET) $(KOS_START) \
		$(OBJS) romdisk.o $(OBJEXTRA) -L$(KOS_BASE)/lib -lgcc   -lSDL -lSDL_image -lpng -lz -ljpeg -lSDL_mixer -lSDL -loggvorbisplay -ltremor -lm  -lmp3 -lm -lkallisti -lgcc $(KOS_LIBS)

romdisk.img:
	$(KOS_GENROMFS) -f romdisk.img -d romdisk -v

romdisk.o: romdisk.img
	$(KOS_BASE)/utils/bin2o/bin2o romdisk.img romdisk romdisk.o

run: $(TARGET)
	$(KOS_LOADER) $(TARGET)

Make a directory named romdisk place your image/file in that directory.

Eg

Code: Select all

/romdisk
blah.rom
So a folder the same name as the make file EG romdisk

Perfect use of the romsdisk will work every time. Send me the code and i will fix it if you cant get it to work.
Dreamcast forever!!!
User avatar
greay
DCEmu Ultra Poster
DCEmu Ultra Poster
Posts: 1938
Joined: Wed Jan 21, 2004 10:59 am
Location: 24 hours from Tulsa
Has thanked: 0
Been thanked: 0
Contact:

Post by greay »

I can't say for sure; I'm on the 1.3.x KOS. That's how I'm doing it. It looks okay, so...

All I can think of is double-checking the other stuff - are you sure the romdisk is being created correctly? Is it creating it from the same directory you're expecting it to? Are you adding it to your target? Check your makefile, it should look roughly like this...

Code: Select all

$(TARGET): $(OBJS) romdisk.o
        $(KOS_CC) $(KOS_CFLAGS) $(KOS_LDFLAGS) -o $(TARGET) $(KOS_START) \
                $(OBJS) romdisk.o $(OBJEXTRA) -L$(KOS_BASE)/lib $(KOS_LIBS)

romdisk.img:
        $(KOS_GENROMFS) -f romdisk.img -d romdisk -v

romdisk.o: romdisk.img
        $(KOS_BASE)/utils/bin2o/bin2o romdisk.img romdisk romdisk.o
In the last line, romdisk (by itself) is the directory everything should be in. That is, ./romdisk/

Code: Select all

    FILE *f = fopen(file, "r");
of course, this should work... :?

One question - I don't know if you've mentioned this elsewhere and I've missed it - why KOS 1.1.9? Is there a reason you're not using a newer version?
I'm a lone wolf looking for trouble.
Ian Micheal
Soul Sold for DCEmu
Soul Sold for DCEmu
Posts: 4865
Joined: Fri Jul 11, 2003 9:56 pm
Has thanked: 2 times
Been thanked: 4 times

Post by Ian Micheal »

I use kos1.1.9 it's faster more compact uses less memory smaller foot print Also lot of project are made for it changes have been made all my projects are for it. What was the point of your example? i posted a complete example for kos1.1.9 before you? :|

Newer version of kos i dont like it's IMO. Nothing wrong with kos 1.1.9 newer is not allways better.

todays throw-away living i guess people get like this.
Dreamcast forever!!!
User avatar
Quzar
Dream Coder
Dream Coder
Posts: 7499
Joined: Wed Jul 31, 2002 12:14 am
Location: Miami, FL
Has thanked: 4 times
Been thanked: 10 times
Contact:

Post by Quzar »

basically its cause i use Ian's SDL libs for neocd and now for neopop and they are for kos 1.1.9. I will check my makefile, its possible i accidentally deleted something
"When you post fewer lines of text than your signature, consider not posting at all." - A Wise Man
Ian Micheal
Soul Sold for DCEmu
Soul Sold for DCEmu
Posts: 4865
Joined: Fri Jul 11, 2003 9:56 pm
Has thanked: 2 times
Been thanked: 4 times

Post by Ian Micheal »

All so a matter of what your use to and works for you. I took a long while to update to kos1.1.9. i went to kos.1.2.0 did not like it at all much slower on some of my projects a and bin sizes were larger i dont have memory to waste like that.
Dreamcast forever!!!
User avatar
greay
DCEmu Ultra Poster
DCEmu Ultra Poster
Posts: 1938
Joined: Wed Jan 21, 2004 10:59 am
Location: 24 hours from Tulsa
Has thanked: 0
Been thanked: 0
Contact:

Post by greay »

Ian Micheal wrote:I use kos1.1.9 it's faster more compact uses less memory smaller foot print Also lot of project are made for it changes have been made all my projects are for it. What was the point of your example? i posted a complete example for kos1.1.9 before you? :|

Newer version of kos i dont like it's IMO. Nothing wrong with kos 1.1.9 newer is not allways better.

todays throw-away living i guess people get like this.
My example was because... Well, when I started writing it you hadn't posted. :oops:

As an aside, for my purposes, KOS < 1.3 won't compile w/o modifications (I'm on a mac)
I'm a lone wolf looking for trouble.
User avatar
Quzar
Dream Coder
Dream Coder
Posts: 7499
Joined: Wed Jul 31, 2002 12:14 am
Location: Miami, FL
Has thanked: 4 times
Been thanked: 10 times
Contact:

Post by Quzar »

romdisk isnt loading correctly. i used BA's testing thing that gives a list of all files in RD and it shows nothing. When i build the romdisk though i see the file have things added, somewhere between there and linking it must die =\

Edit: here is my makefile, it seems to me to be identical to yours but maybe im missing something...

Code: Select all

#NeoPop

KOS_LOCAL_CFLAGS=-I$(KOS_BASE)/include  \
-g -D_REENTRANT  -DDREAMCAST -DSDL -DINLINE="static inline" -DLOWERCASEFILES

TARGET = neopop.elf

OBJS =   System_SDL/system_input.o System_SDL/system_io.o System_SDL/system_language.o System_SDL/system_graphics.o    

System_SDL/system_sound.o System_SDL/system_main.o core/bios.o core/biosHLE.o core/dma.o core/flash.o core/gfx.o 

core/gfx_scanline_colour.o  core/gfx_scanline_mono.o core/interrupt.o core/mem.o core/neopop.o core/rom.o core/sound.o 

core/state.o core/Z80_interface.o  core/TLCS-900h/TLCS900h_disassemble_dst.o core/TLCS-900h/TLCS900h_disassemble_extra.o 

core/TLCS-900h/TLCS900h_disassemble_reg.o core/TLCS-900h/TLCS900h_disassemble_src.o core/TLCS-900h/TLCS900h_interpret_dst.o 

core/TLCS-900h/TLCS900h_interpret_reg.o core/TLCS-900h/TLCS900h_interpret_single.o core/TLCS-900h/TLCS900h_interpret_src.o 

core/TLCS-900h/TLCS900h_registers.o core/z80/dasm.o System_SDL/system_comms.o core/TLCS-900h/TLCS900h_interpret.o 

System_SDL/system_rom.o 

PROBJS = core/z80/z80.c

all: neopop.bin rm-elf $(TARGET)

clean:
	-rm -f $(TARGET) $(OBJS)  romdisk.*


include $(KOS_BASE)/Makefile.rules

KOS_CFLAGS += -ml -m4-single-only -pipe


rm-elf: 
	-rm -f $(TARGET) romdisk.*


$(TARGET): $(OBJS) $(PROBJS) romdisk.o
	$(KOS_CC) $(KOS_CFLAGS) $(KOS_LDFLAGS) -o $(TARGET) $(KOS_START) \
		$(OBJS) $(PROBJS) romdisk.o $(OBJEXTRA) -L$(KOS_BASE)/lib -lgcc -lSDL -lm $(KOS_LIBS)

romdisk.img: 
	$(KOS_GENROMFS) -f romdisk.img -d romdisk -v 


romdisk.o: romdisk.img 
	$(KOS_BASE)/utils/bin2o/bin2o romdisk.img romdisk romdisk.o

neopop.bin: neopop.elf
		$(KOS_OBJCOPY) -O binary neopop.elf output.bin
		$(KOS_BASE)/utils/scramble/scramble output.bin neopop.bin


run: $(TARGET)
		$(KOS_LOADER) $(TARGET)
Sorry for the large post. I think it might have to do with my environment file, or with something i screwed up in my KOS chain (maybe reinstalling it). Its weird though because on my homebrew game romdisk works fine.
"When you post fewer lines of text than your signature, consider not posting at all." - A Wise Man
speud
DCEmu Uncool Newbie
DCEmu Uncool Newbie
Posts: 1459
Joined: Sat Dec 27, 2003 10:40 pm
Has thanked: 0
Been thanked: 0
Contact:

Post by speud »

try this:

Code: Select all

$(OBJS) romdisk.o $(OBJEXTRA)
instead of that:

Code: Select all

$(OBJS) $(PROBJS) romdisk.o $(OBJEXTRA)
in your $(TARGET) declaration.

also if you could paste gcc's output we could see if your romdisk is mounted properly, with the offset of each local file.
http://blueswirl.fr.st - DC Online Tools and Downloads

thx to Wack0 for the avatar ;)
Ian Micheal
Soul Sold for DCEmu
Soul Sold for DCEmu
Posts: 4865
Joined: Fri Jul 11, 2003 9:56 pm
Has thanked: 2 times
Been thanked: 4 times

Post by Ian Micheal »

That should fix his problem what you said.
Dreamcast forever!!!
BlackAura
DC Developer
DC Developer
Posts: 9951
Joined: Sun Dec 30, 2001 9:02 am
Has thanked: 0
Been thanked: 1 time

Post by BlackAura »

PROBJS?

Is it just me, or does that Makefile seem to be derived from the one I used in Genesis Plus?

The Makefile I wrote for that is the only one I've ever seen that used PROBJS. Basically, I had it set up so that "make clean" wouldn't delete anything in PROBJS (like the Z80 CPU emulator) because it was never changed and took a long time to compile. It also has the GCC line split in half exactly like that.

Weird. I didn't know anyone bothered to look at my Makefiles, let along modify them for their own projects.
Ian Micheal
Soul Sold for DCEmu
Soul Sold for DCEmu
Posts: 4865
Joined: Fri Jul 11, 2003 9:56 pm
Has thanked: 2 times
Been thanked: 4 times

Post by Ian Micheal »

Yeah i say he got it from the neogeo cd makefile when we had to change the cpu cores to m68k in genisis plus. if you remember we had to change the cores and you told me it might be good idea to use the gensis plus m68k core.

So the make file is geting a life all around the scene now. Mine at the time has Your name in it. On each project i use PROBJS.

Handy your well Loved by me and i learn and bother to look at every thing you teach like your new Grafix tut. Im going to use that for some menu effects.
Dreamcast forever!!!
BlackAura
DC Developer
DC Developer
Posts: 9951
Joined: Sun Dec 30, 2001 9:02 am
Has thanked: 0
Been thanked: 1 time

Post by BlackAura »

Yeah i say he got it from the neogeo cd makefile when we had to change the cpu cores to m68k in genisis plus. if you remember we had to change the cores and you told me it might be good idea to use the gensis plus m68k core.

So the make file is geting a life all around the scene now. Mine at the time has Your name in it. On each project i use PROBJS.
Well, that would explain it...

It suprised me because even I don't use a makefile like that for Genesis Plus anymore. My current one was rewritten from scratch, is entirely contained in one makefile instead of requiring two, but does still have PROBJS (which now covers both the M68k and the Z80).

The makefile I'm using for everything else is basically the one in by tutorial examples. The fifth one, to be exact, which is the first one with romdisk support. You can generally get away without modifying anything below the bit where it says "You shouldn't need to edit anything below here".
Handy your well Loved by me and i learn and bother to look at every thing you teach like your new Grafix tut. Im going to use that for some menu effects.
Thanks!

That blitter is giving me headaches. I've been trying to extend it to allow flipped images (X and Y axis, or both, or none), and allow you to draw only part of the image instead of all of it. The partial drawing's trivial. The flipping requires duplicating the blitter loop eight times (sixteen if you count the transparent blitter), but otherwise isn't too hard. The problem is that the clipper can't handle flipping and partial drawing at the same time. Aaaargh!

I think it needs a complete rewrite, and it's going to be way too long / complex to do as a tutorial, because it's already too big. D'oh! Shame, because games definitely need the ability to do flipping, and being able to draw part of an image is really useful too.
User avatar
Quzar
Dream Coder
Dream Coder
Posts: 7499
Joined: Wed Jul 31, 2002 12:14 am
Location: Miami, FL
Has thanked: 4 times
Been thanked: 10 times
Contact:

Post by Quzar »

Yea neogeo pocket used Z80 for sound, so i use the PROBJS to link that in and all. the romdisk still dosnt work though... at a LAN party now, gotta test a lot tonight.
"When you post fewer lines of text than your signature, consider not posting at all." - A Wise Man
Ian Micheal
Soul Sold for DCEmu
Soul Sold for DCEmu
Posts: 4865
Joined: Fri Jul 11, 2003 9:56 pm
Has thanked: 2 times
Been thanked: 4 times

Post by Ian Micheal »

Dont use a romsdisk then burn the one rom on a cdr. boot the dctool app up. Swap the cdr in with the one said rom. Send the emulator.

Works just as well saves time and worry about some thing that should work.

use /cd/blah.rom on the cdr.

This same cd can be used over and over. you dont have to boot the emulator and swap the cd in every time only the one time send the emulator all night long.

I think it's better if you just follow this.
Dreamcast forever!!!
User avatar
Quzar
Dream Coder
Dream Coder
Posts: 7499
Joined: Wed Jul 31, 2002 12:14 am
Location: Miami, FL
Has thanked: 4 times
Been thanked: 10 times
Contact:

Post by Quzar »

Im thinking of doing that, at least to test. Just burn the roms all to a CD and test like that. I just havnt had CDs for a while =P just got some so ill try it tonight. LAN party is fun =)
"When you post fewer lines of text than your signature, consider not posting at all." - A Wise Man
User avatar
Quzar
Dream Coder
Dream Coder
Posts: 7499
Joined: Wed Jul 31, 2002 12:14 am
Location: Miami, FL
Has thanked: 4 times
Been thanked: 10 times
Contact:

Post by Quzar »

ok, i tried using the CD. now the loading code is pretty much this:

Code: Select all

FILE *fp=fopen(filename,O_RDONLY);
	if (fp==NULL)
		return FALSE;
and filename is "/cd/delta_war.ngc" which is a file on the CD. but the function always returns false no matter what. i have also tried it with "rb" instead of O_RDONLY. What is wrong with this?
"When you post fewer lines of text than your signature, consider not posting at all." - A Wise Man
PrOfUnD Darkness
DCEmu Freak
DCEmu Freak
Posts: 71
Joined: Thu Feb 20, 2003 11:46 am
Has thanked: 1 time
Been thanked: 0
Contact:

Post by PrOfUnD Darkness »

I just use the lines below to open a ascii file from romdisk:

FILE *fp;
fp = fopen("/rd/quiz.conf", "r");

To open from the CD I just change the path to "/pc".


PD
User avatar
Quzar
Dream Coder
Dream Coder
Posts: 7499
Joined: Wed Jul 31, 2002 12:14 am
Location: Miami, FL
Has thanked: 4 times
Been thanked: 10 times
Contact:

Post by Quzar »

/pc?! what about /cd?

btw: i can normally open things from the romdisk, it just isnt working for some reason in this one project... which sucks..
"When you post fewer lines of text than your signature, consider not posting at all." - A Wise Man
Ian Micheal
Soul Sold for DCEmu
Soul Sold for DCEmu
Posts: 4865
Joined: Fri Jul 11, 2003 9:56 pm
Has thanked: 2 times
Been thanked: 4 times

Post by Ian Micheal »

You would use /cd/blah.XX . Pc would not work for opening any thing on a cd. it would open throu the serial cable your root cygwin install path.
Dreamcast forever!!!
Post Reply