mame icon indicating copy to clipboard operation
mame copied to clipboard

Burger Time decryption disassembly doesn't work

Open jotd666 opened this issue 9 months ago • 0 comments

MAME version

0.262

System information

Windows 11 64 bit.

INI configuration details


Emulated system/software

Burger Time (Data East set 1)

Incorrect behaviour

Disassembly doesn't decrypt encrypted opcodes properly. The emulation supports it properly but not the static disassembly.

C36E: 85 35    sta $35
C370: A9 80    lda #$80
C372: 85 34    sta $34
C374: 4D 00 85 eor $8500    <=== ???
C377: 33 A2    rla ($a2), y
C379: 23 85    rla ($85, x)

What should be disassembled is:

C372: 85 34 sta $34 C374: A5 00 lda $00 C376: 85 33 sta $33 C378: A2 23 ldx #$23 C37A: 85 F6 sta $f6 C37C: AE BD B3 ldx $b3bd

It seems that in decocpu7.cpp the disassemble method doesn't work, probably because mintf->had_written is always false (decryption occurs only at given address masks AND also if a write occurred just before)

u8 deco_cpu7_device::disassembler::decrypt8(u8 value, offs_t pc, bool opcode) const
{
    return opcode && mintf->had_written && ((pc & 0x104) == 0x104) ? bitswap<8>(value,6,5,3,4,2,7,1,0) : value;
}

Proper disassembly can be achieved with a python script + captstone just following those rules.

Expected behaviour

The portion of the ROM above should decrypt as

C372: 85 34    sta $34
C374: A5 00    lda $00  <= 4D => A5 and the code resyncs
C376: 85 33    sta $33
C378: A2 23    ldx #$23
C37A: 85 F6    sta $f6
C37C: AE BD B3 ldx $b3bd

Steps to reproduce

start mame: mame -debug btime disassemble at C372

Additional details

No response

jotd666 avatar Mar 25 '25 22:03 jotd666