Jump to content

VincentF

Members
  • Content Count

    6
  • Joined

  • Last visited

Community Reputation

12 Good

Recent Profile Visitors

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

  1. The idea I have from your description is like a sort of programmable action to perform from inside the VERA chip, kind of like shaders for GPU ?
  2. Version 1.0.0

    7 downloads

    Introduction Here is a little demo of how to dynamically load files in RAM bank in assembly. It's very simple to do but I think that it can be helpful for someone who don't know how to do this right away. In fact I personally would love to see more of this kind of programs in the download section How this loader works ? First thing to do is to tell the Kernal that we want to use a logical file. For this we need to use the SETLFS subroutine. From the "C64 Programmer Reference Guide" : Since we want to load from the disk (or filesystem) we'll need to use the device number 8. The logical file is not important so we use the file 0. Also, as we want to relocate the program into a bank at $A000, we'll set the Y register to #0 to activate secondary address mode. Next step is telling the Kernal which file we want to load. For this we'll use the SETNAME subroutine. From the "C64 Programmer Reference Guide" : For this we'll need to store our file names somewhere in our program so we write at the bottom of our file the names as a string of petscii characters. We then prepare our registers with the size of the filename to load, and then the address. Our final step to load a file is obviously the LOAD subroutine. From the "C64 Programmer Reference Guide" : As the Reference guide said, we want to load a file so we set our A register to 0 and since we want to load to banked RAM ($A000) we enter the address in our X and Y registers. And that's all ! You can chain file loading as much as you need, and even you just need to call SETLFS once at the start of the chain. Note that you'll need to switch the bank between file loads to prevent overwriting previously added program. And since Bank 0 is also reserved you'll need to first switch to bank 1 and start from here. At the end you can also load a file in place of the loader, just avoid overwriting memory where the code is currently being executed. You can for example leave this kind of code in your first bank and at last run it to load a program from $0800 to $9EFF. Kernal Subroutines full documentation : https://www.pagetable.com/c64ref/kernal/ Post Scriptum If you have any suggestions for the code or even want to change things in this description, don't hesitate to tell me !
  3. File Loader Tutorial View File Introduction Here is a little demo of how to dynamically load files in RAM bank in assembly. It's very simple to do but I think that it can be helpful for someone who don't know how to do this right away. In fact I personally would love to see more of this kind of programs in the download section How this loader works ? First thing to do is to tell the Kernal that we want to use a logical file. For this we need to use the SETLFS subroutine. From the "C64 Programmer Reference Guide" : Since we want to load from the disk (or filesystem) we'll need to use the device number 8. The logical file is not important so we use the file 0. Also, as we want to relocate the program into a bank at $A000, we'll set the Y register to #0 to activate secondary address mode. Next step is telling the Kernal which file we want to load. For this we'll use the SETNAME subroutine. From the "C64 Programmer Reference Guide" : For this we'll need to store our file names somewhere in our program so we write at the bottom of our file the names as a string of petscii characters. We then prepare our registers with the size of the filename to load, and then the address. Our final step to load a file is obviously the LOAD subroutine. From the "C64 Programmer Reference Guide" : As the Reference guide said, we want to load a file so we set our A register to 0 and since we want to load to banked RAM ($A000) we enter the address in our X and Y registers. And that's all ! You can chain file loading as much as you need, and even you just need to call SETLFS once at the start of the chain. Note that you'll need to switch the bank between file loads to prevent overwriting previously added program. And since Bank 0 is also reserved you'll need to first switch to bank 1 and start from here. At the end you can also load a file in place of the loader, just avoid overwriting memory where the code is currently being executed. You can for example leave this kind of code in your first bank and at last run it to load a program from $0800 to $9EFF. Kernal Subroutines full documentation : https://www.pagetable.com/c64ref/kernal/ Post Scriptum If you have any suggestions for the code or even want to change things in this description, don't hesitate to tell me ! Submitter VincentF Submitted 07/19/20 Category Tutorial Apps  
  4. Update : I rewrote the parser in assembly (I admit it was way harder than with Millfork) but it's not only that. On my way to learn how the X16 works, I found out I didn't though about IRQs as a possible solution to my previous question. So what I did is write a custom IRQ routine that runs before the Kernal's own subroutine. What this routine do is find out when the cursor has changed its line and parses the potential code found in the cursor's old position. It ignores the line if it's not starting by a number. With that, the program is even lighter than the previous one, from around 200 bytes ! Internally, the program insert the classic BASIC program SYS command but also a second command "NEW" so that you can start writing your basic code directly after running the program. The main code is located at address $8000 so you have some space to write your basic program. Here's the prg file : highlight.prg The source code consist of few files so I will post a zip file containing them. don't mind the weird tree it's mainly because my programs shares the same libraries. basic_highlight_src.zip I didn't have tested everything so maybe there are bugs that I don't have found yet. Feel free to report anything you found while testing Again, thanks for reading !
  5. Hello everybody ! Some days ago I discovered millfork, a programming language designed for Z80 and 6502 computers. I saw that X16 is supported and so I started to write a prototype with this language to see what it can do. This first prototype is a Basic syntax highlighter. it writes on the screen lines of Basic with colors for the line numbers, basic keywords and literal values (strings and numbers). After compiling in Release mode, I was impressed by the resulting .prg file that was around 1KB ! Knowing that basic keywords can take around 400 bytes, I think that the compiler has done a pretty good work (although I still think it can be lighter if someone takes time to optimize it or even use a different approach than mine). For now, sadly, this program uses strings of Basic as input and outputs them directly on screen. It's useless because it's not using the Basic code stored in memory. Do you think that something like this is possible to do ? One approach that I think can work is just calling "LIST" and then a "SYS" command to read the on-screen basic code and highlight it on the fly. I'm attaching the millfork source file basichighlight.mfk and the released prg basichighlight.prg so you can take a look and maybe talk about it further ? Note : In the millfork file, I have commented the tiny text adventure written by Robin from 8-bit show and tell as a way to test the syntax highlighter. Notice that the code is altered because of some limitations of my program that can't handle lines going beyond the right side of the screen. Thanks you for reading ! I'll eventually post updates on this thread if I have more content to share in the future
  6. Hello everybody ! I'm Vincent, 24, former user of Murray²'s X16 forums who just re-discovered the new forums ^^ I have left the community back in the days because of some work-tiredness that prevented me to continue writing assembly code, and so much other things like discovering the Rust Language etc... I am a backend web-developer that just loves programming things in any languages, and also a viewer of David's videos since a very long time (these videos trained me to better understand spoken English !). I'm pretty hyped by the X16 (especially the X16p) and I hope that I can bring some "things" to the community someday I think I'm writing this everywhere but I think it's important for you to note this : I don't mean to be rude : If one of my messages seems rude please don't mind it, there are 100% chances that I didn't meant to be rude. If so, explaining why it can be taken this way and what I should write instead will be appreciated ! I'm still learning : If my message is written in bad English instead of good English, don't hesitate to correct me, I want to improve myself and this will also be appreciated ! Thank you for your time and I hope you all have a good day
×
×
  • Create New...

Important Information

Please review our Terms of Use