If you appreciate the work done within the wiki, please consider supporting The Cutting Room Floor on Patreon. Thanks for all your support!

Mortal Kombat II (32X)

From The Cutting Room Floor
Jump to navigation Jump to search

Title Screen

Mortal Kombat II

Developer: Probe Entertainment
Publishers: Acclaim Entertainment (US/EU), Acclaim Japan (JP)
Platform: 32X
Released in JP: May 19, 1995
Released in US: December 4, 1994
Released in EU: March 1995
Released in BR: 1995


SourceIcon.png This game has uncompiled source code.


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