ivop Posted October 2, 2021 Share Posted October 2, 2021 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 Quote Link to comment Share on other sites More sharing options...
ilmenit Posted October 2, 2021 Share Posted October 2, 2021 (edited) Instead of reinventing the wheel what about using these functions? https://github.com/cc65/cc65/blob/master/include/fcntl.h https://github.com/cc65/cc65/blob/master/include/unistd.h Take a look at their code here, they are not that bad: https://github.com/cc65/cc65/tree/master/libsrc/atari Edited October 2, 2021 by ilmenit 1 Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted October 2, 2021 Share Posted October 2, 2021 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 1 Quote Link to comment Share on other sites More sharing options...
ivop Posted October 2, 2021 Share Posted October 2, 2021 (edited) 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 October 2, 2021 by ivop Quote Link to comment Share on other sites More sharing options...
ilmenit Posted October 2, 2021 Share Posted October 2, 2021 if you look at e.g. https://github.com/cc65/cc65/blob/master/libsrc/atari/open.s then it may be either good enough or a good base for writing own open/read/write/close functions. Quote Link to comment Share on other sites More sharing options...
Harry Potter Posted October 2, 2021 Author Share Posted October 2, 2021 I can do that. Now, what about reading the directory? BTW, I don't know how to use those functions. Quote Link to comment Share on other sites More sharing options...
ilmenit Posted October 2, 2021 Share Posted October 2, 2021 11 minutes ago, Harry Potter said: I can do that. Now, what about reading the directory? BTW, I don't know how to use those functions. Let me Google that for you http://www.mathcs.emory.edu/~cheung/Courses/561/Syllabus/3-C/bin-files.html 1 Quote Link to comment Share on other sites More sharing options...
ivop Posted October 2, 2021 Share Posted October 2, 2021 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. Quote Link to comment Share on other sites More sharing options...
sanny Posted October 2, 2021 Share Posted October 2, 2021 3 hours ago, Harry Potter said: How do I call CIOV? use _sys() https://cc65.github.io/doc/funcref.html#ss3.14 1 Quote Link to comment Share on other sites More sharing options...
ivop Posted October 3, 2021 Share Posted October 3, 2021 19 hours ago, sanny said: use _sys() https://cc65.github.io/doc/funcref.html#ss3.14 So my inline assembly for setting X, and returning Y isn't even needed. I was right in the first place (without knowing), it can all be done in C. Quote Link to comment Share on other sites More sharing options...
Harry Potter Posted October 4, 2021 Author Share Posted October 4, 2021 Can anybody here post a link to a reference of the different CIOV calls and parameters for me, please? Quote Link to comment Share on other sites More sharing options...
drac030 Posted October 4, 2021 Share Posted October 4, 2021 Here you go: http://atariki.krap.pl/index.php/Dostęp_do_plików Polish, but an automated translator should get this sorted out. Quote Link to comment Share on other sites More sharing options...
E474 Posted October 4, 2021 Share Posted October 4, 2021 There's this list of XIO codes for various DOSs, which are actually CIO calls. https://atariwiki.org/wiki/Wiki.jsp?page=XIO Command Codes DOS Handler Quote Link to comment Share on other sites More sharing options...
Harry Potter Posted October 5, 2021 Author Share Posted October 5, 2021 Thank you, E474. Quote Link to comment Share on other sites More sharing options...
Harry Potter Posted October 5, 2021 Author Share Posted October 5, 2021 What about the arguments? Quote Link to comment Share on other sites More sharing options...
ilmenit Posted October 5, 2021 Share Posted October 5, 2021 (edited) https://letmegooglethat.com/?q=atari+CIOV+calls Edited October 5, 2021 by ilmenit 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.