Jump to content
IGNORED

cc65: best way to access the disk?


Recommended Posts

9 minutes ago, TGB1718 said:

it does

    lda _channel
     clc
     rol a   ; channel * 16
     rol a
     rol a
     rol a
     tax      <<<<< here channel now 16 in x register
     jsr ciov

Instead of CLC and ROL, you could use ASL. It always shifts in zeroes at bit zero. Bit seven goes to the carry bit. Saves one instruction and two cycles :)

Link to comment
Share on other sites

1 minute ago, ilmenit said:

Instead of reinventing the wheel what about using these functions?

https://www.cc65.org/doc/funcref-20.html

Take a look at their code here, they are not that bad:

https://github.com/cc65/cc65/tree/master/libsrc/atari

He said he didn't want to use the C file handling facilities to reduce the memory overhead 

  • Like 1
Link to comment
Share on other sites

4 minutes ago, TGB1718 said:

He said he didn't want to use the C file handling facilities to reduce the memory overhead 

But there's difference between fopen() and open(). The difference between a full blown FILE structure and a pointer to that, or a file descriptor, which is just an int. After that, use read() instead of fread(), etc...

 

Edited by ivop
Link to comment
Share on other sites

Reading a directory can be done through opendir()/readdir()/closedir(). If you don't want the DIR structure, and bypass libc, you can also use the so-far fictional callciov() and use CIO to read the directory. See "task number 6" at page 86 of Mapping. After opening the directory, it's like reading a file. Read lines until EOF.

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...