mirror of
https://github.com/yourtion/30dayMakeOS.git
synced 2026-02-12 22:35:01 +08:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eadcb88a6c | ||
|
|
75a82443c1 |
@@ -80,12 +80,6 @@ hello5.bim : hello5.obj Makefile
|
|||||||
hello5.hrb : hello5.bim Makefile
|
hello5.hrb : hello5.bim Makefile
|
||||||
$(BIM2HRB) hello5.bim hello5.hrb 0
|
$(BIM2HRB) hello5.bim hello5.hrb 0
|
||||||
|
|
||||||
bug1.bim : bug1.obj Makefile
|
|
||||||
$(OBJ2BIM) @$(RULEFILE) out:bug1.bim map:bug1.map bug1.obj a_nask.obj
|
|
||||||
|
|
||||||
bug1.hrb : bug1.bim Makefile
|
|
||||||
$(BIM2HRB) bug1.bim bug1.hrb 0
|
|
||||||
|
|
||||||
bug2.bim : bug2.obj Makefile
|
bug2.bim : bug2.obj Makefile
|
||||||
$(OBJ2BIM) @$(RULEFILE) out:bug2.bim map:bug2.map bug2.obj
|
$(OBJ2BIM) @$(RULEFILE) out:bug2.bim map:bug2.map bug2.obj
|
||||||
|
|
||||||
@@ -98,9 +92,23 @@ bug3.bim : bug3.obj Makefile
|
|||||||
bug3.hrb : bug3.bim Makefile
|
bug3.hrb : bug3.bim Makefile
|
||||||
$(BIM2HRB) bug3.bim bug3.hrb 0
|
$(BIM2HRB) bug3.bim bug3.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
|
||||||
|
|
||||||
|
winhelo2.bim : winhelo2.obj a_nask.obj Makefile
|
||||||
|
$(OBJ2BIM) @$(RULEFILE) out:winhelo2.bim stack:1k map:winhelo2.map \
|
||||||
|
winhelo2.obj a_nask.obj
|
||||||
|
|
||||||
|
winhelo2.hrb : winhelo2.bim Makefile
|
||||||
|
$(BIM2HRB) winhelo2.bim winhelo2.hrb 0
|
||||||
|
|
||||||
haribote.img : ipl10.bin haribote.sys Makefile \
|
haribote.img : ipl10.bin haribote.sys Makefile \
|
||||||
hello.hrb hello2.hrb a.hrb hello3.hrb bug1.hrb bug2.hrb bug3.hrb \
|
hello.hrb hello2.hrb a.hrb hello3.hrb hello4.hrb hello5.hrb \
|
||||||
hello4.hrb hello5.hrb
|
winhelo.hrb winhelo2.hrb
|
||||||
$(EDIMG) imgin:../z_tools/fdimg0at.tek \
|
$(EDIMG) imgin:../z_tools/fdimg0at.tek \
|
||||||
wbinimg src:ipl10.bin len:512 from:0 to:0 \
|
wbinimg src:ipl10.bin len:512 from:0 to:0 \
|
||||||
copy from:haribote.sys to:@: \
|
copy from:haribote.sys to:@: \
|
||||||
@@ -110,11 +118,10 @@ haribote.img : ipl10.bin haribote.sys Makefile \
|
|||||||
copy from:hello2.hrb to:@: \
|
copy from:hello2.hrb to:@: \
|
||||||
copy from:a.hrb to:@: \
|
copy from:a.hrb to:@: \
|
||||||
copy from:hello3.hrb to:@: \
|
copy from:hello3.hrb to:@: \
|
||||||
copy from:bug1.hrb to:@: \
|
|
||||||
copy from:bug2.hrb to:@: \
|
|
||||||
copy from:bug3.hrb to:@: \
|
|
||||||
copy from:hello4.hrb to:@: \
|
copy from:hello4.hrb to:@: \
|
||||||
copy from:hello5.hrb to:@: \
|
copy from:hello5.hrb to:@: \
|
||||||
|
copy from:winhelo.hrb to:@: \
|
||||||
|
copy from:winhelo2.hrb to:@: \
|
||||||
imgout:haribote.img
|
imgout:haribote.img
|
||||||
|
|
||||||
# 其他指令
|
# 其他指令
|
||||||
|
|||||||
@@ -6,6 +6,9 @@
|
|||||||
GLOBAL _api_putchar
|
GLOBAL _api_putchar
|
||||||
GLOBAL _api_putstr0
|
GLOBAL _api_putstr0
|
||||||
GLOBAL _api_end
|
GLOBAL _api_end
|
||||||
|
GLOBAL _api_openwin
|
||||||
|
GLOBAL _api_putstrwin
|
||||||
|
GLOBAL _api_boxfilwin
|
||||||
|
|
||||||
[SECTION .text]
|
[SECTION .text]
|
||||||
|
|
||||||
@@ -26,3 +29,57 @@ _api_putstr0: ; void api_putstr0(char *s);
|
|||||||
_api_end: ; void api_end(void);
|
_api_end: ; void api_end(void);
|
||||||
MOV EDX,4
|
MOV EDX,4
|
||||||
INT 0x40
|
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
|
||||||
|
|
||||||
|
_api_putstrwin: ; void api_putstrwin(int win, int x, int y, int col, int len, char *str);
|
||||||
|
PUSH EDI
|
||||||
|
PUSH ESI
|
||||||
|
PUSH EBP
|
||||||
|
PUSH EBX
|
||||||
|
MOV EDX,6
|
||||||
|
MOV EBX,[ESP+20] ; win
|
||||||
|
MOV ESI,[ESP+24] ; x
|
||||||
|
MOV EDI,[ESP+28] ; y
|
||||||
|
MOV EAX,[ESP+32] ; col
|
||||||
|
MOV ECX,[ESP+36] ; len
|
||||||
|
MOV EBP,[ESP+40] ; str
|
||||||
|
INT 0x40
|
||||||
|
POP EBX
|
||||||
|
POP EBP
|
||||||
|
POP ESI
|
||||||
|
POP EDI
|
||||||
|
RET
|
||||||
|
|
||||||
|
_api_boxfilwin: ; void api_boxfilwin(int win, int x0, int y0, int x1, int y1, int col);
|
||||||
|
PUSH EDI
|
||||||
|
PUSH ESI
|
||||||
|
PUSH EBP
|
||||||
|
PUSH EBX
|
||||||
|
MOV EDX,7
|
||||||
|
MOV EBX,[ESP+20] ; win
|
||||||
|
MOV EAX,[ESP+24] ; x0
|
||||||
|
MOV ECX,[ESP+28] ; y0
|
||||||
|
MOV ESI,[ESP+32] ; x1
|
||||||
|
MOV EDI,[ESP+36] ; y1
|
||||||
|
MOV EBP,[ESP+40] ; col
|
||||||
|
INT 0x40
|
||||||
|
POP EBX
|
||||||
|
POP EBP
|
||||||
|
POP ESI
|
||||||
|
POP EDI
|
||||||
|
RET
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ void HariMain(void)
|
|||||||
task_a = task_init(memman);
|
task_a = task_init(memman);
|
||||||
fifo.task = task_a;
|
fifo.task = task_a;
|
||||||
task_run(task_a, 1, 2);
|
task_run(task_a, 1, 2);
|
||||||
|
*((int *) 0x0fe4) = (int) shtctl;
|
||||||
|
|
||||||
/* sht_back */
|
/* sht_back */
|
||||||
sht_back = sheet_alloc(shtctl);
|
sht_back = sheet_alloc(shtctl);
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
void api_putchar(int c);
|
|
||||||
void api_end(void);
|
|
||||||
|
|
||||||
void HariMain(void){
|
|
||||||
char a[100];
|
|
||||||
a[10] = 'A'; /*这句当然没有问题*/
|
|
||||||
api_putchar(a[10]);
|
|
||||||
a[102] = 'B'; /*这句就有问题了*/
|
|
||||||
api_putchar(a[102]);
|
|
||||||
a[123] = 'C'; /*这句也有问题了*/
|
|
||||||
api_putchar(a[123]);
|
|
||||||
api_end();
|
|
||||||
}
|
|
||||||
@@ -312,19 +312,38 @@ 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 *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 TASK *task = task_now();
|
||||||
struct CONSOLE *cons = (struct CONSOLE *) *((int *) 0x0fec);
|
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) {
|
if (edx == 1) {
|
||||||
cons_putchar(cons, eax & 0xff, 1);
|
cons_putchar(cons, eax & 0xff, 1);
|
||||||
} else if (edx == 2) {
|
} else if (edx == 2) {
|
||||||
cons_putstr0(cons, (char *) ebx + cs_base);
|
cons_putstr0(cons, (char *) ebx + ds_base);
|
||||||
} else if (edx == 3) {
|
} else if (edx == 3) {
|
||||||
cons_putstr1(cons, (char *) ebx + cs_base, ecx);
|
cons_putstr1(cons, (char *) ebx + ds_base, ecx);
|
||||||
} else if (edx == 4) {
|
} else if (edx == 4) {
|
||||||
return &(task->tss.esp0);
|
return &(task->tss.esp0);
|
||||||
} else if (edx == 123456789) {
|
} else if (edx == 5) {
|
||||||
*((char *) 0x00102600) = 0;
|
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;
|
||||||
|
} else if (edx == 6) {
|
||||||
|
sht = (struct SHEET *) ebx;
|
||||||
|
putfonts8_asc(sht->buf, sht->bxsize, esi, edi, eax, (char *) ebp + ds_base);
|
||||||
|
sheet_refresh(sht, esi, edi, esi + ecx * 8, edi + 16);
|
||||||
|
} else if (edx == 7) {
|
||||||
|
sht = (struct SHEET *) ebx;
|
||||||
|
boxfill8(sht->buf, sht->bxsize, ebp, eax, ecx, esi, edi);
|
||||||
|
sheet_refresh(sht, eax, ecx, esi + 1, edi + 1);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
11
22_day/winhelo.c
Normal file
11
22_day/winhelo.c
Normal 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();
|
||||||
|
}
|
||||||
15
22_day/winhelo2.c
Normal file
15
22_day/winhelo2.c
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
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);
|
||||||
|
|
||||||
|
char buf[150 * 50];
|
||||||
|
|
||||||
|
void HariMain(void)
|
||||||
|
{
|
||||||
|
int win;
|
||||||
|
win = api_openwin(buf, 150, 50, -1, "hello");
|
||||||
|
api_boxfilwin(win, 8, 36, 141, 43, 3); /*黄色*/
|
||||||
|
api_putstrwin(win, 28, 28, 0 /*黑色*/, 12, "hello, world");
|
||||||
|
api_end();
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user