From: "Karri Kaksonen" on Thursday, March 20, 2008; at 05:20 AM -0400 > > 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 > are really just two basic commands you use: > > void __fastcall__ FileLoadFile(int filenumber) > void __fastcall__ FileExecFile(int filenumber) I think that those functions should be renamed CartLoadFile() and CartExecFile(). It will avoid confusion about the source of what they load. There are three sources of programs: 1. cartridges, 2. ComLynx serial cables, 3. emulators can load from a host's file-system. Those functions' names should show that they read from the first source. > > Typical Lynx "files" are linked into a cartridge image as named segments. > "File" number - description: > 0 - title sprite, mandatory > 1 - start-up 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 them. > > 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 and data overlays. > > On some carts., we also have EEPROM support (128 * 16bit). > For that, there are 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, can that functionality be implemented using > some common functions found for other cc65 targets? No, the libraries do not have common functions for direct overlay support. However, I adapted some code from your "lynx-cart-demo-1.1.zip" contribution, and created enough POSIX input functions to allow Lynx programs to load dynamic drivers (into heap space) in the same way that other targets do it. Examples: // The joystick and graphics drivers are the third and fourth files // in the directory. status = joy_load_driver(joy_stddrv); tgi_load_driver("\3"); It might be interesting to add a layer above those EEPROM functions that sees the EEPROM as a POSIX file. ---------------------------------------------------------------------- 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 23:55:10 2008
This archive was generated by hypermail 2.1.8 : 2008-03-20 23:55:12 CET