Jump to content

DusanStrakl

Members
  • Posts

    100
  • Joined

  • Last visited

  • Days Won

    5

Posts posted by DusanStrakl

  1. Thanks for both answers. The usual suspects to the rescue 😀

     

    To be honest I didn't even know that VLOAD is implemented so I didn't even experiment with it. I saw it mentioned in documentation with TODO comment so I assumed it is not there yet. 

    LOAD does not work with loading data directly to VRAM and if there is dedicated VLOAD for that it probably shouldn't. There is no point to have two commands doing the same thing it just add unnecessary confusion.

    I think I will test VLOAD thoroughly in the next few days and probably write a short tutorial on how to use it after that.

  2. Has anybody recently (e.g. Emulator R38) tried to load binary files directly to VRAM from BASIC?

    It worked before but now it is driving me crazy and it just doesn't work. If I load the file to regular RAM it works fine with following for example:

    LOAD"TEST.BIN",8,1,$8000

    The command 

    LOAD"TEST.BIN",8,2,$8000

    should load to VRAM bank 0, and

    LOAD"TEST.BIN",8,3,$8000

    should load to VRAM bank 1

    but it always just loads to regular RAM even if I try something like

    LOAD"TEST.BIN",8,8,$8000

    it gets loaded to RAM without error.

    I tried changing first two bytes in TEST.BIN file between $00 $00 and $00 $80 and many other combinations with no luck.

    Thanks

  3. On 9/12/2020 at 7:15 AM, mobluse said:

    I tried both EFFECTS and EFFECTSHI with my program Aritm, but in both cases it deletes the screen and changes background color after the sound, and then you cannot see what you type. I use R38 of the emulator in most updated Windows 10.

    I added these lines to Aritm:

     

    Thanks for the comment Mikael. It seems that there was some interference between effects library and some VERA related actions from BASIC programs, specifically in your case, scrolling of the screen. I added some code to save and restore VERA state inside the IRQ Player. I tried both EFFECTS.PRG and EFFECTSHI.PRG with your program and it seems to work without problems now. 

  4. 3 minutes ago, Fenner Machine said:

    Thanks DusanStrakl.

    I’ve read and reread several of your tutorials.

    They are excellent.

    A few things I was not quite sure of, but with the X16 docs, answers to specific questions and your guides I think I might be able to make a game.

    Thanks. I hope you can make it. Just share your progress and there is plenty of help out there. I myself do not come over here often enough but will try to follow this forum a bit closer in the future.

  5. I have covered most of the topics you are asking about in the series of tutorials on my blog:

    https://www.8bitcoding.com/p/commander-x16.html

    I go pretty deep into explanations on how VERA works, different video modes, sprites, sprite animations, scrolling, layers and even some simple libraries to add music to your programs. Examples are written mostly in BASIC and some in Assembly but of course all the hardware related subjects are applicable to all programming languages.

    • Like 1
    • Thanks 3
  6. 16 hours ago, rje said:

    So I wrote this quick-and-dirty BASIC program just to play with the values, and it works ... as long as I don't try to change the envelope while the sound routine is actually running.  In other words, you have to wait for the decay to complete before changing a value! 

     

    TEST-SOUND.BAS 871 B · 0 downloads

    Interesting. It might be tricky to poke values directly because BASIC might be too slow and the player is called 50 times per second. Maybe try stopping the current sound by poking 0 into "running" first, change the envelope parameters and then start the sound by poking 255 into "phase". Obviously I haven't tried this...

    • Like 1
  7. 22 hours ago, BruceMcF said:

    That's really nice ... xForth uses $8000-$9BFF as seven block buffers, so the $9000 verdipon can be installed at the cost of one buffer.

    Does it preserve registers? If so:

    CODE PING $9000 CALL, ENDCODE

    ...and a PING word would be defined. Otherwise I'll have to add PHX, PHY, PLX, PLY, to my small set of code words.

    (NB. Don't look for ;CODE and friends in the uploaded version, that's in the next on coming this weekend).

     

    Very cool! No I don't preserve registers.

    • Like 1
  8. I wrote few games in BASIC and it can be done. Even with faster CPU speed you still have to design it very carefully though. Like you found out graphics is usually a bottleneck so whenever you can use hardware to help use it. So perhaps instead of continuously drawing to screen, try to load the whole map at once directly into VRAM and move around by scrolling which typically only requires couple of POKEs instead of drawing. In my experience any time you have to do X times Y loop for drawing from BASIC it is time to reconsider the design.

    If assembly is an option of course that changes everything but it is not a BASIC game anymore and that is a special kind of challenge.

    Perhaps some of the examples and resources from my blog would be helpful:

    https://www.8bitcoding.com/p/commander-x16.html

     

    • Like 2
  9. Of course Andy, that's why I posted the source code so that anybody can reuse it.

    I didn't plan to make this particular library multichannel but it should be pretty easy doable. I think your approach to simply duplicate the code four times for four channels is totally fine, the other approach would be a loop.

    I am actually working on another library that is intended to play music in the background and supports full ADSR sound modulation and would have few predefined instruments etc. It is almost working but I am currently distracted by another project but hopefully I can find few days to finish and test it.

    • Like 3
  10. Simplest Sound Effects Library for BASIC programs

    View File

    Usage

    Because of its simplicity the library can be stored in a 1K space below basic programs, starting at $0400.
    Save the EFFECTS.PRG program in the directory where your BASIC program is stored, which would typically be in the same directory from where you are running the emulator.
     
    Load library with LOAD command:
     
    LOAD”EFFECTS.PRG”,8,1,$0400
     
    Since this routine after the first run adds a new interrupt handler it is good practice to only load it once. It is therefore recommended to do a simple check:
     
    IF PEEK($400)=0 THEN LOAD”EFFECTS.PRG”,8,1,$0400
     
     
    And that is it. Now you only need to call the needed sound effect from the BASIC program with a simple SYS command. We have four different effects so four different addresses can be called:
     
    SYS $400 PING Is designed for events like picking coins or rewards.
    SYS $403 SHOOT Effect that can be used for shooting the gun or other weapon.
    SYS $406 ZAP Electricity zapping or perhaps a laser gun sound.
    SYS $409 EXPLODE Long explosion for when we successfully blow something up
     
    Alternative binary named EFFECTSHI.PRG that loads into memory at $9000 can be downloaded. Of course calls are then $9000 for PING, $9003 for SHOOT, $9006 for ZAP and $9009 for EXPLODE.
     
    Full source code and walk through is available at my blog:
     
    Demo video:
     
     
     

     

    • Like 5
    • Thanks 2
  11. Interesting project. I was actually thinking about putting it on my list of possible future projects but unfortunately that list is way too big already especially considering available free time 😞

    Considering that sending data to VERA can be a bottleneck some sort of hybrid solution of tile background with hardware scrolling and bitmap road with bending by using scan line shifting might work and leave enough CPU time for manipulating animated sprites that could be used for everything else.

    Keep us updated and good luck!

     

  12. I am trying out cc65 and it seems the documentation is quite messy. So far I have no problem building C projects, also assembly with BASIC startup starting at $801 but I have difficulties building executable from assembly to be loadable into any arbitrary memory location. I know it is lazy way out but would prefer coding to reading documentation for few hours 🙂

    Thanks,

    Dusan

  13. Thanks for the help guys. I was totally oblivious of the discussion going on here. I did notice yesterday that Try It button was not there and saw it is there now and working perfectly but had no idea what was happening in the background 🙂

    Of course I uploaded it late yesterday and today I was totally under water with work so that is my excuse.

    Next time I will make sure to upload BASIC encoded files.

    Cheers,

    Dusan

    • Like 7
×
×
  • Create New...

Important Information

Please review our Terms of Use