Translate source code in x68k (#289)

* Translate code comments

* Remove documentation that is contained in wiki

* Translate code comments

* Remove documentation that is contained in wiki

* Translate configuration file

* Remove documentation that is covered by wiki

* Translate code comments

* Translate strings and code comments

* Cleanup
This commit is contained in:
Daniel Markstedt 2021-10-01 13:23:53 -07:00 committed by GitHub
parent 6d32a8d102
commit af4e3dfe80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 787 additions and 870 deletions

View File

@ -1,11 +0,0 @@
X68000 commands for the management tool (rasctl)
Overview
This is a program for using the RaSCSI management tool (rasctl) to interface with
a real X68000 computer running Human68k over the RaSCSI bridge device.
Description
It has the exact same functionality as the management tool (rasctl) running on
the Raspberry Pi, so please refer to the RaSCSI documentation for instructions.

File diff suppressed because it is too large Load Diff

View File

@ -3,9 +3,9 @@
// SCSI Target Emulator RaSCSI (*^..^*) // SCSI Target Emulator RaSCSI (*^..^*)
// for Raspberry Pi // for Raspberry Pi
// //
// Powered by XM6 TypeG Technorogy. // Powered by XM6 TypeG Technology.
// Copyright (C) 2016-2017 GIMONS // Copyright (C) 2016-2017 GIMONS
// [ ホストファイルシステム ブリッジドライバ ] // [ Host Filesystem Bridge Driver ]
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -30,7 +30,7 @@ typedef int BOOL;
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
// 定数定義 // Constant definitions
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
#define FILEPATH_MAX _MAX_PATH #define FILEPATH_MAX _MAX_PATH
@ -38,219 +38,218 @@ typedef int BOOL;
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
// ステータスコード定義 // Status code definitions
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
#define FS_INVALIDFUNC 0xFFFFFFFF // 無効なファンクションコードを実行した #define FS_INVALIDFUNC 0xFFFFFFFF // Executed an invalid function
#define FS_FILENOTFND 0xFFFFFFFE // 指定したファイルが見つからない #define FS_FILENOTFND 0xFFFFFFFE // The selected file can not be found
#define FS_DIRNOTFND 0xFFFFFFFD // 指定したディレクトリが見つからない #define FS_DIRNOTFND 0xFFFFFFFD // The selected directory can not be found
#define FS_OVEROPENED 0xFFFFFFFC // オープンしているファイルが多すぎる #define FS_OVEROPENED 0xFFFFFFFC // There are too many files open
#define FS_CANTACCESS 0xFFFFFFFB // ディレクトリやボリュームラベルはアクセス不可 #define FS_CANTACCESS 0xFFFFFFFB // Can not access the direcory or volume
#define FS_NOTOPENED 0xFFFFFFFA // 指定したハンドルはオープンされていない #define FS_NOTOPENED 0xFFFFFFFA // The selected handle is not opened
#define FS_INVALIDMEM 0xFFFFFFF9 // メモリ管理領域が破壊された #define FS_INVALIDMEM 0xFFFFFFF9 // Memory management has been destroyed
#define FS_OUTOFMEM 0xFFFFFFF8 // 実行に必要なメモリがない #define FS_OUTOFMEM 0xFFFFFFF8 // Insufficient memory for execution
#define FS_INVALIDPTR 0xFFFFFFF7 // 無効なメモリ管理ポインタを指定した #define FS_INVALIDPTR 0xFFFFFFF7 // Selected an invalid memory management pointer
#define FS_INVALIDENV 0xFFFFFFF6 // 不正な環境を指定した #define FS_INVALIDENV 0xFFFFFFF6 // Selected an invalid environment
#define FS_ILLEGALFMT 0xFFFFFFF5 // 実行ファイルのフォーマットが異常 #define FS_ILLEGALFMT 0xFFFFFFF5 // The exeucted file is in an invalid format
#define FS_ILLEGALMOD 0xFFFFFFF4 // オープンのアクセスモードが異常 #define FS_ILLEGALMOD 0xFFFFFFF4 // Invalid open access mode
#define FS_INVALIDPATH 0xFFFFFFF3 // ファイル名の指定に誤りがある #define FS_INVALIDPATH 0xFFFFFFF3 // Mistake in selected file name
#define FS_INVALIDPRM 0xFFFFFFF2 // 無効なパラメータでコールした #define FS_INVALIDPRM 0xFFFFFFF2 // Called with an invalid parameter
#define FS_INVALIDDRV 0xFFFFFFF1 // ドライブ指定に誤りがある #define FS_INVALIDDRV 0xFFFFFFF1 // Mistake in selected drive
#define FS_DELCURDIR 0xFFFFFFF0 // カレントディレクトリは削除できない #define FS_DELCURDIR 0xFFFFFFF0 // Unable to delete the current directory
#define FS_NOTIOCTRL 0xFFFFFFEF // IOCTRLできないデバイス #define FS_NOTIOCTRL 0xFFFFFFEF // Unable to use IOCTRL with the device
#define FS_LASTFILE 0xFFFFFFEE // これ以上ファイルが見つからない #define FS_LASTFILE 0xFFFFFFEE // Can not find any more files
#define FS_CANTWRITE 0xFFFFFFED // 指定のファイルは書き込みできない #define FS_CANTWRITE 0xFFFFFFED // Selected file can not be written
#define FS_DIRALREADY 0xFFFFFFEC // 指定のディレクトリは既に登録されている #define FS_DIRALREADY 0xFFFFFFEC // Selected directory is already registered
#define FS_CANTDELETE 0xFFFFFFEB // ファイルがあるので削除できない #define FS_CANTDELETE 0xFFFFFFEB // Can not delete because of a file
#define FS_CANTRENAME 0xFFFFFFEA // ファイルがあるのでリネームできない #define FS_CANTRENAME 0xFFFFFFEA // Can not rename because of a file
#define FS_DISKFULL 0xFFFFFFE9 // ディスクが一杯でファイルが作れない #define FS_DISKFULL 0xFFFFFFE9 // Can not create a file because the disk is full
#define FS_DIRFULL 0xFFFFFFE8 // ディレクトリが一杯でファイルが作れない #define FS_DIRFULL 0xFFFFFFE8 // Can not create a file because the directory is full
#define FS_CANTSEEK 0xFFFFFFE7 // 指定の位置にはシークできない #define FS_CANTSEEK 0xFFFFFFE7 // Can not seek in the selected location
#define FS_SUPERVISOR 0xFFFFFFE6 // スーパーバイザ状態でスーパバイザ指定した #define FS_SUPERVISOR 0xFFFFFFE6 // Selected supervisor in supervisor mode
#define FS_THREADNAME 0xFFFFFFE5 // 同じスレッド名が存在する #define FS_THREADNAME 0xFFFFFFE5 // A thread with this name already exists
#define FS_BUFWRITE 0xFFFFFFE4 // プロセス間通信のバッファが書込み禁止 #define FS_BUFWRITE 0xFFFFFFE4 // Writing to inter-process communication buffers is disallowed
#define FS_BACKGROUND 0xFFFFFFE3 // バックグラウンドプロセスを起動できない #define FS_BACKGROUND 0xFFFFFFE3 // Unable to start a background process
#define FS_OUTOFLOCK 0xFFFFFFE0 // ロック領域が足りない #define FS_OUTOFLOCK 0xFFFFFFE0 // Insufficient lock space
#define FS_LOCKED 0xFFFFFFDF // ロックされていてアクセスできない #define FS_LOCKED 0xFFFFFFDF // Can not access because it is locked
#define FS_DRIVEOPENED 0xFFFFFFDE // 指定のドライブはハンドラがオープンされている #define FS_DRIVEOPENED 0xFFFFFFDE // Selected drive has an open handler
#define FS_LINKOVER 0xFFFFFFDD // シンボリックリンクネストが16回を超えた #define FS_LINKOVER 0xFFFFFFDD // The symbolic link is nested over 16 times
#define FS_FILEEXIST 0xFFFFFFB0 // ファイルが存在する #define FS_FILEEXIST 0xFFFFFFB0 // The file exists
#define FS_FATAL_MEDIAOFFLINE 0xFFFFFFA3 // メディアが入っていない #define FS_FATAL_MEDIAOFFLINE 0xFFFFFFA3 // No media inserted
#define FS_FATAL_WRITEPROTECT 0xFFFFFFA2 // 書き込み禁止違反 #define FS_FATAL_WRITEPROTECT 0xFFFFFFA2 // Write protected
#define FS_FATAL_INVALIDCOMMAND 0xFFFFFFA1 // 不正なコマンド番号 #define FS_FATAL_INVALIDCOMMAND 0xFFFFFFA1 // Invalid command number
#define FS_FATAL_INVALIDUNIT 0xFFFFFFA0 // 不正なユニット番号 #define FS_FATAL_INVALIDUNIT 0xFFFFFFA0 // Invalid unit number
#define HUMAN68K_PATH_MAX 96 // Human68kのパス最大長 #define HUMAN68K_PATH_MAX 96 // Longest path allowed in Human68k
//=========================================================================== //===========================================================================
// //
/// Human68k 名前空間 /// Human68k name space
// //
//=========================================================================== //===========================================================================
/// ファイル属性ビット /// File attribute bit
enum attribute_t { enum attribute_t {
AT_READONLY = 0x01, // 読み込み専用属性 AT_READONLY = 0x01, // Read only attribute
AT_HIDDEN = 0x02, // 隠し属性 AT_HIDDEN = 0x02, // Hidden attribute
AT_SYSTEM = 0x04, // システム属性 AT_SYSTEM = 0x04, // System attribute
AT_VOLUME = 0x08, // ボリュームラベル属性 AT_VOLUME = 0x08, // Volume label attribute
AT_DIRECTORY= 0x10, // ディレクトリ属性 AT_DIRECTORY = 0x10, // Directory attribute
AT_ARCHIVE = 0x20, // アーカイブ属性 AT_ARCHIVE = 0x20, // Archive attribute
AT_ALL = 0xFF, // 全ての属性ビットが1 AT_ALL = 0xFF, // All attribute bits are 1
}; };
/// ファイルオープンモード /// File open modes
enum open_t { enum open_t {
OP_READ = 0, // 読み込み OP_READ = 0, // Read
OP_WRITE = 1, // 書き込み OP_WRITE = 1, // Write
OP_FULL = 2, // 読み書き OP_FULL = 2, // Read/Write
OP_MASK = 0x0F, // 判定用マスク OP_MASK = 0x0F, // Decision mask
OP_SHARE_NONE = 0x10, // 共有禁止 OP_SHARE_NONE = 0x10, // Sharing forbidden
OP_SHARE_READ = 0x20, // 読み込み共有 OP_SHARE_READ = 0x20, // Read sharing
OP_SHARE_WRITE = 0x30, // 書き込み共有 OP_SHARE_WRITE = 0x30, // Write sharing
OP_SHARE_FULL = 0x40, // 読み書き共有 OP_SHARE_FULL = 0x40, // Read/Write sharing
OP_SHARE_MASK = 0x70, // 共有判定用マスク OP_SHARE_MASK = 0x70, // Sharing decision mask
OP_SPECIAL = 0x100,// 辞書アクセス OP_SPECIAL = 0x100, // Dictionary access
}; };
/// シーク種類 /// Seek types
enum seek_t { enum seek_t {
SK_BEGIN = 0, // ファイル先頭から SK_BEGIN = 0, // From the beginning of a file
SK_CURRENT = 1, // 現在位置から SK_CURRENT = 1, // From the current location
SK_END = 2, // ファイル末尾から SK_END = 2, // From the end of the file
}; };
/// メディアバイト /// Media byte
enum media_t { enum media_t {
MEDIA_2DD_10 = 0xE0, // 2DD/10セクタ MEDIA_2DD_10 = 0xE0, // 2DD/10 sector
MEDIA_1D_9 = 0xE5, // 1D/9セクタ MEDIA_1D_9 = 0xE5, // 1D/9 sector
MEDIA_2D_9 = 0xE6, // 2D/9セクタ MEDIA_2D_9 = 0xE6, // 2D/9 sector
MEDIA_1D_8 = 0xE7, // 1D/8セクタ MEDIA_1D_8 = 0xE7, // 1D/8 sector
MEDIA_2D_8 = 0xE8, // 2D/8セクタ MEDIA_2D_8 = 0xE8, // 2D/8 sector
MEDIA_2HT = 0xEA, // 2HT MEDIA_2HT = 0xEA, // 2HT
MEDIA_2HS = 0xEB, // 2HS MEDIA_2HS = 0xEB, // 2HS
MEDIA_2HDE = 0xEC, // 2DDE MEDIA_2HDE = 0xEC, // 2DDE
MEDIA_1DD_9 = 0xEE, // 1DD/9セクタ MEDIA_1DD_9 = 0xEE, // 1DD/9 sector
MEDIA_1DD_8 = 0xEF, // 1DD/8セクタ MEDIA_1DD_8 = 0xEF, // 1DD/8 sector
MEDIA_MANUAL = 0xF1, // リモートドライブ (手動イジェクト) MEDIA_MANUAL = 0xF1, // Remote drive (manual eject)
MEDIA_REMOVABLE = 0xF2, // リモートドライブ (リムーバブル) MEDIA_REMOVABLE = 0xF2, // Remote drive (removable)
MEDIA_REMOTE = 0xF3, // リモートドライブ MEDIA_REMOTE = 0xF3, // Remote drive
MEDIA_DAT = 0xF4, // SCSI-DAT MEDIA_DAT = 0xF4, // SCSI-DAT
MEDIA_CDROM = 0xF5, // SCSI-CDROM MEDIA_CDROM = 0xF5, // SCSI-CDROM
MEDIA_MO = 0xF6, // SCSI-MO MEDIA_MO = 0xF6, // SCSI-MO
MEDIA_SCSI_HD = 0xF7, // SCSI-HD MEDIA_SCSI_HD = 0xF7, // SCSI-HD
MEDIA_SASI_HD = 0xF8, // SASI-HD MEDIA_SASI_HD = 0xF8, // SASI-HD
MEDIA_RAMDISK = 0xF9, // RAMディスク MEDIA_RAMDISK = 0xF9, // RAM disk
MEDIA_2HQ = 0xFA, // 2HQ MEDIA_2HQ = 0xFA, // 2HQ
MEDIA_2DD_8 = 0xFB, // 2DD/8セクタ MEDIA_2DD_8 = 0xFB, // 2DD/8 sector
MEDIA_2DD_9 = 0xFC, // 2DD/9セクタ MEDIA_2DD_9 = 0xFC, // 2DD/9 sector
MEDIA_2HC = 0xFD, // 2HC MEDIA_2HC = 0xFD, // 2HC
MEDIA_2HD = 0xFE, // 2HD MEDIA_2HD = 0xFE, // 2HD
}; };
/// namests構造体 /// namests struct
typedef struct { typedef struct {
BYTE wildcard; // ワイルドカード文字数 BYTE wildcard; // Wildcard character length
BYTE drive; // ドライブ番号 BYTE drive; // Drive number
BYTE path[65]; // パス(サブディレクトリ+/) BYTE path[65]; // Path (subdirectory +/)
BYTE name[8]; // ファイル名 (PADDING 0x20) BYTE name[8]; // File name (PADDING 0x20)
BYTE ext[3]; // 拡張子 (PADDING 0x20) BYTE ext[3]; // Extension (PADDING 0x20)
BYTE add[10]; // ファイル名追加 (PADDING 0x00) BYTE add[10]; // File name addition (PADDING 0x00)
} namests_t; } namests_t;
/// files構造体 /// files struct
typedef struct { typedef struct {
BYTE fatr; // + 0 検索する属性 読込専用 BYTE fatr; // + 0 search attribute; read-only
BYTE pad1[3]; // padding BYTE pad1[3]; // padding
// BYTE drive; // + 1 ドライブ番号 読込専用 // BYTE drive; // + 1 drive number; read-only
DWORD sector; // + 2 ディレクトリのセクタ DOS _FILES先頭アドレスで代用 DWORD sector; // + 2 directory sector; DOS _FILES first address substitute
// WORD cluster; // + 6 ディレクトリのクラスタ 詳細不明 (未使用) // WORD cluster; // + 6 directory cluster; details unknown (unused)
WORD offset; // + 8 ディレクトリエントリ 書込専用 WORD offset; // + 8 directory entry; write-only
// BYTE name[8]; // +10 作業用ファイル名 読込専用 (未使用) // BYTE name[8]; // +10 working file name; write-only (unused)
// BYTE ext[3]; // +18 作業用拡張子 読込専用 (未使用) // BYTE ext[3]; // +18 working extension; write-only (unused)
BYTE attr; // +21 ファイル属性 書込専用 BYTE attr; // +21 file attribute; write-only
BYTE pad2; // padding BYTE pad2; // padding
WORD time; // +22 最終変更時刻 書込専用 WORD time; // +22 last change time of day; write-only
WORD date; // +24 最終変更月日 書込専用 WORD date; // +24 last change date; write-only
DWORD size; // +26 ファイルサイズ 書込専用 DWORD size; // +26 file size; write-only
BYTE full[23]; // +30 フルファイル名 書込専用 BYTE full[23]; // +30 full name; write-only
BYTE pad3; // padding BYTE pad3; // padding
} files_t; } files_t;
/// FCB<43>\‘¢‘Ì /// FCB<43>\‘¢‘Ì
typedef struct { typedef struct {
// BYTE pad00[6]; // + 0+ 5 (未使用) // BYTE pad00[6]; // + 0~+ 5 (unused)
DWORD fileptr; // + 6+ 9 ファイルポインタ DWORD fileptr; // + 6~+ 9 file pointer
// BYTE pad01[4]; // +10+13 (未使用) // BYTE pad01[4]; // +10~+13 (unused)
WORD mode; // +14+15 オープンモード WORD mode; // +14~+15 open mode
// BYTE pad02[16]; // +16+31 (未使用) // BYTE pad02[16]; // +16~+31 (unused)
// DWORD zero; // +32+35 オープンのとき0が書き込まれている (未使用) // DWORD zero; // +32~+35 zeros are written when opened (unused)
// BYTE name[8]; // +36+43 ファイル名 (PADDING 0x20) (未使用) // BYTE name[8]; // +36~+43 file name (PADDING 0x20) (unused)
// BYTE ext[3]; // +44+46 拡張子 (PADDING 0x20) (未使用) // BYTE ext[3]; // +44~+46 extension (PADDING 0x20) (unused)
BYTE attr; // +47 ファイル属性 BYTE attr; // +47 file attribute
BYTE pad; // padding // BYTE add[10]; // +48~+57 file name addition (PADDING 0x00) (unused)
// BYTE add[10]; // +48+57 ファイル名追加 (PADDING 0x00) (未使用) WORD time; // +58~+59 last change time of day
WORD time; // +58+59 最終変更時刻 WORD date; // +60~+61 last change date
WORD date; // +60+61 最終変更月日 // WORD cluster; // +62~+63 cluster number (unused)
// WORD cluster; // +62+63 クラスタ番号 (未使用) DWORD size; // +64~+67 file size
DWORD size; // +64+67 ファイルサイズ // BYTE pad03[28]; // +68~+95 FAT cache (unused)
// BYTE pad03[28]; // +68+95 FATキャッシュ (未使用)
} fcb_t; } fcb_t;
/// capacity構造体 /// capacity struct
typedef struct { typedef struct {
WORD freearea; // + 0 使用可能なクラスタ数 WORD freearea; // + 0 Number of available clusters
WORD clusters; // + 2 総クラスタ数 WORD clusters; // + 2 Total number of clusters
WORD sectors; // + 4 クラスタあたりのセクタ数 WORD sectors; // + 4 Number of sectors per cluster
WORD bytes; // + 6 セクタ当たりのバイト数 WORD bytes; // + 6 Number of bytes per sector
} capacity_t; } capacity_t;
/// ctrldrive構造体 /// ctrldrive struct
typedef struct { typedef struct {
BYTE status; // +13 状態 BYTE status; // +13 status
BYTE pad[3]; // padding BYTE pad[3]; // padding
} ctrldrive_t; } ctrldrive_t;
/// DPB構造体 /// DPB struct
typedef struct { typedef struct {
WORD sector_size; // + 0 1セクタ当りのバイト数 WORD sector_size; // + 0 Number of bytes in one sector
BYTE cluster_size; // + 2 1クラスタ当りのセクタ数-1 BYTE cluster_size; // + 2 Number sectors in one cluster -1
BYTE shift; // + 3 クラスタ→セクタのシフト数 BYTE shift; // + 3 Number of cluster<65>¨sector shifts
WORD fat_sector; // + 4 FATの先頭セクタ番号 WORD fat_sector; // + 4 FAT first sector number
BYTE fat_max; // + 6 FAT領域の個数 BYTE fat_max; // + 6 FAT storage quantity
BYTE fat_size; // + 7 FATの占めるセクタ数(複写分を除く) BYTE fat_size; // + 7 FAT controlled sector number (excluding duplicates)
WORD file_max; // + 8 ルートディレクトリに入るファイルの個数 WORD file_max; // + 8 Number of files in the root directory
WORD data_sector; // +10 データ領域の先頭セクタ番号 WORD data_sector; // +10 First sector number of data storage
WORD cluster_max; // +12 総クラスタ数+1 WORD cluster_max; // +12 Total number of clusters +1
WORD root_sector; // +14 ルートディレクトリの先頭セクタ番号 WORD root_sector; // +14 First sector number of root directory
// DWORD driverentry; // +16 デバイスドライバへのポインタ (未使用) // DWORD driverentry; // +16 Device driver pointer (unused)
BYTE media; // +20 メディア識別子 BYTE media; // +20 Media identifier
// BYTE flag; // +21 DPB使用フラグ (未使用) // BYTE flag; // +21 Flag used by DPB (unused)
BYTE pad; // padding BYTE pad; // padding
} dpb_t; } dpb_t;
/// ディレクトリエントリ構造体 /// Directory entry struct
typedef struct { typedef struct {
BYTE name[8]; // + 0 ファイル名 (PADDING 0x20) BYTE name[8]; // + 0 File name (PADDING 0x20)
BYTE ext[3]; // + 8 拡張子 (PADDING 0x20) BYTE ext[3]; // + 8 Extension (PADDING 0x20)
BYTE attr; // +11 ファイル属性 BYTE attr; // +11 File attribute
BYTE add[10]; // +12 ファイル名追加 (PADDING 0x00) BYTE add[10]; // +12 File name addition (PADDING 0x00)
WORD time; // +22 最終変更時刻 WORD time; // +22 Last change time of day
WORD date; // +24 最終変更月日 WORD date; // +24 Last change date
WORD cluster; // +26 クラスタ番号 WORD cluster; // +26 Cluster number
DWORD size; // +28 ファイルサイズ DWORD size; // +28 File size
} dirent_t; } dirent_t;
/// IOCTRLパラメータ共用体 /// IOCTRL parameter union
typedef union { typedef union {
BYTE buffer[8]; // バイト単位でのアクセス BYTE buffer[8]; // Access in byte units
DWORD param; // パラメータ(先頭4バイト) DWORD param; // Parameter (First 4 bytes)
WORD media; // メディアバイト(先頭2バイト) WORD media; // Media byte (First 2 bytes)
} ioctrl_t; } ioctrl_t;
/// コマンドライン引数構造体 /// Command line parameter struct
typedef struct { typedef struct {
BYTE buf[256]; // コマンドライン引数 BYTE buf[256]; // Command line argument
} argument_t; } argument_t;
#endif // bridge_h #endif // bridge_h

View File

@ -3,9 +3,9 @@
* SCSI Target Emulator RaSCSI (*^..^*) * SCSI Target Emulator RaSCSI (*^..^*)
* for Raspberry Pi * for Raspberry Pi
* *
* Powered by XM6 TypeG Technorogy. * Powered by XM6 TypeG Technology.
* Copyright (C) 2016-2019 GIMONS * Copyright (C) 2016-2019 GIMONS
* [ ] * [ Host Filesystem Bridge Driver ]
* *
* Based on * Based on
* X68k Emulator Host Filesystem Driver version 0.27 * X68k Emulator Host Filesystem Driver version 0.27
@ -20,19 +20,19 @@
.XREF _Init, _Process ;bridge.c .XREF _Init, _Process ;bridge.c
COMMAND EQU 2 COMMAND EQU 2 Command number
ERRLOW EQU 3 8 ERRLOW EQU 3 Error code lower 8 bits
ERRHIGH EQU 4 8 ERRHIGH EQU 4 Error code upper 8 bits
MXUNIT EQU 13 MXUNIT EQU 13 Number of units
DEVEND EQU 14 DEVEND EQU 14 Driver exit address
BDEVNO EQU 22 BDEVNO EQU 22 Base drive number
DDHEADER: DDHEADER:
DC.L -1 +$00 DC.L -1 +$00 Link pointer
DC.W $2040 +$04 DC.W $2040 +$04 Device attribute
DC.L DDSTRATEGY +$06 DC.L DDSTRATEGY +$06
DC.L DDENTRY_FIRST +$0A DC.L DDENTRY_FIRST +$0A
DC.B '*EMUHOST' +$0E DC.B '*EMUHOST' +$0E Device name
DDREQUEST: DDREQUEST:
DC.L 0 DC.L 0
@ -41,12 +41,12 @@ DDSTRATEGY:
MOVE.L A5,DDREQUEST MOVE.L A5,DDREQUEST
RTS RTS
* *Device driver entry
DDENTRY: DDENTRY:
MOVE.L SP,(STACK_BUFF) MOVE.L SP,(STACK_BUFF)
LEA (DEF_STACK),SP LEA (DEF_STACK),SP
MOVEM.L D1-D3/A0-A2,-(SP) MOVEM.L D1-D3/A0-A2,-(SP)
MOVEM.L DDREQUEST(PC),D0 D0.L: MOVEM.L DDREQUEST(PC),D0 D0.L: Request header address
MOVE.L D0,-(SP) MOVE.L D0,-(SP)
BSR _Process BSR _Process
ADDQ.L #4,SP ADDQ.L #4,SP
@ -56,67 +56,67 @@ DDENTRY:
KEEP_HERE: KEEP_HERE:
* *First time only device driver entry
DDENTRY_FIRST: DDENTRY_FIRST:
MOVEM.L D1-D3/A0-A2/A5,-(SP) MOVEM.L D1-D3/A0-A2/A5,-(SP)
MOVEA.L DDREQUEST(PC),A5 A5.L: MOVEA.L DDREQUEST(PC),A5 A5.L: Request header address
* CMPI.B #$40,COMMAND(A5) Human68k * CMPI.B #$40,COMMAND(A5) No need to check when Human68k is running
* BNE UNSUPPORTED : * BNE UNSUPPORTED Error: Not supported
* *Show title
PEA MESSAGE_TITLE(PC) PEA MESSAGE_TITLE(PC)
DOS _PRINT DOS _PRINT
ADDQ.L #4,SP ADDQ.L #4,SP
* *Device check
DEVICE_CHECK: DEVICE_CHECK:
BSR _Init BSR _Init
TST.L D0 TST.L D0
BEQ NOTFOUND : BEQ NOTFOUND Error: Device not found
* *Resident program start
LEA DDENTRY(PC),A1 LEA DDENTRY(PC),A1
LEA DDHEADER+$0A(PC),A0 LEA DDHEADER+$0A(PC),A0
MOVE.L A1,(A0) MOVE.L A1,(A0) Configure driver entry
MOVE.L #PROG_END,DEVEND(A5) MOVE.L #PROG_END,DEVEND(A5) Configure resident exit address
ST.B MXUNIT(A5) ST.B MXUNIT(A5) Set negative number since port is considered unimplemented
JSR (A1) JSR (A1) Execute driver entry
TST.B MXUNIT(A5) TST.B MXUNIT(A5) Verify number of units
BLE NODRIVE : BLE NODRIVE Error: No drive
MOVE.B BDEVNO(A5),D0 MOVE.B BDEVNO(A5),D0
MOVE.B MXUNIT(A5),D1 MOVE.B MXUNIT(A5),D1
LEA FIRSTDRIVE(PC),A0 LEA FIRSTDRIVE(PC),A0
ADD.B D0,(A0) ADD.B D0,(A0) Overwrite start drive name
ADD.B D1,D0 ADD.B D1,D0 Overwrite stop drive name
ADD.B D0,LASTDRIVE-FIRSTDRIVE(A0) ADD.B D0,LASTDRIVE-FIRSTDRIVE(A0)
PEA MESSAGE_DRIVENAME(PC) : A: PEA MESSAGE_DRIVENAME(PC) Normal: Drive A:
DOS _PRINT DOS _PRINT
PEA MESSAGE_DRIVENAME2(PC) : Z: PEA MESSAGE_DRIVENAME2(PC) Normal: to Z:
SUBQ.B #2,D1 SUBQ.B #2,D1
BCS @F BCS @F
DOS _PRINT DOS _PRINT
@@ ADDQ.L #8,SP @@ ADDQ.L #8,SP
PEA MESSAGE_DRIVENAME3(PC) : PEA MESSAGE_DRIVENAME3(PC) Normal: was registered
BRA QUIT BRA QUIT
NOTFOUND: NOTFOUND:
PEA MESSAGE_NOTFOUND(PC) : PEA MESSAGE_NOTFOUND(PC) Error: Device not found
BRA ABORT BRA ABORT
UNSUPPORTED: UNSUPPORTED:
PEA MESSAGE_UNSUPPORTED(PC) : PEA MESSAGE_UNSUPPORTED(PC) Error: Not supported
BRA ABORT BRA ABORT
NODRIVE: NODRIVE:
PEA MESSAGE_NODRIVE(PC) : PEA MESSAGE_NODRIVE(PC) Error: No drive
ABORT: ABORT:
MOVE.B #$0D,ERRLOW(A5) MOVE.B #$0D,ERRLOW(A5)
@ -139,41 +139,41 @@ SECRET:
DATA DATA
* *Error messages
MESSAGE_NOTFOUND: MESSAGE_NOTFOUND:
DC.B '',$0D,$0A,0 DC.B 'Device not found',$0D,$0A,0
MESSAGE_UNSUPPORTED: MESSAGE_UNSUPPORTED:
DC.B '',$0D,$0A,0 DC.B 'Not supported',$0D,$0A,0
MESSAGE_NODRIVE: MESSAGE_NODRIVE:
DC.B '',$0D,$0A,0 DC.B 'No drive',$0D,$0A,0
* *Registration messages
MESSAGE_DRIVENAME: MESSAGE_DRIVENAME:
DC.B '' DC.B 'Drive'
FIRSTDRIVE: FIRSTDRIVE:
DC.B 'A:',0 DC.B 'A:',0
MESSAGE_DRIVENAME2: MESSAGE_DRIVENAME2:
DC.B '' DC.B ' to '
LASTDRIVE: LASTDRIVE:
DC.B '@:',0 DC.B '@:',0
MESSAGE_DRIVENAME3: MESSAGE_DRIVENAME3:
DC.B '',$0D,$0A,0 DC.B ' was registered',$0D,$0A,0
* *Title
MESSAGE_TITLE: MESSAGE_TITLE:
DC.B $0D,$0A DC.B $0D,$0A
MESSAGE_TITLE2: MESSAGE_TITLE2:
DC.B 'RaSCSI FileSystem Driver version 1.42',$0D,$0A,0 DC.B 'RaSCSI FileSystem Driver version 1.42',$0D,$0A,0
* *Thanks!
CREDIT: CREDIT:
DC.B 'Coded by GIMONS',$0D,$0A DC.B 'Coded by GIMONS',$0D,$0A
DC.B 'Special thanks to',$0D,$0A DC.B 'Special thanks to',$0D,$0A
DC.B 9,'co',$0D,$0A DC.B 9,'co',$0D,$0A
DC.B 9,'',$0D,$0A DC.B 9,'PI.',$0D,$0A
DC.B 9,'',$0D,$0A DC.B 9,'Tachibana@Kuwashima Giken',$0D,$0A
DC.B 0 DC.B 0
BSS BSS

View File

@ -1,29 +0,0 @@
RaSCSI ファイルシステムドライバ
RASDRV version 1.42
■概要
 本プログラムはX68000実機で動作しているHuman68kからRaSCSIのブリッジデバイスを
通してRaspberry Pi側のファイルシステムを直接操作するためのデバイスドライバです。
 X68000エミュレータであるXM6及びXM6改ならびにTypeGのWindrvXMと同等の機能を提供
 します。
■解説
 利用するにはRaspberry PiのRaSCSIでブリッジデバイスを有効にする必要があります。
例えばSCSI ID6にブリッジデバイスを有効にする場合はrascsi -ID6 BRIDGEといった
指定が必要です。
 次にデバイスドライバRASCSI.SYSを実機の環境にコピーします。あとはCONFIG.SYSの
後半部分に以下のように記述してください。
DEVICE = \SYS\RASDRV.SYS
 起動オプションを指定しない場合はRaspberry Piのルートディレクトリ配下をマウント
 します。引数にディレクトリ名を指定することでそのディレクトリをマウントできます。
例えば/home/pi/appと/home/pi/dataというディレクトリをマウントする場合は
DEVICE = \SYS\RASDRV.SYS /home/pi/app /home/pi/data
と記述することで二つのディレクトリを別々のドライブとしてマウント可能です。
その他のオプションとしてWindrvXMのものが指定可能です。

View File

@ -1,42 +0,0 @@
RaSCSI用 Ethernetドライバ
RASETHER version 1.20
Based on
Neptune-X board driver for Human-68k(ESP-X) version 0.03
Programed 1996-7 by Shi-MAD.
Special thanks to Niggle, FIRST, yamapu ...
● このプログラムは
Shi-MAD さんの作られた Ethernet 用 ISA バスブリッジ "Neptune-X" 用デバ
イスドライバ ether_ne.sys を改造した ether_ne.sys ver0.03 +M01 +1 +L12を
参考にして開発したRaSCSI用のイーサーネット通信ドライバです。
● 使い方
基本的にはオリジナルのドライバと同じようにデバイスドライバとしてCONFIG.SYS
で組み込んで下さい。
 例)
DEVICE = \SYS\RASETHER.SYS
 以下のオプションが指定可能です。
-tx [xは数字] : 使用するtrapを指定します。xはからが指定可能です。
ただし、指定したtrapが使用中である場合は、trap #0から
空いている所を自動探索し、見つかった空きtrapを利用し
ます。
-n : APIにtrapを使用しません。
RASETHERで拡張したオプションは以下のとおりです。
-px [xは数字] : パケット受信のポーリング間隔を指定します1がデフォルトです。
1の場合は約16ms毎にポーリングします。2,3・・・8まで指定が可能
です。数字が一つ増えるごとに16ms間隔が大きくなります。
-ix [xは数字] : ポーリングに使用する割り込みのタイプを指定します。
デフォルトは0でMFPのGPIP割り込み(V-DISP)を利用します。
1を指定するとTimer-A割り込みを使用します。
● このドライバについて
オリジナルのether_ne.sys及び改造版のether_ne.sys ver0.03 +M01 +1 +L12の
利用規定に従います。

View File

@ -3,9 +3,9 @@
// SCSI Target Emulator RaSCSI (*^..^*) // SCSI Target Emulator RaSCSI (*^..^*)
// for Raspberry Pi // for Raspberry Pi
// //
// Powered by XM6 TypeG Technorogy. // Powered by XM6 TypeG Technology.
// Copyright (C) 2016-2017 GIMONS // Copyright (C) 2016-2017 GIMONS
// [ RaSCSI イーサーネット メイン ] // [ RaSCSI Ethernet Main ]
// //
// Based on // Based on
// Neptune-X board driver for Human-68k(ESP-X) version 0.03 // Neptune-X board driver for Human-68k(ESP-X) version 0.03
@ -25,7 +25,7 @@ int trap_no;
int num_of_prt; int num_of_prt;
struct prt PRT_LIST[NPRT]; struct prt PRT_LIST[NPRT];
// マルチキャスト(未対応) // Multicast (not supported)
#ifdef MULTICAST #ifdef MULTICAST
int num_of_multicast; int num_of_multicast;
struct eaddr multicast_array[NMULTICAST]; struct eaddr multicast_array[NMULTICAST];
@ -45,7 +45,7 @@ static int sprint_eaddr(unsigned char* dst, void* e)
} }
/************************************************ /************************************************
* TRAP nが使用可能か調べる * * Check if TRAP n can be used *
************************************************/ ************************************************/
static int is_valid_trap(int trap_no) static int is_valid_trap(int trap_no)
{ {
@ -55,10 +55,10 @@ static int is_valid_trap(int trap_no)
return 0; return 0;
} }
// 使用中かどうかチェック // Check if in use
addr = (unsigned int)_dos_intvcg(TRAP_VECNO(trap_no)); addr = (unsigned int)_dos_intvcg(TRAP_VECNO(trap_no));
// 処理アドレスの最上位バイトにベクタ番号が入っていれば未使用 // Unused if the uppermost byte of the process address contains the vector number
if (addr & 0xff000000) { if (addr & 0xff000000) {
return -1; return -1;
} }
@ -67,13 +67,13 @@ static int is_valid_trap(int trap_no)
} }
/************************************************ /************************************************
* 使TRAP nを検索 * * Search for unused TRAP n *
************************************************/ ************************************************/
static int search_trap_no(int def) static int search_trap_no(int def)
{ {
int i; int i;
// もしdefが使用可能ならそれに決定 // If def is usable, choose that
if (is_valid_trap(def)) { if (is_valid_trap(def)) {
return def; return def;
} }
@ -96,8 +96,8 @@ static void* trap_vector(int trap_no, void *func)
} }
/************************************************ /************************************************
ne.sイニシャライズで呼びます * * Init Function (call with ne.s initialize) *
************************************************/ ************************************************/
int Initialize(void) int Initialize(void)
{ {
unsigned char buff[128]; unsigned char buff[128];
@ -106,27 +106,27 @@ int Initialize(void)
if (SearchRaSCSI()) if (SearchRaSCSI())
{ {
Print("RaSCSI Ether Adapter の存在を確認できませんでした\r\n"); Print("Could not locate the RaSCSI Ethernet Adapter\r\n");
return -1; return -1;
} }
if (InitList(NPRT) if (InitList(NPRT)
|| InitRaSCSI()) || InitRaSCSI())
{ {
Print("RaSCSI Ether Adapter Driver の初期化に失敗しました\r\n"); Print("Failed to initialize the RaSCSI Ethernet Adapter Driver\r\n");
return -1; return -1;
} }
memset(&ether_addr, 0x00, sizeof(ether_addr)); memset(&ether_addr, 0x00, sizeof(ether_addr));
GetMacAddr(&ether_addr); GetMacAddr(&ether_addr);
// 未使用trap番号を調べる指定番号優先 // Inspect unused trap number (prioritize specified number)
if (trap_no >= 0) { if (trap_no >= 0) {
trap_no = search_trap_no(trap_no); trap_no = search_trap_no(trap_no);
} }
if (trap_no >= 0) { if (trap_no >= 0) {
// trapをフックする // Hook the trap
trap_vector(trap_no, (void*)trap_entry); trap_vector(trap_no, (void*)trap_entry);
sprintf(buff, " API trap number:%d ", trap_no); sprintf(buff, " API trap number:%d ", trap_no);
} else { } else {
@ -141,14 +141,14 @@ int Initialize(void)
sprintf(buff, "MAC Addr:%s\r\n", buff2); sprintf(buff, "MAC Addr:%s\r\n", buff2);
Print(buff); Print(buff);
// ポーリング開始 // Start polling
RegisterIntProcess(poll_interval); RegisterIntProcess(poll_interval);
return 0; return 0;
} }
/************************************************ /************************************************
* * * Initialize Protocol List *
************************************************/ ************************************************/
int InitList(int n) int InitList(int n)
{ {
@ -171,7 +171,7 @@ int InitList(int n)
} }
/************************************************ /************************************************
* * * Add Receive Handler (protocol) *
************************************************/ ************************************************/
int AddList(int type, int_handler handler) int AddList(int type, int_handler handler)
{ {
@ -184,7 +184,7 @@ int AddList(int type, int_handler handler)
result = -1; result = -1;
// overwrite if alreay exist // overwrite if already exist
p = &PRT_LIST[0]; p = &PRT_LIST[0];
for (i = 0; i < NPRT; i++, p++) { for (i = 0; i < NPRT; i++, p++) {
if ((p->type == type && p->malloc != (malloc_func)-1) if ((p->type == type && p->malloc != (malloc_func)-1)
@ -214,7 +214,7 @@ int AddList(int type, int_handler handler)
} }
/************************************************ /************************************************
* * * Delete Receive Handler (protocol) *
************************************************/ ************************************************/
int DeleteList(int type) int DeleteList(int type)
{ {
@ -238,7 +238,7 @@ int DeleteList(int type)
} }
/************************************************ /************************************************
* * * Search Receive Handler (protocol) *
************************************************/ ************************************************/
int_handler SearchList(int type) int_handler SearchList(int type)
{ {
@ -260,7 +260,7 @@ int_handler SearchList(int type)
/************************************************ /************************************************
* * * Search Receive Handler (protocol) *
************************************************/ ************************************************/
int_handler SearchList2(int type, int n) int_handler SearchList2(int type, int n)
{ {

View File

@ -3,9 +3,9 @@
// SCSI Target Emulator RaSCSI (*^..^*) // SCSI Target Emulator RaSCSI (*^..^*)
// for Raspberry Pi // for Raspberry Pi
// //
// Powered by XM6 TypeG Technorogy. // Powered by XM6 TypeG Technology.
// Copyright (C) 2016-2017 GIMONS // Copyright (C) 2016-2017 GIMONS
// [ RaSCSI イーサーネット メイン ] // [ RaSCSI Ethernet Main ]
// //
// Based on // Based on
// Neptune-X board driver for Human-68k(ESP-X) version 0.03 // Neptune-X board driver for Human-68k(ESP-X) version 0.03
@ -25,7 +25,7 @@
// number of multicast address we can handle **EDIT this** // number of multicast address we can handle **EDIT this**
#define NMULTICAST (64) #define NMULTICAST (64)
/* ただし、まだマルチキャストには対応していない */ /* However, multicast is not yet supported */
struct eaddr { struct eaddr {
unsigned char eaddr [6]; unsigned char eaddr [6];
@ -41,7 +41,7 @@ struct prt {
}; };
// グローバル変数 // Global variables
extern unsigned int scsiid; extern unsigned int scsiid;
extern int trap_no; extern int trap_no;
extern int num_of_prt; extern int num_of_prt;
@ -53,7 +53,7 @@ extern struct eaddr multicast_array [NMULTICAST];
#endif #endif
// プロトタイプ宣言 // Prototype declarations
extern int Initialize (void); extern int Initialize (void);
extern int InitList (int); extern int InitList (int);
extern int AddList (int, int_handler); extern int AddList (int, int_handler);
@ -69,7 +69,7 @@ extern void MakeMulticastTable (unsigned char*);
#endif #endif
// ne.s 内関数 // Function within ne.s
extern void trap_entry (void); extern void trap_entry (void);

View File

@ -3,9 +3,9 @@
** SCSI Target Emulator RaSCSI (*^..^*) ** SCSI Target Emulator RaSCSI (*^..^*)
** for Raspberry Pi ** for Raspberry Pi
** **
** Powered by XM6 TypeG Technorogy. ** Powered by XM6 TypeG Technology.
** Copyright (C) 2016-2017 GIMONS ** Copyright (C) 2016-2017 GIMONS
** [ RaSCSI ] ** [ RaSCSI Ethernet Driver ]
** **
** Based on ** Based on
** Neptune-X board driver for Human-68k(ESP-X) version 0.03 ** Neptune-X board driver for Human-68k(ESP-X) version 0.03
@ -23,21 +23,21 @@
* Global Symbols ---------------------- * * Global Symbols ---------------------- *
* *
* * For C language: external declarations
* *
.xref _Initialize, _AddList, _SearchList, _DeleteList ;main.c .xref _Initialize, _AddList, _SearchList, _DeleteList ;main.c
.xref _GetMacAddr, _SetMacAddr ;scsictl.c .xref _GetMacAddr, _SetMacAddr ;scsictl.c
.xref _SendPacket, _SetPacketReception ;scsictl.c .xref _SendPacket, _SetPacketReception ;scsictl.c
* .xref _AddMulticastAddr, _DelMulticastAddr ;未実装 * .xref _AddMulticastAddr, _DelMulticastAddr ;not implemented
* *
* * For C language: external functions
* *
.xref _num_of_prt ;main.c 登録プロトコル数 .xref _num_of_prt ;main.c Number of registered protocols
.xref _trap_no ;使用trapナンバー .xref _trap_no ;Used trap number
.xref _trans_counter ;scsictl.c 送信/受信バイト数 .xref _trans_counter ;scsictl.c Number of send/receive bytes
.xref _intr_type ;scsictl.c 割り込み種別 .xref _intr_type ;scsictl.c Type of interrupt
.xref _poll_interval ;scsictl.c ポーリング間隔 .xref _poll_interval ;scsictl.c Polling interval
* Text Section -------------------------------- * * Text Section -------------------------------- *
@ -47,21 +47,21 @@
* *
* * Device Header
* *
device_header: device_header:
.dc.l -1 ;リンクポインター .dc.l -1 ;link pointer
.dc $8000 ;device att. .dc $8000 ;device att.
.dc.l strategy_entry ;stategy entry .dc.l strategy_entry ;strategy entry
.dc.l interupt_entry ;interupt entry .dc.l interupt_entry ;interrupt entry
.dc.b '/dev/en0' ;device name .dc.b '/dev/en0' ;device name
.dc.b 'EthD' ;for etherlib.a .dc.b 'EthD' ;for etherlib.a
.dc.b 'RASC' ;driver name (この後にエントリーを置く) .dc.b 'RASC' ;driver name (put in entry later)
* 'RASC' superjsr_entry * Don not put anything between 'RASC' and superjsr_entry
* *
* ( for DOS _SUPERJSR ) * Ether Driver Function Entry ( for DOS _SUPERJSR )
* in: d0: command number * in: d0: command number
* a0: args * a0: args
* *
@ -79,11 +79,11 @@ superjsr_entry:
bsr do_command bsr do_command
movem.l (sp)+,d1-d7/a1-a7 movem.l (sp)+,d1-d7/a1-a7
rts ;普通のリターン rts ;normal return
* *
* ( for trap #n ) * Ether Driver Function Entry ( for trap #n )
* in: d0: command number * in: d0: command number
* a0: args * a0: args
* *
@ -101,51 +101,51 @@ _trap_entry::
bsr do_command bsr do_command
movem.l (sp)+,d1-d7/a1-a7 movem.l (sp)+,d1-d7/a1-a7
rte ;割り込みリターン rte ;interrupt return
* *
* * Assign each command
* *
do_command: do_command:
moveq #FUNC_MIN,d1 moveq #FUNC_MIN,d1
cmp.l d0,d1 cmp.l d0,d1
bgt error ;d0<-2 なら未対応コマンド番号 bgt error ;d0<-2 is an unsupported command number
moveq #FUNC_MAX,d1 moveq #FUNC_MAX,d1
cmp.l d1,d0 cmp.l d1,d0
bgt error ;9<d0 なら未対応コマンド番号 bgt error ;9<d0 is an unsupported command number
add d0,d0 add d0,d0
move (jumptable,pc,d0.w),d0 move (jumptable,pc,d0.w),d0
jmp (jumptable,pc,d0.w) ;引数 a0 をレジスタ渡し jmp (jumptable,pc,d0.w) ;Pass parameter a0 to register
** rts ** rts
error: error:
moveq #-1,d0 moveq #-1,d0
rts rts
* *
* * Jump Table
* *
FUNC_MIN: .equ ($-jumptable)/2 FUNC_MIN: .equ ($-jumptable)/2
.dc get_cnt_addr-jumptable ;-2 ... 送受信カウンタのアドレス取得 .dc get_cnt_addr-jumptable ;-2 ... Get transfer counter address
.dc driver_entry-jumptable ;-1 ... 使用trap番号の取得 .dc driver_entry-jumptable ;-1 ... Get used trap number
jumptable: jumptable:
.dc get_driver_version-jumptable ;00 ... バージョンの取得 .dc get_driver_version-jumptable ;00 ... Get version
.dc get_mac_addr-jumptable ;01 ... 現在のMACアドレス取得 .dc get_mac_addr-jumptable ;01 ... Get current MAC address
.dc get_prom_addr-jumptable ;02 ... PROMに書かれたMACアドレス取得 .dc get_prom_addr-jumptable ;02 ... Get MAC address written in PROM
.dc set_mac_addr-jumptable ;03 ... MACアドレスの設定 .dc set_mac_addr-jumptable ;03 ... Set MAC address
.dc send_packet-jumptable ;04 ... パケット送信 .dc send_packet-jumptable ;04 ... Send packet
.dc set_int_addr-jumptable ;05 ... パケット受信ハンドラ設定 .dc set_int_addr-jumptable ;05 ... Set packet receive handler
.dc get_int_addr-jumptable ;06 ... パケット受信ハンドラのアドレス取得 .dc get_int_addr-jumptable ;06 ... Get packet receive handler address
.dc del_int_addr-jumptable ;07 ... ハンドラ削除 .dc del_int_addr-jumptable ;07 ... Delete handler
.dc set_multicast_addr-jumptable ;08 ... (マルチキャストの設定<未対応>) .dc set_multicast_addr-jumptable ;08 ... (Set multicast <unsupported>)
.dc get_statistics-jumptable ;09 ... (統計読み出し<未対応>) .dc get_statistics-jumptable ;09 ... (Read out statistics <unsupported>)
FUNC_MAX: .equ ($-jumptable)/2-1 FUNC_MAX: .equ ($-jumptable)/2-1
* *
* -2: * Command -2: Return transfer counter address
* return: address * return: address
* *
get_cnt_addr: get_cnt_addr:
@ -155,7 +155,7 @@ get_cnt_addr:
* *
* -1: 使trap * Command -1: Return used trap number
* return: trap number to use (-1:use SUPERJSR) * return: trap number to use (-1:use SUPERJSR)
* *
driver_entry: driver_entry:
@ -166,13 +166,13 @@ driver_entry:
*mesff: .dc.b 'DriverEntry',13,10,0 *mesff: .dc.b 'DriverEntry',13,10,0
* .text * .text
move.l (_trap_no,pc),d0 ;trap_no ... main.c 変数 move.l (_trap_no,pc),d0 ;trap_no ... main.c variable
rts rts
* *
* 00: * Command 00: Return driver version
* return: version number (... ver1.00 100 ) * return: version number (Ex... for ver1.00 return 100)
* *
get_driver_version: get_driver_version:
* pea (mes00,pc) * pea (mes00,pc)
@ -187,7 +187,7 @@ get_driver_version:
* *
* 01: MAC * Command 01: Get current MAC address
* return: same as *dst * return: same as *dst
* *
get_mac_addr: get_mac_addr:
@ -200,13 +200,13 @@ get_mac_addr:
pea (a0) pea (a0)
pea (a0) pea (a0)
bsr _GetMacAddr ;scsictl.c 関数 bsr _GetMacAddr ;scsictl.c function
addq.l #4,sp addq.l #4,sp
move.l (sp)+,d0 ;引数の a0 を d0 にそのまま返す move.l (sp)+,d0 ;Return d0 for parameter a0
rts rts
* *
* 02: EEPROM MAC * Command 02: Get MAC address written to EEPROM
* return: same as *dst * return: same as *dst
* *
get_prom_addr: get_prom_addr:
@ -219,13 +219,13 @@ get_prom_addr:
pea (a0) pea (a0)
pea (a0) pea (a0)
bsr _GetMacAddr ;scsictl.c 関数 bsr _GetMacAddr ;scsictl.c function
addq.l #4,sp addq.l #4,sp
move.l (sp)+,d0 ;引数の a0 を d0 にそのまま返す move.l (sp)+,d0 ;Return d0 for parameter a0
rts rts
* *
* 03: MAC * Command 03: Set MAC address
* return: 0 (if no errors) * return: 0 (if no errors)
* *
set_mac_addr: set_mac_addr:
@ -237,13 +237,13 @@ set_mac_addr:
* .text * .text
pea (a0) pea (a0)
bsr _SetMacAddr ;scsictl.c 関数 bsr _SetMacAddr ;scsictl.c function
addq.l #4,sp addq.l #4,sp
rts rts
* *
* 04: * Command 04: Send packet
* packet contents: * packet contents:
* Distination MAC: 6 bytes * Distination MAC: 6 bytes
* Source(own) MAC: 6 bytes * Source(own) MAC: 6 bytes
@ -256,10 +256,10 @@ send_packet:
* DOS _PRINT * DOS _PRINT
* addq.l #4,sp * addq.l #4,sp
move.l (a0)+,d0 ;パケットサイズ move.l (a0)+,d0 ;packet size
move.l (a0),-(sp) ;パケットアドレス move.l (a0),-(sp) ;packet address
move.l d0,-(sp) move.l d0,-(sp)
bsr _SendPacket ;scsictl.c 関数 bsr _SendPacket ;scsictl.c function
addq.l #8,sp addq.l #8,sp
* move.l d0,-(sp) * move.l d0,-(sp)
@ -269,14 +269,14 @@ send_packet:
* move.l (sp)+,d0 * move.l (sp)+,d0
* .data * .data
*mes04: .dc.b 13,10,'SendPacket,13,10',0 *mes04: .dc.b 13,10,'SendPacket,13,10',0
*mes04e:.dc.b 13,10,'SendPacket',13,10,0 *mes04e:.dc.b 13,10,'SendPacket finished',13,10,0
* .text * .text
rts rts
* *
* 05: * Command 05: Set / add receive interrupt handler
* type: 0x00000800 IP packet * type: 0x00000800 IP packet
* 0x00000806 ARP packet * 0x00000806 ARP packet
* return: 0 (if no errors) * return: 0 (if no errors)
@ -289,28 +289,28 @@ set_int_addr:
*mes05: .dc.b 'SetIntAddr',13,10,0 *mes05: .dc.b 'SetIntAddr',13,10,0
* .text * .text
move.l (a0)+,d0 ;プロトコル番号 move.l (a0)+,d0 ;protocol number
move.l (a0),-(sp) ;ハンドラ関数のアドレス move.l (a0),-(sp) ;address to handler function
move.l d0,-(sp) move.l d0,-(sp)
bsr _AddList ;main.c 関数 bsr _AddList ;main.c function
addq.l #8,sp addq.l #8,sp
tst.l d0 tst.l d0
bmi set_int_addr_rts ;登録失敗 bmi set_int_addr_rts ;Registration failed
cmpi.l #1,(_num_of_prt) ;ハンドラ数が1なら割り込み許可へ cmpi.l #1,(_num_of_prt) ;Permit interrupt if number of handlers is 1
bne set_int_addr_rts bne set_int_addr_rts
pea (1) ;1=<許可> pea (1) ;1=<Permit>
bsr _SetPacketReception ;割り込み許可 ... scsictl.c bsr _SetPacketReception ;interrupt permitted ... scsictl.c
addq.l #4,sp addq.l #4,sp
* moveq #0,d0 ;SetPacketReception() で常に 0 が返るので省略 * moveq #0,d0 ;SetPacketReception() always returns 0 so bypass
set_int_addr_rts: set_int_addr_rts:
rts rts
* *
* 06: * Command 06: Get interrupt handler and address
* return: interupt address * return: interupt address
* *
get_int_addr: get_int_addr:
@ -328,7 +328,7 @@ get_int_addr:
* *
* 07: * Command 07: Delete interrupt handler
* return: 0 (if no errors) * return: 0 (if no errors)
* *
del_int_addr: del_int_addr:
@ -340,24 +340,24 @@ del_int_addr:
* .text * .text
pea (a0) pea (a0)
bsr _DeleteList ;main.c 関数 bsr _DeleteList ;main.c function
move.l d0,(sp)+ move.l d0,(sp)+
bmi del_int_addr_ret ;削除失敗 bmi del_int_addr_ret ;Delete failed
tst.l (_num_of_prt) ;ハンドラが一つもなくなれば割り込みを禁止する tst.l (_num_of_prt) ;Forbid interrupts if handlers are gone
bne del_int_addr_ret bne del_int_addr_ret
clr.l -(sp) ;0=<禁止> clr.l -(sp) ;0=<Block>
bsr _SetPacketReception ;割り込み禁止 ... scsictl.c bsr _SetPacketReception ;Interrupt forbitten ... scsictl.c
addq.l #4,sp addq.l #4,sp
* moveq #0,d0 ;SetPacketReception() で常に 0 が返るので省略 * moveq #0,d0 ;SetPacketReception() always returns 0 so bypass
del_int_addr_ret: del_int_addr_ret:
rts rts
* *
* 08: * Command 08: Set multicast address
* *
set_multicast_addr: set_multicast_addr:
* pea (mes08,pc) * pea (mes08,pc)
@ -372,7 +372,7 @@ set_multicast_addr:
* *
* 09: * Command 09: Read out statistics
* *
get_statistics: get_statistics:
* pea (mes09,pc) * pea (mes09,pc)
@ -386,7 +386,7 @@ get_statistics:
rts rts
* *
* * Device Driver Entry
* *
strategy_entry: strategy_entry:
move.l a5,(request_buffer) move.l a5,(request_buffer)
@ -394,7 +394,7 @@ strategy_entry:
interupt_entry: interupt_entry:
move.l sp,(stack_buff) ;自前のスタックエリアを使う move.l sp,(stack_buff) ;Use own stack area
lea (def_stack),sp ; lea (def_stack),sp ;
movem.l d1-d7/a0-a5,-(sp) movem.l d1-d7/a0-a5,-(sp)
@ -481,13 +481,13 @@ opt_i:
bra opt_loop bra opt_loop
arg_end: arg_end:
bsr _Initialize ;main.c 関数 bsr _Initialize ;main.c function
;I/Oアドレス設定 ;Set I/O address
;MACアドレス取得 ;Get MAC address
;プロトコルリスト初期化 ;Init protocol list
;SCSICTL初期化 ;Init SCSICTL
;割り込みハンドラ(ベクタ設定) ;Interrupt handler (set vector)
;trapサービス(ベクタ設定) ;trap service (set vector)
tst.l d0 tst.l d0
bne errorret bne errorret
@ -508,7 +508,7 @@ intret:
move.b d0,(3,a5) move.b d0,(3,a5)
movem.l (sp)+,d1-d7/a0-a5 movem.l (sp)+,d1-d7/a0-a5
movea.l (stack_buff,pc),sp ;スタックポインタを元にもどす movea.l (stack_buff,pc),sp ;Restore stack pointer
rts rts
get_num: get_num:
@ -539,7 +539,7 @@ mestitle:
.dc.b 'RaSCSI Ethernet Driver version 1.20 / Based on ether_ne.sys+M01L12',13,10 .dc.b 'RaSCSI Ethernet Driver version 1.20 / Based on ether_ne.sys+M01L12',13,10
.dc.b 0 .dc.b 0
mesparam_err: mesparam_err:
.dc.b '',13,10,0 .dc.b 'Invalid parameter',13,10,0
.even .even
@ -562,7 +562,7 @@ stack_buff_i:
.quad .quad
* *
* * Stack area
* *
.ds.b 1024*8 .ds.b 1024*8
def_stack: def_stack:

View File

@ -3,9 +3,9 @@
// SCSI Target Emulator RaSCSI (*^..^*) // SCSI Target Emulator RaSCSI (*^..^*)
// for Raspberry Pi // for Raspberry Pi
// //
// Powered by XM6 TypeG Technorogy. // Powered by XM6 TypeG Technology.
// Copyright (C) 2016-2017 GIMONS // Copyright (C) 2016-2017 GIMONS
// [ RaSCSI イーサーネット SCSI制御部 ] // [ RaSCSI Ethernet SCSI Control Department ]
// //
// Based on // Based on
// Neptune-X board driver for Human-68k(ESP-X) version 0.03 // Neptune-X board driver for Human-68k(ESP-X) version 0.03
@ -47,24 +47,24 @@ typedef struct
#define MFP_IERB 0xe88009 #define MFP_IERB 0xe88009
#define MFP_IMRB 0xe88015 #define MFP_IMRB 0xe88015
// asmsub.s 内のサブルーチン // Subroutine in asmsub.s
extern void DI(); extern void DI();
extern void EI(); extern void EI();
volatile short* iocsexec = (short*)0xa0e; // IOCS実行中ワーク volatile short* iocsexec = (short*)0xa0e; // Work when executin IOCS
struct trans_counter trans_counter; // 送受信カウンタ struct trans_counter trans_counter; // Transfer counter
unsigned char rx_buff[2048]; // 受信バッファ unsigned char rx_buff[2048]; // Receive buffer
int imr; // 割り込み許可フラグ int imr; // Interrupt permission flag
int scsistop; // SCSI停止中フラグ int scsistop; // SCSI stopped flag
int intr_type; // 割り込み種別(0:V-DISP 1:TimerA) int intr_type; // Interrupt type (0:V-DISP 1:TimerA)
int poll_interval; // ポーリング間隔(設定) int poll_interval; // Polling interval (configure)
int poll_current; // ポーリング間隔(現在) int poll_current; // Polling interval (current)
int idle; // アイドルカウンタ int idle; // Idle counter
#define POLLING_SLEEP 255 // 4-5s #define POLLING_SLEEP 255 // 4-5s
/************************************************ /************************************************
* MACアドレス取得命令発行 * * Execute command to get MAC address *
************************************************/ ************************************************/
int SCSI_GETMACADDR(unsigned char *mac) int SCSI_GETMACADDR(unsigned char *mac)
{ {
@ -105,7 +105,7 @@ int SCSI_GETMACADDR(unsigned char *mac)
} }
/************************************************ /************************************************
* MACアドレス設定命令発行 * * Execute command to configure MAC address *
************************************************/ ************************************************/
int SCSI_SETMACADDR(const unsigned char *mac) int SCSI_SETMACADDR(const unsigned char *mac)
{ {
@ -144,7 +144,7 @@ int SCSI_SETMACADDR(const unsigned char *mac)
} }
/************************************************ /************************************************
* * * Execute command to get received packet size*
************************************************/ ************************************************/
int SCSI_GETPACKETLEN(int *len) int SCSI_GETPACKETLEN(int *len)
{ {
@ -188,7 +188,7 @@ int SCSI_GETPACKETLEN(int *len)
} }
/************************************************ /************************************************
* * * Execute receive packet command *
************************************************/ ************************************************/
int SCSI_GETPACKETBUF(unsigned char *buf, int len) int SCSI_GETPACKETBUF(unsigned char *buf, int len)
{ {
@ -229,7 +229,7 @@ int SCSI_GETPACKETBUF(unsigned char *buf, int len)
} }
/************************************************ /************************************************
* * * Execute packet send command *
************************************************/ ************************************************/
int SCSI_SENDPACKET(const unsigned char *buf, int len) int SCSI_SENDPACKET(const unsigned char *buf, int len)
{ {
@ -267,7 +267,7 @@ int SCSI_SENDPACKET(const unsigned char *buf, int len)
} }
/************************************************ /************************************************
* MACアドレス取得 * * Get MAC address *
************************************************/ ************************************************/
int GetMacAddr(struct eaddr* buf) int GetMacAddr(struct eaddr* buf)
{ {
@ -279,7 +279,7 @@ int GetMacAddr(struct eaddr* buf)
} }
/************************************************ /************************************************
* MACアドレス設定 * * Set MAC address *
************************************************/ ************************************************/
int SetMacAddr(const struct eaddr* data) int SetMacAddr(const struct eaddr* data)
{ {
@ -291,7 +291,7 @@ int SetMacAddr(const struct eaddr* data)
} }
/************************************************ /************************************************
* RaSCSI検索 * * Search RaSCSI *
************************************************/ ************************************************/
int SearchRaSCSI() int SearchRaSCSI()
{ {
@ -299,7 +299,7 @@ int SearchRaSCSI()
INQUIRYOPT_T inq; INQUIRYOPT_T inq;
for (i = 0; i <= 7; i++) { for (i = 0; i <= 7; i++) {
// BRIDGEデバイス検索 // Search for BRIDGE device
if (S_INQUIRY(sizeof(INQUIRY_T) , i, (struct INQUIRY*)&inq) < 0) { if (S_INQUIRY(sizeof(INQUIRY_T) , i, (struct INQUIRY*)&inq) < 0) {
continue; continue;
} }
@ -308,7 +308,7 @@ int SearchRaSCSI()
continue; continue;
} }
// TAP初期化状態を取得 // Get TAP initialization status
if (S_INQUIRY(sizeof(INQUIRYOPT_T) , i, (struct INQUIRY*)&inq) < 0) { if (S_INQUIRY(sizeof(INQUIRYOPT_T) , i, (struct INQUIRY*)&inq) < 0) {
continue; continue;
} }
@ -317,7 +317,7 @@ int SearchRaSCSI()
continue; continue;
} }
// SCSI ID確定 // Configure SCSI ID
scsiid = i; scsiid = i;
return 0; return 0;
} }
@ -326,7 +326,7 @@ int SearchRaSCSI()
} }
/************************************************ /************************************************
* RaSCSI初期化 * * Init RaSCSI method *
************************************************/ ************************************************/
int InitRaSCSI(void) int InitRaSCSI(void)
{ {
@ -343,7 +343,7 @@ int InitRaSCSI(void)
} }
/************************************************ /************************************************
* RaSCSI () * * RaSCSI interrupt handler function (polling) *
************************************************/ ************************************************/
void interrupt IntProcess(void) void interrupt IntProcess(void)
{ {
@ -353,78 +353,78 @@ void interrupt IntProcess(void)
int_handler func; int_handler func;
int i; int i;
// V-DISP GPIP割り込みはアイドルカウンタで制御 // V-DISP GPIP interrupt idle count control
if (intr_type == 0) { if (intr_type == 0) {
// アイドル加算 // Increment idle
idle++; idle++;
// 次回の処理予定に到達していないならスキップ // Skip if not yet next scheduled processing
if (idle < poll_current) { if (idle < poll_current) {
return; return;
} }
// アイドルカウンタをクリア // Clear idle counter
idle = 0; idle = 0;
} }
// 割り込み開始 // Start interrupt
// 割り込み許可の時だけ // Only when interrupt is permitted
if (imr == 0) { if (imr == 0) {
return; return;
} }
// IOCS実行中ならばスキップ // Skip if executing IOCS
if (*iocsexec != -1) { if (*iocsexec != -1) {
return; return;
} }
// 受信処理中は割り込み禁止 // Interrupt forbidden if receiving data
DI (); DI ();
// バスフリーの時だけ // Only in bus free phase
phase = S_PHASE(); phase = S_PHASE();
if (phase != 0) { if (phase != 0) {
// 終了 // Exit
goto ei_exit; goto ei_exit;
} }
// 受信処理 // Receive data
if (SCSI_GETPACKETLEN(&len) == 0) { if (SCSI_GETPACKETLEN(&len) == 0) {
// RaSCSI停止中 // RaSCSI is stopped
scsistop = 1; scsistop = 1;
// ポーリング間隔の再設定(寝る) // Reset polling interval (sleep)
UpdateIntProcess(POLLING_SLEEP); UpdateIntProcess(POLLING_SLEEP);
// 終了 // Exit
goto ei_exit; goto ei_exit;
} }
// RaSCSIは動作中 // RaSCSI is stopped
if (scsistop) { if (scsistop) {
scsistop = 0; scsistop = 0;
// ポーリング間隔の再設定(急ぐ) // Reset polling interval (hurry)
UpdateIntProcess(poll_interval); UpdateIntProcess(poll_interval);
} }
// パケットは到着してなかった // Packets did not arrive
if (len == 0) { if (len == 0) {
// 終了 // Exit
goto ei_exit; goto ei_exit;
} }
// 受信バッファメモリへパケット転送 // Tranfer packets to receive buffer memory
if (SCSI_GETPACKETBUF(rx_buff, len) == 0) { if (SCSI_GETPACKETBUF(rx_buff, len) == 0) {
// 失敗 // Fail
goto ei_exit; goto ei_exit;
} }
// 割り込み許可 // Interrupt permitted
EI (); EI ();
// パケットタイプでデータ分別 // Split data by packet type
type = rx_buff[12] * 256 + rx_buff[13]; type = rx_buff[12] * 256 + rx_buff[13];
i = 0; i = 0;
while ((func = SearchList2(type, i))) { while ((func = SearchList2(type, i))) {
@ -435,12 +435,12 @@ void interrupt IntProcess(void)
return; return;
ei_exit: ei_exit:
// 割り込み許可 // Interrupt permitted
EI (); EI ();
} }
/************************************************ /************************************************
* RaSCSI (ne.sから) * * RaSCSI Send Packets Function (from ne.s) *
************************************************/ ************************************************/
int SendPacket(int len, const unsigned char* data) int SendPacket(int len, const unsigned char* data)
{ {
@ -449,35 +449,35 @@ int SendPacket(int len, const unsigned char* data)
} }
if (len > 1514) { // 6 + 6 + 2 + 1500 if (len > 1514) { // 6 + 6 + 2 + 1500
return -1; // エラー return -1; // Error
} }
// RaSCSI停止中のようならエラー // If RaSCSI seems to be stopped, throw an error
if (scsistop) { if (scsistop) {
return -1; return -1;
} }
// 送信処理中は割り込み禁止 // Interrupt is not permitted during sending
DI (); DI ();
// 送信処理と送信フラグアップ // Send processing and raise send flag
if (SCSI_SENDPACKET(data, len) == 0) { if (SCSI_SENDPACKET(data, len) == 0) {
// 割り込み許可 // Interrupt permitted
EI (); EI ();
return -1; return -1;
} }
// 割り込み許可 // Interrupt permitted
EI (); EI ();
// 送信依頼済み // Finished requesting send
trans_counter.send_byte += len; trans_counter.send_byte += len;
return 0; return 0;
} }
/************************************************ /************************************************
* RaSCSI * * RaSCSI Interrupt Permission Setting Function*
************************************************/ ************************************************/
int SetPacketReception(int i) int SetPacketReception(int i)
{ {
@ -486,19 +486,19 @@ int SetPacketReception(int i)
} }
/************************************************ /************************************************
* RaSCSI * * RaSCSI Interrupt Processing Registration *
************************************************/ ************************************************/
void RegisterIntProcess(int n) void RegisterIntProcess(int n)
{ {
volatile unsigned char *p; volatile unsigned char *p;
// ポーリング間隔(現在)の更新とアイドルカウンタクリア // Update polling interval (current) and clear idle counter
poll_current = n; poll_current = n;
idle = 0; idle = 0;
if (intr_type == 0) { if (intr_type == 0) {
// V-DISP GPIP割り込みベクタを書き換えて // Overwrite V-DISP GPIP interrupt vectors
// 割り込みを有効にする // and enable interrupt
B_INTVCS(0x46, (int)IntProcess); B_INTVCS(0x46, (int)IntProcess);
p = (unsigned char *)MFP_AEB; p = (unsigned char *)MFP_AEB;
*p = *p | 0x10; *p = *p | 0x10;
@ -507,28 +507,28 @@ void RegisterIntProcess(int n)
p = (unsigned char *)MFP_IMRB; p = (unsigned char *)MFP_IMRB;
*p = *p | 0x40; *p = *p | 0x40;
} else if (intr_type == 1) { } else if (intr_type == 1) {
// TimerAはカウントモードを設定 // Set TimerA counter mode
VDISPST(NULL, 0, 0); VDISPST(NULL, 0, 0);
VDISPST(IntProcess, 0, poll_current); VDISPST(IntProcess, 0, poll_current);
} }
} }
/************************************************ /************************************************
* RaSCSI * * RaSCSI Interrupt Processing Update *
************************************************/ ************************************************/
void UpdateIntProcess(int n) void UpdateIntProcess(int n)
{ {
// ポーリング間隔(現在)と同じなら更新しない // Do not update if polling interval (current) is the same
if (n == poll_current) { if (n == poll_current) {
return; return;
} }
// ポーリング間隔(現在)の更新とアイドルカウンタクリア // Update polling interval (current) and clear idle counter
poll_current = n; poll_current = n;
idle = 0; idle = 0;
if (intr_type == 1) { if (intr_type == 1) {
// TimerAは再登録必要 // TimerA requires re-registering
VDISPST(NULL, 0, 0); VDISPST(NULL, 0, 0);
VDISPST(IntProcess, 0, poll_current); VDISPST(IntProcess, 0, poll_current);
} }

View File

@ -3,9 +3,9 @@
// SCSI Target Emulator RaSCSI (*^..^*) // SCSI Target Emulator RaSCSI (*^..^*)
// for Raspberry Pi // for Raspberry Pi
// //
// Powered by XM6 TypeG Technorogy. // Powered by XM6 TypeG Technology.
// Copyright (C) 2016-2017 GIMONS // Copyright (C) 2016-2017 GIMONS
// [ RaSCSI イーサーネット SCSI制御部 ] // [ RaSCSI Ethernet SCSI Control Department ]
// //
// Based on // Based on
// Neptune-X board driver for Human-68k(ESP-X) version 0.03 // Neptune-X board driver for Human-68k(ESP-X) version 0.03
@ -17,11 +17,11 @@
#ifndef scsictl_h #ifndef scsictl_h
#define scsictl_h #define scsictl_h
// グローバル変数 // Global variables
extern int intr_type; extern int intr_type;
extern int poll_interval; extern int poll_interval;
// 送受信カウンタ // Transfer counter
struct trans_counter { struct trans_counter {
unsigned int send_byte; unsigned int send_byte;
unsigned int recv_byte; unsigned int recv_byte;