显示窗口

This commit is contained in:
Yourtion
2016-05-09 18:34:09 +08:00
parent 02980d3422
commit 75a82443c1
5 changed files with 54 additions and 6 deletions

View File

@@ -80,6 +80,13 @@ hello5.bim : hello5.obj Makefile
hello5.hrb : hello5.bim Makefile
$(BIM2HRB) hello5.bim hello5.hrb 0
winhelo.bim : winhelo.obj a_nask.obj Makefile
$(OBJ2BIM) @$(RULEFILE) out:winhelo.bim stack:1k map:winhelo.map \
winhelo.obj a_nask.obj
winhelo.hrb : winhelo.bim Makefile
$(BIM2HRB) winhelo.bim winhelo.hrb 0
bug1.bim : bug1.obj Makefile
$(OBJ2BIM) @$(RULEFILE) out:bug1.bim map:bug1.map bug1.obj a_nask.obj
@@ -100,7 +107,7 @@ bug3.hrb : bug3.bim Makefile
haribote.img : ipl10.bin haribote.sys Makefile \
hello.hrb hello2.hrb a.hrb hello3.hrb bug1.hrb bug2.hrb bug3.hrb \
hello4.hrb hello5.hrb
hello4.hrb hello5.hrb winhelo.hrb
$(EDIMG) imgin:../z_tools/fdimg0at.tek \
wbinimg src:ipl10.bin len:512 from:0 to:0 \
copy from:haribote.sys to:@: \
@@ -115,6 +122,7 @@ haribote.img : ipl10.bin haribote.sys Makefile \
copy from:bug3.hrb to:@: \
copy from:hello4.hrb to:@: \
copy from:hello5.hrb to:@: \
copy from:winhelo.hrb to:@: \
imgout:haribote.img
# 其他指令

View File

@@ -6,6 +6,7 @@
GLOBAL _api_putchar
GLOBAL _api_putstr0
GLOBAL _api_end
GLOBAL _api_openwin
[SECTION .text]
@@ -26,3 +27,19 @@ _api_putstr0: ; void api_putstr0(char *s);
_api_end: ; void api_end(void);
MOV EDX,4
INT 0x40
_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

View File

@@ -64,6 +64,7 @@ void HariMain(void)
task_a = task_init(memman);
fifo.task = task_a;
task_run(task_a, 1, 2);
*((int *) 0x0fe4) = (int) shtctl;
/* sht_back */
sht_back = sheet_alloc(shtctl);

View File

@@ -312,19 +312,30 @@ int cmd_app(struct CONSOLE *cons, int *fat, char *cmdline)
int *hrb_api(int edi, int esi, int ebp, int esp, int ebx, int edx, int ecx, int eax)
{
int cs_base = *((int *) 0xfe8);
int ds_base = *((int *) 0xfe8);
struct TASK *task = task_now();
struct CONSOLE *cons = (struct CONSOLE *) *((int *) 0x0fec);
struct SHTCTL *shtctl = (struct SHTCTL *) *((int *) 0x0fe4);
struct SHEET *sht;
int *reg = &eax + 1; /* eax后面的地址*/
/*强行改写通过PUSHAD保存的值*/
/* reg[0] : EDI, reg[1] : ESI, reg[2] : EBP, reg[3] : ESP */
/* reg[4] : EBX, reg[5] : EDX, reg[6] : ECX, reg[7] : EAX */
if (edx == 1) {
cons_putchar(cons, eax & 0xff, 1);
} else if (edx == 2) {
cons_putstr0(cons, (char *) ebx + cs_base);
cons_putstr0(cons, (char *) ebx + ds_base);
} else if (edx == 3) {
cons_putstr1(cons, (char *) ebx + cs_base, ecx);
cons_putstr1(cons, (char *) ebx + ds_base, ecx);
} else if (edx == 4) {
return &(task->tss.esp0);
} else if (edx == 123456789) {
*((char *) 0x00102600) = 0;
} else if (edx == 5) {
sht = sheet_alloc(shtctl);
sheet_setbuf(sht, (char *) ebx + ds_base, esi, edi, eax);
make_window8((char *) ebx + ds_base, esi, edi, (char *) ecx + ds_base, 0);
sheet_slide(sht, 100, 50);
sheet_updown(sht, 3); /*背景层高度3位于task_a之上*/
reg[7] = (int) sht;
}
return 0;
}

11
22_day/winhelo.c Normal file
View File

@@ -0,0 +1,11 @@
int api_openwin(char *buf, int xsiz, int ysiz, int col_inv, char *title);
void api_end(void);
char buf[150 * 50];
void HariMain(void)
{
int win;
win = api_openwin(buf, 150, 50, -1, "hello");
api_end();
}