Jump to content

Greg King

Members
  • Posts

    162
  • Joined

  • Last visited

  • Days Won

    4

Greg King last won the day on June 28 2021

Greg King had the most liked content!

1 Follower

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Greg King's Achievements

  1. You're right. I forgot that the number is 32, not 16, bits. I was thinking nybbles instead of bytes.
  2. buf should be increased before the test. Otherwise, the current wrap-around won't be seen. But, if tmp is zero, then there's no point in doing any increases/decreases.
  3. That's big-endian. But, the number must be little-endian! Also, don't use strings. That will run the string garbage collector, which will slow down your program. Write it this way: PRINT#15,"P";CHR$(8);CHR$($0);CHR$($0);CHR$($4);CHR$($0)
  4. ASL instead of ROL!
  5. What happens if you open and close the command/status channel instead of a file?
  6. Type a control-n. Then, load the file with lower-case letters: load"cx16*"
  7. I have upgraded my commander-r39 branch to the new Kernal code. I haven't pushed it to master yet because I have problems with file loading. Programs that want to load dynamic drivers can't get them. I haven't investigated it yet. https://github.com/greg-king5/cc65/tree/commander-r39
  8. You should call cbm_k_clrchn() before you call cbm_k_close(). It's the opposite of when you started to use the file: OPEN the file, connect to the file. When you're finished, you must: disconnect from the file, close the file.
  9. Tape files are opened by Kernal. Therefore, OPEN can know when they can't be found. But, Kernal asks DOS to open disk files. Therefore, OPEN can't know about them. With READST, bits 6 and 1 aren't connected to each other. It's a coincidence if bit 6 happens to be set when bit 1 is set. Always check bit 1 by itself. That bit is reliable. LOAD uses it to know when a file can't be loaded. The same is true for the other direction. If a file can't be created, or opened for appending, then an attempt to write into it will set bit 0 (write timeout).
  10. Don't forget to put "-t cx16" on the command line. The assembler needs to know it.
  11. Some cc65 tricks that will shorten pieces of your code: Change l++; if(l > 4095) {l=0;} to l = (l + 1) & 4095; Change while(!(VERA.audio.control & 0x80)){ //while(ii<256){ to while ((signed char)VERA.audio.control >= 0) { //while(ii<256){
  12. Your code waits for VSYNC, then does its work. It finishes just in time to catch the next VSYNC. If you add a little bit of code, then it can't finish in time -- it just misses the next VSYNC. Maybe, your code must wait for the second next VSYNC! It does nothing for almost an entire frame! Naturally, its frame rate suffers a huge hit. (Try not waiting for VSYNC. See what that does to the rate.)
  13. What cc65 does depends on the context (the code that surrounds those expressions). Most of the time, cc65 can recognize that they are simple byte fetches. It won't do the actual operations that are implied by the C code. cc65 will generate Assembly code that grabs the register that holds the desired byte. #define BYTE1(val) ((unsigned char)((val) & 0xFF)) #define BYTE2(val) ((unsigned char)(((val) >> 8 ) & 0xFF)) #define BYTE3(val) ((unsigned char)(((val) >> 16) & 0xFF)) #define BYTE4(val) ((unsigned char)(((val) >> 24) & 0xFF))
  14. No, the addition must be done last. It's used to move past numbers that Commodore already used to control Kernal's LOAD behavior: 0 -> normal load 1 -> normal verify 2 -> VRAM address high bit (0) 3 -> VRAM address high bit (1)
  15. @rje's code has a couple of problems. DOS commands must be lower-case. cbm_k_setnam() needs a variable-length C text string; but, the "p" command is fixed-length binary. cbm_k_setnam() cannot be used to pass the command to DOS. The following code will work: #include <cbm.h> #include <errno.h> unsigned char __fastcall__ cx16_seek(unsigned char chn, unsigned long pos) { static struct { const char p; unsigned char chn; unsigned long pos; } cmd = { 'p' }; cmd.pos = pos; cmd.chn = chn; cbm_open(255, 8, 15, ""); cbm_write(255, &cmd, sizeof cmd); cbm_close(255); return _oserror; }
×
×
  • Create New...

Important Information

Please review our Terms of Use