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

P-47 Aces

From The Cutting Room Floor
Jump to navigation Jump to search

Title Screen

P-47 Aces

Developer: NMK
Publisher: Jaleco
Platform: Arcade (Jaleco MegaSystem 32)
Released in JP: March 1995[1]
Released in US: 1995


SourceIcon.png This game has uncompiled source code.


Sound Driver

Programmer Credit

A small credit for the sound driver programmer can be seen at 0x98 in p47-21.bin:

SOUND DRIVER VERSION 1.04 for MEGA System 32
Programmed by N.M.K.Co.,Ltd. K.Hideya
1994.11.22 (TUE)

Uncompiled Source Code

Two fragments for a sound driver were included in this game and both of them are in p47-21.bin. Both of these were written in Z80 assembly. They can be found at the hex addresses listed below:

0x227DD:

                                                               ========
;======================================================================
;======================================================================
MODE	EQU	1	; 0 : for V70 / 1 : for DEBBUGER
MONO	EQU	0	; 0 : STEREO  / 1 : MONO


	ASEG

	INCLUDE	SDRV.INC
	INCLUDE	SMACRO.INC

ATREQ	EQU	0

;================================================================
;=								=
;=  HOT START							=
;=								=
;================================================================
	ORG	$0000
RESET:
	IM	0
	LD	(WAT_DOG),A	; WATCH DOG CLEAR
	JP	START


;================================================================
;=								=
;=  WAIT							=
;=								=
;================================================================
	ORG	$0008
OPXWAIT:
	LD	A,(OPX_ST0)
	RLCA			; OPN Busy ?
	JR	C,OPXWAIT	; Yes !
	RET


;================================================================
;=								=
;=  YMF271 REGSTER SET						=
;=	A  : LOW ADDRESS					=
;=	D  : REGSTER						=
;=	E  : DATA						=
;=								=
;================================================================
	ORG	$0010
REGST:
	PUSH	HL
	LD	H,$3F
	LD	L,A
;	RST	$08
	LD	(HL),D
	INC	HL
;	RST	$08
	LD	(HL),E
	POP	HL
	RET


;================================================================
;=								=
;=  OPX SET by TABLE						=
;=	HL : TABLE ADDRESS					=
;=								=
;================================================================
	ORG	$20
OPX_SET_TBL:
1$:
	LD	A,(HL)
	INC	HL
	CP	$FF
	RET	Z
	LD	D,(HL)
	INC	HL
	LD	E,(HL)
	INC	HL
	RST	$10
	JR	1$


;================================================================
;=								=
;=  MASKABLE INTERRUPT						=
;=								=
;================================================================
	ORG	$0038
	RETI


;================================================================
;=								=
;=  NON MASKABLE INTERRUPT					=
;=								=
;================================================================
	ORG	$0066
	PUSH	AF
	PUSH	HL
	LD	A,(NMIFLAG)
	OR	A
	JR	Z,5$
	LD	A,$FE
	XOR	$FF
	LD	(OUTPUT),A
20$:	JR	20$
5$:
	LD	A,$FF
	LD	(NMIFLAG),A
	LD	A,(INPUT)
	XOR	$FF			;メインからのリクエストは反転している
	OR	A
	JR	Z,10$
	CP	$FF
	JR	Z,10$
	LD	HL,(REQCEWAD)
	LD	(HL),A
	INC	L
	LD	(REQCEWAD),HL
10$:
	XOR	A
	LD	(NMIFLAG),A
	POP	HL
	POP	AF
	RETN


;================================================================
;================================================================
	DB	' SOUND DRIVER VERSION 1.04 for MEGA System 32 '
	DB	' Programmed by N.M.K.Co.,Ltd. K.Hideya '
	DB	' 1994.11.22 (TUE) '
;================================================================
;================================================================


;================================================================
;=								=
;=  START							=
;=								=
;================================================================
	ORG	$0100
START:
	LD	SP,STACK
	CALL	INITIAL
	CALL	PORT_INIT
	LD	HL,INITTBL
	RST	$20

;================================================================
;=								=
;=  IDLE							=
;=								=
;================================================================
IDLE:
	EI

	IF	MODE
	LD	A,(INPUT)
	LD	HL,OLDREQ
	CP	(HL)
	JR	Z,10$
	OR	A
	JR	Z,10$
	CP	0FFH
	JR	Z,10$
	LD	(HL),A
	LD	HL,(REQCEWAD)
	LD	(HL),A
	INC	L
	LD	(REQCEWAD),HL
10$:
	ENDIF

	LD	(WAT_DOG),A	; WATCH DOG CLEAR
	CALL	CHKREQ
	LD	(WAT_DOG),A	; WATCH DOG CLEAR
	CALL	TIMER_INT
	LD	(WAT_DOG),A	; WATCH DOG CLEAR
	CALL	CHK_PCMOFF
	JR	IDLE


;================================================================
;=								=
;=  TIMER CHECK							=
;=								=
;================================================================
TIMER_INT:
;	DI
	LD	A,(OPX_ST1)
	LD	(OPX_SF1),A
	LD	A,(OPX_ST0)
	LD	(OPX_SF0),A
	BIT	0,A		; TIMER-A  On ?
	CALL	NZ,INTA
	LD	A,(OPX_SF0)
	BIT	1,A		; TIMER-B  On ?
	CALL	NZ,INTB
;	EI
	RET


;================================================================
;=								=
;=  INT	A							=
;=								=
;================================================================
INTA:
	LD	D,$13
	LD	E,00011111B
	LD	A,$0C
	RST	$10
	;-------------- ゲートタイムチェック --------------
	LD	IY,WRKCH0
	LD	DE,WRKCHL
	LD	B,FMCHAN
10$:
	BIT	7,(IY+CTRLTR)
	JR	NZ,20$
	XOR	A
	CP	(IY+GATETM)
	JR	Z,20$
	DEC	(IY+GATETM)
	JR	Z,25$
20$:
	ADD	IY,DE
	DJNZ	10$
	LD	B,PCMCHAN
	JR	30$
25$:
	LD	A,FMCHAN
	SUB	B
	LD	(JOBCHAN),A
	CALL	INC_CHSTAT
	LD	A,$FF
	LD	(IY+CTRLTR),A
	CALL	KEYOFF
	JR	20$
30$:
	BIT	7,(IY+CTRLTR)
	JR	NZ,40$
	XOR	A
	CP	(IY+GATETM)
	JR	Z,40$
	DEC	(IY+GATETM)
	JR	Z,50$
40$:
	ADD	IY,DE
	DJNZ	30$
	JR	60$
50$:
	LD	A,FMCHAN+PCMCHAN
	SUB	B
	LD	(JOBCHAN),A
	CALL	INC_CHSTAT
	LD	A,$FF
	LD	(IY+CTRLTR),A
	CALL	KEYOFF
	JR	40$
	;--------------------------------------------------
60$:
	;------------- ステップタイムチェック -------------
	LD	IX,WRKTR0
	LD	DE,WRKTRL
	LD	HL,JOBTRK
	XOR	A
	LD	(HL),A
INTA_LOOP:
	LD	A,(IX+TRKPTR+0)
	OR	(IX+TRKPTR+1)
	JR	Z,100$
	DEC	(IX+STEPT)
	CALL	Z,ANAJOB
100$:
	INC	(HL)
	LD	A,(HL)
	CP	FMTRK+PCMTRK
	RET	Z			;<- EXIT
	ADD	IX,DE
	JR	INTA_LOOP
	;--------------------------------------------------


;================================================================
;=								=
;=  INT	B							=
;=								=
;================================================================
INTB:
	LD	D,$13
	LD	E,00101111B
	LD	A,$0C
	RST	$10
	CALL	CHK_PCMOFFL
	IF	ATREQ
	CALL	AUTOREQ
	ENDIF
;--- フェイドアウト処理 -------------------------------------
	LD	A,(FADEOUT)
	OR	A
	RET	Z		;<-EXIT
	LD	A,(FMMVOL)
	LD	C,A
	LD	A,(PCMMVOL)
	OR	C
	RET	Z		;<-EXIT
INTB_FADE:
	LD	A,(FADEOUT)
	LD	C,A
	LD	A,(FADEWRK)
	ADD	A,C
	LD	C,A
	AND	$1F
	LD	(FADEWRK),A	;少数部を保存
	LD	A,C
	AND	$E0		;正数部を取り出し、0なら帰る
	RET	Z		;↑
	RRA			;↑
	RRA			;↑
	RRA			;↑
	RRA			;↑
;--- フェイドアウト処理の準備 -------------------------------
	LD	C,A
	LD	A,(FMMVOL)
	SUB	C
	JR	NC,10$
	XOR	A
10$:
	LD	(FMMVOL),A
	LD	A,(PCMMVOL)
	SUB	C
	JR	NC,20$
	XOR	A
20$:
	LD	(PCMMVOL),A

;--- フェイドアウトの処理の実行部 ---

0x26319:

=
;=								=
;=  REQUEST FUNCTION AC~AF <<DIRECT PCM VOLUME DOWN>>		=
;=								=
;================================================================
REQ_FUNC_AC:
	SUB	$AC
	LD	(SEREQ_TBL),A
	INC	HL
	LD	A,(HL)
	LD	(SEREQ_NO),A
	CALL	SEREQ_VOLUME_DOWN2
	RET


;================================================================
;=								=
;=  REQUEST FUNCTION A8~AB <<DIRECT PCM VOLUME UP>>		=
;=								=
;================================================================
REQ_FUNC_A8:
	SUB	$A8
	LD	(SEREQ_TBL),A
	INC	HL
	LD	A,(HL)
	LD	(SEREQ_NO),A
	CALL	SEREQ_VOLUME_UP2
	RET


;================================================================
;=								=
;=  REQUEST FUNCTION A4~A7 <<DIRECT

References