Jump to content

svenvandevelde

Members
  • Posts

    377
  • Joined

  • Last visited

  • Days Won

    14

Everything posted by svenvandevelde

  1. This is my sequential file read routine ... /** * @brief Load a file to banked ram located between address 0xA000 and 0xBFFF incrementing the banks. * * @param channel Input channel. * @param device Input device. * @param secondary Secondary channel. * @param filename Name of the file to be loaded. * @param bank The bank in banked ram to where the data of the file needs to be loaded. * @param sptr The pointer between 0xA000 and 0xBFFF in banked ram. * @return bram_ptr_t * - 0x0000: Something is wrong! Kernal Error Code (https://commodore.ca/manuals/pdfs/commodore_error_messages.pdf) * - other: OK! The last pointer between 0xA000 and 0xBFFF is returned. Note that the last pointer is indicating the first free byte. */ unsigned int load_file_bram(char channel, char device, char secondary, bram_bank_t dbank, bram_ptr_t dptr, size_t size) { #ifdef __FILE printf("load file, c=%u, d=%u, s=%u, b=%x, p=%p, si=%u", channel, device, secondary, dbank, dptr, size); #endif byte status = 0; char ch = 0; unsigned int read = 0; byte bank_old = bank_get_bram(); bank_set_bram(dbank); status = cbm_k_chkin(channel); status = cbm_k_readst(); if(status) return 0; byte* ptr = dptr; // gotoxy(0,10); // printf("load: ptr = %p, bank = %x", ptr, bank); while ((size && read < size) || !size) { ch = cbm_k_chrin(); // OK, character read and not end of input read++; // check if pointer is between bram boundaries if(ptr == 0xC000) { dbank++; // printf(", %x", (word)bank); bank_set_bram(dbank); // select the bank ptr = (byte*)0xA000; } // put the read character into the pointer location *ptr = ch; // increase the pointer ptr++; status = cbm_k_readst(); if(status) break; } #ifdef __FILE printf(", r=%u, status=%u\n", read, status); #endif bank_set_bram(bank_old); #ifdef __FILE // cbm_k_chkin(0); // while(!getin()); #endif return read; } Note that the routine and the description still requires some love from my side ... it's just a version at the moment to get my files loaded into bram in a sequential manner, in chunks as I use a bram heap manager that allocates blocks of memory for me.
  2. One thing to avoid though in C are pointers ...
  3. Very interesting. Didn't know you also develop in C for the X16. There are some very interesting language constructs that end up with blazing fast 8 bit assembler code ...
  4. Maybe log an issue on github for the emulator ... so this gets tracked.
  5. Actually, what you just highlighted seems like an interesting concept.
  6. I know this video however these days unity is the standard. And with unity one can just paste blocks like little bitmaps. But how would this be implemented using vera tiles? Including the steep edges and elevation. Million $ question ...
  7. Looked again closer to your video and you really made something very nice there @SlithyMatt! Well done! You will have a nice game created when finished.
  8. Thank you sir. Interesting concept using two layers. Would it also work with isomeric tiles that are 30⁰ over 30⁰ instead 45⁰ over 45⁰?
  9. Thank you Tom. Very interesting and fascinating how you modelled this so quickly. You know, racing destruction set of EA was a game which I admired greatly when I was young. And I still have not figured out how they did that game. How did they manage to create these tracks with such limited hardware. With elevations that went flat, up, steep up, down and steep down. And this with asphalt, ice and dirty roads. They even had tires and oil spills. Remember such a game on the cx16 with latest graphics. 16 years again it would be for me
  10. Thank you for this. Great achievement there. What I'm struggling with is how to create isomeric tiles from square 8x8 chairs. Is there somewhere an example of how to do this? How and which char patterns to create that can be combined to isomeric maps
  11. My question was meant in reply to Ed comment ... but thanks! So how do you manage to process interrupts at a specific scan line?
  12. How would you approach the creation of an isometric landscape using vera on the cx16? The vera can tile only square tiles like 8x8 or 16x16. Is there a way to create an isometric landscape using square tiles or are other techniques required? I remember on the Commodore 64 the game Racing Destruction Set, Spindizzy, Zaxxon, Marble Madness ... Example Anyone?
  13. So how do you manage to process interrupts at a specific scan line?
  14. Really? Well to be honest I am kind of glad that the 65C02 was selected, although it would have been nice if the 65CE02 would have been possible. The additional z register would really make a difference. It would allow for less zero page usage etc. But the 65C02 really gives that commodore feeling!
  15. Put it at the highest top of the main ram, and pls minimize zeropage usage.
  16. i see ... indeed, i will need a memory segment where your music player runs in. No way to compile this or link. A direct memory load and a jmp, that"s it. How many zeropage does your music player use?
  17. Kick C, in progress by @Jesper Gravgaard. It is the most impressive work I've seen in years. If your code is well written, it generates FAST code that I've never seen. His methods of SSA and code optimizations is something I've never seen in a compiler for the 6502 family. That being said ... It has a steep learning curve. Not the language of course, which is C, but learning how to witte you code so that your xode becomes optimal. So looking at the generated assembler is how you learn how to apply the most ideal language constructs. And that is where people struggle... The compiler works with a fragment system that contains hundreds, if not thousands, of 6502 assembler code snippets that are used to generate the assembler. It has taken me about a year to come to this result. I've helped Jesper to write many fragments that were missing. Fragments are needed as a result of missing combinations of C code constructs. For example a fragment that implements how to assign an char element in a struct indirected by a constant pointer with variable offset from a byte in memory, assigned from a signed byte indirected by a constant offset from a variable pointer through zero page. It takes time to learn the compiler and how to use it. It is not perfect yet. It had defects and its error messaging is good but incomplete. Sometimes the compiler will crash and it will take you about 3 weeks to find out why it is crashing. Of course I've also downloaded the code from github and now I'm at a level where I can debug and correct the compiler code where needed. But besides all that, the result is there. Through its users this environment will become better. Users like me who persevere. Jesper had been helping me in the background with bugs and also writing certain fragments. I've been debugging his code of the compiler to find crashes and intercepting the exceptions to get meaningful error messages and to know WHERE it complains in your code. But the core of his compiler is solid. If your are interested we can setup a discord session and I'll explain you my current environment. Or I'll record a video how to use it ... I am working from a fork from his compiler and have written lots of code for the CX16 as libraries for use by others. Vera library, heap, banking... etc ... Let me know if you're interested in this offer. Jesper is a bit offline now due to his personal obligations but I can help you a lot getting you started if you want. On discord.
  18. You mean, when the files are stored on an sdcard and the sdcard is mounted?
  19. $6 to $8? That's it? Seriously? I would have gone for the 256K then when designing the cx16. Video capabilities boost platform popularity. I mean, the difference is only a few bucks additionally. I had understood moving to a VRAM larger than 128K would be a + $50 cost or something.
×
×
  • Create New...

Important Information

Please review our Terms of Use