Skip to content

Commit

Permalink
Add 30 day code
Browse files Browse the repository at this point in the history
  • Loading branch information
yourtion committed May 20, 2016
1 parent 6b0457b commit 2c262f9
Show file tree
Hide file tree
Showing 204 changed files with 12,259 additions and 0 deletions.
1 change: 1 addition & 0 deletions 30_day/!cons_9x.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
command
1 change: 1 addition & 0 deletions 30_day/!cons_nt.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cmd.exe
183 changes: 183 additions & 0 deletions 30_day/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
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 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 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 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 change: 1 addition & 0 deletions 30_day/a/!cons_9x.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
command
1 change: 1 addition & 0 deletions 30_day/a/!cons_nt.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cmd.exe
5 changes: 5 additions & 0 deletions 30_day/a/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
APP = a
STACK = 1k
MALLOC = 0k

include ../app_make.txt
7 changes: 7 additions & 0 deletions 30_day/a/a.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "apilib.h"

void HariMain(void)
{
api_putchar('A');
api_end();
}
1 change: 1 addition & 0 deletions 30_day/a/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
27 changes: 27 additions & 0 deletions 30_day/apilib.h
Original file line number Diff line number Diff line change
@@ -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 change: 1 addition & 0 deletions 30_day/apilib/!cons_9x.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
command
1 change: 1 addition & 0 deletions 30_day/apilib/!cons_nt.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cmd.exe
48 changes: 48 additions & 0 deletions 30_day/apilib/Makefile
Original file line number Diff line number Diff line change
@@ -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 changes: 13 additions & 0 deletions 30_day/apilib/alloca.nas
Original file line number Diff line number Diff line change
@@ -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 changes: 14 additions & 0 deletions 30_day/apilib/api001.nas
Original file line number Diff line number Diff line change
@@ -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 changes: 16 additions & 0 deletions 30_day/apilib/api002.nas
Original file line number Diff line number Diff line change
@@ -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 changes: 17 additions & 0 deletions 30_day/apilib/api003.nas
Original file line number Diff line number Diff line change
@@ -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 changes: 12 additions & 0 deletions 30_day/apilib/api004.nas
Original file line number Diff line number Diff line change
@@ -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 changes: 24 additions & 0 deletions 30_day/apilib/api005.nas
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit 2c262f9

Please sign in to comment.