mirror of
https://github.com/yourtion/30dayMakeOS.git
synced 2026-02-04 18:43:25 +08:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ac8b6b1411 | ||
|
|
86791cd7f4 | ||
|
|
9231ce4a38 | ||
|
|
7b5d69c7c8 | ||
|
|
1bcf500c14 |
@@ -21,22 +21,22 @@ GOLIB = $(TOOLPATH)golib00.exe
|
||||
COPY = copy
|
||||
DEL = del
|
||||
|
||||
# デフォルト動作
|
||||
#默认动作
|
||||
|
||||
default :
|
||||
$(MAKE) apilib.lib
|
||||
|
||||
# ファイル生成規則
|
||||
#库生成规则
|
||||
|
||||
apilib.lib : Makefile $(OBJS_API)
|
||||
$(GOLIB) $(OBJS_API) out:apilib.lib
|
||||
|
||||
# 一般規則
|
||||
#文件生成规则
|
||||
|
||||
%.obj : %.nas Makefile
|
||||
$(NASK) $*.nas $*.obj $*.lst
|
||||
|
||||
# コマンド
|
||||
#命令
|
||||
|
||||
clean :
|
||||
-$(DEL) *.lst
|
||||
|
||||
@@ -20,7 +20,8 @@ haribote.img : haribote/ipl10.bin haribote/haribote.sys Makefile \
|
||||
star1/star1.hrb stars/stars.hrb stars2/stars2.hrb \
|
||||
lines/lines.hrb walk/walk.hrb noodle/noodle.hrb \
|
||||
beepdown/beepdown.hrb color/color.hrb color2/color2.hrb \
|
||||
sosu/sosu.hrb sosu3/sosu3.hrb
|
||||
sosu/sosu.hrb sosu2/sosu2.hrb sosu3/sosu3.hrb \
|
||||
typeipl/typeipl.hrb type/type.hrb iroha/iroha.hrb
|
||||
$(EDIMG) imgin:../z_tools/fdimg0at.tek \
|
||||
wbinimg src:haribote/ipl10.bin len:512 from:0 to:0 \
|
||||
copy from:haribote/haribote.sys to:@: \
|
||||
@@ -43,7 +44,12 @@ haribote.img : haribote/ipl10.bin haribote/haribote.sys Makefile \
|
||||
copy from:color/color.hrb to:@: \
|
||||
copy from:color2/color2.hrb to:@: \
|
||||
copy from:sosu/sosu.hrb to:@: \
|
||||
copy from:sosu2/sosu2.hrb to:@: \
|
||||
copy from:sosu3/sosu3.hrb to:@: \
|
||||
copy from:typeipl/typeipl.hrb to:@: \
|
||||
copy from:type/type.hrb to:@: \
|
||||
copy from:iroha/iroha.hrb to:@: \
|
||||
copy from:nihongo/nihongo.fnt to:@: \
|
||||
imgout:haribote.img
|
||||
|
||||
#命令
|
||||
@@ -77,7 +83,11 @@ full :
|
||||
$(MAKE) -C color
|
||||
$(MAKE) -C color2
|
||||
$(MAKE) -C sosu
|
||||
$(MAKE) -C sosu2
|
||||
$(MAKE) -C sosu3
|
||||
$(MAKE) -C typeipl
|
||||
$(MAKE) -C type
|
||||
$(MAKE) -C iroha
|
||||
$(MAKE) haribote.img
|
||||
|
||||
run_full :
|
||||
@@ -120,7 +130,11 @@ clean_full :
|
||||
$(MAKE) -C color clean
|
||||
$(MAKE) -C color2 clean
|
||||
$(MAKE) -C sosu clean
|
||||
$(MAKE) -C sosu2 clean
|
||||
$(MAKE) -C sosu3 clean
|
||||
$(MAKE) -C typeipl clean
|
||||
$(MAKE) -C type clean
|
||||
$(MAKE) -C iroha clean
|
||||
|
||||
src_only_full :
|
||||
$(MAKE) -C haribote src_only
|
||||
@@ -142,7 +156,11 @@ src_only_full :
|
||||
$(MAKE) -C color src_only
|
||||
$(MAKE) -C color2 src_only
|
||||
$(MAKE) -C sosu src_only
|
||||
$(MAKE) -C sosu2 src_only
|
||||
$(MAKE) -C sosu3 src_only
|
||||
$(MAKE) -C typeipl src_only
|
||||
$(MAKE) -C type src_only
|
||||
$(MAKE) -C iroha src_only
|
||||
-$(DEL) haribote.img
|
||||
|
||||
refresh :
|
||||
|
||||
@@ -18,3 +18,9 @@ void api_inittimer(int timer, int data);
|
||||
void api_settimer(int timer, int time);
|
||||
void api_freetimer(int timer);
|
||||
void api_beep(int tone);
|
||||
int api_fopen(char *fname);
|
||||
void api_fclose(int fhandle);
|
||||
void api_fseek(int fhandle, int offset, int mode);
|
||||
int api_fsize(int fhandle, int mode);
|
||||
int api_fread(char *buf, int maxsize, int fhandle);
|
||||
int api_cmdline(char *buf, int maxsize);
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
OBJS_API = api001.obj api002.obj api003.obj api004.obj api005.obj api006.obj \
|
||||
api007.obj api008.obj api009.obj api010.obj api011.obj api012.obj \
|
||||
api013.obj api014.obj api015.obj api016.obj api017.obj api018.obj \
|
||||
api019.obj api020.obj
|
||||
api019.obj api020.obj api021.obj api022.obj api023.obj api024.obj \
|
||||
api025.obj api026.obj alloca.obj
|
||||
|
||||
TOOLPATH = ../../z_tools/
|
||||
INCPATH = ../../z_tools/haribote/
|
||||
@@ -21,22 +22,22 @@ GOLIB = $(TOOLPATH)golib00.exe
|
||||
COPY = copy
|
||||
DEL = del
|
||||
|
||||
# デフォルト動作
|
||||
#默认动作
|
||||
|
||||
default :
|
||||
$(MAKE) apilib.lib
|
||||
|
||||
# ファイル生成規則
|
||||
#库生成规则
|
||||
|
||||
apilib.lib : Makefile $(OBJS_API)
|
||||
$(GOLIB) $(OBJS_API) out:apilib.lib
|
||||
|
||||
# 一般規則
|
||||
#文件生成规则
|
||||
|
||||
%.obj : %.nas Makefile
|
||||
$(NASK) $*.nas $*.obj $*.lst
|
||||
|
||||
# コマンド
|
||||
#命令
|
||||
|
||||
clean :
|
||||
-$(DEL) *.lst
|
||||
|
||||
13
28_day/apilib/alloca.nas
Normal file
13
28_day/apilib/alloca.nas
Normal file
@@ -0,0 +1,13 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "alloca.nas"]
|
||||
|
||||
GLOBAL __alloca
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
__alloca:
|
||||
ADD EAX,-4
|
||||
SUB ESP,EAX
|
||||
JMP DWORD [ESP+EAX] ; 代替RET
|
||||
16
28_day/apilib/api021.nas
Normal file
16
28_day/apilib/api021.nas
Normal file
@@ -0,0 +1,16 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api021.nas"]
|
||||
|
||||
GLOBAL _api_fopen
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_fopen: ; int api_fopen(char *fname);
|
||||
PUSH EBX
|
||||
MOV EDX,21
|
||||
MOV EBX,[ESP+8] ; fname
|
||||
INT 0x40
|
||||
POP EBX
|
||||
RET
|
||||
14
28_day/apilib/api022.nas
Normal file
14
28_day/apilib/api022.nas
Normal file
@@ -0,0 +1,14 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api022.nas"]
|
||||
|
||||
GLOBAL _api_fclose
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_fclose: ; void api_fclose(int fhandle);
|
||||
MOV EDX,22
|
||||
MOV EAX,[ESP+4] ; fhandle
|
||||
INT 0x40
|
||||
RET
|
||||
18
28_day/apilib/api023.nas
Normal file
18
28_day/apilib/api023.nas
Normal file
@@ -0,0 +1,18 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api023.nas"]
|
||||
|
||||
GLOBAL _api_fseek
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_fseek: ; void api_fseek(int fhandle, int offset, int mode);
|
||||
PUSH EBX
|
||||
MOV EDX,23
|
||||
MOV EAX,[ESP+8] ; fhandle
|
||||
MOV ECX,[ESP+16] ; mode
|
||||
MOV EBX,[ESP+12] ; offset
|
||||
INT 0x40
|
||||
POP EBX
|
||||
RET
|
||||
15
28_day/apilib/api024.nas
Normal file
15
28_day/apilib/api024.nas
Normal file
@@ -0,0 +1,15 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api024.nas"]
|
||||
|
||||
GLOBAL _api_fsize
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_fsize: ; int api_fsize(int fhandle, int mode);
|
||||
MOV EDX,24
|
||||
MOV EAX,[ESP+4] ; fhandle
|
||||
MOV ECX,[ESP+8] ; mode
|
||||
INT 0x40
|
||||
RET
|
||||
18
28_day/apilib/api025.nas
Normal file
18
28_day/apilib/api025.nas
Normal file
@@ -0,0 +1,18 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api025.nas"]
|
||||
|
||||
GLOBAL _api_fread
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_fread: ; int api_fread(char *buf, int maxsize, int fhandle);
|
||||
PUSH EBX
|
||||
MOV EDX,25
|
||||
MOV EAX,[ESP+16] ; fhandle
|
||||
MOV ECX,[ESP+12] ; maxsize
|
||||
MOV EBX,[ESP+8] ; buf
|
||||
INT 0x40
|
||||
POP EBX
|
||||
RET
|
||||
17
28_day/apilib/api026.nas
Normal file
17
28_day/apilib/api026.nas
Normal file
@@ -0,0 +1,17 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api026.nas"]
|
||||
|
||||
GLOBAL _api_cmdline
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_cmdline: ; int api_cmdline(char *buf, int maxsize);
|
||||
PUSH EBX
|
||||
MOV EDX,26
|
||||
MOV ECX,[ESP+12] ; maxsize
|
||||
MOV EBX,[ESP+8] ; buf
|
||||
INT 0x40
|
||||
POP EBX
|
||||
RET
|
||||
@@ -47,6 +47,10 @@ void HariMain(void)
|
||||
int key_shift = 0, key_leds = (binfo->leds >> 4) & 7, keycmd_wait = -1;
|
||||
int j, x, y, mmx = -1, mmy = -1, mmx2 = 0;
|
||||
struct SHEET *sht = 0, *key_win, *sht2;
|
||||
int *fat;
|
||||
unsigned char *nihongo;
|
||||
struct FILEINFO *finfo;
|
||||
extern char hankaku[4096];
|
||||
|
||||
init_gdtidt();
|
||||
init_pic();
|
||||
@@ -71,6 +75,7 @@ void HariMain(void)
|
||||
fifo.task = task_a;
|
||||
task_run(task_a, 1, 2);
|
||||
*((int *) 0x0fe4) = (int) shtctl;
|
||||
task_a->langmode = 0;
|
||||
|
||||
/* sht_back */
|
||||
sht_back = sheet_alloc(shtctl);
|
||||
@@ -96,10 +101,28 @@ void HariMain(void)
|
||||
sheet_updown(sht_mouse, 2);
|
||||
keywin_on(key_win);
|
||||
|
||||
/*为了避免和键盘当前状态冲突,在一开始先进行设置*/
|
||||
/* 为了避免和键盘当前状态冲突,在一开始先进行设置 */
|
||||
fifo32_put(&keycmd, KEYCMD_LED);
|
||||
fifo32_put(&keycmd, key_leds);
|
||||
|
||||
/* 载入nihongo.fnt */
|
||||
nihongo = (unsigned char *) memman_alloc_4k(memman, 16 * 256 + 32 * 94 * 47);
|
||||
fat = (int *) memman_alloc_4k(memman, 4 * 2880);
|
||||
file_readfat(fat, (unsigned char *) (ADR_DISKIMG + 0x000200));
|
||||
finfo = file_search("nihongo.fnt", (struct FILEINFO *) (ADR_DISKIMG + 0x002600), 224);
|
||||
if (finfo != 0) {
|
||||
file_loadfile(finfo->clustno, finfo->size, nihongo, fat, (char *) (ADR_DISKIMG + 0x003e00));
|
||||
} else {
|
||||
for (i = 0; i < 16 * 256; i++) {
|
||||
nihongo[i] = hankaku[i]; /* 没有字库,半角部分直接复制英文字库 */
|
||||
}
|
||||
for (i = 16 * 256; i < 16 * 256 + 32 * 94 * 47; i++) {
|
||||
nihongo[i] = 0xff; /* 没有字库,全角部分以0xff填充 */
|
||||
}
|
||||
}
|
||||
*((int *) 0x0fe8) = (int) nihongo;
|
||||
memman_free_4k(memman, (int) fat, 4 * 2880);
|
||||
|
||||
for (;;) {
|
||||
if (fifo32_status(&keycmd) > 0 && keycmd_wait < 0) {
|
||||
/* 如果存在向键盘控制器发送的数据,则发送它 */
|
||||
|
||||
@@ -214,6 +214,10 @@ struct TASK {
|
||||
struct SEGMENT_DESCRIPTOR ldt[2];
|
||||
struct CONSOLE *cons;
|
||||
int ds_base, cons_stack;
|
||||
struct FILEHANDLE *fhandle;
|
||||
int *fat;
|
||||
char *cmdline;
|
||||
char langmode;
|
||||
};
|
||||
struct TASKLEVEL {
|
||||
int running; /*正在运行的任务数量*/
|
||||
@@ -248,6 +252,11 @@ struct CONSOLE {
|
||||
int cur_x, cur_y, cur_c;
|
||||
struct TIMER *timer;
|
||||
};
|
||||
struct FILEHANDLE {
|
||||
char *buf;
|
||||
int size;
|
||||
int pos;
|
||||
};
|
||||
void console_task(struct SHEET *sheet, int memtotal);
|
||||
void cons_putchar(struct CONSOLE *cons, int chr, char move);
|
||||
void cons_newline(struct CONSOLE *cons);
|
||||
@@ -257,10 +266,10 @@ void cons_runcmd(char *cmdline, struct CONSOLE *cons, int *fat, int memtotal);
|
||||
void cmd_mem(struct CONSOLE *cons, int memtotal);
|
||||
void cmd_cls(struct CONSOLE *cons);
|
||||
void cmd_dir(struct CONSOLE *cons);
|
||||
void cmd_type(struct CONSOLE *cons, int *fat, char *cmdline);
|
||||
void cmd_exit(struct CONSOLE *cons, int *fat);
|
||||
void cmd_start(struct CONSOLE *cons, char *cmdline, int memtotal);
|
||||
void cmd_ncst(struct CONSOLE *cons, char *cmdline, int memtotal);
|
||||
void cmd_langmode(struct CONSOLE *cons, char *cmdline);
|
||||
int cmd_app(struct CONSOLE *cons, int *fat, char *cmdline);
|
||||
int *hrb_api(int edi, int esi, int ebp, int esp, int ebx, int edx, int ecx, int eax);
|
||||
int *inthandler0d(int *esp);
|
||||
|
||||
@@ -9,13 +9,17 @@ void console_task(struct SHEET *sheet, int memtotal)
|
||||
struct TASK *task = task_now();
|
||||
struct MEMMAN *memman = (struct MEMMAN *) MEMMAN_ADDR;
|
||||
int i, *fat = (int *) memman_alloc_4k(memman, 4 * 2880);
|
||||
struct FILEHANDLE fhandle[8];
|
||||
struct CONSOLE cons;
|
||||
char cmdline[30];
|
||||
unsigned char *nihongo = (char *) *((int *) 0x0fe8);
|
||||
|
||||
cons.sht = sheet;
|
||||
cons.cur_x = 8;
|
||||
cons.cur_y = 28;
|
||||
cons.cur_c = -1;
|
||||
task->cons = &cons;
|
||||
task->cmdline = cmdline;
|
||||
|
||||
if (cons.sht != 0) {
|
||||
cons.timer = timer_alloc();
|
||||
@@ -23,6 +27,16 @@ void console_task(struct SHEET *sheet, int memtotal)
|
||||
timer_settime(cons.timer, 50);
|
||||
}
|
||||
file_readfat(fat, (unsigned char *) (ADR_DISKIMG + 0x000200));
|
||||
for (i = 0; i < 8; i++) {
|
||||
fhandle[i].buf = 0; /*未使用标记*/
|
||||
}
|
||||
task->fhandle = fhandle;
|
||||
task->fat = fat;
|
||||
if (nihongo[4096] != 0xff) { /* 是否载入了字库?*/
|
||||
task->langmode = 1;
|
||||
} else {
|
||||
task->langmode = 0;
|
||||
}
|
||||
|
||||
/*显示提示符*/
|
||||
cons_putchar(&cons, '>', 1);
|
||||
@@ -191,15 +205,15 @@ void cons_runcmd(char *cmdline, struct CONSOLE *cons, int *fat, int memtotal)
|
||||
cmd_cls(cons);
|
||||
} else if ((strcmp(cmdline, "dir") == 0 || strcmp(cmdline, "ls") == 0) && cons->sht != 0) {
|
||||
cmd_dir(cons);
|
||||
} else if (strncmp(cmdline, "type ", 5) == 0 && cons->sht != 0) {
|
||||
cmd_type(cons, fat, cmdline);
|
||||
} else if (strcmp(cmdline, "exit") == 0) {
|
||||
cmd_exit(cons, fat);
|
||||
} else if (strncmp(cmdline, "start ", 6) == 0) {
|
||||
cmd_start(cons, cmdline, memtotal);
|
||||
} else if (strncmp(cmdline, "ncst ", 5) == 0) {
|
||||
cmd_ncst(cons, cmdline, memtotal);
|
||||
} else if (cmdline[0] != 0) {
|
||||
} else if (strncmp(cmdline, "langmode ", 9) == 0) {
|
||||
cmd_langmode(cons, cmdline);
|
||||
}else if (cmdline[0] != 0) {
|
||||
if (cmd_app(cons, fat, cmdline) == 0) {
|
||||
/*不是命令,不是应用程序,也不是空行*/
|
||||
cons_putstr0(cons, "Bad command.\n\n");
|
||||
@@ -257,25 +271,6 @@ void cmd_dir(struct CONSOLE *cons)
|
||||
return;
|
||||
}
|
||||
|
||||
void cmd_type(struct CONSOLE *cons, int *fat, char *cmdline)
|
||||
{
|
||||
struct MEMMAN *memman = (struct MEMMAN *) MEMMAN_ADDR;
|
||||
struct FILEINFO *finfo = file_search(cmdline + 5, (struct FILEINFO *) (ADR_DISKIMG + 0x002600), 224);
|
||||
char *p;
|
||||
if (finfo != 0) {
|
||||
/*找到文件的情况*/
|
||||
p = (char *) memman_alloc_4k(memman, finfo->size);
|
||||
file_loadfile(finfo->clustno, finfo->size, p, fat, (char *) (ADR_DISKIMG + 0x003e00));
|
||||
cons_putstr1(cons, p, finfo->size);
|
||||
memman_free_4k(memman, (int) p, finfo->size);
|
||||
} else {
|
||||
/*没有找到文件的情况*/
|
||||
cons_putstr0(cons, "File not found.\n");
|
||||
}
|
||||
cons_newline(cons);
|
||||
return;
|
||||
}
|
||||
|
||||
void cmd_exit(struct CONSOLE *cons, int *fat)
|
||||
{
|
||||
struct MEMMAN *memman = (struct MEMMAN *) MEMMAN_ADDR;
|
||||
@@ -330,6 +325,19 @@ void cmd_ncst(struct CONSOLE *cons, char *cmdline, int memtotal)
|
||||
return;
|
||||
}
|
||||
|
||||
void cmd_langmode(struct CONSOLE *cons, char *cmdline)
|
||||
{
|
||||
struct TASK *task = task_now();
|
||||
unsigned char mode = cmdline[9] - '0';
|
||||
if (mode <= 1) {
|
||||
task->langmode = mode;
|
||||
} else {
|
||||
cons_putstr0(cons, "mode number error.\n");
|
||||
}
|
||||
cons_newline(cons);
|
||||
return;
|
||||
}
|
||||
|
||||
int cmd_app(struct CONSOLE *cons, int *fat, char *cmdline)
|
||||
{
|
||||
struct MEMMAN *memman = (struct MEMMAN *) MEMMAN_ADDR;
|
||||
@@ -387,6 +395,12 @@ int cmd_app(struct CONSOLE *cons, int *fat, char *cmdline)
|
||||
sheet_free(sht); /*关闭*/
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 8; i++) { /*将未关闭的文件关闭*/
|
||||
if (task->fhandle[i].buf != 0) {
|
||||
memman_free_4k(memman, (int) task->fhandle[i].buf, task->fhandle[i].size);
|
||||
task->fhandle[i].buf = 0;
|
||||
}
|
||||
}
|
||||
timer_cancelall(&task->fifo);
|
||||
memman_free_4k(memman, (int) q, segsiz);
|
||||
} else {
|
||||
@@ -413,6 +427,9 @@ int *hrb_api(int edi, int esi, int ebp, int esp, int ebx, int edx, int ecx, int
|
||||
/* reg[0] : EDI, reg[1] : ESI, reg[2] : EBP, reg[3] : ESP */
|
||||
/* reg[4] : EBX, reg[5] : EDX, reg[6] : ECX, reg[7] : EAX */
|
||||
int i;
|
||||
struct FILEINFO *finfo;
|
||||
struct FILEHANDLE *fh;
|
||||
struct MEMMAN *memman = (struct MEMMAN *) MEMMAN_ADDR;
|
||||
|
||||
if (edx == 1) {
|
||||
cons_putchar(cons, eax & 0xff, 1);
|
||||
@@ -528,6 +545,75 @@ int *hrb_api(int edi, int esi, int ebp, int esp, int ebx, int edx, int ecx, int
|
||||
i = io_in8(0x61);
|
||||
io_out8(0x61, (i | 0x03) & 0x0f);
|
||||
}
|
||||
} else if (edx == 21) {
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (task->fhandle[i].buf == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
fh = &task->fhandle[i];
|
||||
reg[7] = 0;
|
||||
if (i < 8) {
|
||||
finfo = file_search((char *) ebx + ds_base, (struct FILEINFO *) (ADR_DISKIMG + 0x002600), 224);
|
||||
if (finfo != 0) {
|
||||
reg[7] = (int) fh;
|
||||
fh->buf = (char *) memman_alloc_4k(memman, finfo->size);
|
||||
fh->size = finfo->size;
|
||||
fh->pos = 0;
|
||||
file_loadfile(finfo->clustno, finfo->size, fh->buf, task->fat, (char *) (ADR_DISKIMG + 0x003e00));
|
||||
}
|
||||
}
|
||||
} else if (edx == 22) {
|
||||
fh = (struct FILEHANDLE *) eax;
|
||||
memman_free_4k(memman, (int) fh->buf, fh->size);
|
||||
fh->buf = 0;
|
||||
} else if (edx == 23) {
|
||||
fh = (struct FILEHANDLE *) eax;
|
||||
if (ecx == 0) {
|
||||
fh->pos = ebx;
|
||||
} else if (ecx == 1) {
|
||||
fh->pos += ebx;
|
||||
} else if (ecx == 2) {
|
||||
fh->pos = fh->size + ebx;
|
||||
}
|
||||
if (fh->pos < 0) {
|
||||
fh->pos = 0;
|
||||
}
|
||||
if (fh->pos > fh->size) {
|
||||
fh->pos = fh->size;
|
||||
}
|
||||
} else if (edx == 24) {
|
||||
fh = (struct FILEHANDLE *) eax;
|
||||
if (ecx == 0) {
|
||||
reg[7] = fh->size;
|
||||
} else if (ecx == 1) {
|
||||
reg[7] = fh->pos;
|
||||
} else if (ecx == 2) {
|
||||
reg[7] = fh->pos - fh->size;
|
||||
}
|
||||
} else if (edx == 25) {
|
||||
fh = (struct FILEHANDLE *) eax;
|
||||
for (i = 0; i < ecx; i++) {
|
||||
if (fh->pos == fh->size) {
|
||||
break;
|
||||
}
|
||||
*((char *) ebx + ds_base + i) = fh->buf[fh->pos];
|
||||
fh->pos++;
|
||||
}
|
||||
reg[7] = i;
|
||||
} else if (edx == 26) {
|
||||
i = 0;
|
||||
for (;;) {
|
||||
*((char *) ebx + ds_base + i) = task->cmdline[i];
|
||||
if (task->cmdline[i] == 0) {
|
||||
break;
|
||||
}
|
||||
if (i >= ecx) {
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
reg[7] = i;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -108,9 +108,19 @@ void putfonts8_asc(char *vram, int xsize, int x, int y, char c, unsigned char *s
|
||||
{
|
||||
extern char hankaku[4096];
|
||||
/* C语言中,字符串都是以0x00结尾 */
|
||||
for (; *s != 0x00; s++) {
|
||||
putfont8(vram, xsize, x, y, c, hankaku + *s * 16);
|
||||
x += 8;
|
||||
struct TASK *task = task_now();
|
||||
char *nihongo = (char *) *((int *) 0x0fe8);
|
||||
if (task->langmode == 0) {
|
||||
for (; *s != 0x00; s++) {
|
||||
putfont8(vram, xsize, x, y, c, hankaku + *s * 16);
|
||||
x += 8;
|
||||
}
|
||||
}
|
||||
if (task->langmode == 1) {
|
||||
for (; *s != 0x00; s++) {
|
||||
putfont8(vram, xsize, x, y, c, nihongo + *s * 16);
|
||||
x += 8;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
1
28_day/iroha/!cons_9x.bat
Normal file
1
28_day/iroha/!cons_9x.bat
Normal file
@@ -0,0 +1 @@
|
||||
command
|
||||
1
28_day/iroha/!cons_nt.bat
Normal file
1
28_day/iroha/!cons_nt.bat
Normal file
@@ -0,0 +1 @@
|
||||
cmd.exe
|
||||
5
28_day/iroha/Makefile
Normal file
5
28_day/iroha/Makefile
Normal file
@@ -0,0 +1,5 @@
|
||||
APP = iroha
|
||||
STACK = 1k
|
||||
MALLOC = 0k
|
||||
|
||||
include ../app_make.txt
|
||||
9
28_day/iroha/iroha.c
Normal file
9
28_day/iroha/iroha.c
Normal file
@@ -0,0 +1,9 @@
|
||||
#include "apilib.h"
|
||||
|
||||
void HariMain(void)
|
||||
{
|
||||
static char s[9] = { 0xb2, 0xdb, 0xca, 0xc6, 0xce, 0xcd, 0xc4, 0x0a, 0x00 };
|
||||
/*半角片假名イロハニホヘト的字符编码+换行+0 */
|
||||
api_putstr0(s);
|
||||
api_end();
|
||||
}
|
||||
1
28_day/iroha/make.bat
Normal file
1
28_day/iroha/make.bat
Normal file
@@ -0,0 +1 @@
|
||||
..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
BIN
28_day/nihongo/jpn16v00.bin
Normal file
BIN
28_day/nihongo/jpn16v00.bin
Normal file
Binary file not shown.
BIN
28_day/nihongo/jpn16v00.fnt
Normal file
BIN
28_day/nihongo/jpn16v00.fnt
Normal file
Binary file not shown.
BIN
28_day/nihongo/nihongo.fnt
Normal file
BIN
28_day/nihongo/nihongo.fnt
Normal file
Binary file not shown.
1
28_day/type/!cons_9x.bat
Normal file
1
28_day/type/!cons_9x.bat
Normal file
@@ -0,0 +1 @@
|
||||
command
|
||||
1
28_day/type/!cons_nt.bat
Normal file
1
28_day/type/!cons_nt.bat
Normal file
@@ -0,0 +1 @@
|
||||
cmd.exe
|
||||
5
28_day/type/Makefile
Normal file
5
28_day/type/Makefile
Normal file
@@ -0,0 +1,5 @@
|
||||
APP = type
|
||||
STACK = 1k
|
||||
MALLOC = 0k
|
||||
|
||||
include ../app_make.txt
|
||||
1
28_day/type/make.bat
Normal file
1
28_day/type/make.bat
Normal file
@@ -0,0 +1 @@
|
||||
..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
23
28_day/type/type.c
Normal file
23
28_day/type/type.c
Normal file
@@ -0,0 +1,23 @@
|
||||
#include "apilib.h"
|
||||
|
||||
void HariMain(void)
|
||||
{
|
||||
int fh;
|
||||
char c, cmdline[30], *p;
|
||||
|
||||
api_cmdline(cmdline, 30);
|
||||
for (p = cmdline; *p > ' '; p++) { } /*跳过之前的内容,直到遇到空格*/
|
||||
for (; *p == ' '; p++) { } /*跳过空格*/
|
||||
fh = api_fopen(p);
|
||||
if (fh != 0) {
|
||||
for (;;) {
|
||||
if (api_fread(&c, 1, fh) == 0) {
|
||||
break;
|
||||
}
|
||||
api_putchar(c);
|
||||
}
|
||||
} else {
|
||||
api_putstr0("File not found.\n");
|
||||
}
|
||||
api_end();
|
||||
}
|
||||
1
28_day/typeipl/!cons_9x.bat
Normal file
1
28_day/typeipl/!cons_9x.bat
Normal file
@@ -0,0 +1 @@
|
||||
command
|
||||
1
28_day/typeipl/!cons_nt.bat
Normal file
1
28_day/typeipl/!cons_nt.bat
Normal file
@@ -0,0 +1 @@
|
||||
cmd.exe
|
||||
5
28_day/typeipl/Makefile
Normal file
5
28_day/typeipl/Makefile
Normal file
@@ -0,0 +1,5 @@
|
||||
APP = typeipl
|
||||
STACK = 1k
|
||||
MALLOC = 0k
|
||||
|
||||
include ../app_make.txt
|
||||
1
28_day/typeipl/make.bat
Normal file
1
28_day/typeipl/make.bat
Normal file
@@ -0,0 +1 @@
|
||||
..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
17
28_day/typeipl/typeipl.c
Normal file
17
28_day/typeipl/typeipl.c
Normal file
@@ -0,0 +1,17 @@
|
||||
#include "apilib.h"
|
||||
|
||||
void HariMain(void)
|
||||
{
|
||||
int fh;
|
||||
char c;
|
||||
fh = api_fopen("ipl10.nas");
|
||||
if (fh != 0) {
|
||||
for (;;) {
|
||||
if (api_fread(&c, 1, fh) == 0) {
|
||||
break;
|
||||
}
|
||||
api_putchar(c);
|
||||
}
|
||||
}
|
||||
api_end();
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
APP = winhelo
|
||||
STACK = 1k
|
||||
STACK = 8k
|
||||
MALLOC = 0k
|
||||
|
||||
include ../app_make.txt
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#include "apilib.h"
|
||||
|
||||
char buf[150 * 50];
|
||||
|
||||
void HariMain(void)
|
||||
{
|
||||
int win;
|
||||
char buf[150 * 50];
|
||||
|
||||
win = api_openwin(buf, 150, 50, -1, "hello");
|
||||
for (;;) {
|
||||
if (api_getkey(1) == 0x0a) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
APP = winhelo2
|
||||
STACK = 1k
|
||||
STACK = 8k
|
||||
MALLOC = 0k
|
||||
|
||||
include ../app_make.txt
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#include "apilib.h"
|
||||
|
||||
char buf[150 * 50];
|
||||
|
||||
void HariMain(void)
|
||||
{
|
||||
int win;
|
||||
char buf[150 * 50];
|
||||
|
||||
win = api_openwin(buf, 150, 50, -1, "hello");
|
||||
api_boxfilwin(win, 8, 36, 141, 43, 3); /*黄色*/
|
||||
api_putstrwin(win, 28, 28, 0 /*黑色*/, 12, "hello, world");
|
||||
|
||||
Reference in New Issue
Block a user