mirror of
https://github.com/yourtion/30dayMakeOS.git
synced 2026-02-04 18:43:25 +08:00
Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
140774a293 | ||
|
|
7c2fc66927 | ||
|
|
636c1a8c3d | ||
|
|
c177821913 | ||
|
|
febac10ebf | ||
|
|
0e31ff06ca | ||
|
|
08d19d7512 | ||
|
|
b2d31a8e54 | ||
|
|
72532c8cd7 | ||
|
|
3871740126 | ||
|
|
70b335278d | ||
|
|
2c262f986d | ||
|
|
6b0457bed6 | ||
|
|
0adab9385e | ||
|
|
73b7421cf2 | ||
|
|
203dd63152 | ||
|
|
9df2b90ad3 |
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.
Binary file not shown.
@@ -21,8 +21,8 @@ haribote.img : haribote/ipl20.bin haribote/haribote.sys Makefile \
|
||||
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 iroha/iroha.hrb \
|
||||
chklang/chklang.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:@: \
|
||||
@@ -47,11 +47,13 @@ haribote.img : haribote/ipl20.bin haribote/haribote.sys Makefile \
|
||||
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: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
|
||||
|
||||
@@ -69,6 +71,7 @@ install :
|
||||
full :
|
||||
$(MAKE) -C haribote
|
||||
$(MAKE) -C apilib
|
||||
$(MAKE) -C stdlib
|
||||
$(MAKE) -C a
|
||||
$(MAKE) -C hello3
|
||||
$(MAKE) -C hello4
|
||||
@@ -88,10 +91,12 @@ full :
|
||||
$(MAKE) -C sosu
|
||||
$(MAKE) -C sosu2
|
||||
$(MAKE) -C sosu3
|
||||
$(MAKE) -C typeipl
|
||||
$(MAKE) -C type
|
||||
$(MAKE) -C iroha
|
||||
$(MAKE) -C chklang
|
||||
$(MAKE) -C notrec
|
||||
$(MAKE) -C bball
|
||||
$(MAKE) -C invader
|
||||
$(MAKE) haribote.img
|
||||
|
||||
run_full :
|
||||
@@ -116,57 +121,63 @@ 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 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 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 typeipl clean
|
||||
$(MAKE) -C type clean
|
||||
$(MAKE) -C iroha 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 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 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 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 iroha 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 :
|
||||
|
||||
Binary file not shown.
@@ -1,6 +1,7 @@
|
||||
TOOLPATH = ../../z_tools/
|
||||
INCPATH = ../../z_tools/haribote/
|
||||
APILIBPATH = ../apilib/
|
||||
STDLIBPATH = ../stdlib/
|
||||
HARIBOTEPATH = ../haribote/
|
||||
|
||||
MAKE = $(TOOLPATH)make.exe -r
|
||||
@@ -26,9 +27,13 @@ default :
|
||||
|
||||
#文件生成规则
|
||||
|
||||
$(APP).bim : $(APP).obj $(APILIBPATH)apilib.lib Makefile ../app_make.txt
|
||||
$(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
|
||||
$(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
|
||||
@@ -41,7 +46,7 @@ haribote.img : ../haribote/ipl20.bin ../haribote/haribote.sys $(APP).hrb \
|
||||
|
||||
#一般规则
|
||||
|
||||
%.gas : %.c ../apilib.h Makefile ../app_make.txt
|
||||
%.gas : %.c ../apilib.h ../stdlib.h Makefile ../app_make.txt
|
||||
$(CC1) -o $*.gas $*.c
|
||||
|
||||
%.nas : %.gas Makefile ../app_make.txt
|
||||
@@ -65,10 +70,12 @@ run :
|
||||
|
||||
full :
|
||||
$(MAKE) -C $(APILIBPATH)
|
||||
$(MAKE) -C $(STDLIBPATH)
|
||||
$(MAKE) $(APP).hrb
|
||||
|
||||
run_full :
|
||||
$(MAKE) -C $(APILIBPATH)
|
||||
$(MAKE) -C $(STDLIBPATH)
|
||||
$(MAKE) -C ../haribote
|
||||
$(MAKE) run
|
||||
|
||||
|
||||
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();
|
||||
}
|
||||
@@ -28,9 +28,6 @@ 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
|
||||
|
||||
@@ -78,6 +75,5 @@ clean :
|
||||
|
||||
src_only :
|
||||
$(MAKE) clean
|
||||
-$(DEL) ipl10.bin
|
||||
-$(DEL) ipl20.bin
|
||||
-$(DEL) haribote.sys
|
||||
|
||||
@@ -489,6 +489,16 @@ int *hrb_api(int edi, int esi, int ebp, int esp, int ebx, int edx, int ecx, int
|
||||
sht = (struct SHEET *) (ebx & 0xfffffffe);
|
||||
hrb_api_linewin(sht, eax, ecx, esi, edi, ebp);
|
||||
if ((ebx & 1) == 0) {
|
||||
if (eax > esi) {
|
||||
i = eax;
|
||||
eax = esi;
|
||||
esi = i;
|
||||
}
|
||||
if (ecx > edi) {
|
||||
i = ecx;
|
||||
ecx = edi;
|
||||
edi = i;
|
||||
}
|
||||
sheet_refresh(sht, eax, ecx, esi + 1, edi + 1);
|
||||
}
|
||||
} else if (edx == 14) {
|
||||
|
||||
Binary file not shown.
@@ -1,7 +1,7 @@
|
||||
; haribote-ipl
|
||||
; TAB=4
|
||||
|
||||
CYLS EQU 10 ; どこまで読み込むか
|
||||
CYLS EQU 20 ; どこまで読み込むか
|
||||
|
||||
ORG 0x7c00 ; このプログラムがどこに読み込まれるのか
|
||||
|
||||
|
||||
@@ -4,5 +4,5 @@ MALLOC = 0k
|
||||
|
||||
include ../app_make.txt
|
||||
|
||||
$(APP).hrb : $(APP).org Makefile
|
||||
$(STDAPP).hrb : $(APP).org Makefile
|
||||
$(COPY) $(APP).org $(APP).hrb
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "apilib.h"
|
||||
#include "stdlib.h"
|
||||
|
||||
void HariMain(void)
|
||||
{
|
||||
api_putstr0("hello, world\n");
|
||||
api_end();
|
||||
printf("hello, world : %s %d\n", "aaa", 10);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
1
29_day/invader/!cons_9x.bat
Normal file
1
29_day/invader/!cons_9x.bat
Normal file
@@ -0,0 +1 @@
|
||||
command
|
||||
1
29_day/invader/!cons_nt.bat
Normal file
1
29_day/invader/!cons_nt.bat
Normal file
@@ -0,0 +1 @@
|
||||
cmd.exe
|
||||
5
29_day/invader/Makefile
Normal file
5
29_day/invader/Makefile
Normal file
@@ -0,0 +1,5 @@
|
||||
APP = invader
|
||||
STACK = 90k
|
||||
MALLOC = 0k
|
||||
|
||||
include ../app_make.txt
|
||||
281
29_day/invader/invader.c
Normal file
281
29_day/invader/invader.c
Normal file
@@ -0,0 +1,281 @@
|
||||
#include <stdio.h> /* sprintf */
|
||||
#include <string.h> /* strlen */
|
||||
#include "apilib.h"
|
||||
|
||||
void putstr(int win, char *winbuf, int x, int y, int col, unsigned char *s);
|
||||
void wait(int i, int timer, char *keyflag);
|
||||
|
||||
static unsigned char charset[16 * 8] = {
|
||||
|
||||
/* invader(0) */
|
||||
0x00, 0x00, 0x00, 0x43, 0x5f, 0x5f, 0x5f, 0x7f,
|
||||
0x1f, 0x1f, 0x1f, 0x1f, 0x00, 0x20, 0x3f, 0x00,
|
||||
|
||||
/* invader(1) */
|
||||
0x00, 0x0f, 0x7f, 0xff, 0xcf, 0xcf, 0xcf, 0xff,
|
||||
0xff, 0xe0, 0xff, 0xff, 0xc0, 0xc0, 0xc0, 0x00,
|
||||
|
||||
/* invader(2) */
|
||||
0x00, 0xf0, 0xfe, 0xff, 0xf3, 0xf3, 0xf3, 0xff,
|
||||
0xff, 0x07, 0xff, 0xff, 0x03, 0x03, 0x03, 0x00,
|
||||
|
||||
/* invader(3) */
|
||||
0x00, 0x00, 0x00, 0xc2, 0xfa, 0xfa, 0xfa, 0xfe,
|
||||
0xf8, 0xf8, 0xf8, 0xf8, 0x00, 0x04, 0xfc, 0x00,
|
||||
|
||||
/* fighter(0) */
|
||||
0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x43, 0x47, 0x4f, 0x5f, 0x7f, 0x7f, 0x00,
|
||||
|
||||
/* fighter(1) */
|
||||
0x18, 0x7e, 0xff, 0xc3, 0xc3, 0xc3, 0xc3, 0xff,
|
||||
0xff, 0xff, 0xe7, 0xe7, 0xe7, 0xe7, 0xff, 0x00,
|
||||
|
||||
/* fighter(2) */
|
||||
0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||
0x80, 0xc2, 0xe2, 0xf2, 0xfa, 0xfe, 0xfe, 0x00,
|
||||
|
||||
/* laser */
|
||||
0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00
|
||||
};
|
||||
/* invader:"abcd", fighter:"efg", laser:"h" */
|
||||
|
||||
void HariMain(void)
|
||||
{
|
||||
/*
|
||||
fx:自机的x坐标(fighter_x)
|
||||
lx,ly:等离子炮弹的坐标(laser_x,laser_y)
|
||||
ix,iy:外星人群的坐标(invaders_x,in-vaders_y)
|
||||
idir:外星人群的移动方向(invaders_direc-tion)
|
||||
laserwait:等离子炮弹的剩余充电时间
|
||||
movewait:当这个变量变为0时外星人群前进一步
|
||||
movewait0:movewait的初始值(消灭30只敌人后减少)
|
||||
invline:外星人群的行数(invaders_line)
|
||||
score:当前得分
|
||||
high:最高得分
|
||||
point:得分的增加量(奖金的单价?)
|
||||
invstr:将外星人群的状态显示为字符串的变量
|
||||
*/
|
||||
|
||||
int win, timer, i, j, fx, laserwait, lx = 0, ly;
|
||||
int ix, iy, movewait0, movewait, idir;
|
||||
int invline, score, high, point;
|
||||
char winbuf[336 * 261], invstr[32 * 6], s[12], keyflag[4], *p;
|
||||
static char invstr0[32] = " abcd abcd abcd abcd abcd ";
|
||||
|
||||
win = api_openwin(winbuf, 336, 261, -1, "invader");
|
||||
api_boxfilwin(win, 6, 27, 329, 254, 0);
|
||||
timer = api_alloctimer();
|
||||
api_inittimer(timer, 128);
|
||||
|
||||
high = 0;
|
||||
putstr(win, winbuf, 22, 0, 7, "HIGH:00000000");
|
||||
|
||||
restart:
|
||||
score = 0;
|
||||
point = 1;
|
||||
putstr(win, winbuf, 4, 0, 7, "SCORE:00000000");
|
||||
movewait0 = 20;
|
||||
fx = 18;
|
||||
putstr(win, winbuf, fx, 13, 6, "efg");
|
||||
wait(100, timer, keyflag);
|
||||
|
||||
next_group:
|
||||
wait(100, timer, keyflag);
|
||||
ix = 7;
|
||||
iy = 1;
|
||||
invline = 6;
|
||||
for (i = 0; i < 6; i++) {
|
||||
for (j = 0; j < 27; j++) {
|
||||
invstr[i * 32 + j] = invstr0[j];
|
||||
}
|
||||
putstr(win, winbuf, ix, iy + i, 2, invstr + i * 32);
|
||||
}
|
||||
keyflag[0] = 0;
|
||||
keyflag[1] = 0;
|
||||
keyflag[2] = 0;
|
||||
|
||||
ly = 0; /*不显示*/
|
||||
laserwait = 0;
|
||||
movewait = movewait0;
|
||||
idir = +1;
|
||||
wait(100, timer, keyflag);
|
||||
|
||||
for (;;) {
|
||||
if (laserwait != 0) {
|
||||
laserwait--;
|
||||
keyflag[2 /* space */] = 0;
|
||||
}
|
||||
|
||||
wait(4, timer, keyflag);
|
||||
|
||||
/*自机的处理*/
|
||||
if (keyflag[0 /* left */] != 0 && fx > 0) {
|
||||
fx--;
|
||||
putstr(win, winbuf, fx, 13, 6, "efg ");
|
||||
keyflag[0 /* left */] = 0;
|
||||
}
|
||||
if (keyflag[1 /* right */] != 0 && fx < 37) {
|
||||
putstr(win, winbuf, fx, 13, 6, " efg");
|
||||
fx++;
|
||||
keyflag[1 /* right */] = 0;
|
||||
}
|
||||
if (keyflag[2 /* space */] != 0 && laserwait == 0) {
|
||||
laserwait = 15;
|
||||
lx = fx + 1;
|
||||
ly = 13;
|
||||
}
|
||||
|
||||
/*外星人移动*/
|
||||
if (movewait != 0) {
|
||||
movewait--;
|
||||
} else {
|
||||
movewait = movewait0;
|
||||
if (ix + idir > 14 || ix + idir < 0) {
|
||||
if (iy + invline == 13) {
|
||||
break; /* GAME OVER */
|
||||
}
|
||||
idir = - idir;
|
||||
putstr(win, winbuf, ix + 1, iy, 0, " ");
|
||||
iy++;
|
||||
} else {
|
||||
ix += idir;
|
||||
}
|
||||
for (i = 0; i < invline; i++) {
|
||||
putstr(win, winbuf, ix, iy + i, 2, invstr + i * 32);
|
||||
}
|
||||
}
|
||||
|
||||
/*炮弹处理*/
|
||||
if (ly > 0) {
|
||||
if (ly < 13) {
|
||||
if (ix < lx && lx < ix + 25 && iy <= ly && ly < iy + invline) {
|
||||
putstr(win, winbuf, ix, ly, 2, invstr + (ly - iy) * 32);
|
||||
} else {
|
||||
putstr(win, winbuf, lx, ly, 0, " ");
|
||||
}
|
||||
}
|
||||
ly--;
|
||||
if (ly > 0) {
|
||||
putstr(win, winbuf, lx, ly, 3, "h");
|
||||
} else {
|
||||
point -= 10;
|
||||
if (point <= 0) {
|
||||
point = 1;
|
||||
}
|
||||
}
|
||||
if (ix < lx && lx < ix + 25 && iy <= ly && ly < iy + invline) {
|
||||
p = invstr + (ly - iy) * 32 + (lx - ix);
|
||||
if (*p != ' ') {
|
||||
/* hit ! */
|
||||
score += point;
|
||||
point++;
|
||||
sprintf(s, "%08d", score);
|
||||
putstr(win, winbuf, 10, 0, 7, s);
|
||||
if (high < score) {
|
||||
high = score;
|
||||
putstr(win, winbuf, 27, 0, 7, s);
|
||||
}
|
||||
for (p--; *p != ' '; p--) { }
|
||||
for (i = 1; i < 5; i++) {
|
||||
p[i] = ' ';
|
||||
}
|
||||
putstr(win, winbuf, ix, ly, 2, invstr + (ly - iy) * 32);
|
||||
for (; invline > 0; invline--) {
|
||||
for (p = invstr + (invline - 1) * 32; *p != 0; p++) {
|
||||
if (*p != ' ') {
|
||||
goto alive;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*全部消灭*/
|
||||
movewait0 -= movewait0 / 3;
|
||||
goto next_group;
|
||||
alive:
|
||||
ly = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* GAME OVER */
|
||||
putstr(win, winbuf, 15, 6, 1, "GAME OVER");
|
||||
wait(0, timer, keyflag);
|
||||
for (i = 1; i < 14; i++) {
|
||||
putstr(win, winbuf, 0, i, 0, " ");
|
||||
}
|
||||
goto restart;
|
||||
}
|
||||
|
||||
void putstr(int win, char *winbuf, int x, int y, int col, unsigned char *s)
|
||||
{
|
||||
int c, x0, i;
|
||||
char *p, *q, t[2];
|
||||
x = x * 8 + 8;
|
||||
y = y * 16 + 29;
|
||||
x0 = x;
|
||||
i = strlen(s); /*计算s的字符数*/
|
||||
api_boxfilwin(win + 1, x, y, x + i * 8 - 1, y + 15, 0);
|
||||
q = winbuf + y * 336;
|
||||
t[1] = 0;
|
||||
for (;;) {
|
||||
c = *s;
|
||||
if (c == 0) {
|
||||
break;
|
||||
}
|
||||
if (c != ' ') {
|
||||
if ('a' <= c && c <= 'h') {
|
||||
p = charset + 16 * (c - 'a');
|
||||
q += x;
|
||||
for (i = 0; i < 16; i++) {
|
||||
if ((p[i] & 0x80) != 0) { q[0] = col; }
|
||||
if ((p[i] & 0x40) != 0) { q[1] = col; }
|
||||
if ((p[i] & 0x20) != 0) { q[2] = col; }
|
||||
if ((p[i] & 0x10) != 0) { q[3] = col; }
|
||||
if ((p[i] & 0x08) != 0) { q[4] = col; }
|
||||
if ((p[i] & 0x04) != 0) { q[5] = col; }
|
||||
if ((p[i] & 0x02) != 0) { q[6] = col; }
|
||||
if ((p[i] & 0x01) != 0) { q[7] = col; }
|
||||
q += 336;
|
||||
}
|
||||
q -= 336 * 16 + x;
|
||||
} else {
|
||||
t[0] = *s;
|
||||
api_putstrwin(win + 1, x, y, col, 1, t);
|
||||
}
|
||||
}
|
||||
s++;
|
||||
x += 8;
|
||||
}
|
||||
api_refreshwin(win, x0, y, x, y + 16);
|
||||
return;
|
||||
}
|
||||
|
||||
void wait(int i, int timer, char *keyflag)
|
||||
{
|
||||
int j;
|
||||
if (i > 0) {
|
||||
/*等待一段时间*/
|
||||
api_settimer(timer, i);
|
||||
i = 128;
|
||||
} else {
|
||||
i = 0x0a; /* Enter */
|
||||
}
|
||||
for (;;) {
|
||||
j = api_getkey(1);
|
||||
if (i == j) {
|
||||
break;
|
||||
}
|
||||
if (j == '4') {
|
||||
keyflag[0 /* left */] = 1;
|
||||
}
|
||||
if (j == '6') {
|
||||
keyflag[1 /* right */] = 1;
|
||||
}
|
||||
if (j == ' ') {
|
||||
keyflag[2 /* space */] = 1;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
1
29_day/invader/make.bat
Normal file
1
29_day/invader/make.bat
Normal file
@@ -0,0 +1 @@
|
||||
..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
1
29_day/notrec/!cons_9x.bat
Normal file
1
29_day/notrec/!cons_9x.bat
Normal file
@@ -0,0 +1 @@
|
||||
command
|
||||
1
29_day/notrec/!cons_nt.bat
Normal file
1
29_day/notrec/!cons_nt.bat
Normal file
@@ -0,0 +1 @@
|
||||
cmd.exe
|
||||
5
29_day/notrec/Makefile
Normal file
5
29_day/notrec/Makefile
Normal file
@@ -0,0 +1,5 @@
|
||||
APP = notrec
|
||||
STACK = 11k
|
||||
MALLOC = 0k
|
||||
|
||||
include ../app_make.txt
|
||||
1
29_day/notrec/make.bat
Normal file
1
29_day/notrec/make.bat
Normal file
@@ -0,0 +1 @@
|
||||
..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
17
29_day/notrec/notrec.c
Normal file
17
29_day/notrec/notrec.c
Normal file
@@ -0,0 +1,17 @@
|
||||
#include "apilib.h"
|
||||
|
||||
void HariMain(void)
|
||||
{
|
||||
int win;
|
||||
char buf[150 * 70];
|
||||
win = api_openwin(buf, 150, 70, 255, "notrec");
|
||||
api_boxfilwin(win, 0, 50, 34, 69, 255);
|
||||
api_boxfilwin(win, 115, 50, 149, 69, 255);
|
||||
api_boxfilwin(win, 50, 30, 99, 49, 255);
|
||||
for (;;) {
|
||||
if (api_getkey(1) == 0x0a) {
|
||||
break; /*按下回车键则break; */
|
||||
}
|
||||
}
|
||||
api_end();
|
||||
}
|
||||
4
29_day/stdlib.h
Normal file
4
29_day/stdlib.h
Normal file
@@ -0,0 +1,4 @@
|
||||
int putchar(int c);
|
||||
void exit(int status);
|
||||
int printf(char *format, ...);
|
||||
void *malloc(int size);
|
||||
1
29_day/stdlib/!cons_9x.bat
Normal file
1
29_day/stdlib/!cons_9x.bat
Normal file
@@ -0,0 +1 @@
|
||||
command
|
||||
1
29_day/stdlib/!cons_nt.bat
Normal file
1
29_day/stdlib/!cons_nt.bat
Normal file
@@ -0,0 +1 @@
|
||||
cmd.exe
|
||||
50
29_day/stdlib/Makefile
Normal file
50
29_day/stdlib/Makefile
Normal file
@@ -0,0 +1,50 @@
|
||||
OBJS_API = stdlib.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) stdlib.lib
|
||||
|
||||
#库生成规则
|
||||
|
||||
stdlib.lib : Makefile $(OBJS_API)
|
||||
$(GOLIB) $(OBJS_API) out:stdlib.lib
|
||||
|
||||
#文件生成规则
|
||||
|
||||
%.gas : %.c ../stdlib.h Makefile
|
||||
$(CC1) -o $*.gas $*.c
|
||||
|
||||
%.nas : %.gas Makefile
|
||||
$(GAS2NASK) $*.gas $*.nas
|
||||
|
||||
%.obj : %.nas Makefile
|
||||
$(NASK) $*.nas $*.obj $*.lst
|
||||
|
||||
#命令
|
||||
|
||||
clean :
|
||||
-$(DEL) *.lst
|
||||
-$(DEL) *.obj
|
||||
|
||||
src_only :
|
||||
$(MAKE) clean
|
||||
-$(DEL) stdlib.lib
|
||||
1
29_day/stdlib/make.bat
Normal file
1
29_day/stdlib/make.bat
Normal file
@@ -0,0 +1 @@
|
||||
..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
51
29_day/stdlib/stdlib.c
Normal file
51
29_day/stdlib/stdlib.c
Normal file
@@ -0,0 +1,51 @@
|
||||
#include "../apilib.h"
|
||||
#include "../stdlib.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
int putchar(int c)
|
||||
{
|
||||
api_putchar(c);
|
||||
return c;
|
||||
}
|
||||
|
||||
void exit(int status)
|
||||
{
|
||||
api_end();
|
||||
}
|
||||
|
||||
int printf(char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char s[1000];
|
||||
int i;
|
||||
|
||||
va_start(ap, format);
|
||||
i = vsprintf(s, format, ap);
|
||||
api_putstr0(s);
|
||||
va_end(ap);
|
||||
return i;
|
||||
}
|
||||
|
||||
void *malloc(int size)
|
||||
{
|
||||
char *p = api_malloc(size + 16);
|
||||
if (p != 0) {
|
||||
*((int *) p) = size;
|
||||
p += 16;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
void free(void *p)
|
||||
{
|
||||
char *q = p;
|
||||
int size;
|
||||
if (q != 0) {
|
||||
q -= 16;
|
||||
size = *((int *) q);
|
||||
api_free(q, size + 16);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
#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
30_day/!cons_9x.bat
Normal file
1
30_day/!cons_9x.bat
Normal file
@@ -0,0 +1 @@
|
||||
command
|
||||
1
30_day/!cons_nt.bat
Normal file
1
30_day/!cons_nt.bat
Normal file
@@ -0,0 +1 @@
|
||||
cmd.exe
|
||||
209
30_day/Makefile
Normal file
209
30_day/Makefile
Normal file
@@ -0,0 +1,209 @@
|
||||
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/ipl10.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 \
|
||||
calc/calc.hrb tview/tview.hrb mmlplay/mmlplay.hrb gview/gview.hrb
|
||||
$(EDIMG) imgin:../z_tools/fdimg0at.tek \
|
||||
wbinimg src:haribote/ipl10.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:calc/calc.hrb to:@: \
|
||||
copy from:tview/tview.hrb to:@: \
|
||||
copy from:mmlplay/mmlplay.hrb to:@: \
|
||||
copy from:mmldata/kirakira.mml to:@: \
|
||||
copy from:mmldata/fujisan.mml to:@: \
|
||||
copy from:mmldata/daigo.mml to:@: \
|
||||
copy from:mmldata/daiku.mml to:@: \
|
||||
copy from:gview/gview.hrb to:@: \
|
||||
copy from:pictdata/fujisan.jpg to:@: \
|
||||
copy from:pictdata/night.bmp 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) -C calc
|
||||
$(MAKE) -C tview
|
||||
$(MAKE) -C mmlplay
|
||||
$(MAKE) -C gview
|
||||
$(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
|
||||
$(MAKE) -C calc clean
|
||||
$(MAKE) -C tview clean
|
||||
$(MAKE) -C mmlplay clean
|
||||
$(MAKE) -C gview 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
|
||||
$(MAKE) -C calc src_only
|
||||
$(MAKE) -C tview src_only
|
||||
$(MAKE) -C mmlplay src_only
|
||||
$(MAKE) -C gview src_only
|
||||
-$(DEL) haribote.img
|
||||
|
||||
refresh :
|
||||
$(MAKE) full
|
||||
$(MAKE) clean_full
|
||||
-$(DEL) haribote.img
|
||||
1
30_day/a/!cons_9x.bat
Normal file
1
30_day/a/!cons_9x.bat
Normal file
@@ -0,0 +1 @@
|
||||
command
|
||||
1
30_day/a/!cons_nt.bat
Normal file
1
30_day/a/!cons_nt.bat
Normal file
@@ -0,0 +1 @@
|
||||
cmd.exe
|
||||
8
30_day/a/Makefile
Normal file
8
30_day/a/Makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
APP = a
|
||||
STACK = 1k
|
||||
MALLOC = 0k
|
||||
|
||||
include ../app_make.txt
|
||||
|
||||
$(APP).hrb : $(APP).org Makefile
|
||||
$(COPY) $(APP).org $(APP).hrb
|
||||
7
30_day/a/a.c
Normal file
7
30_day/a/a.c
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "apilib.h"
|
||||
|
||||
void HariMain(void)
|
||||
{
|
||||
api_putchar('A');
|
||||
api_end();
|
||||
}
|
||||
1
30_day/a/make.bat
Normal file
1
30_day/a/make.bat
Normal file
@@ -0,0 +1 @@
|
||||
..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
27
30_day/apilib.h
Normal file
27
30_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
30_day/apilib/!cons_9x.bat
Normal file
1
30_day/apilib/!cons_9x.bat
Normal file
@@ -0,0 +1 @@
|
||||
command
|
||||
1
30_day/apilib/!cons_nt.bat
Normal file
1
30_day/apilib/!cons_nt.bat
Normal file
@@ -0,0 +1 @@
|
||||
cmd.exe
|
||||
48
30_day/apilib/Makefile
Normal file
48
30_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
30_day/apilib/alloca.nas
Normal file
13
30_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
30_day/apilib/api001.nas
Normal file
14
30_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
30_day/apilib/api002.nas
Normal file
16
30_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
30_day/apilib/api003.nas
Normal file
17
30_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
30_day/apilib/api004.nas
Normal file
12
30_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
30_day/apilib/api005.nas
Normal file
24
30_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
30_day/apilib/api006.nas
Normal file
27
30_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
30_day/apilib/api007.nas
Normal file
27
30_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
30_day/apilib/api008.nas
Normal file
20
30_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
30_day/apilib/api009.nas
Normal file
17
30_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
30_day/apilib/api010.nas
Normal file
18
30_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
30_day/apilib/api011.nas
Normal file
23
30_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
30_day/apilib/api012.nas
Normal file
24
30_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
30_day/apilib/api013.nas
Normal file
27
30_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
30_day/apilib/api014.nas
Normal file
16
30_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
30_day/apilib/api015.nas
Normal file
14
30_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
30_day/apilib/api016.nas
Normal file
13
30_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
30_day/apilib/api017.nas
Normal file
17
30_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
30_day/apilib/api018.nas
Normal file
17
30_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
30_day/apilib/api019.nas
Normal file
16
30_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
30_day/apilib/api020.nas
Normal file
14
30_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
30_day/apilib/api021.nas
Normal file
16
30_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
30_day/apilib/api022.nas
Normal file
14
30_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
30_day/apilib/api023.nas
Normal file
18
30_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
30_day/apilib/api024.nas
Normal file
15
30_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
30_day/apilib/api025.nas
Normal file
18
30_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
30_day/apilib/api026.nas
Normal file
17
30_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
30_day/apilib/api027.nas
Normal file
13
30_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
30_day/apilib/make.bat
Normal file
1
30_day/apilib/make.bat
Normal file
@@ -0,0 +1 @@
|
||||
..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
92
30_day/app_make.txt
Normal file
92
30_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/ipl10.bin ../haribote/haribote.sys $(APP).hrb \
|
||||
Makefile ../app_make.txt
|
||||
$(EDIMG) imgin:../../z_tools/fdimg0at.tek \
|
||||
wbinimg src:../haribote/ipl10.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
30_day/bball/!cons_9x.bat
Normal file
1
30_day/bball/!cons_9x.bat
Normal file
@@ -0,0 +1 @@
|
||||
command
|
||||
1
30_day/bball/!cons_nt.bat
Normal file
1
30_day/bball/!cons_nt.bat
Normal file
@@ -0,0 +1 @@
|
||||
cmd.exe
|
||||
5
30_day/bball/Makefile
Normal file
5
30_day/bball/Makefile
Normal file
@@ -0,0 +1,5 @@
|
||||
APP = bball
|
||||
STACK = 52k
|
||||
MALLOC = 0k
|
||||
|
||||
include ../app_make.txt
|
||||
37
30_day/bball/bball.c
Normal file
37
30_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
30_day/bball/make.bat
Normal file
1
30_day/bball/make.bat
Normal file
@@ -0,0 +1 @@
|
||||
..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
1
30_day/beepdown/!cons_9x.bat
Normal file
1
30_day/beepdown/!cons_9x.bat
Normal file
@@ -0,0 +1 @@
|
||||
command
|
||||
1
30_day/beepdown/!cons_nt.bat
Normal file
1
30_day/beepdown/!cons_nt.bat
Normal file
@@ -0,0 +1 @@
|
||||
cmd.exe
|
||||
5
30_day/beepdown/Makefile
Normal file
5
30_day/beepdown/Makefile
Normal file
@@ -0,0 +1,5 @@
|
||||
APP = beepdown
|
||||
STACK = 1k
|
||||
MALLOC = 40k
|
||||
|
||||
include ../app_make.txt
|
||||
19
30_day/beepdown/beepdown.c
Normal file
19
30_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
30_day/beepdown/make.bat
Normal file
1
30_day/beepdown/make.bat
Normal file
@@ -0,0 +1 @@
|
||||
..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
1
30_day/calc/!cons_9x.bat
Normal file
1
30_day/calc/!cons_9x.bat
Normal file
@@ -0,0 +1 @@
|
||||
command
|
||||
1
30_day/calc/!cons_nt.bat
Normal file
1
30_day/calc/!cons_nt.bat
Normal file
@@ -0,0 +1 @@
|
||||
cmd.exe
|
||||
5
30_day/calc/Makefile
Normal file
5
30_day/calc/Makefile
Normal file
@@ -0,0 +1,5 @@
|
||||
APP = calc
|
||||
STACK = 4k
|
||||
MALLOC = 0k
|
||||
|
||||
include ../app_make.txt
|
||||
163
30_day/calc/calc.c
Normal file
163
30_day/calc/calc.c
Normal file
@@ -0,0 +1,163 @@
|
||||
#include "apilib.h"
|
||||
#include <stdio.h> /* sprintf */
|
||||
|
||||
#define INVALID -0x7fffffff
|
||||
|
||||
int strtol(char *s, char **endp, int base); /* 标准函数 <stdlib.h> */
|
||||
|
||||
char *skipspace(char *p);
|
||||
int getnum(char **pp, int priority);
|
||||
|
||||
void HariMain(void)
|
||||
{
|
||||
int i;
|
||||
char s[30], *p;
|
||||
|
||||
api_cmdline(s, 30);
|
||||
for (p = s; *p > ' '; p++) { } /* 一直读到空格为止 */
|
||||
i = getnum(&p, 9);
|
||||
if (i == INVALID) {
|
||||
api_putstr0("error!\n");
|
||||
} else {
|
||||
sprintf(s, "= %d = 0x%x\n", i, i);
|
||||
api_putstr0(s);
|
||||
}
|
||||
api_end();
|
||||
}
|
||||
|
||||
char *skipspace(char *p)
|
||||
{
|
||||
for (; *p == ' '; p++) { } /* 将空格跳过去 */
|
||||
return p;
|
||||
}
|
||||
|
||||
int getnum(char **pp, int priority)
|
||||
{
|
||||
char *p = *pp;
|
||||
int i = INVALID, j;
|
||||
p = skipspace(p);
|
||||
|
||||
/*单项运算符*/
|
||||
if (*p == '+') {
|
||||
p = skipspace(p + 1);
|
||||
i = getnum(&p, 0);
|
||||
} else if (*p == '-') {
|
||||
p = skipspace(p + 1);
|
||||
i = getnum(&p, 0);
|
||||
if (i != INVALID) {
|
||||
i = - i;
|
||||
}
|
||||
} else if (*p == '~') {
|
||||
p = skipspace(p + 1);
|
||||
i = getnum(&p, 0);
|
||||
if (i != INVALID) {
|
||||
i = ~i;
|
||||
}
|
||||
} else if (*p == '(') { /*括号*/
|
||||
p = skipspace(p + 1);
|
||||
i = getnum(&p, 9);
|
||||
if (*p == ')') {
|
||||
p = skipspace(p + 1);
|
||||
} else {
|
||||
i = INVALID;
|
||||
}
|
||||
} else if ('0' <= *p && *p <= '9') { /*数值*/
|
||||
i = strtol(p, &p, 0);
|
||||
} else { /*错误 */
|
||||
i = INVALID;
|
||||
}
|
||||
|
||||
/*二项运算符*/
|
||||
for (;;) {
|
||||
if (i == INVALID) {
|
||||
break;
|
||||
}
|
||||
p = skipspace(p);
|
||||
if (*p == '+' && priority > 2) {
|
||||
p = skipspace(p + 1);
|
||||
j = getnum(&p, 2);
|
||||
if (j != INVALID) {
|
||||
i += j;
|
||||
} else {
|
||||
i = INVALID;
|
||||
}
|
||||
} else if (*p == '-' && priority > 2) {
|
||||
p = skipspace(p + 1);
|
||||
j = getnum(&p, 2);
|
||||
if (j != INVALID) {
|
||||
i -= j;
|
||||
} else {
|
||||
i = INVALID;
|
||||
}
|
||||
} else if (*p == '*' && priority > 1) {
|
||||
p = skipspace(p + 1);
|
||||
j = getnum(&p, 1);
|
||||
if (j != INVALID) {
|
||||
i *= j;
|
||||
} else {
|
||||
i = INVALID;
|
||||
}
|
||||
} else if (*p == '/' && priority > 1) {
|
||||
p = skipspace(p + 1);
|
||||
j = getnum(&p, 1);
|
||||
if (j != INVALID && j != 0) {
|
||||
i /= j;
|
||||
} else {
|
||||
i = INVALID;
|
||||
}
|
||||
} else if (*p == '%' && priority > 1) {
|
||||
p = skipspace(p + 1);
|
||||
j = getnum(&p, 1);
|
||||
if (j != INVALID && j != 0) {
|
||||
i %= j;
|
||||
} else {
|
||||
i = INVALID;
|
||||
}
|
||||
} else if (*p == '<' && p[1] == '<' && priority > 3) {
|
||||
p = skipspace(p + 2);
|
||||
j = getnum(&p, 3);
|
||||
if (j != INVALID && j != 0) {
|
||||
i <<= j;
|
||||
} else {
|
||||
i = INVALID;
|
||||
}
|
||||
} else if (*p == '>' && p[1] == '>' && priority > 3) {
|
||||
p = skipspace(p + 2);
|
||||
j = getnum(&p, 3);
|
||||
if (j != INVALID && j != 0) {
|
||||
i >>= j;
|
||||
} else {
|
||||
i = INVALID;
|
||||
}
|
||||
} else if (*p == '&' && priority > 4) {
|
||||
p = skipspace(p + 1);
|
||||
j = getnum(&p, 4);
|
||||
if (j != INVALID) {
|
||||
i &= j;
|
||||
} else {
|
||||
i = INVALID;
|
||||
}
|
||||
} else if (*p == '^' && priority > 5) {
|
||||
p = skipspace(p + 1);
|
||||
j = getnum(&p, 5);
|
||||
if (j != INVALID) {
|
||||
i ^= j;
|
||||
} else {
|
||||
i = INVALID;
|
||||
}
|
||||
} else if (*p == '|' && priority > 6) {
|
||||
p = skipspace(p + 1);
|
||||
j = getnum(&p, 6);
|
||||
if (j != INVALID) {
|
||||
i |= j;
|
||||
} else {
|
||||
i = INVALID;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
p = skipspace(p);
|
||||
*pp = p;
|
||||
return i;
|
||||
}
|
||||
1
30_day/calc/make.bat
Normal file
1
30_day/calc/make.bat
Normal file
@@ -0,0 +1 @@
|
||||
..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
1
30_day/chklang/!cons_9x.bat
Normal file
1
30_day/chklang/!cons_9x.bat
Normal file
@@ -0,0 +1 @@
|
||||
command
|
||||
1
30_day/chklang/!cons_nt.bat
Normal file
1
30_day/chklang/!cons_nt.bat
Normal file
@@ -0,0 +1 @@
|
||||
cmd.exe
|
||||
@@ -1,4 +1,4 @@
|
||||
APP = typeipl
|
||||
APP = chklang
|
||||
STACK = 1k
|
||||
MALLOC = 0k
|
||||
|
||||
24
30_day/chklang/chklang.c
Normal file
24
30_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
30_day/chklang/make.bat
Normal file
1
30_day/chklang/make.bat
Normal file
@@ -0,0 +1 @@
|
||||
..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
1
30_day/color/!cons_9x.bat
Normal file
1
30_day/color/!cons_9x.bat
Normal file
@@ -0,0 +1 @@
|
||||
command
|
||||
1
30_day/color/!cons_nt.bat
Normal file
1
30_day/color/!cons_nt.bat
Normal file
@@ -0,0 +1 @@
|
||||
cmd.exe
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user