Jump to content
IGNORED

Minikernel - Player Scores


CurtisP

Recommended Posts

As a minikernel? Definitely feasible, though I would make it a separate code base than this minikernel. I'll give it a try.

 

Edit: One limitation to keep in mind is that you will need to have your own functions for changing the value of the second score. You won't be able to do e.g. score2 = score2 + 100 and have it work the way you would expect.

 

Yes, a minikernel would be awesome. I think functions for score2 could definitely work. As for color, personally I think it could just be static. My understanding from a few pages back is that a second score might cost some variables, so I'm not sure one for a second score color would be worth it.

 

Thanks for looking into it!

Link to comment
Share on other sites

 

Yes, a minikernel would be awesome. I think functions for score2 could definitely work. As for color, personally I think it could just be static. My understanding from a few pages back is that a second score might cost some variables, so I'm not sure one for a second score color would be worth it.

 

Thanks for looking into it!

 

The problem with two six digit scores is that the second score isn't tied to the score math code. So, you couldn't do things like: score2 = score2 + 16483

 

I'd still go bonkers for a second 6 digit score above the first. Especially if it used a separate score font. I'd use it for a menu bar for RPGs :)

Link to comment
Share on other sites

 

The problem with two six digit scores is that the second score isn't tied to the score math code. So, you couldn't do things like: score2 = score2 + 16483

 

I'd still go bonkers for a second 6 digit score above the first. Especially if it used a separate score font. I'd use it for a menu bar for RPGs :)

 

That's what I was trying to say. One could make custom functions to do this, or do it the kludgy way by saving the score to temp variables, putting the second score in those variables, doing the operation, then putting each back in place.

 

I just posted my first not-yet-working stab at this just in case someone else wants to try to figure out my bug.

  • Like 1
Link to comment
Share on other sites

  • 3 years later...
On 8/16/2018 at 9:34 AM, Gemintronic said:

Thank you Karl G for making this spiffy new mini kernel! Displaying extra information is always a challenge - your work makes it possible to create much more informative displays (and thus more detailed games.)

 

As a side your recent changes made it almsot fully compatible with the multi sprite kernel. The second score seems to point to, umm.. not the score font data? I wonder if that could be turned into a feature. Maybe have it point to a graphic data block different from the score font intentionally so we could display life icons and other goodies :)

 

Dunno if this is useful for this but Random Terrain has a memory map for both standard and MS kernels here: http://www.randomterrain.com/atari-2600-memories-batari-basic-commands.html#memorymaps

 

Again, thank you for taking an interest in mini kermels. I hope it's more fun than hassle!

 

post-13304-0-43763300-1534426446_thumb.png

 

Multi sprite example (edited version from original Karl G code)

KarlG_Playerscores.zip 69.94 kB · 38 downloads

 

I was playing around with this example and while I can get 2 or 4 scores to appear I couldn't get 2 separate scores to appear over a six-digit score.  I had just noticed when typing this response that it mentioned it was a multi-sprite example so I wonder if this had something to do with it, or if my project was using superchip ram, as when I also tried to use the option with pfcolors and dim the variable as mentioned it would not compile. 

 

SPACWALK_12_09_2021.bas

Link to comment
Share on other sites

After playing around with it some more, I was wondering if this is compatible with using the extra A-F digits in a font?  

When I had initially tried this out with a couple fonts the digits would come up glitchy and sometimes when I would modify the player1score the player0score would change.

 

My ultimate goal was to use the regular 6-digit score as a score but then try to use the two playerscores as a kind of item selection.  I did not know if it was possible to use 4 of the extra digits and plug them into the playerscores (using 2 digit player scores). Or if not, then one and one. 

 

I put a counter in the attached file that just cycles up the number to show what I mean.

SPACWALK_12_09_2021b.bas

Link to comment
Share on other sites

Looks like it works.  I made A-F into six sided dice.

spacedebris.bas.png

 

BONUS:  These are the dice I added onto the end (just after the number 9 data) of score_graphics.asm.  You will have to modify the score_graphics.asm further in the multi kernel framework to get all 16 characters working.

        .byte %01111110 ; DICE
        .byte %01111110 ; DICE
        .byte %01111110 ; DICE
        .byte %01100110 ; DICE
        .byte %01100110 ; DICE
        .byte %01111110 ; DICE
        .byte %01111110 ; DICE
        .byte %01111110 ; DICE

        .byte %01111110 ; DICE
        .byte %01001110 ; DICE
        .byte %01001110 ; DICE
        .byte %01111110 ; DICE
        .byte %01111110 ; DICE
        .byte %01110010 ; DICE
        .byte %01110010 ; DICE
        .byte %01111110 ; DICE

        .byte %01111110 ; DICE
        .byte %01111110 ; DICE
        .byte %01001110 ; DICE
        .byte %01111110 ; DICE
        .byte %01100110 ; DICE
        .byte %01111110 ; DICE
        .byte %01110010 ; DICE
        .byte %01111110 ; DICE

        .byte %01111110 ; DICE
        .byte %01011010 ; DICE
        .byte %01011010 ; DICE
        .byte %01111110 ; DICE
        .byte %01111110 ; DICE
        .byte %01011010 ; DICE
        .byte %01011010 ; DICE
        .byte %01111110 ; DICE

        .byte %01111110 ; DICE
        .byte %01011010 ; DICE
        .byte %01111110 ; DICE
        .byte %01100110 ; DICE
        .byte %01111110 ; DICE
        .byte %01011010 ; DICE
        .byte %01111110 ; DICE
        .byte %01111110 ; DICE

        .byte %01111110 ; DICE
        .byte %01111110 ; DICE
        .byte %01011010 ; DICE
        .byte %01111110 ; DICE
        .byte %01011010 ; DICE
        .byte %01111110 ; DICE
        .byte %01011010 ; DICE
        .byte %01111110 ; DICE

 

Link to comment
Share on other sites

5 hours ago, Gemintronic said:

Looks like it works.  I made A-F into six sided dice.

spacedebris.bas.png

 

BONUS:  These are the dice I added onto the end (just after the number 9 data) of score_graphics.asm.  You will have to modify the score_graphics.asm further in the multi kernel framework to get all 16 characters working

 

I was using Superchip RAM but not the multisprite kernel. I tried using score_graphics.asm.hex but all I seem to get are glitches. I also did notice that when I commented out that line my numbers were closer together and above the score vs what you or Karl G had posted.SPACWALK_12_10_2021_bas.thumb.png.65878e3368ddd5bef4329ee32935b951.png

Link to comment
Share on other sites

Not sure what score_graphics.asm.hex is.  It should be "score_graphics.asm" full stop.  You need to add the extra A-F digits after the number 9 data in score_graphics.asm.  Make sure that edited "score_graphics.asm" file is in your projects folder.

 

Not trying to be a dingle dork.  Just want to be extremely clear :)

  • Like 1
Link to comment
Share on other sites

17 minutes ago, Gemintronic said:

Not sure what score_graphics.asm.hex is.  It should be "score_graphics.asm" full stop.  You need to add the extra A-F digits after the number 9 data in score_graphics.asm.  Make sure that edited "score_graphics.asm" file is in your projects folder.

 

Not trying to be a dingle dork.  Just want to be extremely clear :)

When I had edited the "score_graphics.asm" using the dice example as mentioned it resulted in a black screen and tone being played.  

 

I used "score_graphics.asm.hex" and use "const font = .hex" to use the custom font. But even when I replaced "score_graphics.asm" with a custom font that I would edit the A-F it resulted in the same glitches. 

 

Part of me wonders if I am overlooking something really small and simple.

  • Sad 1
Link to comment
Share on other sites

6 minutes ago, KevKelley said:

Another quirk I had noticed when messing around with this was that trying to add or subtract to player0score didn't seem to work but if I add $10 to player1score then it would add a single digit to player0score.

Not a solution.  More of a possible experiment.  I wonder if using DEC would garner more expected results.

https://www.randomterrain.com/atari-2600-memories-batari-basic-commands.html#bcd_dec

Link to comment
Share on other sites

45 minutes ago, Gemintronic said:

Not a solution.  More of a possible experiment.  I wonder if using DEC would garner more expected results.

https://www.randomterrain.com/atari-2600-memories-batari-basic-commands.html#bcd_dec

I had already tried.  It just causes the numbers to cycle without going into the A-F.  So if I do:

if joy0fire then dec player1score=player1score+$01 

it adds up player1score ad once player1score gets to 10 it starts back over and adds 1 to player0score.  

if joy0fire then dec player1score=player1score+$10

will add 1 to player0score.

 

This isn't exactly what I was looking to accomplish but it had given me ideas but I thought it was still weird.

Edited by KevKelley
Link to comment
Share on other sites

  • 6 months later...

Just found this minikernel, it is amazing !

 

Regarding the glitch characters, did you find the solution for this? I am also getting these weird glitch characters on both player0score and player1score, but only for a single frame when I redraw the playfield. I made sure that I am not using the lifepointer, lives, lifecolor, statusbarlength variables for anything else, and I am using Superchip.

 

EDIT: I found that what causes the glitches to appear for a single frame is the fact that when I change playfields, I have to do an additional drawscreen to avoid going overcycle. If I remove the additional drawscreen, the glitch does not appear, but of course I go overcycle.

 

EDIT2: I am using vblank, so the additonal drawscreen that causes the glitch is followed by an automatic vblank call. To make sure that what my vblank routine does is not causing the problem, I added a return on the first line of vblank (so it returns immediately), but the glitch still appears.

 

 

Edited by rfunes
New information
Link to comment
Share on other sites

5 hours ago, rfunes said:

Just found this minikernel, it is amazing !

 

Regarding the glitch characters, did you find the solution for this? I am also getting these weird glitch characters on both player0score and player1score, but only for a single frame when I redraw the playfield. I made sure that I am not using the lifepointer, lives, lifecolor, statusbarlength variables for anything else, and I am using Superchip.

 

EDIT: I found that what causes the glitches to appear for a single frame is the fact that when I change playfields, I have to do an additional drawscreen to avoid going overcycle. If I remove the additional drawscreen, the glitch does not appear, but of course I go overcycle.

 

 

I guess I had missed or forgotten that there was a remaining issue with this minikernel. With an example that shows the issue, I can take a look at it sometime in the next few days and see if I can figure out what is going on.

  • Like 2
Link to comment
Share on other sites

Thanks Karl! I think I identified what causes the glitch characters to appear, even though I am not sure "why" it is happening.

 

My program uses 32k with Superchip, so I have 8 banks, and the main loop with the main "drawscreen" is on bank 8, together with the include for playerscores.asm.

The vblank of course also is on bank 8.

 

I have another "drawscreen" in a different bank. It is part of a subroutine I execute when I change playfields, so this is why I only see the glitches when I switch playfields.

 

I identified that the additional "drawscreen" was not the cause of the glitch, though. It was the vblank code (that is called automatically by drawscreen) that caused the playerscores minikernel to display glitched characters.

 

My vblank code uses several temp variables, changes player positions, does a bunch of pfread, and so on.

 

I added a flag on the first line of the vblank code, to allow it to execute only for the main "drawscreen" that is called by bank 8. For all other drawscreens, the vblank will immediately return. This made almost all glitch characters disappear, but I still had a glitch character appearing on the last character of the second score.

 

The solution was to change the variable the playerscores.asm file uses, from:

temp1digit2 = stack1

to

temp1digit2 = var42

 

I had to try several variables until I found one that worked. It seems that the playerscores.asm file wants two consecutive variables as it does a "stx temp1digit2+1", so this actually used "var42" and "var43", both which are free.

 

I did create a small test program using bankswitching, but I was not able to reproduce the glitch on the test program. It seems that it only happens for very complex programs that are using all variables and using a lot of stack and other stuff. If I discover a way to reproduce it with a small test program, I will share.

 

Edited by rfunes
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...