%第1版第9第刷
% 本文由来の誤植ありあり。もっと新しい刷の方に直して貰わないと・・・
% ・List A.1 に、List 5.15 が必要と書いてあるけど、たぶん 5.13
% (5.15 は無いし。勝手に修正済)
% ・本文には「erea」という部分が何カ所か。workerea とか。
% 勝手に area に修正。
% ・カートリッジバス配線図。+5V が 2 つある・・・。どちらが -5V か
% わからないので、そのままにしてあります。
%
%================
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 O 2 CS2 0
____ _____
3 CS12 0 4 SLTSL 0
____
5 予備 *1 - 6 RFSH 0
____ ___
7 WAIT *2 1 8 INT *2 I
__ ______
9 M1 0 10 BUSDIR I
____ ____
11 IORQ O 12 MERQ O
__ __
13 WR O 14 RD O
_____
15 RESET O 16 予備 *1 -
17 A9 0 18 A15 0
19 A11 O 20 A10 O
21 A7 O 22 A6 O
23 A12 O 24 A8 O
25 A14 O 26 A13 O
27 A1 O 28 A0 O
29 A3 O 30 A2 O
31 A5 O 32 A4 O
33 D1 I/O 34 D0 I/O
35 D3 I/O 36 D2 I/O
37 D5 I/O 38 D4 I/O
39 D7 I/O 40 D6 I/O
41 GND - 42 CLOCK O
43 GND - 44 SW1 -
45 +5V - 46 SW2 -
47 +5V - 48 +12V -
49 SUNDIN I 50 -12V -
注) 本体を基準にした入出力の区別
- 1 予備は使用禁止端子
- 2 OPEN COLLECTER 出力
%================
% スロットの番号図
%================
●スロットのタイミングチャート
M1 サイクル 基本スロット
%================
% 図
%================
M1 サイクル 拡張スロット
%================
% 図
%================
メモリサイクル 基本スロット
%================
% 図
%================
メモリサイクル 拡張スロット
%================
% 図
%================
I/O サイクル 基本スロット
%================
% 図
%================
I/O サイクル 拡張スロット
%================
% 図
%================
●拡張スロットセレクト信号作成回路例
%================
% 図×3つ
%================
●カートリッジ寸法
%================
% 図×3つぐらい
%================
●コネクター寸法例
%================
% 図×3
%================