the cutting room mirror

Mortal Kombat II (32X)

Turns out Mortal Kombat II looks nicer and plays better on the 32X compared to its Genesis iteration. Too bad that wasn't enough to save the 32X.

Uncompiled Code#

In the December 1994 revision at 0x3CA00, there's some uncompiled code. It's largely generic driver code.

                 t,r0
    mov.l   r0,@r15         ; PC
    mov ##$f0,r0
    mov.l   r0,@(4,r15)     ; SR

    mov.l   ##_DMAOPERATION,r1
    mov #0,r0
    mov.l   r0,@r1          ; DMA off

    mov.l   ##_DMACHANNEL0,r1
    mov #0,r0
    mov.l   r0,@r1

    mov.l   ##%0100010011100000,r1
    mov.l   r0,@r1          ; Channel control

    rte
    nop

mars_reset
    mov.l   ##_FRT,r1       ; System Reset
    mov.b   @(_TOCR,r1),r0      ;
    or  #$01,r0         ;
    mov.b   r0,@(_TOCR,r1)      ;
vresloop:
    bra vresloop
    nop

    littab

;============================================================================
    cnop    0,4
M_vint:
    PUSH_PR

    if PSYQ=1
    trapa   #$21        ; Psyq
    endif

    mov.l   ##_sysreg,r0
    ldc r0,gbr

    mov.l   ##$f0,r0
    ldc r0,sr       ;mask off all IRQS

    mov.w   r0,@(vintclr,gbr)   ; V interrupt clear
    mov.l   ##_FRT,r1
    mov.l   #$02,r0         ; Toggle FRT bit for future IRQs
    mov.b   r0,@(_TOCR,r1)      ;  as required
    mov.w   @(vintclr,gbr),r0   ; V interrupt clear
    mov.b   @(_TOCR,r1),r0      ;  as required

    mov.l   ##Mframe,r0     ; INC frame counter
    mov.l   @r0,r1
    add #1,r1
    mov.l   r1,@r0

    nop
    nop
    nop
    nop
    POP_PR
    rts
    nop

;============================================================================
    cnop    0,4
M_hint:
    mov.l   ##_sysreg,r0
    ldc r0,gbr

    mov.w   r0,@(hintclr,gbr)   ; H interrupt clear
    mov.l   ##_FRT,r1
    mov.l   #$02,r0         ;toggle FRT bit for future IRQs
    mov.b   r0,@(_TOCR,r1)      ;as required
    mov.w   @(hintclr,gbr),r0   ; V interrupt clear
    mov.b   @(_TOCR,r1),r0      ;as required

    nop
    nop
    nop
    nop
    nop
    nop
    rts
    nop

;============================================================================
    cnop    0,4
M_cmdint:
    PUSH    r3


;    mov.l   ##_palette,r0       ; Set colour 0 to another colour
;    mov     ##$8888,r1
;    mov.w   r1,@r0


;    mov.l   ##_DMAOPERATION,r1
;    mov     #0,r0
;    mov.l   r0,@r1          ; DMA off
;
;    mov.l   ##_DMACHANNEL0,r1
;    mov     #0,r0
;    mov.l   r0,@r1
;    mov.l   ##%0100010011100000,r0
;    mov.l   r0,@r1          ; All Channel off



    mov.l   ##_SYSREG,r0        ; GBR = SYSREG base
    ldc r0,gbr


    mov.w   r0,@(cmdintclr,gbr) ; CMD interrupt clear
    mov.l   ##_FRT,r1
    mov.l   #$02,r0         ;toggle FRT bit for future IRQs
    mov.b   r0,@(_TOCR,r1)      ;as required
    mov.w   @(cmdintclr,gbr),r0 ; V interrupt clear
    mov.b   @(_TOCR,r1),r0      ;as required





    mov.l   ##mstruct,r1        ; R1 = MSTRUCT ptr
    mov.l   ##MSTRUCT_SIZE,r2   ; R2 = Bytes to receive
.rlp
    mov #M_OK,r0        ; I'm OK now
    mov.w   r0,@(COMM2,gbr)

.waitb  mov.w   @(COMM0,gbr),r0     ; Wait for GENESIS to be BUSY
    extu.w  r0,r0
    cmp/eq  #M_BUSY,r0
    bf  .waitb

    mov #M_BUSY,r0      ; I'm BUSY now
    mov.w   r0,@(COMM2,gbr)

.waito  mov.w   @(COMM0,gbr),r0     ; Wait for GENESIS to be OK
    extu.w  r0,r0
    cmp/eq  #M_OK,r0
    bf  .waito

    mov #5*2,r0         ; Enough left to rec all COMM ports?
    cmp/ge  r0,r2
    bf  .finishoff      ; No

    mov.w   @(COMM4,gbr),r0     ; Receive 5 words
    mov.w   r0,@r1
    add #2,r1
    mov.w   @(COMM6,gbr),r0
    mov.w   r0,@r1
    add #2,r1
    mov.w   @(COMM8,gbr),r0
    mov.w   r0,@r1
    add #2,r1
    mov.w   @(COMM10,gbr),r0
    mov.w   r0,@r1
    add #2,r1
    mov.w   @(COMM12,gbr),r0
    mov.w   r0,@r1
    add #2,r1

    mov #M_OK,r0        ; I'm OK now
    mov.w   r0,@(COMM2,gbr)

    mov #5*2,r0
    bra .rlp
    sub r0,r2

.finishoff
    tst r2,r2           ; Finished ?
    bt  .exit           ; Yes

    mov.w   @(COMM4,gbr),r0
    mov.w   r0,@r1
    add #2,r1
    dt  r2
    dt  r2
    bt  .exit
    mov.w   @(COMM6,gbr),r0
    mov.w   r0,@r1
    add #2,r1
    dt  r2
    dt  r2
    bt  .exit
    mov.w   @(COMM8,gbr),r0
    mov.w   r0,@r1
    add #2,r1
    dt  r2
    dt  r2
    bt  .exit
    mov.w   @(COMM10,gbr),r0
    mov.w   r0,@r1

.exit

;    mov.l   ##_palette,r0       ; Set colour 0 to normal
;    mov     ##$0000,r1
;    mov.w   r1,@r0


;    mov.w   r0,@(cmdintclr,gbr)     ; CMD interrupt clear
;    mov.l   ##_FRT,r1
;    mov.l   #$02,r0         ;toggle FRT bit for future IRQs
;    mov.b   r0,@(_TOCR,r1)      ;as required
;    mov.w   @(cmdintclr,gbr),r0     ; V interrupt clear
;    mov.b   @(_TOCR,r1),r0      ;as required

;    nop
;    nop
;    nop
    nop
    nop
    nop

    POP r3
    rts
    nop

    littab

;============================================================================
    cnop    0,4
M_pwmint:
    mov.l   ##_sysreg,r0
    ldc r0,gbr

    mov.w   r0,@(pwmintclr,gbr) ; PWM interrupt clear
    mov.l   ##_FRT,r1
    mov.l   #$02,r0         ;toggle FRT bit for future IRQs
    mov.b   r0,@(_TOCR,r1)      ;as required
    mov.w   @(pwmintclr,gbr),r0 ; V interrupt clear
    mov.b   @(_TOCR,r1),r0      ;as required

    nop
    nop
    nop
    nop
    nop
    nop
    rts
    nop

;============================================================================
;               ERROR
;============================================================================

error0:

    if PSYQ=1
    trapa   #$21
    endif

    nop
    bra error0
    nop

;============================================================================
;               TRAP INDICATORS
;============================================================================

    IF  MARS_TRAPS

    cnop    0,4

T_illegal:
    mov.l   ##_palette,r0       ; YELLOW
    mov ##$1234|$8000,r1
    bra PrintPC
    mov.w   r1,@r0
T_cpu:
    mov.l   ##_palette,r0       ; GREEN
    mov ##$aa00|$8000,r1
    bra PrintPC
    mov.w   r1,@r0
T_dma:
    mov.l   ##_palette,r0       ; RED
    mov ##$003f|$8000,r1
    mov.w   r1,@r0

PrintPC:
    POP r3
    mov.l   ##SCREENBASE+(72*SCREENWIDTH)+8+(6*10),r2
    JSR_R0  PrintLONG
    nop
    bsr WaitVbi
    nop
    bsr PageFlip
    nop
.lp1    bra .lp1
    nop

    ENDIF

    littab

References#


  1. Outpost Sega - Mortal Kombat II - Electronic Gaming Monthly, Volume 8, Issue 3, Number 68, March 1995↩︎
  2. 32X Review: Mortal Kombat II - Mean Machines Sega, Issue 29, March 1995↩︎
  3. ソフトウェア一覧(ソフトライセンシー発売) | スーパー32X |セガ SEGA↩︎
  4. Férias trazem novos cartuchos para videogames da linha Sega "Winter break brings new cartridges for Sega consoles" - O Estado de S. Paulo, June 26, 1995↩︎