Jump to content

Lynx cart access


Recommended Posts

Hi All, I'm stuck on a cart access issue with the current git version of CC65 and was wondering if anyone else was able to get cart access working.


I have code like this...


lseek(1, 0, SEEK_SET);
read(1, &buffer[0], 1024*16);


What seems to happen is that the first 1024 bytes are read ok, but then the remaining 15k is just junk.

When I try to put this into a loop to read 1024 bytes 16 times into my buffer, it still gives me the same result as if I was trying to read all 16k in one go.


I have __BLOCKSIZE__ set to 1024 in lynx.cfg


Any ideas what's wrong or is there a different way to read cart memory starting at a particular offset and reading a number of bytes?

Link to comment
Share on other sites

Figured out the issue 😅

Looks like I didn't think and set the block sizes incorrectly...


I had __BANK0BLOCKSIZE__ set to 2048 and __BLOCKSIZE__ set to 1024, which in retrospect should have been obvious!

The git version seems to have not ported all of the code to use the correct symbols, which is a little annoying.


    __STACKSIZE__:        type = export, value = 128;   # stack size in bytes
    __STARTOFDIRECTORY__: type = export, value = 203;   # start just after loader
    __BANK0BLOCKSIZE__:   type = export, value = 2048;  # Bank 0 cart block size (2048=512k ROM, 1024=256k ROM)
    __BANK1BLOCKSIZE__:   type = export, value = 0;     # Bank 1 block size
    __BLOCKSIZE__:        type = export, value = 2048;  # __BANK0BLOCKSIZE__; # backwards compatibility for older code
    __EXEHDRUSR__:        type = import;                # LNX file header, see lnxhdr.s to customise
    __BOOTLDR__:          type = import;                # Lynx boot loader
    __DEFDIR__:           type = import;                # Lynx file system directory


  • Like 1
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.

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.


  • Recently Browsing   0 members

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