Jump to content

DusanStrakl

Members
  • Content Count

    69
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by DusanStrakl

  1. 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
  2. Thanks Rob, I appreciate it.
  3. 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
  4. 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.
  5. Wow, this is great tune. Can I include it on my blog (of course with full credits)? Perhaps there will be more that I could add and build a little library of songs for the player.
  6. Ha, ha, yes I did. It was my first computer. Anybody who did will know these four sound effects
  7. Thank you for compliments. You made just a minor error. You are not loading all the data to memory. 64 bytes of music plus 9 bytes of header data so you have to change the FOR loop to read total of 73 bytes.
  8. Version 1.0.0

    29 downloads

    I wrote a library to enable BASIC programs play music in the background. It is compatible with Simplest Effects Sound library I released a while ago. To demo the library I included two BASIC programs: PLAY.BAS - Playing Twinkle Twinkle Little Star - it demonstrates the BASIC program doing other stuff including calling simple Effects HOUSE.BAS - Playing House of the Rising Sun - it demonstrates a bit more complex music Full Tutorial and source code is available from my blog: https://www.8bitcoding.com/p/music-player-library-for-basic-programs.html
  9. Music Player Library for BASIC Programs View File I wrote a library to enable BASIC programs play music in the background. It is compatible with Simplest Effects Sound library I released a while ago. To demo the library I included two BASIC programs: PLAY.BAS - Playing Twinkle Twinkle Little Star - it demonstrates the BASIC program doing other stuff including calling simple Effects HOUSE.BAS - Playing House of the Rising Sun - it demonstrates a bit more complex music Full Tutorial and source code is available from my blog: https://www.8bitcoding.com/p/music-player-library-for-basic-programs.html Submitter DusanStrakl Submitted 01/09/21 Category Audio Apps  
  10. Thanks for these instructions Tom, this works perfectly and creates an image that can be used by standard Windows tools and mounts to X16 Emulator.
  11. That was my understanding, obviously I didn't test the border values enough. I will have to go back and update my tutorial. Thanks for this Johan. It essentially means that 10 bit number for X and Y position is treated as signed binary where: 11 1111 1111 = -1 11 1111 1110 = -2 11 1111 1101 = -3 etc. but of course that is not completely consistent across the whole range because for example when we put Sprite at X = 600 which is binary 10 0101 1000 and therefore technically negative number it behaves as unsigned 10 bit value.
  12. I can confirm that. Even BASIC programs like my Crazy Boulder can come in multiple files and it runs fine.
  13. I think that for any kind of real application a custom palette is almost a must mostly because how colors are organized not because of the selection of available tones as such. If you have a tile set or sprites with 16 colors the available colors within one group (16 colors in sequence) would almost never work. But for short demos where 256 color mode can be used it is not bad at all.
  14. I explain in quite detail and with BASIC examples how VRAM is structured in different tile (text) modes and explains the concept of Tile base and Map base. I suggest reading these three tutorials; https://www.8bitcoding.com/p/vera-overview.html https://www.8bitcoding.com/p/tiles.html https://www.8bitcoding.com/p/tile-modes-2-4let-us-continue-with.html And yes, by default the content of VRAM is (kind of) random and has to be initialized before use.
  15. I believe your assumption is correct. If you turn on the mouse (with either 1 or -1) it will automatically update x and y coordinate. I experimented a bit with it and it can be quite annoying because if you try to use Sprite 0 for an active object in your game it will sometimes jump to some erratic locations. My workaround was to turn on the mouse, and use empty sprite for Sprite 0 and just use it to read the movements and then display Sprite 1 accordingly but still have control over the actual coordinates.
  16. I am using default palette and 256 color mode for tiles. It is a luxury but since I only use 10 different tiles the whole TILESHEET.BIN is only 10*16*16+2 = 2,562 bytes so not a problem to fit into VRAM.
  17. I just posted full tutorial around above code here: https://www.8bitcoding.com/p/sprites-in-assembly-i-setup.html Haha yes. It looks like he will renew support from you yes, like Matt said. Most of us learned assembly the hard way in the pre-internet days. I also spent most of my career in software development and used too many languages and platforms to list. Now I am in sales for large software services company and still like to code for fun.
  18. Hi Hugo, I wrote a pretty detailed description of how CX16 graphics work and how to use from BASIC: Vera Basics: https://www.8bitcoding.com/p/vera-overview.html How to display Sprite: https://www.8bitcoding.com/p/sprites-in-basic.html Below is source code of exactly the same program as is described in above tutorial just written in Assembly. ; Assembly Demo of Sprite ; System: Commander X16 ; Version: Emulator R.38+ ; Author: Dusan Strakl ; Date: December 2020 ; Compiler: CC65 ; Build using: cl65 -t cx16 Sprite1.asm -o SPRITE1.PRG .org $080D .segment "STARTUP" .segment "INIT" .segment "ONCE" .segment "CODE" ; I/O Registers VERA_LOW = $9F20 VERA_MID = $9F21 VERA_HIGH = $9F22 VERA_DATA0 = $9F23 VERA_CTRL = $9F25 ;****************************************************************************** main: ; Define Sprite stz VERA_CTRL lda #$10 sta VERA_HIGH lda #$40 sta VERA_MID stz VERA_LOW ldy #0 : lda data,Y sta VERA_DATA0 iny bne :- ; Initiate Sprite lda $9F29 ora #%01000000 sta $9F29 lda #$11 sta VERA_HIGH lda #$FC sta VERA_MID stz VERA_LOW stz VERA_DATA0 lda #$82 sta VERA_DATA0 stz VERA_DATA0 stz VERA_DATA0 stz VERA_DATA0 stz VERA_DATA0 lda #%00001100 sta VERA_DATA0 lda #%01010000 sta VERA_DATA0 rts data: .byte 16,16,16,16,16,16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 .byte 16,38,38,38,38,38,16, 0, 0, 0, 0, 0, 0, 0, 0, 0 .byte 16,50,50,50,50,38,16, 0, 0, 0, 0, 0, 0, 0, 0, 0 .byte 16,50,50,50,38,16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 .byte 16,50,50,50,50,38,16, 0, 0, 0, 0, 0, 0, 0, 0, 0 .byte 16,50,16,16,50,50,38,16, 0, 0, 0, 0, 0, 0, 0, 0 .byte 0,16,16, 0,16,50,50,38,16, 0, 0, 0, 0, 0, 0, 0 .byte 0, 0, 0, 0, 0,16,50,50,38,16, 0, 0, 0, 0, 0, 0 .byte 0, 0, 0, 0, 0, 0,16,50,50,38,16, 0, 0, 0, 0, 0 .byte 0, 0, 0, 0, 0, 0, 0,16,50,16, 0, 0, 0, 0, 0, 0 .byte 0, 0, 0, 0, 0, 0, 0, 0,16, 0, 0, 0, 0, 0, 0, 0 .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
  19. I am proud daily user of Deluxe keyboard for almost a year now and it works great. I noticed that mini keyboard has one more key the "FN" at bottom left that does not exist on Deluxe version. Any special reason/plans for that?
  20. Thanks. Well, I only built 5 levels so I had to make them hard so the game doesn't finish too fast
  21. Crazy Boulders View File Boulder Dash style game written in Commander X16 BASIC for learning purposes. Link to detailed description and access to source code on my blog: https://www.8bitcoding.com/p/crazy-boulder.html Submitter DusanStrakl Submitted 11/28/20 Category Games  
  22. Version 1.0.0

    147 downloads

    Boulder Dash style game written in Commander X16 BASIC for learning purposes. Link to detailed description and access to source code on my blog: https://www.8bitcoding.com/p/crazy-boulder.html
  23. Yes that is correct. the same happens with default palette. At startup the memory addresses from $1FA00 to $1FBFF do not contain actual color definitions, which is kind of confusing especially because older versions of Emulator/VERA did.
×
×
  • Create New...

Important Information

Please review our Terms of Use