void load_background(int number) { #if PSP_VIDEO_32BPP int found = 0; if (bgimage_type == BG_DEFAULT || bgimage_type == BG_USER) { found = load_png(NULL, number); } else if (bgimage_type == BG_LOGOONLY) { found = load_png(NULL, WP_LOGO); } if (!found) { boxfill(0, 0, 479, 271, COLOR_BLACK); boxfill_alpha(0, 0, 479, 271, UI_COLOR(UI_PAL_BG2), 15 * bgimage_blightness / 100); } #else ui_fill_frame(draw_frame, UI_PAL_BG2); #endif draw_bar_shadow(); boxfill_alpha(0, 0, 479, 23, UI_COLOR(UI_PAL_BG1), 10); hline_alpha(0, 479, 23, UI_COLOR(UI_PAL_FRAME), 12); hline_alpha(0, 479, 24, UI_COLOR(UI_PAL_FRAME), 10); video_copy_rect(draw_frame, work_frame, &full_rect, &full_rect); }
//interrupt service procedure for keyboard void inthandler21(int *esp) { struct boot_info *binfo=(struct boot_info *)ADDR_BOOT; boxfill(0,0,0,32*8-1,15);//一个黑色的小box puts8((char *)binfo->vram ,binfo->xsize,0,0,7,"int 21(IRQ-1):PS/2 keyboard"); while(1) io_halt(); }
void gui_boxfill_rect(GUIRect *r, uchar color, uchar mode) { unsigned int x1, y1, x2, y2; x1 = r->x; y1 = r->y; x2 = x1+r->w; y2 = y1+r->h; boxfill(x1, y1, x2, y2, color, mode); }
int *hrb_api(int edi, int esi, int ebp, int esp, int ebx, int edx, int ecx, int eax) { struct TASK *task = task_now(); int ds_base = task->ds_base; struct CONSOLE *cons = task->cons; struct SHTCTL *shtctl = (struct SHTCTL *) *((int *) 0x0fe4); struct SHEET *sht; struct FIFO32 *sys_fifo = (struct FIFO32 *) *((int *) 0x0fec); int *reg = &eax + 1; /* 返し値 */ int i; struct FILEINFO *finfo; struct FILEHANDLE *fh; struct MEMMAN *memman = (struct MEMMAN *) MEMMAN_ADDR; unsigned char *p; int *memtotal = (int *) *((int *) 0x0fe2); struct TASK *task2; struct FIFO32 *fifo; struct BOOTINFO *binfo = (struct BOOTINFO *) ADR_BOOTINFO; int bpp = binfo->vmode; unsigned short *sp; unsigned int *ip; struct PICTURE *pic; if (edx == 1) { cons_putchar(cons, eax & 0xff, 1); } else if (edx == 2) { cons_putstr0(cons, (char *) ebx + ds_base); } else if (edx == 3) { cons_putstr1(cons, (char *) ebx + ds_base, ecx); } else if (edx == 4) { return &(task->tss.esp0); } else if (edx == 5) { sht = sheet_alloc(shtctl); sht->task = task; sht->flags |= 0x10; sheet_setbuf(sht, (char *) ebx + ds_base, esi, edi, eax); make_window((unsigned int *) ((char *) ebx + ds_base), esi, edi, (char *) ecx + ds_base, 0, 0); sht->windowname = (char *) ecx + ds_base; sheet_slide(sht, ((shtctl->xsize - esi) / 2) & ~3, (shtctl->ysize - edi) / 2); keywin_off(shtctl->sheets[shtctl->top - 2]); sheet_updown(sht, shtctl->top - 1); keywin_on(sht); fifo32_put(sys_fifo, 0x4000); /* key_win変更要求 */ reg[7] = (int) sht; } else if (edx == 6) { sht = (struct SHEET *) (ebx & 0xfffffffe); putfonts((unsigned int *) (sht->buf), sht->bxsize, esi, edi, get_color(1, eax), (char *) ebp + ds_base); if ((ebx & 1) == 0) { sheet_refresh(sht, esi, edi, esi + ecx * 8, edi + 16); } } else if (edx == 7) { sht = (struct SHEET *) (ebx & 0xfffffffe); boxfill((unsigned int *) (sht->buf), sht->bxsize, get_color(1, ebp), eax, ecx, esi, edi); 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バイト単位にする */ memman_free((struct MEMMAN *) (ebx + ds_base), eax, ecx); } else if (edx == 9) { ecx = (ecx + 0x0f) & 0xfffffff0; /* 16バイト単位に切り上げ */ reg[7] = memman_alloc((struct MEMMAN *) (ebx + ds_base), ecx); } 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 & 0xfffffffe); i = get_color(1, eax); if (bpp == 8) { sht->buf[sht->bxsize * edi + esi] = get_color(bpp, i); } else if (bpp == 16) { sp = (unsigned short *) (sht->buf); sp[sht->bxsize * edi + esi] = get_color(bpp, i); } else if (bpp == 24) { ip = (unsigned int *) (sht->buf); ip[sht->bxsize * edi + esi] = get_color(bpp, i); } 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); } else if (edx == 13) { sht = (struct SHEET *) (ebx & 0xfffffffe); hrb_api_linewin(sht, eax, ecx, esi, edi, get_color(1, ebp)); if ((ebx & 1) == 0) { if (eax > esi) { i = eax; eax = esi; esi = i; } if (ecx > edi) { i = ecx; ecx = edi; edi = i; } sheet_refresh(sht, eax, ecx, esi + 1, edi + 1); } } else if (edx == 14) { sheet_free((struct SHEET *) ebx); keywin_on(shtctl->sheets[shtctl->top - 2]); } else if (edx == 15) { for (;;) { io_cli(); if (fifo32_status(&task->fifo) == 0) { if (eax != 0) { /* fifoカラッポ */ task_sleep(task); /* 寝て待つ */ } else { io_sti(); reg[7] = -1; return 0; } } i = fifo32_get(&task->fifo); io_sti(); if (i <= 1) { /* カーソル用 */ /* アプリ実行中はカーソルが出ないので、いつも次は表示用の1を注文 */ timer_init(cons->timer, &task->fifo, 1); timer_settime(cons->timer, 50); } if (i == 2) { /* カーソルON */ cons->curcol = 0xffffff; } if (i == 3) { /* カーソルOFF */ cons->curcol = -1; } if (i == 4) { timer_cancel(cons->timer); io_cli(); fifo32_put(sys_fifo, cons->sht - shtctl->sheets0 + 2024); /* 2024〜2279 */ cons->sht = 0; io_sti(); } if (i >= 256) { reg[7] = i - 256; return 0; } } } else if (edx == 16) { reg[7] = (int) timer_alloc(); ((struct TIMER *) reg[7])->flags2 = 1; /* 自動キャンセル有効 */ } else if (edx == 17) { timer_init((struct TIMER *) ebx, &task->fifo, eax + 256); } else if (edx == 18) { timer_settime((struct TIMER *) ebx, eax); } else if (edx == 19) { timer_free((struct TIMER *) ebx); } else if (edx == 20) { if (eax == 0) { /* 音を消す */ i = io_in8(0x61); io_out8(0x61, i & 0x0d); } else { i = 1193180000 / eax; io_out8(0x43, 0xb6); io_out8(0x42, i & 0xff); io_out8(0x42, i >> 8); i = io_in8(0x61); io_out8(0x61, (i | 0x03) & 0x0f); } } else if (edx == 21) {
void draw_window() { unsigned char *p; int x=320,y=200; p=(unsigned char*)VRAM; // boxfill8(p,320,110,20,20,250,150); //draw a window boxfill(7 ,0, 0 ,x-1,y-29); //task button boxfill(8 ,0, y-28,x-1,y-28); boxfill(7 ,0, y-27,x-1,y-27); boxfill(8 ,0, y-26,x-1,y-1); //left button boxfill(7, 3, y-24, 59, y-24); boxfill(7, 2, y-24, 2 , y-4); boxfill(15, 3, y-4, 59, y-4); boxfill(15, 59, y-23, 59, y-5); boxfill(0, 2, y-3, 59, y-3); boxfill(0, 60, y-24, 60, y-3); // //right button boxfill(15, x-47, y-24,x-4,y-24); boxfill(15, x-47, y-23,x-47,y-4); boxfill(7, x-47, y-3,x-4,y-3); boxfill(7, x-3, y-24,x-3,y-3); }