This commit is contained in:
Yourtion
2016-05-10 14:31:35 +08:00
parent 7fca384104
commit dc29fff86f
5 changed files with 79 additions and 2 deletions

View File

@@ -113,9 +113,23 @@ winhelo3.bim : winhelo3.obj a_nask.obj Makefile
winhelo3.hrb : winhelo3.bim Makefile
$(BIM2HRB) winhelo3.bim winhelo3.hrb 40k
star1.bim : star1.obj a_nask.obj Makefile
$(OBJ2BIM) @$(RULEFILE) out:star1.bim stack:1k map:star1.map \
star1.obj a_nask.obj
star1.hrb : star1.bim Makefile
$(BIM2HRB) star1.bim star1.hrb 47k
stars.bim : stars.obj a_nask.obj Makefile
$(OBJ2BIM) @$(RULEFILE) out:stars.bim stack:1k map:stars.map \
stars.obj a_nask.obj
stars.hrb : stars.bim Makefile
$(BIM2HRB) stars.bim stars.hrb 47k
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
winhelo.hrb winhelo2.hrb winhelo3.hrb star1.hrb stars.hrb
$(EDIMG) imgin:../z_tools/fdimg0at.tek \
wbinimg src:ipl10.bin len:512 from:0 to:0 \
copy from:haribote.sys to:@: \
@@ -130,6 +144,8 @@ haribote.img : ipl10.bin haribote.sys Makefile \
copy from:winhelo.hrb to:@: \
copy from:winhelo2.hrb to:@: \
copy from:winhelo3.hrb to:@: \
copy from:star1.hrb to:@: \
copy from:stars.hrb to:@: \
imgout:haribote.img
# 其他指令

View File

@@ -12,6 +12,7 @@
GLOBAL _api_initmalloc
GLOBAL _api_malloc
GLOBAL _api_free
GLOBAL _api_point
[SECTION .text]
@@ -117,4 +118,18 @@ _api_free: ; void api_free(char *addr, int size);
INT 0x40
POP EBX
RET
_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

View File

@@ -354,6 +354,10 @@ int *hrb_api(int edi, int esi, int ebp, int esp, int ebx, int edx, int ecx, int
} else if (edx == 10) {
ecx = (ecx + 0x0f) & 0xfffffff0; /*以16字节为单位进位取整*/
memman_free((struct MEMMAN *) (ebx + ds_base), eax, ecx);
} else if (edx == 11) {
sht = (struct SHEET *) ebx;
sht->buf[sht->bxsize * edi + esi] = eax;
sheet_refresh(sht, esi, edi, esi + 1, edi + 1);
}
return 0;
}

18
23_day/star1.c Normal file
View File

@@ -0,0 +1,18 @@
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);
void HariMain(void)
{
char *buf;
int win;
api_initmalloc();
buf = api_malloc(150 * 100);
win = api_openwin(buf, 150, 100, -1, "star1");
api_boxfilwin(win, 6, 26, 143, 93, 0);/*黑色*/
api_point(win, 75, 59, 3);/*黄色*/
api_end();
}

24
23_day/stars.c Normal file
View File

@@ -0,0 +1,24 @@
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);
int rand(void); /*产生032767之间的随机数*/
void HariMain(void)
{
char *buf;
int win, i, x, y;
api_initmalloc();
buf = api_malloc(150 * 100);
win = api_openwin(buf, 150, 100, -1, "stars");
api_boxfilwin(win, 6, 26, 143, 93, 0);/*黑色*/
for (i = 0; i < 50; i++) {
x = (rand() % 137) + 6;
y = (rand() % 67) + 26;
api_point(win, x, y, 3);/*黄色*/
}
api_end();
}