トップ 差分 一覧 ソース 検索 ヘルプ RSS ログイン

Appendix A.7 カートリッジ ハードウェア仕様

 第 5 部 7 章ではカートリッジ ROM 内に収めるソフトウェアの作成法を説明しましたが、実際にカートリッジを制作する場合には、ここに示したハードウェア仕様を参考にしてください。


;============================================================
;  List A.1   MSX ROM Cartridge Header to start by H.STKE
;              (this program must link List 5.13)
;============================================================
;
;	Switch
SNSDEL	EQU	1		;Sense DEL key not to start
;
;	BIOS
;
SNSMAT	EQU	141H		;Sense key in real time
;
;	System work area
;
H.STKE	EQU	0FEDAH		;Hook for auto start
;
;	External symbol
;
 	EXTRN	START		;Address to start
	EXTRN	GTSL1@		;Get my slot address
;
;	Header
;
	ASEG
	ORG	4000H
	DB	41H, 42H
	DW	INIT
	DW	0		;No STATEMENT
	DW	0		;No DEVICE
	DW	0		;No TEXT
	DW	0
	DW	0
	DW	0
;
;	INIT : set H.STKE and return
;
INIT:
	IF	SNSDEL
	LD	A,8		;Read 8th row
	CALL	SNSMAT		;Read key
	BIT	3,A		;DEL key
	RET	Z		;Return if DEL pressed
	ENDIF			;IF SNSDEL
;
	LD	HL,H.STKE	;Hook for auto start
	LD	A, 0F7H		;"RST 30H" instruction
	DI			;For fale safe
	LD	(HL), A
	CALL	GRSL1@		;[A] = my slot address
	INC	HL
	LD	(HL), A
	LD	DE, START	;Set start address
	INC	HL
	LD	(HL), E
	INC	HL
	LD	(HL), D
	EI
	RET

	END
;================================================================
; List A.2   MSX ROM Cartridge Header to get work area from HIMEM
;================================================================
	.SFCOND
	.XALL
	.RADIX	10
;
;	Switch
;
SNSDEL	EQU	1		;Sense DEL key not to start
;
;	Constant
;
MYWORK	EQU	1024		;Length of my work area to request
;
;	BIOS
;
RSLREG	EQU	138H		;Get primary slot register
SNSMAT	EQU	141H		;Sense key in real time
CALBAS	EQU	159H		;Call BASIC interpreter
;
;	System work area
;
MEMSIZ	EQU	0F672H
VARTAB	EQU	0F6C2H
STKTOP	EQU	0F674H
TEMP	EQU	0F6A7H		;To save text pointer
MAXFIL	EQU	0F85FH
FILTAB	EQU	0F860H
NULBUF	EQU	0F862H
BOTTOM	EQU	0FC48H
HIMEM	EQU	0FC4AH
EXPTBL	EQU	0FCC1H
SLTWRK	EQU	0FD09H
H.CLEA	EQU	0FED0H		;Hook to get work area
;
;	MACROS
;
COMPAR	MACRO
	RST	20H		;Compares HL with DE
	ENDM
;
BIOS	MACRO	ADDRESS
	CALL	ADDRESS		;Will be change for DOS version
	ENDM
;
;	Header
;
	CSEG
;	 ASEG
;	 ORG	 4000H
	DB	41H, 42H
	DW	INIT
	DW	0		;No STATEMENT
	DW	0		;No DEVICE
	DW	0		;No TEXT
	DW	0
	DW	0
	DW	0
;
;	INIT : set H.CLEA and return
;
INIT:
	IF	SNSDEL
	LD	A,8		;Read 8th row
	CALL	SNSMAT		;Read key
	BIT	3,A		;DEL key
	RET	Z		;Return if DEL pressed
	ENDIF			;IF SNSDEL
;
	LD	HL, H.CLEA	;Hook to get work area
	LD	A, 0F7H		;"RST 30th" instruction
	DI			;For fale safe
	LD	(HL), A
	CALL	GTSL1@		;[A] = my slot address
	INC	HL
	LD	(HL), A
	LD	DE, START	;Set start address
	INC	HL
	LD	(HL), E
	INC	HL
	LD	(HL), D
	EI
	RET
;
;	Called by H.CLEA
;
START:
	LD	(TEMP),HL	;Save [HL]
	DI			;For fail safe
	LD	B,5
	LD	HL,H.CLEA
	LD	A,0C9H		;RET instruction
CLHOOK:
	LD	(HL),A		;Clear H.CLEA
	INC	HL
	DJNZ	CLHOOK
	EI
;
	LD	HL,MYWORK	;How many memory to request
	CALL	WORKH@		;Change HIMEM
;
;	[HL] = (HIMEM) = start address of my work area
;	[HL] = 0 if out of memory
;
	CALL	DEFILE
;
;	Note that DEFILE changes stack pointer
;
	LD	IX,7D20H
	JP	CALBAS
;
;	Note that H.CLEA will be called again.
;	Make sure that H.CLEA is cleared by 'RET'

;-----------------------------------------------------------
;	BOTTOM became greater than 0DFFFH, there is
;	no RAM left to be allocated.
;
NORMOOM:
	LD	HL,0
	CALL	WSLW1@		;Clear slot work
	JR	WORKBEND	;Return 0 in [HL]
	ENDIF			;IF USEWORKB OR USEWORKH
	IF	USEWORKH
;
;	WORKH	allocate work area from HIMEM
;		(my slot work) <- (new HIMEM)
;	Entry	HL	required memory size
;	Return	HL	start address of my work area = new HIMEM
;			0 if cal not allocate
;	Modify	None
;	Note	This routine shoud be called by H.STKE not by INIT.
;
LIMHIM	EQU	0C400H
;
	PUBLIC	WORKH@
WORKH@:
	PUSH	DE
	PUSH	BC
	PUSH	AF
;
	EX	DE,HL		;[DE} = size
	LD	HL,(HIMEM)	;Get current RAM top
	XOR	A		;Clear carry
	SBC	HL, DE		;[HL] = new HIMEME
	JR	C, NOROOM	;HIMEM < 0
	EX	DE, HL		;[DE] = new HIMEME
	LD	HL, LIMHIM	;Lower limit of HIMEM
	XOR	A		;Clear carry
	SBC	HL, DE
	JR	NC, NOROOM	;HIMEM < LIMHIM
	EX	DE, HL		;[HL] = new HIMEM
	CALL	WSLW1@		;Save HIMEM to slot work
	LD	(HIMEM), HL	;Update HIMEM
	JR	WORKBEND
	ENDIF			;If USEWORKH
;
;	DEFILE : re-build file structure
;	Original program is in INIT.MAC
;	Changed to set workarea at H.CLEA
;	MAXFIL = 1
;	String space = 200
;	by nao-i on 3. Feb., 1986
;
;	Entry	(HIMEM)		New HIMEM
;		(STKTOP)	To know string space if not STR200
;		(MEMSIZ)	To know string space if not STR200
;		(VARTAB)	To check free space if CHKOME
;		[A]		New MAXFIL if not FILMAX1
;
;	Return	(MAXFIL)
;		(FILTAB)
;		(MEMSIZ)
;		(STKTOP)
;		(NULBUF)
;
;	Modify	AF, BC, DE, HL, SP
;
;	Note	This routine changes stack pointer
;
;	Constant
;
NUMLEV	EQU	60
FILLEN	EQU	265
FL.BUF	EQU	9
;
;	Switch
;
MAXFIL1	EQU	1		;MAXFILE = 1
STR200	EQU	1		;String space is 200 Byte
CHKOME	EQU	0		;Check "Out of memory"
;
	IF	CHKOME
	EXTRN	OMERR		;Entry of "Out of memory"
	ENDIF
;
DEFILE:
	IFE	MAXFIL1
	PUSH	AF		;Save new MAXFIL
	ENDIF			;IFE MAXFIL1
	LD	HL,(HIMEM)
	IF	MSXFIL1
	LD	DE,65536-FILLEN*2-4
	ADD	HL,DE
	ELSE
	LD	DE,65536-FILLEN-2
DEFIL1:
	ADD	HL,DE		;[HL] = (HIMEM) - FILLEN -2
	DEC	A
	JP	P,DEFIL1
	ENDIF			;IF MAXFIL1
	EX	DE,HL		;DE:=FILTAB
	IF	STR200		;String space is fixed
	LD	HL,200
	ELSE
	LD	BC,(STKTOP)	;Get current string space in BC
	LD	HL,(MEMSIZ)
	XOR	A		;Clear carry
	SBC	HL,BC		;[HL] = (MEMSIZ) - (STKTOP)
	ENDIF			;IF STR200
	IFE	MAXFIL1
	POP	AF		;Restore new MAXFIL
	ENDIF			;IFE MAXFIL1
	PUSH	HL		;Save current string space
	IFE	MAXFIL1
	PUSH	AF		;Save new MSXFIL
	ENDIF			;IFE MAXFIL
	IF	CHKOME
	LD	BC,2*NUMLEV+20
	ADD	HL,BC
	LD	B,H
	LD	C,L
	LD	HL,(VARTAB)	;Get end of program
	ADD	HL,BC
	COMPAR			;Enough breathing room?
	JP	NC,OMERR	;No
	ENDIF			;IF CHKOME
	IF	MAXFIL1
	LD	A, 1		;Make sure MAXFIL = 1
	ELSE
	POP	AF		;Restore new MAXFIL
	ENDIF			;IF MSXFIL1
	LD	(MAXFIL),A
	LD	L,E
	LD	H,D		;[HL] = [DL] = (HIMEM) - FILLEN -2
	LD	(FILTAB),HL	;Pointer to first FCB
	DEC	HL
	DEC	HL		;[HL] = (HIMEM) - FILLEN - 4
	LD	(MEMSIZ),HL
	POP	BC		;Restore current string space
	XOR	A		;Clear carry
	SBC	HL, BC
	LD	(STKTOP),HL	;[HL] = (HIMEM) - FILLEN -4 - <string size>
	DEC	HL
	DEC	HL
	POP	BC		;Get return address
	LD	SP,HL		;Set new temporary stack
	PUSH	BC
	IF	MSXFIL1
	LD	A, 1		;[A] = MAXFIL
	LD	HL, 4		;[HL] = MAXFIL * 2 + 2
	ELSE
	LD	A,(MSXFIL)
	LD	L,AINC	L
	LD	H,0
	ADD	HL,HL		;[HL] = (MSXFIL) * 2 + 2
	ENDIF			;IF MAXFIL1
	ADD	HL,DE		;Add FILTAB to get start of FCB's
	EX	DE,HL		;DE=Adress of first FCB
	PUSH	DE		;Address of first FCB (#0)
	LD	BC,FILLEN
DSKFLL:
	LD	(HL),E
	INC	HL
	LD	(HL),D
	INC	HL
	EX	DE,HL
	LD	(HL),0		;Make it look closed
	ADD	HL,BC
	EX	DE,HL
	DEC	A
	JP	P,DSKFLL
	POP	HL		;Restore address of first FCB
	LD	BC,FL,BUF
	ADD	HL,BC		;Get address of buffer for file #0
	LD	(NULBUF),HL
	RET

	END

●カートリッジバス信号線表

ピンNo.名 称I/O*ピンNo.名 称I/O*
1_
CS1
O2_
CS2
O
3__
CS12
O4___
SLTSL
O
5予備 *1-6___
RFSH
O
7__
WAIT *2
I8__
INT *2
I
9_
M1
O10___
BUSDIR
I
11__
IORQ
O12__
MERQ
O
13_
WR
O14_
RD
O
15___
RESET
O16予備 *1-
17A9O18A15O
19A11O20A10O
21A7O22A6O
23A12O24A8O
25A14O26A13O
27A1O28A0O
29A3O30A2O
31A5O32A4O
33D1I/O34D0I/O
35D3I/O36D2I/O
37D5I/O38D4I/O
39D7I/O40D6I/O
41GND-42CLOCKO
43GND-44SW1-
45+5V-46SW2-
47+5V-48+12V-
49SUNDINI50-12V-
注) 本体を基準にした入出力の区別
*1 予備は使用禁止端子
*2 OPEN COLLECTER 出力


●スロットのタイミングチャート

M1 サイクル 基本スロット


M1 サイクル 拡張スロット


メモリサイクル 基本スロット


メモリサイクル 拡張スロット


I/O サイクル 基本スロット


I/O サイクル 拡張スロット


●拡張スロットセレクト信号作成回路例




●カートリッジ寸法



●コネクター寸法例





修正

BugTrack-techhan/2