Greg King 65 Posted February 2 18 minutes ago, VincentF said: Got this code to check if an error occurred, it's just for testing. What do you think of it? The "00, ok" message is text, not binary numbers. That is, your code would read $30, $30. 1 Quote Share this post Link to post Share on other sites
Greg King 65 Posted February 2 2 minutes ago, VincentF said: Right now it's returning carry set (debugged the output and it made sense) but still no luck on the blinking, i'll try with the READST. I tried to check for zeroes but I need to CMP #$30 instead. (petscii zeroes) Perhaps, you need to read the entire message. Do a loop. Read until it sees a $0D (carriage return). Quote Share this post Link to post Share on other sites
Stefan 94 Posted February 2 (edited) This seems to work. Also puts out the blinking light. CLOSE = $ffc3 CLRCHN = $ffcc SETLFS = $ffba SETNAM = $ffbd OPEN = $ffc0 CHKIN = $ffc6 CHROUT = $ffd2 CHRIN = $ffcf READST =$ffb7 disk_status: lda #15 ldx #8 ldy #15 jsr SETLFS lda #0 jsr SETNAM jsr OPEN ldx #15 jsr CHKIN : jsr CHRIN pha jsr READST bne EOF pla jsr CHROUT bra :- EOF: pla lda #15 jsr CLOSE jsr CLRCHN rts Edited February 2 by Stefan 1 Quote Share this post Link to post Share on other sites
VincentF 40 Posted February 2 15 minutes ago, Greg King said: Perhaps, you need to read the entire message. Do a loop. Read until it sees a $0D (carriage return). It was that. Now that I read the entire message the blinking is finally gone ! Thank you so much @Greg King and @Stefan for helping me figuring out the issue ! I learned a lot on the filesystem process thanks to you It would be nice to document this kind of stuff somewhere for people like me It's sometimes hard to find the right documentation for the right problem 2 Quote Share this post Link to post Share on other sites
Greg King 65 Posted February 2 Does Vixx really need to know why it can't read the high score file? Maybe, it's enough that your program knows when it can, and when it can't. If that's the case, then "check_disk_error:" actually wouldn't need to compare the status numbers. It merely would need to do something that stops people from yelling, "Hey buddy, you left your turn signal on!" Your program would OPEN the file. If OPEN returned with the Carry flag set, then the device doesn't exist (someone forgot to attach a card to the emulator). If the flag is unset, then the file must be closed, at some later time -- no matter what else happenned. Vixx would try to read the file. Then, if READST returned a non-zero value (the particular bits wouldn't matter), Vixx would "flush" the device's error channel. If Vixx wanted to add a new high score to the file, then it would know that the score is the first one. Vixx would create the file. But, if Vixx wanted to show a high scores screen, then it would show an empty screen (nobody has scored, yet). 1 Quote Share this post Link to post Share on other sites
VincentF 40 Posted February 2 Actually the program do this : When loading the title screen, he checks if the high score variable is zero. If so, he tries to load the file. He immediately do "check_disk_error" that just return carry set if there was an error (whatever it was) and carry clear if the returned code was "00". If there was an error, he then create a new file by storing zeroes in it. Else he gets the content of the file and fill the high score variable. I check if the score is zero on the title screen to avoid useless file loads. The file is saved back only when the last high score was beaten during a game. I don't mind checking for a disk error directly, because it's not on a critical part of the code that need to be optimized as much as possible. Also quite conveniently, the error is stored on X and Y when returning, so this code could be reused on some other apps ^^ The next step for me, now that the filesystem access is fixed, is making a music / sound engine. My first steps with the PSG are very clumsy and to be honest I'm not good at all with music stuff ^^' I'm kind of afraid of this part. It would be the last big feature missing before I have all the bricks I need to finish the game. Devlog 3 coming tomorrow probably, by the way I got a lot of stuff to talk in it Quote Share this post Link to post Share on other sites
Greg King 65 Posted February 3 By the way, CLOSE clears the carry flag just before it returns. Therefore, your function doesn't need to do it for "good to go". Quote Share this post Link to post Share on other sites
kliepatsch 74 Posted February 3 (edited) 11 hours ago, VincentF said: The next step for me, now that the filesystem access is fixed, is making a music / sound engine. My first steps with the PSG are very clumsy and to be honest I'm not good at all with music stuff ^^' I'm kind of afraid of this part. It would be the last big feature missing before I have all the bricks I need to finish the game. Have you had a look at the music player library? @DusanStrakl also made a simple sound effects library. They are intended for use in BASIC, but can also be used in machine code programs. If you have further questions about them, you can ask him. The source code for the Music Player Library is out there on GitHub. I couldn't find the source for the SFX library, but maybe the author would share that as well upon request. Edited February 3 by kliepatsch 1 Quote Share this post Link to post Share on other sites
JimmyDansbo 153 Posted February 3 11 minutes ago, kliepatsch said: I couldn't find the source for the SFX library, but maybe the author would share that as well upon request. Effects library does not have its own repo, but it can be found here: https://github.com/Dooshco/X16/blob/master/Effects.asm I have converted to ACME assembler her: https://github.com/JimmyDansbo/cx16stuff/blob/master/effects.asm 1 Quote Share this post Link to post Share on other sites
VincentF 40 Posted February 3 (edited) It was announced yesterday, here he comes, the third issue of my devlog ! #3 - 03/02/2021 : Graphic design is my passion. Since the last devlog, I worked mainly on the graphic identity of the game, and also still improving the choreography system in place. So as said in an earlier post, I got a background for the game : We play as an antivirus software that go through the computer to find and destroy a virus. This idea is quite simple and allow me to work on simple graphics. Since a bullet hell game can be hard to read it's better to set a color code right away. So I decided to make the existing bullets in red and draw a small ship (no idea why but it made sense to me) in green. The contrast between the two is large enough to play the game without being confused. I also designed the main antagonist of the game, known as the Virus : I also designed a title screen for the game, with a small message before it when we play in the emulator (looking at the ROM's source code I found out that $9FBE and $9FBF contains "16" when the emulator is running). Through the game, you'll get to boss phases, where the virus comes and summon a bunch of bullet to dodge. If you manage to survive long enough, the virus will be damaged and the next level starts. When a boss is defeated, the player will be rewarded with some points and will also get one extra life. Talking about points, let's recap the ways of gaining them : Over time, you'll slowly get points just by surviving long enough You'll get extra points by staying near bullets, taking risks can reward you with a huge amount of points When defeating bosses, you get a fixed amount of points, not too much to avoid having it ruling over the others ways of getting points When you have lost a life, you get invincibility but you won't gain any points during the period I'm still thinking of other ways to get points, stay tuned for this On the choreography side, I didn't made much changes, just optimizations to insert bullets in bulk. I finished a sketch of the first level layout, it need to be longer but I'm happy by how much he sizes for now (~768 bytes) I have added a way to control the scrolling speed, the scoring-over-time speed, and finally he can controls what is displayed in the background as well as the bullet's sprites, and even reconfigure a bullet on the fly (for example to control the virus's movements). Finally, here's the current state of the game, hope you enjoyed the devlog (note: level 2 is not done at all, the name and patterns are just tests) Edited February 4 by VincentF Quote Share this post Link to post Share on other sites
DusanStrakl 102 Posted February 3 Nice and very fast progress Vincent! Like Kliepatch and JimmyDansbo mentioned I wrote couple of libraries that could be useful for implementing sound effects and music. Full tutorials with access to source code are available on my blog: https://www.8bitcoding.com/p/simplest-sound-effects-library-for.html https://www.8bitcoding.com/p/music-player-library-for-basic-programs.html Quote Share this post Link to post Share on other sites
VincentF 40 Posted February 3 (edited) 51 minutes ago, DusanStrakl said: Nice and very fast progress Vincent! Like Kliepatch and JimmyDansbo mentioned I wrote couple of libraries that could be useful for implementing sound effects and music. Full tutorials with access to source code are available on my blog: https://www.8bitcoding.com/p/simplest-sound-effects-library-for.html https://www.8bitcoding.com/p/music-player-library-for-basic-programs.html Thank you ! Yeah I started to read your posts and code my audio engine following them ^^ It's really well made, thank you for this ! Edited February 3 by VincentF Quote Share this post Link to post Share on other sites
VincentF 40 Posted February 8 (edited) Hey everybody ! Here's a small update on the project ! #4 - 08/02/2021 : Music Engine Following the excellent post by @DusanStrakl I wrote a music engine based on a very similar approach. This post allowed me to understand how to figure out an ADSR envelope and I learned a lot thanks to it. It's far from being perfect and will need a rewrite, but for me it's enough for a first version. Basically it's an(other) interpreter much like the Choreography Engine that reads a byte stream and control various things like changing the number of voices, the rhythm, the instrument used by a voice, jumping all while playing. For this I have two loops running : the main loop that handles instrument's ADSR envelope and interprets the next notes, and the vsync loop that just updates as quickly as possible the PSG registers. During this project, I wanted to run the vsync code as fast as possible, leaving the main computations to the game loop. To be sure the game loop keeps in sync with the frames, there is a wait_frame variable cleared by the vsync and each bit is set by a section of the loop, so for example I run the collision detection once per frame, the music engine runs also once per frame, the note interpreter runs once every [Rhythm] frames and finally the Choreography engine runs as fast as possible the rest of the time until next frame (unless put to sleep). To also optimize space, I gave the note interpreter the ability to jump to subsection of a music. It's working like jsr and rts, but without a stack (So no sub-subsections). I also got some magic notes like a "Global NOP" opcode that will replace NOPing every voices, saving as much space as possible. Musics and Choreographies will take a big part of the memory so I must think of this ahead of time. Here's an example of a music using my interpreter : Now, I need musics ! .... If only I knew how to make good music lol I asked a friend if he could try to do something but it won't be ready soon, actually And that's all for this devlog ! Thanks for reading Edit: I also started to clean up files for a near open-source release. I still need to add more comments to the code. Edited February 8 by VincentF 1 Quote Share this post Link to post Share on other sites
VincentF 40 Posted February 22 Hello everybody ! It's been a while, let's talk about what happened since last time #5 - 22/02/2021 : Music Making As said on the last devlog, I have asked a friend if he can help me making musics for the game. No luck for now, he's quite busy so we don't had a chance to try something. While waiting for him, I started playing around with a software someone has suggested me some time ago : Bosca Ceoil. I went with multiple tries and finally got some themes for the game. It was my first musics I wrote, and considering how much time I spent clicking randomly I'm happy with the result so far. Bosca Ceoil, the music software I use to write Vixx's musics. Here you can see "Seeking", the music you can hear on the first level. I remarked I was using the sawtooth waveform with low pitch pretty frequently, combined with either a noise channel or a pulse channel, to make the percussions. I also tend to use the pulse waveform as my main instrument. The triangle is sadly really too quiet to make anything out of it. (Surely we can do something but I doubt I will get something interesting with my little experience) Converting from Bosca to music data is quite trivial : I only need to change the octave number from Bosca and adapt the number of voices / instruments used to get the same music (the quality seems less clear on CX16 than on Bosca). I then use my music engine's abilities to perform jump-to-subsection in order to optimize space as much as possible : The first song, "Seeking", uses 453 bytes for 44 seconds of music at 75 bpm The first boss's theme, uses 179 bytes for 26 seconds of music at 60 bpm The second level's music (just finished today), uses 907 bytes for 1 minute and 18 seconds at 75 bpm Here's the three musics of the game compiled as a Soundtrack album : Vixx OST.zip ( once I get more musics i'll put the OST along with the prg download) If you can, I would be glad to hear your feedback about these tracks I am still poking around when making music but I feel more and more confident ^^ Now that I have the music for the second level, my next goal will be making this second level himself Thank you for reading ! Quote Share this post Link to post Share on other sites