first commit

This commit is contained in:
sky5454
2019-05-26 18:28:16 +08:00
commit af424f32e3
9322 changed files with 2146345 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
[AUTORUN]
open=EXPLORER \

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,75 @@
; へぼOS用アプリ "GRAPHIC.NAS"
; TAB = 4
; copyright(C) 2003 川合秀実, KL-01
; prompt>nask graphic.nas graphic.hoa graphic.lst
; でアセンブルできます。naskはtolset05以降に含まれています。
; tolset05は http://www.imasy.orr/~kawai/osask/developers.html にあります。
[FORMAT "BIN"]
[INSTRSET "i386"]
[OPTIMIZE 1]
[OPTION 1]
[BITS 16]
ORG 0x0100
; パレットの設定
; 0-15はシステムパレットで、16以降は自由に使える、ってことにした(笑)
MOV BX,64
PALLOP:
MOV AX,0x1010
MOV DH,BL
AND DH,0x3f
MOV CH,DH
MOV CL,0
PUSH BX
INT 0x10
POP BX
INC BX
CMP BX,0x7f
JBE PALLOP
; VRAMへの書き込み
PUSH DS
MOV AX,0xa000
MOV DS,AX
XOR BX,BX
; まず8ラインをクリア
MOV AX,0x4040
CLR8LOP:
MOV [BX],AX
ADD BX,2
CMP BX,320*8
JB CLR8LOP
; グラデーション生成
GRALOP0:
MOV CX,320*3/2
GRALOP1:
MOV [BX],AX
ADD BX,2
DEC CX
JNZ GRALOP1
ADD AX,0x0101
CMP AL,0x7f
JBE GRALOP0
POP DS
; 何かキーを押してもらう
MOV AH,0x00
INT 0x16
; 画面をクリアしてOSに戻る
MOV AX,2
INT 0x80
XOR AX,AX
XOR CX,CX
INT 0x80

Binary file not shown.

View File

@@ -0,0 +1,23 @@
; へぼOS用アプリ "HELLO.NAS"
; TAB = 4
; copyright(C) 2003 川合秀実, KL-01
; prompt>nask hello.nas hello.hoa hello.lst
; でアセンブルできます。naskはtolset05以降に含まれています。
; tolset05は http://www.imasy.orr/~kawai/osask/developers.html にあります。
[FORMAT "BIN"]
[INSTRSET "i386"]
[OPTIMIZE 1]
[OPTION 1]
[BITS 16]
ORG 0x0100
MOV AX,1
MOV SI,msg
INT 0x80
XOR AX,AX
XOR CX,CX
INT 0x80
msg:
DB "hello, world",10,0

View File

@@ -0,0 +1,168 @@
/* へぼOS用IPL copyright(C) 2003 川合秀実, KL-01 */
/* ASKAがいろいろうるさいので、とりあえず書いておく */
segment CODE(USE32, PARA);
default(code == CODE);
void readsec();
void header()
// MS-DOS互換のためのヘッダ
{
asmout("[BITS 16]");
ORG(0x7c00);
asmout("JMP boot"); // ヘッダをスキップするためのジャンプ命令
NOP();
asmout("DB 'heboOS '"); // OEM name & version.
DW(512); // セクタ長(バイト単位)
DB(1); // クラスタ長(セクタ単位)
DW(1); // ブートセクタ長(セクタ単位)
DB(2); // FATの数
DW(0x00e0); // root directory entries.
DW(2880); // 総セクタ数
DB(0xf0); // media descriptor byte.
DW(9); // 1つのFATの長さ(セクタ単位)
DW(18); // 1トラックに収容されているセクタ数
DW(2); // ヘッド数
DD(0); // 不可視セクタ数
DD(2880); // 総セクタ数
DB(0, 0); /* unknown */
DB(0x29);
DD(0xffffffff);
asmout("DB 'heboOS '");
asmout("DB 'FAT12 '");
}
void boot()
{
SI = 33;
CL = 1;
AX = 0x0800;
ES = AX;
DS = AX;
SS = AX;
SP = 0xfffe;
BX = 0x0100;
readsec();
CL = [DS:0x0102];
BX = 0x0300;
SI = 34;
CL--;
if (!= 0)
readsec();
JMP(0x0800, 0x0100);
}
void readsec()
{
do {
PUSH(ES);
PUSH(SI);
PUSH(BX);
PUSH(DX);
PUSH(CX);
PUSH(AX);
AX = SI;
CL = 18;
DIV(CL);
CH = AL;
DH = AL;
CL = AH;
(unsigned char) CH /= 2;
DH &= 0x01;
CL++;
AX = 0x0201;
DL = 0;
INT(0x13);
POP(AX);
POP(CX);
POP(DX);
POP(BX);
POP(SI);
POP(ES);
if (CF != 0)
break;
BX += 512;
SI++;
CLC();
CL--;
} while (!= 0);
return;
}
void footer()
{
asmout("RESB 0x7dfe - $");
DW(0xaa55);
}
void FAT()
/* HEBOOS.SYSは64KBということにしておく */
/* だから64KBのFATチェインを */
{
DB(0xf0, 0xff, 0xff, 0x03, 0x40, 0x00, 0x05, 0x60);
DB(0x00, 0x07, 0x80, 0x00, 0x09, 0xa0, 0x00, 0x0b);
DB(0xc0, 0x00, 0x0d, 0xe0, 0x00, 0x0f, 0x00, 0x01);
DB(0x11, 0x20, 0x01, 0x13, 0x40, 0x01, 0x15, 0x60);
DB(0x01, 0x17, 0x80, 0x01, 0x19, 0xa0, 0x01, 0x1b);
DB(0xc0, 0x01, 0x1d, 0xe0, 0x01, 0x1f, 0x00, 0x02);
DB(0x21, 0x20, 0x02, 0x23, 0x40, 0x02, 0x25, 0x60);
DB(0x02, 0x27, 0x80, 0x02, 0x29, 0xa0, 0x02, 0x2b);
DB(0xc0, 0x02, 0x2d, 0xe0, 0x02, 0x2f, 0x00, 0x03);
DB(0x31, 0x20, 0x03, 0x33, 0x40, 0x03, 0x35, 0x60);
DB(0x03, 0x37, 0x80, 0x03, 0x39, 0xa0, 0x03, 0x3b);
DB(0xc0, 0x03, 0x3d, 0xe0, 0x03, 0x3f, 0x00, 0x04);
DB(0x41, 0x20, 0x04, 0x43, 0x40, 0x04, 0x45, 0x60);
DB(0x04, 0x47, 0x80, 0x04, 0x49, 0xa0, 0x04, 0x4b);
DB(0xc0, 0x04, 0x4d, 0xe0, 0x04, 0x4f, 0x00, 0x05);
DB(0x51, 0x20, 0x05, 0x53, 0x40, 0x05, 0x55, 0x60);
DB(0x05, 0x57, 0x80, 0x05, 0x59, 0xa0, 0x05, 0x5b);
DB(0xc0, 0x05, 0x5d, 0xe0, 0x05, 0x5f, 0x00, 0x06);
DB(0x61, 0x20, 0x06, 0x63, 0x40, 0x06, 0x65, 0x60);
DB(0x06, 0x67, 0x80, 0x06, 0x69, 0xa0, 0x06, 0x6b);
DB(0xc0, 0x06, 0x6d, 0xe0, 0x06, 0x6f, 0x00, 0x07);
DB(0x71, 0x20, 0x07, 0x73, 0x40, 0x07, 0x75, 0x60);
DB(0x07, 0x77, 0x80, 0x07, 0x79, 0xa0, 0x07, 0x7b);
DB(0xc0, 0x07, 0x7d, 0xe0, 0x07, 0x7f, 0x00, 0x08);
DB(0x81, 0xf0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
DB(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
RESB(4400);
DB(0xf0, 0xff, 0xff, 0x03, 0x40, 0x00, 0x05, 0x60);
DB(0x00, 0x07, 0x80, 0x00, 0x09, 0xa0, 0x00, 0x0b);
DB(0xc0, 0x00, 0x0d, 0xe0, 0x00, 0x0f, 0x00, 0x01);
DB(0x11, 0x20, 0x01, 0x13, 0x40, 0x01, 0x15, 0x60);
DB(0x01, 0x17, 0x80, 0x01, 0x19, 0xa0, 0x01, 0x1b);
DB(0xc0, 0x01, 0x1d, 0xe0, 0x01, 0x1f, 0x00, 0x02);
DB(0x21, 0x20, 0x02, 0x23, 0x40, 0x02, 0x25, 0x60);
DB(0x02, 0x27, 0x80, 0x02, 0x29, 0xa0, 0x02, 0x2b);
DB(0xc0, 0x02, 0x2d, 0xe0, 0x02, 0x2f, 0x00, 0x03);
DB(0x31, 0x20, 0x03, 0x33, 0x40, 0x03, 0x35, 0x60);
DB(0x03, 0x37, 0x80, 0x03, 0x39, 0xa0, 0x03, 0x3b);
DB(0xc0, 0x03, 0x3d, 0xe0, 0x03, 0x3f, 0x00, 0x04);
DB(0x41, 0x20, 0x04, 0x43, 0x40, 0x04, 0x45, 0x60);
DB(0x04, 0x47, 0x80, 0x04, 0x49, 0xa0, 0x04, 0x4b);
DB(0xc0, 0x04, 0x4d, 0xe0, 0x04, 0x4f, 0x00, 0x05);
DB(0x51, 0x20, 0x05, 0x53, 0x40, 0x05, 0x55, 0x60);
DB(0x05, 0x57, 0x80, 0x05, 0x59, 0xa0, 0x05, 0x5b);
DB(0xc0, 0x05, 0x5d, 0xe0, 0x05, 0x5f, 0x00, 0x06);
DB(0x61, 0x20, 0x06, 0x63, 0x40, 0x06, 0x65, 0x60);
DB(0x06, 0x67, 0x80, 0x06, 0x69, 0xa0, 0x06, 0x6b);
DB(0xc0, 0x06, 0x6d, 0xe0, 0x06, 0x6f, 0x00, 0x07);
DB(0x71, 0x20, 0x07, 0x73, 0x40, 0x07, 0x75, 0x60);
DB(0x07, 0x77, 0x80, 0x07, 0x79, 0xa0, 0x07, 0x7b);
DB(0xc0, 0x07, 0x7d, 0xe0, 0x07, 0x7f, 0x00, 0x08);
DB(0x81, 0xf0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
DB(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
RESB(4400);
}
void rootdir()
{
asmout("DB 'HEBOOS SYS',0x04");
DB(0,0,0,0,0,0,0,0,0,0);
DB(0, 0, 0, 0);
DW(0x002);
DD(64 * 1024);
RESB(0x00df * 32);
}

View File

@@ -0,0 +1,5 @@
cpp0 -P -I. -o ipl.ias ipl.ask
aska ipl.ias ipl.3as
naskcnv0 -l -s ipl.3as ipl.nas
nask ipl.nas ipl.bin ipl.lst
copy /B ipl.bin+os.com fdimage.bin

View File

@@ -0,0 +1,6 @@
cpp0 -P -I. -o os.ias os.ask
aska os.ias os.3as
naskcnv0 -l -s os.3as os.nas
nask os.nas os.bin os.lst
txt2bin charfont.txt charfont.bin
copy /B os.bin+charfont.bin os.com

View File

@@ -0,0 +1,560 @@
/* へぼOS copyright(C) 2003 川合秀実, KL-01 */
/* ASKAがいろいろうるさいので、とりあえず書いておく */
segment CODE(USE32, PARA);
default(code == CODE);
/* .COMファイルにするための記述 */
void COMFILE()
{
asmout("[BITS 16]");
ORG(0x0100);
}
void cls();
void putstr();
void scroll();
void readsec();
void loaddir();
void syscall();
void charfont();
#define SEG_DIR 0x1000
#define SEG_APP 0x2000
void main()
{
/* IPLのための記述 */
goto skip;
DW(3072 / 512); /* このOSの大きさ(512バイト単位) */
skip:
/* 画面モード設定 */
AX = 0x0013;
INT(0x10);
/* パレット設定 */
/* とりあえず、黒(0)と白(15)しか使わないので、それしか設定してない */
AX = 0x1010;
BX = 0;
DH = 0;
CX = 0;
INT(0x10);
AX = 0x1010;
BX = 15;
DH = 0x3f;
CX = 0x3f3f;
INT(0x10);
/* 画面初期化 */
cls();
asmout("MOV SI,.msg");
putstr();
/* システムコール用INTベクタ設定 */
PUSH(DS);
AX = 0;
DS = AX;
asmout("MOV WORD [DS:0x0200],syscall");
[DS:0x0202] = CS;
POP(DS);
loaddir();
command:
/* コマンドラインループ */
for (;;) {
AX = 0;
asmout("MOV BX,.cmdlin");
CX = 40 / 2;
do {
[DS:BX] = AX;
BX += 2;
CX--;
} while (!= 0);
asmout("MOV SI,.prompt");
putstr();
asmout("MOV SI,.cursor");
putstr();
for (;;) {
AH = 0x00;
INT(0x16);
BX = 0;
asmout("MOV BL,[putstr.curx]");
if ((unsigned) AL >= 0x20) {
if ((unsigned) AL < 0x7e) {
if ((unsigned) BL < 39) {
asmout("MOV SI,.char_cur");
[DS:SI + 1] = AL;
asmout("MOV [BX-2+.cmdlin],AL");
putstr();
continue;
}
}
}
if (AL == 0x08) { /* Backspace */
if ((unsigned) BL >= 3) {
asmout("MOV BYTE [BX-3+.cmdlin],0");
asmout("MOV SI,.backspace");
putstr();
continue;
}
}
if (AL == 0x0d)
break; /* Enter */
}
asmout("MOV SI,.delcur_lf");
putstr();
asmout("MOV BX,.cmdlin");
AX = [DS:BX + 0];
CX = [DS:BX + 2];
DX = [DS:BX + 4];
if (AX == 0)
continue;
/* cls */
if (AX == 0x6c63) {
if (CX == 0x0073) {
cls();
continue;
}
}
/* reset */
if (AX == 0x6572) {
if (CX == 0x6573) {
if (DX == 0x0074) {
INT(0x19);
continue;
}
}
}
/* BASIC(どうなるか分からない隠しコマンド・・・笑) */
if (AX == 0x4142) {
if (CX == 0x4953) {
if (DX == 0x0043) {
INT(0x18);
continue;
}
}
}
/* dir */
if (AX == 0x6964) {
if (CX == 0x0072) {
PUSH(ES);
AX = CS;
AX += SEG_DIR;
ES = AX;
DI = 0;
for (;;) {
AX = [ES:DI];
if (AL == 0)
break;
if (AL != 0xe5) {
TEST((char) [ES:DI + 11], 0x18);
if (== 0) {
asmout("MOV SI,.cmdlin");
[DS:SI + 0] = AX;
AX = [ES:DI + 2];
[DS:SI + 2] = AX;
AX = [ES:DI + 4];
[DS:SI + 4] = AX;
AX = [ES:DI + 6];
[DS:SI + 6] = AX;
AL = 0x20;
AH = [ES:DI + 8];
[DS:SI + 8] = AX;
AL = [ES:DI + 9];
AH = [ES:DI + 10];
[DS:SI + 10] = AX;
(short) [DS:SI + 12] = 0x000a;
putstr();
}
}
DI += 32;
}
POP(ES);
continue;
}
}
/* コマンド名とみなして、????????.hoaを探す */
CL = 8;
do {
AL = [DS:BX];
if (AL == 0x00)
AL = 0x20;
if ((unsigned) AL >= 0x61) {
if ((unsigned) AL <= 0x7a)
AL -= 0x20;
}
[DS:BX] = AL;
BX++;
CL--;
} while (!= 0);
BX -= 8;
PUSH(ES);
AX = CS;
AX += SEG_DIR;
ES = AX;
DI = 0;
for (;;) {
AX = [ES:DI];
if (AL == 0)
break;
TEST((char) [ES:DI + 11], 0x18);
if (== 0) {
if ((unsigned) (short) [ES:DI + 8] == 0x4f48) {
if ((unsigned) (char) [ES:DI + 10] == 0x41) {
if (AX == [DS:BX]) {
AX = [ES:DI + 2];
if (AX == [DS:BX + 2]) {
AX = [ES:DI + 4];
if (AX == [DS:BX + 4]) {
AX = [ES:DI + 6];
if (AX == [DS:BX + 6]) {
/* ファイル発見! */
AX = [ES:DI + 26];
AX -= 2;
asmout("MUL WORD [loaddir.SIZ_CLU]");
asmout("ADD AX,[loaddir.LBA_CLU2]");
SI = AX;
CL = 1;
AX = CS;
AX += SEG_APP;
ES = AX;
BX = 0x0100;
readsec();
if (CF != 0) {
asmout("MOV SI,.diskerr");
putstr();
goto command;
}
AX = ES;
SS = AX;
SP = 0xfffe;
DS = AX;
PUSH(AX);
PUSH(0x0100);
RETF(); /* アプリケーションに分岐 */
}
}
}
}
}
}
}
DI += 32;
}
POP(ES);
asmout("MOV SI,.badcmd");
putstr();
}
msg:
asmout("DB 'heboOS dayoon!',10");
lf:
DB(10, 0);
prompt:
asmout("DB '>',0");
char_cur:
DB(8, 0);
cursor:
asmout("DB '_',0");
backspace:
DB(8, 0x20, 8, 8);
asmout("DB '_',0");
delcur_lf:
DB(8, 0x20, 10, 0);
badcmd:
asmout("DB 'Bad command o','r file name',10,0");
/* naskcnv0が馬鹿なので、'or'と素直に書くと変な反応をしてしまう */
diskerr:
asmout("DB 'Disk error',10,0");
ALIGNB(2);
cmdlin:
RESB(40);
}
void cls()
{
PUSH(DS);
AX = 0xa000;
DS = AX;
BX = 0;
AX = 0;
do {
[DS:BX] = AX;
BX += 2;
} while (!= 0);
POP(DS);
asmout("MOV [CS:putstr.curx],AX"); /* 表示座標を0に */
return;
}
void putstr()
/* DS:SIにテキスト */
/* 理解できるコントロールコードは0x08,0x0aだけ(=ただの手抜き) */
/* 0x00に遭遇したら終わる */
{
PUSH(ES);
PUSH(DI);
PUSH(SI);
PUSH(BX);
PUSH(CX);
PUSH(AX);
AX = 0xa000;
ES = AX;
for (;;) {
BX = 0;
BL = [DS:SI];
SI++;
if (BL == 0x0a)
goto newline;
if (BL == 0x08) {
asmout("DEC BYTE [CS:.curx]");
continue;
}
BX *= 16;
if (== 0)
break;
asmout("ADD BX,-0x20*16+charfont");
/* DI = curx * 8 + cury * 16 * 320; */
AX = 0;
asmout("MOV AL,[CS:.curx]");
AX *= 8;
CX = 0;
asmout("MOV CX,[CS:.cury]");
DI = CX;
DI *= 4;
DI += CX; /* これで、DI = CX * 5; */
DI *= 1024;
DI += AX;
CH = 16;
do {
CL = 8;
AL = [CS:BX];
BX++;
do {
AL <<= 1;
SBB(AH, AH); /* if (CF == 0) AH = 0; else AH = 0xff; */
AH &= 0x0f;
[ES:DI] = AH;
DI++;
CL--;
} while (!= 0);
DI += 320 - 8;
CH--;
} while (!= 0);
asmout("MOV AL,BYTE [CS:.curx]");
AL++;
asmout("MOV BYTE [CS:.curx],AL");
if (AL == 40) {
newline:
asmout("MOV BYTE [CS:.curx],0");
asmout("MOV AL,BYTE [CS:.cury]");
AL++;
asmout("MOV BYTE [CS:.cury],AL");
if (AL == 12)
scroll();
}
}
POP(AX);
POP(BX);
POP(CX);
POP(SI);
POP(DI);
POP(ES);
return;
ALIGNB(2);
curx: DB(0);
cury: DB(0);
}
void scroll()
{
PUSH(DS);
AX = 0xa000;
DS = AX;
SI = 320 * 16;
DI = 0;
do {
AX = [DS:SI];
SI += 2;
[DS:DI] = AX;
DI += 2;
} while ((unsigned) SI < 320 * 200);
AX = 0;
do {
[DS:DI] = AX;
DI += 2;
} while ((unsigned) DI < 320 * 200);
POP(DS);
asmout("DEC BYTE [CS:putstr.cury]");
return;
}
void readsec()
{
CH = 3;
do {
PUSH(ES);
PUSH(SI);
PUSH(BX);
PUSH(DX);
PUSH(CX);
PUSH(AX);
AX = SI;
CL = 18;
DIV(CL);
CH = AL;
DH = AL;
CL = AH;
(unsigned char) CH /= 2;
DH &= 0x01;
CL++;
AX = 0x0201;
DL = 0;
INT(0x13);
POP(AX);
POP(CX);
POP(DX);
POP(BX);
POP(SI);
POP(ES);
if (CF != 0) {
CH--;
if (== 0)
break;
PUSH(ES);
PUSH(SI);
PUSH(BX);
PUSH(DX);
PUSH(CX);
PUSH(AX);
AH = 0x11;
DL = 0;
INT(0x13);
POP(AX);
POP(CX);
POP(DX);
POP(BX);
POP(SI);
POP(ES);
continue;
}
BX += 512;
SI++;
CLC();
CL--;
} while (!= 0);
return;
}
void loaddir()
/* ディスクからディレクトリを読み込む */
{
PUSH(ES);
AX = CS;
AX += SEG_DIR;
ES = AX;
(char) [ES:0] = 0x00; /* エラーのときは、ファイルなし、になる */
AX = CS;
AX += SEG_APP;
ES = AX;
BX = 0;
SI = 0;
CL = 1;
readsec();
if (CF != 0)
goto err;
AL = [ES:0x000d];
asmout("MOV [.SIZ_CLU],AL");
AX = [ES:0x000e];
asmout("MOV [.LBA_FAT],AX");
CX = [ES:0x0016];
AX += CX;
asmout("MOV [.LBA_FAT2],AX");
AX += CX;
asmout("MOV [.LBA_DIR],AX");
CX = [ES:0x0011];
asmout("MOV [.SIZ_DIR],CX");
CX *= 32;
CX += 511;
(unsigned short) CX /= 512;
AX += CX;
asmout("MOV [.LBA_CLU2],AX");
AX = CS;
AX += SEG_DIR;
ES = AX;
BX = 0;
asmout("MOV SI,[.LBA_DIR]");
readsec();
asmout("MOV BX,[.SIZ_DIR]");
BX--;
BX *= 32;
(char) [ES:BX] = 0x00; /* もしものためのターミネータ */
err:
POP(ES);
return;
ALIGNB(2);
LBA_FAT:
DW(1);
LBA_FAT2:
DW(10);
LBA_DIR:
DW(19);
LBA_CLU2:
DW(33);
SIZ_DIR:
DW(0x00e0);
SIZ_CLU:
DW(1);
}
void syscall()
/* アプリケーションから呼ばれる */
{
PUSH(DI);
PUSH(SI);
PUSH(BP);
PUSH(BX);
PUSH(DX);
PUSH(CX);
PUSH(AX);
BP = SP;
if (AX == 0) { /* アプリ終了, CXに戻り値でも入れればいいね */
AX = CS;
SS = AX;
SP = 0xfffe;
DS = AX;
ES = AX;
asmout("JMP main.command");
}
if (AX == 1) { /* 文字表示ファンクション */
putstr();
goto fin;
}
if (AX == 2) { /* 画面クリアファンクション */
cls();
goto fin;
}
err:
(char) [SS:BP + 18] |= 0x01; /* STC */
goto fin2;
fin:
(char) [SS:BP + 18] &= 0xfe; /* CLC */
fin2:
POP(AX);
POP(CX);
POP(DX);
POP(BX);
POP(BP);
POP(SI);
POP(DI);
IRET();
}
void charfont() {}
/* makeos.batがここにフォントバイナリをくっつける */

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,79 @@
; NASKで作ったへぼOS専用IPL(AT互換機用)
; TAB = 4
; copyright(C) 2003 川合秀実, KL-01
; OSは512バイト未満であると仮定
; OSはシリンダ0、ヘッド0、セクタ2から入っていると想定
; prompt>nask ipl.nas ipl.bin ipl.lst
; でアセンブルできます。naskはtolset05以降に含まれています。
; tolset05は http://www.imasy.orr/~kawai/osask/developers.html にあります。
; ディスクイメージを作るにはこうします。
; prompt>copy /B ipl.bin+os.com fdimage.bin
; これをディスクに書き込むにはこうします。
; まずフォーマット済みのディスクをA:に入れる。
; prompt>imgtol w a: fdimage.bin
; imgtolもtolset05以降に含まれています。
[FORMAT "BIN"]
[INSTRSET "i386"]
[OPTIMIZE 1]
[OPTION 1]
[BITS 16]
ORG 0x7c00
JMP START
NOP
DB 'hogehoge'
; FATなんか用意してもいないくせに、BPBを作ってFAT12だということにしておく
; これをなくすと、ディスクをフォーマットしないとimgtolで読み書きできなくなるので
; しょうがないので入れておく
DW 512 ; セクタ長(バイト単位)
DB 1 ; クラスタ長(セクタ単位)
DW 1 ; ブートセクタ長(セクタ単位)
DB 2 ; FATの数
DW 0x00e0 ; root directory entries.
DW 2880 ; 総セクタ数
DB 0xf0 ; media descriptor byte.
DW 9 ; 1つのFATの長さ(セクタ単位)
DW 18 ; 1トラックに収容されているセクタ数
DW 2 ; ヘッド数
DD 0 ; 不可視セクタ数
DD 2880 ; 総セクタ数
DB 0, 0 ; /* unknown */
DB 0x29
DD 0xffffffff
DB "hogehoge "
DB "FAT12 "
; このディスクはDOSやWinでは読み書きできませんので、よろしく
START:
MOV AX,0x0201
MOV CX,0x0002
XOR DX,DX
MOV BX,0x0800
MOV ES,BX
MOV BX,0x0100
INT 0x13
JC ERR
; .COMファイルのなので、DOS互換のレジスタ状態にしてやる
MOV AX,0x0800
MOV SS,AX
MOV SP,0xfffe
MOV DS,AX
MOV ES,AX
JMP 0x0800:0x0100
ERR:
INT 0x18 ; ROM-BASICへ
RESB 0x7dfe-$ ; 0x7dfeまで0x00で埋める
DB 0x55,0xaa

Binary file not shown.

View File

@@ -0,0 +1,81 @@
; NASKで作った.COMファイル型へぼOS (AT互換機専用)
; mini-FirstStepOS
;
; TAB = 4
; copyright(C) 2003 川合秀実, KL-01
;
; .COMファイルはプログラムが64KBを越えない限りにおいてはもっとも簡単
; たいていの人は最終的にOSが64KBを越えるからという理由で.COMを
; 選択したくないと思うだろう。しかし最初から.EXEの苦労を味わう必要はない。
; 64KBを越えたらその時に.EXE化すればいいではないか。
; .COMならセグメントも気にしなくていいので気楽なものだ。
; prompt>nask os.nas os.com os.lst
; でアセンブルできます。naskはtolset05以降に含まれています。
; tolset05は http://www.imasy.orr/~kawai/osask/developers.html にあります。
[FORMAT "BIN"]
[INSTRSET "i386"]
[OPTIMIZE 1]
[OPTION 1]
[BITS 16]
ORG 0x0100 ; .COMは必ずORG 0x0100で始まる
; さて何をしようか。とりあえず320x200x256色でもやってグラデーションを
; 出して遊ぶかな?("hello"とかは平凡すぎるだろうから)
; 画面モードとパレット設定
MOV AX,0x0013
INT 0x10
XOR BX,BX
PALLOP:
MOV AX,0x1010
MOV DH,BL
MOV CH,BL
MOV CL,0
PUSH BX
INT 0x10
POP BX
INC BX
CMP BX,0x3f
JBE PALLOP
MOV AX,0x1010
MOV BL,255
MOV DH,0x3f
MOV CX,0x3f3f
INT 0x10
; VRAMへの書き込み
PUSH DS
MOV AX,0xa000
MOV DS,AX
XOR BX,BX
; まず8ラインをクリア
XOR AX,AX
CLR8LOP:
MOV [BX],AX
ADD BX,2
CMP BX,320*8
JB CLR8LOP
; グラデーション生成
GRALOP0:
MOV CX,320*3/2
GRALOP1:
MOV [BX],AX
ADD BX,2
DEC CX
JNZ GRALOP1
ADD AX,0x0101
CMP AL,0x3f
JBE GRALOP0
POP DS
JMP $ ; おしまい(リセットボタンを押してね)

View File

@@ -0,0 +1,98 @@
川合堂许可协议-01 ver.1.0
2000.12.30 H.Kawai (川合秀实)
0.概要
通俗地说:“这是自由软件,使用前使用后都无须支付任何费用,可以自由使用,也可以
复制、修改以及用于商业目的但是作者对软件的bug以及因此所造成的损失不负任何责
任。”
为了保护软件使用者以及软件修改者、参考者的利益,即便作者将来为该软件中所使用的
算法申请专利,也保证不会向使用者收取授权费用。
1.目的
适用于本协议的软件,旨在为公众带来利益,以及为软件技术的进步做出贡献。
2.宗旨
本协议并不代表作者放弃著作权(仅放弃独家复制发布的权利),使用者可以自由复制并
再次发布本软件的一部分甚至全部内容。使用时无须支付任何费用,对本软件的解析、修改
也无须支付任何费用。
适用于本协议的软件,可以无条件地用作商业目的,甚至可以将软件直接有偿出售。
对于以适用于本协议的软件的一部分或全部内容为基础,在此之上所开发的软件(下称“
派生物”),可以赋予任何种类的许可协议。即,派生物的作者可以禁止对派生物进行复制,
也可以只允许派生物以有偿形式发布。派生物的著作权属于该派生物的生成者,适用于本协
议的软件作者不会对其派生物主张著作权。
在派生物的文档中,没有义务对原始软件的作者进行介绍,但这句话,理所当然地,不意
味着禁止这一行为。
在发布派生物时,没有义务取得原始软件作者的同意,但这句话,理所当然地,不意味着
禁止这一行为。
作者不对软件的质量作出任何保证,因此,由于使用本软件所造成的损害,或者没有达到
所期望的结果,作者不负任何责任。
对于适用于本协议的软件中所使用的技术,除了事先取得作者授权的人以外,禁止其他人
对其申请专利。但如果附加了新的技术并生成了派生物,允许对于追加的部分申请专利。作
者在将来有可能对软件中的技术申请专利,但保证不会向派生物以及软件的使用收取授权费
用。本保证不仅适用于申请专利之前所生成的派生物,也适用于专利取得后所生成的派生物。
将解析结果汇总并申请专利,需要事先取得作者的同意,但对于申请专利以外的行为,没
有任何限制。
3.补充
基本上,作者十分欢迎复制本软件。如果要表示对作者的感谢,请将本软件推荐给更多的
人,并复制给他们使用。作者希望有更多的人使用本软件,因此对于复制的行为非常支持。
除此之外,如果可以将使用后的感想发给作者,作者一定会感到更加高兴。
对于本协议所授权的软件,仅修改著作权信息并再次发布的行为,本协议并没有禁止,而
是作为派生物来处理。这并不是一个漏洞。因此,如果你认为有必要仅修改著作权信息并再
次发布本软件,是完全可以这样做的。
除了修复bug、增加新功能等修改行为以外对于为代码添加注释增加易读性、对文档进行
补充等,不会反映在编译产物及运行结果上的修改也同样欢迎。如果生成了这样的派生物,
欢迎和作者联系(但这并不是义务)。
如果你有任何疑问,或者对于制作派生物方面感到缺少某些信息,可以向作者提问。但是,
受作者精力所限可能无法一一进行回复,请大家谅解。对于协议本身漏洞的指摘,请联系作
者或川合堂。
也许,对于本协议所授权的软件中所使用的技术,禁止未经作者允许申请专利这一点,和
日本的专利法是向抵触的(希望大家提出自己的见解)。对此,最初提出本协议的川合秀实
的见解如下。
指定专利法的背景,是因为如果发明者为了保护自己发明所带来的利益,而拒绝将发明的
详情公开,会阻碍科学技术的进步,因此在法律上对于其所公开的内容,在一定时间内给予
独家使用的保护,这是专利法的精神所在。在本协议中,作者并没有故意隐藏发明的详细内
容,因此即便禁止对其申请专利我认为也不违背专利法的精神。相反,不理解本协议精神的
人,如果申请了专利并对原创的软件及派生物收取授权费用,这种担心反倒阻碍了科学技术
的进步。因此,本协议的目的是事先消除这种担心,我认为和专利法是不抵触的。
当然,最稳妥的做法是,作者对原创软件中可以被认作发明的全部内容申请并取得专利,
事前防止其他人来取得相关的专利,但是这对于作者来说负担很大。申请专利的负担和是否
公开软件内容之间必须要有所取舍的话,可能有些人会放弃公开软件内容。这并不是专利法
精神所期待的,也不符合我们的目的(参见“1.目的”)。
此外,当发明的详细内容由于专利法的形式限制没有记述并明确的,由作者以外的人在未
经许可的情况下将其解析并明确的行为,在本协议中是允许的。对于这部分内容,可以无偿
公开,也可以有偿出售。
不过,对于协议所授权的软件中的所有技术,并不能保证在使用时完全避免支付授权费用
的可能性。如果在发布的时间点仍然有效的专利技术,在软件中被使用的话,该专利的所有
者可以要求支付授权费用。本协议所保证的不收取专利授权费用,是针对软件内被认为是新
发明的那一部分技术。
如果需要将本协议适用于自己开发的软件,在事前事后均无须经过作者同意,可任意使用。
如果有任何不方便之处,可以对协议文本进行修改。如需修改协议文本,为了避免歧义,请
同时修改协议的名称。
4.链接
川合堂URL http://www.imasy.org/~mone/kawaido/
川合秀实URL http://www.imasy.org/~kawai/
e-mail kawai@imasy.org

View File

@@ -0,0 +1,107 @@
关于omake目录的内容
关于下面的说明如果有不明白的地方,请到支持页面提问。
1.tolsrc目录
tolset的源代码。虽然这些代码可能没有什么人会去看不过有总比没有要好吧
读者当中总归有一两个人想看这些源代码的)。
aksa1a aksa.exe的源代码。
-- 这是对ASKA进行反汇编的软件将可执行文件转换为源代码
关于ASKA请参见下面的说明。
aska aska.exe的源代码。
-- 这是一个和nask语法不大一样汇编器。比如用 EAX = ECX; 来代替 MOV。
笔者很喜欢用不过bug比较多不太好用因此也没向大家推荐。
bim2bi4w bim2bin.exe的源代码。
bim2hrb bim2hrb.exe的源代码。
bin2obj bin2obj.exe的源代码。
doscmd0a doscmd.exe的源代码。
-- 这主要是为Cygwin中tolset无法正常工作的人所准备的工具。详细请参见
tolopt/fix_cygw/readme.txt 或者参见支持页面。
edimg0j edimg.exe的源代码。
go_0023s cc1.exe, cpp0.exe, nask.exe, gas2nask.exe, golib00.exe,
naskcnv0.exe, sjisconv.exe, golibc.lib, w32clibc.lib 的
源代码。
cc1.exe -- C语言编译器
cpp0.exe -- 仅处理 #include 和 #define 的程序
nask.exe -- 汇编器
gas2nask.exe -- 将cc1输出的文件转换为nask格式
golib00.exe -- 库管理器
naskcnv0.exe -- 将aska输出的文件转换为nask格式
sjisconv.exe -- 将包含全角字符的源代码转换为cc1可安全
处理的格式
golibc.lib -- sprintf等不依赖操作系统的标准函数库
随编译器附带的
w32clibc.lib -- Windows用的标准函数库
hrblib0a z_tools/haribote/harilibc.lib的源代码。
-- 用来调用HariMain的库。
imgtol0d imgtol.com的源代码。
makefont makefont.exe的源代码。
obj2bi4d obj2bim.exe的源代码。
osalink1 osalink1.exe的源代码。
-- 这是OSASK的操作系统核心专用的连接器。这个东西可能也没什么用处
不过将这个程序放到tolset中是OSASK界的惯例因此也就放进去了。
既然如此这里也需要提供这个程序的源代码,仅此而已。
sartol0j sartol.exe的源代码。
-- 用tek压缩算法对文件进行压缩、解压缩的软件。标准扩展名为.sar。
tk5lgpl1 t5lzma.exe的源代码。
2.osask目录
这是笔者正在开发的OSASK的ver.4.7版本,附送给大家的。也许这个没有什么用,
有兴趣的话就权当消遣也无所谓。
osat47i 最基本的OSASK软件包。只要参照README0.TXT的第4.章就可以完成
安装。其他章节中介绍了如何安装到硬盘或移动存储器,不过有很多
相关的注意事项,不遵守的话可能会比较危险,不推荐大家这样做。
osat47uf 如果使用USB软盘驱动器的话请用这个代替osat47i。
osat47cd 用于CD-ROM启动的.ISO版OSASK。
make47 OSASK ver.4.7 的源代码。
3.heboos目录
这是一个笔者发表在 http://community.osdev.info/?FirstStep 上面的一个功能非常
低级的操作系统。这个系统全部用汇编语言编写而且是16位模式的。在本书出版之前
一直是用这个系统作为“操作系统自制入门”的。
minifsos是“迷你版mini初级first-step操作系统”的意思操作系统只有80个
字节,只能画出一些图形。详情请参见上述网页。
heboos是另外一个操作系统核心的大小增加到1.08KB。虽然这个大小只有“纸娃娃系统”
的3%不到但是可以执行dir等命令。详情请参见上述网页。
上面提到的两个系统,在看完本书学习了操作系统编写方法之后,基本上都没有参考价值
作为一个只用asmhead.nas来编写的操作系统实例来说还是不错的因此笔者将它们也
放在光盘中附送给大家,给大家展示一个只用汇编语言就能编写出操作系统的世界。
4.tolopt目录
这是为扩展、改良tolset用的tolset扩展工具包有需要的话可以使用基本上不会用到
每个工具的使用方法详见各目录中的readme.txt。
fix_cygw 由于使用Cygwin而无法正常make的人可以用这个。
bochs226 QEMU无论如何也无法正常工作或者不喜欢QEMU想要换用其他模拟器的话
这里给大家准备了bochs-2.2.6。
5.其他
如果想要用QEMU随便体验一下笔者开发的OSASK请双击 tolset/z_osabin/ 的run.bat。
关于使用方法请参见上述osat47i中的readme文件。

View File

@@ -0,0 +1 @@
command

View File

@@ -0,0 +1 @@
cmd.exe

View File

@@ -0,0 +1,111 @@
# Makefile for OSASK
# ver. 0.0
TOOLPATH = ../z_tools/
include make_com.txt
ALL :
# デフォルト動作:各自好きなようにカスタマイズすればいい
$(MAKE) img_at
all :
$(MAKE) at
$(MAKE) tw
$(MAKE) ne
at :
$(MAKE) -C pcat
$(COPY) pcat\OSASK.EXE OSASK_AT.EXE
$(EDIMG) binin:OSASK_AT.EXE exe2bin seg:2048 binout:OSASK_AT.SYS
tw :
$(MAKE) -C towns
$(COPY) towns\OSASK.EXE OSASK_TW.EXE
$(EDIMG) binin:OSASK_TW.EXE exe2bin seg:2048 binout:OSASK_TW.SYS
ne :
$(MAKE) -C nec98
$(COPY) nec98\OSASK.EXE OSASK_NE.EXE
$(EDIMG) binin:OSASK_NE.EXE exe2bin seg:2048 binout:OSASK_NE.SYS
qe :
$(MAKE) -C qemu
$(COPY) qemu\OSASK.EXE OSASK_QE.EXE
$(EDIMG) binin:OSASK_QE.EXE exe2bin seg:2048 binout:OSASK_QE.SYS
run : Makefile qemu/edimgopt.txt $(TOOLPATH)osa_qemu/OSAIMGAT.BIN
$(MAKE) qe
$(EDIMG) imgin:$(TOOLPATH)osa_qemu/OSAIMGAT.BIN @qemu/edimgopt.txt \
imgout:qemu/OSAIMGQE.BIN imgout:$(TOOLPATH)qemu/FDIMAGE0.BIN
$(MAKE) -C $(TOOLPATH)qemu
bo :
$(MAKE) -C bochs
$(COPY) bochs\OSASK.EXE OSASK_BO.EXE
$(EDIMG) binin:OSASK_BO.EXE exe2bin seg:2048 binout:OSASK_BO.SYS
vm :
$(MAKE) -C vmware3
$(COPY) vmware3\OSASK.EXE OSASK_VM.EXE
$(EDIMG) binin:OSASK_VM.EXE exe2bin seg:2048 binout:OSASK_VM.SYS
img_at :
$(MAKE) at
$(EDIMG) imgin:fdimg0at.tek wbinimg src:osaskbs1.bin len:512 from:0 to:0 \
bias:9 create file:@:osask.sys size:108k begin:5 \
ovrcopy from:OSASK_AT.SYS to:@:OSASK.SYS \
setattr file:@:OSASK.SYS attr:0x06 imgout:OSAIMGAT.BIN
img_tw :
$(MAKE) tw
$(EDIMG) imgin:fdimg0tw.tek wbinimg src:osaiplt0.bin len:1024 from:0 to:0 \
bias:9 create file:@:osask.sys size:106k begin:7 \
ovrcopy from:OSASK_TW.SYS to:@:OSASK.SYS \
setattr file:@:OSASK.SYS attr:0x06 imgout:OSAIMGTW.BIN
img_ne :
$(MAKE) ne
$(EDIMG) imgin:fdimg0tw.tek wbinimg src:osaipln0.bin len:1024 from:0 to:0 \
bias:9 create file:@:osask.sys size:106k begin:7 \
ovrcopy from:OSASK_NE.SYS to:@:OSASK.SYS \
setattr file:@:OSASK.SYS attr:0x06 imgout:OSAIMGNE.BIN
img_qe :
$(MAKE) qe
$(EDIMG) imgin:fdimg0at.tek wbinimg src:osaskbs1.bin len:512 from:0 to:0 \
bias:9 create file:@:osask.sys size:108k begin:5 \
ovrcopy from:OSASK_QE.SYS to:@:OSASK.SYS \
setattr file:@:OSASK.SYS attr:0x06 imgout:OSAIMGQE.BIN
img_bo :
$(MAKE) bo
$(EDIMG) imgin:fdimg0at.tek wbinimg src:osaskbs1.bin len:512 from:0 to:0 \
bias:9 create file:@:osask.sys size:108k begin:5 \
ovrcopy from:OSASK_BO.SYS to:@:OSASK.SYS \
setattr file:@:OSASK.SYS attr:0x06 imgout:OSAIMGBO.BIN
img_vm :
$(MAKE) vm
$(EDIMG) imgin:fdimg0at.tek wbinimg src:osaskbs1.bin len:512 from:0 to:0 \
bias:9 create file:@:osask.sys size:108k begin:5 \
ovrcopy from:OSASK_VM.SYS to:@:OSASK.SYS \
setattr file:@:OSASK.SYS attr:0x06 imgout:OSAIMGVM.BIN
clean :
# OSASK_??.EXE/SYSやディスクイメージは残るが中間生成物は全て消される
$(MAKE) -C pcat clean
$(MAKE) -C towns clean
$(MAKE) -C nec98 clean
$(MAKE) -C sgg00lib clean
$(MAKE) -C qemu clean
$(MAKE) -C bochs clean
$(MAKE) -C vmware3 clean
src_only :
$(MAKE) clean
-$(DELE) sgg00lib\sgg00lib.lib
-$(DELE) OSASK_*.EXE
-$(DELE) OSASK_*.SYS
-$(DELE) OSAIMG*.BIN
-$(DELE) qemu\OSAIMGQE.BIN

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,41 @@
#include <stdio.h>
const int main(int argc, char **argv)
{
FILE *fp0, *fp1;
if (argc != 3) {
fputs("\"txt2bin\" copyright (C) 2001 H.Kawai\n"
"usage : >txt2bin source.txt font.bin\n", stdout
);
return 1;
}
fp0 = fopen(argv[1], "r");
fp1 = fopen(argv[2], "wb");
if (fp0 == NULL) {
fputs("can't open input file.\n", stderr);
return 2;
}
if (fp1 == NULL) {
fputs("can't open output file.\n", stderr);
return 3;
}
do {
char s[12];
int i;
if (fgets(s, 12, fp0) != NULL && (s[0] == ' ' || s[0] == '*' || s[0] == '.')) {
i = (s[0] == '*') << 7;
i |= (s[1] == '*') << 6;
i |= (s[2] == '*') << 5;
i |= (s[3] == '*') << 4;
i |= (s[4] == '*') << 3;
i |= (s[5] == '*') << 2;
i |= (s[6] == '*') << 1;
i |= (s[7] == '*') ;
fputc(i, fp1);
}
} while (!feof(fp0));
fclose(fp0);
fclose(fp1);
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,364 @@
; "base.nas" ver.3.1
; OSASK用のブートプログラム
; Copyright(C) 2004 H.Kawai (川合秀実)
; TAB = 4
[BITS 16]
[OPTIMIZE 1]
[OPTION 1]
[INSTRSET "i486p"]
[FORMAT "BIN"]
BootMdl EQU 0
SysWorkMdl EQU (BootSiz + 0x0f) / 16 + BootMdl
StackMdl EQU 0 ; (osalink0が調節してくれるので気にしない)
; <header> 30bytes. 0x0000 - 0x001d
header:
DB "MZ"
DW 0, 0 ; 最終ページサイズ、ファイルページ数 (osalink0が調節してくれるので気にしない)
DW (relent1-relent0)/4 ; relocation entries
DW 0x20 ; header-size / 16
DW StackSiz / 16 ; BSS-size / 16 (== stack-size / 16)
DW 0xffff ; MAXALLOC
DW 0 ; DOS_SS0 (osalink0が調節してくれるので気にしない)
DW StackSiz ; DOS_SP0
DW 0 ; check-sum (ignore)
DW 0 ; DOS_IP0 (entry-offset)
DW 0 ; DOS_CS0 (entry-seg, relative)
DW 0x001e ; relocation table offset
DW 0 ; not use overlay
DW 1 ; "I don't know."
; <relocation table image> 0x001e - 0x01ff
; org 0x001e
relent0:
; DW ofs, seg
DW BootMdl*16+4, 0 ; for SysWorkMdl
DW SysWorkMdl*16+modulelist+ 0*16+12, 0
DW SysWorkMdl*16+modulelist+ 1*16+12, 0
DW SysWorkMdl*16+modulelist+ 2*16+12, 0
DW SysWorkMdl*16+modulelist+ 3*16+12, 0
DW SysWorkMdl*16+modulelist+ 4*16+12, 0
DW SysWorkMdl*16+modulelist+ 5*16+12, 0
DW SysWorkMdl*16+modulelist+ 6*16+12, 0
DW SysWorkMdl*16+modulelist+ 7*16+12, 0
DW SysWorkMdl*16+modulelist+ 8*16+12, 0
DW SysWorkMdl*16+modulelist+ 9*16+12, 0
DW SysWorkMdl*16+modulelist+10*16+12, 0
DW SysWorkMdl*16+modulelist+11*16+12, 0
DW SysWorkMdl*16+modulelist+12*16+12, 0
DW SysWorkMdl*16+modulelist+13*16+12, 0
DW SysWorkMdl*16+modulelist+14*16+12, 0
DW SysWorkMdl*16+modulelist+15*16+12, 0
DW SysWorkMdl*16+modulelist+16*16+12, 0
DW SysWorkMdl*16+modulelist+17*16+12, 0
relent1:
RESB header+512-$
ORG 0x0000 ; NASKは何回でもORGできる
BootBgn:
Entry:
JMP .entry2 ; 2バイト
RESB 4-$ ; MASMORG(0x0004)
.SysWorkSeg:
DW SysWorkMdl
RESB 8-$ ; MASMORG(0x0008)
; KHBIOS用スクリプト
DB 0x10,0x89,0x00,0xd8,0x00,0x00
DD 0x8000,36
DB 0x1a
DW 0x0000,0x0800
.entry2:
MOV SI, DS
MOV DS, WORD [CS:.SysWorkSeg]
MOV AX, CS
ADD SI,16
CMP AX, SI
#if (defined(PCAT))
MOV ECX,(640-16)*1024 ; for PCAT
#elif (defined(TOWNS))
MOV ECX,(640+128)*1024 ; for TOWNS
#elif (defined(NEC98))
MOV ECX,640*1024 ; for NEC98
#endif
JE .fromdos
MOV BYTE [DiskCacheReady],3
MOV AX,4096/16
.fromdos:
SHL EAX,4
ADD EAX,0xfff;
AND EAX,0xff000 ; 4KB単位にする
MOV DWORD [bootmalloc_adr1],EAX
SUB ECX,EAX
MOV DWORD [bootmalloc_fre1],ECX
#if (defined(PCAT))
MOV AH, 0x02
INT 0x16 ; keyboard BIOS
SHR AL,4
AND AL,0x07
MOV BYTE [boot_keylock],AL
#elif (defined(NEC98))
MOV CH,0xC0
MOV AH,0x42
INT 0x18 ; 400ライングラフィックモード(BIOS)
MOV AH,0x40
INT 0x18 ; グラフィック画面表示(BIOS)
MOV AH,0x0d
INT 0x18 ; テキスト画面非表示(BIOS)
; MOV AL,0xff
; OUT 0x0002,AL ; 割り込みマスク
; MOV AH,0x03
; INT 0x18 ; キーボード初期化
#endif
MOV AX,[CS:0x0002]
MOV [CFport],AX
#if (defined(PCAT))
#if (defined(BOCHS))
mov ax, word ds:[VGA_mode]
int 10h
#else
; mov ax, word ds:[VGA_mode]
; int 10h
#endif
;mov dx,03d4h
;mov ax,3213h
;out dx,ax
#endif
; ここでA20を有効にする
#if (defined(PCAT))
/* エッジトリガ対策 */
MOV AL,0xff
OUT 0x21,AL
NOP
OUT 0xa1,AL
#elif (defined(NEC98))
MOV AL,0xff
OUT 0x02,AL
NOP
OUT 0x0a,AL
#endif
CLI ; IDTが設定されるまで、割り込みを禁止する
#if (defined(PCAT))
CALL waitkbdout
MOV AL,0xae ; keyboard interface enable
OUT 0x64, AL
CALL waitkbdout
MOV AL,0x60 ; write mode command
OUT 0x64, AL
CALL waitkbdout
MOV AL,0x47 ; 下記参照
OUT 0x60, AL
; // IRQ01 enable, IRQ12 enable, system flag on, keylock enable
; // keyboard interface enable, mouse interface enable, scan code 1(PC format)
CALL waitkbdout
MOV AL,0xd1 ;
OUT 0x64, AL
CALL waitkbdout
MOV AL,0xdf ; enable A20
OUT 0x60, AL
CALL waitkbdout
MOV AL,0xa8 ; mouse interface enable
OUT 0x64, AL
CALL waitkbdout
;.wait03:
; MOV ECX,0xaa55aa55
; MOV EDX,0x55aa55aa
; MOV AX,0
; MOV FS, AX
; MOV AX,0xff00
; MOV GS, AX
; MOV EAX,[FS:0]
; MOV [GS:0x1000],EDX
; MOV [FS:0],ECX
; CMP ECX,[GS:0x1000]
; MOV [FS:0],EAX
; JE .wait03
#elif (defined(NEC98))
OUT 0xf2, AL
#endif
; AC = 1となるので、SPをdwordアラインしておくこと
MOV AX,0xff00
MOV ES, AX
MOV SS, AX ; これ以降、スタック操作は禁止
MOV DWORD [ES:0x2000],0x102007 ; 面倒なのでPDE,PTEもキャッシュさせてしまう
; MOV DWORD [ES:0x2004],0x103007 ; どうせ仮のものなのでどうってことはない
MOV EAX,0x101000
MOV CR3,EAX
MOV EAX,7
MOV DI,0x3000
MOV CX,3*1024/4 ; 3MB
CLD
.fillpte
STOSD
ADD EAX,4096
LOOP .fillpte
; to protect mode
MOV EAX,CR0
OR EAX,10000000_00000000_00000000_00001101b ; PG,TS,PE
AND EAX,10011111_11111010_11111111_11111011b ; CD,NW,AM,WP,EM
MOV CR0,EAX ; モード移行
JMP ..$ ; for pipeline-flash
; GDTにDTを作る
; int boot32_sel == 2 * 8, boot32_ent == 1 * 16;
.boot32_sel EQU 21 * 8
.boot32_ent EQU 16 * 16 + modulelist
MOV BP,0x1000+384+.boot32_sel
MOV AX, WORD [.boot32_ent+12] ; boot32 seg
SHL EAX,4
AND EAX,0xffff0
MOV WORD [BP+2], AX
SHR EAX,16
MOV BYTE [BP+4], AL
MOV BYTE [BP+7], AH
MOV AX, WORD [.boot32_ent+ 8]
DEC AX
MOV WORD [BP+0], AX
MOV BYTE [BP+5],10011010b ; ER
MOV BYTE [BP+6],01000000b ; use32
LGDT [gdt0+2]
JMP FAR DWORD .boot32_sel:0
#if (defined(PCAT))
waitkbdout:
IN AL,0x64
TEST AL,0x02
IN AL,0x60 ; から読み(受信バッファが悪さをしないように)
JNZ waitkbdout
RETN
#endif
BootSiz EQU $ - BootBgn
RESB (16 - ($ % 16)) % 16
ORG 0x0000
SysWorkBgn:
VESA_busdevfnc DD 0 ; 80 bus dev-func ofs-reg
VESAPNP_00 DD 0
VESAPNP_08 DD 0
VESAPNP_2c DD 0
VGA_mode DW 12h ; +0x10
DW 0
#if (defined(BOCHS) | defined(VMWARE3))
to_winman0 DD 1 ; +0x14
#else
to_winman0 DD 0 ; +0x14
#endif
CFport DD 0 ; +0x18
eflags DD 0
; align 16
modulelist:
DD "syswork ",SysWorkSiz,SysWorkMdl ; 0 * 16
DD "init ",0,BootMdl ; 1 * 16
DD "vgadrv0 ",0,BootMdl ; 2 * 16
DD "keymos0 ",0,BootMdl ; 3 * 16
DD "timerdrv",0,BootMdl ; 4 * 16
DD "tapi0 ",0,BootMdl ; 5 * 16
DD "decode0 ",0,BootMdl ; 6 * 16
DD "fdcdrv0 ",0,BootMdl ; 7 * 16
DD "pioneer0",0,BootMdl ; 8 * 16
DD "winman0 ",0,BootMdl ; 9 * 16
DD "pokon0 ",0,BootMdl ; 10 * 16
#if (!defined(TOWNS))
DD "vesa8 ",0,BootMdl ; 11 * 16
#else
DD "towns15 ",0,BootMdl ; 11 * 16
#endif
DD "ankfont0",0,BootMdl ; 12 * 16 256バイトだけ必要
DD "papi0 ",0,BootMdl ; 13 * 16
DD "vesa16 ",0,BootMdl ; 14 * 16
DD "vesa32 ",0,BootMdl ; 15 * 16
DD "boot32 ",0,BootMdl ; 16 * 16 これは必ず非圧縮
DD "fdimage ",0,BootMdl ; 17 * 16
loaded_modules EQU ($ - modulelist) / 16
alloclist:
#if (defined(PCAT))
DD "pdepte ",4096*70,-1 ; 0
#else
DD "pdepte ",4096*67,-1 ; 0
#endif
DD "idtgdt ",4096,-1 ; 48+463entry
DD "freeslot",0,0
DD "stack ",4096*4,-1
DD "keydata ",4096,-1 ; 4
DD "gapidata",4096*176,-1 ; 起動最低限しか用意しない
DD "timerdat",4096*2,-1
DD "tapiwork",0,0 ; for 31 tasks(init, idle, winman0, pokon0).
DD "decodata",4096*6,-1 ; 8
DD "fdcwork ",4096,-1
DD "papiwork",4096*8,-1
DD 0
bootmalloc_adr0 DD 0x1000 ; (+0x01d4)
bootmalloc_fre0 DD 0 ; (+0x01d8)
bootmalloc_adr1 DD 0 ; LastMdlを指す (+0x01dc)
bootmalloc_fre1 DD 0 ; 636KB - bootmalloc_adr1 (+0x01e0)
FD_motor_init DB 01ch ; motor on
FD_cache_init DB 1 ; must init
DiskCacheReady DB 0
; bit0 : cache enable, bit1:boot from OSASK boot-sector
boot_keylock DB 0
FD_debug DD -1
bootmalloc_adr2 DD 1024 * 1024
bootmalloc_fre2 DD 0
bootmalloc_adr3 DD 16 * 1024 * 1024
bootmalloc_fre3 DD 0
bootlinear DD 0x480000 ; 4.5MB
bootlinear_EDI DD 0
bmodule_size DD 0
bmodule_paddr DD 0
bmodule_laddr DD 0
DiskCacheLength DD 0
gdt0 DD (4096 - 384 - 1)*0x10000, 0x100180
mscount DD 0, 0
SysWorkSiz EQU $ - SysWorkBgn
RESB (16 - ($ % 16)) % 16
StackSiz EQU 256
END

View File

@@ -0,0 +1,7 @@
include ../pcat/Makefile
DEFINES_AT += -DBOCHS
VPATH += ../pcat
force:
-$(DELE) ../pcat/OSASK.EXE

View File

@@ -0,0 +1,4 @@
include ../pcat/Makefile
DEFINES_AT += -DBOCHS
VPATH += ../pcat

View File

@@ -0,0 +1,17 @@
base.exe
boot32.bin
ankfont0.tek
tapi0.tek
timerdrv.tek
keymos0.tek
fdcdrv0.tek
pioneer0.tek
vgadrv0.tek
decode0.tek
papi0.tek
init.tek
winman0.tek
pokon0.tek
vesa8.tek
vesa16.tek
vesa32.tek

View File

@@ -0,0 +1,963 @@
/* "boot32.ask" ver.0.3 copyright(C) 2004 H.Kawai(川合秀実) */
#include "osaskinc.ask"
segment CODE(USE32, PARA);
default(code == CODE);
void testmemory();
void bmalloc();
void error();
void bmap();
void set_modulesegment();
void putstr();
void dumpreg();
void decode_tek0();
/* 進入条件:
SS.base = 0xff000 (ff00)
DS.base = SysWork
IDTGDT = 1MB+0KB (このページは暫定スタックとしても使用)
CR3 = 1MB+4KB (8K, 12KはPTE)
なおリアルの最後の4KB(636KB)はV86用のスタックになる
さらに12KBがBIOSとの交信用
リアルの640KB(+128KB)と次の1MBについては一切チェックしない。
そこが疑わしいようでは、OSASKを起動するのは絶望的だから。
*/
/* いつか、initとbase32を分けよう */
void far boot32()
{
STR_SYSWORK *swork == DS:0;
ESP = 0x2000; /* 暫定スタックへ */
PUSHFD();
POP(EAX);
EAX |= 0x00240000 /* bit18,21 */;
EAX &= 0xfffc88ff /* bit8,9,10,12,13,14,16,17 */;
PUSH(EAX);
POPFD();
PUSHFD();
POP(EDX);
swork->eflags = EDX;
EDX >>= 16;
TEST(DL, 0x04); /* bit18(AC) */
if (!= 0) {
EAX = CR0;
AL |= 0x21; /* NE, PE */
CR0 = EAX;
}
/* all_selの作成(for dummy GDT) */
EBP = 0x1180 + 8;
(int) [SS:EBP + 0] = 0x0000ffff;
(int) [SS:EBP + 4] = 0x00cf9200;
PUSH(8);
POP(ES); /* ES = all_sel */
/* プロテクトメモリテスト */
EBX = 16 * 1024 * 1024; /* i386DX, i486, Pentium */
EAX = 2 * 1024 * 1024;
testmemory();
ECX += 1024 * 1024;
swork->bootmalloc_fre2 = ECX;
/* A24-31が生きているかどうかのチェック */
EDI = 0x102c00; /* PTE 3MB */
EAX = 0x01000007;
TEST(DL, 0x04);
if (!= 0 /* 486 */)
AL= 0x1f /* キャッシュ禁止(PCD = 1, PWT = 1) */;
STOSD();
EAX = CR3;
CR3 = EAX;
EBX = 0;
EAX = 0xaa55aa55;
ECX = [ES:EBX];
[ES:EBX] = EAX;
NOT(EAX);
[ES:0x00300000] = EAX;
NOT(EAX);
CMP(EAX, [ES:EBX]);
[ES:EBX] = ECX;
if (==) {
EAX = 16 * 1024 * 1024;
EBX = 1024 * 1024 * 1024;
testmemory();
swork->bootmalloc_fre3 = ECX;
}
#if (defined(PCAT))
EAX = 160 * 9 * 1024; /* PCAT diskbuf */
#elif (defined(TOWNS))
EAX = 160 * 8 * 1024; /* TOWNS diskbuf */
#elif (defined(NEC98))
EAX = 160 * 8 * 1024; /* NEC98 diskbuf */
#endif
swork->bootmalloc_adr2 += EAX;
swork->bootmalloc_fre2 -= EAX;
// if ((unsigned) <= 0)
// INT(0x03);
/* モジュール転送先確保 */
AL = 16;
ECX = 0;
ESI = (offset) swork->modulelist;
do {
ECX += [DS:ESI + 8]; /* size */
ESI += 16;
ECX += 15;
ECX &= 0xfffffff0;
AL--;
} while (!= 0);
ECX += 0xfff;
ECX &= 0xfffff000;
swork->bmodule_size = ECX;
bmalloc();
swork->bmodule_paddr = EAX;
/* 各種ワークエリアの確保 */
ESI = (offset) swork->modulelist;
do {
ECX = [DS:ESI + 8]; /* size */
EAX = [DS:ESI + 12]; /* addr */
if (ECX != 0) {
if (EAX == -1) {
bmalloc();
[DS:ESI + 12] = EAX; /* addr */
}
}
ESI += 16;
} while ((unsigned) (int) [DS:ESI + 0] != 0);
/* PDEPTEを作り直す(作り直さないと落ち着いてマッピングができない) */
/* PDEPTEは最大で1MB(=1GB) */
/* もっとも、この後で0クリアルーチンを追加していけばもっと増やせるが */
EDI = 0x102c00; /* PTE 3MB-4MB */
EAX = swork->alloclist[ENT_PDEPTE + 12];
AL = 3;
ECX = swork->alloclist[ENT_PDEPTE + 8];
PUSH(ECX);
do {
STOSD();
EAX += 4096;
ECX -= 4096;
} while ((unsigned) > 0);
EAX = CR3;
CR3 = EAX;
POP(ECX);
EDI = 3 * 1024 * 1024;
EAX = 0;
PUSH(EDI);
PUSH(ECX);
ECX /= 4;
asmout("REP STOSD"); /* PDEPTEの0クリア */
POP(ECX);
POP(EDI);
EAX = 8 * 1024;
EBX = swork->alloclist[ENT_PDEPTE + 12];
EBX += EAX;
BL = 0x07;
TEST(DL, 0x04);
if (!= 0)
BL = 0x1f;
#if (!defined(PCAT))
/* VRAMの最大は4MB */
[ES:EDI + 0x1e00] = EBX;
[ES:EDI + 0x0e00] = EAX;
EAX += 4096;
EBX += 4096;
#else
/* VRAMの最大は16MB */
[ES:EDI + 0x1e00] = EBX;
[ES:EDI + 0x0e00] = EAX;
EAX += 4096;
EBX += 4096;
[ES:EDI + 0x1e04] = EBX;
[ES:EDI + 0x0e04] = EAX;
EAX += 4096;
EBX += 4096;
[ES:EDI + 0x1e08] = EBX;
[ES:EDI + 0x0e08] = EAX;
EAX += 4096;
EBX += 4096;
[ES:EDI + 0x1e0c] = EBX;
[ES:EDI + 0x0e0c] = EAX;
EAX += 4096;
EBX += 4096;
/* PCIデバイス用空間 (0xac00_0000) */
[ES:EDI + 0x1ac0] = EBX;
[ES:EDI + 0x0ac0] = EAX;
EAX += 4096;
EBX += 4096;
#endif
PUSH(ECX);
ECX -= EAX;
do {
[ES:EDI + 0x1000] = EBX;
STOSD();
EBX += 4096;
EAX += 4096;
ECX -= 4096;
} while ((unsigned) > 0);
#if (!defined(PCAT))
EDI = 0x303000;
#else
EDI = 0x307000;
#endif
ECX = 3 * 1024 / 4;
EAX = 7;
fillpte:
STOSD();
EAX += 4096;
asmout("LOOP .fillpte");
POP(ECX);
/* ptepdeのマッピング */
/* +0xxx:link, +1xxx:pde, +2xxx:VRAM, +3xxx:PTE(0-4) : 非PCAT */
/* +0xxx:link, +1xxx:pde, +2xxx:VRAM, +6xxx:c0000000 +7xxx:PTE(0-4) : PCAT */
#if (!defined(PCAT))
EDI = 0x303000 + 0x1200; /* 4.5MB */
#else
EDI = 0x307000 + 0x1200; /* 4.5MB */
#endif
EAX = swork->alloclist[ENT_PDEPTE + 12];
AL = 7;
PUSH(ECX);
do {
STOSD();
EAX += 4096;
ECX -= 4096;
} while ((unsigned) > 0);
POP(ECX);
EAX = swork->alloclist[ENT_PDEPTE + 12];
EAX += 4096;
TEST(DL, 0x04);
if (!= 0)
AL = 0x18;
CR3 = EAX;
EDI += 0x480000 - 0x300000;
swork->bootlinear_EDI = EDI;
swork->bootlinear += ECX;
/* idtgdtのマッピング */
ECX = swork->alloclist[ENT_IDTGDT + 8];
EAX = swork->alloclist[ENT_IDTGDT + 12];
bmap();
PUSH(ECX);
EDI = EDX;
ECX /= 4;
EAX = 0;
asmout("REP STOSD"); /* 0クリア */
POP(ECX);
(int) [ES:EDX + 384 + 8 + 0] = 0x0000ffff; /* all_sel */
(int) [ES:EDX + 384 + 8 + 4] = 0x00cf9200;
PUSH(ES); /* all_sel */
POP(GS);
LEA(EBX, [EDX + 384 + 120]); /* idtgdt_sel */
EAX = 0x4092;
PUSH(EDX);
PUSH(EAX);
set_modulesegment();
POP(EAX);
POP(EDX);
ECX = swork->alloclist[ENT_PDEPTE + 8];
PUSH(EDX);
LEA(EBX, [EDX + 384 + SEL_PDEPTE]);
EDX = 0x480000;
// EAX = 0x4092;
set_modulesegment();
PUSH(0x017f0000);
LIDT([SS:ESP + 2]);
ECX = swork->alloclist[ENT_IDTGDT + 8];
ECX -= 0x181;
[SS:ESP + 2] = CX;
(int) [SS:ESP + 4] += 0x180;
LGDT([SS:ESP + 2]);
POP(EAX);
POP(ECX);
/* pdepte = 0x480000 - 4c2ffff */
/* GDTR.base = 0x4c3180 */
/* これで、SEL_ALL, SEL_IDTGDT, SEL_PDEPTEは使える */
PUSH(SEL_IDTGDT);
POP(GS); /* = SEL_IDTGDT */
PUSH(SEL_PDEPTE);
POP(ES); /* = SEL_PDEPTE */
swork->bootlinear_EDI -= 0x480000;
ECX = swork->bmodule_size;
EAX = swork->bmodule_paddr;
bmap();
swork->bmodule_laddr = EDX; /* 0x4c4000 */
/* 以下はinitがやるべきことかも */
/* いや、bmapを使いたいから、boot32でやるのが正しい */
asmout("MOV EDI,.initsel0");
do {
ESI = (unsigned short) [CS:EDI + 2];
ECX = [DS:ESI + 8];
EAX = [DS:ESI + 12];
bmap();
AX = (unsigned short) [CS:EDI + 0];
EBX = (unsigned short) [CS:EDI + 4];
EDI += 6;
if (AL == 0x96 /* stack */)
EDX += ECX;
set_modulesegment();
} while ((unsigned) (char) [CS:EDI] != 0);
LEA(EBX, swork->modulelist[ENT_BOOT32 - 16]);
PUSH(8);
EBP = swork->bmodule_paddr;
EDI = swork->bmodule_laddr;
POP(FS);
do {
ECX = [DS:EBX + 8];
ESI = (unsigned short) [DS:EBX + 12];
ECX += 15;
ESI *= 16;
ECX &= 0xfffffff0;
if (!= 0) {
CMP((char) [DS:EBX + 15], 0);
[DS:EBX + 12] = EBP;
LEA(EBP, [SS:EBP + ECX]);
if (== 0) {
do {
EAX = [FS:ESI];
ESI += 4;
[FS:EDI] = EAX;
EDI += 4;
ECX -= 4;
} while ((unsigned) > 0);
} else {
ECX += EDI;
PUSH(ECX);
PUSH(EBP);
EBP = [DS:EBX + 8];
PUSH(EBX);
/* tek0展開 */
/* FS:ESIからFS:EDIへ, EBPバイト */
decode_tek0();
POP(EBX);
POP(EBP);
POP(EDI);
}
}
EBX -= 16;
} while (EBX >= (offset) swork->modulelist); /* syswork (0x0020) */
asmout("MOV EDI,.initsel1");
do {
ESI = (unsigned short) [CS:EDI + 2];
EBX = (unsigned short) [CS:EDI + 4];
EDX = [DS:ESI + 12];
ECX = [DS:ESI + 8];
EDX -= swork->bmodule_paddr;
AX = [CS:EDI + 0];
EDI += 6;
EDX += swork->bmodule_laddr;
set_modulesegment();
} while ((unsigned) (char) [CS:EDI] != 0);
PUSH(3*8);
POP(DS);
EAX = 6 * 8 /* stack_sel */;
SS = EAX;
ESP = /* (offset) stack_ESP0 */ 0xffffd000; /* スタックの初期化 */
EBP = swork->modulelist[ENT_FDIMAGE + 8];
PUSH(8);
EDI = 1024 * 1024;
POP(ES);
if (EBP != 0) {
ESI = (unsigned short) swork->modulelist[ENT_FDIMAGE + 12];
ESI *= 16;
decode_tek0();
(char) swork->DiskCacheLength = 160; /* 0-159トラック */
} else {
TEST(swork->DiskCacheReady, 0x02);
if (!= 0) {
ESI = 0x1000;
#if (defined(PCAT))
ECX = 18 * 1024 / 4;
#elif (defined(TOWNS))
ECX = 16 * 1024 / 4;
#elif (defined(NEC98))
ECX = 16 * 1024 / 4;
#endif
asmout("ES REP MOVSD");
(char) swork->DiskCacheLength = 2; /* 0-1トラック */
}
}
JMP(16,0); /* init_sel:0 */
ALIGN(2);
initsel0:
DW(0xc096, SYSWORK_ALIST + ENT_STACK, 6 * 8 + 384); /* stack_ent, stack_sel */
DW(0x4092, SYSWORK_ALIST + ENT_KEYDATA, 9 * 8 + 384); /* keydata_ent, keydata_sel */
DW(0x4092, SYSWORK_ALIST + ENT_GAPIDATA, 5 * 8 + 384); /* gapidata_ent, gapidata_sel */
DW(0x4092, SYSWORK_ALIST + ENT_TIMERDAT, 11 * 8 + 384); /* timerdata_ent, timerdata_sel */
DW(0x4092, SYSWORK_ALIST + ENT_DECODATA, 23 * 8 + 384); /* decowork_ent, decowork_sel */
DW(0x4092, SYSWORK_ALIST + ENT_FDCWORK, 29 * 8 + 384); /* fdcwork_ent, fdcwork_sel */
DW(0x4092, SYSWORK_ALIST + ENT_PAPIWORK, 19 * 8 + 384); /* papiwork_ent, papiwork_sel */
DW(0);
initsel1:
DW(0x4092, 0x020, 3 * 8 + 384); /* syswork_sel */
DW(0x409a, 0x040, 4 * 8 + 384); /* vgadrv0 */
DW(0x409a, 0x050, 8 * 8 + 384); /* keymos0 */
DW(0x409a, 0x060, 10 * 8 + 384); /* timerdrv */
DW(0x409a, 0x070, 12 * 8 + 384); /* tapi0 */
DW(0x409a, 0x080, 22 * 8 + 384); /* decode0 */
DW(0x409a, 0x090, 28 * 8 + 384); /* fdcdrv0 */
DW(0x4092, 0x0e0, 7 * 8 + 384); /* ankfont */
DW(0x409a, 0x0f0, 18 * 8 + 384); /* papi0 */
DW(0x409a, 0x030, 2 * 8 + 384); /* init */
DW(0);
/* ここでわざとリアルからメモリを確保してみせる(IDTGDTとPDEPTE) */
/* DS == syswork_seg, GS == IDT&GDT_seg (どちらもセレクタではないことに注意が必要) */
}
void testmemory()
/* EAXから1MB単位でテスト */
/* 最大アドレスをEBXに指定 */
/* DLにはelfagsを */
/* ES = all_sel */
/* ESI, EDI, EBPを破壊 */
{
PUSH(EAX);
do {
EDI = 0x102c00; /* PTE 3MB-4MB */
PUSH(EAX);
AL = 7;
TEST(DL, 0x04);
if (!= 0 /* 486 */)
AL= 0x1f /* キャッシュ禁止(PCD = 1, PWT = 1) */;
do {
STOSD();
EAX += 4096;
} while ((unsigned) EDI < 0x103000);
EDI = CR3;
CR3 = EDI;
POP(EAX);
EBP = 0xaa55aa55;
ESI = 0x55aa55aa;
EDI = 3 * 1024 * 1024;
do {
int *adr0 == ES:EDI, *adr1 == ES:EDI + 0xffc;
*adr0 = EBP;
NOT(*adr0);
if (ESI != *adr0)
goto skip;
NOT(*adr0);
if (EBP != *adr0)
goto skip;
*adr1 = EBP;
NOT(*adr1);
if (ESI != *adr1)
goto skip;
NOT(*adr1);
if (EBP != *adr1)
goto skip;
EDI += 0x1000;
} while ((unsigned) EDI < 0x00400000);
EAX += 1024 * 1024;
} while ((unsigned) EAX < EBX);
skip:
ECX = EAX;
POP(EAX);
ECX -= EAX;
return;
}
void bmalloc()
/* ECXにサイズ > EAXに物理アドレス */
{
STR_SYSWORK *swork == DS:0;
if ((unsigned) ECX <= swork->bootmalloc_fre3) {
swork->bootmalloc_fre3 -= ECX;
EAX = swork->bootmalloc_adr3;
swork->bootmalloc_adr3 += ECX;
return;
}
if ((unsigned) ECX <= swork->bootmalloc_fre2) {
swork->bootmalloc_fre2 -= ECX;
EAX = swork->bootmalloc_adr2;
swork->bootmalloc_adr2 += ECX;
return;
}
// if ((unsigned) ECX <= swork->bootmalloc_fre1) {
// swork->bootmalloc_fre1 -= ECX;
// EAX = swork->bootmalloc_adr1;
// swork->bootmalloc_adr1 += ECX;
// return;
// }
}
void error()
{
for (;;);
}
void bmap()
/* 簡易マッピングプログラム */
/* EDXを返す */
{
STR_SYSWORK *swork == DS:0;
PUSH(EDI);
PUSH(ECX);
PUSH(EAX);
EDX = swork->bootlinear;
EDI = swork->bootlinear_EDI;
AL = 7;
do {
STOSD();
EAX += 4096;
swork->bootlinear += 4096;
ECX -= 4096;
} while ((unsigned) > 0);
swork->bootlinear_EDI = EDI;
POP(EAX);
POP(ECX);
POP(EDI);
return;
}
void set_modulesegment()
/* AL, AH = access_right
ECX = size, EDX = base
GS:EBX = DT-entry */
/* sizeは0xfffff000以下である */
{
struct DescriptTbl {
unsigned short limit1;
unsigned short base1;
unsigned char base2;
unsigned char access_right1;
unsigned char limit2_access_right2;
unsigned char base3;
};
DescriptTbl *DT == GS:EBX;
unsigned int size == ECX, base == EDX;
size--;
DT->access_right1 = AL;
TEST(AL, 0x10);
if (!= 0) { /* S = 1 */
if (size > 0xfffff) {
AH |= 0x80; /* page単位に補正 */
// size &= 0xfffff000;
}
AL &= 0x1e;
TEST(AH, 0x80);
if (!= 0) {
size /= 4096; /* ページ単位に補正(00xffffe) */
if (AL == 0x16) {
size ^= 0x000fffff; /* 0→0xfffff, 1→0xffffe */
size--; /* 0→0xffffe, 1→0xffffd */
}
}
}
DT->base1 = DX /* base */;
base >>= 16;
DT->limit1 = CX /* size */;
size >>= 16;
DT->base2 = DL /* base */;
CL |= AH;
DT->limit2_access_right2 = CL /* size */;
DT->base3 = DH /* base */;
return;
}
void getb()
{
char *src == FS:ESI;
BL--;
if ((signed) < 0) {
BL = 7;
BH = *src;
(offset) src++;
}
BH <<= 1;
return;
}
void getbECX()
{
char *src == FS:ESI;
do {
BL--;
if ((signed) < 0) {
BL = 7;
BH = *src;
(offset) src++;
}
BH <<= 1;
RCL(EAX, 1);
ECX--;
} while (!= 0);
TEST(EAX, EAX);
return;
}
void getl1a()
/* ECXに返す */
/* ECX = 1で呼ぶこと */
{
// ECX = 1;
getb();
if (CF == 0) {
do {
getb();
RCL(ECX, 1);
getb();
} while (CF == 0);
}
return;
}
void getl1b()
/* ECXに返す */
/* ECX = 1で呼ぶこと */
{
// ECX = 1;
getb();
if (CF == 0) {
do {
getb();
RCL(ECX, 1);
getb();
} while (CF == 0);
ECX++;
return;
}
getb();
ADC(ECX, 0);
return;
}
void getl0a()
/* EBPに返す */
/* 進入条件EBP = 0, ECX = 0 */
{
do {
EBP++;
getb();
if (CF != 0)
goto fin;
EDX--;
} while (!= 0);
ECX++; /* ECX = 1; */
getl1b();
EBP += ECX;
ECX = 0;
fin:
return;
}
void decode_tek0()
{
char *dst == FS:EDI;
unsigned int *z1 == SS:ESP, *z0 == SS:ESP + 4, *mode == SS:ESP + 8;
unsigned int *l_ofs == SS:ESP + 12, *dis_s == SS:ESP + 16;
unsigned int *bytes == SS:ESP + 20;
EBX = 0;
ECX = 0;
EAX = 0;
PUSH(EBP); /* bytes */
do {
CL = 9;
getbECX(); /* 9bit入力 */
(unsigned int) EAX >>= 1;
} while (CF == 0);
PUSH(EAX); /* dis_s */
EAX = 0;
CL = 2;
getbECX(); /* 2bit入力 */
PUSH(EAX); /* l_ofs */
EAX = (offset) &getl1a;
getb();
if (CF != 0) {
// EAX = (offset) &getl1b;
asmout("ADD EAX,getl1b-getl1a");
// DB(0x83, 0xc0); asmout("DB getl1b-getl1a");
}
PUSH(EAX); /* mode */
LEA(EDX, [ECX + 2]); /* EDX = 2; */
do {
EAX = 0;
CL = 2;
getbECX(); /* 2bit入力 */
asmout("MOVSX EAX,BYTE PTR CS:[.table+EAX]");
PUSH(EAX); /* z0, z1 */
EDX--;
} while (!= 0);
EBP = 0;
do {
/* "0"-phase (非圧縮フェーズ) */
EDX = *z0;
getl0a(); /* EBPに返す */
*bytes -= EBP;
do {
CL = 8;
getbECX();
*dst = AL;
(offset) dst++;
EBP--;
} while (!= 0);
if (ECX == *bytes)
break;
/* "1"-phase (圧縮フェーズ) */
EDX = *z1;
getl0a(); /* EBPに返す */
do {
/* getdf */
unsigned int stopbits == EAX, distance == EDX;
// distance = 0xffffffff;
LEA(EDX, [ECX - 1]);
ECX++; /* l1aやl1bのため */
stopbits = *dis_s;
do {
do {
getb();
RCL(distance, 1);
stopbits >>= 1;
} while (CF == 0);
if (/* stopbits */ == 0)
break;
getb();
} while (CF == 0);
CALL(*mode); /* l1a or l1b */
ECX += *l_ofs;
*bytes -= ECX;
do {
AL = dst[EDX];
*dst = AL;
(offset) dst++;
ECX--;
} while (!= 0);
EBP--;
} while (!= 0);
} while (ECX != *bytes);
ESP += 24;
return;
table:
DB(0xff, 4, 8, 16);
}
#if 0
/* TOWNS用デバッグルーチン */
void putstr()
/* ES:EDIへ出力, FS:EBXに文字列, ECXが文字長, ES:ESIにフォント */
{
PUSH(EDI);
PUSH(EBX);
PUSH(ECX);
PUSH(EAX);
AL = 0x0f;
[ES:0xcff83] = AL; /* all plain write */
do {
// EAX = (unsigned char) [FS:EBX];
EAX = (unsigned char) [SS:EBX];
PUSH(ESI);
EAX *= 16;
EBX++;
ESI += EAX;
EAX = [ES:ESI + 0];
[ES:EDI + 80 * 0] = AL;
[ES:EDI + 80 * 1] = AH;
(unsigned int) EAX >>= 16;
[ES:EDI + 80 * 2] = AL;
[ES:EDI + 80 * 3] = AH;
EAX = [ES:ESI + 4];
[ES:EDI + 80 * 4] = AL;
[ES:EDI + 80 * 5] = AH;
(unsigned int) EAX >>= 16;
[ES:EDI + 80 * 6] = AL;
[ES:EDI + 80 * 7] = AH;
EAX = [ES:ESI + 8];
[ES:EDI + 80 * 8] = AL;
[ES:EDI + 80 * 9] = AH;
(unsigned int) EAX >>= 16;
[ES:EDI + 80 * 10] = AL;
[ES:EDI + 80 * 11] = AH;
EAX = [ES:ESI + 12];
POP(ESI);
[ES:EDI + 80 * 12] = AL;
[ES:EDI + 80 * 13] = AH;
(unsigned int) EAX >>= 16;
[ES:EDI + 80 * 14] = AL;
[ES:EDI + 80 * 15] = AH;
EDI++;
ECX--;
} while (!= 0);
POP(EAX);
POP(ECX);
POP(EBX);
POP(EDI);
return;
}
void itoa1()
/* AL -> CL */
{
CL = AL;
CL &= 0x0f;
CL += 0x30; /* '0' */
if (CL > 0x39)
CL += 0x41 - 10 - 0x30;
return;
}
void itoa2()
/* AL -> CX */
{
itoa1();
CH = CL;
ROL(AL, 4);
itoa1();
ROL(AL, 4);
return;
}
void itoa4()
/* AX -> ECX */
{
itoa2();
ECX <<= 16;
XCHG(AL, AH);
itoa2();
XCHG(AL, AH);
return;
}
void itoa8()
/* EAX -> EDX:ECX */
{
itoa4();
EDX = ECX;
ROL(EAX, 16);
itoa4();
ROL(EAX, 16);
return;
}
void dumpreg()
/* 進入条件ES = all_sel */
{
int *bmodule_paddr == DS:0x228, *bmodule_laddr == DS:0x22c;
PUSHAD();
EBP = ESP;
// PUSH(SS);
ESI = [DS:0x0e0 + 12];
// ESI *= 16;
ESI -= *bmodule_paddr;
ESI += *bmodule_laddr;
EDI = 0xc0000 + 80 * 16 * 10;
ESI -= 16 * 32;
// POP(FS);
EAX = EBX;
itoa8();
PUSH(EDX);
PUSH(ECX);
asmout("PUSH 'EBX:'");
PUSH(0x20202020);
EAX = [SS:EBP + 20];
itoa8();
PUSH(EDX);
PUSH(ECX);
asmout("PUSH 'EDX:'");
PUSH(0x20202020);
EAX = [SS:EBP + 24];
itoa8();
PUSH(EDX);
PUSH(ECX);
asmout("PUSH 'ECX:'");
PUSH(0x20202020);
EAX = [SS:EBP + 28];
itoa8();
PUSH(EDX);
PUSH(ECX);
asmout("PUSH 'EAX:'");
EBX = ESP;
ECX = 60;
putstr();
ESP = EBP;
EDI += 80 * 16;
EAX = [SS:EBP + 0];
itoa8();
PUSH(EDX);
PUSH(ECX);
asmout("PUSH 'EDI:'");
PUSH(0x20202020);
EAX = [SS:EBP + 4];
itoa8();
PUSH(EDX);
PUSH(ECX);
asmout("PUSH 'ESI:'");
PUSH(0x20202020);
EAX = [SS:EBP + 8];
itoa8();
PUSH(EDX);
PUSH(ECX);
asmout("PUSH 'EBP:'");
PUSH(0x20202020);
EAX = [SS:EBP + 12];
itoa8();
PUSH(EDX);
PUSH(ECX);
asmout("PUSH 'ESP:'");
EBX = ESP;
ECX = 60;
putstr();
ESP = EBP;
for (;;);
}
#endif

View File

@@ -0,0 +1,169 @@
●主な変更点 by 小柳 雅明(Koyanagi.Masaaki@nifty.com)
Version 4.7(2005/2)
[OSASK 7018][OSASK 7108][OSASK 7129]
・sartolに関するバグ修正を行いました。
・I.Tak.さんのBMPスクリーンショット出力に対応しました。
・壁紙ロードがPICTURE0.BINに対応しました。
・アーカイブ機能のバグを修正しました。
Version 4.6(2004/6)
[OSASK 6995][OSASK 6996][OSASK 6999]
・tek1/tek2/tek5の展開に対応しました。
・sarイメージによるアーカイブ機能に対応しました。
・beditcでファイルセレクタ出現中にアプリ側のウィンドウを閉じると
落ちてしまうバグを修正しました。
・全角フォントのosacmp形式に対応しました。
・800x600x16bit画面のリフレッシュレートを60Hzに変更しました。(TOWNS版)
Version 4.5(2004/5)
[OSASK 6930][OSASK 6935]
・アーカイブ機能がサポートされました。
・32768色画面に対応しました(TOWNS版)。
・漢字ROMに対応しました(TOWNS版)。
Version 4.4(2004/4)
[OSASK 6872][OSASK 6880][OSASK 6883][OSASK 6910][OSASK 6911]
・CardBus周りのルーチンを改良しました。
・仮想86周りのコードのバグフィクスを行いました。
・setwallpaperコマンドを追加しました。
・setextコマンドを追加しました
・メモリチェックアルゴリズムを改良し、3機種で共通化しました。
・NEC98版でキーボードリセットコマンドの送信を廃止しました。
・QEMU に対応しました。
Version 4.3(2003/12)
[OSASK 6696][OSASK 6706][OSASK 6759]
・ウィンドウを移動していても枠が重ならない限りは描画を止めないように修正
されました。
・vgadrv, vesa8のグラフィック転送ルーチンが高速化されました。(PC-AT版)
・pioneer0.askの cmd114グラフィックボックスへの文字列出力
のバグを修正しました。
Version 4.2(2003/11)
[OSASK 6603][OSASK 6604]
・OSASKの大きすぎるウィンドウに対する対策処理が追加されました
・windowの枠だけ描画がサポートされました
・ATAとPCカードの読み書き速度がアップしました(AT/TOWNS
・.BMPの関連付けがPICTURE0.BINに変更されました
・画面イメージセーブのキー操作がF6からShift+F7に変更されました。
Version 4.1(2003/10)
[OSASK 6511][OSASK 6515]
・一部のートPCにおいてPCカードスロットが原因で起動に失敗する問題を修正しました。
・POKONの関連付けが一部変更されました。
・マウススピードのデフォルトが少し速くなりました。
Version 4.0(2003/9)
[OSASK 6411][OSASK 6417]
・Linux/BSD上でビルドが可能になりました(詳細は OSASK Wikiを見て下さい)。
・CF以外のメモリカードスマートメディア、マルチメディアカード、
SDカード、miniSDカード、メモリースティックに対応しました(PC-AT版)。
・起動時のドライブ設定が働かないバグを修正しました。
・pokonがダブルクリックでハングアップするバグを修正しました。
・16bitカラーモードと32bitカラーモードのときに、マウスカーソルが
画面の右端にかかると表示が乱れるというバグを修正しました。
・画面モード切り替えが失敗した場合に元に戻す機能が働かなくなっている
のを修正しました。
Version 3.9(2003/8)
[OSASK 6313][OSASK 6314][OSASK 6318]
・CFコンパクトフラッシュ内のディスクイメージにアクセスできるように
なりました(PC-AT版, TOWNS版)。
・ATAハードディスク内のディスクイメージにアクセスできるように
なりました(PC-AT版)。
Version 3.8(2003/7)
[OSASK 6293]
・pokon がマウス対応になりました。
・pokon コンソールのコマンドが追加されました。
・pokon コンソールでスクリプトファイルを実行できるようになりました。
・pioneer がエラーメッセージに対応しました。
・4bit、8bit、16bitカラーでの減色ルーチンが改良されました。
・直接起動周りが改造されました。IPLも変わりました。
Version 3.7(2003/6)
[OSASK 6225]
・壁紙がJPEGファイルに対応しました。
・マウスが加速対応しました。
Version 3.6(2003/5)
[OSASK 6042][OSASK 6047]
・拡張子JPGがkjpegls.binに関連づけされました。
・現在の状況で開けるウインドウサイズの目安が得られるAPIが追加されました。
・VESA を使用した8bit-color, 16bit-color, 32bit-color 画面において、
screen shot が取れるようになりました(PC-AT版)。ただし、16bit-color,
32bit-color においては、保存したファイルをコンバータにかける必要があります。
Version 3.5(2003/4)
[OSASK 5859]
・pokonがデフォルトで開くテキストエディタがteditc01からteditc02
に変更されました
・AT版では16bit/32bitカラーモードでもカラーフォントが使えるよう
になりました(PC-AT版)
Version 3.4(2003/3)
[OSASK 5675][OSASK 5766]
・起動時にスクリプトを実行するようになりました。
・デフォルトのキーバインド設定が変更可能になりました。
・US101モードに対応しました(PC-AT版)。
・PF3 でビデオモードに切り替えられます(TOWNS版)。
・PF13でFresh-E,ES,ET,FS,FT HA HB HC (全てアクセラ未換装)シリーズのビデオ
アクセラレータCLGD543Xを使って1024x768x8bppに切り替えられます(TOWNS版)。
・直接起動ディスクが生成できるようになりました(NEC98版)。
・親指シフトキーのバインドを追加しました(TOWNS版)。
Version 3.3(2003/2)
[OSASK 5592][OSASK 5608][OSASK 5635]
・時計表示がサポートされました(TOWNS版)。
・時計表示位置が修正されました(PC-AT版/TOWNS版)。
・go_0009 で生成した .BIN ファイルが、go_0009 を閉じなく
ても開けるようになりました。
・VESA 2.0を使用して、8bit color, 16bit color, 32bit color
の高解像度画面が使用できるようになりました(PC-AT版のみ)。
・16bitグラフィックボックスが使えるようになりました。
・32bitグラフィックボックスが使えるようになりました。
・ankfont0をバージョンアップして、聖人さんのグラフィックキャラク
ターを導入しました。
Version 3.2(2003/1)
[OSASK 5548][OSASK 5557]
・C のソースファイルのコンパイラが GO(cc1 + as) から
GO(cc1 + gas2nask + nask) に変更されました。
・mousespeedのデフォルトが2になりました。
・新規ファイル生成のためのAPIが整備されました。
・圧縮しても1MBを超えるようなアプリの展開に対応しました。
・聖人さんの日付表示改造を取り込みました(PC-AT版のみ)。
・圧縮ファイルのresize0を許容しました。
・アプリのIOPLを3に変更しました。
Version 3.1(2002/12)
[OSASK 5364][OSASK 5365][OSASK 5405]
・自己シグナル送信APIのバグが修正されました。
・消し忘れていたデバッグメッセージを削除しました。
・PC/AT版においてキーボードインタフェース周りが変更(初期化時のACK/NACK以外
の応答を無視)され、対応するキーボードが増えました。
・C のソースファイルのコンパイラが lcc から GO(cc1 + as) に変更されました。
これによりtolset02をダウンロードすれば、コンパイルに必要なツールを全て
そろえることができます。
Version 3.0(2002/11)
[OSASK 5137][OSASK 5142][OSASK 5143][OSASK 5183]
・各モジュールをあらかじめ圧縮しておくことにより、OSASK.EXEが小さくなり
ました。
・ブートシーケンスが変更され、リアルメモリの使用量が少なくなりました。
・PC/AT版においてキーボードインタフェース周りが変更されました。
・起動時に OSASK.EXE に付属するディスクイメージを展開することにより、
フロッピーディスクがなくても起動可能になりました。
・TOWNS版での直接起動ディスク生成がサポートされました。
・ビルド時のリンカが obj2bim3 + bim2bin3 + osalink1 にバージョンアップ
されました。
Version 2.9(2002/10)
・ビルドターゲットとして nec98 が追加されました。
 現状は特定の機種で動作チェックを行なった程度であり、動作確認は十分
とはいえませんNEC98上でビルドできるかどうかは、話題になってい
ません)。
 これにともない、nec98 ディレクトリが追加されました
・ビルド時のリンカを obj2bim2 + bim2bin2 にバージョンアップされました。
・標準ライブラリが stdlib6 にバージョンアップされました。

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,98 @@
川合堂许可协议-01 ver.1.0
2000.12.30 H.Kawai (川合秀实)
0.概要
通俗地说:“这是自由软件,使用前使用后都无须支付任何费用,可以自由使用,也可以
复制、修改以及用于商业目的但是作者对软件的bug以及因此所造成的损失不负任何责
任。”
为了保护软件使用者以及软件修改者、参考者的利益,即便作者将来为该软件中所使用的
算法申请专利,也保证不会向使用者收取授权费用。
1.目的
适用于本协议的软件,旨在为公众带来利益,以及为软件技术的进步做出贡献。
2.宗旨
本协议并不代表作者放弃著作权(仅放弃独家复制发布的权利),使用者可以自由复制并
再次发布本软件的一部分甚至全部内容。使用时无须支付任何费用,对本软件的解析、修改
也无须支付任何费用。
适用于本协议的软件,可以无条件地用作商业目的,甚至可以将软件直接有偿出售。
对于以适用于本协议的软件的一部分或全部内容为基础,在此之上所开发的软件(下称“
派生物”),可以赋予任何种类的许可协议。即,派生物的作者可以禁止对派生物进行复制,
也可以只允许派生物以有偿形式发布。派生物的著作权属于该派生物的生成者,适用于本协
议的软件作者不会对其派生物主张著作权。
在派生物的文档中,没有义务对原始软件的作者进行介绍,但这句话,理所当然地,不意
味着禁止这一行为。
在发布派生物时,没有义务取得原始软件作者的同意,但这句话,理所当然地,不意味着
禁止这一行为。
作者不对软件的质量作出任何保证,因此,由于使用本软件所造成的损害,或者没有达到
所期望的结果,作者不负任何责任。
对于适用于本协议的软件中所使用的技术,除了事先取得作者授权的人以外,禁止其他人
对其申请专利。但如果附加了新的技术并生成了派生物,允许对于追加的部分申请专利。作
者在将来有可能对软件中的技术申请专利,但保证不会向派生物以及软件的使用收取授权费
用。本保证不仅适用于申请专利之前所生成的派生物,也适用于专利取得后所生成的派生物。
将解析结果汇总并申请专利,需要事先取得作者的同意,但对于申请专利以外的行为,没
有任何限制。
3.补充
基本上,作者十分欢迎复制本软件。如果要表示对作者的感谢,请将本软件推荐给更多的
人,并复制给他们使用。作者希望有更多的人使用本软件,因此对于复制的行为非常支持。
除此之外,如果可以将使用后的感想发给作者,作者一定会感到更加高兴。
对于本协议所授权的软件,仅修改著作权信息并再次发布的行为,本协议并没有禁止,而
是作为派生物来处理。这并不是一个漏洞。因此,如果你认为有必要仅修改著作权信息并再
次发布本软件,是完全可以这样做的。
除了修复bug、增加新功能等修改行为以外对于为代码添加注释增加易读性、对文档进行
补充等,不会反映在编译产物及运行结果上的修改也同样欢迎。如果生成了这样的派生物,
欢迎和作者联系(但这并不是义务)。
如果你有任何疑问,或者对于制作派生物方面感到缺少某些信息,可以向作者提问。但是,
受作者精力所限可能无法一一进行回复,请大家谅解。对于协议本身漏洞的指摘,请联系作
者或川合堂。
也许,对于本协议所授权的软件中所使用的技术,禁止未经作者允许申请专利这一点,和
日本的专利法是向抵触的(希望大家提出自己的见解)。对此,最初提出本协议的川合秀实
的见解如下。
指定专利法的背景,是因为如果发明者为了保护自己发明所带来的利益,而拒绝将发明的
详情公开,会阻碍科学技术的进步,因此在法律上对于其所公开的内容,在一定时间内给予
独家使用的保护,这是专利法的精神所在。在本协议中,作者并没有故意隐藏发明的详细内
容,因此即便禁止对其申请专利我认为也不违背专利法的精神。相反,不理解本协议精神的
人,如果申请了专利并对原创的软件及派生物收取授权费用,这种担心反倒阻碍了科学技术
的进步。因此,本协议的目的是事先消除这种担心,我认为和专利法是不抵触的。
当然,最稳妥的做法是,作者对原创软件中可以被认作发明的全部内容申请并取得专利,
事前防止其他人来取得相关的专利,但是这对于作者来说负担很大。申请专利的负担和是否
公开软件内容之间必须要有所取舍的话,可能有些人会放弃公开软件内容。这并不是专利法
精神所期待的,也不符合我们的目的(参见“1.目的”)。
此外,当发明的详细内容由于专利法的形式限制没有记述并明确的,由作者以外的人在未
经许可的情况下将其解析并明确的行为,在本协议中是允许的。对于这部分内容,可以无偿
公开,也可以有偿出售。
不过,对于协议所授权的软件中的所有技术,并不能保证在使用时完全避免支付授权费用
的可能性。如果在发布的时间点仍然有效的专利技术,在软件中被使用的话,该专利的所有
者可以要求支付授权费用。本协议所保证的不收取专利授权费用,是针对软件内被认为是新
发明的那一部分技术。
如果需要将本协议适用于自己开发的软件,在事前事后均无须经过作者同意,可任意使用。
如果有任何不方便之处,可以对协议文本进行修改。如需修改协议文本,为了避免歧义,请
同时修改协议的名称。
4.链接
川合堂URL http://www.imasy.org/~mone/kawaido/
川合秀实URL http://www.imasy.org/~kawai/
e-mail kawai@imasy.org

View File

@@ -0,0 +1,20 @@
format:
/* このセクションでリンクの方針を記述 */
code(align:1, logic:0x48, file:0x48);
data(align:4, logic:stack_end, file:code_end);
file:
/* このセクションでコマンドラインに書ききれなかった
.ojbファイル、.libファイルを記載 */
/* なお、このセクションはフルパスで書いてもよい。 */
/* 例: c:/osask/gg00libc.lib; */
../../z_tools/guigui00/gg00libc.lib;
../../z_tools/guigui00/golibc.lib;
label:
/* 必ずリンクしなければいけないラベルを指定 */
/* エントリポイントを指定すればいいと思ってください */
_OsaskMain;
/* 上記3セクションの順序は入れ替えてはいけません! */

View File

@@ -0,0 +1 @@
..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9

View File

@@ -0,0 +1,85 @@
―GNU Make for Win32 を使用した OSASK.EXE のビルドの方法について―
2004.4.18 by 小柳 雅明(Koyanagi.Masaaki@nifty.com)
◎ビルド方法
Linux/Free BSDでのコンパイル方法は、OsaskWikiを御覧下さい。
http://remo.s10.xrea.com/osawiki/pukiwiki.php
0. document.txt の2.コンパイル&アセンブル方法を参照して
必要なファイルをPATH の通ったディレクトリに置きます。
http://www.imasy.org/~kawai/osask/developers.html
の tolset05 をダウンロードして使って下さい。
1. 対象とするアーキテクチャに従って make にパラメータを与えて実行します。
(1) PC/AT 互換機
make at
(2) VMware
make vm
(3) QEMU
make mu
(4) Bochs ver 1.3
make bochs
(5) Bochs ver 1.2.1
make bochs12
(6) FM-TOWNS
make towns
(7) NEC PC-98x1
make nec98
するとOSASK.EXE が生成されます。
一度対象を決定した後は make のみで生成できます。
対象を変更する場合は、変更前に make -i clean を実行して下さい。
2. make clean とすると全ての生成物が削除されます。
また make dist_clean で中間生成物が削除されます。
◎画面デザイン
画面デザインを変更するには以下の二通りの方法があります。
(1) depend.mak を編集する
#DESIGN = WIN9X
#DESIGN = WIN31
#DESIGN = TMENU
#DESIGN = CHO_OSASK
#DESIGN = NEWSTYLE
のいずれかの先頭の # を削除して下さい。それぞれ
WIN9X Win9x風
WIN31 Win3.1風
TMENU T-OSASK
CHO_OSASK 超OSASK
NEWSTYLE NWSOS風
に対応します。default は Win9x風です。
(2) make 実行時に直接指定する
make pcat DESIGN=WIN9X
のように make 実行時に直接指定できます。
◎FM-TOWNS 版の設定パラメータ
FM-TOWNS 版の生成において depend.mak を編集することで設定を換える
ことができます。
・TWSCRL1 = y とすると 1ドットスクロールが有効になります。
・TWVSW = n (768 <= n <= 1024 の 8の倍数) の数値を設定すると
仮想画面の幅を変更できます。高さは自動的に決まります。
・VMODE = y とすると、ビデオモードが有効になります。
・CLGD543X = y とすると、Fresh-E,ES,ET,FS,FT HA HB HC (全てアクセラ未換装)
シリーズでビデオアクセラレータCLGD543Xを使用した画面モードが使用可能に
なります。
◎その他
・一部の生成ファイルが無い状態で make clean あるいは make dist_cleanす
ると、del に失敗して処理が停止してしまいます。この場合には -i オプショ
ンを付けて make -i clean あるいはmake -i dist_clean して下さい。
・make towns を行った後 make bootimg を実行すると OSASK.EXEを 0x8000用に
リロケートした OSASK.SYS を生成します。生成には imgtol.com が必要です。
imgtol.com は tolset05 の中にあります。Windows 2000/XP では、imgtol.com
実行時に画面がクリアされますが実行には問題はありません。
◎著作権
makefile の著作権は、小柳 雅明にあり、川合堂ライセンス-01を適用しま
す。

View File

@@ -0,0 +1,20 @@
# Makefileのインクルードファイル
# 全機種共通
MAKE = $(TOOLPATH)make.exe -r
SJISCONV = $(TOOLPATH)sjisconv.exe -s
CC1 = $(TOOLPATH)cc1.exe -I$(INCPATH) -Os -Wall -quiet
GAS2NASK = $(TOOLPATH)gas2nask.exe -a
NASK = $(TOOLPATH)nask.exe
OBJ2BIM = $(TOOLPATH)obj2bim.exe
BIM2BIN = $(TOOLPATH)bim2bin.exe
CPP0 = $(TOOLPATH)cpp0.exe -P -I$(INCPATH)
ASKA = $(TOOLPATH)aska.exe
NASKCNV = $(TOOLPATH)naskcnv0.exe -l -s
GOLIB = $(TOOLPATH)golib00.exe
OSALINK = $(TOOLPATH)osalink1.exe
EDIMG = $(TOOLPATH)edimg.exe
DELE = del
COPY = copy
TXT2BIN = ../ankfont0/txt2bin.exe

View File

@@ -0,0 +1,31 @@
# Makefileのインクルードファイル
# 各種設定用
# ウィンドウデザイン
DESIGN = WIN9X
# DESIGN = WIN9X
# DESIGN = TMENU
# DESIGN = WIN31
# DESIGN = CHO_OSASK
# DESIGN = NEWSTYLE
# 標準半角フォント
FONTSRC = ibmank0.txt
# FONTSRC = ibmank0.txt
# FONTSRC = win31.txt
# FONTSRC = newstyle.txt
# pcat用のオプション
DEFINES_AT =
# DEFINES_AT = -DBOCHS
# towns用のオプション
DEFINES_TW = -DTWVSW=1024 -DVMODE -DCLGD543X
# DEFINES_TW = -DTWVSW=1024 -DVMODE -DCLGD543X
# nec98用のオプション
DEFINES_NE =
# DEFINES_NE =
# その他のオプション
# 今のところなし

View File

@@ -0,0 +1,17 @@
# linker options for pokon0
STK_PK_AT = 1m
STK_PK_TW = 1m
STK_PK_NE = 1m
MLC_PK_AT = 90k
MLC_PK_TW = 90k
MLC_PK_NE = 90k
MMA_PK_AT = 4096k
MMA_PK_TW = 4096k
MMA_PK_NE = 4096k
BIM_PK_AT = -tek5 eopt:-fb106 eprm:z1
BIM_PK_TW = -tek5 eopt:-fb88 eprm:z1
BIM_PK_NE = -tek5 eopt:-fb88 eprm:z1

View File

@@ -0,0 +1,17 @@
# linker options for winmain0
STK_WM_AT = 64k
STK_WM_TW = 64k
STK_WM_NE = 64k
MLC_WM_AT = 4272k
MLC_WM_TW = 4272k
MLC_WM_NE = 4272k
MMA_WM_AT = 4160k
MMA_WM_TW = 4160k
MMA_WM_NE = 4160k
BIM_WM_AT = -tek5 eopt:-fb75 eprm:z1
BIM_WM_TW = -tek5 eopt:-fb83 eprm:z1
BIM_WM_NE = -tek5 eopt:-fb124 eprm:z1

View File

@@ -0,0 +1,108 @@
# Makefile for OSASK/NEC98
# ver. 0.0
TOOLPATH = ../../z_tools/
INCPATH = ../../z_tools/guigui00/
include ../make_inc.txt
include ../make_com.txt
include ../make_wm0.txt
include ../make_pk0.txt
DEFINES = $(DEFINES_NE) -DNEC98 -D$(DESIGN)
MKFL = Makefile ../Makefile ../make_inc.txt ../make_com.txt
ALL :
$(MAKE) OSASK.EXE
OSASK.EXE : $(MKFL) osalink1.opt base.exe boot32.bin ankfont0.tek tapi0.tek \
timerdrv.tek keymos0.tek fdcdrv0.tek pioneer0.tek vgadrv0.tek \
decode0.tek papi0.tek init.tek winman0.tek pokon0.tek
$(OSALINK)
base.exe : $(MKFL) ../base.nap
$(CPP0) -P $(DEFINES) -o base.nas ../base.nap
$(NASK) base.nas base.exe base.lst
$(DELE) base.nas
boot32.ias : $(MKFL) ../boot32.ask
$(CPP0) -P $(DEFINES) -o boot32.ias ../boot32.ask
ankfont0.bin : $(MKFL) ../ankfont0/$(FONTSRC)
$(TXT2BIN) ../ankfont0/$(FONTSRC) ankfont0.bin
tapi0.ias : $(MKFL) ../tapi0.ask
$(CPP0) -P $(DEFINES) -o tapi0.ias ../tapi0.ask
timerdrv.ias : $(MKFL) timerdrv.ask
$(CPP0) -P -I.. $(DEFINES) -o timerdrv.ias timerdrv.ask
keymos0.ias : $(MKFL) keymos0.ask
$(CPP0) -P -I.. $(DEFINES) -o keymos0.ias keymos0.ask
fdcdrv0.ias : $(MKFL) fdcdrv0.ask
$(CPP0) -P -I.. $(DEFINES) -o fdcdrv0.ias fdcdrv0.ask
pioneer0.ias : $(MKFL) ../pioneer0.ask
$(CPP0) -P $(DEFINES) -o pioneer0.ias ../pioneer0.ask
vgadrv0.ias : $(MKFL) vgadrv0.ask
$(CPP0) -P -I.. $(DEFINES) -o vgadrv0.ias vgadrv0.ask
decode0.ias : $(MKFL) decode0.ask
$(CPP0) -P -I.. $(DEFINES) -o decode0.ias decode0.ask
papi0.ias : $(MKFL) ../papi0.ask
$(CPP0) -P $(DEFINES) -o papi0.ias ../papi0.ask
init.ias : $(MKFL) ../init.ask
$(CPP0) -P $(DEFINES) -o init.ias ../init.ask
winman0.gas : $(MKFL) ../winman0.c
$(CC1) $(DEFINES) -I../sgg00lib -o winman0.gas ../winman0.c
winman0.bin : $(MKFL) ../make_wm0.txt winman0.obj
$(MAKE) -C ../sgg00lib
$(OBJ2BIM) @../linkrule.rul stack:$(STK_WM_NE) map:winman0.map \
out:winman0.bim winman0.obj ../sgg00lib/sgg00lib.lib
$(BIM2BIN) malloc:$(MLC_WM_NE) mmarea:$(MMA_WM_NE) input:winman0.bim \
output:winman0.bin $(BIM_WM_NE)
$(DELE) winman0.bim
pokon0.gas : $(MKFL) ../pokon0.c
$(CC1) $(DEFINES) -I../sgg00lib -o pokon0.gas ../pokon0.c
pokon0.bin : $(MKFL) ../make_pk0.txt pokon0.obj
$(MAKE) -C ../sgg00lib
$(OBJ2BIM) @../linkrule.rul stack:$(STK_PK_NE) map:pokon0.map \
out:pokon0.bim pokon0.obj ../sgg00lib/sgg00lib.lib
$(BIM2BIN) malloc:$(MLC_PK_NE) mmarea:$(MMA_PK_NE) input:pokon0.bim \
output:pokon0.bin $(BIM_PK_NE)
$(DELE) pokon0.bim
%.bin : $(MKFL) %.ias
$(ASKA) $*.ias $*.3as
$(NASKCNV) $*.3as $*.nas
$(NASK) $*.nas $*.bin $*.lst
$(DELE) $*.3as
$(DELE) $*.nas
%.obj : $(MKFL) %.gas
$(GAS2NASK) $*.gas $*.nas
$(NASK) $*.nas $*.obj $*.lst
$(DELE) $*.nas
%.tek : $(MKFL) %.bin
$(BIM2BIN) in:$*.bin out:$*.tek -osacmp -tek0 rjc:0
clean :
-$(DELE) OSASK.EXE
-$(DELE) *.lst
-$(DELE) *.ias
-$(DELE) *.gas
-$(DELE) *.map
-$(DELE) base.exe
-$(DELE) *.obj
-$(DELE) *.bin
-$(DELE) *.tek

View File

@@ -0,0 +1,443 @@
/* "decode0":キーコード・デコーダー for NEC98 ver.1.0 */
segment CODE(USE32, PARA);
default(code == CODE);
#include "osaskinc.ask"
void near Keydecode_Init();
//void near Keydecode_led();
struct WORK {
int last;
short shiftmap, [2];
int declist[1028 /* 257 * 4 */];
/* +1036 */
int subcmdbuf[0x5bf4];
};
void far Keydecode_syscmd()
{
int *cmd == FS:EBX;
WORK *work == DS:0;
PUSHAD();
MOV(EAX, CS);
PUSH(DS);
EAX += 8;
DS = EAX;
nextcmd:
EAX = *cmd;
if (EAX == 0)
goto cmd0000;
if (EAX == 0x010c)
goto cmd010c; /* decodeルール定義 */
if (EAX == 0x0104)
goto cmd0104; // Keydecode_setlock
if (EAX == 0x0110)
goto cmd0110; /* decodeルール初期化 */
if (EAX == 0x0108)
goto cmd0108; // Keydecode_Mainへのベクタ通知
if (EAX == 0x0100)
goto cmd0100; // 初期化
INT(0x03);
cmd0000:
POP(DS);
[SS:ESP + 16] = EBX;
POPAD();
return;
cmd0100:
// 初期化
PUSH((offset) cmd);
Keydecode_Init();
POP((offset) cmd);
(offset) cmd += 4;
goto nextcmd;
cmd0104:
/* Keydecode_setlock */
EAX = cmd[4];
PUSH((offset) cmd);
ROR(EAX, 16);
work->shiftmap &= AX;
ROR(EAX, 16);
work->shiftmap |= AX;
// Keydecode_led();
POP((offset) cmd);
(offset) cmd += 8;
goto nextcmd;
cmd0108:
// Keydecode_Mainへのベクタ通知
asmout("MOV DWORD PTR FS:[EBX+4],OFFSET Keydecode_Main");
(short) cmd[8] = CS;
(offset) cmd += 12;
goto nextcmd;
cmd010c:
/* decodeルール定義(CLIしたほうがいいかも) */
/* cmd, opt(len), rawコード, shift-lock-bitmap(mask, equal), subcmd,... */
/* subcmdの一覧 */
/* 01 : sendsignal(mode-1), call vector, cmd(01), len(max:1KB), signal,...
02 : sendsignal(mode-2),
03 : sendsignal(mode-3),
04 : or shift-lock-bitmap, 0(dw), bitmap, cmd(04), 0(byte)
05 : and shift-lock-bitmap,
06 : xor shift-lock-bitmap,
// 07 : control LED, hardware-param, bitmap(andしてンゼロならon), cmd(07), hardware-param
*/
/* shift-lock-bitmapの割付例 */
/* bit0 : scroll...自動反映
bit1 : numlock...自動反映
bit2 : caps...自動反映
bit3 : reserve...自動反映
bit4 : shift
bit5 : ctrl
bit6 : alt
bit7 : reserve
bit14, 15は、make/break/remake/overbreak
*/
/*
数字の"1":
no-shift & no-ctrl & no-altでキーを押した時
numlock & no-shift & no-ctrl & no-altでテンキーを押した時
英語文字"A":
capslock & no-shift & no-ctrl & no-altでキーを押した時
no-capslock & shift & no-ctrl & no-altでキーを押した時
英語文字"a":
no-capslock & no-shift & no-ctrl & no-altでキーを押した時
capslock & shift & no-ctrl & no-altでキーを押した時
というわけで、Aとaを登録すると都合4パターンを登録する必要がある
キーの複雑な対応は、winman0で処理させる。
*/
/* ワークエリアから適当に切り取って転送して、ポインタを繋いでおわり。 */
ESI = work->last;
ECX = cmd[ 4]; /* len */
EDX = cmd[ 8]; /* rawコード */
EAX = cmd[12]; /* shiftmap */
(offset) cmd += 16;
[DS:ESI] = EAX;
EDI = ESI;
ESI += 8;
ECX -= 2;
do {
EAX = *cmd;
(offset) cmd += 4;
[DS:ESI] = EAX;
ESI += 4;
ECX--;
} while (!= 0);
[DS:EDI + 4] = ECX /* 0 */;
work->last = ESI;
ESI = work->declist[EDX * 4];
if (ESI == 0) {
work->declist[EDX * 4] = EDI;
goto nextcmd;
}
do {
EAX = ESI;
ESI = [DS:ESI + 4];
} while (ESI != 0);
[DS:EAX + 4] = EDI;
goto nextcmd;
cmd0110:
/* decodeルール初期化 */
work->last = 1036;
(offset) cmd += 8;
LEA(ESI, work->declist[0]);
EAX = 0;
ECX = 257;
do {
[DS:ESI] = EAX;
ESI += 4;
ECX--;
} while (!= 0);
goto nextcmd;
}
void far Keydecode_Main()
/* CLIしたほうがいいかも */
{
unsigned int keyint_sel == 8 * 8, keydata_sel == 9 * 8;
WORK *work == DS:0;
int *msg == DS:ESI;
MOV(ECX, CS);
PUSH(DS);
ECX += 8;
EAX = msg[8];
DS = ECX;
PUSH(ESI);
if ((unsigned) EAX >= 0x04000000)
goto ignore;
ECX = EAX;
// EDX = EAX;
(unsigned int) ECX >>= 10;
EAX &= 0x00ffffff;
ECX &= 0xc000;
/* mode-1バッファを検索する */
/* コードが存在したら、shiftmapではなく、バッファ内のシフトコードをローディング */
// if (EAX == work->mode1buf[ 0])
// CX |= work->mode1buf[ 4];
// else if (EAX == work->mode1buf[ 8])
// CX |= work->mode1buf[12];
// else if (EAX == work->mode1buf[16])
// CX |= work->mode1buf[20];
// else if (EAX == work->mode1buf[24])
// CX |= work->mode1buf[28];
// else
CX |= work->shiftmap;
/* breakだったら、mode1buf, mode2bufから抹消する */
EDI = work->declist[EAX * 4];
if (EDI != 0) {
do {
/* このループ内でCXは保存すること */
EAX = ECX;
AX &= [DS:EDI + 0];
CMP(AX, [DS:EDI + 2]);
if (==) {
AL = [DS:EDI + 8 + 6];
LEA(ESI, [EDI + 8 + 8]);
if (AL == 0x01) {
/* send signal mode-1 */
INT(0x03);
}
if (AL == 0x02) {
/* send signal mode-2 */
INT(0x03);
}
if (AL == 0x03) {
/* send signal mode-3 */
PUSH(EDI);
PUSH(ECX);
asmout("CALL FAR [DS:EDI + 8]");
POP(ECX);
POP(EDI);
goto next;
}
// DL = (char) work->shiftmap;
if (AL == 0x04) {
/* or shift-lock-bitmap */
EAX = [DS:EDI + 8];
work->shiftmap |= AX;
checkled:
// DL ^= (char) work->shiftmap;
// DL &= 0x0f;
// if (!= 0)
// Keydecode_led();
/* mode-2バッファを検索する */
/* コードが存在し、かつ、shift状態の変化によりmake状態にふさわしくなくなったら、
ブレイクしてから、あらたにmakeする */
goto next;
}
if (AL == 0x05) {
/* and shift-lock-bitmap */
EAX = [DS:EDI + 8];
work->shiftmap &= AX;
// goto checkled;
goto next;
}
if (AL == 0x06) {
/* xor shift-lock-bitmap */
EAX = [DS:EDI + 8];
work->shiftmap ^= AX;
// goto checkled;
goto next;
}
if (AL == 0x38) {
// /* DMA停止 */
CLI();
// AL = 0x0f;
// OUT(0x00af, AL);
/* reset */
EAX = 0; /* AL = 0; */
OUT(0x00F0, AL);
for (;;)
HLT();
}
}
next:
EDI = [DS:EDI + 4];
} while (EDI != 0);
}
ignore:
POP(ESI);
POP(DS);
return;
}
void near Keydecode_Init()
{
unsigned int Init_sel == 2 * 8, TAPI_sel == 12 * 8;
ECX = 4096 * 6 / 4;
EAX = 0;
ESI = 0;
do {
(int) [DS:ESI] = EAX;
ESI += 4;
ECX--;
} while (!= 0);
return;
}
#if 0
void far filter0()
// F1F6しか通さないフィルター
{
unsigned int keyint_sel == 8 * 8, keydata_sel == 9 * 8;
asmout("#work_keycode EQU 0");
asmout("#work_keytype EQU #work_keycode+256");
asmout("#work_msg EQU #work_keytype+256");
asmout("#work_tenkey EQU #work_msg+64");
asmout("#work_twocase EQU #work_tenkey");
asmout("#work_signal EQU #work_twocase+60H");
asmout("#work_jmptable EQU #work_signal+8");
asmout("#work_shiftflag EQU #work_jmptable+20");
asmout("#work_pause EQU #work_shiftflag+1");
asmout("#work_dummy0 EQU #work_pause+1");
asmout("#work_sigcall EQU #work_dummy0+2");
asmout("#work_size EQU #work_sigcall+8");
EAX = [DS:ESI + 8];
EAX &= 0x0fff;
if (EAX == 0x6a5 /* Ctrl + Alt + Delete */) {
// PUSH(FS);
PUSH((int) 0);
PUSH(EAX);
PUSH(0x010c /* KeyResetCPU */);
AX = SS;
EBX = ESP;
FS = AX;
DB(0x9a); DD(0); DW((short) keyint_sel);
ESP += 12;
// POP(FS);
// asmout("fcall 8*8, KeyResetCPU");
for (;;)
HLT();
/* // double-faultでリセットをかける
CLI();
// GDTとIDTのリミットを0にする。
EAX = 0;
PUSH(EAX);
PUSH(EAX);
asmout("LGDTE FWORD PTR SS:[ESP+2]");
asmout("LIDTE FWORD PTR SS:[ESP+2]");
ESP = 256;
INT(0x03);
*/
/* PUSH([DS:ESI + 4]);
PUSH([DS:ESI + 0]);
(int) [DS:ESI + 0] = 0x00001241;
(int) [DS:ESI + 4] = 0xffffff00;
asmout("fcall 12*8,TAPI_SingnalMessageTimer");
POP([DS:ESI + 0]);
POP([DS:ESI + 4]);
return;
*/ } else if (EAX == 0x6a4 /* Ctrl + Alt + Insert */) {
PUSH([DS:ESI + 4]);
PUSH([DS:ESI + 0]);
(int) [DS:ESI + 0] = 0x00001241;
(int) [DS:ESI + 4] = 0xffffff01;
asmout("CALL FWORD PTR DS:[#work_sigcall]");
// asmout("fcall 12*8,TAPI_SingnalMessageTimer");
POP([DS:ESI + 0]);
POP([DS:ESI + 4]);
return;
}
PUSH(DS);
PUSH(ESI);
EAX *= 16;
ESI = 0x1000;
EAX &= 0x0ff0;
CX = CS; CX += 8; DS = CX;
ESI += EAX;
TEST((char) [DS:ESI], 0x0f);
if (!= 0) {
asmout("CALL FWORD PTR DS:[#work_sigcall]");
// asmout("fcall 12*8,TAPI_SingnalMessageTimer");
}
POP(ESI);
POP(DS);
return;
asmout("DecodeSiz:");
}
/*
void far filter1()
{
EAX = [DS:ESI + 8];
EAX &= 0x0fff;
if (EAX == 0x6a5 /* Ctrl + Alt + Delete */) {
asmout("fcall 8*8, KeyResetCPU");
for (;;)
HLT();
/* // double-faultでリセットをかける
CLI();
// GDTとIDTのリミットを0にする。
EAX = 0;
PUSH(EAX);
PUSH(EAX);
asmout("LGDTE FWORD PTR SS:[ESP+2]");
asmout("LIDTE FWORD PTR SS:[ESP+2]");
ESP = 256;
INT(0x03);
*/
} else if (EAX == 0x6a4 /* Ctrl + Alt + Insert */) {
CL = 0x01;
} else if (EAX == 0x0ac /* left */) {
CL = 0x10;
} else if (EAX == 0x0ad /* right */) {
CL = 0x11;
} else if (EAX == 0x0a0 /* Enter */) {
CL = 0x12;
} else if (EAX == 0x1a0 /* Shift + Enter */) {
CL = 0x13;
} else if (EAX == 0x1ac /* Shift + left */) {
CL = 0x14;
} else if (EAX == 0x1ad /* Shift + right */) {
CL = 0x15;
} else if (EAX == 0x646 /* Ctrl + Alt + 'F' */) {
CL = 0x16;
} else if (EAX == 0x666 /* Ctrl + Alt + 'f' */) {
CL = 0x16;
} else if (EAX == 0x746 /* Shift + Ctrl + Alt + 'F' */) {
CL = 0x17;
} else if (EAX == 0x766 /* Shift + Ctrl + Alt + 'f' */) {
CL = 0x17;
} else
return;
ECX |= 0xffffff00;
PUSH([DS:ESI + 4]);
PUSH([DS:ESI + 0]);
(int) [DS:ESI + 0] = 0x00001241;
(int) [DS:ESI + 4] = ECX;
asmout("fcall 12*8,TAPI_SingnalMessageTimer");
POP([DS:ESI + 0]);
POP([DS:ESI + 4]);
return;
asmout("DecodeSiz:");
}
*/
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,14 @@
base.exe
boot32.bin
ankfont0.tek
tapi0.tek
timerdrv.tek
keymos0.tek
fdcdrv0.tek
pioneer0.tek
vgadrv0.tek
decode0.tek
papi0.tek
init.tek
winman0.tek
pokon0.tek

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,94 @@
/* "osaskinc.ask" */
#define ALIGN2 asmout("RESB (2 - ($ % 2)) % 2")
#define ALIGN4 asmout("RESB (4 - ($ % 4)) % 4")
#define ALIGN8 asmout("RESB (8 - ($ % 8)) % 8")
#define ALIGN16 asmout("RESB (16 - ($ % 16)) % 16")
#define ALIGN(bytes) ALIGN ## bytes
#define jmp_system_count0() asmout("JMP FAR DWORD SS:[0xFFFFFFE8]")
struct STR_SYSWORK {
int [16];
int VGA_mode, to_winman0, CFport, eflags;
int modulelist[288]; /* 18 * 16 */
int alloclist[176]; /* 11 * 16 */
int [4]; /* terminator */
unsigned int bootmalloc_adr0, bootmalloc_fre0;
unsigned int bootmalloc_adr1, bootmalloc_fre1;
char FD_motor_init, FD_cache_init, DiskCacheReady, boot_keylock;
int FD_debug;
unsigned int bootmalloc_adr2, bootmalloc_fre2;
unsigned int bootmalloc_adr3, bootmalloc_fre3;
int bootlinear, bootlinear_EDI;
int bmodule_size, bmodule_paddr, bmodule_laddr;
int DiskCacheLength;
int gdt0[8];
unsigned int mscount[8];
};
#define ENT_SYSWORK 0x0000 /* これは必ず 0x0000 */
#define ENT_INIT 0x0010
#define ENT_VGADRV0 0x0020
#define ENT_KEYMOS0 0x0030
#define ENT_TIMERDRV 0x0040
#define ENT_TAPI0 0x0050
#define ENT_DECODE0 0x0060
#define ENT_FDCDRV0 0x0070
#define ENT_PIONEER0 0x0080
#define ENT_WINMAN0 0x0090
#define ENT_POKON0 0x00a0
#define ENT_VESA8 0x00b0
#define ENT_ANKFONT0 0x00c0
#define ENT_PAPI0 0x00d0
#define ENT_VESA16 0x00e0
#define ENT_VESA32 0x00f0
#define ENT_BOOT32 0x0100 /* これは非圧縮 (これは通常転送されない) */
#define ENT_FDIMAGE 0x0110 /* 特別転送 (これは通常転送されない) */
#define ENT_PDEPTE 0x0000
#define ENT_IDTGDT 0x0010
#define ENT_FREESLOT 0x0020
#define ENT_STACK 0x0030
#define ENT_KEYDATA 0x0040
#define ENT_GAPIDATA 0x0050
#define ENT_TIMERDAT 0x0060
#define ENT_TAPIWORK 0x0070
#define ENT_DECODATA 0x0080
#define ENT_FDCWORK 0x0090
#define ENT_PAPIWORK 0x00a0
/* ASKAのバグ回避のためやむなく使う(boot32.ask) */
#define SYSWORK_MLIST 0x0020
#define SYSWORK_ALIST 0x0140
#define SEL_ALL 0x0008
#define SEL_INIT 0x0010
#define SEL_SYSWORK 0x0018
#define SEL_GAPI 0x0020
#define SEL_GAPIWORK 0x0028
#define SEL_STACK 0x0030
#define SEL_ANKFONT 0x0038
#define SEL_KEYINT 0x0040
#define SEL_KEYDATA 0x0048
#define SEL_TIMERINT 0x0050
#define SEL_TIMERDAT 0x0058
#define SEL_TAPI 0x0060
#define SEL_TAPIWORK 0x0068
#define SEL_PDEPTE 0x0070
#define SEL_IDTGDT 0x0078
#define SEL_ROOT 0x0080
#define SEL_TMP 0x0088
#define SEL_PAPI 0x0090
#define SEL_PAPIWORK 0x0098
#define SEL_VRAM 0x00a0
#define SEL_BOOT32 0x00a8
#define SEL_DECODE 0x00b0
#define SEL_DECOWORK 0x00b8
#define SEL_FDCDRIVE 0x00e0
#define SEL_FDCWORK 0x00e8
#define SEL_DISKBUF 0x00f0
#define SEL_TEXTBUF 0x00f8
#define SEL_FREEGDT 0x0100
#define TSS_V86 0x5000

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,80 @@
# Makefile for OSASK/AT
# ver. 0.0
TOOLPATH = ../../z_tools/
INCPATH = ../../z_tools/guigui00/
VPATH = ..
include ../make_inc.txt
include ../make_com.txt
include ../make_wm0.txt
include ../make_pk0.txt
DEFINES = $(DEFINES_AT) -DPCAT -D$(DESIGN)
MKFL = Makefile ../Makefile ../make_inc.txt ../make_com.txt
ALL :
$(MAKE) OSASK.EXE
OSASK.EXE : $(MKFL) osalink1.opt base.exe boot32.bin ankfont0.tek tapi0.tek \
timerdrv.tek keymos0.tek fdcdrv0.tek pioneer0.tek vgadrv0.tek \
decode0.tek papi0.tek init.tek winman0.tek pokon0.tek vesa8.tek \
vesa16.tek vesa32.tek
$(OSALINK)
base.exe : $(MKFL) ../base.nap
$(CPP0) -P $(DEFINES) -o base.nas ../base.nap
$(NASK) base.nas base.exe base.lst
$(DELE) base.nas
ankfont0.bin : $(MKFL) ../ankfont0/$(FONTSRC)
$(TXT2BIN) ../ankfont0/$(FONTSRC) ankfont0.bin
%.ias : %.ask $(MKFL)
$(CPP0) -P -I.. $(DEFINES) -o $@ $<
%.gas : %.c $(MKFL)
$(CC1) $(DEFINES) -I../sgg00lib -o $@ $<
winman0.bin : $(MKFL) ../make_wm0.txt winman0.obj
$(MAKE) -C ../sgg00lib
$(OBJ2BIM) @../linkrule.rul stack:$(STK_WM_AT) map:winman0.map \
out:winman0.bim winman0.obj ../sgg00lib/sgg00lib.lib
$(BIM2BIN) malloc:$(MLC_WM_AT) mmarea:$(MMA_WM_AT) input:winman0.bim \
output:winman0.bin $(BIM_WM_AT)
$(DELE) winman0.bim
pokon0.bin : $(MKFL) ../make_pk0.txt pokon0.obj
$(MAKE) -C ../sgg00lib
$(OBJ2BIM) @../linkrule.rul stack:$(STK_PK_AT) map:pokon0.map \
out:pokon0.bim pokon0.obj ../sgg00lib/sgg00lib.lib
$(BIM2BIN) malloc:$(MLC_PK_AT) mmarea:$(MMA_PK_AT) input:pokon0.bim \
output:pokon0.bin $(BIM_PK_AT)
$(DELE) pokon0.bim
%.bin : $(MKFL) %.ias
$(ASKA) $*.ias $*.3as
$(NASKCNV) $*.3as $*.nas
$(NASK) $*.nas $*.bin $*.lst
$(DELE) $*.3as
$(DELE) $*.nas
%.obj : $(MKFL) %.gas
$(GAS2NASK) $*.gas $*.nas
$(NASK) $*.nas $*.obj $*.lst
$(DELE) $*.nas
%.tek : $(MKFL) %.bin
$(BIM2BIN) in:$*.bin out:$*.tek -osacmp -tek0 rjc:0
clean :
-$(DELE) OSASK.EXE
-$(DELE) *.lst
-$(DELE) *.ias
-$(DELE) *.gas
-$(DELE) *.map
-$(DELE) base.exe
-$(DELE) *.obj
-$(DELE) *.bin
-$(DELE) *.tek

View File

@@ -0,0 +1,546 @@
/* "decode0":キーコード・デコーダー for PC/AT ver.1.0 */
#include "osaskinc.ask"
segment CODE(USE32, PARA);
default(code == CODE);
void near Keydecode_Init();
void near Keydecode_led();
struct WORK {
int last;
short shiftmap, [2];
int declist[1028 /* 257 * 4 */];
/* +1036 */
int subcmdbuf[0x5bf4];
};
void far Keydecode_syscmd()
{
int *cmd == FS:EBX;
WORK *work == DS:0;
PUSHAD();
MOV(EAX, CS);
PUSH(DS);
EAX += 8;
DS = AX;
nextcmd:
EAX = *cmd;
if (EAX == 0)
goto cmd0000;
if (EAX == 0x010c)
goto cmd010c; /* decodeルール定義 */
if (EAX == 0x0104)
goto cmd0104; // Keydecode_setlock
if (EAX == 0x0110)
goto cmd0110; /* decodeルール初期化 */
if (EAX == 0x0108)
goto cmd0108; // Keydecode_Mainへのベクタ通知
if (EAX == 0x0100)
goto cmd0100; // 初期化
INT(0x03);
cmd0000:
POP(DS);
[SS:ESP + 16] = EBX;
POPAD();
return;
cmd0100:
// 初期化
PUSH((offset) cmd);
Keydecode_Init();
POP((offset) cmd);
(offset) cmd += 4;
goto nextcmd;
cmd0104:
/* Keydecode_setlock */
EAX = cmd[4];
PUSH((offset) cmd);
ROR(EAX, 16);
work->shiftmap &= AX;
ROR(EAX, 16);
work->shiftmap |= AX;
Keydecode_led();
POP((offset) cmd);
(offset) cmd += 8;
goto nextcmd;
cmd0108:
// Keydecode_Mainへのベクタ通知
asmout("MOV DWORD PTR FS:[EBX+4],OFFSET Keydecode_Main");
(short) cmd[8] = CS;
(offset) cmd += 12;
goto nextcmd;
cmd010c:
/* decodeルール定義(CLIしたほうがいいかも) */
/* cmd, opt(len), rawコード, shift-lock-bitmap(mask, equal), subcmd,... */
/* subcmdの一覧 */
/* 01 : sendsignal(mode-1), call vector, cmd(01), len(max:1KB), signal,...
02 : sendsignal(mode-2),
03 : sendsignal(mode-3),
04 : or shift-lock-bitmap, 0(dw), bitmap, cmd(04), 0(byte)
05 : and shift-lock-bitmap,
06 : xor shift-lock-bitmap,
// 07 : control LED, hardware-param, bitmap(andしてンゼロならon), cmd(07), hardware-param
*/
/* shift-lock-bitmapの割付例 */
/* bit0 : scroll...自動反映
bit1 : numlock...自動反映
bit2 : caps...自動反映
bit3 : reserve...自動反映
bit4 : shift
bit5 : ctrl
bit6 : alt
bit7 : reserve
bit14, 15は、make/break/remake/overbreak
*/
/*
数字の"1":
no-shift & no-ctrl & no-altでキーを押した時
numlock & no-shift & no-ctrl & no-altでテンキーを押した時
英語文字"A":
capslock & no-shift & no-ctrl & no-altでキーを押した時
no-capslock & shift & no-ctrl & no-altでキーを押した時
英語文字"a":
no-capslock & no-shift & no-ctrl & no-altでキーを押した時
capslock & shift & no-ctrl & no-altでキーを押した時
というわけで、Aとaを登録すると都合4パターンを登録する必要がある
キーの複雑な対応は、winman0で処理させる。
*/
/* ワークエリアから適当に切り取って転送して、ポインタを繋いでおわり。 */
ESI = work->last;
ECX = cmd[ 4]; /* len */
EDX = cmd[ 8]; /* rawコード */
EAX = cmd[12]; /* shiftmap */
(offset) cmd += 16;
[DS:ESI] = EAX;
EDI = ESI;
ESI += 8;
ECX -= 2;
do {
EAX = *cmd;
(offset) cmd += 4;
[DS:ESI] = EAX;
ESI += 4;
ECX--;
} while (!= 0);
[DS:EDI + 4] = ECX /* 0 */;
work->last = ESI;
ESI = work->declist[EDX * 4];
if (ESI == 0) {
work->declist[EDX * 4] = EDI;
goto nextcmd;
}
do {
EAX = ESI;
ESI = [DS:ESI + 4];
} while (ESI != 0);
[DS:EAX + 4] = EDI;
goto nextcmd;
cmd0110:
/* decodeルール初期化 */
work->last = 1036;
(offset) cmd += 8;
LEA(ESI, work->declist[0]);
EAX = 0;
ECX = 257;
do {
[DS:ESI] = EAX;
ESI += 4;
ECX--;
} while (!= 0);
goto nextcmd;
}
void far Keydecode_Main()
/* CLIしたほうがいいかも */
{
unsigned int keyint_sel == 8 * 8, keydata_sel == 9 * 8;
WORK *work == DS:0;
int *msg == DS:ESI;
MOV(ECX, CS);
PUSH(DS);
ECX += 8;
EAX = msg[8];
DS = CX;
PUSH(ESI);
if ((unsigned) EAX >= 0x04000000)
goto ignore;
ECX = EAX;
// EDX = EAX;
(unsigned int) ECX >>= 10;
EAX &= 0x00ffffff;
ECX &= 0xc000;
/* mode-1バッファを検索する */
/* コードが存在したら、shiftmapではなく、バッファ内のシフトコードをローディング */
// if (EAX == work->mode1buf[ 0])
// CX |= work->mode1buf[ 4];
// else if (EAX == work->mode1buf[ 8])
// CX |= work->mode1buf[12];
// else if (EAX == work->mode1buf[16])
// CX |= work->mode1buf[20];
// else if (EAX == work->mode1buf[24])
// CX |= work->mode1buf[28];
// else
CX |= work->shiftmap;
/* breakだったら、mode1buf, mode2bufから抹消する */
EDI = work->declist[EAX * 4];
if (EDI != 0) {
do {
/* このループ内でCXは保存すること */
EAX = ECX;
AX &= [DS:EDI + 0];
CMP(AX, [DS:EDI + 2]);
if (==) {
AL = [DS:EDI + 8 + 6];
LEA(ESI, [EDI + 8 + 8]);
if (AL == 0x01) {
/* send signal mode-1 */
INT(0x03);
}
if (AL == 0x02) {
/* send signal mode-2 */
INT(0x03);
}
if (AL == 0x03) {
/* send signal mode-3 */
PUSH(EDI);
PUSH(ECX);
asmout("CALL FAR DWORD DS:[EDI + 8]");
POP(ECX);
POP(EDI);
goto next;
}
DL = (char) work->shiftmap;
if (AL == 0x04) {
/* or shift-lock-bitmap */
EAX = [DS:EDI + 8];
work->shiftmap |= AX;
checkled:
DL ^= (char) work->shiftmap;
DL &= 0x0f;
if (!= 0)
Keydecode_led();
/* mode-2バッファを検索する */
/* コードが存在し、かつ、shift状態の変化によりmake状態にふさわしくなくなったら、
ブレイクしてから、あらたにmakeする */
goto next;
}
if (AL == 0x05) {
/* and shift-lock-bitmap */
EAX = [DS:EDI + 8];
work->shiftmap &= AX;
goto checkled;
}
if (AL == 0x06) {
/* xor shift-lock-bitmap */
EAX = [DS:EDI + 8];
work->shiftmap ^= AX;
goto checkled;
}
if (AL == 0x38) {
/* reset */
PUSH((int) 0);
PUSH(EAX /* dummy */);
PUSH(0x010c /* KeyResetCPU */);
MOV(EAX, SS);
EBX = ESP;
FS = AX;
DB(0x9a); DD(0); DW((short) keyint_sel);
ESP += 12;
for (;;)
HLT();
}
}
next:
EDI = [DS:EDI + 4];
} while (EDI != 0);
}
ignore:
POP(ESI);
POP(DS);
return;
}
#if 0
DS = AX;
EAX = msg[8];
ECX = EAX;
EAX <<= 4;
ECX >>= 12;
EAX &= 0xff0;
ECX &= 0x3000;
asmout("#work_keycode EQU 0");
asmout("#work_keytype EQU #work_keycode+256");
asmout("#work_msg EQU #work_keytype+256");
asmout("#work_tenkey EQU #work_msg+64");
asmout("#work_twocase EQU #work_tenkey");
asmout("#work_signal EQU #work_twocase+60H");
asmout("#work_jmptable EQU #work_signal+8");
asmout("#work_shiftflag EQU #work_jmptable+20");
asmout("#work_pause EQU #work_shiftflag+1");
asmout("#work_dummy0 EQU #work_pause+1");
asmout("#work_sigcall EQU #work_dummy0+2");
asmout("#work_size EQU #work_sigcall+8");
asmout("KeyCode_Esc EQU 080H");
asmout("KeyCode_F1 EQU 081H");
asmout("KeyCode_F2 EQU 082H");
asmout("KeyCode_F3 EQU 083H");
asmout("KeyCode_F4 EQU 084H");
asmout("KeyCode_F5 EQU 085H");
asmout("KeyCode_F6 EQU 086H");
asmout("KeyCode_F7 EQU 087H");
asmout("KeyCode_F8 EQU 088H");
asmout("KeyCode_F9 EQU 089H");
asmout("KeyCode_F10 EQU 08AH");
asmout("KeyCode_F11 EQU 08BH");
asmout("KeyCode_F12 EQU 08CH");
asmout("KeyCode_Enter EQU 0A0H");
asmout("KeyCode_Backspace EQU 0A1H");
asmout("KeyCode_Tab EQU 0A2H");
asmout("KeyCode_Insert EQU 0A4H");
asmout("KeyCode_Delete EQU 0A5H");
asmout("KeyCode_Home EQU 0A6H");
asmout("KeyCode_End EQU 0A7H");
asmout("KeyCode_PageUp EQU 0A8H");
asmout("KeyCode_PageDown EQU 0A9H");
asmout("KeyCode_Left EQU 0ACH");
asmout("KeyCode_Right EQU 0ADH");
asmout("KeyCode_Up EQU 0AEH");
asmout("KeyCode_Down EQU 0AFH");
asmout("KeyCode_PrintScreen EQU 0B0H");
asmout("KeyCode_ScrollLock EQU 0B1H");
asmout("KeyCode_NumLock EQU 0B2H");
asmout("KeyCode_CapsLock EQU 0B3H");
asmout("KeyCode_Pause EQU 0B4H");
asmout("KeyCode_Break EQU 0B5H");
asmout("KeyCode_SysRq EQU 0B6H");
asmout("KeyCode_Windows EQU 0B8H");
asmout("KeyCode_Menu EQU 0BAh");
asmout("KeyCode_Zenkaku EQU 0C0H");
asmout("KeyCode_Muhenkan EQU 0C1H");
asmout("KeyCode_Henkan EQU 0C2H");
asmout("KeyCode_Hiragana EQU 0C3H");
int *msg == DS:ESI;
MOV(EAX, CS);
PUSH(DS);
EAX += 8;
PUSH(ESI);
DS = AX;
EAX = msg[8];
ECX = EAX;
EAX <<= 4;
ECX >>= 12;
EAX &= 0xff0;
ECX &= 0x3000;
LEA(ESI, [EAX + ECX + 0x2000]);
TEST((char) [DS:ESI], 0x0f);
if (!= 0) {
asmout("CALL FAR DWORD DS:[#work_sigcall]");
// asmout("fcall 12*8,TAPI_SingnalMessageTimer");
}
POP(ESI);
POP(DS);
EAX = msg[8];
if ((unsigned) EAX >= 0x03000000) // overbreakとerrorは捨てる
goto ret;
MOV(EDX, CS);
PUSHFD();
DX += 8;
CLI(); // こんがらがらないようにするため
PUSH(DS);
DS = DX;
ECX = EAX;
EAX &= 0xffffff;
if ((unsigned) EAX >= 0x100)
goto over100;
asmout("MOVZX EBX,BYTE PTR DS:[#work_keytype][EAX]");
asmout("MOV AL,BYTE PTR DS:[#work_keycode][EAX]");
if (EBX == 0)
goto shift;
TEST(ECX, 0x01000000);
if (!= 0) // breakは無視
goto ret2;
asmout("JMP DWORD PTR DS:[#work_jmptable][EBX-4]");
over100:
if (!=)
goto ret2;
asmout("MOV AL,BYTE PTR DS:[#work_pause]");
send_al:
asmout("Keydecode_Main_sendal:"); // type == 0x14
asmout("MOV AH,BYTE PTR DS:[#work_shiftflag]");
send_ax:
asmout("Keydecode_Main_sendax:");
asmout("MOV WORD PTR DS:[#work_msg+8],AX");
PUSH(ESI);
asmout("MOV ESI,OFFSET #work_msg");
asmout("CALL FAR DWORD DS:[#work_signal]");
POP(ESI);
ret2:
asmout("Keydecode_Main_ret2:");
POP(DS);
POPFD();
ret:
return;
shift:
asmout("Keydecode_Main_shift:"); // type == 0x00
if (ECX >= 0x02000000) // make/break以外は無視
goto ret2;
if (ECX < 0x01000000) { // make
asmout("OR BYTE PTR DS:[#work_shiftflag],AL");
goto ret2;
}
AL =~ AL;
asmout("AND BYTE PTR DS:[#work_shiftflag],AL");
goto ret2;
asmout("Keydecode_Main_lock:"); // type == 0x04
PUSH(EAX);
asmout("MOV BL,BYTE PTR DS:[#work_shiftflag]");
DL = 0x01 /* shift */;
BL &= 0x0b /* 00001011B */; // Alt状態は無視
if (AL != 0x40 /* caps */) {
/* DL = 0 */ EDX = 0;
BL &= 0x0a /* 00001010B */; // Alt, Shit状態は無視
}
if (DL == BL) {
asmout("XOR AL,BYTE PTR DS:[#work_shiftflag]");
asmout("MOV BYTE PTR DS:[#work_shiftflag],AL");
SHR(AL,4);
PUSH(FS);
PUSH(EBX);
PUSH((int) 0);
PUSH(EAX);
PUSH(0x0108 /* KeySetLed */);
MOV(EAX, SS);
EBX = ESP;
FS = AX;
DB(0x9a); DD(0); DW((short) keyint_sel);
ESP += 12;
POP(EBX);
POP(FS);
// asmout("fcall 8*8, KeySetLed");
}
POP(ECX);
asmout("MOV AL,KeyCode_NumLock");
if (CL == 0x20)
goto send_al;
asmout("MOV AL,KeyCode_CapsLock");
if (CL == 0x40)
goto send_al;
asmout("MOV AL,KeyCode_ScrollLock");
// if (CL == 0x10)
goto send_al;
asmout("Keydecode_Main_tenkey:"); // type == 0x08
EBX = EAX;
asmout("MOV AH,BYTE PTR DS:[#work_shiftflag]");
asmout("MOV AL,BYTE PTR DS:[#work_tenkey][EBX]");
TEST(AH, 0x20); // NumLock
if (== 0)
goto tenkey_skip;
TEST(AH, 0x01); // shift
/* (false) */ if (!= 0)
goto tenkey_skip2;
asmout("MOV AL,BYTE PTR DS:[#work_tenkey+30H][EBX]");
tenkey_skip:
if (AL != 0)
goto send_ax;
goto ret2;
tenkey_skip2:
AH &= 0xfe; // shiftを消す
if (AL != 0)
goto send_ax;
goto ret2;
asmout("Keydecode_Main_alphabet:"); // type == 0x0C
asmout("MOV AH,BYTE PTR DS:[#work_shiftflag]");
TEST(AH, 0x01); // shift
if (!= 0) {
AL ^= 0x20;
}
TEST(AH, 0x40); // caps
if (== 0)
goto send_ax;
AL ^= 0x20;
goto send_ax;
asmout("Keydecode_Main_twocase:"); // type == 0x10
EBX = EAX;
asmout("MOV AH,BYTE PTR DS:[#work_shiftflag]");
asmout("MOV AL,BYTE PTR DS:[#work_twocase][EBX]");
TEST(AH, 0x01); // shift
if (== 0)
goto send_ax;
asmout("MOV AL,BYTE PTR DS:[#work_twocase+30H][EBX]");
goto send_ax;
}
#endif
void near Keydecode_led()
{
unsigned int keyint_sel == 8 * 8, keydata_sel == 9 * 8;
WORK *work == DS:0;
AL = (char) work->shiftmap;
EAX &= 0x0f;
PUSH(FS);
PUSH((int) 0);
PUSH(EAX);
PUSH(0x0108 /* KeySetLed */);
MOV(EAX, SS);
EBX = ESP;
FS = AX;
DB(0x9a); DD(0); DW((short) keyint_sel);
ESP += 12;
POP(FS);
return;
}
void near Keydecode_Init()
{
unsigned int Init_sel == 2 * 8, TAPI_sel == 12 * 8;
ECX = 4096 * 6 / 4;
EAX = 0;
ESI = 0;
do {
(int) [DS:ESI] = EAX;
ESI += 4;
ECX--;
} while (!= 0);
return;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,17 @@
base.exe
boot32.bin
ankfont0.tek
tapi0.tek
timerdrv.tek
keymos0.tek
fdcdrv0.tek
pioneer0.tek
vgadrv0.tek
decode0.tek
papi0.tek
init.tek
winman0.tek
pokon0.tek
vesa8.tek
vesa16.tek
vesa32.tek

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,365 @@
#ifndef _POKON0_H
#define _POKON0_H
#define AUTO_MALLOC 0
#define NULL 0
#define SYSTEM_TIMER 0x01c0
#define LIST_HEIGHT 8
#define ext_EXE ('E' | ('X' << 8) | ('E' << 16))
#define ext_BIN ('B' | ('I' << 8) | ('N' << 16))
#define ext_ALL -1
#define CONSOLESIZEX 40
#define CONSOLESIZEY 15
#define MAX_BANK 56
#define MAX_FILEBUF 64
#define MAX_SELECTOR 5
#define MAX_SELECTORWAIT 64
#define MAX_VMREF 256
#define JOBLIST_SIZE 1024
#define MAX_ORDER 16 /* 256B */ // 256 /* 4KB */
#define MAX_ARCBUF 32
#define MAX_LARGECACHE MAX_FILEBUF
/* key defines */
#define DEFSIG_EXT1 0x00001000
#define DEFSIG_MAKE 0x00000000
#define DEFSIG_BREAK 0x00004000
#define DEFSIG_REMAKE 0x00008000
#define DEFSIG_NOCAPS 0x00040000
#define DEFSIG_CAPS 0x04040000
#define DEFSIG_NOSHIFT 0x00100000
#define DEFSIG_SHIFT 0x10100000
#define DEFSIG_NOCTRL 0x00200000
#define DEFSIG_CTRL 0x20200000
#define DEFSIG_NOALT 0x00400000
#define DEFSIG_ALT 0x40400000
/* pokon status */
enum {
STATUS_RUN_APPLICATION,
STATUS_MAKE_PLAIN_BOOT_DISK,
STATUS_MAKE_COMPRESSED_BOOT_DISK,
FMODE3,
FMODE4,
FMODE5,
FMODE6,
STATUS_LOAD_BOOT_SECTOR_CODE_COMPLETE,/* 'S'と'Enter'と'F'と'R'しか入力できない */
STATUS_WRITE_KERNEL_COMPLETE,
STATUS_FORMAT_COMPLETE,
STATUS_BOOTING
};
/* pokon sort mode */
enum {
SORT_NAME,
SORT_EXT,
SORTS,
DEFAULT_SORT_MODE = SORT_NAME,
};
/* signal defines */
/* main signals */
#define NO_SIGNAL 0x0000 /* no signal */
#define SIGNAL_REWIND 0x0004 /* rewind */
#define SIGNAL_BOOT_COMPLETE 99 /* boot完了 */
#define SIGNAL_TERMINATED_TASK 0x0080 /* terminated task */
#define SIGNAL_REQUEST_DIALOG 0x0084 /* ダイアログ要求シグナル */
#define SIGNAL_REQUEST_DIALOG2 0x0088
#define SIGNAL_FREE_FILES 0x008c /* ファイル開放要求(えせファイルシステム用) */
#define SIGNAL_RESIZE_FILE 0x008d /* cmd, addr, new-size, task, sig, slot */
#define SIGNAL_NEED_WB 0x0090 /* ファイルキャッシュはライトバックが必要 */
#define SIGNAL_NO_WB_CACHE 0x0094 /* to clear need_wb */
#define SIGNAL_CHECK_WB_CACHE_NEXT 0x0098 /* JOB_CHECK_WB_CACHEの作業用シグナル */
#define SIGNAL_REFRESH_FLIST 0x009c
#define SIGNAL_REFRESH_FLIST0 0x009d /* ファイルリストは変更しない */
#define SIGNAL_RELOAD_FAT_COMPLETE 0x00a0 /* FAT再読み込み完了(Insert) */
#define SIGNAL_JSUB 0x00a4 /* 汎用シグナル */
#define SIGNAL_FORMAT_COMPLETE 0x00b8 /* フォーマット完了 */
#define SIGNAL_WRITE_KERNEL_COMPLETE 0x00bc /* .EXE書き込み完了 */
#define SIGNAL_RESIZE_SUB0 0x00bd /* size == 0 からのリサイズ */
#define SIGNAL_VBELIST 0x00be /* VESA情報アドレス通知(ATのみ, winman0から) */
/* action signals */
enum {
SIGNAL_CURSOR_UP = 4,
SIGNAL_CURSOR_DOWN,
SIGNAL_ENTER = 6,
SIGNAL_CURSOR_PAGE_UP = 10,
SIGNAL_CURSOR_PAGE_DOWN,
SIGNAL_TOP_OF_LIST = 12,
SIGNAL_BOTTOM_OF_LIST,
SIGNAL_DISK_CHANGED = 14,
SIGNAL_START_WB,
SIGNAL_FORCE_CHANGED,
SIGNAL_CHECK_WB_CACHE,
SIGNAL_CREATE_NEW,
SIGNAL_DELETE_FILE,
SIGNAL_RESIZE,
SIGNAL_CHANGE_SORT_MODE, /* 21 */
SIGNAL_DISK_CHANGE0, /* 10個必要(22-31) */
SIGNAL_LETTER_START = '!', /* 33 */
SIGNAL_LETTER_END = 'Z', /* 5a */
SIGNAL_PAGE_UP = 0x60,
SIGNAL_PAGE_DOWN,
SIGNAL_MOSPOS,
SIGNAL_MOSBTN,
SIGNAL_WINDOW_ENABLE_DRAW = 120,
SIGNAL_WINDOW_DISABLE_DRAW,
SIGNAL_WINDOW_REDRAW,
SIGNAL_WINDOW_REDRAW_PARTIAL,
SIGNAL_WINDOW_CLOSE0 = 126,
SIGNAL_WINDOW_CLOSE1 = 127,
};
/* command signals */
enum {
COMMAND_SIGNAL_START = 0xc0, /* 192 */
COMMAND_TO_FORMAT_MODE = COMMAND_SIGNAL_START, /* to format-mode */
COMMAND_TO_RUN_MODE, /* to run-mode */
COMMAND_CHANGE_FORMAT_MODE, /* change format-mode */
COMMAND_OPEN_CONSOLE, /* open console */
COMMAND_OPEN_MONITOR, /* open monitor */
COMMAND_BINEDIT, /* binary edit */
COMMAND_TXTEDIT, /* text viewer */
COMMAND_CMPTEK0,
COMMAND_MCOPY,
COMMAND_SIGNAL_END = 0xff,
};
/* console signals ( + file selector signal start) */
enum {
CONSOLE_SIGNAL_START = 256,
CONSOLE_VRAM_ACCESS_ENABLE = CONSOLE_SIGNAL_START,
CONSOLE_VRAM_ACCESS_DISABLE,
CONSOLE_REDRAW_0,
CONSOLE_REDRAW_1,
CONSOLE_CHANGE_TITLE_COLOR = CONSOLE_SIGNAL_START + 5,
CONSOLE_CLOSE_WINDOW,
CONSOLE_CURSOR_BLINK = CONSOLE_SIGNAL_START + 31,
CONSOLE_KEY_SIGNAL_START = CONSOLE_SIGNAL_START + ' ',
CONSOLE_KEY_SIGNAL_END = CONSOLE_SIGNAL_START + 0x7f,
CONSOLE_INPUT_ENTER = CONSOLE_SIGNAL_START + 0xa0,
CONSOLE_INPUT_BACKSPACE = CONSOLE_SIGNAL_START + 0xa1,
CONSOLE_SIGNAL_END = 512 - 1,
FILE_SELECTOR_SIGNAL_START,
};
/* jobs */
#define JOB_INVALID_DISKCACHE 0x0004 /* invalid diskcache -> reload fat */
#define JOB_LOAD_FILE_AND_EXECUTE 0x0008 /* file load & execute */
//#define JOB_CREATE_TASK 0x000c /* create task */
#define JOB_LOAD_FILE 0x0010 /* file load */
#define JOB_LOAD_FILE_AND_FORMAT 0x0014 /* file load & format (1) */
#define JOB_VIEW_FILE 0x0018 /* viewer load & execute, file open */
#define JOB_CHECK_WB_CACHE 0x001c /* check WB cache */
#define JOB_WRITEBACK_CACHE 0x0020 /* writeback cache */
#define JOB_INVALID_WB_CACHE 0x0024 /* invalid WB cache */
#define JOB_FREE_MEMORY 0x0028 /* free memory */
#define JOB_CREATE_FILE 0x002c
#define JOB_DELETE_FILE 0x0030
#define JOB_RENAME_FILE 0x0034
#define JOB_RESIZE_FILE 0x0038
#define JOB_LOAD_FILE_AND_EXEC_CONS 0x003c /* file load & execute (console) */
#define JOB_EXT_OPEN 0x0040
#define JOB_SEND_TEST_MODULE_SIGNAL 0x0044
#define JOB_SEARCH_FP 0x0048
#define JOB_CHANGE_DRIVE 0x004c
#define JOB_LOAD_AND_EXEC_PSF 0x0050
#define JOB_CHANGE_DEVICE 0x0054
/* structs */
struct FILELIST {
char name[11];
struct SGG_FILELIST *ptr;
};
struct FILEBUF {
int dirslot, linkcount, size, paddr, virtualmodule;
struct STR_ARCBUF *arcbuf;
char readonly, pipe /* resize時の挙動を決める */;
};
struct STR_BANK { /* 84bytes */
int tss; /* ここが0だと未使用bank, 負の値だと予約bank */
struct FILEBUF *fbuf;
struct STR_ARCBUF *arcbuf;
char name[12];
struct {
int global, inner;
} Llv[8];
};
#define FILESELWINFLAG_DRAWENABLED 1
#define FILESELWINFLAG_GRABBED 2
#define FILESELWINFLAG_SBARDIRTY 4
struct FILESELWIN { /* 1つあたり、5.6KB必要 */
int ext, cur, winslot, sigbase, listsize;
int task, mdlslot, num, siglen, sig[16];
int shndly0, shndly1, grabbedy;
int mosx, mosy, mosbtns;
char subtitle_str[24];
char flags;
struct FILELIST *lp, list[256] /* 4KB */, *grabbedlp;
struct LIB_WINDOW window; /* (128B) */
struct {
struct LIB_TEXTBOX tbox;
int data[8 * 10 * 1 / 4];
} wintitle; /* 144B */
struct {
struct LIB_TEXTBOX tbox;
int data[8 * 20 * 1 / 4];
} subtitle; /* 224B */
struct {
struct LIB_TEXTBOX tbox;
int data[8 * 16 * 8 / 4];
} selector; /* 1088B */
// subtitle_str[0] == '\0' : ウィンドウクローズ完了
// task == 0 : 未使用マーク(subtitle_str[0]と同じじゃないのか?)
// lp == NULL : close処理中
// mdlslot == -1 : タスク終了によってキャンセルされた
// mdlslot == -2 : close処理中
/*
close windowを実施すると、lp = NULLになる。
closedを受け取ると、lp = listになる。
ロードが終わったら、mdlslotが-2になる。
*/
};
struct SELECTORWAIT {
int task, slot, bytes, ofs, sel;
};
struct STR_JOBLIST {
int *list, free, *rp, *wp, now;
struct FILEBUF *fbuf;
struct STR_BANK *bank;
struct FILESELWIN *win;
int param[8];
struct SGG_FILELIST *fp, *fp__;
int dirslot;
struct STR_OPEN_ORDER *order;
void (*retfunc)(int);
int (*jsubfunc)(int *);
};
#define PPJ_fbuf 5
#define PPJ_bank 6
#define PPJ_win 7
#define PPJ_prm0 8
#define PPJ_prm1 9
#define PPJ_prm2 10
#define PPJ_prm3 11
#define PPJ_prm4 12
#define PPJ_prm5 13
#define PPJ_prm6 14
#define PPJ_prm7 15
#define PPJ_fp 16
struct VIRTUAL_MODULE_REFERENCE {
int task, slot;
struct FILEBUF *fbuf;
int sigbase, flushed_size;
char flags;
};
struct STR_CONSOLE {
unsigned char col;
char curx, cury;
char sleep, cursorflag, cursoractive;
unsigned char buf[(CONSOLESIZEX + 2) * (CONSOLESIZEY + 1)];
struct LIB_WINDOW win;
struct {
struct LIB_TEXTBOX tbox;
int data[8 * 16 * 1 / 4];
} title; /* 192B */
struct {
struct LIB_TEXTBOX tbox;
int data[8 * CONSOLESIZEX * CONSOLESIZEY / 4];
} tbox;
};
struct STR_OPEN_ORDER {
int task, num, dummy;
struct SGG_FILELIST *fp;
};
struct STR_VIEWER {
unsigned char ext[4], binary[12];
int signal[4];
};
struct STR_PROCESS_TASK {
struct STR_BANK *bank;
struct VIRTUAL_MODULE_REFERENCE *vmr_lst[6];
char flags; /* bit0:1ならこのタスクが死ぬときプロセスを巻き添えにする */
};
struct STR_PROCESS {
struct STR_PROCESS_TASK task[4];
};
struct STR_ARCBUF {
int dirslot, linkcount, size, paddr, clu2;
int dir0, info0, flags, align;
};
/* functions */
void consoleout(char *s);
void open_console();
void poko_exec_cmd(const char *cmdlin);
/* pokon console command */
int poko_memory(const char *cmdlin);
int poko_color(const char *cmdlin);
int poko_cls(const char *cmdlin);
//int poko_mousespeed(const char *cmdlin);
int poko_mouseaccel(const char *cmdlin);
int poko_setdefaultIL(const char *cmdlin);
int poko_tasklist(const char *cmdlin);
int poko_sendsignalU(const char *cmdlin);
int poko_LLlist(const char *cmdlin);
int poko_setIL(const char *cmdlin);
int poko_create(const char *cmdlin);
int poko_delete(const char *cmdlin);
int poko_rename(const char *cmdlin);
int poko_resize(const char *cmdlin);
int poko_debug(const char *cmdlin);
int poko_nfname(const char *cmdlin);
int poko_autodecomp(const char *cmdlin);
int poko_sortmode(const char *cmdlin);
int poko_exec(const char *cmdlin);
int poko_kill(const char *cmdlin);
int poko_vesalist(const char *cmdlin);
int poko_setvesa(const char *cmdlin);
int poko_detectpcivga(const char *cmdlin);
int poko_defkeybind(const char *cmdlin);
int poko_defspkeybind(const char *cmdlin);
int poko_setwindef(const char *cmdlin);
int poko_run(const char *cmdlin);
int poko_drvfd(const char *cmdlin);
int poko_drvata(const char *cmdlin);
int poko_drvcf(const char *cmdlin);
int poko_drvbfd(const char *cmdlin);
int poko_setwallpaper(const char *cmdlin);
int poko_setext(const char *cmdlin);
int poko_autodearc(const char *cmdlin);
int poko_townsmouse(const char *cmdlin);
/* */
void sgg_wm0s_sendto2_winman0(const int signal, const int param);
struct STR_VIEWER *search_viewer0(const unsigned char *ext);
//struct STR_VIEWER *search_viewer1(const unsigned char *ext);
#if 0
void fileselect(struct FILESELWIN *win, int fileid);
#endif
#endif /* pokon0.h */

View File

@@ -0,0 +1,22 @@
# Makefile for OSASK/qemu
# ver. 0.0
TOOLPATH = ../../z_tools/
INCPATH = ../../z_tools/guigui00/
include ../make_inc.txt
include ../make_com.txt
MKFL = Makefile ../Makefile ../make_inc.txt ../make_com.txt
ALL :
$(MAKE) OSASK.EXE
OSASK.EXE : $(MKFL) osalink1.opt timerdrv.tek
$(MAKE) -C .. at
$(COPY) ..\osask_at.exe osask_at.exe
$(OSALINK)
$(DELE) osask_at.exe
clean :
-$(DELE) OSASK.EXE

View File

@@ -0,0 +1,2 @@
setvesa 3 0x114
mouseaccel 1 1

View File

@@ -0,0 +1,2 @@
ovrcopy from:osask_qe.sys to:@:OSASK.SYS
copy from:qemu/OSASK0.PSF to:@:

View File

@@ -0,0 +1,2 @@
osask_at.exe
timerdrv.tek

View File

@@ -0,0 +1,42 @@
# Makefile for sgg00lib
# ver. 0.0
TOOLPATH = ../../z_tools/
INCPATH = ../../z_tools/guigui00/
include ../make_inc.txt
include ../make_com.txt
DEFINES += -DPCAT -D$(DESIGN)
TARGET = sgg00lib.lib
OBJS = execcmd.obj execcmd0.obj execcmd1.obj fwinman.obj fpokon.obj fdebug.obj
MKFL = Makefile ../Makefile ../make_inc.txt ../make_com.txt
ALL :
$(MAKE) sgg00lib.lib
%.gas : $(MKFL) %.c
$(CC1) $(DEFINES) -I. -o $*.gas $*.c
%.nas : $(MKFL) %.gas
$(GAS2NASK) $*.gas $*.nas
%.ias : $(MKFL) %.ask
$(CPP0) -P $(DEFINES) -I. -o $*.ias $*.ask
%.3as : $(MKFL) %.ias
$(ASKA) $*.ias $*.3as
%.nas : $(MKFL) %.3as
$(NASKCNV) -w $*.3as $*.nas
%.obj : $(MKFL) %.nas
$(NASK) $*.nas $*.obj $*.lst
$(TARGET) : $(MKFL) $(OBJS)
$(GOLIB) out:$(TARGET) $(OBJS)
clean :
-$(DELE) *.lst
-$(DELE) *.obj

View File

@@ -0,0 +1,16 @@
segment CODE(USE32, PARA);
default(code == CODE);
asmout("[FILE 'execcmd.ask']");
asmout("GLOBAL _sgg_execcmd");
/* void sgg_execcmd(void *EBX); */
void _sgg_execcmd()
{
PUSH(EBX);
EBX = [SS:ESP+8];
CALL(0xcf,0);
POP(EBX);
return;
}

View File

@@ -0,0 +1,16 @@
segment CODE(USE32, PARA);
default(code == CODE);
asmout("[FILE 'execcmd0.ask']");
asmout("GLOBAL _sgg_execcmd0");
/* void sgg_execcmd0(const int cmd, ...) */
void _sgg_execcmd0()
{
PUSH(EBX);
LEA(EBX, [SS:ESP+8] /* cmd */);
CALL(0xcf,0);
POP(EBX);
return;
}

View File

@@ -0,0 +1,19 @@
segment CODE(USE32, PARA);
default(code == CODE);
asmout("[FILE 'execcmd1.ask']");
asmout("GLOBAL _sgg_execcmd1");
/* const int sgg_execcmd1(const int ret, const int cmd, ...)
ret = n * 4 + 12 */
void _sgg_execcmd1()
{
PUSH(EBX);
LEA(EBX, [SS:ESP+12] /* cmd */);
CALL(0xcf,0);
EAX = [SS:ESP+8] /* ret */;
EAX = [SS:ESP+EAX];
POP(EBX);
return;
}

View File

@@ -0,0 +1,24 @@
// for debug
#include <sysgg00.h>
void sgg_debug00(const int opt, const int bytes, const int reserve,
const int src_ofs, const int src_sel, const int dest_ofs, const int dest_sel)
{
static struct {
int cmd, opt, bytes, reserve;
int src_ofs, src_sel, dest_ofs, dest_sel;
int eoc;
} command = { 0x8010, 0, 0, 0, 0, 0, 0, 0, 0x0000 };
command.opt = opt;
command.bytes = bytes;
command.reserve = reserve;
command.src_ofs = src_ofs;
command.src_sel = src_sel;
command.dest_ofs = dest_ofs;
command.dest_sel = dest_sel;
sgg_execcmd(&command);
return;
}

View File

@@ -0,0 +1,188 @@
// for pokon0
#include <sysgg00.h>
const int sgg_getfilelist(const int size, struct SGG_FILELIST *fp, const int reserve0, const int reserve1)
{
static struct {
int cmd1, opt; void *buf; int sel;
int reserve0, reserve1, reserve2, reserve3;
int eoc;
} command = { 0x0040, 0, 0, 0x000f, 0, 0, 0, 0, 0x0000 };
struct SGG_FILELIST *fp0 = fp + 1;
command.opt = size;
command.buf = fp;
sgg_execcmd(&command);
do {
fp++;
} while (fp->name[0]);
return fp - fp0;
}
#if 0
void sgg_loadfile(const int mdl_ent, const int file_id, const int fin_sig)
{
static struct {
int cmd, opt, data[8];
int eoc;
} command = {
0x0020, 0x80000000 + 8,
0x1247, 0x0100, 0, 0, 0x4243 /* to pokon0 */, 0x7f000002, 0, 0,
0x0000
};
command.data[2] = mdl_ent;
command.data[3] = file_id;
command.data[6] = fin_sig;
sgg_execcmd(&command);
return;
}
void sgg_createtask(const int mdl_ent, const int fin_sig)
{
static struct {
int cmd, opt, data[7];
int eoc;
} command = {
0x0020, 0x80000000 + 7,
0x1246, 0x0104, 0, 0x4243 /* to pokon0 */, 0x7f000002, 0, 0,
0x0000
};
command.data[2] = mdl_ent;
command.data[5] = fin_sig;
sgg_execcmd(&command);
return;
// このコマンドが別タスクで処理されていることは、効率の悪いことだ。
}
#endif
void sgg_settasklocallevel(const int task, const int local, const int global, const int inner)
{
static struct {
int cmd, opt, data[6];
int eoc;
} command = {
0x0020, 0x80000000 + 6,
0x1245, 0x0108, 0, 0, 0, 0,
0x0000
};
command.data[2] = task;
command.data[3] = local;
command.data[4] = global;
command.data[5] = inner;
sgg_execcmd(&command);
return;
// このコマンドが別タスクで処理されていることは、効率の悪いことだ。
}
void sgg_runtask(const int task, const int local)
{
static struct {
int cmd, opt, data[4];
int eoc;
} command = {
0x0020, 0x80000000 + 4,
0x1243, 0x010c, 0, 0,
0x0000
};
command.data[2] = task;
command.data[3] = local;
sgg_execcmd(&command);
return;
// このコマンドが別タスクで処理されていることは、効率の悪いことだ。
}
#if 0
void sgg_freememory(const int mdl_ent)
{
static struct {
int cmd, opt, data[3];
int eoc;
} command = {
0x0020, 0x80000000 + 3,
0x1242, 0x0110, 0,
0x0000
};
command.data[2] = mdl_ent;
sgg_execcmd(&command);
return;
// このコマンドが別タスクで処理されていることは、効率の悪いことだ。
}
#endif
void sgg_format(const int sub_cmd, const int sig)
{
sgg_execcmd0(0x0020, 0x80000000 + 6, 0x1245, sub_cmd, 0, 0x4242 /* to pokon0 */, 0x7f000001, sig, 0x0000);
#if 0
static struct {
int cmd, opt, data[6];
int eoc;
} command = {
0x0020, 0x80000000 + 6,
0x1245, 0, 0, 0x4242 /* to pokon0 */, 0x7f000001, 0,
0x0000
};
command.data[1] = sub_cmd;
command.data[5] = sig;
sgg_execcmd(&command);
#endif
return;
}
#if 0
void sgg_wm0s_sendto1_winmam0(const int signal)
{
static struct {
int cmd, opt;
int data[3];
int eoc;
} command = { 0x0020, 0x80000000 + 3, { 0x3240 + 2, 0x7f000001, 0 }, 0x0000 };
command.data[2] = signal;
sgg_execcmd(&command);
return;
}
#endif
void sgg_wm0s_sendto2_winman0(const int signal, const int param)
{
sgg_execcmd0(0x0020, 0x80000000 + 4, 0x3240 + 3, 0x7f000002, signal, param, 0x0000);
#if 0
static struct {
int cmd, opt;
int data[4];
int eoc;
} command = { 0x0020, 0x80000000 + 4, { 0x3240 + 3, 0x7f000002, 0, 0 }, 0x0000 };
command.data[2] = signal;
command.data[3] = param;
sgg_execcmd(&command);
#endif
return;
}

View File

@@ -0,0 +1,395 @@
// for winman0
#include <sysgg00.h>
#if 0
#define WINSTR_STATUS 0 / 4
#define WINSTR_USERID 4 / 4
#define WINSTR_SIGNALBASE 8 / 4
#define WINSTR_SIGNALEBOX 12 / 4
#define WINSTR_XSIZE 16 / 4
#define WINSTR_YSIZE 20 / 4
#define WINSTR_X0 24 / 4
#define WINSTR_Y0 28 / 4
void sgg_wm0s_movewindow(struct SGG_WINDOW *window, const int x, const int y)
// wm0sは、"winman0signal"の略
{
static struct {
int cmd1, opt1, data[5];
int cmd2, opt2, handle; void *ofs; int sel;
int eoc;
} command = {
0x0020, 0x80000000 + 5, { 0 },
0x002c, 0, 0, 0, 0x0c,
0x0000
};
command.data[0] = window->image[WINSTR_SIGNALEBOX] | 4;
command.data[1] = window->image[WINSTR_SIGNALBASE] + 0;
command.data[2] = window->image[WINSTR_USERID];
command.data[3] = window->image[WINSTR_X0] = x;
command.data[4] = window->image[WINSTR_Y0] = y;
command.handle = window->handle;
command.ofs = (void *) window->image;
sgg_execcmd(&command);
return;
}
void sgg_wm0s_setstatus(const struct SGG_WINDOW *window, const int status)
{
static struct {
int cmd, opt;
int data[4];
int eoc;
} command = { 0x0020, 0x80000000 + 4, { 0 }, 0x0000 };
command.data[0] = window->image[WINSTR_SIGNALEBOX] | 3;
command.data[1] = window->image[WINSTR_SIGNALBASE] + 1;
command.data[2] = window->image[WINSTR_USERID];
command.data[3] = status;
sgg_execcmd(&command);
return;
}
void sgg_wm0s_accessenable(const struct SGG_WINDOW *window)
{
static struct {
int cmd, opt;
int data[3];
int eoc;
} command = { 0x0020, 0x80000000 + 3, { 0 }, 0x0000 };
command.data[0] = window->image[WINSTR_SIGNALEBOX] | 2;
command.data[1] = window->image[WINSTR_SIGNALBASE] + 2;
command.data[2] = window->image[WINSTR_USERID];
sgg_execcmd(&command);
return;
}
void sgg_wm0s_accessdisable(const struct SGG_WINDOW *window)
// 完了シグナルが帰ってくるので注意
{
static struct {
int cmd, opt;
int data[3];
int eoc;
} command = { 0x0020, 0x80000000 + 3, { 0 }, 0x0000 };
command.data[0] = window->image[WINSTR_SIGNALEBOX] | 2;
command.data[1] = window->image[WINSTR_SIGNALBASE] + 4;
command.data[2] = window->image[WINSTR_USERID];
sgg_execcmd(&command);
return;
}
void sgg_wm0s_redraw(const struct SGG_WINDOW *window)
// 完了シグナルが帰ってくるので注意
{
static struct {
int cmd, opt;
int data[3];
int eoc;
} command = { 0x0020, 0x80000000 + 3, { 0 }, 0x0000 };
command.data[0] = window->image[WINSTR_SIGNALEBOX] | 2;
command.data[1] = window->image[WINSTR_SIGNALBASE] + 8;
command.data[2] = window->image[WINSTR_USERID];
sgg_execcmd(&command);
return;
}
#endif
void sgg_wm0_openwindow(struct SGG_WINDOW *window, const int handle)
{
static struct {
int cmd, opt, handle;
void *ofs;
int sel;
int eoc;
} command = { 0x0028, 0, 0, 0, 0x0c, 0x0000 };
command.handle = window->handle = handle;
command.ofs = (void *) window->image;
sgg_execcmd(&command);
return;
}
#if 0
const int sgg_wm0_win2sbox(const struct SGG_WINDOW *window)
{
return window->image[WINSTR_SIGNALEBOX];
}
#endif
#if 0
void sgg_wm0_definesignal2(const int opt, const int device, const int code,
const int signalbox, const int signal0, const int signal1)
{
static struct {
int cmd, opt, device, code, signalbox;
int length, signal0, signal1;
int eoc;
} command = { 0x0030, 0, 0, 0, 0, 2, 0, 0, 0x0000 };
command.opt = opt;
command.device = device;
command.code = code;
command.signalbox = signalbox;
command.signal0 = signal0;
command.signal1 = signal1;
sgg_execcmd(&command);
return;
}
void sgg_wm0_definesignal0(const int opt, const int device, const int code)
{
static struct {
int cmd, opt, device, code, signalbox, length;
int eoc;
} command = { 0x0030, 0, 0, 0, 0, 0, 0x0000 };
command.opt = opt;
command.device = device;
command.code = code;
sgg_execcmd(&command);
return;
}
#endif
#if 0
const int sgg_wm0_winsizex(const struct SGG_WINDOW *window)
{
return window->image[WINSTR_XSIZE];
}
const int sgg_wm0_winsizey(const struct SGG_WINDOW *window)
{
return window->image[WINSTR_YSIZE];
}
void sgg_wm0s_close(const struct SGG_WINDOW *window)
// クローズの要請をタスクに伝える
{
static struct {
int cmd, opt;
int data[3];
int eoc;
} command = { 0x0020, 0x80000000 + 3, { 0 }, 0x0000 };
command.data[0] = window->image[WINSTR_SIGNALEBOX] | 2;
command.data[1] = window->image[WINSTR_SIGNALBASE] + 3;
command.data[2] = window->image[WINSTR_USERID];
sgg_execcmd(&command);
return;
}
void sgg_wm0s_windowclosed(const struct SGG_WINDOW *window)
{
static struct {
int cmd, opt;
int data[3];
int eoc;
} command = { 0x0020, 0x80000000 + 3, { 0 }, 0x0000 };
command.data[0] = window->image[WINSTR_SIGNALEBOX] | 2;
command.data[1] = window->image[WINSTR_SIGNALBASE] + 5;
command.data[2] = window->image[WINSTR_USERID];
sgg_execcmd(&command);
return;
}
void sgg_wm0_setvideomode(const int mode, const int signal)
{
static struct {
int cmd, opt;
int mode, sig[3];
int eoc;
} command = { 0x0054, 0, 0, { 0x3240 /* winman0 */ + 3, 0x7f000002, 0 }, 0x0000 };
command.mode = mode;
command.sig[2] = signal;
sgg_execcmd(&command);
return;
}
void sgg_wm0_gapicmd_0010_0000()
{
static struct {
int cmd, length;
int gapicmd[4];
int eoc;
} command = {
0x0050, 6 * 4, {
0x0010 /* initialize */,
0 /* priority/command-handle */,
0x0000 /* opt */,
0x0000 /* EOC */
}, 0 /* EOC */
};
sgg_execcmd(&command);
return;
}
void sgg_wm0_gapicmd_001c_0004()
{
static struct {
int cmd, length;
int gapicmd[4];
int eoc;
} command = {
0x0050, 6 * 4, {
0x001c /* hardware control */,
0 /* priority/command-handle */,
0x0004 /* hardware connect(device reset) */,
0x0000 /* EOC */
}, 0 /* EOC */
};
sgg_execcmd(&command);
return;
}
void sgg_wm0_gapicmd_001c_0020()
{
static struct {
int cmd, length;
int gapicmd[4];
int eoc;
} command = {
0x0050, 6 * 4, {
0x001c /* hardware control */,
0 /* priority/command-handle */,
0x0020 /* special command */,
0x0000 /* EOC */
}, 0 /* EOC */
};
sgg_execcmd(&command);
return;
}
void sgg_wm0_putmouse(const int x, const int y)
{
static struct {
int cmd, length;
int gapicmd[6];
int eoc;
} command = {
0x0050, 8 * 4, {
0x0180 /* mouse */,
0 /* priority/command-handle */,
0x0100 /* opt */,
0, 0 /* x, y */,
0x0000 /* EOC */
}, 0 /* EOC */
};
command.gapicmd[3] = x;
command.gapicmd[4] = y;
sgg_execcmd(&command);
return;
}
void sgg_wm0_removemouse()
{
static struct {
int cmd, length;
int gapicmd[4];
int eoc;
} command = {
0x0050, 6 * 4, {
0x0180 /* mouse */,
0 /* priority/command-handle */,
0x0200 /* opt */,
0x0000 /* EOC */
}, 0 /* EOC */
};
sgg_execcmd(&command);
return;
}
void sgg_wm0_movemouse(const int x, const int y)
{
static struct {
int cmd, length;
int gapicmd[6];
int eoc;
} command = {
0x0050, 8 * 4, {
0x0180 /* mouse */,
0 /* priority/command-handle */,
0x0300 /* opt */,
0, 0 /* x, y */,
0x0000 /* EOC */
}, 0 /* EOC */
};
command.gapicmd[3] = x;
command.gapicmd[4] = y;
sgg_execcmd(&command);
return;
}
void sgg_wm0_enablemouse()
{
static struct {
int cmd, length;
int keymoscmd[2];
int eoc;
} command = {
0x0060, 4 * 4, {
0x0120 /* MouseEnable */,
0x0000 /* EOC */
}, 0 /* EOC */
};
sgg_execcmd(&command);
return;
}
#endif
#if 0
void sgg_wm0s_sendto1_pokon0(const int signal)
{
static struct {
int cmd, opt;
int data[3];
int eoc;
} command = { 0x0020, 0x80000000 + 3, { 0x4240 /* pokon0 */ + 2, 0x7f000001, 0 }, 0x0000 };
command.data[2] = signal;
sgg_execcmd(&command);
return;
}
void sgg_wm0s_sendto2_pokon0(const int signal, const int param)
{
static struct {
int cmd, opt;
int data[4];
int eoc;
} command = { 0x0020, 0x80000000 + 4, { 0x4240 /* pokon0 */ + 3, 0x7f000002, 0, 0 }, 0x0000 };
command.data[1] = signal;
command.data[2] = param;
sgg_execcmd(&command);
return;
}
#endif

View File

@@ -0,0 +1,30 @@
// ライブラリ初期化
#include <sysgg00.h>
struct SGG_WORK *sgg_init(struct SGG_WORK *work)
{
return 0;
}
/*
#include <guigui00.h>
#include <stdlib.h>
struct LIB_WORK *lib_init(struct LIB_WORK *work)
{
static struct {
int cmd;
struct LIB_WORK *work;
int eoc;
} command = { 0x0004, 0, 0x0000 };
if (work)
command.work = work;
else
command.work = (struct LIB_WORK *) malloc(sizeof (struct LIB_WORK));
lib_execcmd(&command);
return command.work;
}
*/

View File

@@ -0,0 +1,193 @@
#ifndef __SYSGG00_H
#define __SYSGG00_H
struct SGG_WORK {
int data[256 / 4];
};
struct SGG_FILELIST {
int id;
unsigned char name[11], type;
int size;
};
struct SGG_WINDOW {
int image[32 / 4];
int handle;
};
#if 1
#define WINSTR_STATUS 0 / 4
#define WINSTR_USERID 4 / 4
#define WINSTR_SIGNALBASE 8 / 4
#define WINSTR_SIGNALEBOX 12 / 4
#define WINSTR_XSIZE 16 / 4
#define WINSTR_YSIZE 20 / 4
#define WINSTR_X0 24 / 4
#define WINSTR_Y0 28 / 4
#endif
void sgg_execcmd0(const int cmd, ...);
const int sgg_execcmd1(const int ret, const int cmd, ...);
void sgg_execcmd(void *EBX);
#define sgg_init(work) (work)
#if 0
#define sgg_init(work) \
(struct SGG_WORK *) sgg_execcmd1(1 * 4 + 12, 0x0010, \
(work) ? (void *) (work) : malloc(sizeof (struct SGG_WORK)), 0x0000)
#endif
#if 1
#define sgg_wm0s_movewindow(window, x, y) \
sgg_execcmd0(0x0020, 0x80000000 + 5, \
((struct SGG_WINDOW *) (window))->image[WINSTR_SIGNALEBOX] | 4, \
((struct SGG_WINDOW *) (window))->image[WINSTR_SIGNALBASE] + 0, \
((struct SGG_WINDOW *) (window))->image[WINSTR_USERID], \
((struct SGG_WINDOW *) (window))->image[WINSTR_X0] = (int) (x), \
((struct SGG_WINDOW *) (window))->image[WINSTR_Y0] = (int) (y), \
0x002c, 0, ((struct SGG_WINDOW *) (window))->handle, \
((struct SGG_WINDOW *) (window))->image, 0x0c, 0x0000)
#define sgg_wm0s_setstatus(window, status) \
sgg_execcmd0(0x0020, 0x80000000 + 4, \
((struct SGG_WINDOW *) (window))->image[WINSTR_SIGNALEBOX] | 3, \
((struct SGG_WINDOW *) (window))->image[WINSTR_SIGNALBASE] + 1, \
((struct SGG_WINDOW *) (window))->image[WINSTR_USERID], \
(int) (status), 0x0000)
#define sgg_wm0s_accessenable(window) \
sgg_execcmd0(0x0020, 0x80000000 + 3, \
((struct SGG_WINDOW *) (window))->image[WINSTR_SIGNALEBOX] | 2, \
((struct SGG_WINDOW *) (window))->image[WINSTR_SIGNALBASE] + 2, \
((struct SGG_WINDOW *) (window))->image[WINSTR_USERID], 0x0000)
#define sgg_wm0s_accessdisable(window) \
sgg_execcmd0(0x0020, 0x80000000 + 3, \
((struct SGG_WINDOW *) (window))->image[WINSTR_SIGNALEBOX] | 2, \
((struct SGG_WINDOW *) (window))->image[WINSTR_SIGNALBASE] + 4, \
((struct SGG_WINDOW *) (window))->image[WINSTR_USERID], 0x0000)
#define sgg_wm0s_redraw(window) \
sgg_execcmd0(0x0020, 0x80000000 + 3, \
((struct SGG_WINDOW *) (window))->image[WINSTR_SIGNALEBOX] | 2, \
((struct SGG_WINDOW *) (window))->image[WINSTR_SIGNALBASE] + 8, \
((struct SGG_WINDOW *) (window))->image[WINSTR_USERID], 0x0000)
#define sgg_wm0s_redrawdif(window) \
sgg_execcmd0(0x0020, 0x80000000 + 3, \
((struct SGG_WINDOW *) (window))->image[WINSTR_SIGNALEBOX] | 2, \
((struct SGG_WINDOW *) (window))->image[WINSTR_SIGNALBASE] + 9, \
((struct SGG_WINDOW *) (window))->image[WINSTR_USERID], 0x0000)
#define sgg_wm0_win2sbox(window) \
(((struct SGG_WINDOW *) (window))->image[WINSTR_SIGNALEBOX])
#define sgg_wm0_winsizex(window) \
(((struct SGG_WINDOW *) (window))->image[WINSTR_XSIZE])
#define sgg_wm0_winsizey(window) \
(((struct SGG_WINDOW *) (window))->image[WINSTR_YSIZE])
#define sgg_wm0s_close(window) \
sgg_execcmd0(0x0020, 0x80000000 + 3, \
((struct SGG_WINDOW *) (window))->image[WINSTR_SIGNALEBOX] | 2, \
((struct SGG_WINDOW *) (window))->image[WINSTR_SIGNALBASE] + 3, \
((struct SGG_WINDOW *) (window))->image[WINSTR_USERID], 0x0000)
#define sgg_wm0s_windowclosed(window) \
sgg_execcmd0(0x0020, 0x80000000 + 3, \
((struct SGG_WINDOW *) (window))->image[WINSTR_SIGNALEBOX] | 2, \
((struct SGG_WINDOW *) (window))->image[WINSTR_SIGNALBASE] + 5, \
((struct SGG_WINDOW *) (window))->image[WINSTR_USERID], 0x0000)
#define sgg_wm0_setvideomode(mode, signal) \
sgg_execcmd0(0x0054, 0, (int) (mode), 0x3240 + 3, 0x7f000002, \
(int) (signal), 0x0000)
#define sgg_wm0_gapicmd_0010_0000() \
sgg_execcmd0(0x0050, 6 * 4, 0x0010, 0, 0x0000, 0x0000, 0x0000)
#define sgg_wm0_gapicmd_001c_0004() \
sgg_execcmd0(0x0050, 6 * 4, 0x001c, 0, 0x0004, 0x0000, 0x0000)
#define sgg_wm0_gapicmd_001c_0020() \
sgg_execcmd0(0x0050, 6 * 4, 0x001c, 0, 0x0020, 0x0000, 0x0000)
#define sgg_wm0_putmouse(x, y) \
sgg_execcmd0(0x0050, 8 * 4, 0x0180, 0, 0x0100, (int) (x), (int) (y), \
0x0000, 0x0000)
#define sgg_wm0_removemouse() \
sgg_execcmd0(0x0050, 6 * 4, 0x0180, 0, 0x0200, 0x0000, 0x0000)
#define sgg_wm0_movemouse(x, y) \
sgg_execcmd0(0x0050, 8 * 4, 0x0180, 0, 0x0300, (int) (x), (int) (y), \
0x0000, 0x0000)
#define sgg_wm0_enablemouse() \
sgg_execcmd0(0x0060, 4 * 4, 0x0120, 0x0000, 0x0000)
/* for pokon0 */
#define sgg_createtask2(size, addr, fin_sig) \
sgg_execcmd0(0x0020, 0x80000000 + 8, 0x1247, 0x0130, (int) (size), \
(int) (addr), 0x4243 /* to pokon0 */, 0x7f000002, (int) (fin_sig), \
0, 0x0000)
#define sgg_format2(sub_cmd, bsc_size, bsc_addr, exe_size, exe_addr, sig) \
sgg_execcmd0(0x0020, 0x80000000 + 10, 0x1249, (int) (sub_cmd), 0, \
(int) (bsc_size), (int) (bsc_addr), (int) (exe_size), \
(int) (exe_addr), 0x4242 /* to pokon0 */, 0x7f000001, (int) (sig), \
0x0000)
#define sgg_directwrite(opt, bytes, reserve, src_ofs, src_sel, dest_ofs, dest_sel) \
sgg_execcmd0(0x0078, (int) (opt), (int) (bytes), (int) (reserve), \
(int) (src_ofs), (int) (src_sel), (int) (dest_ofs), (int) (dest_sel), \
0x0000)
#define sgg_createvirtualmodule(size, addr) \
(int) sgg_execcmd1(3 * 4 + 12, 0x0070, 0, (int) (size), 0, (int) (addr), \
0, 0x0000)
#endif
// struct SGG_WORK *sgg_init(struct SGG_WORK *work);
const int sgg_getfilelist(const int size, struct SGG_FILELIST *fp, const int reserve0, const int reserve1);
// void sgg_wm0s_movewindow(struct SGG_WINDOW *window, const int x, const int y);
// void sgg_wm0s_setstatus(const struct SGG_WINDOW *window, const int status);
// void sgg_wm0s_accessenable(const struct SGG_WINDOW *window);
// void sgg_wm0s_accessdisable(const struct SGG_WINDOW *window);
// void sgg_wm0s_redraw(const struct SGG_WINDOW *window);
void sgg_wm0_openwindow(struct SGG_WINDOW *window, const int handle);
// const int sgg_wm0_win2sbox(const struct SGG_WINDOW *window);
//void sgg_wm0_definesignal2(const int opt, const int device, const int code,
// const int signalbox, const int signal0, const int signal1);
//void sgg_wm0_definesignal0(const int opt, const int device, const int code);
// const int sgg_wm0_winsizex(const struct SGG_WINDOW *window);
// const int sgg_wm0_winsizey(const struct SGG_WINDOW *window);
// void sgg_wm0s_close(const struct SGG_WINDOW *window);
// void sgg_wm0s_windowclosed(const struct SGG_WINDOW *window);
// void sgg_wm0_setvideomode(const int mode, const int signal);
// void sgg_wm0_gapicmd_0010_0000();
// void sgg_wm0_gapicmd_001c_0004();
// void sgg_wm0_gapicmd_001c_0020();
// void sgg_wm0_putmouse(const int x, const int y);
// void sgg_wm0_removemouse();
// void sgg_wm0_movemouse(const int x, const int y);
// void sgg_wm0_enablemouse();
void sgg_loadfile(const int mdl_ent, const int file_id, const int fin_sig);
void sgg_createtask(const int mdl_ent, const int fin_sig);
void sgg_settasklocallevel(const int task, const int local, const int global, const int inner);
void sgg_runtask(const int task, const int local);
void sgg_freememory(const int mdl_ent);
void sgg_format(const int sub_cmd, const int sig);
void sgg_debug00(const int opt, const int bytes, const int reserve,
const int src_ofs, const int src_sel, const int dest_ofs, const int dest_sel);
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,80 @@
# Makefile for OSASK/TOWNS
# ver. 0.0
TOOLPATH = ../../z_tools/
INCPATH = ../../z_tools/guigui00/
VPATH = ..
include ../make_inc.txt
include ../make_com.txt
include ../make_wm0.txt
include ../make_pk0.txt
DEFINES = $(DEFINES_TW) -DTOWNS -D$(DESIGN)
MKFL = Makefile ../Makefile ../make_inc.txt ../make_com.txt
ALL :
$(MAKE) OSASK.EXE
OSASK.EXE : $(MKFL) osalink1.opt base.exe boot32.bin ankfont0.tek tapi0.tek \
timerdrv.tek keymos0.tek fdcdrv0.tek pioneer0.tek vgadrv0.tek \
decode0.tek papi0.tek init.tek winman0.tek pokon0.tek vesa16.tek \
towns15.tek
$(OSALINK)
base.exe : ../base.nap $(MKFL)
$(CPP0) -P $(DEFINES) -o base.nas ../base.nap
$(NASK) base.nas base.exe base.lst
$(DELE) base.nas
ankfont0.bin : ../ankfont0/$(FONTSRC) $(MKFL)
$(TXT2BIN) $< $@
%.ias : %.ask $(MKFL)
$(CPP0) -P -I.. $(DEFINES) -o $@ $<
%.gas : %.c $(MKFL)
$(CC1) $(DEFINES) -I../sgg00lib -o $@ $<
winman0.bin : $(MKFL) ../make_wm0.txt winman0.obj
$(MAKE) -C ../sgg00lib
$(OBJ2BIM) @../linkrule.rul stack:$(STK_WM_TW) map:winman0.map \
out:winman0.bim winman0.obj ../sgg00lib/sgg00lib.lib
$(BIM2BIN) malloc:$(MLC_WM_TW) mmarea:$(MMA_WM_TW) input:winman0.bim \
output:winman0.bin $(BIM_WM_TW)
$(DELE) winman0.bim
pokon0.bin : $(MKFL) ../make_pk0.txt pokon0.obj
$(MAKE) -C ../sgg00lib
$(OBJ2BIM) @../linkrule.rul stack:$(STK_PK_TW) map:pokon0.map \
out:pokon0.bim pokon0.obj ../sgg00lib/sgg00lib.lib
$(BIM2BIN) malloc:$(MLC_PK_TW) mmarea:$(MMA_PK_TW) input:pokon0.bim \
output:pokon0.bin $(BIM_PK_TW)
$(DELE) pokon0.bim
%.bin : $(MKFL) %.ias
$(ASKA) $*.ias $*.3as
$(NASKCNV) $*.3as $*.nas
$(NASK) $*.nas $*.bin $*.lst
$(DELE) $*.3as
$(DELE) $*.nas
%.obj : $(MKFL) %.gas
$(GAS2NASK) $*.gas $*.nas
$(NASK) $*.nas $*.obj $*.lst
$(DELE) $*.nas
%.tek : %.bin $(MKFL)
$(BIM2BIN) in:$< out:$@ -osacmp -tek0 rjc:0
clean :
-$(DELE) OSASK.EXE
-$(DELE) *.lst
-$(DELE) *.ias
-$(DELE) *.gas
-$(DELE) *.map
-$(DELE) base.exe
-$(DELE) *.obj
-$(DELE) *.bin
-$(DELE) *.tek

View File

@@ -0,0 +1,445 @@
/* "decode0":キーコード・デコーダー for TOWNS ver.1.0 */
segment CODE(USE32, PARA);
default(code == CODE);
#include "osaskinc.ask"
void near Keydecode_Init();
//void near Keydecode_led();
struct WORK {
int last;
short shiftmap, [2];
int declist[1028 /* 257 * 4 */];
/* +1036 */
int subcmdbuf[0x5bf4];
};
void far Keydecode_syscmd()
{
int *cmd == FS:EBX;
WORK *work == DS:0;
PUSHAD();
MOV(EAX, CS);
PUSH(DS);
EAX += 8;
DS = EAX;
nextcmd:
EAX = *cmd;
if (EAX == 0)
goto cmd0000;
if (EAX == 0x010c)
goto cmd010c; /* decodeルール定義 */
if (EAX == 0x0104)
goto cmd0104; // Keydecode_setlock
if (EAX == 0x0110)
goto cmd0110; /* decodeルール初期化 */
if (EAX == 0x0108)
goto cmd0108; // Keydecode_Mainへのベクタ通知
if (EAX == 0x0100)
goto cmd0100; // 初期化
INT(0x03);
cmd0000:
POP(DS);
[SS:ESP + 16] = EBX;
POPAD();
return;
cmd0100:
// 初期化
PUSH((offset) cmd);
Keydecode_Init();
POP((offset) cmd);
(offset) cmd += 4;
goto nextcmd;
cmd0104:
/* Keydecode_setlock */
EAX = cmd[4];
PUSH((offset) cmd);
ROR(EAX, 16);
work->shiftmap &= AX;
ROR(EAX, 16);
work->shiftmap |= AX;
// Keydecode_led();
POP((offset) cmd);
(offset) cmd += 8;
goto nextcmd;
cmd0108:
// Keydecode_Mainへのベクタ通知
asmout("MOV DWORD PTR FS:[EBX+4],OFFSET Keydecode_Main");
(short) cmd[8] = CS;
(offset) cmd += 12;
goto nextcmd;
cmd010c:
/* decodeルール定義(CLIしたほうがいいかも) */
/* cmd, opt(len), rawコード, shift-lock-bitmap(mask, equal), subcmd,... */
/* subcmdの一覧 */
/* 01 : sendsignal(mode-1), call vector, cmd(01), len(max:1KB), signal,...
02 : sendsignal(mode-2),
03 : sendsignal(mode-3),
04 : or shift-lock-bitmap, 0(dw), bitmap, cmd(04), 0(byte)
05 : and shift-lock-bitmap,
06 : xor shift-lock-bitmap,
// 07 : control LED, hardware-param, bitmap(andしてンゼロならon), cmd(07), hardware-param
*/
/* shift-lock-bitmapの割付例 */
/* bit0 : scroll...自動反映
bit1 : numlock...自動反映
bit2 : caps...自動反映
bit3 : reserve...自動反映
bit4 : shift
bit5 : ctrl
bit6 : alt
bit7 : reserve
bit14, 15は、make/break/remake/overbreak
*/
/*
数字の"1":
no-shift & no-ctrl & no-altでキーを押した時
numlock & no-shift & no-ctrl & no-altでテンキーを押した時
英語文字"A":
capslock & no-shift & no-ctrl & no-altでキーを押した時
no-capslock & shift & no-ctrl & no-altでキーを押した時
英語文字"a":
no-capslock & no-shift & no-ctrl & no-altでキーを押した時
capslock & shift & no-ctrl & no-altでキーを押した時
というわけで、Aとaを登録すると都合4パターンを登録する必要がある
キーの複雑な対応は、winman0で処理させる。
*/
/* ワークエリアから適当に切り取って転送して、ポインタを繋いでおわり。 */
ESI = work->last;
ECX = cmd[ 4]; /* len */
EDX = cmd[ 8]; /* rawコード */
EAX = cmd[12]; /* shiftmap */
(offset) cmd += 16;
[DS:ESI] = EAX;
EDI = ESI;
ESI += 8;
ECX -= 2;
do {
EAX = *cmd;
(offset) cmd += 4;
[DS:ESI] = EAX;
ESI += 4;
ECX--;
} while (!= 0);
[DS:EDI + 4] = ECX /* 0 */;
work->last = ESI;
ESI = work->declist[EDX * 4];
if (ESI == 0) {
work->declist[EDX * 4] = EDI;
goto nextcmd;
}
do {
EAX = ESI;
ESI = [DS:ESI + 4];
} while (ESI != 0);
[DS:EAX + 4] = EDI;
goto nextcmd;
cmd0110:
/* decodeルール初期化 */
work->last = 1036;
(offset) cmd += 8;
LEA(ESI, work->declist[0]);
EAX = 0;
ECX = 257;
do {
[DS:ESI] = EAX;
ESI += 4;
ECX--;
} while (!= 0);
goto nextcmd;
}
void far Keydecode_Main()
/* CLIしたほうがいいかも */
{
unsigned int keyint_sel == 8 * 8, keydata_sel == 9 * 8;
WORK *work == DS:0;
int *msg == DS:ESI;
MOV(ECX, CS);
PUSH(DS);
ECX += 8;
EAX = msg[8];
DS = ECX;
PUSH(ESI);
if ((unsigned) EAX >= 0x04000000)
goto ignore;
ECX = EAX;
// EDX = EAX;
(unsigned int) ECX >>= 10;
EAX &= 0x00ffffff;
ECX &= 0xc000;
/* mode-1バッファを検索する */
/* コードが存在したら、shiftmapではなく、バッファ内のシフトコードをローディング */
// if (EAX == work->mode1buf[ 0])
// CX |= work->mode1buf[ 4];
// else if (EAX == work->mode1buf[ 8])
// CX |= work->mode1buf[12];
// else if (EAX == work->mode1buf[16])
// CX |= work->mode1buf[20];
// else if (EAX == work->mode1buf[24])
// CX |= work->mode1buf[28];
// else
CX |= work->shiftmap;
/* breakだったら、mode1buf, mode2bufから抹消する */
EDI = work->declist[EAX * 4];
if (EDI != 0) {
do {
/* このループ内でCXは保存すること */
EAX = ECX;
AX &= [DS:EDI + 0];
CMP(AX, [DS:EDI + 2]);
if (==) {
AL = [DS:EDI + 8 + 6];
LEA(ESI, [EDI + 8 + 8]);
if (AL == 0x01) {
/* send signal mode-1 */
INT(0x03);
}
if (AL == 0x02) {
/* send signal mode-2 */
INT(0x03);
}
if (AL == 0x03) {
/* send signal mode-3 */
PUSH(EDI);
PUSH(ECX);
asmout("CALL FAR [DS:EDI + 8]");
POP(ECX);
POP(EDI);
goto next;
}
// DL = (char) work->shiftmap;
if (AL == 0x04) {
/* or shift-lock-bitmap */
EAX = [DS:EDI + 8];
work->shiftmap |= AX;
checkled:
// DL ^= (char) work->shiftmap;
// DL &= 0x0f;
// if (!= 0)
// Keydecode_led();
/* mode-2バッファを検索する */
/* コードが存在し、かつ、shift状態の変化によりmake状態にふさわしくなくなったら、
ブレイクしてから、あらたにmakeする */
goto next;
}
if (AL == 0x05) {
/* and shift-lock-bitmap */
EAX = [DS:EDI + 8];
work->shiftmap &= AX;
// goto checkled;
goto next;
}
if (AL == 0x06) {
/* xor shift-lock-bitmap */
EAX = [DS:EDI + 8];
work->shiftmap ^= AX;
// goto checkled;
goto next;
}
if (AL == 0x38) {
/* DMA停止 */
CLI();
AL = 0x0f;
OUT(0x00af, AL);
/* reset */
EAX = 0; /* AL = 0; */
OUT(0x0020, AL);
EAX++; /* AL = 1; */
OUT(0x0020, AL);
for (;;)
HLT();
}
}
next:
EDI = [DS:EDI + 4];
} while (EDI != 0);
}
ignore:
POP(ESI);
POP(DS);
return;
}
void near Keydecode_Init()
{
unsigned int Init_sel == 2 * 8, TAPI_sel == 12 * 8;
ECX = 4096 * 6 / 4;
EAX = 0;
ESI = 0;
do {
(int) [DS:ESI] = EAX;
ESI += 4;
ECX--;
} while (!= 0);
return;
}
#if 0
void far filter0()
// F1F6しか通さないフィルター
{
unsigned int keyint_sel == 8 * 8, keydata_sel == 9 * 8;
asmout("#work_keycode EQU 0");
asmout("#work_keytype EQU #work_keycode+256");
asmout("#work_msg EQU #work_keytype+256");
asmout("#work_tenkey EQU #work_msg+64");
asmout("#work_twocase EQU #work_tenkey");
asmout("#work_signal EQU #work_twocase+60H");
asmout("#work_jmptable EQU #work_signal+8");
asmout("#work_shiftflag EQU #work_jmptable+20");
asmout("#work_pause EQU #work_shiftflag+1");
asmout("#work_dummy0 EQU #work_pause+1");
asmout("#work_sigcall EQU #work_dummy0+2");
asmout("#work_size EQU #work_sigcall+8");
EAX = [DS:ESI + 8];
EAX &= 0x0fff;
if (EAX == 0x6a5 /* Ctrl + Alt + Delete */) {
// PUSH(FS);
PUSH((int) 0);
PUSH(EAX);
PUSH(0x010c /* KeyResetCPU */);
AX = SS;
EBX = ESP;
FS = AX;
DB(0x9a); DD(0); DW((short) keyint_sel);
ESP += 12;
// POP(FS);
// asmout("fcall 8*8, KeyResetCPU");
for (;;)
HLT();
/* // double-faultでリセットをかける
CLI();
// GDTとIDTのリミットを0にする。
EAX = 0;
PUSH(EAX);
PUSH(EAX);
asmout("LGDTE FWORD PTR SS:[ESP+2]");
asmout("LIDTE FWORD PTR SS:[ESP+2]");
ESP = 256;
INT(0x03);
*/
/* PUSH([DS:ESI + 4]);
PUSH([DS:ESI + 0]);
(int) [DS:ESI + 0] = 0x00001241;
(int) [DS:ESI + 4] = 0xffffff00;
asmout("fcall 12*8,TAPI_SingnalMessageTimer");
POP([DS:ESI + 0]);
POP([DS:ESI + 4]);
return;
*/ } else if (EAX == 0x6a4 /* Ctrl + Alt + Insert */) {
PUSH([DS:ESI + 4]);
PUSH([DS:ESI + 0]);
(int) [DS:ESI + 0] = 0x00001241;
(int) [DS:ESI + 4] = 0xffffff01;
asmout("CALL FWORD PTR DS:[#work_sigcall]");
// asmout("fcall 12*8,TAPI_SingnalMessageTimer");
POP([DS:ESI + 0]);
POP([DS:ESI + 4]);
return;
}
PUSH(DS);
PUSH(ESI);
EAX *= 16;
ESI = 0x1000;
EAX &= 0x0ff0;
CX = CS; CX += 8; DS = CX;
ESI += EAX;
TEST((char) [DS:ESI], 0x0f);
if (!= 0) {
asmout("CALL FWORD PTR DS:[#work_sigcall]");
// asmout("fcall 12*8,TAPI_SingnalMessageTimer");
}
POP(ESI);
POP(DS);
return;
asmout("DecodeSiz:");
}
/*
void far filter1()
{
EAX = [DS:ESI + 8];
EAX &= 0x0fff;
if (EAX == 0x6a5 /* Ctrl + Alt + Delete */) {
asmout("fcall 8*8, KeyResetCPU");
for (;;)
HLT();
/* // double-faultでリセットをかける
CLI();
// GDTとIDTのリミットを0にする。
EAX = 0;
PUSH(EAX);
PUSH(EAX);
asmout("LGDTE FWORD PTR SS:[ESP+2]");
asmout("LIDTE FWORD PTR SS:[ESP+2]");
ESP = 256;
INT(0x03);
*/
} else if (EAX == 0x6a4 /* Ctrl + Alt + Insert */) {
CL = 0x01;
} else if (EAX == 0x0ac /* left */) {
CL = 0x10;
} else if (EAX == 0x0ad /* right */) {
CL = 0x11;
} else if (EAX == 0x0a0 /* Enter */) {
CL = 0x12;
} else if (EAX == 0x1a0 /* Shift + Enter */) {
CL = 0x13;
} else if (EAX == 0x1ac /* Shift + left */) {
CL = 0x14;
} else if (EAX == 0x1ad /* Shift + right */) {
CL = 0x15;
} else if (EAX == 0x646 /* Ctrl + Alt + 'F' */) {
CL = 0x16;
} else if (EAX == 0x666 /* Ctrl + Alt + 'f' */) {
CL = 0x16;
} else if (EAX == 0x746 /* Shift + Ctrl + Alt + 'F' */) {
CL = 0x17;
} else if (EAX == 0x766 /* Shift + Ctrl + Alt + 'f' */) {
CL = 0x17;
} else
return;
ECX |= 0xffffff00;
PUSH([DS:ESI + 4]);
PUSH([DS:ESI + 0]);
(int) [DS:ESI + 0] = 0x00001241;
(int) [DS:ESI + 4] = ECX;
asmout("fcall 12*8,TAPI_SingnalMessageTimer");
POP([DS:ESI + 0]);
POP([DS:ESI + 4]);
return;
asmout("DecodeSiz:");
}
*/
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,16 @@
base.exe
boot32.bin
ankfont0.tek
tapi0.tek
timerdrv.tek
keymos0.tek
fdcdrv0.tek
pioneer0.tek
vgadrv0.tek
decode0.tek
papi0.tek
init.tek
winman0.tek
pokon0.tek
vesa16.tek
towns15.tek

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
/* "TOWNS15.ASK" for TOWNS ver.0.0 copyright(C) 2004 I.Tak */
/* 今のところ, towns/vesa16.ask と共用です
* HWcursor などの野望もあるし (←大言壮語)
* makefileを書くのもめんどいのでこんなんで */
#define TOWNS15
#include "vesa16.ask"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,7 @@
include ../pcat/Makefile
DEFINES_AT += -DVMWARE3
VPATH += ../pcat
force:
-$(DELE) ../pcat/OSASK.EXE

View File

@@ -0,0 +1,4 @@
include ../pcat/Makefile
DEFINES_AT += -DVMWARE3
VPATH += ../pcat

View File

@@ -0,0 +1,17 @@
base.exe
boot32.bin
ankfont0.tek
tapi0.tek
timerdrv.tek
keymos0.tek
fdcdrv0.tek
pioneer0.tek
vgadrv0.tek
decode0.tek
papi0.tek
init.tek
winman0.tek
pokon0.tek
vesa8.tek
vesa16.tek
vesa32.tek

Some files were not shown because too many files have changed in this diff Show More