Jump to content
IGNORED

Loading from the cartridge in BLL


TailChao

Recommended Posts

You need to read the file entry from the cart and then read the block somewhere. I don't know if the code is in BLL. I use the file.m65 from the C compiler (newcc65/libsrc/lynx/file.m65).

 

struct fileentry {

uchar StartBlock;

uint BlockOffset;

uchar ExecFlag;

char *DestAddr;

uint FileLen;

};

extern struct fileentry FileEntry;

uchar buffer[256];

 

--

Cheers,

 

Karri

Link to comment
Share on other sites

Hi!

 

 

My demo has nearly exceeded the limits of ram, and I need to add a point where it loads from the cartridge, how should I set this up in BLL?

Edit: I'm coding in Assembler.

 

Use the macros given in "file.mac".

 

Tschau,

 

Sage

 

 

But do we have a good description of the usage of the Lynxer-tool meanwhile?

 

For those who don't know what i mean:

The Lynx uses a kind of file-system for accessing the content of the cartridge, and the Lynxer helps to compile the several necessary

"files" for the cartridge.

 

 

Regards

Matthias

Link to comment
Share on other sites

So, would it be feasable to make seperate programs for each section of the game, and have the lynx load them, but keep the values of the variables set by earlier programs by using the file macro?

 

and if that is true, what is the syntax for the loadprg command?

 

without looking into the source i guess its LOADPRG

Link to comment
Share on other sites

Sorry, but i'm still having problems. what exactly do I have to do for the lynx to load from the cart, I've originally tried to set it up with two .o files linked together, but the assembler didn't like that, so what should I do? clear the ram from x to y and then load whatever. I'm kinda stuck here.

 

Edit: also, whenever the demo itself reaches a certain size, handy gives me the error "CMikie::Poke() - Write to MTEST2". is that bad?

Link to comment
Share on other sites

You have to create the cart image first.

 

Create an ASCII file ROM.MAK with content like

 

INSERT.O

#ALIGN

myprog.o

#ALIGN

myprog2.o

 

Then you run Lynxer on this to crate a *.LYX file

 

The resulting LYX-file is then burnable on a chip.

 

Now your programs should be able to load each other from the cart.

 

--

Karri

Link to comment
Share on other sites

Alright, the cart fits together alright (thanks karri), but I still cant get one program to load the other, whenever I try to use the LOADPRG command from the file.mac like this- LOADPRG 2 or LOADPRG LTOXY (ltoxy is the name of the seccond program) I get an undefined variable error message when assembling the pieces of my game (each .o file) so what is the proper way to use the command? (If you tell me, i'll shut up and leave you all alone :P )

 

and, thanks, D@md@m for the compliment.

Link to comment
Share on other sites

Edit: also, whenever the demo itself reaches a certain size, handy gives me the error "CMikie::Poke() - Write to MTEST2". is that bad?

 

Then your demo reach the hardware adresses of teh memory.

Putting the screen memory at that position saves a lot of memory.

 

Tschau,

Sage

Link to comment
Share on other sites

Alright, the cart fits together alright (thanks karri), but I still cant get one program to load the other, whenever I try to use the LOADPRG command from the file.mac like this- LOADPRG 2 or LOADPRG LTOXY (ltoxy is the name of the seccond program) I get an undefined variable error message when assembling the pieces of my game (each .o file) so what is the proper way to use the command? (If you tell me, i'll shut up and leave you all alone  

 

maybe LOADPRG #2

(or even #3, because there is the title picture before the first program, i am not sure if title picture is #0 or #1)

 

Also, the part should be loaded to differentz memory positions. at least the part where the loading code sits, should not be overwritten by the loading program!!!

Overloading the code while executing gives nice effects ;-)

 

I have some pieces of demo code here, how it can be done...

 

Tschau,

Sage

Link to comment
Share on other sites

Hmm, I got the assembler to let the programs go through, and stuck them together with lynxer, but now handy is giving me illegal opcode errors, and I think I have to clear the ram before loading, but I dont know how to do so properly, if anyone can help, I'd appreciate it, here is a link to the demo and source code-

http://www.webpost.net/tc/tcPicgallery/Zonik.rar

Link to comment
Share on other sites

Hmm, I got the assembler to let the programs go through, and stuck them together with lynxer, but now handy is giving me illegal opcode errors, and I think I have to clear the ram before loading, but I dont know how to do so properly, if anyone can help, I'd appreciate it, here is a link to the demo and source code-

http://www.webpost.net/tc/tcPicgallery/Zonik.rar

 

Besides the mistake, that you run through data in LOXY.asm because the loop is not closed, i think your problem is that you use the same memory regions. you should check that the loader is not overwritten by the programm which is loaded!!

 

Moreover, you should define in the ASM file, that you are using NEWHEAD (arent you?).

 

I put some example sourcecodes on my site... lynxdev.atari.org -> development

Link to comment
Share on other sites

Hmm, apparently the data I was trying to load was overwriting the code in ram, you were right... now to just figure out how to get such a huge file loaded not to do so :P . And also, the TExpress to lynx connection was a multiplayer idea, not a dev station *shot*

 

Also, Is there any way to have lynxer create 512k images, because I have no idea how to use lynxer4.ttp. thanks.

Link to comment
Share on other sites

42Bastian invented a very nice way of using Audio I/O pin as an external block-select line. Then you can use 512k with no problems using the BLL-kit.

 

Just create two seperate 256k images with Lynxer and burn them on the same 512k cart.

 

If you rewrite the libraries for 2048 byte block access you can even get 1024k images to run.

 

So space is not a big problem :)

--

Cheers,

 

Karri

Link to comment
Share on other sites

Edit: also, whenever the demo itself reaches a certain size, handy gives me the error "CMikie::Poke() - Write to MTEST2". is that bad?

 

Then your demo reach the hardware adresses of teh memory.

Putting the screen memory at that position saves a lot of memory.

 

Tschau,

Sage

How would I move the screen buffers and collision buffers right before that point?

Note- I have two screen buffers and one collision buffer.

Link to comment
Share on other sites

How would I move the screen buffers and collision buffers right before that point?

Note- I have two screen buffers and one collision buffer.

 

SCRBASE $A000, $C000,$E000

 

Hint: Try to look in the .mac files, some things are explained there.

 

PS: If you use collision buffer, make sure the offset for the collision flag is set correctly!!!

 

Tschau,

 

Sage

Link to comment
Share on other sites

  • 8 years later...

This thread was _really_old_.

 

If you use cc65 it is all taken care of.

 

You can choose from two pre-designed configuration files.

 

-C lynx.cfg has dual screen buffers (or if you don't use the tgi_updatedisplay you can use a single screen also)

-C lynx-coll.cfg has dual screen buffers + collision detection

 

For using collision detection you also have to initialize collision detection in the driver.

 

tgi_setcollisiondetection(1); // this activates it

tgi_setcollisiondetection(0); // this de-activates it

 

--

Karri

Link to comment
Share on other sites

I'm sorry, I didn't specify that's the original post that interest me.

 

How can I do in C if I want to load a program from cartridge (for example a .o file) and run it ?

 

Sorry, my first answer was eaten up by a wifi disconnect.

 

I think the function name in c was LoadFile(nr);

 

Add:

check the example sources on my website.

I mostly use a function names LaodFileTo(nr, addr), but this works only for data files as executeables always have afixed address.

Edited by sage
Link to comment
Share on other sites

In MegaPak most minigames are written with the BLL-kit. I used a simple unix command to turn the *.o files into asm-files that can be compiled by cc65 and included on a compilation cart.

 

From the cc65 you can load and execute the BLL games with

 

lynx_exec(filenr);

 

The conversion program looks like this:

 

tail --bytes=`ls -l yahtzee.o | cut -b 37-41 | bc calc` yahtzee.o | od -i -v -w2 | gawk -f dicee.awk > dicee.s

 

The calc help file looks like this:

a=read()

a-10

 

And the formattin file dicee.awk like this:

 

BEGIN {
   FS=" "
   printf("    .global _dicee_start\n");
   printf("    .global _dicee_end\n");
   printf("    .segment \"DICEE_RODATA\"\n");
   printf("_dicee_start: \n");
}

($2 != "") {
   printf("    .word %d\n",$2);
}

END {
   printf("_dicee_end: \n");
}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...