mirror of
https://github.com/yourtion/30dayMakeOS.git
synced 2026-02-05 02:53:19 +08:00
Compare commits
24 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
140774a293 | ||
|
|
7c2fc66927 | ||
|
|
636c1a8c3d | ||
|
|
c177821913 | ||
|
|
febac10ebf | ||
|
|
0e31ff06ca | ||
|
|
08d19d7512 | ||
|
|
b2d31a8e54 | ||
|
|
72532c8cd7 | ||
|
|
3871740126 | ||
|
|
70b335278d | ||
|
|
2c262f986d | ||
|
|
6b0457bed6 | ||
|
|
0adab9385e | ||
|
|
73b7421cf2 | ||
|
|
203dd63152 | ||
|
|
9df2b90ad3 | ||
|
|
633089d320 | ||
|
|
41a0252634 | ||
|
|
5a064e20c2 | ||
|
|
d925a8d992 | ||
|
|
7497159026 | ||
|
|
fcd87ee302 | ||
|
|
ac8b6b1411 |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1 +1,5 @@
|
||||
*.hrb
|
||||
*.lst
|
||||
*.map
|
||||
*.bim
|
||||
*.hrb
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -14,18 +14,19 @@ default :
|
||||
|
||||
#文件生成规则
|
||||
|
||||
haribote.img : haribote/ipl10.bin haribote/haribote.sys Makefile \
|
||||
haribote.img : haribote/ipl20.bin haribote/haribote.sys Makefile \
|
||||
a/a.hrb hello3/hello3.hrb hello4/hello4.hrb hello5/hello5.hrb \
|
||||
winhelo/winhelo.hrb winhelo2/winhelo2.hrb winhelo3/winhelo3.hrb \
|
||||
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 sosu2/sosu2.hrb sosu3/sosu3.hrb \
|
||||
typeipl/typeipl.hrb type/type.hrb
|
||||
typeipl/typeipl.hrb type/type.hrb iroha/iroha.hrb \
|
||||
chklang/chklang.hrb
|
||||
$(EDIMG) imgin:../z_tools/fdimg0at.tek \
|
||||
wbinimg src:haribote/ipl10.bin len:512 from:0 to:0 \
|
||||
wbinimg src:haribote/ipl20.bin len:512 from:0 to:0 \
|
||||
copy from:haribote/haribote.sys to:@: \
|
||||
copy from:haribote/ipl10.nas to:@: \
|
||||
copy from:haribote/jp.nas to:@: \
|
||||
copy from:make.bat to:@: \
|
||||
copy from:a/a.hrb to:@: \
|
||||
copy from:hello3/hello3.hrb to:@: \
|
||||
@@ -48,6 +49,10 @@ haribote.img : haribote/ipl10.bin haribote/haribote.sys Makefile \
|
||||
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:chklang/chklang.hrb to:@: \
|
||||
copy from:euc.txt to:@: \
|
||||
copy from:nihongo/nihongo.fnt to:@: \
|
||||
imgout:haribote.img
|
||||
|
||||
#命令
|
||||
@@ -85,6 +90,8 @@ full :
|
||||
$(MAKE) -C sosu3
|
||||
$(MAKE) -C typeipl
|
||||
$(MAKE) -C type
|
||||
$(MAKE) -C iroha
|
||||
$(MAKE) -C chklang
|
||||
$(MAKE) haribote.img
|
||||
|
||||
run_full :
|
||||
@@ -109,53 +116,57 @@ src_only :
|
||||
|
||||
clean_full :
|
||||
$(MAKE) -C haribote clean
|
||||
$(MAKE) -C apilib clean
|
||||
$(MAKE) -C a clean
|
||||
$(MAKE) -C hello3 clean
|
||||
$(MAKE) -C hello4 clean
|
||||
$(MAKE) -C hello5 clean
|
||||
$(MAKE) -C apilib clean
|
||||
$(MAKE) -C a clean
|
||||
$(MAKE) -C hello3 clean
|
||||
$(MAKE) -C hello4 clean
|
||||
$(MAKE) -C hello5 clean
|
||||
$(MAKE) -C winhelo clean
|
||||
$(MAKE) -C winhelo2 clean
|
||||
$(MAKE) -C winhelo3 clean
|
||||
$(MAKE) -C star1 clean
|
||||
$(MAKE) -C stars clean
|
||||
$(MAKE) -C stars2 clean
|
||||
$(MAKE) -C lines clean
|
||||
$(MAKE) -C walk clean
|
||||
$(MAKE) -C noodle clean
|
||||
$(MAKE) -C star1 clean
|
||||
$(MAKE) -C stars clean
|
||||
$(MAKE) -C stars2 clean
|
||||
$(MAKE) -C lines clean
|
||||
$(MAKE) -C walk clean
|
||||
$(MAKE) -C noodle clean
|
||||
$(MAKE) -C beepdown clean
|
||||
$(MAKE) -C color clean
|
||||
$(MAKE) -C color2 clean
|
||||
$(MAKE) -C sosu clean
|
||||
$(MAKE) -C sosu2 clean
|
||||
$(MAKE) -C sosu3 clean
|
||||
$(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 type clean
|
||||
$(MAKE) -C iroha clean
|
||||
$(MAKE) -C chklang clean
|
||||
|
||||
src_only_full :
|
||||
$(MAKE) -C haribote src_only
|
||||
$(MAKE) -C apilib src_only
|
||||
$(MAKE) -C a src_only
|
||||
$(MAKE) -C hello3 src_only
|
||||
$(MAKE) -C hello4 src_only
|
||||
$(MAKE) -C hello5 src_only
|
||||
$(MAKE) -C apilib src_only
|
||||
$(MAKE) -C a src_only
|
||||
$(MAKE) -C hello3 src_only
|
||||
$(MAKE) -C hello4 src_only
|
||||
$(MAKE) -C hello5 src_only
|
||||
$(MAKE) -C winhelo src_only
|
||||
$(MAKE) -C winhelo2 src_only
|
||||
$(MAKE) -C winhelo3 src_only
|
||||
$(MAKE) -C star1 src_only
|
||||
$(MAKE) -C stars src_only
|
||||
$(MAKE) -C stars2 src_only
|
||||
$(MAKE) -C lines src_only
|
||||
$(MAKE) -C walk src_only
|
||||
$(MAKE) -C noodle src_only
|
||||
$(MAKE) -C star1 src_only
|
||||
$(MAKE) -C stars src_only
|
||||
$(MAKE) -C stars2 src_only
|
||||
$(MAKE) -C lines src_only
|
||||
$(MAKE) -C walk src_only
|
||||
$(MAKE) -C noodle src_only
|
||||
$(MAKE) -C beepdown src_only
|
||||
$(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 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
|
||||
$(MAKE) -C chklang src_only
|
||||
-$(DEL) haribote.img
|
||||
|
||||
refresh :
|
||||
|
||||
@@ -24,3 +24,4 @@ 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);
|
||||
int api_getlang(void);
|
||||
|
||||
@@ -2,7 +2,7 @@ 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 api021.obj api022.obj api023.obj api024.obj \
|
||||
api025.obj api026.obj alloca.obj
|
||||
api025.obj api026.obj api027.obj alloca.obj
|
||||
|
||||
TOOLPATH = ../../z_tools/
|
||||
INCPATH = ../../z_tools/haribote/
|
||||
|
||||
13
28_day/apilib/api027.nas
Normal file
13
28_day/apilib/api027.nas
Normal file
@@ -0,0 +1,13 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api027.nas"]
|
||||
|
||||
GLOBAL _api_getlang
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_getlang: ; int api_getlang(void);
|
||||
MOV EDX,27
|
||||
INT 0x40
|
||||
RET
|
||||
Binary file not shown.
1
28_day/chklang/!cons_9x.bat
Normal file
1
28_day/chklang/!cons_9x.bat
Normal file
@@ -0,0 +1 @@
|
||||
command
|
||||
1
28_day/chklang/!cons_nt.bat
Normal file
1
28_day/chklang/!cons_nt.bat
Normal file
@@ -0,0 +1 @@
|
||||
cmd.exe
|
||||
5
28_day/chklang/Makefile
Normal file
5
28_day/chklang/Makefile
Normal file
@@ -0,0 +1,5 @@
|
||||
APP = chklang
|
||||
STACK = 1k
|
||||
MALLOC = 0k
|
||||
|
||||
include ../app_make.txt
|
||||
24
28_day/chklang/chklang.c
Normal file
24
28_day/chklang/chklang.c
Normal file
@@ -0,0 +1,24 @@
|
||||
#include "apilib.h"
|
||||
|
||||
void HariMain(void)
|
||||
{
|
||||
int langmode = api_getlang();
|
||||
static char s1[23] = { /* 日本語シフトJISモード(日文Shift-JIS模式)*/
|
||||
0x93, 0xfa, 0x96, 0x7b, 0x8c, 0xea, 0x83, 0x56, 0x83, 0x74, 0x83, 0x67,
|
||||
0x4a, 0x49, 0x53, 0x83, 0x82, 0x81, 0x5b, 0x83, 0x68, 0x0a, 0x00
|
||||
};
|
||||
static char s2[17] = { /*日本語EUCモード(日文EUC模式)*/
|
||||
0xc6, 0xfc, 0xcb, 0xdc, 0xb8, 0xec, 0x45, 0x55, 0x43, 0xa5, 0xe2, 0xa1,
|
||||
0xbc, 0xa5, 0xc9, 0x0a, 0x00
|
||||
};
|
||||
if (langmode == 0) {
|
||||
api_putstr0("English ASCII mode\n");
|
||||
}
|
||||
if (langmode == 1) {
|
||||
api_putstr0(s1);
|
||||
}
|
||||
if (langmode == 2) {
|
||||
api_putstr0(s2);
|
||||
}
|
||||
api_end();
|
||||
}
|
||||
1
28_day/chklang/make.bat
Normal file
1
28_day/chklang/make.bat
Normal file
@@ -0,0 +1 @@
|
||||
..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
1
28_day/euc.txt
Normal file
1
28_day/euc.txt
Normal file
@@ -0,0 +1 @@
|
||||
日本語EUCで書いてみたよー
|
||||
@@ -23,7 +23,7 @@ DEL = del
|
||||
#默认动作
|
||||
|
||||
default :
|
||||
$(MAKE) ipl10.bin
|
||||
$(MAKE) ipl20.bin
|
||||
$(MAKE) haribote.sys
|
||||
|
||||
# 镜像文件生成
|
||||
@@ -31,6 +31,9 @@ default :
|
||||
ipl10.bin : ipl10.nas Makefile
|
||||
$(NASK) ipl10.nas ipl10.bin ipl10.lst
|
||||
|
||||
ipl20.bin : ipl20.nas Makefile
|
||||
$(NASK) ipl20.nas ipl20.bin ipl20.lst
|
||||
|
||||
asmhead.bin : asmhead.nas Makefile
|
||||
$(NASK) asmhead.nas asmhead.bin asmhead.lst
|
||||
|
||||
@@ -76,4 +79,5 @@ clean :
|
||||
src_only :
|
||||
$(MAKE) clean
|
||||
-$(DEL) ipl10.bin
|
||||
-$(DEL) ipl20.bin
|
||||
-$(DEL) haribote.sys
|
||||
|
||||
@@ -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) {
|
||||
/* 如果存在向键盘控制器发送的数据,则发送它 */
|
||||
|
||||
@@ -217,6 +217,7 @@ struct TASK {
|
||||
struct FILEHANDLE *fhandle;
|
||||
int *fat;
|
||||
char *cmdline;
|
||||
unsigned char langmode, langbyte1;
|
||||
};
|
||||
struct TASKLEVEL {
|
||||
int running; /*正在运行的任务数量*/
|
||||
@@ -268,6 +269,7 @@ void cmd_dir(struct CONSOLE *cons);
|
||||
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);
|
||||
|
||||
@@ -12,6 +12,7 @@ void console_task(struct SHEET *sheet, int memtotal)
|
||||
struct FILEHANDLE fhandle[8];
|
||||
struct CONSOLE cons;
|
||||
char cmdline[30];
|
||||
unsigned char *nihongo = (char *) *((int *) 0x0fe8);
|
||||
|
||||
cons.sht = sheet;
|
||||
cons.cur_x = 8;
|
||||
@@ -31,6 +32,12 @@ void console_task(struct SHEET *sheet, int memtotal)
|
||||
}
|
||||
task->fhandle = fhandle;
|
||||
task->fat = fat;
|
||||
if (nihongo[4096] != 0xff) { /* 是否载入了字库?*/
|
||||
task->langmode = 1;
|
||||
} else {
|
||||
task->langmode = 0;
|
||||
}
|
||||
task->langbyte1 = 0;
|
||||
|
||||
/*显示提示符*/
|
||||
cons_putchar(&cons, '>', 1);
|
||||
@@ -152,6 +159,7 @@ void cons_newline(struct CONSOLE *cons)
|
||||
{
|
||||
int x, y;
|
||||
struct SHEET *sheet = cons->sht;
|
||||
struct TASK *task = task_now();
|
||||
if (cons->cur_y < 28 + 112) {
|
||||
cons->cur_y += 16; /*到下一行*/
|
||||
} else {
|
||||
@@ -171,6 +179,9 @@ void cons_newline(struct CONSOLE *cons)
|
||||
}
|
||||
}
|
||||
cons->cur_x = 8;
|
||||
if (task->langmode == 1 && task->langbyte1 != 0) {
|
||||
cons->cur_x += 8;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -205,7 +216,9 @@ void cons_runcmd(char *cmdline, struct CONSOLE *cons, int *fat, int memtotal)
|
||||
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");
|
||||
@@ -317,6 +330,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 <= 2) {
|
||||
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;
|
||||
@@ -382,6 +408,7 @@ int cmd_app(struct CONSOLE *cons, int *fat, char *cmdline)
|
||||
}
|
||||
timer_cancelall(&task->fifo);
|
||||
memman_free_4k(memman, (int) q, segsiz);
|
||||
task->langbyte1 = 0;
|
||||
} else {
|
||||
cons_putstr0(cons, ".hrb file format error.\n");
|
||||
}
|
||||
@@ -593,6 +620,8 @@ int *hrb_api(int edi, int esi, int ebp, int esp, int ebx, int edx, int ecx, int
|
||||
i++;
|
||||
}
|
||||
reg[7] = i;
|
||||
} else if (edx == 27) {
|
||||
reg[7] = task->langmode;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -107,10 +107,64 @@ void putfont8(char *vram, int xsize, int x, int y, char c, char *font)
|
||||
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), *font;
|
||||
int k, t;
|
||||
|
||||
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++) {
|
||||
if (task->langbyte1 == 0) {
|
||||
if ((0x81 <= *s && *s <= 0x9f) || (0xe0 <= *s && *s <= 0xfc)) {
|
||||
task->langbyte1 = *s;
|
||||
} else {
|
||||
putfont8(vram, xsize, x, y, c, nihongo + *s * 16);
|
||||
}
|
||||
} else {
|
||||
if (0x81 <= task->langbyte1 && task->langbyte1 <= 0x9f) {
|
||||
k = (task->langbyte1 - 0x81) * 2;
|
||||
} else {
|
||||
k = (task->langbyte1 - 0xe0) * 2 + 62;
|
||||
}
|
||||
if (0x40 <= *s && *s <= 0x7e) {
|
||||
t = *s - 0x40;
|
||||
} else if (0x80 <= *s && *s <= 0x9e) {
|
||||
t = *s - 0x80 + 63;
|
||||
} else {
|
||||
t = *s - 0x9f;
|
||||
k++;
|
||||
}
|
||||
task->langbyte1 = 0;
|
||||
font = nihongo + 256 * 16 + (k * 94 + t) * 32;
|
||||
putfont8(vram, xsize, x - 8, y, c, font ); /* 左半部分 */
|
||||
putfont8(vram, xsize, x , y, c, font + 16); /* 右半部分 */
|
||||
}
|
||||
x += 8;
|
||||
}
|
||||
}
|
||||
if (task->langmode == 2) {
|
||||
for (; *s != 0x00; s++) {
|
||||
if (task->langbyte1 == 0) {
|
||||
if (0x81 <= *s && *s <= 0xfe) {
|
||||
task->langbyte1 = *s;
|
||||
} else {
|
||||
putfont8(vram, xsize, x, y, c, nihongo + *s * 16);
|
||||
}
|
||||
} else {
|
||||
k = task->langbyte1 - 0xa1;
|
||||
t = *s - 0xa1;
|
||||
task->langbyte1 = 0;
|
||||
font = nihongo + 256 * 16 + (k * 94 + t) * 32;
|
||||
putfont8(vram, xsize, x - 8, y, c, font ); /* 左半部分 */
|
||||
putfont8(vram, xsize, x , y, c, font + 16); /* 右半部分 */
|
||||
}
|
||||
x += 8;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
109
28_day/haribote/ipl20.nas
Normal file
109
28_day/haribote/ipl20.nas
Normal file
@@ -0,0 +1,109 @@
|
||||
; haribote-ipl
|
||||
; TAB=4
|
||||
|
||||
CYLS EQU 20 ; 声明CYLS=20
|
||||
|
||||
ORG 0x7c00 ; 指明程序装载地址
|
||||
|
||||
; 标准FAT12格式软盘专用的代码 Stand FAT12 format floppy code
|
||||
|
||||
JMP entry
|
||||
DB 0x90
|
||||
DB "HARIBOTE" ; 启动扇区名称(8字节)
|
||||
DW 512 ; 每个扇区(sector)大小(必须512字节)
|
||||
DB 1 ; 簇(cluster)大小(必须为1个扇区)
|
||||
DW 1 ; FAT起始位置(一般为第一个扇区)
|
||||
DB 2 ; FAT个数(必须为2)
|
||||
DW 224 ; 根目录大小(一般为224项)
|
||||
DW 2880 ; 该磁盘大小(必须为2880扇区1440*1024/512)
|
||||
DB 0xf0 ; 磁盘类型(必须为0xf0)
|
||||
DW 9 ; FAT的长度(必??9扇区)
|
||||
DW 18 ; 一个磁道(track)有几个扇区(必须为18)
|
||||
DW 2 ; 磁头数(必??2)
|
||||
DD 0 ; 不使用分区,必须是0
|
||||
DD 2880 ; 重写一次磁盘大小
|
||||
DB 0,0,0x29 ; 意义不明(固定)
|
||||
DD 0xffffffff ; (可能是)卷标号码
|
||||
DB "HARIBOTEOS " ; 磁盘的名称(必须为11字?,不足填空格)
|
||||
DB "FAT12 " ; 磁盘格式名称(必??8字?,不足填空格)
|
||||
RESB 18 ; 先空出18字节
|
||||
|
||||
; 程序主体
|
||||
|
||||
entry:
|
||||
MOV AX,0 ; 初始化寄存器
|
||||
MOV SS,AX
|
||||
MOV SP,0x7c00
|
||||
MOV DS,AX
|
||||
|
||||
; 读取磁盘
|
||||
|
||||
MOV AX,0x0820
|
||||
MOV ES,AX
|
||||
MOV CH,0 ; 柱面0
|
||||
MOV DH,0 ; 磁头0
|
||||
MOV CL,2 ; 扇区2
|
||||
|
||||
readloop:
|
||||
MOV SI,0 ; 记录失败次数寄存器
|
||||
|
||||
retry:
|
||||
MOV AH,0x02 ; AH=0x02 : 读入磁盘
|
||||
MOV AL,1 ; 1个扇区
|
||||
MOV BX,0
|
||||
MOV DL,0x00 ; A驱动器
|
||||
INT 0x13 ; 调用磁盘BIOS
|
||||
JNC next ; 没出错则跳转到fin
|
||||
ADD SI,1 ; 往SI加1
|
||||
CMP SI,5 ; 比较SI与5
|
||||
JAE error ; SI >= 5 跳转到error
|
||||
MOV AH,0x00
|
||||
MOV DL,0x00 ; A驱动器
|
||||
INT 0x13 ; 重置驱动器
|
||||
JMP retry
|
||||
next:
|
||||
MOV AX,ES ; 把内存地址后移0x200(512/16十六进制转换)
|
||||
ADD AX,0x0020
|
||||
MOV ES,AX ; ADD ES,0x020因为没有ADD ES,只能通过AX进行
|
||||
ADD CL,1 ; 往CL里面加1
|
||||
CMP CL,18 ; 比较CL与18
|
||||
JBE readloop ; CL <= 18 跳转到readloop
|
||||
MOV CL,1
|
||||
ADD DH,1
|
||||
CMP DH,2
|
||||
JB readloop ; DH < 2 跳转到readloop
|
||||
MOV DH,0
|
||||
ADD CH,1
|
||||
CMP CH,CYLS
|
||||
JB readloop ; CH < CYLS 跳转到readloop
|
||||
|
||||
; 读取完毕,跳转到haribote.sys执行!
|
||||
MOV [0x0ff0],CH ; IPLがどこまで読んだのかをメモ
|
||||
JMP 0xc200
|
||||
|
||||
error:
|
||||
MOV SI,msg
|
||||
|
||||
putloop:
|
||||
MOV AL,[SI]
|
||||
ADD SI,1 ; 给SI加1
|
||||
CMP AL,0
|
||||
JE fin
|
||||
MOV AH,0x0e ; 显示一个文字
|
||||
MOV BX,15 ; 指定字符颜色
|
||||
INT 0x10 ; 调用显卡BIOS
|
||||
JMP putloop
|
||||
|
||||
fin:
|
||||
HLT ; 让CPU停止,等待指令
|
||||
JMP fin ; 无限循环
|
||||
|
||||
msg:
|
||||
DB 0x0a, 0x0a ; 换行两次
|
||||
DB "load error"
|
||||
DB 0x0a ; 换行
|
||||
DB 0
|
||||
|
||||
RESB 0x7dfe-$ ; 填写0x00直到0x001fe
|
||||
|
||||
DB 0x55, 0xaa
|
||||
107
28_day/haribote/jp.nas
Normal file
107
28_day/haribote/jp.nas
Normal file
@@ -0,0 +1,107 @@
|
||||
; haribote-ipl
|
||||
; TAB=4
|
||||
|
||||
CYLS EQU 10 ; どこまで読み込むか
|
||||
|
||||
ORG 0x7c00 ; このプログラムがどこに読み込まれるのか
|
||||
|
||||
; 以下は標準的なFAT12フォーマットフロッピーディスクのための記述
|
||||
|
||||
JMP entry
|
||||
DB 0x90
|
||||
DB "HARIBOTE" ; ブートセクタの名前を自由に書いてよい(8バイト)
|
||||
DW 512 ; 1セクタの大きさ(512にしなければいけない)
|
||||
DB 1 ; クラスタの大きさ(1セクタにしなければいけない)
|
||||
DW 1 ; FATがどこから始まるか(普通は1セクタ目からにする)
|
||||
DB 2 ; FATの個数(2にしなければいけない)
|
||||
DW 224 ; ルートディレクトリ領域の大きさ(普通は224エントリにする)
|
||||
DW 2880 ; このドライブの大きさ(2880セクタにしなければいけない)
|
||||
DB 0xf0 ; メディアのタイプ(0xf0にしなければいけない)
|
||||
DW 9 ; FAT領域の長さ(9セクタにしなければいけない)
|
||||
DW 18 ; 1トラックにいくつのセクタがあるか(18にしなければいけない)
|
||||
DW 2 ; ヘッドの数(2にしなければいけない)
|
||||
DD 0 ; パーティションを使ってないのでここは必ず0
|
||||
DD 2880 ; このドライブ大きさをもう一度書く
|
||||
DB 0,0,0x29 ; よくわからないけどこの値にしておくといいらしい
|
||||
DD 0xffffffff ; たぶんボリュームシリアル番号
|
||||
DB "HARIBOTEOS " ; ディスクの名前(11バイト)
|
||||
DB "FAT12 " ; フォーマットの名前(8バイト)
|
||||
RESB 18 ; とりあえず18バイトあけておく
|
||||
|
||||
; プログラム本体
|
||||
|
||||
entry:
|
||||
MOV AX,0 ; レジスタ初期化
|
||||
MOV SS,AX
|
||||
MOV SP,0x7c00
|
||||
MOV DS,AX
|
||||
|
||||
; ディスクを読む
|
||||
|
||||
MOV AX,0x0820
|
||||
MOV ES,AX
|
||||
MOV CH,0 ; シリンダ0
|
||||
MOV DH,0 ; ヘッド0
|
||||
MOV CL,2 ; セクタ2
|
||||
readloop:
|
||||
MOV SI,0 ; 失敗回数を数えるレジスタ
|
||||
retry:
|
||||
MOV AH,0x02 ; AH=0x02 : ディスク読み込み
|
||||
MOV AL,1 ; 1セクタ
|
||||
MOV BX,0
|
||||
MOV DL,0x00 ; Aドライブ
|
||||
INT 0x13 ; ディスクBIOS呼び出し
|
||||
JNC next ; エラーがおきなければnextへ
|
||||
ADD SI,1 ; SIに1を足す
|
||||
CMP SI,5 ; SIと5を比較
|
||||
JAE error ; SI >= 5 だったらerrorへ
|
||||
MOV AH,0x00
|
||||
MOV DL,0x00 ; Aドライブ
|
||||
INT 0x13 ; ドライブのリセット
|
||||
JMP retry
|
||||
next:
|
||||
MOV AX,ES ; アドレスを0x200進める
|
||||
ADD AX,0x0020
|
||||
MOV ES,AX ; ADD ES,0x020 という命令がないのでこうしている
|
||||
ADD CL,1 ; CLに1を足す
|
||||
CMP CL,18 ; CLと18を比較
|
||||
JBE readloop ; CL <= 18 だったらreadloopへ
|
||||
MOV CL,1
|
||||
ADD DH,1
|
||||
CMP DH,2
|
||||
JB readloop ; DH < 2 だったらreadloopへ
|
||||
MOV DH,0
|
||||
ADD CH,1
|
||||
CMP CH,CYLS
|
||||
JB readloop ; CH < CYLS だったらreadloopへ
|
||||
|
||||
; 読み終わったのでharibote.sysを実行だ!
|
||||
|
||||
MOV [0x0ff0],CH ; IPLがどこまで読んだのかをメモ
|
||||
JMP 0xc200
|
||||
|
||||
error:
|
||||
MOV AX,0
|
||||
MOV ES,AX
|
||||
MOV SI,msg
|
||||
putloop:
|
||||
MOV AL,[SI]
|
||||
ADD SI,1 ; SIに1を足す
|
||||
CMP AL,0
|
||||
JE fin
|
||||
MOV AH,0x0e ; 一文字表示ファンクション
|
||||
MOV BX,15 ; カラーコード
|
||||
INT 0x10 ; ビデオBIOS呼び出し
|
||||
JMP putloop
|
||||
fin:
|
||||
HLT ; 何かあるまでCPUを停止させる
|
||||
JMP fin ; 無限ループ
|
||||
msg:
|
||||
DB 0x0a, 0x0a ; 改行を2つ
|
||||
DB "load error"
|
||||
DB 0x0a ; 改行
|
||||
DB 0
|
||||
|
||||
RESB 0x7dfe-$ ; 0x7dfeまでを0x00で埋める命令
|
||||
|
||||
DB 0x55, 0xaa
|
||||
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
29_day/!cons_9x.bat
Normal file
1
29_day/!cons_9x.bat
Normal file
@@ -0,0 +1 @@
|
||||
command
|
||||
1
29_day/!cons_nt.bat
Normal file
1
29_day/!cons_nt.bat
Normal file
@@ -0,0 +1 @@
|
||||
cmd.exe
|
||||
186
29_day/Makefile
Normal file
186
29_day/Makefile
Normal file
@@ -0,0 +1,186 @@
|
||||
TOOLPATH = ../z_tools/
|
||||
INCPATH = ../z_tools/haribote/
|
||||
|
||||
MAKE = $(TOOLPATH)make.exe -r
|
||||
EDIMG = $(TOOLPATH)edimg.exe
|
||||
IMGTOL = $(TOOLPATH)imgtol.com
|
||||
COPY = copy
|
||||
DEL = del
|
||||
|
||||
#默认动作
|
||||
|
||||
default :
|
||||
$(MAKE) haribote.img
|
||||
|
||||
#文件生成规则
|
||||
|
||||
haribote.img : haribote/ipl20.bin haribote/haribote.sys Makefile \
|
||||
a/a.hrb hello3/hello3.hrb hello4/hello4.hrb hello5/hello5.hrb \
|
||||
winhelo/winhelo.hrb winhelo2/winhelo2.hrb winhelo3/winhelo3.hrb \
|
||||
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 sosu2/sosu2.hrb sosu3/sosu3.hrb \
|
||||
type/type.hrb iroha/iroha.hrb chklang/chklang.hrb \
|
||||
notrec/notrec.hrb bball/bball.hrb invader/invader.hrb
|
||||
$(EDIMG) imgin:../z_tools/fdimg0at.tek \
|
||||
wbinimg src:haribote/ipl20.bin len:512 from:0 to:0 \
|
||||
copy from:haribote/haribote.sys to:@: \
|
||||
copy from:haribote/jp.nas to:@: \
|
||||
copy from:make.bat to:@: \
|
||||
copy from:a/a.hrb to:@: \
|
||||
copy from:hello3/hello3.hrb to:@: \
|
||||
copy from:hello4/hello4.hrb to:@: \
|
||||
copy from:hello5/hello5.hrb to:@: \
|
||||
copy from:winhelo/winhelo.hrb to:@: \
|
||||
copy from:winhelo2/winhelo2.hrb to:@: \
|
||||
copy from:winhelo3/winhelo3.hrb to:@: \
|
||||
copy from:star1/star1.hrb to:@: \
|
||||
copy from:stars/stars.hrb to:@: \
|
||||
copy from:stars2/stars2.hrb to:@: \
|
||||
copy from:lines/lines.hrb to:@: \
|
||||
copy from:walk/walk.hrb to:@: \
|
||||
copy from:noodle/noodle.hrb to:@: \
|
||||
copy from:beepdown/beepdown.hrb to:@: \
|
||||
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:type/type.hrb to:@: \
|
||||
copy from:iroha/iroha.hrb to:@: \
|
||||
copy from:chklang/chklang.hrb to:@: \
|
||||
copy from:euc.txt to:@: \
|
||||
copy from:notrec/notrec.hrb to:@: \
|
||||
copy from:bball/bball.hrb to:@: \
|
||||
copy from:invader/invader.hrb to:@: \
|
||||
copy from:nihongo/nihongo.fnt to:@: \
|
||||
imgout:haribote.img
|
||||
|
||||
#命令
|
||||
|
||||
run :
|
||||
$(MAKE) haribote.img
|
||||
$(COPY) haribote.img ..\z_tools\qemu\fdimage0.bin
|
||||
$(MAKE) -C ../z_tools/qemu
|
||||
|
||||
install :
|
||||
$(MAKE) haribote.img
|
||||
$(IMGTOL) w a: haribote.img
|
||||
|
||||
full :
|
||||
$(MAKE) -C haribote
|
||||
$(MAKE) -C apilib
|
||||
$(MAKE) -C stdlib
|
||||
$(MAKE) -C a
|
||||
$(MAKE) -C hello3
|
||||
$(MAKE) -C hello4
|
||||
$(MAKE) -C hello5
|
||||
$(MAKE) -C winhelo
|
||||
$(MAKE) -C winhelo2
|
||||
$(MAKE) -C winhelo3
|
||||
$(MAKE) -C star1
|
||||
$(MAKE) -C stars
|
||||
$(MAKE) -C stars2
|
||||
$(MAKE) -C lines
|
||||
$(MAKE) -C walk
|
||||
$(MAKE) -C noodle
|
||||
$(MAKE) -C beepdown
|
||||
$(MAKE) -C color
|
||||
$(MAKE) -C color2
|
||||
$(MAKE) -C sosu
|
||||
$(MAKE) -C sosu2
|
||||
$(MAKE) -C sosu3
|
||||
$(MAKE) -C type
|
||||
$(MAKE) -C iroha
|
||||
$(MAKE) -C chklang
|
||||
$(MAKE) -C notrec
|
||||
$(MAKE) -C bball
|
||||
$(MAKE) -C invader
|
||||
$(MAKE) haribote.img
|
||||
|
||||
run_full :
|
||||
$(MAKE) full
|
||||
$(COPY) haribote.img ..\z_tools\qemu\fdimage0.bin
|
||||
$(MAKE) -C ../z_tools/qemu
|
||||
|
||||
install_full :
|
||||
$(MAKE) full
|
||||
$(IMGTOL) w a: haribote.img
|
||||
|
||||
run_os :
|
||||
$(MAKE) -C haribote
|
||||
$(MAKE) run
|
||||
|
||||
clean :
|
||||
#不执行任何操作
|
||||
|
||||
src_only :
|
||||
$(MAKE) clean
|
||||
-$(DEL) haribote.img
|
||||
|
||||
clean_full :
|
||||
$(MAKE) -C haribote clean
|
||||
$(MAKE) -C apilib clean
|
||||
$(MAKE) -C stdlib clean
|
||||
$(MAKE) -C a clean
|
||||
$(MAKE) -C hello3 clean
|
||||
$(MAKE) -C hello4 clean
|
||||
$(MAKE) -C hello5 clean
|
||||
$(MAKE) -C winhelo clean
|
||||
$(MAKE) -C winhelo2 clean
|
||||
$(MAKE) -C winhelo3 clean
|
||||
$(MAKE) -C star1 clean
|
||||
$(MAKE) -C stars clean
|
||||
$(MAKE) -C stars2 clean
|
||||
$(MAKE) -C lines clean
|
||||
$(MAKE) -C walk clean
|
||||
$(MAKE) -C noodle clean
|
||||
$(MAKE) -C beepdown clean
|
||||
$(MAKE) -C color clean
|
||||
$(MAKE) -C color2 clean
|
||||
$(MAKE) -C sosu clean
|
||||
$(MAKE) -C sosu2 clean
|
||||
$(MAKE) -C sosu3 clean
|
||||
$(MAKE) -C type clean
|
||||
$(MAKE) -C iroha clean
|
||||
$(MAKE) -C chklang clean
|
||||
$(MAKE) -C notrec clean
|
||||
$(MAKE) -C bball clean
|
||||
$(MAKE) -C invader clean
|
||||
|
||||
src_only_full :
|
||||
$(MAKE) -C haribote src_only
|
||||
$(MAKE) -C apilib src_only
|
||||
$(MAKE) -C stdlib src_only
|
||||
$(MAKE) -C a src_only
|
||||
$(MAKE) -C hello3 src_only
|
||||
$(MAKE) -C hello4 src_only
|
||||
$(MAKE) -C hello5 src_only
|
||||
$(MAKE) -C winhelo src_only
|
||||
$(MAKE) -C winhelo2 src_only
|
||||
$(MAKE) -C winhelo3 src_only
|
||||
$(MAKE) -C star1 src_only
|
||||
$(MAKE) -C stars src_only
|
||||
$(MAKE) -C stars2 src_only
|
||||
$(MAKE) -C lines src_only
|
||||
$(MAKE) -C walk src_only
|
||||
$(MAKE) -C noodle src_only
|
||||
$(MAKE) -C beepdown src_only
|
||||
$(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 type src_only
|
||||
$(MAKE) -C iroha src_only
|
||||
$(MAKE) -C chklang src_only
|
||||
$(MAKE) -C notrec src_only
|
||||
$(MAKE) -C bball src_only
|
||||
$(MAKE) -C invader src_only
|
||||
-$(DEL) haribote.img
|
||||
|
||||
refresh :
|
||||
$(MAKE) full
|
||||
$(MAKE) clean_full
|
||||
-$(DEL) haribote.img
|
||||
1
29_day/a/!cons_9x.bat
Normal file
1
29_day/a/!cons_9x.bat
Normal file
@@ -0,0 +1 @@
|
||||
command
|
||||
1
29_day/a/!cons_nt.bat
Normal file
1
29_day/a/!cons_nt.bat
Normal file
@@ -0,0 +1 @@
|
||||
cmd.exe
|
||||
5
29_day/a/Makefile
Normal file
5
29_day/a/Makefile
Normal file
@@ -0,0 +1,5 @@
|
||||
APP = a
|
||||
STACK = 1k
|
||||
MALLOC = 0k
|
||||
|
||||
include ../app_make.txt
|
||||
7
29_day/a/a.c
Normal file
7
29_day/a/a.c
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "apilib.h"
|
||||
|
||||
void HariMain(void)
|
||||
{
|
||||
api_putchar('A');
|
||||
api_end();
|
||||
}
|
||||
1
29_day/a/make.bat
Normal file
1
29_day/a/make.bat
Normal file
@@ -0,0 +1 @@
|
||||
..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
27
29_day/apilib.h
Normal file
27
29_day/apilib.h
Normal file
@@ -0,0 +1,27 @@
|
||||
void api_putchar(int c);
|
||||
void api_putstr0(char *s);
|
||||
void api_putstr1(char *s, int l);
|
||||
void api_end(void);
|
||||
int api_openwin(char *buf, int xsiz, int ysiz, int col_inv, char *title);
|
||||
void api_putstrwin(int win, int x, int y, int col, int len, char *str);
|
||||
void api_boxfilwin(int win, int x0, int y0, int x1, int y1, int col);
|
||||
void api_initmalloc(void);
|
||||
char *api_malloc(int size);
|
||||
void api_free(char *addr, int size);
|
||||
void api_point(int win, int x, int y, int col);
|
||||
void api_refreshwin(int win, int x0, int y0, int x1, int y1);
|
||||
void api_linewin(int win, int x0, int y0, int x1, int y1, int col);
|
||||
void api_closewin(int win);
|
||||
int api_getkey(int mode);
|
||||
int api_alloctimer(void);
|
||||
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);
|
||||
int api_getlang(void);
|
||||
1
29_day/apilib/!cons_9x.bat
Normal file
1
29_day/apilib/!cons_9x.bat
Normal file
@@ -0,0 +1 @@
|
||||
command
|
||||
1
29_day/apilib/!cons_nt.bat
Normal file
1
29_day/apilib/!cons_nt.bat
Normal file
@@ -0,0 +1 @@
|
||||
cmd.exe
|
||||
48
29_day/apilib/Makefile
Normal file
48
29_day/apilib/Makefile
Normal file
@@ -0,0 +1,48 @@
|
||||
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 api021.obj api022.obj api023.obj api024.obj \
|
||||
api025.obj api026.obj api027.obj alloca.obj
|
||||
|
||||
TOOLPATH = ../../z_tools/
|
||||
INCPATH = ../../z_tools/haribote/
|
||||
|
||||
MAKE = $(TOOLPATH)make.exe -r
|
||||
NASK = $(TOOLPATH)nask.exe
|
||||
CC1 = $(TOOLPATH)cc1.exe -I$(INCPATH) -Os -Wall -quiet
|
||||
GAS2NASK = $(TOOLPATH)gas2nask.exe -a
|
||||
OBJ2BIM = $(TOOLPATH)obj2bim.exe
|
||||
MAKEFONT = $(TOOLPATH)makefont.exe
|
||||
BIN2OBJ = $(TOOLPATH)bin2obj.exe
|
||||
BIM2HRB = $(TOOLPATH)bim2hrb.exe
|
||||
RULEFILE = ../haribote.rul
|
||||
EDIMG = $(TOOLPATH)edimg.exe
|
||||
IMGTOL = $(TOOLPATH)imgtol.com
|
||||
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
|
||||
-$(DEL) *.obj
|
||||
|
||||
src_only :
|
||||
$(MAKE) clean
|
||||
-$(DEL) apilib.lib
|
||||
13
29_day/apilib/alloca.nas
Normal file
13
29_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
|
||||
14
29_day/apilib/api001.nas
Normal file
14
29_day/apilib/api001.nas
Normal file
@@ -0,0 +1,14 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api001.nas"]
|
||||
|
||||
GLOBAL _api_putchar
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_putchar: ; void api_putchar(int c);
|
||||
MOV EDX,1
|
||||
MOV AL,[ESP+4] ; c
|
||||
INT 0x40
|
||||
RET
|
||||
16
29_day/apilib/api002.nas
Normal file
16
29_day/apilib/api002.nas
Normal file
@@ -0,0 +1,16 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api002.nas"]
|
||||
|
||||
GLOBAL _api_putstr0
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_putstr0: ; void api_putstr0(char *s);
|
||||
PUSH EBX
|
||||
MOV EDX,2
|
||||
MOV EBX,[ESP+8] ; s
|
||||
INT 0x40
|
||||
POP EBX
|
||||
RET
|
||||
17
29_day/apilib/api003.nas
Normal file
17
29_day/apilib/api003.nas
Normal file
@@ -0,0 +1,17 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api003.nas"]
|
||||
|
||||
GLOBAL _api_putstr1
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_putstr1: ; void api_putstr1(char *s, int l);
|
||||
PUSH EBX
|
||||
MOV EDX,3
|
||||
MOV EBX,[ESP+ 8] ; s
|
||||
MOV ECX,[ESP+12] ; l
|
||||
INT 0x40
|
||||
POP EBX
|
||||
RET
|
||||
12
29_day/apilib/api004.nas
Normal file
12
29_day/apilib/api004.nas
Normal file
@@ -0,0 +1,12 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api004.nas"]
|
||||
|
||||
GLOBAL _api_end
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_end: ; void api_end(void);
|
||||
MOV EDX,4
|
||||
INT 0x40
|
||||
24
29_day/apilib/api005.nas
Normal file
24
29_day/apilib/api005.nas
Normal file
@@ -0,0 +1,24 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api005.nas"]
|
||||
|
||||
GLOBAL _api_openwin
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_openwin: ; int api_openwin(char *buf, int xsiz, int ysiz, int col_inv, char *title);
|
||||
PUSH EDI
|
||||
PUSH ESI
|
||||
PUSH EBX
|
||||
MOV EDX,5
|
||||
MOV EBX,[ESP+16] ; buf
|
||||
MOV ESI,[ESP+20] ; xsiz
|
||||
MOV EDI,[ESP+24] ; ysiz
|
||||
MOV EAX,[ESP+28] ; col_inv
|
||||
MOV ECX,[ESP+32] ; title
|
||||
INT 0x40
|
||||
POP EBX
|
||||
POP ESI
|
||||
POP EDI
|
||||
RET
|
||||
27
29_day/apilib/api006.nas
Normal file
27
29_day/apilib/api006.nas
Normal file
@@ -0,0 +1,27 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api006.nas"]
|
||||
|
||||
GLOBAL _api_putstrwin
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_putstrwin: ; void api_putstrwin(int win, int x, int y, int col, int len, char *str);
|
||||
PUSH EDI
|
||||
PUSH ESI
|
||||
PUSH EBP
|
||||
PUSH EBX
|
||||
MOV EDX,6
|
||||
MOV EBX,[ESP+20] ; win
|
||||
MOV ESI,[ESP+24] ; x
|
||||
MOV EDI,[ESP+28] ; y
|
||||
MOV EAX,[ESP+32] ; col
|
||||
MOV ECX,[ESP+36] ; len
|
||||
MOV EBP,[ESP+40] ; str
|
||||
INT 0x40
|
||||
POP EBX
|
||||
POP EBP
|
||||
POP ESI
|
||||
POP EDI
|
||||
RET
|
||||
27
29_day/apilib/api007.nas
Normal file
27
29_day/apilib/api007.nas
Normal file
@@ -0,0 +1,27 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api007.nas"]
|
||||
|
||||
GLOBAL _api_boxfilwin
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_boxfilwin: ; void api_boxfilwin(int win, int x0, int y0, int x1, int y1, int col);
|
||||
PUSH EDI
|
||||
PUSH ESI
|
||||
PUSH EBP
|
||||
PUSH EBX
|
||||
MOV EDX,7
|
||||
MOV EBX,[ESP+20] ; win
|
||||
MOV EAX,[ESP+24] ; x0
|
||||
MOV ECX,[ESP+28] ; y0
|
||||
MOV ESI,[ESP+32] ; x1
|
||||
MOV EDI,[ESP+36] ; y1
|
||||
MOV EBP,[ESP+40] ; col
|
||||
INT 0x40
|
||||
POP EBX
|
||||
POP EBP
|
||||
POP ESI
|
||||
POP EDI
|
||||
RET
|
||||
20
29_day/apilib/api008.nas
Normal file
20
29_day/apilib/api008.nas
Normal file
@@ -0,0 +1,20 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api008.nas"]
|
||||
|
||||
GLOBAL _api_initmalloc
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_initmalloc: ; void api_initmalloc(void);
|
||||
PUSH EBX
|
||||
MOV EDX,8
|
||||
MOV EBX,[CS:0x0020] ; malloc内存空间的地址
|
||||
MOV EAX,EBX
|
||||
ADD EAX,32*1024 ; 加上32KB
|
||||
MOV ECX,[CS:0x0000] ; 数据段的大小
|
||||
SUB ECX,EAX
|
||||
INT 0x40
|
||||
POP EBX
|
||||
RET
|
||||
17
29_day/apilib/api009.nas
Normal file
17
29_day/apilib/api009.nas
Normal file
@@ -0,0 +1,17 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api009.nas"]
|
||||
|
||||
GLOBAL _api_malloc
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_malloc: ; char *api_malloc(int size);
|
||||
PUSH EBX
|
||||
MOV EDX,9
|
||||
MOV EBX,[CS:0x0020]
|
||||
MOV ECX,[ESP+8] ; size
|
||||
INT 0x40
|
||||
POP EBX
|
||||
RET
|
||||
18
29_day/apilib/api010.nas
Normal file
18
29_day/apilib/api010.nas
Normal file
@@ -0,0 +1,18 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api010.nas"]
|
||||
|
||||
GLOBAL _api_free
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_free: ; void api_free(char *addr, int size);
|
||||
PUSH EBX
|
||||
MOV EDX,10
|
||||
MOV EBX,[CS:0x0020]
|
||||
MOV EAX,[ESP+ 8] ; addr
|
||||
MOV ECX,[ESP+12] ; size
|
||||
INT 0x40
|
||||
POP EBX
|
||||
RET
|
||||
23
29_day/apilib/api011.nas
Normal file
23
29_day/apilib/api011.nas
Normal file
@@ -0,0 +1,23 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api011.nas"]
|
||||
|
||||
GLOBAL _api_point
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_point: ; void api_point(int win, int x, int y, int col);
|
||||
PUSH EDI
|
||||
PUSH ESI
|
||||
PUSH EBX
|
||||
MOV EDX,11
|
||||
MOV EBX,[ESP+16] ; win
|
||||
MOV ESI,[ESP+20] ; x
|
||||
MOV EDI,[ESP+24] ; y
|
||||
MOV EAX,[ESP+28] ; col
|
||||
INT 0x40
|
||||
POP EBX
|
||||
POP ESI
|
||||
POP EDI
|
||||
RET
|
||||
24
29_day/apilib/api012.nas
Normal file
24
29_day/apilib/api012.nas
Normal file
@@ -0,0 +1,24 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api012.nas"]
|
||||
|
||||
GLOBAL _api_refreshwin
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_refreshwin: ; void api_refreshwin(int win, int x0, int y0, int x1, int y1);
|
||||
PUSH EDI
|
||||
PUSH ESI
|
||||
PUSH EBX
|
||||
MOV EDX,12
|
||||
MOV EBX,[ESP+16] ; win
|
||||
MOV EAX,[ESP+20] ; x0
|
||||
MOV ECX,[ESP+24] ; y0
|
||||
MOV ESI,[ESP+28] ; x1
|
||||
MOV EDI,[ESP+32] ; y1
|
||||
INT 0x40
|
||||
POP EBX
|
||||
POP ESI
|
||||
POP EDI
|
||||
RET
|
||||
27
29_day/apilib/api013.nas
Normal file
27
29_day/apilib/api013.nas
Normal file
@@ -0,0 +1,27 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api013.nas"]
|
||||
|
||||
GLOBAL _api_linewin
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_linewin: ; void api_linewin(int win, int x0, int y0, int x1, int y1, int col);
|
||||
PUSH EDI
|
||||
PUSH ESI
|
||||
PUSH EBP
|
||||
PUSH EBX
|
||||
MOV EDX,13
|
||||
MOV EBX,[ESP+20] ; win
|
||||
MOV EAX,[ESP+24] ; x0
|
||||
MOV ECX,[ESP+28] ; y0
|
||||
MOV ESI,[ESP+32] ; x1
|
||||
MOV EDI,[ESP+36] ; y1
|
||||
MOV EBP,[ESP+40] ; col
|
||||
INT 0x40
|
||||
POP EBX
|
||||
POP EBP
|
||||
POP ESI
|
||||
POP EDI
|
||||
RET
|
||||
16
29_day/apilib/api014.nas
Normal file
16
29_day/apilib/api014.nas
Normal file
@@ -0,0 +1,16 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api014.nas"]
|
||||
|
||||
GLOBAL _api_closewin
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_closewin: ; void api_closewin(int win);
|
||||
PUSH EBX
|
||||
MOV EDX,14
|
||||
MOV EBX,[ESP+8] ; win
|
||||
INT 0x40
|
||||
POP EBX
|
||||
RET
|
||||
14
29_day/apilib/api015.nas
Normal file
14
29_day/apilib/api015.nas
Normal file
@@ -0,0 +1,14 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api015.nas"]
|
||||
|
||||
GLOBAL _api_getkey
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_getkey: ; int api_getkey(int mode);
|
||||
MOV EDX,15
|
||||
MOV EAX,[ESP+4] ; mode
|
||||
INT 0x40
|
||||
RET
|
||||
13
29_day/apilib/api016.nas
Normal file
13
29_day/apilib/api016.nas
Normal file
@@ -0,0 +1,13 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api016.nas"]
|
||||
|
||||
GLOBAL _api_alloctimer
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_alloctimer: ; int api_alloctimer(void);
|
||||
MOV EDX,16
|
||||
INT 0x40
|
||||
RET
|
||||
17
29_day/apilib/api017.nas
Normal file
17
29_day/apilib/api017.nas
Normal file
@@ -0,0 +1,17 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api017.nas"]
|
||||
|
||||
GLOBAL _api_inittimer
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_inittimer: ; void api_inittimer(int timer, int data);
|
||||
PUSH EBX
|
||||
MOV EDX,17
|
||||
MOV EBX,[ESP+ 8] ; timer
|
||||
MOV EAX,[ESP+12] ; data
|
||||
INT 0x40
|
||||
POP EBX
|
||||
RET
|
||||
17
29_day/apilib/api018.nas
Normal file
17
29_day/apilib/api018.nas
Normal file
@@ -0,0 +1,17 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api018.nas"]
|
||||
|
||||
GLOBAL _api_settimer
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_settimer: ; void api_settimer(int timer, int time);
|
||||
PUSH EBX
|
||||
MOV EDX,18
|
||||
MOV EBX,[ESP+ 8] ; timer
|
||||
MOV EAX,[ESP+12] ; time
|
||||
INT 0x40
|
||||
POP EBX
|
||||
RET
|
||||
16
29_day/apilib/api019.nas
Normal file
16
29_day/apilib/api019.nas
Normal file
@@ -0,0 +1,16 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api019.nas"]
|
||||
|
||||
GLOBAL _api_freetimer
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_freetimer: ; void api_freetimer(int timer);
|
||||
PUSH EBX
|
||||
MOV EDX,19
|
||||
MOV EBX,[ESP+ 8] ; timer
|
||||
INT 0x40
|
||||
POP EBX
|
||||
RET
|
||||
14
29_day/apilib/api020.nas
Normal file
14
29_day/apilib/api020.nas
Normal file
@@ -0,0 +1,14 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api020.nas"]
|
||||
|
||||
GLOBAL _api_beep
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_beep: ; void api_beep(int tone);
|
||||
MOV EDX,20
|
||||
MOV EAX,[ESP+4] ; tone
|
||||
INT 0x40
|
||||
RET
|
||||
16
29_day/apilib/api021.nas
Normal file
16
29_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
29_day/apilib/api022.nas
Normal file
14
29_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
29_day/apilib/api023.nas
Normal file
18
29_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
29_day/apilib/api024.nas
Normal file
15
29_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
29_day/apilib/api025.nas
Normal file
18
29_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
29_day/apilib/api026.nas
Normal file
17
29_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
|
||||
13
29_day/apilib/api027.nas
Normal file
13
29_day/apilib/api027.nas
Normal file
@@ -0,0 +1,13 @@
|
||||
[FORMAT "WCOFF"]
|
||||
[INSTRSET "i486p"]
|
||||
[BITS 32]
|
||||
[FILE "api027.nas"]
|
||||
|
||||
GLOBAL _api_getlang
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
_api_getlang: ; int api_getlang(void);
|
||||
MOV EDX,27
|
||||
INT 0x40
|
||||
RET
|
||||
1
29_day/apilib/make.bat
Normal file
1
29_day/apilib/make.bat
Normal file
@@ -0,0 +1 @@
|
||||
..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
92
29_day/app_make.txt
Normal file
92
29_day/app_make.txt
Normal file
@@ -0,0 +1,92 @@
|
||||
TOOLPATH = ../../z_tools/
|
||||
INCPATH = ../../z_tools/haribote/
|
||||
APILIBPATH = ../apilib/
|
||||
STDLIBPATH = ../stdlib/
|
||||
HARIBOTEPATH = ../haribote/
|
||||
|
||||
MAKE = $(TOOLPATH)make.exe -r
|
||||
NASK = $(TOOLPATH)nask.exe
|
||||
CC1 = $(TOOLPATH)cc1.exe -I$(INCPATH) -I../ -Os -Wall -quiet
|
||||
GAS2NASK = $(TOOLPATH)gas2nask.exe -a
|
||||
OBJ2BIM = $(TOOLPATH)obj2bim.exe
|
||||
MAKEFONT = $(TOOLPATH)makefont.exe
|
||||
BIN2OBJ = $(TOOLPATH)bin2obj.exe
|
||||
BIM2HRB = $(TOOLPATH)bim2hrb.exe
|
||||
BIM2BIN = $(TOOLPATH)bim2bin.exe
|
||||
RULEFILE = ../haribote.rul
|
||||
EDIMG = $(TOOLPATH)edimg.exe
|
||||
IMGTOL = $(TOOLPATH)imgtol.com
|
||||
GOLIB = $(TOOLPATH)golib00.exe
|
||||
COPY = copy
|
||||
DEL = del
|
||||
|
||||
#默认动作
|
||||
|
||||
default :
|
||||
$(MAKE) $(APP).hrb
|
||||
|
||||
#文件生成规则
|
||||
|
||||
$(APP).bim : $(APP).obj $(APILIBPATH)apilib.lib $(STDLIBPATH)stdlib.lib Makefile ../app_make.txt
|
||||
$(OBJ2BIM) @$(RULEFILE) out:$(APP).bim map:$(APP).map stack:$(STACK) \
|
||||
$(APP).obj $(APILIBPATH)apilib.lib $(STDLIBPATH)stdlib.lib
|
||||
|
||||
$(STDAPP).bim : $(APP).obj $(STDLIBPATH)stdlib.lib Makefile ../app_make.txt
|
||||
$(OBJ2BIM) @$(RULEFILE) out:$(APP).bim map:$(APP).map stack:$(STACK) \
|
||||
$(APP).obj $(STDLIBPATH)stdlib.lib
|
||||
|
||||
haribote.img : ../haribote/ipl20.bin ../haribote/haribote.sys $(APP).hrb \
|
||||
Makefile ../app_make.txt
|
||||
$(EDIMG) imgin:../../z_tools/fdimg0at.tek \
|
||||
wbinimg src:../haribote/ipl20.bin len:512 from:0 to:0 \
|
||||
copy from:../haribote/haribote.sys to:@: \
|
||||
copy from:$(APP).hrb to:@: \
|
||||
copy from:../nihongo/nihongo.fnt to:@: \
|
||||
imgout:haribote.img
|
||||
|
||||
#一般规则
|
||||
|
||||
%.gas : %.c ../apilib.h ../stdlib.h Makefile ../app_make.txt
|
||||
$(CC1) -o $*.gas $*.c
|
||||
|
||||
%.nas : %.gas Makefile ../app_make.txt
|
||||
$(GAS2NASK) $*.gas $*.nas
|
||||
|
||||
%.obj : %.nas Makefile ../app_make.txt
|
||||
$(NASK) $*.nas $*.obj $*.lst
|
||||
|
||||
%.org : %.bim Makefile ../app_make.txt
|
||||
$(BIM2HRB) $*.bim $*.org $(MALLOC)
|
||||
|
||||
%.hrb : %.org Makefile ../app_make.txt
|
||||
$(BIM2BIN) -osacmp in:$*.org out:$*.hrb
|
||||
|
||||
#命令
|
||||
|
||||
run :
|
||||
$(MAKE) haribote.img
|
||||
$(COPY) haribote.img ..\..\z_tools\qemu\fdimage0.bin
|
||||
$(MAKE) -C ../../z_tools/qemu
|
||||
|
||||
full :
|
||||
$(MAKE) -C $(APILIBPATH)
|
||||
$(MAKE) -C $(STDLIBPATH)
|
||||
$(MAKE) $(APP).hrb
|
||||
|
||||
run_full :
|
||||
$(MAKE) -C $(APILIBPATH)
|
||||
$(MAKE) -C $(STDLIBPATH)
|
||||
$(MAKE) -C ../haribote
|
||||
$(MAKE) run
|
||||
|
||||
clean :
|
||||
-$(DEL) *.lst
|
||||
-$(DEL) *.obj
|
||||
-$(DEL) *.map
|
||||
-$(DEL) *.bim
|
||||
-$(DEL) *.org
|
||||
-$(DEL) haribote.img
|
||||
|
||||
src_only :
|
||||
$(MAKE) clean
|
||||
-$(DEL) $(APP).hrb
|
||||
1
29_day/bball/!cons_9x.bat
Normal file
1
29_day/bball/!cons_9x.bat
Normal file
@@ -0,0 +1 @@
|
||||
command
|
||||
1
29_day/bball/!cons_nt.bat
Normal file
1
29_day/bball/!cons_nt.bat
Normal file
@@ -0,0 +1 @@
|
||||
cmd.exe
|
||||
5
29_day/bball/Makefile
Normal file
5
29_day/bball/Makefile
Normal file
@@ -0,0 +1,5 @@
|
||||
APP = bball
|
||||
STACK = 52k
|
||||
MALLOC = 0k
|
||||
|
||||
include ../app_make.txt
|
||||
37
29_day/bball/bball.c
Normal file
37
29_day/bball/bball.c
Normal file
@@ -0,0 +1,37 @@
|
||||
#include "apilib.h"
|
||||
|
||||
void HariMain(void)
|
||||
{
|
||||
int win, i, j, dis;
|
||||
char buf[216 * 237];
|
||||
struct POINT {
|
||||
int x, y;
|
||||
};
|
||||
static struct POINT table[16] = {
|
||||
{ 204, 129 }, { 195, 90 }, { 172, 58 }, { 137, 38 }, { 98, 34 },
|
||||
{ 61, 46 }, { 31, 73 }, { 15, 110 }, { 15, 148 }, { 31, 185 },
|
||||
{ 61, 212 }, { 98, 224 }, { 137, 220 }, { 172, 200 }, { 195, 168 },
|
||||
{ 204, 129 }
|
||||
};
|
||||
|
||||
win = api_openwin(buf, 216, 237, -1, "bball");
|
||||
api_boxfilwin(win, 8, 29, 207, 228, 0);
|
||||
for (i = 0; i <= 14; i++) {
|
||||
for (j = i + 1; j <= 15; j++) {
|
||||
dis = j - i; /*两点间的距离*/
|
||||
if (dis >= 8) {
|
||||
dis = 15 - dis; /*逆向计数*/
|
||||
}
|
||||
if (dis != 0) {
|
||||
api_linewin(win, table[i].x, table[i].y, table[j].x, table[j].y, 8 - dis);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
if (api_getkey(1) == 0x0a) {
|
||||
break; /*按下回车键则break; */
|
||||
}
|
||||
}
|
||||
api_end();
|
||||
}
|
||||
1
29_day/bball/make.bat
Normal file
1
29_day/bball/make.bat
Normal file
@@ -0,0 +1 @@
|
||||
..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
1
29_day/beepdown/!cons_9x.bat
Normal file
1
29_day/beepdown/!cons_9x.bat
Normal file
@@ -0,0 +1 @@
|
||||
command
|
||||
1
29_day/beepdown/!cons_nt.bat
Normal file
1
29_day/beepdown/!cons_nt.bat
Normal file
@@ -0,0 +1 @@
|
||||
cmd.exe
|
||||
5
29_day/beepdown/Makefile
Normal file
5
29_day/beepdown/Makefile
Normal file
@@ -0,0 +1,5 @@
|
||||
APP = beepdown
|
||||
STACK = 1k
|
||||
MALLOC = 40k
|
||||
|
||||
include ../app_make.txt
|
||||
19
29_day/beepdown/beepdown.c
Normal file
19
29_day/beepdown/beepdown.c
Normal file
@@ -0,0 +1,19 @@
|
||||
#include "apilib.h"
|
||||
|
||||
void HariMain(void)
|
||||
{
|
||||
int i, timer;
|
||||
timer = api_alloctimer();
|
||||
api_inittimer(timer, 128);
|
||||
for (i = 20000000; i >= 20000; i -= i / 100) {
|
||||
/* 20KHz~20Hz,即人类可以听到的声音范围*/
|
||||
/* i以1%的速度递减*/
|
||||
api_beep(i);
|
||||
api_settimer(timer, 1); /* 0.01秒*/
|
||||
if (api_getkey(1) != 128) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
api_beep(0);
|
||||
api_end();
|
||||
}
|
||||
1
29_day/beepdown/make.bat
Normal file
1
29_day/beepdown/make.bat
Normal file
@@ -0,0 +1 @@
|
||||
..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
1
29_day/chklang/!cons_9x.bat
Normal file
1
29_day/chklang/!cons_9x.bat
Normal file
@@ -0,0 +1 @@
|
||||
command
|
||||
1
29_day/chklang/!cons_nt.bat
Normal file
1
29_day/chklang/!cons_nt.bat
Normal file
@@ -0,0 +1 @@
|
||||
cmd.exe
|
||||
5
29_day/chklang/Makefile
Normal file
5
29_day/chklang/Makefile
Normal file
@@ -0,0 +1,5 @@
|
||||
APP = chklang
|
||||
STACK = 1k
|
||||
MALLOC = 0k
|
||||
|
||||
include ../app_make.txt
|
||||
24
29_day/chklang/chklang.c
Normal file
24
29_day/chklang/chklang.c
Normal file
@@ -0,0 +1,24 @@
|
||||
#include "apilib.h"
|
||||
|
||||
void HariMain(void)
|
||||
{
|
||||
int langmode = api_getlang();
|
||||
static char s1[23] = { /* 日本語シフトJISモード(日文Shift-JIS模式)*/
|
||||
0x93, 0xfa, 0x96, 0x7b, 0x8c, 0xea, 0x83, 0x56, 0x83, 0x74, 0x83, 0x67,
|
||||
0x4a, 0x49, 0x53, 0x83, 0x82, 0x81, 0x5b, 0x83, 0x68, 0x0a, 0x00
|
||||
};
|
||||
static char s2[17] = { /*日本語EUCモード(日文EUC模式)*/
|
||||
0xc6, 0xfc, 0xcb, 0xdc, 0xb8, 0xec, 0x45, 0x55, 0x43, 0xa5, 0xe2, 0xa1,
|
||||
0xbc, 0xa5, 0xc9, 0x0a, 0x00
|
||||
};
|
||||
if (langmode == 0) {
|
||||
api_putstr0("English ASCII mode\n");
|
||||
}
|
||||
if (langmode == 1) {
|
||||
api_putstr0(s1);
|
||||
}
|
||||
if (langmode == 2) {
|
||||
api_putstr0(s2);
|
||||
}
|
||||
api_end();
|
||||
}
|
||||
1
29_day/chklang/make.bat
Normal file
1
29_day/chklang/make.bat
Normal file
@@ -0,0 +1 @@
|
||||
..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
1
29_day/color/!cons_9x.bat
Normal file
1
29_day/color/!cons_9x.bat
Normal file
@@ -0,0 +1 @@
|
||||
command
|
||||
1
29_day/color/!cons_nt.bat
Normal file
1
29_day/color/!cons_nt.bat
Normal file
@@ -0,0 +1 @@
|
||||
cmd.exe
|
||||
5
29_day/color/Makefile
Normal file
5
29_day/color/Makefile
Normal file
@@ -0,0 +1,5 @@
|
||||
APP = color
|
||||
STACK = 1k
|
||||
MALLOC = 56k
|
||||
|
||||
include ../app_make.txt
|
||||
21
29_day/color/color.c
Normal file
21
29_day/color/color.c
Normal file
@@ -0,0 +1,21 @@
|
||||
#include "apilib.h"
|
||||
|
||||
void HariMain(void)
|
||||
{
|
||||
char *buf;
|
||||
int win, x, y, r, g, b;
|
||||
api_initmalloc();
|
||||
buf = api_malloc(144 * 164);
|
||||
win = api_openwin(buf, 144, 164, -1, "color");
|
||||
for (y = 0; y < 128; y++) {
|
||||
for (x = 0; x < 128; x++) {
|
||||
r = x * 2;
|
||||
g = y * 2;
|
||||
b = 0;
|
||||
buf[(x + 8) + (y + 28) * 144] = 16 + (r / 43) + (g / 43) * 6 + (b / 43) * 36;
|
||||
}
|
||||
}
|
||||
api_refreshwin(win, 8, 28, 136, 156);
|
||||
api_getkey(1); /*等待按下任意键*/
|
||||
api_end();
|
||||
}
|
||||
1
29_day/color/make.bat
Normal file
1
29_day/color/make.bat
Normal file
@@ -0,0 +1 @@
|
||||
..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
1
29_day/color2/!cons_9x.bat
Normal file
1
29_day/color2/!cons_9x.bat
Normal file
@@ -0,0 +1 @@
|
||||
command
|
||||
1
29_day/color2/!cons_nt.bat
Normal file
1
29_day/color2/!cons_nt.bat
Normal file
@@ -0,0 +1 @@
|
||||
cmd.exe
|
||||
5
29_day/color2/Makefile
Normal file
5
29_day/color2/Makefile
Normal file
@@ -0,0 +1,5 @@
|
||||
APP = color2
|
||||
STACK = 1k
|
||||
MALLOC = 56k
|
||||
|
||||
include ../app_make.txt
|
||||
36
29_day/color2/color2.c
Normal file
36
29_day/color2/color2.c
Normal file
@@ -0,0 +1,36 @@
|
||||
#include "apilib.h"
|
||||
|
||||
unsigned char rgb2pal(int r, int g, int b, int x, int y);
|
||||
|
||||
void HariMain(void)
|
||||
{
|
||||
char *buf;
|
||||
int win, x, y;
|
||||
api_initmalloc();
|
||||
buf = api_malloc(144 * 164);
|
||||
win = api_openwin(buf, 144, 164, -1, "color2");
|
||||
for (y = 0; y < 128; y++) {
|
||||
for (x = 0; x < 128; x++) {
|
||||
buf[(x + 8) + (y + 28) * 144] = rgb2pal(x * 2, y * 2, 0, x, y);
|
||||
}
|
||||
}
|
||||
api_refreshwin(win, 8, 28, 136, 156);
|
||||
api_getkey(1); /* <20>Ă<EFBFBD><C482>Ƃ<EFBFBD><C682>ȃL<C883>[<5B><><EFBFBD>͂<EFBFBD>҂<EFBFBD> */
|
||||
api_end();
|
||||
}
|
||||
|
||||
unsigned char rgb2pal(int r, int g, int b, int x, int y)
|
||||
{
|
||||
static int table[4] = { 3, 1, 0, 2 };
|
||||
int i;
|
||||
x &= 1; /*判断是偶数还是奇数*/
|
||||
y &= 1;
|
||||
i = table[x + y * 2]; /*用来生成中间色的常量*/
|
||||
r = (r * 21) / 256; /* r为0~20*/
|
||||
g = (g * 21) / 256;
|
||||
b = (b * 21) / 256;
|
||||
r = (r + i) / 4; /* r为0~5*/
|
||||
g = (g + i) / 4;
|
||||
b = (b + i) / 4;
|
||||
return 16 + r + g * 6 + b * 36;
|
||||
}
|
||||
1
29_day/color2/make.bat
Normal file
1
29_day/color2/make.bat
Normal file
@@ -0,0 +1 @@
|
||||
..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
1
29_day/euc.txt
Normal file
1
29_day/euc.txt
Normal file
@@ -0,0 +1 @@
|
||||
日本語EUCで書いてみたよー
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user