forked from backup/30dayMakeOS
刷新窗口
This commit is contained in:
@@ -127,9 +127,16 @@ stars.bim : stars.obj a_nask.obj Makefile
|
||||
stars.hrb : stars.bim Makefile
|
||||
$(BIM2HRB) stars.bim stars.hrb 47k
|
||||
|
||||
stars2.bim : stars2.obj a_nask.obj Makefile
|
||||
$(OBJ2BIM) @$(RULEFILE) out:stars2.bim stack:1k map:stars2.map \
|
||||
stars2.obj a_nask.obj
|
||||
|
||||
stars2.hrb : stars2.bim Makefile
|
||||
$(BIM2HRB) stars2.bim stars2.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 star1.hrb stars.hrb
|
||||
winhelo.hrb winhelo2.hrb winhelo3.hrb star1.hrb stars.hrb stars2.hrb
|
||||
$(EDIMG) imgin:../z_tools/fdimg0at.tek \
|
||||
wbinimg src:ipl10.bin len:512 from:0 to:0 \
|
||||
copy from:haribote.sys to:@: \
|
||||
@@ -146,6 +153,7 @@ haribote.img : ipl10.bin haribote.sys Makefile \
|
||||
copy from:winhelo3.hrb to:@: \
|
||||
copy from:star1.hrb to:@: \
|
||||
copy from:stars.hrb to:@: \
|
||||
copy from:stars2.hrb to:@: \
|
||||
imgout:haribote.img
|
||||
|
||||
# 其他指令
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
GLOBAL _api_malloc
|
||||
GLOBAL _api_free
|
||||
GLOBAL _api_point
|
||||
GLOBAL _api_refreshwin
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
@@ -133,3 +134,19 @@ _api_point: ; void api_point(int win, int x, int y, int col);
|
||||
POP ESI
|
||||
POP EDI
|
||||
RET
|
||||
|
||||
_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
|
||||
|
||||
@@ -337,13 +337,17 @@ int *hrb_api(int edi, int esi, int ebp, int esp, int ebx, int edx, int ecx, int
|
||||
sheet_updown(sht, 3); /*背景层高度3位于task_a之上*/
|
||||
reg[7] = (int) sht;
|
||||
} else if (edx == 6) {
|
||||
sht = (struct SHEET *) ebx;
|
||||
sht = (struct SHEET *) (ebx & 0xfffffffe);
|
||||
putfonts8_asc(sht->buf, sht->bxsize, esi, edi, eax, (char *) ebp + ds_base);
|
||||
sheet_refresh(sht, esi, edi, esi + ecx * 8, edi + 16);
|
||||
if ((ebx & 1) == 0) {
|
||||
sheet_refresh(sht, esi, edi, esi + ecx * 8, edi + 16);
|
||||
}
|
||||
} else if (edx == 7) {
|
||||
sht = (struct SHEET *) ebx;
|
||||
sht = (struct SHEET *) (ebx & 0xfffffffe);
|
||||
boxfill8(sht->buf, sht->bxsize, ebp, eax, ecx, esi, edi);
|
||||
sheet_refresh(sht, eax, ecx, esi + 1, edi + 1);
|
||||
if ((ebx & 1) == 0) {
|
||||
sheet_refresh(sht, eax, ecx, esi + 1, edi + 1);
|
||||
}
|
||||
} else if (edx == 8) {
|
||||
memman_init((struct MEMMAN *) (ebx + ds_base));
|
||||
ecx &= 0xfffffff0; /*以16字节为单位*/
|
||||
@@ -355,9 +359,14 @@ int *hrb_api(int edi, int esi, int ebp, int esp, int ebx, int edx, int ecx, int
|
||||
ecx = (ecx + 0x0f) & 0xfffffff0; /*以16字节为单位进位取整*/
|
||||
memman_free((struct MEMMAN *) (ebx + ds_base), eax, ecx);
|
||||
} else if (edx == 11) {
|
||||
sht = (struct SHEET *) ebx;
|
||||
sht = (struct SHEET *) (ebx & 0xfffffffe);
|
||||
sht->buf[sht->bxsize * edi + esi] = eax;
|
||||
sheet_refresh(sht, esi, edi, esi + 1, edi + 1);
|
||||
if ((ebx & 1) == 0) {
|
||||
sheet_refresh(sht, esi, edi, esi + 1, edi + 1);
|
||||
}
|
||||
} else if (edx == 12) {
|
||||
sht = (struct SHEET *) ebx;
|
||||
sheet_refresh(sht, eax, ecx, esi, edi);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
26
23_day/stars2.c
Normal file
26
23_day/stars2.c
Normal file
@@ -0,0 +1,26 @@
|
||||
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);
|
||||
|
||||
int rand(void); /*产生0~32767的随机数*/
|
||||
|
||||
void HariMain(void)
|
||||
{
|
||||
char *buf;
|
||||
int win, i, x, y;
|
||||
api_initmalloc();
|
||||
buf = api_malloc(150 * 100);
|
||||
win = api_openwin(buf, 150, 100, -1, "stars2");
|
||||
api_boxfilwin(win + 1, 6, 26, 143, 93, 0);/*黑色*/
|
||||
for (i = 0; i < 50; i++) {
|
||||
x = (rand() % 137) + 6;
|
||||
y = (rand() % 67) + 26;
|
||||
api_point(win + 1, x, y, 3);/*黄色*/
|
||||
}
|
||||
api_refreshwin(win, 6, 26, 144, 94);
|
||||
api_end();
|
||||
}
|
||||
Reference in New Issue
Block a user