Viewing Issue Advanced Details
ID Category [?] Severity [?] Reproducibility Date Submitted Last Update
01326 DIP/Input Minor Have not tried Feb 19, 2008, 15:43 Feb 19, 2008, 15:43
Tester -Misc Reporters- View Status Public Platform
Assigned To stephh Resolution Bugs That Aren't Bugs OS
Status [?] Resolved Driver
Version N/A Fixed in Version Build
Fixed in Git Commit Github Pull Request #
Summary 01326: madcrash: The extra lives don't fit the "Bonus Life" Dip Switch when you set the "Occurence" Dip Switch to "1st, 2nd then every 2nd".
Description The extra lives don't fit the "Bonus Life" Dip Switch when you set the "Occurence" Dip Switch to "1st, 2nd then every 2nd".
Steps To Reproduce
Additional Information marvins.c merged into snk.c in 0.127u2

Read the text file for more info. "Basic" Z80 knowledge needed, sorry ;) - stephh

madcrash (marvins.c driver)

There is an ingame bug if you set the "Occurence" Dip Switch to "1st, 2nd then every 2nd" ...

Here are some useful addresses :

  - 0xc663-0xc666 : player score   (BCD coded, MSB first)
  - 0xc303-0xc306 : 1st bonus life (BCD coded, MSB first)
  - 0xc307-0xc30a : 2nd bonus life (BCD coded, MSB first)
  - 0xc670-0xc673 : next bonus life in case of more than 2 occurences (MSB first)


In fact, only these addresses interest us : 0xc663-0xc664, 0xc307-0xc308 and 0xc670-0xc671 ...

I assume that you've set the "Bonus Lives" Dip Switch to "20k, 60k" ...

When you start a game, here are the contents of the addresses :

  - 0xc663 = 0x00 and 0xc664 = 0x00
  - 0xc307 = 0x00 and 0xc308 = 0x06
  - 0xc670 = 0x00 and 0xc671 = 0x00

When you get your 1st life at 20000 points, this code is executed :

[BEGIN]
1300: 21 07 C3    ld   hl,$C307
1303: 11 70 C6    ld   de,$C670
1306: 01 04 00    ld   bc,
madcrash (marvins.c driver)

There is an ingame bug if you set the "Occurence" Dip Switch to "1st, 2nd then every 2nd" ...

Here are some useful addresses :

  - 0xc663-0xc666 : player score (BCD coded, MSB first)
  - 0xc303-0xc306 : 1st bonus life (BCD coded, MSB first)
  - 0xc307-0xc30a : 2nd bonus life (BCD coded, MSB first)
  - 0xc670-0xc673 : next bonus life in case of more than 2 occurences (MSB first)


In fact, only these addresses interest us : 0xc663-0xc664, 0xc307-0xc308 and 0xc670-0xc671 ...

I assume that you've set the "Bonus Lives" Dip Switch to "20k, 60k" ...

When you start a game, here are the contents of the addresses :

  - 0xc663 = 0x00 and 0xc664 = 0x00
  - 0xc307 = 0x00 and 0xc308 = 0x06
  - 0xc670 = 0x00 and 0xc671 = 0x00

When you get your 1st life at 20000 points, this code is executed :

[BEGIN]
1300: 21 07 C3 ld hl,$C307
1303: 11 70 C6 ld de,$C670
1306: 01 04 00 ld bc,$0004
1309: ED B0 ldir
[END]

So the contents of the addresses are now :

  - 0xc663 = 0x00 and 0xc664 = 0x02
  - 0xc307 = 0x00 and 0xc308 = 0x06
  - 0xc670 = 0x00 and 0xc671 = 0x06

But when your score reaches 60000 points, this code is executed :

[BEGIN]
1352: 11 0A C3 ld de,$C30A
1355: 21 73 C6 ld hl,$C673
1358: 06 04 ld b,$04
135A: 37 scf
135B: 3F ccf
135C: 1A ld a,(de)
135D: 1B dec de
135E: 8E adc a,(hl)
135F: 77 ld (hl),a
1360: 2B dec hl
1361: 10 F9 djnz $135C
[END]

If you watch carefully, you'll notice that there is NO 'daa' ("decimal ajust", needed when you add/sub BCD numbers) after the 'adc a,(hl)' at address 0x135e ...

So the contents of the addresses are now :

  - 0xc663 = 0x00 and 0xc664 = 0x06
  - 0xc307 = 0x00 and 0xc308 = 0x06
  - 0xc670 = 0x00 and 0xc671 = 0x0c !!!

When your scores reaches 100000 points, 0xc663 = 0x00 and 0xc664 = 0x10 ...

And 0x0010 > 0x000c ... So you get ANOTHER life and the buggy routine is called again !

So the contents of the addresses are now :

  - 0xc663 = 0x00 and 0xc664 = 0x10
  - 0xc307 = 0x00 and 0xc308 = 0x06
  - 0xc670 = 0x00 and 0xc671 = 0x12 !!!

And this means that another life will be awarded when your score reaches 120000 points (0xc663 = 0x00 and 0xc664 = 0x12) !

I could continue for ever ;) I hope that you've understood everything ...
04 1309: ED B0 ldir [END] So the contents of the addresses are now : - 0xc663 = 0x00 and 0xc664 = 0x02 - 0xc307 = 0x00 and 0xc308 = 0x06 - 0xc670 = 0x00 and 0xc671 = 0x06 But when your score reaches 60000 points, this code is executed : [BEGIN] 1352: 11 0A C3 ld de,$C30A 1355: 21 73 C6 ld hl,$C673 1358: 06 04 ld b, 135A: 37 scf 135B: 3F ccf 135C: 1A ld a,(de) 135D: 1B dec de 135E: 8E adc a,(hl) 135F: 77 ld (hl),a 1360: 2B dec hl 1361: 10 F9 djnz 5C [END] If you watch carefully, you'll notice that there is NO 'daa' ("decimal ajust", needed when you add/sub BCD numbers) after the 'adc a,(hl)' at address 0x135e ... So the contents of the addresses are now : - 0xc663 = 0x00 and 0xc664 = 0x06 - 0xc307 = 0x00 and 0xc308 = 0x06 - 0xc670 = 0x00 and 0xc671 = 0x0c !!! When your scores reaches 100000 points, 0xc663 = 0x00 and 0xc664 = 0x10 ... And 0x0010 > 0x000c ... So you get ANOTHER life and the buggy routine is called again ! So the contents of the addresses are now : - 0xc663 = 0x00 and 0xc664 = 0x10 - 0xc307 = 0x00 and 0xc308 = 0x06 - 0xc670 = 0x00 and 0xc671 = 0x12 !!! And this means that another life will be awarded when your score reaches 120000 points (0xc663 = 0x00 and 0xc664 = 0x12) ! I could continue for ever ;) I hope that you've understood everything ...
Github Commit
Flags
Regression Version
Affected Sets / Systems madcrash
Attached Files
 
Relationships
There are no relationship linked to this issue.
Notes
0
There are no notes attached to this issue.