Warlords Weirdness

guddler

Busting vectors like it's 1982!
vacBacker
Feedback
10 (100%)
Credits
4,055CR
This is as much of a note to myself as anything.

I need to either step through the game in the mame debugger or disassemble it, or something, to try and work out what's going on and more to the point, why...

I had a PCB on the bench earlier this evening, just giving it a final play test (as best you can, a 4 player game with only a single variable resistor wired up!) and I noticed that the score was going up and being displayed in hexadecimal, not decimal. I could not get my head around how the game could otherwise be working perfectly and yet that was happening.

The CPU running the game was in my Fluke so I put a different CPU in that also happened to be a different make and the score went back to normal. It's not my Fluke, I proved that by removing the CPU from the POD and putting it in the board direct.

So I guess the game must be using one or more instructions that do something different on a Rockwell 6502BP to what they do on a Signetics plain 6502 (and also a MOS 6502 is fine as well, tried a couple). Maybe this is well documented and well known?? I dunno, it's not something I've EVER come across before but hey, I've not done much with Warlords before. I think I've just fixed this one board. Twice!

If anyone has any ideas then I'm all ears as I don't know. That said, it's going to be hard for me to prove after tonight as the PCB is leaving tomorrow
smiley36.gif
I just want to know which 6502 I should put in the Fluke to provide the best compatibility. I'd hate to think that I've potentially got PCBs here that I've not been able to fix and at the end of the day it boils down to the make of the 6502.

That does actually remind me. I've got a Missile Command that I spent nights and night on, and to all intents and purposes it works 100% except there is a colour missing at the bottom of the screen. I highly doubt it would be this but I'm certainly going to double check
smiley4.gif
 

ASI

Newbie
Credits
12CR
It may or may not have to do with the non standard op codes on 6502, i just remeber from way back when programming that certain non standard code would do combined instructions, but not sure if this would be same across all brands of 6502.
 

Mitchell Gant

Active member
vacBacker
Feedback
2 (100%)
Credits
884CR
Could just be a faulty 6502 that has broken BCD logic perhaps.Chip faults don't have to stop code executing.

Unless you've got another 6502 of same manufacturer and possibly batch or revision number?
 

guddler

Busting vectors like it's 1982!
vacBacker
Feedback
10 (100%)
Credits
4,055CR
Thank you for that - there's a LOT of reading there and I'm a bit too tired and consuming wine to take it all in, but from a quick scan through, that would certainly make sense. Especially given it specifically talks about BCD being used to convert numbers to ascii, which one would presume an arcade game would be very likely to do with scores. And it also mentions that using that routine relies on undocumented behaviour. SO, that's certainly an area to focus on if / when I disassemble it and look at it.

Actually, never mind the "IF" I do it. I really need to fully understand this one. If it's behaviour that I can't do anything about then fine, but if one chip would handle the circumstances in all cases then I'd best make sure I have one of those CPUs in my test kit...
 

guddler

Busting vectors like it's 1982!
vacBacker
Feedback
10 (100%)
Credits
4,055CR
Mitchell Gant said:
Could just be a faulty 6502 that has broken BCD logic perhaps.Chip faults don't have to stop code executing.

Unless you've got another 6502 of same manufacturer and possibly batch or revision number?

Can they do that?? Obviously or you wouldn't make the comment
smiley36.gif
I'd always considered a CPU to be a bit of a work / not work kind of thing. I can have a look. I actually found a few more Rockwell CPUs. I imagine it's highly unlikely they would be the same batch as the one in the Fluke but no harm in checking. It was quite hot when I opened the POD up. But that might be normal. The POD was NOS when I got it so I've never been in there before.
 

cmonkey

Active member
vacBacker
Feedback
4 (100%)
Credits
1,658CR
[font="Arial, Helvetica, sans-serif"]I was bored and had half an hour to spare so I reversed the score incrementing routine in Warlords
smiley36.gif
[/font][font="Courier New, Courier, mono"][/font]
[font="Courier New, Courier, mono"]
[/font]

[font="Arial, Helvetica, sans-serif"]It really needs a more in-depth analysis to fully understand the values at $0142,x and $0146,x but I believe them to be something to do with the value that needs to be added to the player score on this invocation of the routine (it would make sense as you generally *have* to pass a value of some kind to a score incrementing routine!)[/font]

[font="Arial, Helvetica, sans-serif"]
[/font]

[font="Arial, Helvetica, sans-serif"]I guess if the BCD logic in the CPU is borked it would play havoc with this routine as the majority of the routine operates in decimal mode.
[/font]
[font="Courier New, Courier, mono"]
[/font]

[font="Courier New, Courier, mono"]; there are 3 bytes per player score (6 BCD digits)[/font]
[font="Courier New, Courier, mono"]; scores are held in memory as follows :-[/font]

[font="Courier New, Courier, mono"]; $121/$128/$135 for player 1 (low 2 digits/mid 2 digits/high 2 digits)[/font]

[font="Courier New, Courier, mono"]; $122/$129/$136 for player 2[/font]

[font="Courier New, Courier, mono"]; $123/$12a/$137 for player 3[/font]

[font="Courier New, Courier, mono"]; $124/$12b/$138 for player 4[/font]

[font="Courier New, Courier, mono"]
[/font]

[font="Courier New, Courier, mono"]709F: A2 03 ldx #$03 ; set up the loop counter for 4 players[/font]

[font="Courier New, Courier, mono"]70A1: BD 42 01 lda $0142, x ; load A from $0142+x (something to do with value to add to player score?)[/font]

[font="Courier New, Courier, mono"]70A4: 1D 46 01 ora $0146, x ; or A with $0146+x (something to do with value to add to player score?)[/font]

[font="Courier New, Courier, mono"]70A7: F0 55 beq $70fe ; branch if A=0 (nothing to add for this player)[/font]

[font="Courier New, Courier, mono"]70A9: F8 sed ; set decimal mode[/font]

[font="Courier New, Courier, mono"]70AA: A0 01 ldy #$01 ; Y = 1 (this is the value that will be added to player score)[/font]

[font="Courier New, Courier, mono"]70AC: BD 46 01 lda $0146, x ; load A from $0146+x[/font]

[font="Courier New, Courier, mono"]70AF: F0 02 beq $70b3 ; branch if A is zero[/font]

[font="Courier New, Courier, mono"]70B1: A0 23 ldy #$23 ; Y = 23 (this is the value that will be added to player score)[/font]

[font="Courier New, Courier, mono"]70B3: 29 F0 and #$f0 ; clear lower nibble of A[/font]

[font="Courier New, Courier, mono"]70B5: F0 02 beq $70b9 ; branch if result is zero[/font]

[font="Courier New, Courier, mono"]70B7: A0 97 ldy #$97 ; Y = 97 (this is the vaule that will be added to player score)[/font]

[font="Courier New, Courier, mono"]70B9: 98 tya ; transfer value to be added to player score to A[/font]

[font="Courier New, Courier, mono"]70BA: 85 4D sta $4d ; store A @ $4d[/font]

[font="Courier New, Courier, mono"]70BC: 18 clc ; clear carry flag[/font]

[font="Courier New, Courier, mono"]70BD: 7D 21 01 adc $0121, x ; add low 2 digits of player score to A[/font]

[font="Courier New, Courier, mono"]70C0: 9D 21 01 sta $0121, x ; store it back[/font]

[font="Courier New, Courier, mono"]70C3: A9 00 lda #$00 ; clear A[/font]

[font="Courier New, Courier, mono"]70C5: 7D 28 01 adc $0128, x ; add mid 2 digits of player score + carry to A[/font]

[font="Courier New, Courier, mono"]70C8: 9D 28 01 sta $0128, x ; store it back[/font]

[font="Courier New, Courier, mono"]70CB: A9 00 lda #$00 ; clear [/font]

[font="Courier New, Courier, mono"]70CD: 7D 35 01 adc $0135, x ; add high 2 digits of player score + carry to A[/font]

[font="Courier New, Courier, mono"]70D0: 9D 35 01 sta $0135, x ; store it back[/font]

[font="Courier New, Courier, mono"]70D3: A5 4D lda $4d ; load A from $4d[/font]

[font="Courier New, Courier, mono"]70D5: 18 clc ; clear carry flag[/font]

[font="Courier New, Courier, mono"]70D6: 6D 25 01 adc $0125 ; add contents of $0125 to A (carry is clear at this point)[/font]

[font="Courier New, Courier, mono"]70D9: 8D 25 01 sta $0125 ; store back to $0125[/font]

[font="Courier New, Courier, mono"]70DC: A9 00 lda #$00 ; clear A[/font]

[font="Courier New, Courier, mono"]70DE: 6D 2C 01 adc $012c ; add contents of $012c + carry to A[/font]

[font="Courier New, Courier, mono"]70E1: 8D 2C 01 sta $012c ; store back to $012c[/font]

[font="Courier New, Courier, mono"]70E4: A9 00 lda #$00 ; clear A[/font]

[font="Courier New, Courier, mono"]70E6: 6D 39 01 adc $0139 ; add contents of $0139 + carry to A[/font]

[font="Courier New, Courier, mono"]70E9: 8D 39 01 sta $0139 ; store back to $0139[/font]

[font="Courier New, Courier, mono"]70EC: BD 42 01 lda $0142, x ; load A from $0142+x[/font]

[font="Courier New, Courier, mono"]70EF: 38 sec ; set carry flag[/font]

[font="Courier New, Courier, mono"]70F0: E5 4D sbc $4d ; subtract contents of $4d and carry from A[/font]

[font="Courier New, Courier, mono"]70F2: 9D 42 01 sta $0142, x ; store A back to $0142+x[/font]

[font="Courier New, Courier, mono"]70F5: BD 46 01 lda $0146, x ; load A from $0146+x[/font]

[font="Courier New, Courier, mono"]70F8: E9 00 sbc #$00 ; subtract 0 and carry from A[/font]

[font="Courier New, Courier, mono"]70FA: 9D 46 01 sta $0146, x ; store A back to $0146+x[/font]

[font="Courier New, Courier, mono"]70FD: D8 cld ; clear decimal mode[/font]

[font="Courier New, Courier, mono"]70FE: CA dex ; decrement x[/font]

[font="Courier New, Courier, mono"]70FF: 10 A0 bpl $70a1 ; loop for all 4 players[/font]

[font="Courier New, Courier, mono"]7101: 60 rts[/font]

cmonkey2015-09-12 23:07:42
 

guddler

Busting vectors like it's 1982!
vacBacker
Feedback
10 (100%)
Credits
4,055CR
Ugh, sorry I missed this!! My day did not entirely go according to plan for personal reasons. Will try and catch up on it during the week...
 
Top