Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by DusanStrakl

  1. I wrote tutorial on programming sound using PSG in BASIC: https://www.8bitcoding.com/p/sound-in-basic-i-programmable-sound.html
  2. Yeah, I am playing with X16 Emulator for more than a year and still mix them up occasionally Actually I saw so many questions about this I just started writing another post for my blog to explain how to use PSG in BASIC.
  3. I think you are overcomplicating a bit. You don't need to program VERA registers when using BASIC, you can use VPOKE to write data to VRAM directly and let BASIC interpreter deal with VERA registers. A simple program to turn on square wave (pulse) and increases frequency can be written as below: 10 VPOKE 1,$F9C3,%00111111:REM SET WAVEFORM FOR VOICE 0 20 VPOKE 1,$F9C2,%11111111:REM SET LEFT AND RIGHT CHANNEL AT MAX VOLUME 30 FOR N=200 TO 2000 STEP 5 40 VPOKE 1,$F9C1,INT(N/256):REM SET HIGH BYTE OF FREQUENCY 50 VPOKE 1,$F9C0,N AND 255:REM SET LOW BYTE OF FREQUENCY 60 FOR I=1 TO 200:NEXT I:REM DELAY 70 NEXT N 80 VPOKE 1,$F9C0,0:VPOKE 1,$F9C1,0
  4. Agree with Matt, VERA PSG is way to get started. I implemented very simple, rudimentary sounds in my version of Tetris in BASIC: https://www.8bitcoding.com/p/crazy-tetrominoes.html If you don't want to deal with programming you can also just import and call four basic sounds in my Simplest Sound Effects Library for BASIC: https://www.8bitcoding.com/p/simplest-sound-effects-library-for.html Later if you want to add music that plays independently in the background of BASIC program you can opt to a bit more complex Music Library: https://www.8bitcoding.com/p/music-player-library-for-basic-programs.html
  5. Thanks Lucky Phil. I agree, Commodore BASIC is not ideal language but then again there is no such thing anyway. I find it very convenient to tinker with, prototype and with some effort and clever coding a lot of fun results can be achieved.
  6. Thanks Jake. I agree and with powerful hardware supported graphics and 8Mhz clock speed a lot can be done in BASIC. I am working mostly on my Assembly tutorials now but I am sure I will add some more BASIC tutorials and games soon.
  7. This has been a common question for a while now and Stefan explained it perfectly. There are several other keys that can't be detected by standard Kernal routine at this time and I was assured that all the keys on the keyboard will have function in the future. I expect they will also fix some discrepancies like for example not use F4 to switch between 40/80 display when there is a dedicated button for it etc.
  8. 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
  9. When I was working on something reusable for my needs I was always struggling with really how generic such a library can and should be. I can think of few dilemmas from the top of my head: Do I support default screen size only or make it generic, specifically Map width is tricky one because if you want to support anything else than 128 tile width the VERA MID parameter is no longer Y dimension and require more checks and bit shifting. How to handle colors, do I go for standard predefined colors for different objects/widgets or should they always be passed as parameters. If second what happens if you want to draw e.g. frame parts in different colors to represent highlights etc. Do I allow different variations e.g. can frame be with rounded corners or square corners or perhaps the whole frame can be built with full or half blocks or even custom characters. Support for Lower case / Upper case PETSCI / ISO and then translations to screen codes Before mentioned number to text translations etc. This can lead to a real rabbit hole of options so I suggest not to overthink and to really simplify the first version and only support default screen and very basic functionality and then see where it leads.
  10. Great initiative Jimmy. I think we all wrote bits and pieces of these type of routines but it would be great to have a library at our disposal.
  11. Yup had the same problem when I wrote music library for BASIC programs. Of course I had to back up registers because I had to allow the default IRQ handler to take over after I was done playing with PSG (pun intended ) and of course BASIC programs print, draw, scroll, etc.
  12. I can't test it right now but call to screen_set_charset function at $FF62 should do the trick. A can contain following values: Value Description 0 use pointer in .X/.Y 1 ISO 2 PET upper/graph 3 PET upper/lower Link to documentation: https://github.com/commanderx16/x16-docs/blob/master/Commander X16 Programmer's Reference Guide.md#function-name-screen_set_charset
  13. Yeah it is not ideal but it is compromise that works reasonably well.. I don't think anybody uses real joysticks with emulator and we still don't have proper access to keyboard to programmatically detect key presses and not rely on kernal. Of course for this type of game analog input would be the best.
  14. DusanStrakl

    Crazy Pong

    Version 1.0.0


    After three tutorials on how to use Sprites on Commander X16 using Assembly, I wrote a game to demonstrate all we learned there plus of course some necessary techniques like reading controls, using interrupts and utilizing Fixed Point Notation. Full tutorial with source code walkthrough is available on my blog: https://www.8bitcoding.com/p/crazy-pong.html
  15. Crazy Pong View File After three tutorials on how to use Sprites on Commander X16 using Assembly, I wrote a game to demonstrate all we learned there plus of course some necessary techniques like reading controls, using interrupts and utilizing Fixed Point Notation. Full tutorial with source code walkthrough is available on my blog: https://www.8bitcoding.com/p/crazy-pong.html Submitter DusanStrakl Submitted 01/29/21 Category Games  
  16. Go for it, it would be very interesting to see what kind of performance you could get out of it.
  17. Great start. Looking forward to your progress.
  18. I agree, it looks like character mapping problem. I saw some other posts from svenvandevelde and I believe he is working in C. So my suggestion would be to check the generated assembly and see how were the filename characters converted.
  19. SlithyMatt and Ender are correct. You probably didn't use the correct colors. I wrote a blog post with some concrete examples to specifically cover layers and threw in some scrolling on top of it. You can check it out here: Scrolling and Layers in BASIC
  20. VERA PSG is definitely not as powerful as SID. Like mentioned before, there are no hardware supported ADSR envelopes and no filters. I wrote a music player with software envelope support that can be called from BASIC programs (and of course also from assembly or C) with some predefined envelopes and ability to test your own. I also wrote stripped down version with four simple sound effects for BASIC programs. I use standard VSYNC interrupt to update the envelope so it can only be adjusted 60 times per second. They both come with source code if you want to tinker with it. Music Player: https://www.8bitcoding.com/p/music-player-library-for-basic-programs.html Sound Effects: https://www.8bitcoding.com/p/simplest-sound-effects-library-for.html
  21. Thanks Rob, I appreciate it.
  22. I wrote a series of blog posts/articles on Commander X16 architecture and coding. I have started with focus on beginners and then slowly moved to more advanced topics and techniques. First I tackle smaller chunks and use simple examples to show the topic in practice. After enough new knowledge is covered I write a complete game to utilize several of the techniques to illustrate how it all comes together so each new complete project is more complex than the one before. I do cover only Commander X16 specific so I recommend reading Commodore C64 BASIC tutorials and guides. Please note that the games and most examples are written with a goal to be as clearly readable and understandable so there is very little source code optimizations. Snake Game This game is written in very clean BASIC with very little trickery so not much special Commander X16 knowledge is required. We do VPOKE directly into video memory so only understanding of fundamentals is required. Recommended reading VERA Overview Topics Covered in Game Analyzing the game itself is a great way to learn basics like: How to structure source code (outer loops, game loop) What is Game loop Use of Data structure like multiple Arrays How to read Joystick, Keyboard How to use VPOKE to “talk to” VERA Video RAM organization and using colors Writing to certain location on the screen Using PETSCII control characters to display messages and title screen GOTO Crazy Snake Tutorial GOTO Download Tetris Clone This game introduces some more advanced features of Commander X16 and we have to take a bit more care of how to use data structures and optimize some parts of the game to make it playable. Recommended reading VERA Overview Tiles in Basic I - Video Modes 0 and 1 Colors and Palettes Topics Covered in Game Tetris clone requires us to improve on pretty much all parts of the snake game structure: We have additional loops outside and inside game loop Advanced game collisions based on screen state Pre-calculate relative positions of four segments of each tetromino Customize color palette Customize tiles (characters) Speed increase per level Adding sound to the game GOTO Crazy Tetrominoes Tutorial GOTO Download Boulder Dash style game With this game we are using most of the Commander X16 hardware capabilities and we are getting close to squeezing most out of it for BASIC games. We have to pay close attention to timings, synchronizing scrolling and animation, take care of different types of collisions, etc. Recommended reading VERA Overview Tiles in Basic I - Video Modes 0 and 1 Sprites in Basic I - Setup Sprites in Basic II - Animation Scrolling and Layers in BASIC Colors and Palettes Simplest Sound Effects Library for BASIC Font Library for Commander X16 Topics Covered in Game This game is taking advantage of hardware features of Commander X16 to the level it almost looks like 16bit game or something written in Assembly for 8 bit computer like: Two phase approach to development Full color mode Full screen scrolling Two layer graphics Scrollable playfield Static HUD Animated full color sprites 256 color title screen in graphics mode Advanced physics and game mechanics Loading assets to memory from binary files for: Tileset Sprite Sheet Fonts Sound effects library Title screen GOTO Crazy Boulders Tutorial GOTO Download
  23. Hmm this is indeed unusual result but also parameters are a bit unusual and it would require some time to debug to understand what exactly is happening. To achieve a short percussive envelope I would use setting like this: Triangle wave AD = $10 - very short attack, no decay SR = $08 - no sustain, medium long 200ms release Not continuous Max Volume = 63 Sustain Volume = 63 LR = 3 - my documentation should state that 11 is binary for left and right channel so decimal 3, will update my post or in code: 10 LOAD"PLAY.PRG",8,1,$9000 20 FOR N=0 TO 64+8 30 READ A 40 POKE $6000+N,A 50 NEXT N 100 REM SETUP CUSTOM INTRUMENTS 110 SYS $9006 120 M=PEEK(4)+PEEK(5)*256+6*8 130 POKE M,128 140 POKE M+1,$10 150 POKE M+2,$08 160 POKE M+3,0 165 POKE M+4,63 170 POKE M+5,63 190 POKE M+6,3 800 REM PLAY SONG 810 POKE 2,$00 820 POKE 3,$60 830 SYS $9000 840 END 999 REM 1000 REM ===== HEADER DATA ===== 1001 REM 1010 DATA 4 :REM NUMBER OF VOICES 1020 DATA 9 :REM TEMPO 1030 DATA 64,0 :REM LENGTH (16 BITS) 1040 DATA 1 :REM AUTOREPEAT ON 1049 REM 1050 REM ===== INSTRUMENTS ===== 1051 REM 1060 DATA 6,0,0,0 : REM CUSTOM INSTRUMENT 1099 REM 1100 REM ===== MUSIC DATA ===== 1101 REM 1110 DATA 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 1120 DATA 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 1130 DATA 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 1140 DATA 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 Please let me know if this creates the effect you were going for? I will try to find some time over the Weekend to investigate strange result your settings created.
  • Create New...

Important Information

Please review our Terms of Use