This commit is contained in:
Yourtion
2016-05-17 12:57:21 +08:00
parent d63b8acd91
commit a1129763dd
20 changed files with 79 additions and 194 deletions

View File

@@ -21,15 +21,16 @@ BIM2HRB = $(TOOLPATH)bim2hrb.exe
RULEFILE = $(TOOLPATH)haribote/haribote.rul
EDIMG = $(TOOLPATH)edimg.exe
IMGTOL = $(TOOLPATH)imgtol.com
GOLIB = $(TOOLPATH)golib00.exe
COPY = copy
DEL = del
# 默认动作
# <EFBFBD>f<EFBFBD>t<EFBFBD>H<EFBFBD><EFBFBD><EFBFBD>g<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
default :
$(MAKE) img
# 镜像文件生成
# <EFBFBD>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>K<EFBFBD><4B>
ipl10.bin : ipl10.nas Makefile
$(NASK) ipl10.nas ipl10.bin ipl10.lst
@@ -54,27 +55,24 @@ bootpack.hrb : bootpack.bim Makefile
haribote.sys : asmhead.bin bootpack.hrb Makefile
copy /B asmhead.bin+bootpack.hrb haribote.sys
hello.hrb : hello.nas Makefile
$(NASK) hello.nas hello.hrb hello.lst
apilib.lib : Makefile $(OBJS_API)
$(GOLIB) $(OBJS_API) out:apilib.lib
hello2.hrb : hello2.nas Makefile
$(NASK) hello2.nas hello2.hrb hello2.lst
a.bim : a.obj $(OBJS_API) Makefile
$(OBJ2BIM) @$(RULEFILE) out:a.bim map:a.map a.obj $(OBJS_API)
a.bim : a.obj apilib.lib Makefile
$(OBJ2BIM) @$(RULEFILE) out:a.bim map:a.map a.obj apilib.lib
a.hrb : a.bim Makefile
$(BIM2HRB) a.bim a.hrb 0
hello3.bim : hello3.obj $(OBJS_API) Makefile
$(OBJ2BIM) @$(RULEFILE) out:hello3.bim map:hello3.map hello3.obj $(OBJS_API)
hello3.bim : hello3.obj apilib.lib Makefile
$(OBJ2BIM) @$(RULEFILE) out:hello3.bim map:hello3.map hello3.obj apilib.lib
hello3.hrb : hello3.bim Makefile
$(BIM2HRB) hello3.bim hello3.hrb 0
hello4.bim : hello4.obj $(OBJS_API) Makefile
hello4.bim : hello4.obj apilib.lib Makefile
$(OBJ2BIM) @$(RULEFILE) out:hello4.bim stack:1k map:hello4.map \
hello4.obj $(OBJS_API)
hello4.obj apilib.lib
hello4.hrb : hello4.bim Makefile
$(BIM2HRB) hello4.bim hello4.hrb 0
@@ -85,108 +83,99 @@ hello5.bim : hello5.obj Makefile
hello5.hrb : hello5.bim Makefile
$(BIM2HRB) hello5.bim hello5.hrb 0
winhelo.bim : winhelo.obj $(OBJS_API) Makefile
winhelo.bim : winhelo.obj apilib.lib Makefile
$(OBJ2BIM) @$(RULEFILE) out:winhelo.bim stack:1k map:winhelo.map \
winhelo.obj $(OBJS_API)
winhelo.obj apilib.lib
winhelo.hrb : winhelo.bim Makefile
$(BIM2HRB) winhelo.bim winhelo.hrb 0
winhelo2.bim : winhelo2.obj $(OBJS_API) Makefile
winhelo2.bim : winhelo2.obj apilib.lib Makefile
$(OBJ2BIM) @$(RULEFILE) out:winhelo2.bim stack:1k map:winhelo2.map \
winhelo2.obj $(OBJS_API)
winhelo2.obj apilib.lib
winhelo2.hrb : winhelo2.bim Makefile
$(BIM2HRB) winhelo2.bim winhelo2.hrb 0
winhelo3.bim : winhelo3.obj $(OBJS_API) Makefile
winhelo3.bim : winhelo3.obj apilib.lib Makefile
$(OBJ2BIM) @$(RULEFILE) out:winhelo3.bim stack:1k map:winhelo3.map \
winhelo3.obj $(OBJS_API)
winhelo3.obj apilib.lib
winhelo3.hrb : winhelo3.bim Makefile
$(BIM2HRB) winhelo3.bim winhelo3.hrb 40k
star1.bim : star1.obj $(OBJS_API) Makefile
star1.bim : star1.obj apilib.lib Makefile
$(OBJ2BIM) @$(RULEFILE) out:star1.bim stack:1k map:star1.map \
star1.obj $(OBJS_API)
star1.obj apilib.lib
star1.hrb : star1.bim Makefile
$(BIM2HRB) star1.bim star1.hrb 47k
stars.bim : stars.obj $(OBJS_API) Makefile
stars.bim : stars.obj apilib.lib Makefile
$(OBJ2BIM) @$(RULEFILE) out:stars.bim stack:1k map:stars.map \
stars.obj $(OBJS_API)
stars.obj apilib.lib
stars.hrb : stars.bim Makefile
$(BIM2HRB) stars.bim stars.hrb 47k
stars2.bim : stars2.obj $(OBJS_API) Makefile
stars2.bim : stars2.obj apilib.lib Makefile
$(OBJ2BIM) @$(RULEFILE) out:stars2.bim stack:1k map:stars2.map \
stars2.obj $(OBJS_API)
stars2.obj apilib.lib
stars2.hrb : stars2.bim Makefile
$(BIM2HRB) stars2.bim stars2.hrb 47k
lines.bim : lines.obj $(OBJS_API) Makefile
lines.bim : lines.obj apilib.lib Makefile
$(OBJ2BIM) @$(RULEFILE) out:lines.bim stack:1k map:lines.map \
lines.obj $(OBJS_API)
lines.obj apilib.lib
lines.hrb : lines.bim Makefile
$(BIM2HRB) lines.bim lines.hrb 48k
walk.bim : walk.obj $(OBJS_API) Makefile
walk.bim : walk.obj apilib.lib Makefile
$(OBJ2BIM) @$(RULEFILE) out:walk.bim stack:1k map:walk.map \
walk.obj $(OBJS_API)
walk.obj apilib.lib
walk.hrb : walk.bim Makefile
$(BIM2HRB) walk.bim walk.hrb 48k
noodle.bim : noodle.obj $(OBJS_API) Makefile
noodle.bim : noodle.obj apilib.lib Makefile
$(OBJ2BIM) @$(RULEFILE) out:noodle.bim stack:1k map:noodle.map \
noodle.obj $(OBJS_API)
noodle.obj apilib.lib
noodle.hrb : noodle.bim Makefile
$(BIM2HRB) noodle.bim noodle.hrb 40k
beepdown.bim : beepdown.obj $(OBJS_API) Makefile
beepdown.bim : beepdown.obj apilib.lib Makefile
$(OBJ2BIM) @$(RULEFILE) out:beepdown.bim stack:1k map:beepdown.map \
beepdown.obj $(OBJS_API)
beepdown.obj apilib.lib
beepdown.hrb : beepdown.bim Makefile
$(BIM2HRB) beepdown.bim beepdown.hrb 40k
color.bim : color.obj $(OBJS_API) Makefile
color.bim : color.obj apilib.lib Makefile
$(OBJ2BIM) @$(RULEFILE) out:color.bim stack:1k map:color.map \
color.obj $(OBJS_API)
color.obj apilib.lib
color.hrb : color.bim Makefile
$(BIM2HRB) color.bim color.hrb 56k
color2.bim : color2.obj $(OBJS_API) Makefile
color2.bim : color2.obj apilib.lib Makefile
$(OBJ2BIM) @$(RULEFILE) out:color2.bim stack:1k map:color2.map \
color2.obj $(OBJS_API)
color2.obj apilib.lib
color2.hrb : color2.bim Makefile
$(BIM2HRB) color2.bim color2.hrb 56k
crack7.bim : crack7.obj Makefile
$(OBJ2BIM) @$(RULEFILE) out:crack7.bim stack:1k map:crack7.map crack7.obj
crack7.hrb : crack7.bim Makefile
$(BIM2HRB) crack7.bim crack7.hrb 0k
haribote.img : ipl10.bin haribote.sys Makefile \
hello.hrb hello2.hrb a.hrb hello3.hrb hello4.hrb hello5.hrb \
winhelo.hrb winhelo2.hrb winhelo3.hrb star1.hrb stars.hrb stars2.hrb \
lines.hrb walk.hrb noodle.hrb beepdown.hrb color.hrb color2.hrb \
crack7.hrb
a.hrb hello3.hrb hello4.hrb hello5.hrb winhelo.hrb winhelo2.hrb \
winhelo3.hrb star1.hrb stars.hrb stars2.hrb lines.hrb walk.hrb \
noodle.hrb beepdown.hrb color.hrb color2.hrb
$(EDIMG) imgin:../z_tools/fdimg0at.tek \
wbinimg src:ipl10.bin len:512 from:0 to:0 \
copy from:haribote.sys to:@: \
copy from:ipl10.nas to:@: \
copy from:make.bat to:@: \
copy from:hello.hrb to:@: \
copy from:hello2.hrb to:@: \
copy from:a.hrb to:@: \
copy from:hello3.hrb to:@: \
copy from:hello4.hrb to:@: \
@@ -203,12 +192,11 @@ haribote.img : ipl10.bin haribote.sys Makefile \
copy from:beepdown.hrb to:@: \
copy from:color.hrb to:@: \
copy from:color2.hrb to:@: \
copy from:crack7.hrb to:@: \
imgout:haribote.img
# 其他指令
# <EFBFBD><EFBFBD><EFBFBD>ʋK<EFBFBD><EFBFBD>
%.gas : %.c bootpack.h Makefile
%.gas : %.c bootpack.h apilib.h Makefile
$(CC1) -o $*.gas $*.c
%.nas : %.gas Makefile
@@ -217,7 +205,7 @@ haribote.img : ipl10.bin haribote.sys Makefile \
%.obj : %.nas Makefile
$(NASK) $*.nas $*.obj $*.lst
# 运行程序
# <EFBFBD>R<EFBFBD>}<7D><><EFBFBD>h
img :
$(MAKE) haribote.img
@@ -239,6 +227,7 @@ clean :
-$(DEL) *.bim
-$(DEL) *.hrb
-$(DEL) haribote.sys
-$(DEL) apilib.lib
src_only :
$(MAKE) clean

View File

@@ -1,5 +1,4 @@
void api_putchar(int c);
void api_end(void);
#include "apilib.h"
void HariMain(void)
{

20
27_day/apilib.h Normal file
View File

@@ -0,0 +1,20 @@
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);

View File

@@ -1,9 +1,4 @@
void api_end(void);
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_beep(int tone);
#include "apilib.h"
void HariMain(void)
{

View File

@@ -1,10 +1,4 @@
int api_openwin(char *buf, int xsiz, int ysiz, int col_inv, char *title);
void api_initmalloc(void);
char *api_malloc(int size);
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);
int api_getkey(int mode);
void api_end(void);
#include "apilib.h"
void HariMain(void)
{

View File

@@ -1,10 +1,4 @@
int api_openwin(char *buf, int xsiz, int ysiz, int col_inv, char *title);
void api_initmalloc(void);
char *api_malloc(int size);
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);
int api_getkey(int mode);
void api_end(void);
#include "apilib.h"
unsigned char rgb2pal(int r, int g, int b, int x, int y);
@@ -21,7 +15,7 @@ void HariMain(void)
}
}
api_refreshwin(win, 8, 28, 136, 156);
api_getkey(1); /*等待按下任意键*/
api_getkey(1); /* <20>Ă<EFBFBD><C482>Ƃ<EFBFBD><C682>ȃL<C883>[<5B><><EFBFBD>͂<EFBFBD>҂<EFBFBD> */
api_end();
}

View File

@@ -1,28 +0,0 @@
[FORMAT "WCOFF"]
[INSTRSET "i486p"]
[BITS 32]
[FILE "crack7.nas"]
GLOBAL _HariMain
[SECTION .text]
_HariMain:
MOV AX,1005*8
MOV DS,AX
CMP DWORD [DS:0x0004],'Hari'
JNE fin ; 不是应用程序,因此不执行任何操作
MOV ECX,[DS:0x0000] ; 读取该应用程序数据段的大小
MOV AX,2005*8
MOV DS,AX
crackloop: ; 整个用123填充
ADD ECX,-1
MOV BYTE [DS:ECX],123
CMP ECX,0
JNE crackloop
fin: ; 结束
MOV EDX,4
INT 0x40

View File

@@ -1,16 +0,0 @@
[INSTRSET "i486p"]
[BITS 32]
MOV ECX,msg
MOV EDX,1
putloop:
MOV AL,[CS:ECX]
CMP AL,0
JE fin
INT 0x40
ADD ECX,1
JMP putloop
fin:
MOV EDX,4
INT 0x40
msg:
DB "hello",0

View File

@@ -1,9 +0,0 @@
[INSTRSET "i486p"]
[BITS 32]
MOV EDX,2
MOV EBX,msg
INT 0x40
MOV EDX,4
INT 0x40
msg:
DB "hello",0

View File

@@ -1,5 +1,4 @@
void api_putchar(int c);
void api_end(void);
#include "apilib.h"
void HariMain(void)
{

View File

@@ -1,5 +1,4 @@
void api_putstr0(char *s);
void api_end(void);
#include "apilib.h"
void HariMain(void)
{

View File

@@ -1,11 +1,4 @@
int api_openwin(char *buf, int xsiz, int ysiz, int col_inv, char *title);
void api_initmalloc(void);
char *api_malloc(int size);
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);
void api_end(void);
#include "apilib.h"
void HariMain(void)
{

View File

@@ -1,15 +1,5 @@
#include <stdio.h>
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);
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_end(void);
#include "apilib.h"
void HariMain(void)
{

View File

@@ -1,9 +1,4 @@
int api_openwin(char *buf, int xsiz, int ysiz, int col_inv, char *title);
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_point(int win, int x, int y, int col);
void api_end(void);
#include "apilib.h"
void HariMain(void)
{

View File

@@ -1,9 +1,4 @@
int api_openwin(char *buf, int xsiz, int ysiz, int col_inv, char *title);
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_point(int win, int x, int y, int col);
void api_end(void);
#include "apilib.h"
int rand(void); /*产生032767之间的随机数*/

View File

@@ -1,10 +1,4 @@
int api_openwin(char *buf, int xsiz, int ysiz, int col_inv, char *title);
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_point(int win, int x, int y, int col);
void api_refreshwin(int win, int x0, int y0, int x1, int y1);
void api_end(void);
#include "apilib.h"
int rand(void); /*产生032767的随机数*/

View File

@@ -1,13 +1,4 @@
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_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);
void api_end(void);
#include "apilib.h"
void HariMain(void)
{

View File

@@ -1,5 +1,4 @@
int api_openwin(char *buf, int xsiz, int ysiz, int col_inv, char *title);
void api_end(void);
#include "apilib.h"
char buf[150 * 50];

View File

@@ -1,7 +1,4 @@
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_end(void);
#include "apilib.h"
char buf[150 * 50];

View File

@@ -1,9 +1,4 @@
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_end(void);
#include "apilib.h"
void HariMain(void)
{
@@ -16,4 +11,4 @@ void HariMain(void)
api_boxfilwin(win, 8, 36, 141, 43, 6); /*浅蓝色*/
api_putstrwin(win, 28, 28, 0 , 12, "hello, world");/*黑色*/
api_end();
}
}