Jump to content

DusanStrakl

Members
  • Posts

    100
  • Joined

  • Last visited

  • Days Won

    6

Posts 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

    • Like 3
  2. 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 

    oOYtAniyluEqKGq-Z6IYr3fc-bdW01qqw_VQP5u2vEZwL5BAUQXWmErnzjQUA0NW-o_IGt__c0SKe5TdkFb3aKSxoq4f4ipjOhM0SlbxoguY2umKOZrNj9nuGBxu6AjmUqtQ4UXG    oPDpxW_K66EjJ-C2B-zzYq7zwd0QonPGrQ44qHIL-tG8WF9mbg1bbJoKohFpHBE86BU122Kr98VU173cwR8lFc26_c-T2KCygEGGhwdU6wy3jdtZZwP3ZWm7xPKn_Bm4weclLt8b    rmmo1izUqdbxJi4uddUn9u9kDt53ndQCKQmmd1HTplwYbOplfZZXtoRPn7dbS8Rh3KLl49G-bW-z_CpXkwrEIbJWVoWmhz6Cy7txanEwyOHNNyHo85r8UShz9scxuSWOv1TwcSal

    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

    GAraTm_TwejiKNrGmFvu_YDAEbUl2eAsCtjMVs1bvjx1gCGz8dmYGIRGltMGJZey0BbpcdEBOAfvrf2lzdDXN1l_1PzmPOwZax5WOZHSfWZu6sJXJNLYqlND9OOiCc8MuXSFytQlVERA 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

    gILKFp0pW36o62XxJfc8dS7z_-hQ82YVr-MBawFC6cq6JZh-OPMOV-UQad42YaD6v6AQUOxUYXTxvhIsdsQP52R5J4eX_9pad9zjFlygc6LR3qv9gi9jPyngWgAtPNND1L4atY_M    oh6ewn4R1cxTisraVGcGCS-sas2uKU4D-7P8nb2v8kFdOpva623LucBFEpvohrMoCll34E6Il6iIVDZ9tY05eghEPftp42gMZT2mY1UYeZzkqvZ0oqMC7AJRk2P3fnAuaSBcThHc    JPM61wsvucbiBTCxoia-BsN_xZM6liVXAwGAlo3kFiD_N3ZwM8PmcpikKAeYQaBdNd19sC_mKeUVk_wUp4cEM_nRzSM31QON8NGgMy3g1fhIQWFr4MoCAA6P-PEDj_0OxKEcrLMb

    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

    GAraTm_TwejiKNrGmFvu_YDAEbUl2eAsCtjMVs1bvjx1gCGz8dmYGIRGltMGJZey0BbpcdEBOAfvrf2lzdDXN1l_1PzmPOwZax5WOZHSfWZu6sJXJNLYqlND9OOiCc8MuXSFytQlVERA Overview

    GAraTm_TwejiKNrGmFvu_YDAEbUl2eAsCtjMVs1bvjx1gCGz8dmYGIRGltMGJZey0BbpcdEBOAfvrf2lzdDXN1l_1PzmPOwZax5WOZHSfWZu6sJXJNLYqlND9OOiCc8MuXSFytQlTiles in Basic I - Video Modes 0 and 1 

    GAraTm_TwejiKNrGmFvu_YDAEbUl2eAsCtjMVs1bvjx1gCGz8dmYGIRGltMGJZey0BbpcdEBOAfvrf2lzdDXN1l_1PzmPOwZax5WOZHSfWZu6sJXJNLYqlND9OOiCc8MuXSFytQlColors 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

    ud1ty1ycxpxLmtpop5k-PlIOuJRyyH2BE_4VvokAB2s0n4uH61G8wDI2H_eZ0pnl81-bwNyWOjjFIA8MloXGeeWRQ3hMlBh4pRDYrrH8ifftexgKlC2rpXeV_qMJ9RE2ki3q5O4Z    6GQwHXMtGLMWqh0An2Zute9l5PwpGFLnkgQBtxrJ3af8zhRMe9KxXkqGk2AeA_nftq_j2r_YfnHRQ5kWuW_3nKu79kcrARw8wulBFEfbTxIiwCsPZUfBfJ4qsIq5K2ddPV5sBeeZ    FkDDhFMClZ1kMNdJPGkxaHXGdLvjcLCf08RlEBFFUmbHxJs5wemfDspInr4JIp6OPuNHfH8GNfAWEpIxV_l-3oZnwFLaa6xqAWaQ2J93yq__LbfF-HlQ-4fMFW7KJpYTER_5H2mP    

    GOvuu-XJH7UNuQAPFrxNUTkttcAzPnOhTDs4pkE7UpESP4ZhC7P7PK-lfFe_G4ko0mMTZf0YLPjM9TJtw_5SWTj6Vq8RjFS89q5Ei7XzSkx9DWMUzqfKbOBaurK8UxBnT1olfCZo    VoIhp1ZuOsTd-F6FxU-wrDPpbd4dI82dRHZNm764comUrPT4NivAZXdF9w6V6xLps93HX2cPKsqNZZCmwDiHE-ZhpHRXRVjPntjZgKHOASaq7gk0wBZFblZYrPQku3tKnTrO9COy    KagZ6agOfbYQP7Z49lWK8GZ3IzkErgs_K_fRzu9_VJUAdQJzbEcGKWOQO-mK6S-3m3QRFJvunSKxaDyVAnAoqEC6XLiH8cOiudXeDBQ02wF9W0k8EsR2PHU8p9-esOj0hRmK45E-

    3IgVaRRFp5Zfg9c0PHaxWDC4iszptrLPuVmLHO3hhbqG7m6005uhPTka4ck69xJrokufbiJRZLUbv9cQdsqr7Qx5N6OG_7ePZSYCNm5dyARLRYLuHroWAWwkY8X362oII_jrJpdj

     

    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

     

    GAraTm_TwejiKNrGmFvu_YDAEbUl2eAsCtjMVs1bvjx1gCGz8dmYGIRGltMGJZey0BbpcdEBOAfvrf2lzdDXN1l_1PzmPOwZax5WOZHSfWZu6sJXJNLYqlND9OOiCc8MuXSFytQlVERA Overview

    GAraTm_TwejiKNrGmFvu_YDAEbUl2eAsCtjMVs1bvjx1gCGz8dmYGIRGltMGJZey0BbpcdEBOAfvrf2lzdDXN1l_1PzmPOwZax5WOZHSfWZu6sJXJNLYqlND9OOiCc8MuXSFytQlTiles in Basic I - Video Modes 0 and 1 

    GAraTm_TwejiKNrGmFvu_YDAEbUl2eAsCtjMVs1bvjx1gCGz8dmYGIRGltMGJZey0BbpcdEBOAfvrf2lzdDXN1l_1PzmPOwZax5WOZHSfWZu6sJXJNLYqlND9OOiCc8MuXSFytQlSprites in Basic I - Setup

    GAraTm_TwejiKNrGmFvu_YDAEbUl2eAsCtjMVs1bvjx1gCGz8dmYGIRGltMGJZey0BbpcdEBOAfvrf2lzdDXN1l_1PzmPOwZax5WOZHSfWZu6sJXJNLYqlND9OOiCc8MuXSFytQlSprites in Basic II - Animation

    GAraTm_TwejiKNrGmFvu_YDAEbUl2eAsCtjMVs1bvjx1gCGz8dmYGIRGltMGJZey0BbpcdEBOAfvrf2lzdDXN1l_1PzmPOwZax5WOZHSfWZu6sJXJNLYqlND9OOiCc8MuXSFytQlScrolling and Layers in BASIC

    GAraTm_TwejiKNrGmFvu_YDAEbUl2eAsCtjMVs1bvjx1gCGz8dmYGIRGltMGJZey0BbpcdEBOAfvrf2lzdDXN1l_1PzmPOwZax5WOZHSfWZu6sJXJNLYqlND9OOiCc8MuXSFytQlColors and Palettes

    GAraTm_TwejiKNrGmFvu_YDAEbUl2eAsCtjMVs1bvjx1gCGz8dmYGIRGltMGJZey0BbpcdEBOAfvrf2lzdDXN1l_1PzmPOwZax5WOZHSfWZu6sJXJNLYqlND9OOiCc8MuXSFytQlSimplest Sound Effects Library for BASIC

    GAraTm_TwejiKNrGmFvu_YDAEbUl2eAsCtjMVs1bvjx1gCGz8dmYGIRGltMGJZey0BbpcdEBOAfvrf2lzdDXN1l_1PzmPOwZax5WOZHSfWZu6sJXJNLYqlND9OOiCc8MuXSFytQlFont 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

     

    Lunar Lander style game

      CrazyLanderTitleSmall.png.7d2be728462ebd7e300ed1eb06ca2c9a.png  CrazyLanderLevel1Small.png.49385d203caefc7012ea0ff4e97a9cfe.png  CrazyLanderLevel2Small.png.0c592b92195e93111c8ef03a5a4dd51d.png

    CrazyLanderLevel3Small.png.cb49a388652a20cc4589fe2810716538.png CrazyLanderLevel4Small.png.c77b840142152a8bb69a8d52fdf0277d.png CrazyLanderInstructionsSmall.png.a9bbb9445ff2ea18efcf19841ca5ed43.png

     

    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. Due to pixel perfect collision detection requirement we had to use small machine code routine.
     

    Recommended reading

     

    GAraTm_TwejiKNrGmFvu_YDAEbUl2eAsCtjMVs1bvjx1gCGz8dmYGIRGltMGJZey0BbpcdEBOAfvrf2lzdDXN1l_1PzmPOwZax5WOZHSfWZu6sJXJNLYqlND9OOiCc8MuXSFytQlVERA Overview

    GAraTm_TwejiKNrGmFvu_YDAEbUl2eAsCtjMVs1bvjx1gCGz8dmYGIRGltMGJZey0BbpcdEBOAfvrf2lzdDXN1l_1PzmPOwZax5WOZHSfWZu6sJXJNLYqlND9OOiCc8MuXSFytQlTiles in Basic I - Video Modes 0 and 1 

    GAraTm_TwejiKNrGmFvu_YDAEbUl2eAsCtjMVs1bvjx1gCGz8dmYGIRGltMGJZey0BbpcdEBOAfvrf2lzdDXN1l_1PzmPOwZax5WOZHSfWZu6sJXJNLYqlND9OOiCc8MuXSFytQlSprites in Basic I - Setup

    GAraTm_TwejiKNrGmFvu_YDAEbUl2eAsCtjMVs1bvjx1gCGz8dmYGIRGltMGJZey0BbpcdEBOAfvrf2lzdDXN1l_1PzmPOwZax5WOZHSfWZu6sJXJNLYqlND9OOiCc8MuXSFytQlSprites in Basic II - Animation

    GAraTm_TwejiKNrGmFvu_YDAEbUl2eAsCtjMVs1bvjx1gCGz8dmYGIRGltMGJZey0BbpcdEBOAfvrf2lzdDXN1l_1PzmPOwZax5WOZHSfWZu6sJXJNLYqlND9OOiCc8MuXSFytQlScrolling and Layers in BASIC

    GAraTm_TwejiKNrGmFvu_YDAEbUl2eAsCtjMVs1bvjx1gCGz8dmYGIRGltMGJZey0BbpcdEBOAfvrf2lzdDXN1l_1PzmPOwZax5WOZHSfWZu6sJXJNLYqlND9OOiCc8MuXSFytQlColors and Palettes

    GAraTm_TwejiKNrGmFvu_YDAEbUl2eAsCtjMVs1bvjx1gCGz8dmYGIRGltMGJZey0BbpcdEBOAfvrf2lzdDXN1l_1PzmPOwZax5WOZHSfWZu6sJXJNLYqlND9OOiCc8MuXSFytQlMusic Player Library for BASIC Programs

    GAraTm_TwejiKNrGmFvu_YDAEbUl2eAsCtjMVs1bvjx1gCGz8dmYGIRGltMGJZey0BbpcdEBOAfvrf2lzdDXN1l_1PzmPOwZax5WOZHSfWZu6sJXJNLYqlND9OOiCc8MuXSFytQlFont 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:

    • Integration of machine code, Assembly source code is available
    • Full color mode
    • 256 Color Title screen
    • Two layer graphics
      • Bitmap background
      • Tile based HUD
    • Full color sprites
    • Advanced physics and game mechanics
    • Loading assets to memory from binary files for:
      • Tileset - fonts
      • Sprite Sheet
      • Background music
      • Title screen
         

     

     

    GOTO Crazy Lander Tutorial

    GOTO Download

     

     

     

    • Like 6
    • Thanks 8
  3. 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.

     

    • Like 1
  4. 12 hours ago, kliepatsch said:

    Ah silly me 😆

    Here's a short song made for the Music Player Library. Again simply  Ctrl+C  Ctrl+V  it into the emulator. Feel free to modify and use it everyone if you see fit.

    DANDELION.TXT 2.76 kB · 4 downloads

    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.

  5. 12 hours ago, kliepatsch said:

    I have noticed that there seems to be a bug that the end of the song data is not used during playback.

    See as an example the attached song, where I have the same four notes played twice in a row. However, only the first time, all four notes are played, whereas the second time only the first three notes are played.

    Or am I doing something wrong? (Simply Ctrl+C, Ctrl+V the source into the emulator).

    MYSONG.TXT 746 B · 4 downloads

    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.

  6. 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


     

    • Like 2
    • Thanks 2
  7. 19 hours ago, TomXP411 said:

    Are you on Windows? Here's how you do it: 

    • Open Computer Management (click start and type the name)
    • Select Disk Management on the left side
    • Pull down Action and select Create VHD
    • Enter the location and filename in the box. 
    • Select VHD (not VHDX) and Fixed Size
    • Make the file at least 40MB. 
    • This will create the VHD and attach it as a drive in the list on the bottom half of the Disk Management window.
    • Right click in the box on the left column for that new disk.
    • Select Initialize. 
    • Select MBR and click OK
    • Now right click on the RIGHT side (the 40MB Unallocated side) and select New Simple Volume
    • Use the defaults on the first page and second page of the wizard (click Next twice)
    • In the third page, select Format the volume with the following settings
      • File System: FAT32
      • Allocation unit size: Default
      • Volume label: whatever you want
      • Perform a quick format
    • Click Next

    You should now have a new drive letter. Copy files in, then eject it by right-clicking the drive letter in File Explorer and selecting Eject. (You can't mount it in the emulator until you eject it from Windows.)

     

    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.

     

    • Like 1
  8. On 1/3/2021 at 6:30 AM, SplitSpine said:

    In the tutorial you point out:

    "Please not that in the current version of emulator position 0,0 is in the top left corner of the visible screen. It means that sprite can’t be drawn left or above the visible screen to allow for gradual entry into the visibility. I am assuming this might change in the future and this text will be updated accordingly."

    I asked about this in this post https://www.commanderx16.com/forum/index.php?/topic/350-outside-objects-coming-into-view/

    So you think they are going to change that behavior?

    That was my understanding, obviously I didn't test the border values enough. I will have to go back and update my tutorial.

    On 1/3/2021 at 8:09 AM, Johan Kårlin said:

    There is actually nothing to wait for : ). Sprites can absolutely be displayed partially on the top or left edge of the screen. Positions are represented by 10 bits (= 0 - 1023) and wrap around which means that 1024 is the same as 0. Let's say you have a sprite that is 32 pixels wide. If you set the horizontal position to 1024 - 16  = 1008, the right half of it will be visible. 

    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.

  9. 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.

     

  10. 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.

    • Like 1
  11. 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.

  12. I just posted full tutorial around above code here:

    https://www.8bitcoding.com/p/sprites-in-assembly-i-setup.html

     

    10 hours ago, JimmyDansbo said:

    wow, Hugo is pretty demanding 😉

    Haha yes. It looks like he will renew support from you 🙂

     

    5 hours ago, Hugo4IT said:

    Just one last question: where did you learn all of this?

    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.

  13. 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,160000000000
            .byte 16,38,38,38,38,38,16000000000
            .byte 16,50,50,50,50,38,16000000000
            .byte 16,50,50,50,38,160000000000
            .byte 16,50,50,50,50,38,16000000000
            .byte 16,50,16,16,50,50,38,1600000000
            .byte  0,16,160,16,50,50,38,160000000
            .byte  00000,16,50,50,38,16000000
            .byte  000000,16,50,50,38,1600000
            .byte  0000000,16,50,16000000
            .byte  00000000,160000000
            .byte  0000000000000000
            .byte  0000000000000000
            .byte  0000000000000000
            .byte  0000000000000000
            .byte  0000000000000000

     

×
×
  • Create New...

Important Information

Please review our Terms of Use