[cc65] Lynx target

From: Karri Kaksonen <karri1kosh.dna.fi>
Date: 2008-03-20 10:20:18
Hi Uz,

The files cartread.s cartwrite.s filedir.s filehelp.s fileload.s have 
evolved a bit since introduction of them. So just throw them away. I 
need to create a new set of them anyway.

Currently TailChao is creating encrypted loaders for all cart sizes and 
the file access routines will develop accordingly.

The Lynx file I/O is a bit different from other systems as the directory 
contains the RAM address where to load the data upon request. So there 
is really just two basic commands you use:

void __fastcall__ FileLoadFile(int filenumber)
void __fastcall__ FileExecFile(int filenumber)
The FileExecFile is mainly for compilation carts where you have several 
small exe:s in one cart. The routine loads the file and does a JMP 
command to the start address of the loaded file.

Typical Lynx files are named segments.
fileno
0 - title sprite, mandatory
1 - startup executable, mandatory (also contains all the cc65 resident 
libraries)
2 - miniloader library remains resident between $0200-$03ff for 
accessing the cart
3 - first game executable starting at $0400 (it does not contain the 
cc65 resident libraries)
4 - second game executable starting at $0400 (it does not contain the 
cc65 resident libraries)
.....
N - sprites for first game
N+1 more sprites
N+3 one tune - music in ABC format to be used for all games
N+4 another tune - more music

The programmer just reads in the files his level needs and uses it.

FileLoadFile(BACKGROUND_SPRITE_FILENO); // The linker knows that the 
sprite is needed in Sbackground
tgi_draw(&Sbackground);
FileLoadFile(MOZART_SYMPHONY_FILENO); // The linker knows that the data 
goes to arrays mozart0..mozart3
abc_play(channel0, mozart0)
abc_play(channel1, mozart1)
abc_play(channel2, mozart2)
abc_play(channel3, mozart3)

The cc65 linker will assemble the directory and set the addresses and 
sizes for code or data overlays.

On some carts we also have EEPROM support (128 * 16bit). For this there 
is three functions:
int __fastcall__ eeprom_read(unsigned char cell)
void __fastcall__ eeprom_erase(unsigned char cell)
void __fastcall__ eeprom_write(unsigned char cell, int data)

The question I have is that can this functionality be implemented using 
some common functions found for other cc65 targets?

I don't want the Lynx programmer to have to worry about load addresses 
or sizes of the overlayed pieces of code. The linker takes care of this 
perfectly.
-- 
Karri

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Thu Mar 20 10:21:06 2008

This archive was generated by hypermail 2.1.8 : 2008-03-20 10:21:08 CET