High Score Challenge - S4 - Spectapede

post your own high scores or enter our challenge competitions
User avatar
richardtoohey
Posts: 3563
Joined: Thu Dec 29, 2011 5:13 am
Location: Tauranga, New Zealand
Contact:

Re: High Score Challenge - S4 - Spectapede

Post by richardtoohey » Sun Nov 23, 2014 7:05 am

steve3000 wrote:As much of the game handler is in BASIC (although heavily 'compressed' BASIC by the looks of it...), and we have over a week left - I wonder how difficult it would be to fix the "overflow at 100,000 points" bug?
Lots of machine code called. &80 and &81 hold the score, &2FC0 is the routine that increments the score (it doesn't check for 10K, though) but I haven't figured out where the lives are stored ... if I can find where that is stored, then could work backwards from that being incremented ...

User avatar
KarateEd
Posts: 3453
Joined: Fri Sep 20, 2013 9:15 pm
Location: Squamish, BC, Canada
Contact:

Re: High Score Challenge - S4 - Spectapede

Post by KarateEd » Sun Nov 23, 2014 7:07 am

Of course!.... why didn't I think of that? #-o

That would make perfect sense since you're always at the top rung of the ladder in these competitions anyway..... :^o [-X

It seems SOOOOO obvious now.... #-o #-o

Ed......:-)

User avatar
KarateEd
Posts: 3453
Joined: Fri Sep 20, 2013 9:15 pm
Location: Squamish, BC, Canada
Contact:

Re: High Score Challenge - S4 - Spectapede

Post by KarateEd » Sun Nov 23, 2014 7:16 am

High Score Tables Updated......

Ed.......:-)

User avatar
richardtoohey
Posts: 3563
Joined: Thu Dec 29, 2011 5:13 am
Location: Tauranga, New Zealand
Contact:

Re: High Score Challenge - S4 - Spectapede

Post by richardtoohey » Sun Nov 23, 2014 7:29 am

:-k Hhhhmmm, guess that is a no, then? :lol:

User avatar
KarateEd
Posts: 3453
Joined: Fri Sep 20, 2013 9:15 pm
Location: Squamish, BC, Canada
Contact:

Re: High Score Challenge - S4 - Spectapede

Post by KarateEd » Sun Nov 23, 2014 7:36 am

I'm happy to give you 3 guesses and ummm.... the first 2 don't count....at all...

Ed......:-)

User avatar
richardtoohey
Posts: 3563
Joined: Thu Dec 29, 2011 5:13 am
Location: Tauranga, New Zealand
Contact:

Re: High Score Challenge - S4 - Spectapede

Post by richardtoohey » Sun Nov 23, 2014 7:37 am

Duh ...

Code: Select all

180PM%=&DF4:Q%=&DF7:Pr%=&DFA:C=&20D8
...
840?Q%=3:Q%?1=0
...
1320?Q%=?Q%-1:IF ?Q%>0 THENPROCClrGame:GOTO960
So lives are stored in &DF7, initialised at 3, and then when you die (line 1320) it decrements the number of lives. If more lives left, you loop around again, otherwise it goes to the end-of-game code.

"Just" need to look at the m/c to see where it tinkers with &DF7 ...

EDIT: my 6502 too rusty for this (and there's maths involved!) ... so &DF7 is low byte of lives, and I think &DF8 is high. &80 and &81 are score (low, high)

Code: Select all

298a	lda &81
	lsr a
	lsr a
	lsr a
	lsr a
	sec

2990	sbc &0df8
	cmp #&00
	bne &2999
	rts

2999 	inc &df7
	inc &df8
299f	ldx &df7
	ldy #&00
	jsr &2b0c
	lda #&07
	jsr &ffee	beep cos lives changed
29ad	rts

User avatar
tricky
Posts: 2461
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: High Score Challenge - S4 - Spectapede

Post by tricky » Sun Nov 23, 2014 10:45 am

It might be easier to reduce the scores for each item, would change the balance a bit, but should be easier than changing code. I have been a bit lazy with my scores too, last digit is always 0, score is stored in BCD mode and wraps at 4 digits/2 bytes/100,000 :roll:

User avatar
KarateEd
Posts: 3453
Joined: Fri Sep 20, 2013 9:15 pm
Location: Squamish, BC, Canada
Contact:

Re: High Score Challenge - S4 - Spectapede

Post by KarateEd » Sun Nov 23, 2014 10:58 pm

Really HUGE increase in score......

Ed......:-)
Attachments
SP4.JPG

steve3000
Posts: 1838
Joined: Sun Nov 25, 2012 12:43 am
Contact:

Re: High Score Challenge - S4 - Spectapede

Post by steve3000 » Mon Nov 24, 2014 12:27 am

richardtoohey wrote:EDIT: my 6502 too rusty for this (and there's maths involved!) ... so &DF7 is low byte of lives, and I think &DF8 is high. &80 and &81 are score (low, high)
Hey well done Richard for looking into this and getting that far - I wasn't sure if my comment about fixing the game would be taken seriously... ;)

I just took a quick look and saw lots of BASIC, so had hoped it would be a relatively easy fix. Ah well... I think my 6502 is also too rusty for this :(

But I do like Tricky's idea - reducing the scoring so 100k is even harder to get to...

User avatar
KarateEd
Posts: 3453
Joined: Fri Sep 20, 2013 9:15 pm
Location: Squamish, BC, Canada
Contact:

Re: High Score Challenge - S4 - Spectapede

Post by KarateEd » Mon Nov 24, 2014 7:46 am

Just a tad better than last time....

Ed......:-)
Attachments
SP5.JPG

User avatar
KarateEd
Posts: 3453
Joined: Fri Sep 20, 2013 9:15 pm
Location: Squamish, BC, Canada
Contact:

Re: High Score Challenge - S4 - Spectapede

Post by KarateEd » Tue Nov 25, 2014 7:26 am

High Score Tables Updated......

Ed.......:-)

User avatar
fwibbler
Posts: 197
Joined: Thu Jan 13, 2005 10:37 pm
Location: Essex
Contact:

Re: High Score Challenge - S4 - Spectapede

Post by fwibbler » Tue Nov 25, 2014 6:45 pm

Its funny, I really don't recall the game being this buggy when I played it years ago.
It seems to be better on B-Em than Beebem though.
Attachments
specta2.gif

User avatar
fwibbler
Posts: 197
Joined: Thu Jan 13, 2005 10:37 pm
Location: Essex
Contact:

Re: High Score Challenge - S4 - Spectapede

Post by fwibbler » Tue Nov 25, 2014 7:15 pm

And I've finally got the hang of it again!
Attachments
specta4.gif

JoolsH
Posts: 505
Joined: Mon May 21, 2012 11:46 am
Contact:

Re: High Score Challenge - S4 - Spectapede

Post by JoolsH » Tue Nov 25, 2014 11:03 pm

Initial impressions of this game weren't that good, but once it starts going at breakneck speed it starts to get enjoyable :)

If the game breaks once you get to 100k, and we can't fix it, perhaps there's a case for capping the scores at 100k as far as the contest is concerned? If after that point it effectively becomes an infinite lives boredom tolerance test, that doesn't sound much fun...

Very nearly got to 100k.

97,780
Attachments
spectapede-97780-joolsh.png

JoolsH
Posts: 505
Joined: Mon May 21, 2012 11:46 am
Contact:

Re: High Score Challenge - S4 - Spectapede

Post by JoolsH » Tue Nov 25, 2014 11:40 pm

Alright then, let's take a look at this code.

Code: Select all

298a   lda &81
   lsr a
   lsr a
   lsr a
   lsr a
   sec

2990   sbc &0df8
   cmp #&00
   bne &2999
   rts

2999    inc &df7
   inc &df8
299f   ldx &df7
   ldy #&00
   jsr &2b0c
   lda #&07
   jsr &ffee   beep cos lives changed
29ad   rts
So, the score is stored in &80 (low byte) and &81 (high byte) as a multiple of 10, in BCD.
It looks like the game was only designed to support five-digit scores (as the game score doesn't have room for another digit).

&DF7 is the number of lives, and &DF8 is the number of extra lives the player has already been granted.

So, when we come in at &298A, we take take the high byte of the score. Shift right four bits to give tens of thousands (it's BCD, remember).

It's then compared to the amount of lives we've been given before, and if it's more, then we increment the number of lives, and the "lives given already counter".

So, what happens when we reach 100,000?

Our score rolls over to zero again, so the value of address &81 is 00. so, after shifting over four bits, that gives us 0.

Deduct 9 (the number of lives we've been given so far) from 0 and we get 91 (if we're in BCD mode here).
That's not zero, so give the player a new life.

Presumably this code is run quite often, maybe every frame, or every time the player's score is increased.
The same thing will happen every time, giving us a new life every time. This process will continue until &DF8 rolls around to zero, at which point it will be happy and stop giving the player lives. Unfortunately it will have given the player another 91 lives at that point.

So, how to we fix it?

Fix one - Change the useless "cmp &#00" line (why did they bother with that? the zero flag was correctly set before that instruction anyway!) to "cmp &#01", and then change BNE to BPL. This will change the game so it no longer gives extra lives after it has been clocked.

Fix two - Replace the useless "cmp &#00" line with "and &#0F". This will make the game continue giving extra lives correctly after being clocked.

Running through this in my head (if we do fix two) - So, when we get to 100,000, it will do 0 - 9 = 91, 1 once you've done the "and &#0f". So it'll give you the extra life.
Next time, it will give you 0 - 10 = 90, 0 once you've done the "and &#0f", so will not give you any more lives.


So... fixes are:

Fix one:

&2993 = no change (CMP)
&2994 = &01
&2995 = &10 (BPL)

Fix two:

&2993 = &29 (AND Immediate)
&2994 = &0F

That was more fun than playing the game :P

I haven't tried either of these fixes, I leave that as an exercise to the reader ;)

User avatar
fwibbler
Posts: 197
Joined: Thu Jan 13, 2005 10:37 pm
Location: Essex
Contact:

Re: High Score Challenge - S4 - Spectapede

Post by fwibbler » Wed Nov 26, 2014 9:26 am

Fix one sounds good to me.
If I've read your post right that means after 100000 points there we be no more extra lives?
Just need someone to upload a fixed version now :)

User avatar
KarateEd
Posts: 3453
Joined: Fri Sep 20, 2013 9:15 pm
Location: Squamish, BC, Canada
Contact:

Re: High Score Challenge - S4 - Spectapede

Post by KarateEd » Wed Nov 26, 2014 4:45 pm

High Score Tables Updated......

Ed.......:-)

MatthewThompson
Posts: 1235
Joined: Tue Apr 22, 2008 3:44 pm
Location: Oxford
Contact:

Re: High Score Challenge - S4 - Spectapede

Post by MatthewThompson » Wed Nov 26, 2014 7:01 pm

I've just managed to get 100000 points, and the game did the same on BeebIT on RISC OS too, suddenly get loads of lives out of nowhere, not sure if my oriignal score was hidden under all those lives or not.

Think I'll have to call it day with this, shame as I could of got a much bigger score than I already have.

User avatar
fwibbler
Posts: 197
Joined: Thu Jan 13, 2005 10:37 pm
Location: Essex
Contact:

Re: High Score Challenge - S4 - Spectapede

Post by fwibbler » Wed Nov 26, 2014 8:25 pm

Hehe! And you all thouht my first choice of Astro Plumber was bad! :twisted: :twisted: :twisted:

User avatar
KarateEd
Posts: 3453
Joined: Fri Sep 20, 2013 9:15 pm
Location: Squamish, BC, Canada
Contact:

Re: High Score Challenge - S4 - Spectapede

Post by KarateEd » Wed Nov 26, 2014 9:41 pm

New High Score for me.....101,350

If we don't get a fix in for the program, I'm ok with people knowing how many lives they have left just before 100k. Assume you gain no more lives, keep track of the lives you lose and stop playing at that point you lose all your lives. Take the screen shot and submit it, much like Tricky and I have done.

Matt, have another go and follow this formula until a fix is in. You should get credit for your score. The score must be taken while in play mode so eventually, about 1/2 hour the screen will clear and go back to the high score table but your new score will unlikely be shown there as there are no flags set for over 100k....so a screenprint/photo is necessary while the machine kills off your many lives.....

If we get a fix in, even better....

Ed......:-)
Attachments
SP6.JPG

User avatar
KarateEd
Posts: 3453
Joined: Fri Sep 20, 2013 9:15 pm
Location: Squamish, BC, Canada
Contact:

Re: High Score Challenge - S4 - Spectapede

Post by KarateEd » Wed Nov 26, 2014 9:59 pm

fwibbler wrote:Hehe! And you all thouht my first choice of Astro Plumber was bad! :twisted: :twisted: :twisted:
Ah but that was last season.....we've already forgotten how bad that was.....:-)

Ed......:-)

User avatar
richardtoohey
Posts: 3563
Joined: Thu Dec 29, 2011 5:13 am
Location: Tauranga, New Zealand
Contact:

Re: High Score Challenge - S4 - Spectapede

Post by richardtoohey » Thu Nov 27, 2014 8:38 am

Yes, I clocked it! <Cough>
specfix.jpg
Here is an attempted fixed version - JoolsH plan 2 (but one byte further in)

Still seems to get a bit excited with the extra lives, but not insane.

To test, load as normal, start the game, press Escape (it doesn't bother blocking that.)

Enter

Code: Select all

?&80=&99
?&81=&99
That sets your score to 99990 - so 10 more points triggers the bug (or hopefully the fix in this case.)

Then enter

Code: Select all

G.1320
to resume the game (it is the "you died" routine, so will take one life off you.)

EDIT - just to make it clear - the whole press Escape, enter commands is JUST to test the fix. If you want to play your way to 100K+, then ignore all that - use this new SSD and play like normal.

NB. inside the zip the file is Mastertronic/Spectapede.ssd so it will overwrite your existing SSD if you are not careful.

Can someone give it a whirl to make sure I've done it right? Thanks.
Attachments
SpecFix.zip
(7.7 KiB) Downloaded 40 times
Last edited by richardtoohey on Thu Nov 27, 2014 9:00 am, edited 1 time in total.

User avatar
richardtoohey
Posts: 3563
Joined: Thu Dec 29, 2011 5:13 am
Location: Tauranga, New Zealand
Contact:

Re: High Score Challenge - S4 - Spectapede

Post by richardtoohey » Thu Nov 27, 2014 8:51 am

And I suppose I'd better give the game a go ... it's not that bad a game (certainly better than what I could do!) Bit too much whizzing around for me.
spec1.jpg
I thought my code change had caused a crash (not during the above game, obviously), but it was exactly the same message reported by Col, so it must just be a bit crashy at times (well, in Beebem, anyway.)

JoolsH
Posts: 505
Joined: Mon May 21, 2012 11:46 am
Contact:

Re: High Score Challenge - S4 - Spectapede

Post by JoolsH » Thu Nov 27, 2014 11:28 am

richardtoohey wrote:JoolsH plan 2 (but one byte further in)
Oops, looks like I counted them wrong :)
Enter

Code: Select all

?&80=&99
?&81=&99
That sets your score to 99990 - so 10 more points triggers the bug (or hopefully the fix in this case.)

Then enter

Code: Select all

G.1320
to resume the game (it is the "you died" routine, so will take one life off you.)
That won't test it properly. The game keeps track of how many extra lives you've been given - so when you go back to the game at 99990 points, the game knows that you haven't been given the 9 extra lives you should have had by that point and gives them to you immediately. And another for good luck when you clock it.

You'll need to set ?&DF8=9 when you try it out as well, to reflect the number of lives you would have been given by that point.

User avatar
KarateEd
Posts: 3453
Joined: Fri Sep 20, 2013 9:15 pm
Location: Squamish, BC, Canada
Contact:

Re: High Score Challenge - S4 - Spectapede

Post by KarateEd » Thu Nov 27, 2014 1:38 pm

So, to be clear....once you achieve 100k, no more extra lives?

Btw, thanks for the fix guys.....

Ed......:-)

JoolsH
Posts: 505
Joined: Mon May 21, 2012 11:46 am
Contact:

Re: High Score Challenge - S4 - Spectapede

Post by JoolsH » Thu Nov 27, 2014 1:59 pm

KarateEd wrote:So, to be clear....once you achieve 100k, no more extra lives?
Fix one is no extra lives once you reach 100k, fix two continues giving you extra lives. I think Richard's version implemented fix two, but haven't tried it yet. Not sure which is best?

User avatar
fwibbler
Posts: 197
Joined: Thu Jan 13, 2005 10:37 pm
Location: Essex
Contact:

Re: High Score Challenge - S4 - Spectapede

Post by fwibbler » Thu Nov 27, 2014 4:22 pm

Didn't work for me I'm afraid.
Gave me another 7 lives and the score rolled back to zero. I ended the game with a hi score of 7450 instead of 107450 :oops:

JoolsH
Posts: 505
Joined: Mon May 21, 2012 11:46 am
Contact:

Re: High Score Challenge - S4 - Spectapede

Post by JoolsH » Thu Nov 27, 2014 4:54 pm

The score is going to roll back to zero whatever we do, unfortunately - the game only supports 5-digit scores.

I'll have a look later and see if I can the lives to work properly, at least...

User avatar
1024MAK
Posts: 7432
Joined: Mon Apr 18, 2011 4:46 pm
Location: Looking forward to summer in Somerset, UK...
Contact:

Re: High Score Challenge - S4 - Spectapede

Post by 1024MAK » Thu Nov 27, 2014 5:07 pm

Wild idea here, how hard would it be to convert this game so it used a hexadecimal number for the score?
Then two bytes gives a total of FFFF0 hex, 655350 dec (as the LSD is fixed at zero).

Of course how easy this is very much depends on the routine that prints the scores if there is even a separate routine.

Mark
For a "Complete BBC Games Archive" visit www.bbcmicro.co.uk NOW!
BeebWiki‬ - for answers to many questions...

JoolsH
Posts: 505
Joined: Mon May 21, 2012 11:46 am
Contact:

Re: High Score Challenge - S4 - Spectapede

Post by JoolsH » Thu Nov 27, 2014 9:14 pm

Doh. It looks like neither of my fixes worked first time :(

Fix 2 is probably broken ecause the "inc" command doesn't respect the decimal flag, and just does a binary addition. Hence, once you get past 9 lives, it cycles through A, B, C, D, E, and F before getting to zero - hence the seven extra lives.

I'm not sure why fix 1 didn't work either, but I've changed the BPL to BEQ (&F0) and it now seems to work fine. So, here's a fixed version, using the modified fix one (no extra lives above 100,000 points) - this should hopefully be fixed for real this time.

As for changing the score to use hex - might be possible, though it might mess up their score printing routine, and would affect the points at which you get the extra lives.
Attachments
Spectapede_fixed.zip
(7.76 KiB) Downloaded 48 times

Post Reply