Source for an old Centipede game I wrote in '82

Got a programming project in mind? Tell everyone about it!
User avatar
tricky
Posts: 1823
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Source for an old Centipede game I wrote in '82

Postby tricky » Wed Feb 22, 2017 9:25 pm

Here is the source and .ssd for a centipede game that I think I wrote in 1982.
Its mostly there, but you have to CALL &E02 when you die to start again!
It is assembler in two basic programs:
PAGE is set to &3000 so that the code can be assembled below and then the BASIC program wiped when the game switches to MODE 2 :D
MPEDE sets up the sprites and a couple of envelopes before CHAINing MPED1.
MPED1 is the game code and the only bit of code I remember from BITD:

Code: Select all

 5300CMP#&F0:BEQlp
 5310CMP#&F3:BEQrp
 5320CMP#&C0:BEQmp
 5330CMP#&E0:BEQlp
 5340CMP#&D1:BNEnotM
This is where it checks the byte on screen and each one of these is a different state of destruction for the mushroom, maybe the last one is the centipede, I haven't checked, but it really simplifies collision detection!
Image
Feel free to do whatever you like with the code, finish the game or poke fun at my spelling :lol:
The mushrooms shouldn't overlap, keys are Z, X, /, : and SPACE to fire.
I don't think to creatures are allowed on screen at the same time in the arcade version, but here you can have three!

OOPS, forgot the ZIP
Attachments
MPede.zip
(16.54 KiB) Downloaded 28 times
MPEDE.png
(2.29 KiB) Not downloaded yet

Michael Brown
Posts: 1860
Joined: Sat Apr 03, 2010 12:54 pm
Location: Nottingham

Re: Source for an old Centipede game I wrote in '82

Postby Michael Brown » Fri Jul 21, 2017 12:47 pm

Hi Tricky

Dave M asked me if I could take a look at Centipede and make it into a finished game.

Here is a list of what I have managed to do.

1) Ran the code and saved it to tape, then loaded it and saved it to disc and added a machine code downloading routine.
2) Added some BASIC at &2000 which breaks into the game and allows things like 3 lives instead of 1 and displays the score and lives left along with "GAME OVER" and other messages,
3) Added some machine code at &D80 to blank out the screen when killed in order to remove any debris left such as spiders and worms that could interfere with the gameplay.
4) Lastly, added a loader program with some instructions. This also contains the Envelopes and some other data that is stored at &A00 to make the sound work.

Hopefully this is OK.
regards,
Mick

The disc below contains the original MPEDE files untouched and my new CPEDE ones.

MPEDE.zip
(12.1 KiB) Downloaded 12 times

User avatar
oss003
Posts: 2516
Joined: Tue Jul 14, 2009 11:57 am
Location: Netherlands
Contact:

Re: Source for an old Centipede game I wrote in '82

Postby oss003 » Fri Jul 21, 2017 2:02 pm

Nice work Tricky and Mick ....... =D>
Great game.

PS If you set the model to BBC Master 128 in B-em, it hangs .......

Greetings
Kees

User avatar
Arcadian
Posts: 2733
Joined: Fri Nov 24, 2000 12:16 pm
Contact:

Re: Source for an old Centipede game I wrote in '82

Postby Arcadian » Fri Jul 21, 2017 3:00 pm

Wow, thanks Mick - great work - this is now my favourite Centipede clone for the Beeb!

Does anybody else struggle a bit with Space for fire? I think RETURN may be better.

Also, I'd love to put this out for events, but find joystick controlled games work best, especially for kids - how easy would it be to slot a joystick routine in there too? (usual press space/fire to start deal).

I think the only thing missing from the game is perhaps a sound (0?) effect for life lost?
For a "Complete BBC Games Archive" visit www.bbcmicro.co.uk

Image
ABug Leicestershire (17-19 November 2017)

User avatar
Rich Talbot-Watkins
Posts: 1090
Joined: Thu Jan 13, 2005 5:20 pm
Location: Palma, Mallorca

Re: Source for an old Centipede game I wrote in '82

Postby Rich Talbot-Watkins » Fri Jul 21, 2017 4:46 pm

oss003 wrote:Nice work Tricky and Mick ....... =D>
Great game.

PS If you set the model to BBC Master 128 in B-em, it hangs .......

Greetings
Kees

Yeah very nice! I like the animation of the worm thing.

The hanging on the Master is to do with executing * commands in the BASIC program at the core when page &D is overwritten. (Specifically, this is because the tape filing system lives in ROM 15 instead of in the OS, and so needs the extended vectors to be valid).

The solution in this case is simple: just replace the *FX commands with a call to OSBYTE, e.g.

Code: Select all

40A%=200:X%=3:CALL&FFF4

Michael Brown
Posts: 1860
Joined: Sat Apr 03, 2010 12:54 pm
Location: Nottingham

Re: Source for an old Centipede game I wrote in '82

Postby Michael Brown » Fri Jul 21, 2017 5:32 pm

Hi Rich,
thanks for the info.
I have now changed the *FX200,3 to A%=200:X%=3:CALL&FFF4

Mick.

MPEDE.zip
(12.11 KiB) Downloaded 11 times

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

Re: Source for an old Centipede game I wrote in '82

Postby tricky » Sat Jul 22, 2017 8:48 am

Thanks Michael, good job, you should definitely put you self on the splash screen, something like:

Half finished demo by Richard "Tricky" Broadhurst,
Fully playable game by Michael Brown.

I think I left the fire button on space because I play it with the fire held down and it was easier to hold down with a thumb.

The two things that could probably do with fixing are:
Only place mushrooms on a mushroom sized grid, so that they don't overlap and become impervious to your shots. This is because IIRC I use the bottom byte of the mushroom on screen to tell what stage of destruction they are in.
The spider is invulnerable, probably because I think i detect everything by checking a couple of bytes in the bullet to see what if anything is there and never added the code to check the spider bytes.

A friend from Torquay Tech also made a version, which he may have called millipede, it was very slick (he had ADE and twin disc drives, which I think he bought when my father took us to an Acorn show in London from Devon where we lived at the time). His game had demo style wavy "GAME OVER" text and was much nicer than mine, I wish I new what happened to it and him.

User avatar
oss003
Posts: 2516
Joined: Tue Jul 14, 2009 11:57 am
Location: Netherlands
Contact:

Re: Source for an old Centipede game I wrote in '82

Postby oss003 » Sat Jul 22, 2017 9:21 am

There was also a *FX15,0 in CPEDE2 which caused an error in BBC Master 128 mode at Game Over.
I changed it in CPEDE2 to %A=15:%X=3:CALL&FFF4 and now it's working.

Greetings
Kees
Attachments
MPEDE.zip
(12.12 KiB) Downloaded 9 times

Michael Brown
Posts: 1860
Joined: Sat Apr 03, 2010 12:54 pm
Location: Nottingham

Re: Source for an old Centipede game I wrote in '82

Postby Michael Brown » Sun Jul 23, 2017 8:20 am

Hi Kees,

Thanks for spotting the other *FX.

BTW If you want to change the Fire key from SPACE to RETURN then you can either change line 4960 to LDX#&B6 in the MPED1 file or *LOAD CPEDE2 and ?&272F=&B6

regards,
Mick.

Michael Brown
Posts: 1860
Joined: Sat Apr 03, 2010 12:54 pm
Location: Nottingham

Re: Source for an old Centipede game I wrote in '82

Postby Michael Brown » Sun Jul 23, 2017 1:03 pm

OK,

Taken another look at Centipede today.
Added some machine code to file MPED1 and saved it as MP1 so you can see the difference.
Added a routine at lines 4981 to 4985 to check if RETURN has also been pressed (and if so then to Fire) as well as pressing SPACE.
Line 4970 changed to jump to new routine.

Had to re-save the source code to tape and re-load it as adding additional code changes the locations of the code.

Played it a few times and all seems OK.

If anyone can let me know what they think.

Mick.

MPEDE.zip
(12.41 KiB) Downloaded 6 times
Last edited by Michael Brown on Mon Jul 24, 2017 12:56 pm, edited 1 time in total.

User avatar
oss003
Posts: 2516
Joined: Tue Jul 14, 2009 11:57 am
Location: Netherlands
Contact:

Re: Source for an old Centipede game I wrote in '82

Postby oss003 » Sun Jul 23, 2017 5:44 pm

Looking good and plays ok .....
Nice job =D>

Greetings
Kees

Michael Brown
Posts: 1860
Joined: Sat Apr 03, 2010 12:54 pm
Location: Nottingham

Re: Source for an old Centipede game I wrote in '82

Postby Michael Brown » Thu Jul 27, 2017 10:43 am

Taken another look at Centipede today.

Added some borrowed sound envelopes from another Centipede clone and added a routine in my basic code to create a dying sound when you get caught.

Hopefully, this will be OK.

regards,
Mick.

MPEDE.zip
(14.25 KiB) Downloaded 17 times

User avatar
Arcadian
Posts: 2733
Joined: Fri Nov 24, 2000 12:16 pm
Contact:

Re: Source for an old Centipede game I wrote in '82

Postby Arcadian » Thu Jul 27, 2017 10:22 pm

Wow, this is fabulous now Mick, thanks! I love the game over sound effect!

How does it look in terms of adding the missing collision detection in for when a bullet hits the spider (presumably a high score bonus would need to be added too?). Or is it too tricky (no pun intended).

And do you think there might be room to squeeze a joystick routine in there? What about a high score table (though I'm probably getting a bit carried away/greedy with the requests now, ha! What you've done already in terms of finishing off Richard's old project is marvellous enough as it is!!)
For a "Complete BBC Games Archive" visit www.bbcmicro.co.uk

Image
ABug Leicestershire (17-19 November 2017)

Michael Brown
Posts: 1860
Joined: Sat Apr 03, 2010 12:54 pm
Location: Nottingham

Re: Source for an old Centipede game I wrote in '82

Postby Michael Brown » Fri Jul 28, 2017 9:36 am

Glad you like it.

This is about as far as I can go with this game.
Did try adding a Pause routine but the drawing of some of the characters got corrupted whilst paused.
Also tried adding a sound on off routine with S and Q but the sound didn't like coming back on - so scrapped it.

As for adding joysticks and hi-scores or sorting the spider - these would prove difficult for me. Not sure if Tricky wants to sort the spider routine, but as it is - the invulnerable spider adds a bit more scare to the gameplay.

If Tricky is OK with the lastest version, then I will include it on my new Disc115 coming next month.

regards,
Mick.

User avatar
Arcadian
Posts: 2733
Joined: Fri Nov 24, 2000 12:16 pm
Contact:

Re: Source for an old Centipede game I wrote in '82

Postby Arcadian » Sat Jul 29, 2017 6:38 am

Think I've found a couple of bugs ...

Firstly, when you lose a life, the game seems to put you back to the first level?

And secondly, it would appear that on every fourth ("purple") screen from Level 5 upwards, an additional imprint of the player's yellow blaster is displayed. So on level 5, one extra blaster appears - on level 9, two extra blasters appear - and presumably a third would appear on level 13.

It's treated as an actual game object which the player has to manoeuvre around (though the centipede is able to move on top of it).

I think the static/duplicate blaster will be positioned wherever the player leaves it at the end of the previous level ...

I've attached screenshots and some B-Em save states...

cpede5.png
Level 5

cpede9.png
Level 9
Attachments
cpede_snp.zip
(326.03 KiB) Downloaded 9 times
For a "Complete BBC Games Archive" visit www.bbcmicro.co.uk

Image
ABug Leicestershire (17-19 November 2017)

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

Re: Source for an old Centipede game I wrote in '82

Postby tricky » Sat Jul 29, 2017 7:01 am

Mick, please feel free to add it to one of your collections and thanks again for taking an abandoned one level one life demo and making it into a game.

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

Re: Source for an old Centipede game I wrote in '82

Postby tricky » Sat Jul 29, 2017 6:45 pm

I had a go at adding joystick support, but I'm not good with the OS and have run out of time!
I added this code to read the joystick, the idea is to ignore the joystick until fire is pressed.

Code: Select all

 4423LDA #128:LDX #0:LDY #0:JSR osby:TXA:AND #1
 4424STA j_f:ORA jok:STA jok:BEQ no_joy
 4425LDX #1:JSR read_joy:STA j_l:STX j_r
 4426LDX #2:JSR read_joy:STA j_u:STX j_d:.no_joy

Code: Select all

 5982.joy_right:EQUB &80:.joy_left EQUB 0:EQUB 0:EQUB 0:EQUB &80
 5983.read_joy
 5984LDA #128:LDY #0:JSR osby:TYA
 5985ROL A:ROL A:ROL A:AND #3:TAY
 5986LDA joy_right,Y:TAX:LDA joy_left,Y:RTS
 5987.jok:EQUB 0:.j_u:EQUB 0:.j_d:EQUB 0:.j_l:EQUB 0:.j_r:EQUB 0:.j_f:EQUB 0
Then I added an ORA to the result of each of the keys being read so that either should work!

Code: Select all

 4430LDX#&9E:JSRKc :ORA j_l

I had to remove the comments to make room for the extra code, but it doesn't work!

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

Re: Source for an old Centipede game I wrote in '82

Postby tricky » Sun Jul 30, 2017 1:07 pm

Fixed it, I have been spoilt by RichTW's great beebasm, BASIC doesn't support (but also doesn't error with)

Code: Select all

 5982.joy_right:EQUB &80:.joy_left EQUB 0,0,0,&80
, so I had to change it to

Code: Select all

 5982.joy_right:EQUB &80:.joy_left EQUB 0:EQUB 0:EQUB 0:EQUB &80
and I had joystick up and down reversed, so swapped

Code: Select all

 4426LDX #2:JSR read_joy:STA j_d:STX j_u:.no_joy
for

Code: Select all

 4426LDX #2:JSR read_joy:STA j_u:STX j_d:.no_joy
Thanks to Tom for beebem's debugger.
Changes made in place above.

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

Re: Source for an old Centipede game I wrote in '82

Postby tricky » Sun Jul 30, 2017 1:30 pm

PS, It is also worth adding a *FX16,2 to only ADC the first two channels to make them update at 50hz, instead of 25. If I could find a *FX to set 8bit precision, that would be better still!

Michael Brown
Posts: 1860
Joined: Sat Apr 03, 2010 12:54 pm
Location: Nottingham

Re: Source for an old Centipede game I wrote in '82

Postby Michael Brown » Thu Aug 17, 2017 8:00 am

Hi Tricky

How is it coming?

regards,
Mick.

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

Re: Source for an old Centipede game I wrote in '82

Postby tricky » Thu Aug 17, 2017 12:28 pm

The code above works, but I wasn't sure how to wrap it up with your wrapper, sorry for the confusion.

Michael Brown
Posts: 1860
Joined: Sat Apr 03, 2010 12:54 pm
Location: Nottingham

Re: Source for an old Centipede game I wrote in '82

Postby Michael Brown » Thu Aug 17, 2017 2:47 pm

Hi Tricky

Also what about the 2 bugs Arcadian found?

Mick.

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

Re: Source for an old Centipede game I wrote in '82

Postby tricky » Thu Aug 17, 2017 3:14 pm

The demo is only one life, the multiple lives are a great hack by Mick, so starting again makes sense.

I had also assumed that the extra ships were not in the original code, after re-reading Arcadian's post, I see I was seeing to dismiss them.

I'm trying to sort out Warlords on the master when it works on the emulators, but not on a master without having a master for the show in Manchester. Once I've sorted that or run out of show, I'll have a look at the other two issues.

Sorry.

Michael Brown
Posts: 1860
Joined: Sat Apr 03, 2010 12:54 pm
Location: Nottingham

Re: Source for an old Centipede game I wrote in '82

Postby Michael Brown » Thu Aug 17, 2017 4:09 pm

Fantastic!

Look forward to it!

Mick.

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

Re: Source for an old Centipede game I wrote in '82

Postby tricky » Sat Aug 26, 2017 7:36 am

Sorry for the delay, I haven't forgotten about this, I'm working on removing the flicker.

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

Re: Source for an old Centipede game I wrote in '82

Postby tricky » Wed Aug 30, 2017 6:56 pm

I made some time over the weekend and knocked up a test harness to try out some new sprite code (code I should have written for Phoenix).
It is far less efficient than the code in Frogger or Phoenix, but should be fine for Centipede.

I was planning on doing a Centipede emulator as the hardware is nearly identical to Warlords, except that all the Centipede sprites are 16x8, so I would need to draw twice as much!

The demo attached has 20 heads, where the actual game only has 12, so should be fine for the other moving objects.
The segments would not normally cross, but to spread out the test, I am starting them all in the same direction, but on consecutive rows.

Image

Spot any flicker?
I hope not :lol:
Attachments
anim_test.zip
(3.42 KiB) Downloaded 7 times
anim_test.png
(2.2 KiB) Not downloaded yet


Return to “projects”

Who is online

Users browsing this forum: No registered users and 2 guests