Welcome to Data Crystal's new home! Data Crystal is now part of the TCRF family (sort of).
The wiki has recently moved; please report any issues in Discord. Pardon the dust.

X68k/PM

From Data Crystal
(Redirected from X68k:PM)
Jump to navigation Jump to search

This is a sub-page of X68k.

	- PROGRAMMER'S MANUAL (incomplete version) -

==============================================================================

・ユーザープログラム起動後の状態

レジスタ

a0	メモリ管理ポインタのアドレス
a1	プログラムの終わり+1 のアドレス
a2	コマンドラインのアドレス
a3	環境のアドレス
a4	プログラムの実行開始アドレス
sr	ユーザーモード
usp	親のスタック
ssp	システムのスタック
その他	不定

-Conditions after user program startup

Register

a0 Memory control pointer address
a1 Program end+1 address
a2 Command line address
a3 Environment address
a4 Program execution start address
sr User mode
usp New stack
ssp system stack
Other Undefined

メモリ
	  確保できる最大のメモリが割り当てられている.

コマンドラインの構造
	  LASCII 形式. 先頭 1 バイトに文字列の長さが、文字列の終端には 0 が付
	けられる.

環境
	  親の環境そのもので、DOS _SETENV によって環境の内容を変更した場合、親
	の環境も変更されることになる. 子プロセスを異なる環境の下で実行する場合
	は、別にメモリを確保し新しい環境を用意する.

環境の構造
	  先頭 4 バイトに環境変数領域の大きさが示される.
	  各環境変数は 1 バイトの 0 によって区切られ、環境変数の終端には更にも
	う 1 バイトの 0 が付けられる.

Memory
	Allocated the largest amount of memory possible.

Command line structure
	LASCII format. Length of character string is assigned in the first byte, and end of character
string by 0.

Environment
	Being a parent environment, when the details of the environment are changed by DOS _SETENV,
it changes the parent environment as well. When run in an environment that changes the child processes,
all memory is retained and a new environment prepared.

Environment structure
	The size of the environment variable range is indicated in the first 4 bytes.
	Each environment variable is ended by 1 byte of 0, and another 0 is contained in
the variable termination.


==============================================================================

・メモリ管理ポインタ

offset	size
0	1.l	前のメモリ管理ポインタ(0 なら先頭)
4	1.l	このメモリを確保したプロセスのメモリ管理ポインタ(0 なら親はない)
8	1.l	このメモリブロックの終わり+1 のアドレス
12	1.l	次のメモリ管理ポインタ(0 なら終わり)

	  メモリ管理ポインタは必ず下位 4 ビットが 0 のアドレス(16 バイト境界)
	から始まり、先頭は OS 本体のスーパバイザ領域内に存在する.

	  4 バイト目(メモリを確保したプロセス)の最上位バイトで、そのメモリブロ
	ックの属性を表わす.

	$ff	常駐プロセス(KEEP)
	$fe	不明(MEMDRV)
	$fd	サブメモリブロック

-Memory management pointers

offset	size
0	1.l Previous memory management pointer (If 0 then first)
4	1.l Management pointer that processes memory retention (If 0 no parent)
8	1.l End of memory block+1 address
12      1.l Next memory management pointer (If 0 then end)

The low 4 bits of memory management pointers start from the 0 address (16 byte boundary).
The first exists in the supervisor domain of the OS.

Byte #4--the highest byte, and the one with the memory retention process--displays
the properties of its memory block.

$ff Permanent process (KEEP)
$fe Unknown (MEMDRV)
$fd Sub-memory block

==============================================================================

・プロセス管理ポインタ(256 バイト)

offset	size
$0000	 1.l	前のメモリ管理ポインタ(0 なら先頭)		┐
$0004	 1.l	親プロセスのプロセス管理ポインタ(0 なら親はない)│メモリ管理
$0008	 1.l	このメモリブロックの終わり+1 のアドレス		│    ポインタ
$000c	 1.l	次のメモリ管理ポインタ(0 なら終わり)		┘

$0010	 1.l	環境のアドレス(-1 なら確保されていない)
$0014	 1.l	終了時の戻りアドレス
$0018	 1.l	CTRL+C により中断された際の戻りアドレス
$001c	 1.l	エラーにより中断された際の戻りアドレス
$0020	 1.l	コマンドラインのアドレス
$0024	12.b	プロセスのファイルハンドラの使用状況
		($24~$2f の bit 0~7 の順で使用中 = 1 となる)
$0030	 1.l	BSS の先頭アドレス
$0034	 1.l	ヒープの先頭アドレス(BSS と同じ)
$0038	 1.l	初期スタックアドレス(ヒープの終わり+1)
$003c	 1.l	親プロセスの USP
$0040	 1.l	親プロセスの SSP
$0044	 1.w	親プロセスの SR
$0046	 1.w	アボート時の SR
$0048	 1.l	アボート時の SSP
$004c	 1.l	trap #10 のベクタ
$0050	 1.l	trap #11 のベクタ
$0054	 1.l	trap #12 のベクタ
$0058	 1.l	trap #13 のベクタ
$005c	 1.l	trap #14 のベクタ
$0060	 1.l	shell 起動フラグ(0:通常の起動 -1:shell として起動)
$0064	 1.b	モジュール番号
$0065	 3.b	(未使用)
$0068	 1.l	ロードした子プロセスのメモリ管理ポインタ
$006a	 5.l	(未使用)
$0080	 2.b	実行ファイルのドライブ名
$0082	66.b	実行ファイルのパス名
$00c4	24.b	実行ファイルのファイル名
$00dc	 9.l	(未使用)

$0100		(プログラム先頭)

-Process control pointers (256 bytes)

offset	size
$0000	1.l		Previous memory management pointer (If 0 then head) [Memory
$0004	1.l		Parent process management pointer (If 0 no parent)   management
$0008	1.l		End of memory block+1 address			     pointers
$000c	1.l		Next memory management pointer (If 0 then end)      ]
$0010	1.l		Environment address (If -1 then not secured)
$0014	1.l		End time return address
$0018	1.l		Return address when interrupted by pressing CTRL+C
$001c	1.l		Return address when interrupted by error
$020	1.l		Command line address
$0024	12.b	        Process file handler usage
		        (When in use, $24~$2f bits 0-7 = 1)
$0030	1.l		BSS head address
$0034	1.l		Heap head address (same as BSS)
$0038	1.l		Initial stack address (End of heap +1)
$003c	1.l		Parent process USP
$0040	1.l		Parent process SSP
$0044	1.w	        Parent process SR
$0046	1.w	        Abort time SR
$0048	1.l		Abort time SSP
$004c	1.l		trap #10 vector
$0050	1.l		trap #11 vector
$0054	1.l		trap #12 vector
$0058	1.l		trap #13 vector
$005c	1.l		trap #14 vector
$0060	1.l		Shell start flag (0: Normal start, -1: Start as shell)
$0064	1.b	        Module number
$0065	3.b	        (Unused)
$0068	1.l		Loaded child process memory management pointer
$006a	5.l		(Unused)
$0080	2.b	        Executable file drive name
$0082	66.b      	Executable file path name
$00c4	24.b     	Executable file drive name
$00dc	9.l		(Unused)

$0100			(Program head)

==============================================================================

Memory map:

Exception/Interrupt Vector(Reserved by maker:$00~3f)
address	vector
$000000	  $00	SSP after reset
$000004	  $01	PC after reset
$000008	  $02	Bus error
$00000c	  $03	Address error
$000010	  $04	Unknown instruction
$000014	  $05	Division by 0
$000018	  $06	CHK instruction
$00001c	  $07	TRAPV instruction, FTRAPcc instruction
$000020	  $08	Privilege violation
$000024	  $09	Trace exception
$000028	  $0a	Unsupported instruction line 1010 emulator (SX call)
$00002c	  $0b	 〃 line 1111 emulator (DOS call, floating point operation)
$000030	  $0c	Unused
$000034	  $0d	FPU プロトコルバイオレーション例外処理
$000038	  $0e	 〃 フォーマットエラー例外処理

$000034	$0dFPU	Protocol violation exception handling
$000038	$0e ''	Formatting error exception handling

$00003c	  $0f	Uninitialized Interrupt
$000040	  $10	Unused
$000044	  $11	〃
$000048	  $12	〃
$00004c	  $13	〃
$000050	  $14	〃
$000054	  $15	〃
$000058	  $16	〃
$00005c	  $17	〃
$000060	  $18	Spurious Interrupt
$000064	  $19	Level  1 Interrupt (auto vector)
$000068	  $1a	〃	2 〃
$00006c	  $1b	〃	3 〃
$000070	  $1c	〃	4 〃
$000074	  $1d	〃	5 〃
$000078	  $1e	〃	6 〃
$00007c	  $1f	〃	7 〃(NMI)
$000080	  $20	trap #0
$000084	  $21	 〃  #1
$000088	  $22	 〃  #2
$00008c	  $23	 〃  #3
$000090	  $24	 〃  #4
$000094	  $25	 〃  #5
$000098	  $26	 〃  #6
$00009c	  $27	 〃  #7
$0000a0	  $28	 〃  #8  (reserved for system)
$0000a4	  $29	 〃  #9  (OS debugger)
$0000a8	  $2a	 〃  #10 (reset & power off)
$0000ac	  $2b	 〃  #11 (BREAK key)
$0000b0	  $2c	 〃  #12 (COPY key)
$0000b4	  $2d	 〃  #13 (CTRL+C)
$0000b8	  $2e	 〃  #14 (error processing)
$0000bc	  $2f	 〃  #15 (IOCS call)
$0000c0	  $30	FPU BSUN	(Branch/Set on Unordered) 例外処理

$0000c0	  $30	FPU BSUN	(Branch/Set on Unordered) Exception handling

$0000c4	  $31	 〃 INEX1,INEX2	(Inexact Decimal Input,Inexact Operation)
$0000c8	  $32	 〃 DZ		(Divide by Zero)
$0000cc	  $33	 〃 UNFL	(Underflow)
$0000d0	  $34	 〃 OPERR	(Operand Error)
$0000d4	  $35	 〃 OVFL	(Overflow)
$0000d8	  $36	 〃 SNAN	(Signalling Not A Number)
$0000dc	  $37	未使用

$0000dc	  $37   Unused

$0000e0	  $38	MMU
$0000e4	  $39	〃
$0000e8	  $3a	〃
$0000ec	  $3b	Unused
 …	   …	…
$0000fc	  $3f	Unused

例外ベクタ(ユーザ割り込み:$40~$ff)
address	vector
$000100	  $40	MFP	RTCアラーム/1Hz
$000104	  $41	MFP	外部パワー OFF
$000108	  $42	MFP	フロントスイッチ OFF
$00010c	  $43	MFP	FM 音源
$000110	  $44	MFP	Timer-D (BG 処理で使用)
$000114	  $45	MFP	Timer-C (マウス/カーソル/FDD 制御等)
$000118	  $46	MFP	V-DISP
$00011c	  $47	MFP	RTC クロック
$000120	  $48	MFP	Timer-B
$000124	  $49	MFP	キーシリアル出力エラー
$000128	  $4a	MFP	キーシリアル出力空
$00012c	  $4b	MFP	キーシリアル入力エラー
$000130	  $4c	MFP	キーシリアル入力あり
$000134	  $4d	MFP	Timer-A
$000138	  $4e	MFP	CRTC・IRQ
$00013c	  $4f	MFP	H-SYNC
$000140	  $50	SCC(B)	送信バッファ空
$000144	  $51	SCC(B)	〃
$000148	  $52	SCC(B)	外部/ステータス変化
$00014c	  $53	SCC(B)	〃
$000150	  $54	SCC(B)	受信キャラクタ有効(マウス 1 バイト入力)
$000154	  $55	SCC(B)	〃
$000158	  $56	SCC(B)	スペシャル Rx コンディション
$00015c	  $57	SCC(B)	〃
$000160	  $58	SCC(A)	送信バッファ空
$000164	  $59	SCC(A)	〃
$000168	  $5a	SCC(A)	外部ステータス変化
$00016c	  $5b	SCC(A)	〃
$000170	  $5c	SCC(A)	受信キャラクタ有効(RS-232C 1 バイト入力)
$000174	  $5d	SCC(A)	〃
$000178	  $5e	SCC(A)	スペシャル Rx コンディション
$00017c	  $5f	SCC(A)	〃
$000180	  $60	I/O	FDC ステータス割り込み
$000184	  $61	I/O	FDC 挿入/排出割り込み
$000188	  $62	I/O	HDC ステータス割り込み
$00018c	  $63	I/O	プリンタレディー割り込み
$000190	  $64	DMAC	#0 終了  (FDD)
$000194	  $65	DMAC	#0 エラー(〃 )
$000198	  $66	DMAC	#1 終了  (SASI)
$00019c	  $67	DMAC	#1 エラー(〃  )
$0001a0	  $68	DMAC	#2 終了  (IOCS _DMAMOVE,_DMAMOV_A,_DMAMOV_L)
$0001a4	  $69	DMAC	#2 エラー(〃				   )
$0001a8	  $6a	DMAC	#3 終了  (ADPCM)
$0001ac	  $6b	DMAC	#3 エラー(〃   )
$000200	  $6c	SPC	SCSI 割り込み(内蔵 SCSI)
$000204	  $6d	未使用
…	  …	…
$0003d4	  $f5	未使用
$0003d8	  $f6	SPC	SCSI 割り込み(SCSI ボード)
$0003dc	  $f7	未使用
…	  …	…
$0003fc	  $ff	未使用

Exception vector (User interrupt: $40~$ff)
address		vector
$000100		$40 MFP RTC Alarm/1Hz
$000104		$41 MFP External power OFF
$000118		$42 MFP Front switch OFF
$00010c		$43 MFP FM Audio source
$000110		$44 MFP Timer-D (Used with BG processing)
$000114		$45 MFP Timer-C (Mouse/cursor/FDD control, etc.)
$000118	        $46 MFP V-DISP
$00011c	        $47 MFP RTC Clock
$000120	        $48 MFP Timer-B
$000124	        $49 MFP Key serial output error
$000128	        $4a MFP Key serial output empty
$00012c	        $4b MFP Key serial input error
$000130	        $4c MFP Key serial input 
$000134	        $4d MFP	Timer-A
$000138	        $4e MFP	CRTC*IRQ
$00013c	        $4f MFP	H-SYNC
$000140	        $50 SCC(B) Transmission buffer empty
$000144	        $51 SCC(B) ''
$000148	        $52 SCC(B) External/status changes
$00014c	        $53 SCC(B) ''
$000150	        $54 SCC(B) Incoming character validity (Mouse 1 byte input)
$000154	        $55 SCC(B) ''
$000158	        $56 SCC(B) Special Rx condition
$00015c	        $57 SCC(B) ''
$000160	        $58 SCC(A) Transmission buffer empty
$000164	        $59 SCC(A) ''
$000168	        $5a SCC(A) External status changes
$00016c	        $5b SCC(A) ''
$000170	        $5c SCC(A) Incoming character validity (RS-232C 1 byte input)
$000174	        $5d SCC(A) ''
$000178	        $5e SCC(A) Special Rx Condition
$00017c	        $5f SCC(A) ''
$000180	        $60 I/O	FDC status interruption
$000184	        $61 I/O	FDC insertion/discharge interruption
$000188	        $62 I/O	HDC status interruption
$00018c	        $63 I/O	Printer ready interruption
$000190	        $64 DMAC #0 End (FDD)
$000194	        $65 DMAC #0 Error ('')
$000198	        $66 DMAC #1 End (SASI)
$00019c	        $67 DMAC #1 Error ('')
$0001a0	        $68 DMAC #2 End (IOCS _DMAMOVE,_DMAMOV_A,_DMAMOV_L)
$0001a4	        $69 DMAC #2 Error ('')
$0001a8	        $6a DMAC #3 End (ADPCM)
$0001ac	        $6b DMAC #3 Error ('')
$000200	        $6c SPC	SCSI interruption (Internal SCSI)
$000204	        $6d Unused
---	        --- ---
$0003d4	        $f5 Unused
$0003d8	        $f6 SPC	SCSI interruption (SCSI board)
$0003dc	        $f7 Unused
---	        --- ---
$0003fc	        $ff Unused

その他
address
$000400		IOCS コールのベクタテーブル
$000800		IOCS ワーク
$001000		ROM モニタ ワーク
$001800		DOS コールのベクタテーブル
$001c00		Human68k ワーク
$002000		FD IPL / HD IPL MENU
$002400		HD IPL
$006800		Human68k / SSP

Other
address
$000400		IOCS core vector table
$000800		IOSC work
$001000		ROM monitor work
$001800		DOS core vector table
$001c00		Human68k work
$002000		FD IPL / HD IPL MENU
$002400		HD IPL
$006800		Human68k / SSP

$c00000		GV-RAM(2MB)
$e00000		TV-RAM(512KB)
$e80000		CRTC
$e82000		VC
$e84000		DMAC
$e86000		エリアセット

$e86000         Area set

$e88000		MFP
$e8a000		RTC
$e8c000		プリンタ
$e8e000		システムポート
$e90000		OPM
$e92000		ADPCM
$e94000		FDC
$e96000		SPC(SCSI 機種) / HDC(SASI 機種)
$e98000		SCC
$e9a000		i8255(ジョイスティック)
$e9c000		I/O コントローラ
$e9e000		コプロセッサ I/O 0
$e9e080		〃		 1
$ea0000		SCSI ボード(SPC ポート及び SCSI ROM,8KB)
$eaff80		拡張エリアセット(X68030)
$ec0000		ユーザー I/O(拡張ボードで使用可,64KB)
$ed0000		SRAM(16KB)
$ed4000		予備(64KB)
$ee0000		未使用(128KB)
$f00000		CGROM(768KB)

$e88000		MFP
$e8a000		RTC
$e8c000		Printer
$e8e000		System port
$e90000		OPM
$e92000		ADPCM
$e94000		FDC
$e96000		SPC(SCSI type)/HDC (SASI type)
$e98000		SCC
$e9a000		i8255 (Joystick)
$e9c000		I/O controller
$e9e000		Coprocessor I/O 0
$e9e080		'' 1
$ea0000		SCSI Board (SPC Port and SCSI ROM,8KB)
$eaff80			Expansion area set (X68030)
$ec0000		User I/O (Usable with expansion board, 64KB)
$ed0000		SRAM(16KB)
$ed4000		Backup (64KB)
$ee0000		Unused (128KB)
$f00000		CGROM(768KB)

(X68000 SASI)
$fc0000		$fe0000~$ffffff と同じ内容が読み出される.

$fc0000		$fe0000~$ffffff are read out identically.

$fe0000		ROM Debugger
$ff0000		IPL / ROM IOCS

(X68000 SCSI)
$fc0000		SCSI IOCS / IPL(8KB)
$fe0000		ROM Debugger
$ff0000		IPL / ROM IOCS

(X68030)
$fc0000		SCSI IPL ヘッダ部(512byte)

$fc0000		SCSI IPL Header portion (512 bytes)

$fc0200		Human68k version 2.15
$fce000		FLOAT2.X version 2.02
$fd3800		ROM Debugger
$ff0000		IPL / ROM IOCS

注意	リセット直後のみ $0000~$ffff は $ff0000~$ffffff と同じ内容が読める.

Caution: Immediately following a reset, $0000~$ffff can be read identically to $ff0000~$ffffff.

==============================================================================

・CRTC

address	size
$e80000	1.w	R00	水平トータル		┐
$e80002	1.w	R01	水平同期終了位置	│水平タイミング制御
$e80004	1.w	R02	水平表示開始位置	│
$e80006	1.w	R03	水平表示終了位置	┘
$e80008	1.w	R04	垂直トータル		┐
$e8000a	1.w	R05	垂直同期終了位置	│垂直タイミング制御
$e8000c	1.w	R06	垂直表示開始位置	│
$e8000e	1.w	R07	垂直表示終了位置	┘
$e80010	1.w	R08	外部同期水平アジャスト	: 水平位置微調整
$e80012	1.w	R09	ラスタ番号		: ラスタ割り込み用
$e80014	1.w	R10	X 位置			┐テキスト画面スクロール
$e80016	1.w	R11	Y 位置			┘
$e80018	1.w	R12	X0			┐
$e8001a	1.w	R13	Y0			│
$e8001c	1.w	R14	X1			│
$e8001e	1.w	R15	Y1			│グラフィック画面スクロール
$e80020	1.w	R16	X2			│
$e80022	1.w	R17	Y2			│
$e80024	1.w	R18	X3			│
$e80026	1.w	R19	Y3			┘
$e80028	1.w	R20	メモリモード/表示モード制御
$e8002a	1.w	R21	同時アクセス/ラスタコピー/高速クリアプレーン撰択
$e8002c	1.w	R22	ラスタコピー動作用	: ラスタ番号
$e8002e	1.w	R23	テキスト画面アクセスマスクパターン
$e80481	1.b	動作	画像取り込み/高速クリア/ラスタコピー制御

-CRTC
address	size
$e80000	1.w	R00	Horizontal total 					[Horizontal
$e80002	1.w	R01	Horizontal synchronization end position	                timing
$e80004	1.w	R02     Horizontal display start position			control
$e80006	1.w	R03	Horizontal display end position				]
$e80008	1.w	R04     Vertical total 					        [Vertical
$e8000a	1.w	R05     Vertical synchronization end position		        timing
$e8000c	1.w	R06     Vertical display start position				control
$e8000e	1.w	R07     Vertical display end position				]
$e80010	1.w	R08	External synchronization horizontal adjust: Horizontal position tuning
$e80012	1.w	R09	Raster number: Used for raster interruption
$e80014	1.w	R10	X coordinate		                               [Text screen
$e80016	1.w	R11	Y coordinate		                               scroll]
$e80018	1.w	R12	X0					               [
$e8001a	1.w	R13	Y0	
$e8001c	1.w	R14	X1					               Graphics
$e8001e	1.w	R15	Y1						       screen
$e80020	1.w	R16	X2					               scroll
$e80022	1.w	R17	Y2	
$e80026	1.w	R19	Y3						       ]
$e80028	1.w	R20	Memory mode/Display mode control
$e8002a	1.w	R21	Simultaneous access/Raster copy/Quick clear plane select
$e8002c	1.w	R22	Raster copy action: Raster number
$e8002e	1.w	R23	Text screen access mask pattern
$e80481	1.b	Active	Image capture/Quick clear/Raster copy control

==============================================================================

・ビデオコントローラ

address	size
$e82000	 256.w	グラフィックパレット
$e82200	  16.w	テキストパレット   (パレットブロック 0)
$e82220	 240.w	スプライトパレット ( 〃 1~15)
$e82400	   1.w	R0 (画面モード設定)
$e82500	   1.w	R1 (プライオリティ制御)
$e82600	   1.w	R2 (特殊プライオリティ/画面表示)

-Video controller

address	size
$e82000	256.w		Graphics palette
$e82200	  16.w		Text palette (Palette block 0)
$e82220	 240.w		Sprite palette ('' 1-15)
$e82400	   1.w	R0	(Screen mode initialization)
$e82500	   1.w	R1	(Priority control)
$e82600	   1.w	R2	(Special priority/screen display)

==============================================================================

・システムポート

address
$e8e001	#1	コントラスト
		bit 3~0	CONTRAST	0:暗い~$f:明るい
$e8e003	#2	ディスプレイ/3D スコープ
		bit 3		TV CTRL	   Read	0:ディスプレイの電源 ON	1:OFF
					  Write	0:Display 制御信号 0	1:制御信号 1
		bit 1		3D-L		0:3Dスコ-プ左シャッタ- CLOSE	1:OPEN
		bit 0		3D-R		0:〃	 右〃	 CLOSE	1:OPEN
$e8e005	#3	カラーイメージユニット(bit 4~0)
$e8e007	#4	キーボード/NMI/ドットクロック
		bit 3		KEY CTRL   Read	0:キーボード非接続	1:接続
					  Write	0:キーデータ送信不可	1:送信可
		bit 2		NMI RESET	0:NMI リセットしない	1:する
		bit 1		HRL		0:分周比 1/2,1/3,1/6	1:1/2,1/4,1/8
$e8e009	#5	ROM/DRAM ウェイト
		bit 7~4	ROM  Wait Control
		bit 3~0	DRAM Wait Control
				ウェイト数は設定値+2. ただし DRAM アクセスは
				スタティックカラム動作中 0、ページ間をまたぐ時は 4.
$e8e00b	#6	MPU 種別/動作クロック
		bit 7~4	MPU Type	$f:68000 $e:68020 $d:68030 $c:68040
		bit 3~0	MPU Clock(MHz)	$f:10 $e:16 $d:20 $c:25 $b:33 $a:40 $9:50
$e8e00d	#7	SRAM 書き込み
		bit 7~0	SRAM Write Enable Control
				$31 で SRAM 書き込み可能.
$e8e00f	#8	本体電源 OFF
		bit 3~0	Power Off Control
				$00,$0f,$0f の順に書き込むと電源 OFF.

System port
address
$e8e001	#1 Contrast
bit 3-0	Contract 0:Dark - $f: light
$e8e003	#2 Display/3D scope
		bit 3		TV CTRL	   Read 0: Display power   ON 		1: OFF
					 Write	0:Display Control signal 0	1: Control signal 1
		bit 1		 3D-L	0:3D Scope left shutter	CLOSE		1:OPEN
		bit 0		3D-R		0: '' right ''	CLOSE		1:OPEN
$e8e005	#3 Color image unit (bit 4-0)
$e8e007	#Keyboard/NMI/dot clock
		bit 3		KEY CTRL   Read	0: Keyboard out of contact      1: LINK
					  Write	0: Invalid transmission	        1: Transmitting
		bit 2		NMI RESET	0:NMI Do not reset	        1: Reset
		bit 1		HRL		0: Dividing ratio 1/2, 1/3, 1/6 1:1/2, 1/4, 1/8
$e8e009	#5	ROM/DRAM Wait
		bit 7-4	ROM  Wait Control
		bit 3-0	DRAM Wait Control
				Wait number = set value+2. However, DRAM access
				= 0 when static RAM is running, and 4 when crossing page space.
$e8e00b	#6	MPU Classification/Operation clock
		bit 7-4	MPU Type	$f:68000 $e:68020 $d:68030 $c:68040
		bit 3-0	MPU Clock(MHz)	$f:10 $e:16 $d:20 $c:25 $b:33 $a:40 $9:50
$e8e00d	#7	SRAM Write
		bit 7-0	SRAM Write Enable Control
				Use $31 to write to SRAM
$e8e00f	#8	 Unit power OFF
		bit 3-0	Power Off Control
				Writing $00, $0f, $0f in sequence turns power OFF

==============================================================================

・SRAM

address	size	初期値
$ed0000	8.b	'X68000',$57	メモリチェックデータ
$ed0008	1.l	$0020_0000	実装メインメモリ容量(SASI:$100000,030:$400000)
$ed000c	1.l	$00fc_0000	ROM 起動アドレス(1.l)へのポインタ
				($fc???? の場合 ID=????/4 の SCSI から起動)
$ed0010	1.l	$00ed_0100	SRAM 起動アドレス
$ed0014	1.l	-1		アラームで起動後、電原 OFF までの時間(分単位)
				(IOCS _ALARMSET の d2.l -1)
$ed0018	1.w	0		最優先ブートデバイス(? はドライブ番号)
				$0000	STD(2HD→HD→ROM→RAM)
				$8?00	 HD?→ HD→STD
				$9?70	2HD?→2HD→STD
				$a000	ROM →ROM→STD
				$b000	RAM →RAM→STD
$ed001a	1.w	$4e07		RS-232C の設定(IOCS _SET232C の引数と同じ)
				bit 15~14 : ストップビット(0,3:2bit 1:1bit 2:1.5bit)
				bit 13~12 : パリティ(0,2:なし 1:奇数 3:偶数)
				bit 11~10 : ビット長(0:5bit 1:6bit 2:7bit 3:8bit)
				bit	 9 : XON/XOFF 処理(0:OFF 1:ON)
				bit	 8 :  SI/SO   処理(0:OFF 1:ON) 使用禁止
				bit  3~ 0 : 転送速度(0:  75 1: 150 2: 300 3: 600
						      4:1200 5:2400 6:4800 7:9600)
					     (X68030 のみ 8:17361BPS も指定可能)

-SRAM
address	size	initial value
$ed0000	8.b	"X68000', $57	Memory check data
$ed0008	1.l	$0020_0000      Main memory implementation capacity (SASI:$100000,030:$400000)
$ed000c	1.l     $00fc_0000	Pointer to ROM startup address (1.l)
				(If $fc???? ID=????/Startup from 4 SCSI)
$ed0010	1.l	$00ed_0100	SRAM Startup address
$ed0014	1.l	-1		Time from startup by alarm until power source OFF (In minutes)
				(IOCS _ALARMSET の d2.l -1)
$ed0018	1.w	0		(Overriding boot device (Drive number = ?)
				$0000	STD(2HD→HD→ROM→RAM)
				$8?00	 HD?→ HD→STD
				$9?70	2HD?→2HD→STD
				$a000	ROM →ROM→STD
				$b000	RAM →RAM→STD
$ed001a	1.w	$4e07		RS-232C configuration (Same argument as IOCS _SET232C)
				bit 15-14: Stop bit (0,3:2bit 1:1bit 2:1.5bit)
				bit 13-12: Parity 0,2: None 1: Odd 3: Even)
				bit 11-10: Bit length (0: 5 bit 1: 6 bit 2: 7 bit 3: 8 bit)
				bit	 9 : XON/XOFF Processing (0:OFF 1:ON)
				bit	 8 :  SI/SO		Processing (0:OFF 1:ON) Use prohibited
				bit 3-0: Transfer speed (0: 75 1: 150 2: 300 3: 600
						      4: 1200 5: 2400 6: 4800 7: 9600)
						(8:17361BPS only available with X68030)

$ed001c	1.b	0		起動時のキー LED の状態(電原 OFF 時の状態が待避されている)
				bit 7	未使用
				bit 6	全角
				bit 5	ひらがな
				bit 4	INS
				bit 3	CAPS
				bit 2	コード入力
				bit 1	ローマ字
				bit 0	かな
				bit = 0 で消灯、1 で点灯
$ed001d	1.b	16		起動時の画面モード(IOCS CRTMOD の d1)
				ROM IOCS 内のエラー表示ルーチンは 16 のモードにのみ対応
				しているので、できるだけ 16 以外の値は設定しない.
				Human68k は常に 16 のモードで起動する.
$ed001e	1.l	0		アラームで起動した時の動作(IOCS _ALARMSET の a1)
				       0:普通に立ち上がる(指定のメディアからブート).
					 OFF するまでの時間が -1 以外なら、指定時間後本体を OFF.
				$01~$3f:テレビをコントロールする.
					 OFF するまでの時間が -1 なら 1 分後本体のみ OFF.
					 それ以外なら指定時間後本体とテレビを OFF.
				$40~	:$000040~$ffffff までのアドレス指定.
					 先頭バイトが $60 ならスーパーバイザのままそのアドレス
					 をコールし、そのサブルーチンから戻ると本体を OFF.
				      -1:普通に立ち上がる(指定のメディアからブート).
					 テレビの制御はしない.
					 OFF するまでの時間が -1 以外なら、指定時間後本体を OFF.

$ed001c	1.b	0		Status of startup time key LED (Status acts as shunt when power source OFF)
				bit 7	Unused
				bit 6	2-byte character
				bit 5	Hiragana
				bit 4	INS
				bit 3	CAPS
				bit 2	Code input
				bit 1	Romaji
				bit 0	Kana
				Not lit if bit = 0, Lit if bit = 1
$ed001d	1.b	16		Start time screen mode (d1 of IOCS CRTMOD)
				Display routine for internal error in ROM IOCS only works in 16 mode,
				so try not to configure any value except 16.
				Human68k always starts in 16 mode.
$ed001e	1.l	0		Operation when started with alarm (a1 of OCS _ALARMSET)
				      0: Normal startup (Boots from designated media).
					If time until switched OFF is not -1, unit turns off after designated time.
				$01-$3f: Controls TV
					If time until switched OFF is -1, unit turns off after 1 minute.
					Otherwise, TV turns off after designated time.
				$40- : Designated addresses from $000040-$ffffff.
					If head byte = $60, supervisor mode calls address and switches
					unit OFF after returning from subroutine.
				     -1: Normal startup (Boots from designated media).
				        Does not control TV.
					If time until switched OFF is not -1, unit turns off after designated time.

$ed0022	1.l	$ffff_0000	アラームで起動する時間(IOCS _ALARMSET の d1)
				bit 31~28	未使用(0)
				bit 27~24	曜日(0~6)
				bit 23~16	日(01~31:BCD2桁)
				bit 15~ 8	時(00~23:BCD2桁)
				bit  7~ 0	分(00~59:BCD2桁)
				それぞれ $f は無視を表す.
$ed0026	1.b	7		アラームの禁止/許可(0:許可 7:禁止)
$ed0027	1.b	0		OPT.2 キーをテレビコントロールに使用するか(0:使用する 1:しない)
$ed0028	1.b	14		コントラストのシステム既定値(0~15)
$ed0029	1.b	0		本体 OFF 時に FD をイジェクトするか(0:イジェクトしない 1:する)
$ed002a	1.b	$0d		本体 OFF 時に行うテレビコントロールのコード
$ed002b	1.b	0		キーボードの配列	0:JIS配列 1:あいうえお配列
$ed002c	1.b	0		電卓の文字フォント	0:LCD	  1:通常のフォント
$ed002d	1.b	0		SRAM 使用状態		0:未使用  1:SRAMDISK  2:プログラム
$ed002e	1.w	$0000		テキストパレット 0 のシステム規定値
$ed0030	1.w	$f83e			〃	 1 〃
$ed0032	1.w	$ffc0			〃	 2 〃
$ed0034	1.w	$fffe			〃	 3 〃
$ed0036	1.w	$de6c			〃	 4~ 7 〃
$ed0038	1.w	$4022			〃	 8~15 〃
$ed003a	1.b	3		キーのオートリピートが始まるまでの時間(0~15) 200+100N[ms]
$ed003b	1.b	2		キーのリピート間隔(0~15)			30+5N・[ms]
$ed003c	1.l	$0008_0000	プリンタタイムアウト時間
$ed0040	1.l	0		SRAM が初期化されてから前回までの積算稼働時間(分)
				本体 OFF 及びソフトウェアリセットごとに積算される.
$ed0044	1.l	0		SRAM が初期化されてから本体が OFF された回数
				本体 OFF ごとに加算される.
$ed0048	1.l	$00ff_dc00	ROMDISK FAT 開始番地(030:$00ff_f400)
(ROM DISK's BPB)

$ed0022	1.l	$ffff_0000      Time started with alarm (d1 of IOCS _ALARMSET)
				bit 31-28	Unused (0)
				bit 27-24	Day of week (0-6)
				bit 23-16	Day (01-31:BCD2 Column)
				bit 15-8		Hour (00-23:BCD2 Column)
				bit 7-0		Minute (00-59:BCD2 Column)
				Each $f indicates a "don't care" term.
$ed0026	1.b	7		Allow alarm/do not allow (0:Allow 7: Do not allow)
$ed0027	1.b	0		Use OPT.2 Key as TV control? (0: Yes 1: No)
$ed0028	1.b	14		Contrast system default value (0-15)
$ed0029	1.b	0		Insert FD when main unit OFF? (0: No 1: Yes)
$ed002a	1.b	$0d		TV controller code for when main unit is OFF
$ed002b	1.b	0		Keyboard setup 0: JIS 1: A-I-U-E-O
$ed002c	1.b	0		Calculator character font 0: LCD 1: Standard
$ed002d	1.b	0		SRAM Usage status	0: Unused 1: SRAMDISK 2: Program
$ed002e	1.w	$0000		Text palette 0 system-defined value
$ed0030	1.w	$f83e		'' 1 ''
$ed0032	1.w	$ffc0		'' 2 ''
$ed0034	1.w	$fffe		'' 3 ''
$ed0036	1.w	$de6c		'' 4-7 ''
$ed0038	1.w	$4022		'' 8-15 ''
$ed003a	1.b	3		Time until key auto-repeat begins (0-15) 200+100N[ms]
$ed003b	1.b	2		Key repeat interval (0-15)		30+5N * [ms]
$ed003c	1.l	$0008_0000      Printer timeout period
$ed0040	1.l	0		Cumulative operation time until previous session after SRAM initialized. (Minutes)
				Increments each time main unit is OFF and software reset.
$ed0044	1.l	0		Number of times main unit turned OFF after SRAM initialized.
				Increments each time main unit turned OFF.
$ed0048	1.l	$00ff_dc00	ROMDISK FAT start address (030:$00ff_f400)
(ROM DISK's BPB)

$ed004c	1.w	1024		1 セクタ当りのバイト数
$ed004e	1.b	1		1 クラスタ当りのセクタ数
$ed004f	1.b	1		FAT 領域の個数
$ed0050	1.w	0		予約領域の個数
$ed0052	1.w	32		ルートディレクトリのエントリ数
$ed0054	1.w	9		全領域のセクタ数(030:3)
$ed0056	1.b	$f9		メディアバイト
$ed0057	1.b	1		FAT 領域 1 個当りのセクタ数

$ed004c	1.w	1024		Numbers of bytes per sector
$ed004e	1.b	1		Number of sectors per cluster
$ed004f	1.b	1		Number of FAT partitions
$ed0050	1.w	0		Number of reserved partitions
$ed0052	1.w	32		Number of root directory entries
$ed0054	1.w	9		Number of total partitioned sectors (030:3)
$ed0056	1.b	$f9	        Media byte
$ed0057	1.b	1		Number of sectors per FAT partition

$ed0058	1.b	0		ROM デバッガの使用(0:OFF 1:ON)
$ed0059	1.b	0		$7c,$7e,$5c(\~|) の文字変換フラグ
				bit 2	0:| 1:|(破線)
				bit 1	0: ̄ 1:~
				bit 0	0:¥ 1:\
$ed005a	1.b	0		SASI-HD 接続台数(0~15)
				指定台数以上は IOCS コールのレベルでエラーになる.
$ed005b	20.b	0		システム予約
(SCSI)

$ed0058	1.b	0		ROM debugger use (0: OFF 1: ON)
$ed0059	1.b	0		$7c,$7e,$5c(\-|) character conversion flag
				bit 2	0:| 1:|(Dashed line)
				bit 1	0: ̄ 1:~
				bit 0	0:¥ 1:\
$ed005a	1.b	0		Number of SASI-HD connections (0-15)
				Exceeding the designated number will cause an error at the IOCS call level.
$ed005b	20.b	0		Reserved for system use
(SCSI)

$ed006f	1.b	0		SCSI 適用フラグ(0:無効 $56='V':有効)
$ed0070	1.b	0		SCSI 関係(bit 7~4 は X68030 以降で有効)
				bit 7	 転送ブロックサイズ(0:256 1:512;$cc0で可変)
				bit 6	 ブート時のデバイスチェック(0:する 1:しない)
				bit 5	 DMA動作モード(0:オートリクエスト最大速度
					 1:初回オートリクエスト、以後は外部要求転送)
				bit 4	 転送モード(0:DMA転送 1:MPU転送)
				bit 3	 SCSIの種類(0:内蔵 1:オプションボード)
				bit 2~0 本体の ID 番号
$ed0071	1.b	0		SASI フラグ
				SCSI に SASI ディスクを接続した時に SASI の ID
				に対応するビットを 1 にする.

$ed006f	1.b	0		SCSI Application flag (0: Invalid $56="V": Valid)
$ed0070	1.b	0		SCSI Connection (bit 7-4 valid on and after X68030)
				bit 7	 Transmission block size (0:256 1:512; changeable with $cc)
				bit 6	 Device check when booting (0: Yes 1: No)
				bit 5	 DMA run mode (0: Maximum auto request rate
					1: Transmission of external requests after first auto-request)
				bit 4	 Transmission mode (0: DMA transmission 1: MPU transmission)
				bit 3	 SCSI type (0: Internal 1: Option board)
				bit 2-0 Main unit ID#
$ed0071	1.b	0		SASI Flag
				When SASI disk is connected to SCSI, change bit that
				corresponds with SASI ID to 1.

(SX-Window)
$ed0072	2.b	0('SX')		SX-Window 環境フラグ('SX'で使用中)
$ed0074	1.b	0(6)		ダブルクリック基準時間÷10
$ed0075	1.b	0(6)		マウススピード÷2
$ed0076	1.b	0(96)		テキストパレット色相(HSV)
$ed0077	1.b	0(2)			〃	彩度
$ed0078	1.b	0($fe2000)		〃	明度 palette 0~3 5bit???
$ed007b	1.b	0		プリンタドライバ(PRTD)ID
$ed007c	1.b	0		SRAM 情報版数,画面状態保存,開始画面保存
$ed007d	1.b	0		デスクトップ背景(PICT)ID
$ed007e	1.b	0		画面モード

(SX-Window)
$ed0072	2.b	0('SX')		SX-Window environment flag (While in use with "SX")
$ed0074	1.b	0(6)		Standard double-click time / 10
$ed0075	1.b	0(6)		Mouse speed / 2
$ed0076	1.b	0(96)		Text palette hue (HSV)
$ed0077	1.b	0(2)			'' chroma
$ed0078	1.b	0($fe2000)		Brightness palette 0-3 5bit???
$ed007b	1.b	0		Printer drive (PRTD) ID
$ed007c	1.b	0		SRAM info version#, screen status storage, start screen storage
$ed007d	1.b	0		Desktop background (PICT) ID
$ed007e	1.b	0		Screen mode

$ed007f	17.b	0		システム予約
(X68030)
$ed0090	1.b	0		標準キャッシュ状態(bit=0:off 1:on)
				bit 1	データキャッシュ
				bit 0	命令キャッシュ
$ed0091	1.b	0		起動時 OPM 演奏(0:OFF -1:ON)
$ed0092	1.b	0		10MHz 相当のウェイト値
$ed0093	1.b	0		16MHz 〃

$ed0094	108.b			システム予約
$ed0100	768.b	0		SRAM プログラムの先頭アドレス
$ed0400	15KB	0		SRAMDISK の先頭アドレス
$ed3fff				SRAM の終わり

備考	  SRAM 初期化時 $ed0000~$ed005a には ROM 中の初期値が書き込まれ、
	$ed005b~$ed00101(X68030 では ~$ed3fff)は 0 が書き込まれる.

$ed007f	17.b	0		Reserved for system use
(X68030)
$ed0090	1.b	0		Standard cache status (bit=0: off 1:on)
				bit 1 Data cache
				bit 0 Command cache
$ed0091	1.b	0		OPM music during startup (0: OFF -1: ON)
$ed0092	1.b	0		10MHz Proper wait value
$ed0093	1.b	0		16MHz ''

$ed0094	108.b			Reserved for system use
$ed0100	768.b	0		Head SRAM program address
$ed0400	15KB	0		Head SRAMDISK address
$ed3fff				End of SRAM

Note: When SRAM initialized, initial value inside ROM is written into $ed0000-$ed005a.
0 is written into $ed005b-$ed00101 (-$ed3fff in X68030).

==============================================================================

・CGROM

address	  font size	type	 count	code(JIS)
$f00000	  全角 16x16	非漢字	  752	High:$21~$78,Low:$21~$7e
$f05e00	   〃  16x16	第一水準 3008	     $30~$4f
$f1d600	   〃  16x16	第二水準 3478	     $50~$74
$f388c0			(未使用)
$f3a000	 1/4角  8x8	ANK	  256	$00~$ff
$f3a800	  半角  8x16	〃	  256	〃
$f3b800	 1/4角 12x12	〃	  256	〃
$f3d000	  半角 12x24	〃	  256	〃
$f40000	  全角 24x24	非漢字	  752	High:$21~$78,Low:$21~$7e
$f4d380	   〃  24x24	第一水準 3008	     $30~$4f
$f82180	   〃  24x24	第二水準 3478	     $50~$74
$fbf3b0			(未使用)
$fbf400	 1/4角  6x12	ANK	  256	$00~$ff(X68030 only)
$ffd018	 1/4角  6x12	ANK	  256	$00~$ff(XVI only)

==============================================================================

-CGROM

address		font size		type		count		code(JIS)
$f00000		Full width, 16x16	Non-Kanji	752		High:$21-$78,Low:$21-$7e
$f05e00		''	''  16x16	First level	3008		$30-$4f
$f1d600		''	''  16x16	Second level	3478		$50-$74
$f388c0		(Unused)
$f3a000		1/4 width,  8x8		ANK		256		$00-$ff
$f3a800		1/2 width,  8x16	''		256		''
$f3b800		1/4 width,  12x12	''		256		''
$f3d000		1/2 width,  12x24	''		256		''
$f40000		Full width, 24x24	Non-Kanji	752		High:$21-$78,Low:$21-$7e
$f4d380		''	''  24x24	First level	3008		$30-$4f
$f82180		''	''  24x24	Second level	3478		$50-$74
$fbf3b0		(Unused)
$fbf400		1/4 width   6x12	ANK		256		$00-$ff(X68030 only)
$ffd018		1/2 width   6x12	ANK		256		$00-$ff(XVI only)

・割り込み

level	device	level2	vector	factor
7	NMI	---	$1f	INTERRUPT スイッチ(オートベクタ)
6	MFP	15	$4f	CRTC H-SYNC(水平同期信号)
	│	14	$4e	CRTC 指定ラスタ走査
	│	13	$4d	Timer-A(V-DISP を入力とするタイマ)
	│	12	$4c	キーデータ受信
	│	11	$4b	〃	  受信エラー
	│	10	$4a	〃	  送信
	│	 9	$49	〃	  送信エラー
	│	 8	---	USART シリアルクロック発生
	│	 7	$47	RTC 1Hz クロック
	│	 6	$46	CRTC V-DISP(垂直表示信号)
	│	 5	$45	Timer-C(8bit 汎用タイマ)
	│	 4	$44	Timer-D(〃)
	│	 3	$43	OPM
	│	 2	$42	本体全面スイッチ  ON/OFF 検出
	│	 1	$41	拡張 I/O スロット 〃
	└	 0	$40	RTC アラーム      〃
5	SCC	---	$50-$5f	RS-232C/マウスデータ受信
4	---	---	---	拡張 I/O スロット用
3	DMAC	---	$64-$6b	DMA 転送終了/エラー
2	---	---	---	拡張 I/O スロット用
1	IOC	 3	$60	FDC
	│	 3	$61	FD
	│	 1	$62	HD
	└	 0	$63	プリンタ(BUSY 信号)

-Interrupt
level	device	level2	vector		factor
7	NMI	--	$1f		Interrupt switch (Auto vector)
6	MFP	15	$4f		CRTC H-SYNC(Horizontal synchronizing signal)
	''	14	$4e		CRTC designated raster scanning
	''	13	$4d		Timer-A(Inputs V-DISP)
	''	12	$4c		Key data reception
	''	11	$4b		'' reception error
	''	10	$4a		'' transmission
	''	9	$49		'' transmission error
	''	8	--		USART serial clock generation
	''	7	$47		RTC 1Hz clock
	''	6	$46		CRTC V-DISP(Vertical display signal)
	''	5	$45		Timer-C(Generic 8-bit timer)
	''	4	$44		Timer-D ('')
	''	3	$43		OPM
	''	2	$42		Main unit full switch ON/OFF detection
	''	1	$41		I/O expansion slot ''
	''	0	$40		RTC alarm ''
5	SCC	--	$50-$5f		RS-232C/Mouse data reception
4	--	--	--		Used for I/O expansion slot
3	DMAC	--	$64-$6b	        DMA end transfer/error
2	--	--	--		Used for I/O expansion slot
1	IOC	3	$60		FDC
	''	3	$61		FD
	''	1	$62		HD
	''	0	$63		Printer (busy signal)


==============================================================================

・Xファイルヘッダの構造

offset	size
$00	2.b	識別子 'HU'(0x48 0x55)
$02	1.b	予約(0)
$03	1.b	ロードモード(0:通常 1:最小ブロック 2:高位アドレス)
$04	1.l	ベースアドレス
$08	1.l	実行開始アドレス
$0c	1.l	テキストセクションサイズ
$10	1.l	データセクションサイズ
$14	1.l	ブロックストレージセクションサイズ(.comm .stack を含む)
$18	1.l	再配置情報サイズ
$1c	1.l	シンボルテーブルサイズ
$20	1.l	SCD 行番号テーブルサイズ
$24	1.l	SCD シンボルテーブルサイズ
$28	1.l	SCD 文字列テーブルサイズ
$2c	4.l	予約(0)
$3c	1.l	バインドされたモジュールリストのファイル先頭からの位置

-X file header structure
offset	size
$00		2.b	Identifier 'HU'(0x48 0x55)
$02		1.b	Reserved (0)
$03		1.b	Load mode (0: Normal 1: Smallest block 2: High address)
$04		1.l		Base address
$08		1.l		Run (execution) address
$0c		1.l		Text section size
$10		1.l		Data section size
$14		1.l		Block storage section size (Contains .comm .stack)
$18		1.l		Reallocation info size
$1c		1.l		Symbol table size
$20		1.l		SCD line number table size
$24		1.l		SCD symbol table size
$28		1.l		SCD Character string table size
$2c		4.l		Reserved (0)
$3c		1.l		Position from bound module list top-of-file


計 64($40)バイト

  実行ファイルは、ベースアドレスにロードして再配置処理が行われた状態で格納され
ている. よって、実際のロードアドレスがベースアドレスと等しければ再配置は行わな
くて良い. また両者が等しくない場合は、その差を足す.

Total 64 bytes ($40)

Load the executable file to the base address and it will be stored there in the event of
reallocation processing. Therefore, if the actual load address is equal to the base address,
reallocation is not necessary. If the pair is not equal, then add the difference.

・再配置処理

  再配置は以下の手続きを再配置情報のサイズ分繰り返す事によって行われる.

1) プログラム先頭アドレスを A、ベースアドレスを B とする.
2) A から B を引き、これを C とする.
3) 再配置情報から 1 ワード収得し、D とする.
4) D が 1 の場合、再配置情報から 1 ロングワード収得し、新しい D とする.
5) D の最下位ビットが 0(偶数)の場合は、A に D を加算し、A のアドレスからの
   1 ロングワードに C を足す.
6) D の最下位ビットが 1(奇数)の場合は、A に D-1 を加算し、A のアドレスからの
   1 ワードに C を足す(ワードサイズの再配置は通常使われる事はない.).

-Reallocation processing

Reallocation is carried out by repeating the steps below with each section
of the reallocated info size.

1) Make program's head address A and base address B.
2) Subtract B from A. This is C.
3) Perform one-word acquisition from reallocation info. This is D.
4) If D = 1, perform one long-word acquisition from reallocation info. This is now D.
5) If D's least significant bit = 0 (even number), add D to A, and add C to one long-word
from A's address.
6) If D's least significant bit = 1 (odd number), add (D-1) to A, and add C to one long-word
from A's address. (Word size reallocation is not commonly used.)

・Zファイルヘッダの構造

offset	size
$00	1.w	第一識別子 $601a
$02	1.l	テキストセクションサイズ
$06	1.l	データセクションサイズ
$0a	1.l	ブロックストレージセクションサイズ(.comm .stack を含む)
$0e	8.b	予約(0)
$16	1.l	実行開始アドレス
$1a	1.w	第二識別子 $ffff

-Z file header structure
offset	size
$00		1.w		First identifier $601a
$02		1.l		Text section size
$06		1.l		Data section size
$0a		1.l		Block storage section size (Contains .comm .stack)
$0e		8.b		Reserved (0)
$16		1.l		Run (execution) address
$1a		1.w		Second identifier $ffff

計 28($1c)バイト

・バインドリストの構造

offset	size
$00	8.b	ファイル名($e5 で始まるファイル名は $05 とする. 残りはスペース
		で埋める.)
$08	3.b	拡張子(残りはスペースで埋める)
$0b	1.b	属性(%XLAD_VSHR. ただし ASHR 以外を指定しても当然エラーになる)
$0c	10.b	8 バイト以上のファイル名の残り(残りは $00 で埋める)
$16	1.w	最終変更時刻
		%mmmS_SSSS_HHHH_HMMM(H:時 Mm:分 S:秒)
$18	1.w	最終変更年月日
		%mmmD_DDDD_YYYY_YYYM(Y:年 Mm:月 D:日)
$1a	1.b	特殊属性の変更禁止フラグ┐BIND.X で使用
$1b	1.b	特殊属性(%00A0_0SHR)	┘
$1c	1.l	バインドファイル先頭からのオフセット

Total of 28 ($1c) bytes

-Bind list structure

offset	size		

$00		8.b		File name (Start file name at $e5 and go to $05. Fill rest with spaces.)
$08		3.b		Extension (Fill rest with spaces.)
$0b		1.b		Attribute (%XLAD_VSHR. However, even if you designate everything but ASHR,
                                it may naturally produce an error.)
$0c		10.b		Remainder of a file name that exceeds 8 bytes (Remainder filled in with $00.)
$16		1.w		Time of last change
			        %mmmS_SSSS_HHHH_HMMM (H: Hour Mm: Minute S: Second)
$18		1.w		Date of last change
			        %mmmD_DDDD_YYYY_YYYM(Y: Year Mm: Month: D: Day)
$1a		1.b		Prohibited change flag for special attributes		[Used with
$1b		1.b		Special attributes (%00A0_0SHR)				BIND.X]
$1c		1.l		Offset from start of bind file

計 32($20)バイト

  ディレクトリエントリとほぼ同じだが、最終変更時間の上下バイトは逆転しているの
で注意すること.
  リストの終了条件はファイルの残りが 0 byte で終わり、32bytes以上で続きがあり、
それ以外(1~31bytes)は異常な構造となる.

Total of 32 ($20) bytes

Similar to direct entry, but the hi/low byte of last change date is reversed, so be careful.
List termination condition ends when file has 0 bytes remaining and continues if file has more than 32 bytes.
Anything else (1-31 bytes) results in abnormal structure.

==============================================================================

・ディスクマップ

	2HD

sector
     0		IPL
 1~ 2		第一 FAT
 3~ 4		第二 FAT(未使用)
 5~10		ルートディレクトリ(6 セクタ)
11~1231	データエリア

-Disk Map

2HD

sector
   0			IPL
1-2			FAT1
3-4			FAT2 (Unused)
5-10			Root directory (6 sectors)
11-1231	Data area

	ハードディスク

sector
     0		HD IPL メニュープログラム
     4		管理情報用システム領域
 5~20		空き
21~24		HD IPL
25~??		第一 FAT
??~??		第二 FAT(未使用)
??~??		ルートディレクトリ(16 セクタ)
??~??		データエリア
??~??		管理外エリア(代替トラック用)

Hard disk

sector
   0		HD IPL Menu program
   4		System area used for management information
5-20		Empty
21-24	HD IPL
25-??	FAT1
??-??	FAT2 (Unused)
??-??	Root directory (16 sectors)
??-??	Data area
??-??	Outside management area (used for alternative tracks)

2HD IPL
	  $2000 から動くプログラムで、起動したドライブの 5 レコード目(ルートデ
	ィレクトリの先頭 32 個分)から HUMAN.SYS を探し、それが X 形式の $6800
	から動く実行ファイルであれば、それをロードして実行する.
	  この IPL はディスクフォーマット時に書き込まれる.
	  18~20 バイト目に全セクタ数(下位から上位の順)、21 バイト目にメディア
	タイプが書き込まれている.

2HD IPL
A program that moves from $2000. Search for HUMAN.SYS from the record #5 of the booted-up drive
(the head 32 parts of the root directory). Then, if it's an executable file that can be moved
from xformat $6800, load and execute it.
This IPL will be written to during disk formatting.
Media type will be written to all sectors in the 18-20 byte range (from low to hi bytes) and byte 21.

第一 FAT
	  FAT(File Allocation Table)とは、ファイルのディスク上のつながりを管理
	するもので、ファイル 1024 バイトに対し一個のファイルが使われる. ただし、
	FAT が先に確保される関係で、0 バイトのファイルでも一個の FAT が使われ
	る. 以後 1024 バイト単位で一個ずつ増える.
	  FAT 領域の先頭二個分はシステムで決められており、2HD の場合は $feffff
	の 3 バイト、ハードディスクの場合は領域確保の容量により 4MB までは
	$f8ffff の 3 バイト、5MB 以上は $f8ffffff の 4 バイトになる.
	FAT には 1.5byteFAT と 2byteFAT があり、4MB までは 1.5byteFAT、5MB か
	ら 2byteFAT となる.

	1.5byteFAT	fe ff ff ML lH hm ・・・・		HML hml の順に読む
	  2byteFAT	f8 ff ff ff AB CD ab cd ・・・・	ABCD abcd 〃

┌─────┬──────┬──────────┐
│1.5byteFAT│	2byteFAT  │	内	容	│
├─────┼──────┼──────────┤
│	$000│	     $0000│未使用エリア	│
│$002~$ff6│$0002~$fff6│次の FAT 番号	│
│	$ff7│	     $fff7│使用不能クラスタ	│
│$ff8~$fff│$fff8~$ffff│このクラスタで終わり│
└─────┴──────┴──────────┘

	FAT 終端は通常 $fff、$ffff を使用する(それ以外は対応していない).

ディレクトリエントリ

offset	size
$00	8.b	ファイル名(先頭一文字が $e5 なら消されたファイル、$00 ならディ
		レクトリの終わり. $e5 で始まるファイル名は $05 とする. 残りは
		スペースで埋める.)
$08	3.b	拡張子(残りはスペースで埋める)
$0b	1.b	属性(%XLAD_VSHR)
$0c	10.b	8 バイト以上のファイル名の残り(残りは $00 で埋める)
$16	1.w	最終変更時刻
		%mmmS_SSSS_HHHH_HMMM(H:時 Mm:分 S:秒)
$18	1.w	最終変更年月日
		%mmmD_DDDD_YYYY_YYYM(Y:年 Mm:月 D:日)
$1a	1.w	最初の FAT 番号
$1c	1.l	ファイルサイズ

注意	16~$1c のワード/ロングワードデータのバイトの並びは little-endian.

HD IPL メニュープログラム
	  $2000 から動作し、HD を複数のシステムで使用する場合どのシステムを起
	動するかを選択するプログラム.
	  単体のシステムで全ての領域を確保している場合は、単に HD IPL を $2400
	にロードして実行するだけ.
	  この IPL はディスクフォーマット時に書き込まれる.

管理情報用システム領域
	  HD 上に複数のシステムを確保する場合の情報を書き込む.
	管理情報は 16 バイトずつ 16 のブロックに分けられ、先頭の 1 ブロックに
	はドライブの情報、残りの 15 ブロックにはシステムの情報が書かれる.

	(1)先頭のドライブ情報ブロック
	4.b	'X68K'
	1.l	最大レコード番号
	1.l	代替トラックの先頭のレコード番号
	1.l	シッピングゾーンのレコード番号
	(2)その他の 15 ブロック
	8.b	システム名
	1.l	先頭レコード番号
	1.l	レコード長

	  先頭レコードの最上位 8 ビットが 0 でない場合は、現在無効な領域となる.
	データは FORMAT の初期化で書き込まれる.
	  先頭の 16 バイト以外は、FORMAT の領域確保/選択/解放で書き換えられる.

(参考)ドライブ情報ブロックの値
容量	最大レコード	代替レコード	HD OFF レコード
10MB	$09f54		$09f54		$0af50
20MB	$139c8		$139c8		$15660
40MB	$27930		$27930		$2acc0

HD IPL
	  $2400 から動作し、起動したドライブのルートディレクトリの先頭 32 個の
	中から HUMAN.SYS を探し、それが X 形式の $6800 から動く実行ファイルで
	あれば、それをロードして実行する. ただしこのファイルは連続セクタにコピ
	ーされていなければならない.

管理外エリア(代替トラック用)
	  通常は使用されない. 不良トラックの代替用である.

==============================================================================

・システムファイル

タイトル表示ファイル
	  Human68k は起動時に TITLE.SYS というファイルがあると、標準のタイトル
	を出さずに、TITLE.SYS に従ったタイトルを表示する.
	  TITLE.SYS は $10044 バイト以下のファイルで、テキストタイトルとビット
	イメージタイトルの二種類がある.
	  テキストタイトルはコマンドモード用に用意されたもので、タイトル表示フ
	ァイルの文字列を表示する. 制御コード、エスケープシーケンスも使用可能で
	あるが、先頭 1 バイトが 0 であってはいけない.
	  ビットイメージタイトルはビジュアル用で、ビットイメージデータを表示す
	る. 先頭 1 バイトが 0 でなければならない. 文字属性が 0 の場合はカーソ
	ル及びファンクションキーが消去される.

offset	size
 0	1.b	0(固定)
 1	1.b	文字属性
 2	1.b	塗りつぶすテキスト画面の指定(0:塗りつぶす面はない
		1:テキスト 2:テキスト1 4:テキスト2 8:テキスト3)
 3	1.b	表示するテキスト画面の指定(1,2,4,8:同上)
 4	1.w	テキストカラー 4~ 7 のパレット
 6	1.w	〃	       8~15 〃
 8	52.b	シェルの指定("SHELL ="の右辺),0
60	1.w	表示開始X座標
62	1.w	〃	Y座標
64	1.w	ビットイメージデータのX方向のドット数
66	1.w	〃		      Y〃
68	???	ビットイメージデータ

外字ファイル
	  Human68k は起動時に USKCG.SYS というファイルがあると、外字ファイルと
	して OS 内の外字エリアに読み込む.
	  USKCG.SYS は $10000 バイト以下のファイルで、その作成/修正は USKCGM.X
	で行なう.
	  全角の漢字コードは JIS,S-JIS のどちらでもかまわないが、JIS 漢字コー
	ドは low/high が逆になっているので注意すること.

offset	size
0	34.b	未使用
34	 1.w	漢字コード
36	16.w	フォントデータ
	 1.w	半角外字 S-JIS コード
	16.b	フォントデータ
	…
	 1.w	16x16 から 24x24 への切り換えコード($ffff)
	 1.w	漢字コード
	72.b	フォントデータ
	 1.w	半角外字 S-JIS コード
	48.b	フォントデータ

キー定義ファイル
	  Human68k は起動時に KEY.SYS というファイルがあると、ファンクションキ
	ーのデータとして定義する.
	  KEY.SYS は 712 バイトのファイルで、KEY.X によって作成/変更する.
	  先頭が $fe で始まるキーは、$fe 以降 8 文字は表示用として使われ、9 文
	字目からが本当のキーコードとなる. 文字列は必ず 0 で終わらなければなら
	ない.

offset	size
  0	32.b*10	F0~F9
320	32.b*10	Shift+F0~F9
640	6.b	ROLL UP
646	6.b	ROLL DOWN
652	6.b	INS
658	6.b	DEL
664	6.b	上向きカーソルキー
670	6.b	左〃
676	6.b	右〃
682	6.b	下〃
688	6.b	CLR
694	6.b	HELP
700	6.b	HOME
706	6.b	UNDO

ビープ音声ファイル
	  Human68k は CONFIG.SYS で "BELL = BEEP.SYS" と指定すると、BEEP.SYS
	を ADPCM のデータファイルとして、OS 内に読み込む.
	  データはサンプリング周波数 15.6KHz で $ffff バイト以内の、ADPCM から
	読み込んだもの.

==============================================================================

・ASCII 制御コード

$00	NUL	空白		    :Null
$01	SOH	ヘディング開始	TC 1:Start of Heading
$02	STX	テキスト開始	TC 2:Start of Text
$03	ETX	テキスト終結	TC 3:End of Text
$04	EOT	伝送終了	TC 4:End of Transmission
$05	ENQ	問い合わせ	TC 5:Enquiry
$06	ACK	肯定応答	TC 6:Acknowledge
$07	BEL	警告ベル	    :Bell
$08	BS	後退		FE 0:Back Space
$09	HT	水平タブ	FE 1:Horizontal Tabulation
$0a	LF	改行		FE 2:Line Feed
$0b	VT	垂直タブ	FE 3:Vertical   Tabulation
$0c	FF	書式送り	FE 4:From Feed
$0d	CR	復帰		FE 5:Carriage Return
$0e	SO	シフトアウト	    :Shift Out
$0f	SI	シフトイン	    :Shift In
$10	DLE	伝送制御拡張	TC 7:Data Link Escape
$11	DC1	装置制御 1	DC 1:Device Control 1
$12	DC2	装置制御 2	DC 2:〃		    2
$13	DC3	装置制御 3	DC 3:〃		    3
$14	DC4	装置制御 4	DC 4:〃		    4
$15	NAK	否定応答	TC 8:Negative Acknowledge
$16	SYN	同期信号	TC 9:Synchronous idle
$17	ETB	伝送ブロック終結	TC10:End of Transmission Bock
$18	CAN	取り消し	    :Cancel
$19	EM	媒体終端	    :End of Medium
$1a	SUB	置換キャラクタ	    :Substitute Character
$1b	ESC	拡張		    :Escape
$1c	FS(→)	ファイル  分離キャラクタ	IS 4:File Separator
$1d	GS(←)	グル-プ分離キャラクタ	IS 3:Group	〃
$1e	RS(↑)	レコ-ド 分離キャラクタ	IS 2:Record	〃
$1f	US(↓)	ユニット  分離キャラクタ	IS 1:Unit	〃
$20	SPC	間隔		    :Space
$7f	DEL	削除		    :Delete

TC = 伝送制御キャラクタ		Transmission Control Characters
FE = 書式制御キャラクタ		Format Effectors
DC = 装置制御キャラクタ		Device Control Characters
IS = 情報分離キャラクタ		Infomation Separators

・IOCS で有効な ASCII 制御コード

$07	BEL	ベルを鳴らす
$08	BS	1 文字左に移動
$09	HT	次のタブ位置に移動(最大タブ位置より右側で 1 行下の 1 桁目に移動)
$0a	LF	1 行下に移動(最終行で 1 行繰り上がる)
$0b	VT	1 行上に移動(先頭行の時は無効)
$0c	FF	1 文字右に移動
$0d	CR	左端に移動
$1a	SUB	画面消去後先頭行左端に移動
$1b	ESC	エスケープシーケンスの開始
$1e	RS	先頭行左端に移動

==============================================================================

・エスケープシーケンス

[pl;pcH	移動(pl=0 または省略時 pl=1、pl>最終行の時 pl=最終行)
		    (pc=0 または省略時 pc=1、pc>最終桁の時 pc=最終桁)
[pl;pcf	同上
=lc		同上(l,c は行・桁位置に $20 を加算した文字で、省略不可)
[pnA		pn   行上に移動(pn=0 または省略時 pn=1)
[pnB		pn   行下〃
[pnC		pn 文字右〃
[pnD		pn 文字左〃
[0J		カーソル位置から最終行最終桁まで消去(0 は省略可能)
[1J		先頭行左端からカーソル位置まで消去
[2J		画面消去後先頭行左端に移動
*		同上
[0K		カーソル位置から最終桁まで消去(0 は省略可能)
[1K		左端からカーソル位置まで消去
[2K		カーソル行消去
[pnM		カーソル行から下に pn 行削除(pn=0 または省略時 pn=1)
		削除した行より後の行が繰り上がり、繰り上がった行の先頭行左端に移動
[pnL		カーソル行から下に pn 行空行を挿入(pn=0 または省略時 pn=1)
		カーソル行より下の行が繰り下がり、挿入された行の先頭行左端に移動
D		1 行下      に移動(最終行で 1 行繰り上がる)
E		1 行下の左端〃
M		1 行上に移動(先頭行で 1 行繰り下がる)
[s		カーソル位置と文字表示属性を保存する
[u		保存したカーソル位置と文字表示属性に戻す
[6n		実行後コンソール入力の度にカーソル位置を ESC[pl;pcR の形で通知する
[>5l	カーソルを表示する
[>5h	カーソルを消去する
[>1l	ファンクションキー行を消去・解放し、先頭行左端に移動
[>1h	〃		      表示・占有し、〃
[psm		文字表示属性を設定する(ps は ; で区切って複数指定可能、省略時 ps=0)
		ps	機能
		0	初期設定に戻す
		1	強調トグル(30~33,40~43 と 34~37,44~47 を交互に変更する)
		7	逆転トグル(30~33,34~37 と 40~43,44~47 〃)
		30~33	黒,水色,黄色,白
		34~37	〃		    強調
		40~43	〃		逆転
		44~47	〃		逆転強調

ROM IOCS version 1.3 / IOCS.X・HIOCS.X 組み込み時:
[?4h	スムーススクロールにする
[?4l	ジャンプ〃
[pnP		カーソル位置から pn 文字削除
[pnX		カーソル位置から pn 文字属性オフにして消去
[pn@		カーソル位置に pn 個の空白文字を属性オフの状態で挿入

CONDRV.SYS 組み込み時:
0		バックスクロールバッファへの取り込みを中断する
1		〃				      再開する

CONDRV.SYS + HIOCS PLUS 組み込み時:
0		上記参照
1		〃
2		システムステータスの表示を禁止する
3		〃			  許可する

注意	カーソル移動シーケンスで、移動できない位置を指定した場合は移動しない.

==============================================================================