Gorf Posted May 20, 2007 Share Posted May 20, 2007 I want to use the score as a sort of debug print, Im trying to print up the x y values of some sprites to see where they are. I want to use the 3 top digits for x and the lower 3 for y. Is there any way to do this with out to much crazy BCD stuff? Scadoobie Floinkenburger indeed! Quote Link to comment Share on other sites More sharing options...
Glenn Jupp Posted May 20, 2007 Share Posted May 20, 2007 Is there any way to do this with out to much crazy BCD stuff? Sure. When your program starts, set the score so it matches your sprite position (eg, playerx=40, playery=30, score=040030). From then on, when you change the sprite position, change the score at the same time (eg, playerx=playerx+2, score=score+2000. playery=playery-1, score=score-1). Just let bBasic do all that crazy BCD for you. Quote Link to comment Share on other sites More sharing options...
jbs30000 Posted May 21, 2007 Share Posted May 21, 2007 (edited) I want to use the score as a sort of debug print, Im trying to print up the x y valuesof some sprites to see where they are. I want to use the 3 top digits for x and the lower 3 for y. Is there any way to do this with out to much crazy BCD stuff? Scadoobie Floinkenburger indeed! I do this all the time. A slightly different way I do it than what Glenn Jupp said is to first set the score to where the sprite is, so if you have player0x = 80 and player0y = 10 then set score for 80010 then, when you move your sprite to the left 1 unit (player0x = player0x - 1) then go score = score - 1000 from score, or if you go right then score = score + 1000. If you go up then of course it's score = score - 1 or score = score + 1 for moving up. Oops, I'm editing this post to say that after looking at Glenn's post, I guess I just repeated what he said. My mistake. Edited May 21, 2007 by jbs30000 Quote Link to comment Share on other sites More sharing options...
Gorf Posted May 21, 2007 Author Share Posted May 21, 2007 Ah! Excellent, the both of you!!! Thanks Quote Link to comment Share on other sites More sharing options...
Glenn Jupp Posted May 21, 2007 Share Posted May 21, 2007 Now that I've thought a little more on it, another way to go would be to use a SCORE.ASM routine that's modified to display the full hexidecimal set (0-9,A-F) and then work with the three bytes of the score (sc1, sc2, sc3). Could show a whole 'nother byte that way. But then you have to do that crazy BCD (my new favourite phrase) in your head. Quote Link to comment Share on other sites More sharing options...
Gorf Posted May 21, 2007 Author Share Posted May 21, 2007 Now that I've thought a little more on it, another way to go would be to use a SCORE.ASM routine that's modified to display the full hexidecimal set (0-9,A-F) and then work with the three bytes of the score (sc1, sc2, sc3). Could show a whole 'nother byte that way. But then you have to do that crazy BCD (my new favourite phrase) in your head. Nah, the method you already explained will do just nicely as most of the positions I want to know are in the middle of the screen any way. Agian, thanks. Quote Link to comment Share on other sites More sharing options...
CurtisP Posted May 22, 2007 Share Posted May 22, 2007 But then you have to do that crazy BCD (my new favourite phrase) in your head. Actually it's not BCD in that case (which is binary coded decimal), but hexadecimal. Anyways, in case no one has posted it, here is a hexadecimal score_graphics.asm. score_graphics_hex_asm.txt Quote Link to comment Share on other sites More sharing options...
Glenn Jupp Posted May 22, 2007 Share Posted May 22, 2007 Anyways, in case no one has posted it, here is a hexadecimal score_graphics.asm. Thanks fer posting that. I know there was talk of such a thing, but I didn't recall if it had actually been done/posted. And yah, it is hex, but I meant to say that you'll have to convert from hex to decimal in head. Of course, proper programmers should naturally think in hex instead of decimal (and real programmers should think exclusively in binary). Or something like that... Quote Link to comment Share on other sites More sharing options...
+atari2600land Posted May 22, 2007 Share Posted May 22, 2007 Or, if you set the A in the score to a blank, and most y positions never get greater than 100, you could have x=100 and y=80 and have the score read 100_80. Just a suggestion. Quote Link to comment Share on other sites More sharing options...
Gorf Posted May 27, 2007 Author Share Posted May 27, 2007 But then you have to do that crazy BCD (my new favourite phrase) in your head. Actually it's not BCD in that case (which is binary coded decimal), but hexadecimal. Anyways, in case no one has posted it, here is a hexadecimal score_graphics.asm. Thanks for posting the source...it is being put to good use. Steve Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.