3 Commits

Author SHA1 Message Date
Hiroaki Sakai
3547ae13a1 Significantly modified WWDisplay_DrawScreen () algorithm.
It did not get much faster.  When the X server drawing is a hot spot
Since it seems, efforts to reduce drawing amount are necessary.

Version 0.0.6 alpha - from wonx-a06.tar.gz
2000-10-04 12:00:00 +09:00
Hiroaki Sakai
0cc1bd45ae Fix XDisplay_DrawLCDWindow (). I put useless calculations out of the loop.
Fix WWDisplay_DrawScreen ().  I put useless calculations out of the loop.

After examining the hotspot, the drawing part of X (XDisplay_DrawLCDWindow () in XDisplay.c
Loop part) became a hot spot, so arrange the array for each pixel
I made it and raised drawing speed.

Version 0.0.5 alpha - from wonx-a05.tar.gz
2000-10-03 12:00:00 +09:00
Hiroaki Sakai
aa38e7adab Improved the display routines in XDisplay.c and rendered somewhat faster.
Changed method of storing WWLCDPanel data.
(I made 1 byte allocated with 1 pixel as 1 byte with 2 pixels)
(For speeding up, thought about future color correspondence (241 colors?))

Added WonxDisplay_Sync ().  Reduced wasteful drawing in functions of get type.

Implement sprite window function.  (Not tested)

Implement time related functions.  (timer.c)

Fix sprite priority.  (I modified "Priority is given to younger one")

Version 0.0.4 alpha - from wonx-a04.tar.gz
2000-09-30 12:00:00 +09:00
12 changed files with 629 additions and 245 deletions

49
HISTORY
View File

@@ -1,5 +1,54 @@
2000/10/4(<28><>)
wonx-a06 <20><><EFBFBD><EFBFBD>
WWDisplay_DrawScreen() <20>Υ<EFBFBD><CEA5><EFBFBD><EFBFBD><EAA5BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˽<EFBFBD><CBBD><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƹ<EFBFBD>®<EFBFBD>ˤʤ<EFBFBD><EFBFBD>ʤ<EFBFBD><EFBFBD>ä<EFBFBD><EFBFBD><EFBFBD>X <20><><EFBFBD><EFBFBD><EFBFBD>Ф<EFBFBD><D0A4><EFBFBD><EFBFBD><EFBFBD>ۥåȥ<C3A5><C8A5>ݥåȤˤʤäƤ<C3A4><C6A4><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD>פ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Τǡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̤򸺤餹<EFBFBD><EFBFBD><EFBFBD>Ϥ<EFBFBD>ɬ<EFBFBD>ס<EFBFBD>
2000/10/3(<28><>)
wonx-a05 <20><><EFBFBD><EFBFBD>
XDisplay_DrawLCDWindow() <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̵<EFBFBD>̤ʷ׻<CAB7><D7BB><EFBFBD><EFBFBD><EFBFBD>׳<EFBFBD><D7B3>˽Ф<CBBD><D0A4><EFBFBD><EFBFBD><EFBFBD>
WWDisplay_DrawScreen() <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̵<EFBFBD>̤ʷ׻<CAB7><D7BB><EFBFBD><EFBFBD><EFBFBD>׳<EFBFBD><D7B3>˽Ф<CBBD><D0A4><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD>ۥåȥ<EFBFBD><EFBFBD>ݥåȤ<EFBFBD>Ĵ<EFBFBD>٤<EFBFBD><EFBFBD>顤X<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʬ(XDisplay.c <20><> XDisplay_DrawLCDWindow()<29><>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʬ)<29><><EFBFBD>ۥåȥ<C3A5><C8A5>ݥåȤˤʤäƤ<C3A4><C6A4><EFBFBD><EFBFBD>Τǡ<CEA4><C7A1>ԥ<EFBFBD><D4A5><EFBFBD><EFBFBD><EFBFBD>Ȥ<EFBFBD><C8A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD>äơ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>®<EFBFBD>٤<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2000/9/30(<28><>)
wonx-a04 <20><><EFBFBD><EFBFBD>
XDisplay.c <20><><EFBFBD><EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD><EFBFBD><EBA1BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɤ<EFBFBD><C9A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¿<EFBFBD><C2BF><EFBFBD><EFBFBD>®<EFBFBD>ˤ<EFBFBD><CBA4><EFBFBD><EFBFBD><EFBFBD>
WWLCDPanel <20>Υǡ<CEA5><C7A1><EFBFBD><EFBFBD>γ<EFBFBD>Ǽ<EFBFBD><C7BC>ˡ<EFBFBD><CBA1><EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
(<28><><EFBFBD>ԥ<EFBFBD><D4A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǣ<EFBFBD><C7A3>Х<EFBFBD><D0A5>Ȥ<EFBFBD><C8A4>ä<EFBFBD><C3A4>Τ򡤣<CEA4><F2A1A4A3>ԥ<EFBFBD><D4A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǣ<EFBFBD><C7A3>Х<EFBFBD><D0A5>Ȥ<EFBFBD><C8A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƥ<EFBFBD><C6A4><EFBFBD>ˤ<EFBFBD><CBA4><EFBFBD>)
(<28><>®<EFBFBD><C2AE><EFBFBD>Τ<EFBFBD><CEA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Υ<EFBFBD><CEA5><EFBFBD>б<EFBFBD>(241<34><31><EFBFBD><EFBFBD>)<29>Τ<EFBFBD><CEA4>Ȥ<EFBFBD><C8A4>ͤ<EFBFBD><CDA4><EFBFBD>)
WonxDisplay_Sync() <20><><EFBFBD>ɲá<C9B2>get <20>Ϥδؿ<CEB4><D8BF><EFBFBD><EFBFBD>Ǥ<EFBFBD>̵<EFBFBD>̤<EFBFBD><CCA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>򸺤餷<F2B8BAA4><E9A4B7><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD>ץ饤<EFBFBD>ȥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɥ<EFBFBD><EFBFBD><EFBFBD>ǽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><>ƥ<EFBFBD><C6A5><EFBFBD>)
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>δؿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(timer.c)
<EFBFBD><EFBFBD><EFBFBD>ץ饤<EFBFBD>Ȥ<EFBFBD>ͥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̤<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD>ֹ椬<D6B9><EFBFBD><E3A4A4><EFBFBD>ΤΤۤ<CEA4><DBA4><EFBFBD>ͥ<EFBFBD><CDA5><EFBFBD>פ˽<D7A4><CBBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
2000/9/28(<28><>)
wonx-a03 <20><><EFBFBD><EFBFBD>
screen2_set_window()<29><>ɽ<EFBFBD><C9BD><EFBFBD>ϰϤ<CFB0><CFA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD>ޥ˥奢<EFBFBD><EFBFBD><EFBFBD><EFBFBD> screen2_set_window() <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˤϡ<CBA4>ɽ<EFBFBD><C9BD><EFBFBD>ΰ<EFBFBD><CEB0>β<EFBFBD><CEB2><EFBFBD><EFBFBD>Ƚ<EFBFBD><C8BD><EFBFBD><EFBFBD>פ<EFBFBD>
<EFBFBD>񤤤Ƥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ºݤˤϡ<EFBFBD>ɽ<EFBFBD><EFBFBD><EFBFBD>ΰ<EFBFBD><EFBFBD>β<EFBFBD><EFBFBD><EFBFBD>+1<>Ƚ<EFBFBD><C8BD><EFBFBD>+1<>פ<EFBFBD>ư<EFBFBD><EFBFBD><EEA4B9>

View File

@@ -2,8 +2,8 @@ XINCLUDEDIR = /usr/X11R6/include
INCLUDEDIR = .
XLIBDIR = /usr/X11R6/lib
VERSION = Wonx-a03
PKGNAME = wonx-a03
VERSION = Wonx-a06
PKGNAME = wonx-a06
OBJS = WWCharacter.o WWColorMap.o WWDisplay.o WWLCDPanel.o WWPalette.o WWScreen.o WWSprite.o WonxDisplay.o XDisplay.o bank.o comm.o disp.o text.o key.o sound.o system.o timer.o etc.o wonx.o

View File

@@ -24,6 +24,15 @@ int WWDisplay_GetSpriteEnable(WWDisplay d) { return (d->sprite_enable); }
int WWDisplay_GetSpriteWindowEnable(WWDisplay d)
{ return (d->sprite_window_enable); }
int WWDisplay_GetSpriteWindowX(WWDisplay d)
{ return (d->sprite_window_x); }
int WWDisplay_GetSpriteWindowY(WWDisplay d)
{ return (d->sprite_window_y); }
int WWDisplay_GetSpriteWindowWidth(WWDisplay d)
{ return (d->sprite_window_width); }
int WWDisplay_GetSpriteWindowHeight(WWDisplay d)
{ return (d->sprite_window_height); }
int WWDisplay_GetBorder(WWDisplay d) { return (d->border); }
int WWDisplay_GetForegroundColor(WWDisplay d) { return (d->foreground_color); }
@@ -54,6 +63,15 @@ int WWDisplay_SetSpriteEnable(WWDisplay d, int f)
int WWDisplay_SetSpriteWindowEnable(WWDisplay d, int f)
{ return (d->sprite_window_enable = f); }
int WWDisplay_SetSpriteWindowX(WWDisplay d, int n)
{ return (d->sprite_window_x = n); }
int WWDisplay_SetSpriteWindowY(WWDisplay d, int n)
{ return (d->sprite_window_y = n); }
int WWDisplay_SetSpriteWindowWidth(WWDisplay d, int n)
{ return (d->sprite_window_width = n); }
int WWDisplay_SetSpriteWindowHeight(WWDisplay d, int n)
{ return (d->sprite_window_height = n); }
int WWDisplay_SetBorder(WWDisplay d, int b) { return (d->border = b); }
int WWDisplay_SetForegroundColor(WWDisplay d, int c)
@@ -112,6 +130,11 @@ WWDisplay WWDisplay_Create(int lcd_panel_width, int lcd_panel_height,
WWDisplay_SetSpriteEnable(display, 0);
WWDisplay_SetSpriteWindowEnable(display, 0);
WWDisplay_SetSpriteWindowX( display, 0);
WWDisplay_SetSpriteWindowY( display, 0);
WWDisplay_SetSpriteWindowWidth( display, lcd_panel_width);
WWDisplay_SetSpriteWindowHeight(display, lcd_panel_height);
WWDisplay_SetBorder(display, 0);
WWDisplay_SetForegroundColor(display, 3);
@@ -172,22 +195,14 @@ WWDisplay WWDisplay_Destroy(WWDisplay display)
/* LCD<43>ѥͥ<D1A5><CDA5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
/*===========================================================================*/
static int WWDisplay_DrawScreen(WWDisplay display, WWScreen screen)
static int WWDisplay_DrawScreen(WWDisplay display, WWScreen screen,
int lcd_x, int lcd_y)
{
WWLCDPanel lcd_panel;
int lcd_panel_width;
int lcd_panel_height;
int pixel;
int x, y, px, py;
int px, py;
int sx, sy, ex, ey;
int mode;
if (!WWScreen_GetEnable(screen)) return (0);
lcd_panel = WWDisplay_GetLCDPanel(display);
lcd_panel_width = WWLCDPanel_GetWidth( lcd_panel);
lcd_panel_height = WWLCDPanel_GetHeight(lcd_panel);
if (!WWScreen_GetEnable(screen)) return (-1);
if ( (WWScreen_GetMode(screen) == WWSCREEN_INSIDE_ONLY) ||
(WWScreen_GetMode(screen) == WWSCREEN_OUTSIDE_ONLY) ) {
@@ -214,64 +229,82 @@ static int WWDisplay_DrawScreen(WWDisplay display, WWScreen screen)
#endif
}
mode = WWScreen_GetMode(screen);
/* <20>ʲ<EFBFBD><CAB2>ϥۥåȥ<C3A5><C8A5>ݥåȤˤʤ<CBA4><CAA4>Τǡ<CEA4><C7A1><EFBFBD><EFBFBD>Τ<EFBFBD><CEA4><EFBFBD><EFBFBD><EFBFBD>ץ<EFBFBD><D7A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
/* <20><><EFBFBD><EFBFBD><EFBFBD>ۤ<EFBFBD><DBA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
for (y = 0; y < lcd_panel_height; y++) {
for (x = 0; x < lcd_panel_width; x++) {
px = x + WWScreen_GetRollX(screen);
py = y + WWScreen_GetRollY(screen);
if (mode == WWSCREEN_INSIDE_ONLY) {
if (y > ey) {
x = lcd_panel_width - 1; y = lcd_panel_height - 1; continue;
}
if (y < sy) { x = lcd_panel_width - 1; y = sy - 1; continue; }
if (x > ex) { x = lcd_panel_width - 1; continue; }
if (x < sx) { x = sx - 1; continue; }
} else if (mode == WWSCREEN_OUTSIDE_ONLY) {
if ( (x >= sx) && (x <= ex) && (y >= sy) && (y <= ey) ) {
x = ex;
continue;
}
}
pixel = WWScreen_GetPixel(screen, px, py);
/* Ʃ<><C6A9><EFBFBD><EFBFBD><EFBFBD>ξ<EFBFBD><CEBE><EFBFBD> */
if (pixel == -1) continue;
pixel = WWColorMap_GetLCDColor(WWDisplay_GetColorMap(display), pixel);
WWLCDPanel_SetPixel(lcd_panel, x, y, pixel);
}
switch (WWScreen_GetMode(screen)) {
case WWSCREEN_INSIDE_ONLY:
if ( (lcd_x < sx) || (lcd_x > ex) || (lcd_y < sy) || (lcd_y > ey) )
return (-1);
break;
case WWSCREEN_OUTSIDE_ONLY:
if ( !( (lcd_x < sx) || (lcd_x > ex) || (lcd_y < sy) || (lcd_y > ey) ) )
return (-1);
break;
}
return (0);
px = lcd_x + WWScreen_GetRollX(screen);
py = lcd_y + WWScreen_GetRollY(screen);
pixel = WWScreen_GetPixel(screen, px, py);
/* Ʃ<><C6A9><EFBFBD><EFBFBD><EFBFBD>ξ<EFBFBD><CEBE><EFBFBD> */
if (pixel == -1) return (-1);
pixel = WWColorMap_GetLCDColor(WWDisplay_GetColorMap(display), pixel);
WWLCDPanel_SetPixel(WWDisplay_GetLCDPanel(display), lcd_x, lcd_y, pixel);
return (pixel);
}
static int WWDisplay_DrawSprite(WWDisplay display, WWSprite sprite)
static int WWDisplay_DrawSprite(WWDisplay display, WWSprite sprite,
int lcd_x, int lcd_y)
{
int x, y;
int pixel;
int x, y, sprite_x, sprite_y;
int sx, sy, ex, ey;
int pixel, outside;
for (y = 0; y < 8; y++) {
for (x = 0; x < 8; x++) {
pixel = WWSprite_GetPixel(sprite, x, y);
sx = WWDisplay_GetSpriteWindowX(display) - 1;
sy = WWDisplay_GetSpriteWindowY(display) - 1;
/* Ʃ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ξ<EFBFBD><EFBFBD><EFBFBD> */
if (pixel == -1) continue;
/* <20>ʲ<EFBFBD><EFBFBD><EFBFBD> WWDisplay_DrawScreen() <20>˹<EFBFBD><CBB9><EFBFBD><EFBFBD> */
#if 0
ex = sx + WWDisplay_GetSpriteWindowWidth(display) - 1;
ey = sy + WWDisplay_GetSpriteWindowHeight(display) - 1;
#else
ex = sx + WWDisplay_GetSpriteWindowWidth(display);
ey = sy + WWDisplay_GetSpriteWindowHeight(display);
#endif
pixel = WWColorMap_GetLCDColor(WWDisplay_GetColorMap(display), pixel);
WWLCDPanel_SetPixel(WWDisplay_GetLCDPanel(display),
WWSprite_GetX(sprite) + x,
WWSprite_GetY(sprite) + y,
pixel);
sprite_x = WWSprite_GetX(sprite);
sprite_y = WWSprite_GetY(sprite);
if ( (lcd_x < sprite_x) || (lcd_x > sprite_x + 7) ||
(lcd_y < sprite_y) || (lcd_y > sprite_y + 7) )
return (-1);
x = lcd_x - sprite_x;
y = lcd_y - sprite_y;
pixel = WWSprite_GetPixel(sprite, x, y);
/* Ʃ<><C6A9><EFBFBD><EFBFBD><EFBFBD>ξ<EFBFBD><CEBE><EFBFBD> */
if (pixel == -1) return (-1);
if (WWDisplay_GetSpriteWindowEnable(display)) {
if ( (lcd_x < sx) || (lcd_y < sy) || (lcd_x > ex) || (lcd_y > ey) )
outside = 1;
else
outside = 0;
if (WWSprite_GetClipping(sprite)) { /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɥ<EFBFBD><C9A5>γ<EFBFBD>¦<EFBFBD><C2A6>ʬ<EFBFBD><CAAC>ɽ<EFBFBD><C9BD> */
if (!outside) return (-1);
} else { /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɥ<EFBFBD><C9A5><EFBFBD><EFBFBD><EFBFBD>¦<EFBFBD><C2A6>ʬ<EFBFBD><CAAC>ɽ<EFBFBD><C9BD> */
if (outside) return (-1);
}
}
return (0);
pixel = WWColorMap_GetLCDColor(WWDisplay_GetColorMap(display), pixel);
WWLCDPanel_SetPixel(WWDisplay_GetLCDPanel(display), lcd_x, lcd_y, pixel);
return (pixel);
}
int WWDisplay_DrawLCDPanel(WWDisplay display)
@@ -284,47 +317,63 @@ int WWDisplay_DrawLCDPanel(WWDisplay display)
WWColorMap color_map;
int border;
WWSprite sprite;
int ret;
lcd_panel = WWDisplay_GetLCDPanel(display);
lcd_panel_width = WWLCDPanel_GetWidth(lcd_panel);
lcd_panel_width = WWLCDPanel_GetWidth( lcd_panel);
lcd_panel_height = WWLCDPanel_GetHeight(lcd_panel);
color_map = WWDisplay_GetColorMap(display);
border = WWDisplay_GetBorder(display);
/* <20>ܡ<EFBFBD><DCA1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E9A1BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
for (x = 0; x < lcd_panel_width; x++) {
for (y = 0; y < lcd_panel_height; y++) {
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>󣲤<EFBFBD><F3A3B2A4><EFBFBD>ͥ<EFBFBD><CDA5><EFBFBD>Υ<EFBFBD><CEA5>ץ饤<D7A5>Ȥ<EFBFBD><C8A4><EFBFBD><EFBFBD><EFBFBD> */
/* <20>Ťʤä<CAA4><C3A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϡ<EFBFBD><CFA1>ֹ<EFBFBD><D6B9>μ㤤<CEBC><E3A4A4><EFBFBD>Τ<EFBFBD><CEA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
ret = -1;
if (WWDisplay_GetSpriteEnable(display)) {
for (i = 0; i < WWDisplay_GetSpriteCount(display); i++) {
sprite = WWDisplay_GetSprite(display,
i + WWDisplay_GetSpriteStart(display));
if (WWSprite_GetPriority(sprite)) {
ret = WWDisplay_DrawSprite(display, sprite, x, y);
if (ret != -1) break;
}
}
}
if (ret != -1) continue;
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>󣲤<EFBFBD><F3A3B2A4><EFBFBD><EFBFBD><EFBFBD> */
ret = WWDisplay_DrawScreen(display, WWDisplay_GetScreen(display, 1),
x, y);
if (ret != -1) continue;
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>󣲤<EFBFBD><F3A3B2A4><EFBFBD>ͥ<EFBFBD><CDA5><EFBFBD>Ǥʤ<C7A4><CAA4><EFBFBD><EFBFBD>ץ饤<D7A5>Ȥ<EFBFBD><C8A4><EFBFBD><EFBFBD><EFBFBD> */
/* <20>Ťʤä<CAA4><C3A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϡ<EFBFBD><CFA1>ֹ<EFBFBD><D6B9>μ㤤<CEBC><E3A4A4><EFBFBD>Τ<EFBFBD><CEA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
ret = -1;
if (WWDisplay_GetSpriteEnable(display)) {
for (i = 0; i < WWDisplay_GetSpriteCount(display); i++) {
sprite = WWDisplay_GetSprite(display,
i + WWDisplay_GetSpriteStart(display));
if (!WWSprite_GetPriority(sprite)) {
ret = WWDisplay_DrawSprite(display, sprite, x, y);
if (ret != -1) break;
}
}
}
if (ret != -1) continue;
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>󣱤<EFBFBD><F3A3B1A4><EFBFBD><EFBFBD><EFBFBD> */
ret = WWDisplay_DrawScreen(display, WWDisplay_GetScreen(display, 0),
x, y);
if (ret != -1) continue;
/* <20>ܡ<EFBFBD><DCA1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E9A1BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
WWLCDPanel_SetPixel(lcd_panel, x, y,
WWColorMap_GetLCDColor(color_map, border));
}
}
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EAA1BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
if (WWDisplay_GetSpriteEnable(display))
WWDisplay_DrawScreen(display, WWDisplay_GetScreen(display, 0));
/* <20><><EFBFBD>ץ饤<D7A5><E9A5A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>󣲤<EFBFBD><F3A3B2A4><EFBFBD>ͥ<EFBFBD><CDA5><EFBFBD>Ǥʤ<C7A4><CAA4><EFBFBD><EFBFBD><EFBFBD>) */
for (i = 0; i < WWDisplay_GetSpriteCount(display); i++) {
sprite = WWDisplay_GetSprite(display,
i + WWDisplay_GetSpriteStart(display));
if (!WWSprite_GetPriority(sprite)) {
WWDisplay_DrawSprite(display, sprite);
}
}
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EAA1BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
if (WWDisplay_GetSpriteEnable(display))
WWDisplay_DrawScreen(display, WWDisplay_GetScreen(display, 1));
/* <20><><EFBFBD>ץ饤<D7A5><E9A5A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>󣲤<EFBFBD><F3A3B2A4><EFBFBD>ͥ<EFBFBD><CDA5><EFBFBD>ʤ<EFBFBD><CAA4><EFBFBD>) */
for (i = 0; i < WWDisplay_GetSpriteCount(display); i++) {
sprite = WWDisplay_GetSprite(display,
i + WWDisplay_GetSpriteStart(display));
if (WWSprite_GetPriority(sprite)) {
WWDisplay_DrawSprite(display, sprite);
}
}
return (0);
}

View File

@@ -35,6 +35,11 @@ WWLCDPanel WWDisplay_GetLCDPanel(WWDisplay d);
int WWDisplay_GetSpriteEnable(WWDisplay d);
int WWDisplay_GetSpriteWindowEnable(WWDisplay d);
int WWDisplay_GetSpriteWindowX(WWDisplay d);
int WWDisplay_GetSpriteWindowY(WWDisplay d);
int WWDisplay_GetSpriteWindowWidth(WWDisplay d);
int WWDisplay_GetSpriteWindowHeight(WWDisplay d);
int WWDisplay_GetBorder(WWDisplay d);
int WWDisplay_GetForegroundColor(WWDisplay d);
@@ -57,6 +62,11 @@ WWLCDPanel WWDisplay_SetLCDPanel(WWDisplay d, WWLCDPanel p);
int WWDisplay_SetSpriteEnable(WWDisplay d, int f);
int WWDisplay_SetSpriteWindowEnable(WWDisplay d, int f);
int WWDisplay_SetSpriteWindowX(WWDisplay d, int n);
int WWDisplay_SetSpriteWindowY(WWDisplay d, int n);
int WWDisplay_SetSpriteWindowWidth(WWDisplay d, int n);
int WWDisplay_SetSpriteWindowHeight(WWDisplay d, int n);
int WWDisplay_SetBorder(WWDisplay d, int b);
int WWDisplay_SetForegroundColor(WWDisplay d, int c);

View File

@@ -21,8 +21,12 @@ typedef struct _WWDisplay {
WWLCDPanel lcd_panel;
/* <20>ǥ<EFBFBD><C7A5><EFBFBD><EFBFBD>ץ쥤<D7A5><ECA5A4>°<EFBFBD><C2B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
int sprite_enable; /* <20><><EFBFBD>ץ饤<D7A5><E9A5A4>ɽ<EFBFBD><C9BD><EFBFBD><EFBFBD><EFBFBD>͡<EFBFBD><CDA1>֥<EFBFBD><D6A5>ե饰 */
int sprite_window_enable; /* <20><><EFBFBD>ץ饤<D7A5>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɥ<EFBFBD><C9A5><EFBFBD>ǽ<EFBFBD><C7BD><EFBFBD>͡<EFBFBD><CDA1>֥<EFBFBD><D6A5>ե饰 */
int sprite_enable; /* <20><><EFBFBD>ץ饤<D7A5><E9A5A4>ɽ<EFBFBD><C9BD><EFBFBD><EFBFBD><EFBFBD>͡<EFBFBD><CDA1>֥<EFBFBD><D6A5>ե饰 */
int sprite_window_enable; /* <20><><EFBFBD>ץ饤<D7A5>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɥ<EFBFBD><C9A5><EFBFBD>ǽ<EFBFBD><C7BD><EFBFBD>͡<EFBFBD><CDA1>֥<EFBFBD><D6A5>ե饰 */
int sprite_window_x; /* <20><><EFBFBD>ץ饤<D7A5>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɥ<EFBFBD><C9A5><EFBFBD> */
int sprite_window_y; /* <20><><EFBFBD>ץ饤<D7A5>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɥ<EFBFBD><C9A5><EFBFBD> */
int sprite_window_width; /* <20><><EFBFBD>ץ饤<D7A5>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɥ<EFBFBD><C9A5><EFBFBD> */
int sprite_window_height; /* <20><><EFBFBD>ץ饤<D7A5>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɥ<EFBFBD><C9A5><EFBFBD> */
int border; /* <20>ܡ<EFBFBD><DCA1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E9A1BC>0<EFBFBD><30>7<EFBFBD>Υ<EFBFBD><CEA5><EFBFBD>ޥå<DEA5><C3A5>ֹ<EFBFBD> */

View File

@@ -24,8 +24,7 @@ int WWLCDPanel_GetPixel(WWLCDPanel lcd_panel, int x, int y)
(y < 0) || (y > WWLCDPanel_GetHeight(lcd_panel) - 1) )
return (-1);
pixel = lcd_panel->pixel[y * (WWLCDPanel_GetWidth(lcd_panel) / 2) + x / 2];
if (x % 2) pixel = pixel >> 4;
pixel = lcd_panel->pixel[y * WWLCDPanel_GetWidth(lcd_panel) + x];
pixel &= 0x0f;
return ((int)pixel);
}
@@ -39,14 +38,9 @@ int WWLCDPanel_SetPixel(WWLCDPanel lcd_panel, int x, int y, int pixel)
(y < 0) || (y > WWLCDPanel_GetHeight(lcd_panel) - 1) )
return (-1);
p = 0x0f;
if (x % 2) p = p << 4;
n = y * (WWLCDPanel_GetWidth(lcd_panel) / 2) + x / 2;
lcd_panel->pixel[n] &= ~p;
p = ((unsigned char)pixel) & 0x0f;
if (x % 2) p = p << 4;
lcd_panel->pixel[n] |= p;
n = y * WWLCDPanel_GetWidth(lcd_panel) + x;
lcd_panel->pixel[n] = p;
return (pixel);
}
@@ -63,7 +57,7 @@ WWLCDPanel WWLCDPanel_Create(int width, int height)
WWLCDPanel_SetHeight(lcd_panel, height);
lcd_panel->pixel =
(unsigned char *)malloc(sizeof(unsigned char) *
(WWLCDPanel_GetWidth(lcd_panel) / 2) *
WWLCDPanel_GetWidth(lcd_panel) *
WWLCDPanel_GetHeight(lcd_panel));
for (y = 0; y < lcd_panel->height; y++) {

View File

@@ -44,22 +44,15 @@ WonxDisplay WonxDisplay_Create(int x_width, int x_height,
return (wonx_display);
}
int WonxDisplay_Flush(WonxDisplay wonx_display)
int WonxDisplay_Sync(WonxDisplay wonx_display)
{
int i;
XDisplay x_display;
WWDisplay ww_display;
WWLCDPanel ww_lcd_panel;
x_display = WonxDisplay_GetXDisplay(wonx_display);
ww_display = WonxDisplay_GetWWDisplay(wonx_display);
if (XDisplay_GetLCDDraw(x_display)) {
WWDisplay_DrawLCDPanel(ww_display);
ww_lcd_panel = WWDisplay_GetLCDPanel(ww_display);
XDisplay_DrawLCDWindow(x_display, ww_lcd_panel);
}
if (XDisplay_GetColorMapPrint(x_display)) {
WWColorMap_PrintData(WWDisplay_GetColorMap(ww_display), stdout);
XDisplay_SetColorMapPrint(x_display, 0);
@@ -86,6 +79,28 @@ int WonxDisplay_Flush(WonxDisplay wonx_display)
XDisplay_SetSpritePrint(x_display, 0);
}
XDisplay_Sync(x_display);
return (0);
}
int WonxDisplay_Flush(WonxDisplay wonx_display)
{
XDisplay x_display;
WWDisplay ww_display;
WWLCDPanel ww_lcd_panel;
x_display = WonxDisplay_GetXDisplay(wonx_display);
ww_display = WonxDisplay_GetWWDisplay(wonx_display);
if (XDisplay_GetLCDDraw(x_display)) {
WWDisplay_DrawLCDPanel(ww_display);
ww_lcd_panel = WWDisplay_GetLCDPanel(ww_display);
XDisplay_DrawLCDWindow(x_display, ww_lcd_panel);
}
WonxDisplay_Sync(wonx_display);
return (0);
}

View File

@@ -19,6 +19,7 @@ WWDisplay WonxDisplay_GetWWDisplay(WonxDisplay wonx_display);
WonxDisplay WonxDisplay_Create(int x_width, int x_height,
int ww_lcd_panel_width, int ww_lcd_panel_height,
int ww_screen_width, int ww_screen_height);
int WonxDisplay_Sync(WonxDisplay wonx_display);
int WonxDisplay_Flush(WonxDisplay wonx_display);
/*****************************************************************************/

View File

@@ -358,16 +358,23 @@ int XDisplay_Sync(XDisplay x_display)
int XDisplay_DrawLCDWindow(XDisplay x_display, WWLCDPanel ww_lcd_panel)
{
int x, y, n;
int px, py;
int x, y;
int px, py, ph;
int num;
XRectangle * rectangles;
int n[16];
XRectangle * rectangles[16];
int pixel;
int ww_lcd_width, ww_lcd_height;
/* <20><><EFBFBD>ܤ<EFBFBD><DCA4>Ƥ<EFBFBD><C6A4><EFBFBD><EFBFBD>ԥ<EFBFBD><D4A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϤޤȤ<DEA4><C8A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E8A4B9><EFBFBD>Τǡ<CEA4><C7A1>ԥ<EFBFBD><D4A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD><CEBA><EFBFBD><EFBFBD>ͤ<EFBFBD> */
/* <20>ǰ<EFBFBD><C7B0>ξ<EFBFBD><CEBE><EFBFBD>(<28>ʡ<EFBFBD><CAA1><EFBFBD><EFBFBD>ͤΤȤ<CEA4>)<29>ǡ<EFBFBD>width * height / 2 <20>ˤʤ롥 */
num =
WWLCDPanel_GetHeight(ww_lcd_panel) * WWLCDPanel_GetWidth(ww_lcd_panel);
rectangles = (XRectangle *)malloc(sizeof(XRectangle) * num);
WWLCDPanel_GetHeight(ww_lcd_panel) * WWLCDPanel_GetWidth(ww_lcd_panel) / 2;
for (pixel = 0; pixel < 16; pixel++) {
n[pixel] = 0;
rectangles[pixel] = (XRectangle *)malloc(sizeof(XRectangle) * num);
}
if (rectangles == NULL)
Error("XDisplay_DrawLCDWindow", "Cannot allocate memory.");
@@ -376,27 +383,38 @@ int XDisplay_DrawLCDWindow(XDisplay x_display, WWLCDPanel ww_lcd_panel)
/* <20><><EFBFBD><EFBFBD><EFBFBD>ν<EFBFBD><CEBD><EFBFBD><EFBFBD>ϥۥåȥ<C3A5><C8A5>ݥåȤˤʤ<CBA4><CAA4>Τǡ<CEA4><C7A1>Τ<EFBFBD><CEA4>Τ<EFBFBD><CEA4>˥<EFBFBD><CBA5><EFBFBD>˥󥰤<CBA5><F3A5B0A4><EFBFBD><EBA4B3> */
for (pixel = 0; pixel < 16; pixel++) {
n = 0;
for (y = 0; y < ww_lcd_height; y++) {
for (x = 0; x < ww_lcd_width; x++) {
if (pixel == WWLCDPanel_GetPixel(ww_lcd_panel, x, y)) {
px = (x * x_display->width ) / ww_lcd_width;
py = (y * x_display->height) / ww_lcd_height;
rectangles[n].x = px;
rectangles[n].y = py;
rectangles[n].width = (x+1) * x_display->width / ww_lcd_width - px;
rectangles[n].height = (y+1) * x_display->height / ww_lcd_height- py;
n++;
}
}
}
for (y = 0; y < ww_lcd_height; y++) {
py = (y * x_display->height) / ww_lcd_height;
ph = (y+1) * x_display->height / ww_lcd_height- py;
for (x = 0; x < ww_lcd_width; x++) {
pixel = WWLCDPanel_GetPixel(ww_lcd_panel, x, y);
px = (x * x_display->width ) / ww_lcd_width;
rectangles[pixel][n[pixel]].x = px;
rectangles[pixel][n[pixel]].y = py;
rectangles[pixel][n[pixel]].width =
(x+1) * x_display->width / ww_lcd_width - px;
rectangles[pixel][n[pixel]].height = ph;
if (n > 0) {
/* <20><><EFBFBD>ܤ<EFBFBD><DCA4>Ƥ<EFBFBD>Ʊ<EFBFBD><C6B1><EFBFBD>Υԥ<CEA5><D4A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϡ<EFBFBD><CFA1><EFBFBD><EFBFBD>Ϥ<EFBFBD><CFA4>ä<EFBFBD><C3A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E8A4B9> */
x++;
while ( (x < ww_lcd_width) &&
(pixel == WWLCDPanel_GetPixel(ww_lcd_panel, x, y)) ) {
rectangles[pixel][n[pixel]].width =
(x+1) * x_display->width / ww_lcd_width - px;
x++;
}
x--;
n[pixel]++;
}
}
for (pixel = 0; pixel < 16; pixel++) {
if (n[pixel] > 0) {
XFillRectangles(x_display->display,
x_display->lcd_pixmap,
x_display->color_gc[pixel],
rectangles, n);
rectangles[pixel], n[pixel]);
}
}
@@ -406,7 +424,9 @@ int XDisplay_DrawLCDWindow(XDisplay x_display, WWLCDPanel ww_lcd_panel)
XDisplay_Sync(x_display);
free(rectangles);
for (pixel = 0; pixel < 16; pixel++) {
free(rectangles[pixel]);
}
return (0);
}

270
disp.c
View File

@@ -19,7 +19,7 @@ void display_control(unsigned int flags)
{
WWDisplay ww_display;
printf("call : display_control() : flags = 0x%04x, ", (int)flags);
printf("call : display_control() : flags = 0x%04x\n", (int)flags);
fflush(stdout);
if (wonx_display == NULL) Wonx_Create();
@@ -47,7 +47,7 @@ void display_control(unsigned int flags)
WonxDisplay_Flush(wonx_display);
printf("return value = none\n"); fflush(stdout);
printf("call : display_control() : return value = none\n"); fflush(stdout);
return;
}
@@ -57,7 +57,7 @@ unsigned int display_status()
WWDisplay ww_display;
unsigned short int ret;
printf("call : display_status() : "); fflush(stdout);
printf("call : display_status() : \n"); fflush(stdout);
if (wonx_display == NULL) Wonx_Create();
@@ -89,9 +89,10 @@ unsigned int display_status()
ret |= WWDisplay_GetBorder(WonxDisplay_GetWWDisplay(wonx_display)) << 7;
WonxDisplay_Flush(wonx_display);
WonxDisplay_Sync(wonx_display);
printf("return value = %u\n", (int)ret); fflush(stdout);
printf("call : display_status() : return value = %u\n", (int)ret);
fflush(stdout);
return (ret);
}
@@ -103,7 +104,7 @@ void font_set_monodata(unsigned int number, unsigned int count, void * data)
int f, b;
unsigned char * d;
printf("call : font_set_monodata() : number = %u, count = %u, data = %p, ",
printf("call : font_set_monodata() : number = %u, count = %u, data = %p\n",
(int)number, (int)count, data); fflush(stdout);
if (wonx_display == NULL) Wonx_Create();
@@ -127,7 +128,8 @@ void font_set_monodata(unsigned int number, unsigned int count, void * data)
WonxDisplay_Flush(wonx_display);
printf("return value = none\n"); fflush(stdout);
printf("call : font_set_monodata() : return value = none\n");
fflush(stdout);
return;
}
@@ -140,7 +142,7 @@ void font_set_colordata(unsigned int number,
int f, b;
unsigned char * d;
printf("call : font_set_colordata() : number = %u, count = %u, data = %p, ",
printf("call : font_set_colordata() : number = %u, count = %u, data = %p\n",
(int)number, (int)count, data); fflush(stdout);
if (wonx_display == NULL) Wonx_Create();
@@ -166,7 +168,8 @@ void font_set_colordata(unsigned int number,
WonxDisplay_Flush(wonx_display);
printf("return value = none\n"); fflush(stdout);
printf("call : font_set_colordata() : return value = none\n");
fflush(stdout);
return;
}
@@ -180,7 +183,7 @@ void font_get_data(unsigned int number,
int f, b;
unsigned char * d;
printf("call : font_get_data() : number = %u, count = %u, data = %p, ",
printf("call : font_get_data() : number = %u, count = %u, data = %p\n",
(int)number, (int)count, data); fflush(stdout);
if (wonx_display == NULL) Wonx_Create();
@@ -205,9 +208,9 @@ void font_get_data(unsigned int number,
}
}
WonxDisplay_Flush(wonx_display);
WonxDisplay_Sync(wonx_display);
printf("return value = none\n"); fflush(stdout);
printf("call : font_get_data() : return value = none\n"); fflush(stdout);
return;
}
@@ -216,7 +219,7 @@ void font_set_color(unsigned int colors)
{
WWDisplay dis;
printf("call : font_set_color() : colors = 0x%04x, ", (int)colors);
printf("call : font_set_color() : colors = 0x%04x\n", (int)colors);
fflush(stdout);
if (wonx_display == NULL) Wonx_Create();
@@ -227,7 +230,7 @@ void font_set_color(unsigned int colors)
WonxDisplay_Flush(wonx_display);
printf("return value = none\n"); fflush(stdout);
printf("call : font_set_color() : return value = none\n"); fflush(stdout);
return;
}
@@ -237,7 +240,7 @@ unsigned int font_get_color(void)
unsigned short int ret;
WWDisplay dis;
printf("call : font_get_color() : "); fflush(stdout);
printf("call : font_get_color() : \n"); fflush(stdout);
if (wonx_display == NULL) Wonx_Create();
@@ -246,9 +249,10 @@ unsigned int font_get_color(void)
ret |= WWDisplay_GetForegroundColor(dis);
ret |= WWDisplay_GetBackgroundColor(dis) << 2;
WonxDisplay_Flush(wonx_display);
WonxDisplay_Sync(wonx_display);
printf("return value = 0x%04x\n", (int)ret); fflush(stdout);
printf("call : font_get_color() : return value = 0x%04x\n", (int)ret);
fflush(stdout);
return (ret);
}
@@ -265,7 +269,7 @@ void screen_set_char(int screen, int x, int y, int w, int h, void * data)
WWPalette p;
WWCharacter c;
printf("call : screen_set_char() : screen = %d, x = %d, y = %d, w = %d, h = %d, data = %p",
printf("call : screen_set_char() : screen = %d, x = %d, y = %d, w = %d, h = %d, data = %p\n",
screen, x, y, w, h, data); fflush(stdout);
if (wonx_display == NULL) Wonx_Create();
@@ -294,7 +298,7 @@ void screen_set_char(int screen, int x, int y, int w, int h, void * data)
WonxDisplay_Flush(wonx_display);
printf("return value = none\n"); fflush(stdout);
printf("call : screen_set_char() : return value = none\n"); fflush(stdout);
return;
}
@@ -311,7 +315,7 @@ void screen_get_char(int screen, int x, int y, int w, int h, void * data)
WWPalette p;
WWCharacter c;
printf("call : screen_get_char() : screen = %d, x = %d, y = %d, w = %d, h = %d, data = %p",
printf("call : screen_get_char() : screen = %d, x = %d, y = %d, w = %d, h = %d, data = %p\n",
screen, x, y, w, h, data); fflush(stdout);
if (wonx_display == NULL) Wonx_Create();
@@ -337,28 +341,49 @@ void screen_get_char(int screen, int x, int y, int w, int h, void * data)
}
}
WonxDisplay_Flush(wonx_display);
WonxDisplay_Sync(wonx_display);
printf("return value = none\n"); fflush(stdout);
printf("call : screen_get_char() : return value = none\n"); fflush(stdout);
return;
}
unsigned int screen_get_char1(int screen, int x, int y)
{
int horizontal; /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȿž<C8BF>ե饰 */
int vertical; /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȿž<C8BF>ե饰 */
int palette_num; /* <20>ѥ<EFBFBD><D1A5>å<EFBFBD><C3A5>ֹ<EFBFBD> */
int character_num; /* ɽ<><C9BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E9A5AF> */
WWScreen s;
WWPalette p;
WWCharacter c;
unsigned short int ret;
printf("call : screen_get_char1() : screen = %d, x = %d, y = %d, ",
printf("call : screen_get_char1() : screen = %d, x = %d, y = %d\n",
screen, x, y);
fflush(stdout);
if (wonx_display == NULL) Wonx_Create();
screen_get_char(screen, x, y, 1, 1, &ret);
s = WWDisplay_GetScreen(WonxDisplay_GetWWDisplay(wonx_display), screen);
WonxDisplay_Flush(wonx_display);
horizontal = WWScreen_GetHorizontal(s, x, y);
vertical = WWScreen_GetVertical( s, x, y);
p = WWScreen_GetPalette( s, x, y);
c = WWScreen_GetCharacter( s, x, y);
palette_num = WWPalette_GetNumber(p);
character_num = WWCharacter_GetNumber(c);
printf("return value = 0x%04x\n", (int)ret); fflush(stdout);
ret = 0;
ret |= horizontal << 15;
ret |= vertical << 14;
ret |= palette_num << 9;
ret |= character_num;
WonxDisplay_Sync(wonx_display);
printf("call : screen_get_char1() : return value = 0x%04x\n", (int)ret);
fflush(stdout);
return (ret);
}
@@ -375,7 +400,7 @@ void screen_fill_char(int screen, int x, int y, int w, int h,
WWPalette p;
WWCharacter c;
printf("call : screen_fill_char() : screen = %d, x = %d, y = %d, w = %d, h = %d, data = 0x%04x, ",
printf("call : screen_fill_char() : screen = %d, x = %d, y = %d, w = %d, h = %d, data = 0x%04x\n",
screen, x, y, w, h, (int)data); fflush(stdout);
if (wonx_display == NULL) Wonx_Create();
@@ -403,7 +428,7 @@ void screen_fill_char(int screen, int x, int y, int w, int h,
WonxDisplay_Flush(wonx_display);
printf("return value = none\n"); fflush(stdout);
printf("call : screen_fill_char() : return value = none\n"); fflush(stdout);
return;
}
@@ -414,7 +439,7 @@ void screen_fill_attr(int screen, int x, int y, int w, int h,
int i, j;
unsigned short int c;
printf("call : screen_fill_attr() : screen = %d, x = %d, y = %d, w = %d, h = %d, data = 0x%04x, mask = 0x%04x, ",
printf("call : screen_fill_attr() : screen = %d, x = %d, y = %d, w = %d, h = %d, data = 0x%04x, mask = 0x%04x\n",
screen, x, y, w, h, (int)data, (int)mask); fflush(stdout);
if (wonx_display == NULL) Wonx_Create();
@@ -430,14 +455,14 @@ void screen_fill_attr(int screen, int x, int y, int w, int h,
WonxDisplay_Flush(wonx_display);
printf("return value = none\n"); fflush(stdout);
printf("call : screen_fill_attr() : return value = none\n"); fflush(stdout);
return;
}
void sprite_set_range(unsigned int sprite_start, unsigned int sprite_count)
{
printf("call : sprite_set_range() : start = %u, count = %u, ",
printf("call : sprite_set_range() : start = %u, count = %u\n",
(int)sprite_start, (int)sprite_count); fflush(stdout);
if (wonx_display == NULL) Wonx_Create();
@@ -449,19 +474,18 @@ void sprite_set_range(unsigned int sprite_start, unsigned int sprite_count)
WonxDisplay_Flush(wonx_display);
printf("return value = none\n"); fflush(stdout);
printf("call : sprite_set_range() : return value = none\n"); fflush(stdout);
return;
}
void sprite_set_char(unsigned int sprite_num,
unsigned int data)
void sprite_set_char(unsigned int sprite_num, unsigned int data)
{
WWSprite s;
WWPalette p;
WWCharacter c;
printf("call : sprite_set_char() : number = %u, data = 0x%04x, ",
printf("call : sprite_set_char() : number = %u, data = 0x%04x\n",
(int)sprite_num, (int)data); fflush(stdout);
if (wonx_display == NULL) Wonx_Create();
@@ -483,7 +507,7 @@ void sprite_set_char(unsigned int sprite_num,
WonxDisplay_Flush(wonx_display);
printf("return value = none\n"); fflush(stdout);
printf("call : sprite_set_char() : return value = none\n"); fflush(stdout);
return;
}
@@ -495,7 +519,7 @@ unsigned int sprite_get_char(unsigned int sprite_num)
WWCharacter c;
unsigned short int ret;
printf("call : sprite_get_char() : number = %u, ", (int)sprite_num);
printf("call : sprite_get_char() : number = %u\n", (int)sprite_num);
fflush(stdout);
if (wonx_display == NULL) Wonx_Create();
@@ -516,9 +540,10 @@ unsigned int sprite_get_char(unsigned int sprite_num)
c = WWSprite_GetCharacter(s);
ret |= WWCharacter_GetNumber(c);
WonxDisplay_Flush(wonx_display);
WonxDisplay_Sync(wonx_display);
printf("return value = 0x%04x\n", (int)ret); fflush(stdout);
printf("call : sprite_get_char() : return value = 0x%04x\n", (int)ret);
fflush(stdout);
return (ret);
}
@@ -527,7 +552,7 @@ void sprite_set_location(unsigned int sprite_num, int x, int y)
{
WWSprite s;
printf("call : sprite_set_location() : number = %u, x = %d, y = %d, ",
printf("call : sprite_set_location() : number = %u, x = %d, y = %d\n",
(int)sprite_num, x, y); fflush(stdout);
if (wonx_display == NULL) Wonx_Create();
@@ -537,7 +562,8 @@ void sprite_set_location(unsigned int sprite_num, int x, int y)
WonxDisplay_Flush(wonx_display);
printf("return value = none\n"); fflush(stdout);
printf("call : sprite_set_location() : return value = none\n");
fflush(stdout);
return;
}
@@ -547,21 +573,19 @@ unsigned int sprite_get_location(unsigned int sprite_num)
WWSprite s;
unsigned short int ret;
printf("call : sprite_get_location() : number = %u, ", (int)sprite_num);
printf("call : sprite_get_location() : number = %u\n", (int)sprite_num);
fflush(stdout);
if (wonx_display == NULL) Wonx_Create();
s = WWDisplay_GetSprite(WonxDisplay_GetWWDisplay(wonx_display), sprite_num);
ret = 0;
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>դǤϡ<C7A4> */
ret |= WWSprite_GetX(s) << 8;
ret |= WWSprite_GetY(s);
ret = (WWSprite_GetY(s) << 8) | WWSprite_GetX(s);
WonxDisplay_Flush(wonx_display);
WonxDisplay_Sync(wonx_display);
printf("return value = 0x%04x\n", (int)ret); fflush(stdout);
printf("call : sprite_get_location() : return value = 0x%04x\n", (int)ret);
fflush(stdout);
return (ret);
}
@@ -571,7 +595,7 @@ void sprite_set_char_location(unsigned int sprite_num,
{
if (wonx_display == NULL) Wonx_Create();
printf("call : sprite_set_char_location() : number = %u, data = 0x%04x, x = %d, y = %d, ",
printf("call : sprite_set_char_location() : number = %u, data = 0x%04x, x = %d, y = %d\n",
(int)sprite_num, (int)data, x, y); fflush(stdout);
sprite_set_char(sprite_num, data);
@@ -579,7 +603,8 @@ void sprite_set_char_location(unsigned int sprite_num,
WonxDisplay_Flush(wonx_display);
printf("return value = none\n"); fflush(stdout);
printf("call : sprite_set_char_location() : return value = none\n");
fflush(stdout);
return;
}
@@ -588,19 +613,20 @@ unsigned long int sprite_get_char_location(unsigned int sprite_num)
{
unsigned long int ret;
printf("call : sprite_get_char_location() : number = %u, ", (int)sprite_num);
printf("call : sprite_get_char_location() : number = %u\n", (int)sprite_num);
fflush(stdout);
if (wonx_display == NULL) Wonx_Create();
ret = 0;
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>դǤϡ<C7A4> */
ret |= sprite_get_char(sprite_num) << 16;
ret |= sprite_get_location(sprite_num);
ret |= ((unsigned long int)sprite_get_char(sprite_num));
ret |= (unsigned long int)sprite_get_location(sprite_num) << 16;
WonxDisplay_Flush(wonx_display);
WonxDisplay_Sync(wonx_display);
printf("return value = 0x%08x\n", (int)ret); fflush(stdout);
printf("call : sprite_get_char_location() : return value = 0x%08x\n",
(int)ret);
fflush(stdout);
return (ret);
}
@@ -611,7 +637,7 @@ void sprite_set_data(unsigned int sprite_num, unsigned int count, void * data)
char * d;
unsigned long int * n;
printf("call : sprite_set_data() : number = %u, count = %u, data = %p",
printf("call : sprite_set_data() : number = %u, count = %u, data = %p\n",
(int)sprite_num, (int)count, data); fflush(stdout);
if (wonx_display == NULL) Wonx_Create();
@@ -626,7 +652,7 @@ void sprite_set_data(unsigned int sprite_num, unsigned int count, void * data)
WonxDisplay_Flush(wonx_display);
printf("return value = none\n"); fflush(stdout);
printf("call : sprite_set_data() : return value = none\n"); fflush(stdout);
return;
}
@@ -635,7 +661,7 @@ void screen_set_scroll(int screen, int x, int y)
{
WWScreen s;
printf("call : screen_set_scroll() : scsreen = %d, x = %d, y = %d, ",
printf("call : screen_set_scroll() : screen = %d, x = %d, y = %d\n",
screen, x, y); fflush(stdout);
if (wonx_display == NULL) Wonx_Create();
@@ -646,7 +672,7 @@ void screen_set_scroll(int screen, int x, int y)
WonxDisplay_Flush(wonx_display);
printf("return value = none\n"); fflush(stdout);
printf("call : screen_set_scroll() : return value = none\n"); fflush(stdout);
return;
}
@@ -656,7 +682,7 @@ unsigned int screen_get_scroll(int screen)
unsigned short int ret;
WWScreen s;
printf("call : screen_get_scroll() : screen = %d, ", screen); fflush(stdout);
printf("call : screen_get_scroll() : screen = %d\n", screen); fflush(stdout);
if (wonx_display == NULL) Wonx_Create();
@@ -666,9 +692,10 @@ unsigned int screen_get_scroll(int screen)
ret |= WWScreen_GetRollX(s);
ret |= WWScreen_GetRollY(s) << 8;
WonxDisplay_Flush(wonx_display);
WonxDisplay_Sync(wonx_display);
printf("return value = %u\n", (int)ret); fflush(stdout);
printf("call : screen_get_scroll() : return value = %u\n", (int)ret);
fflush(stdout);
return (ret);
}
@@ -677,7 +704,7 @@ void screen2_set_window(int x, int y, int w, int h)
{
WWScreen s;
printf("call : screen2_set_window() : x = %d, y = %d, width = %d, height = %d, ",
printf("call : screen2_set_window() : x = %d, y = %d, width = %d, height = %d\n",
x, y, w, h); fflush(stdout);
if (wonx_display == NULL) Wonx_Create();
@@ -690,7 +717,8 @@ void screen2_set_window(int x, int y, int w, int h)
WonxDisplay_Flush(wonx_display);
printf("return value = none\n"); fflush(stdout);
printf("call : screen2_set_window() : return value = none\n");
fflush(stdout);
return;
}
@@ -704,39 +732,79 @@ unsigned long int screen2_get_window(void)
if (wonx_display == NULL) Wonx_Create();
printf("call : screen2_get_window() : "); fflush(stdout);
printf("call : screen2_get_window() : \n"); fflush(stdout);
s = WWDisplay_GetScreen(WonxDisplay_GetWWDisplay(wonx_display), SCREEN2);
xy =
((WWScreen_GetDrawY(s) << 8) & 0xff00) |
(WWScreen_GetDrawX(s) & 0x00ff);
(((unsigned short int)WWScreen_GetDrawY(s) << 8) & 0xff00) |
((unsigned short int)WWScreen_GetDrawX(s) & 0x00ff);
wh =
((WWScreen_GetDrawHeight(s) << 8) & 0xff00) |
(WWScreen_GetDrawWidth(s) & 0x00ff);
(((unsigned short int)WWScreen_GetDrawHeight(s) << 8) & 0xff00) |
((unsigned short int)WWScreen_GetDrawWidth(s) & 0x00ff);
ret = ((unsigned long int)wh) << 16 | xy;
WonxDisplay_Flush(wonx_display);
WonxDisplay_Sync(wonx_display);
printf("return value = 0x%08x\n", (int)ret); fflush(stdout);
printf("call : screen2_get_window() : return value = 0x%08x\n", (int)ret);
fflush(stdout);
return (ret);
}
void sprite_set_window(int x, int y, int w, int h)
{
WWDisplay d;
printf("call : sprite_set_window() : x = %d, y = %d, w = %d, h = %d\n",
x, y, w, h);
fflush(stdout);
if (wonx_display == NULL) Wonx_Create();
/* <20><><EFBFBD>Ȥǽ񤯤<C7BD><F1A4AFA4><EFBFBD> */
d = WonxDisplay_GetWWDisplay(wonx_display);
WWDisplay_SetSpriteWindowX(d, x);
WWDisplay_SetSpriteWindowY(d, y);
WWDisplay_SetSpriteWindowWidth(d, w);
WWDisplay_SetSpriteWindowHeight(d, h);
WonxDisplay_Flush(wonx_display);
printf("call : sprite_set_window() : return value = none\n");
fflush(stdout);
return;
}
unsigned long int sprite_get_window(void)
{
if (wonx_display == NULL) Wonx_Create();
/* <20><><EFBFBD>Ȥǽ񤯤<C7BD><F1A4AFA4><EFBFBD> */
WWDisplay d;
unsigned short int xy;
unsigned short int wh;
unsigned long int ret;
WonxDisplay_Flush(wonx_display);
printf("call : sprite_get_window() : \n");
fflush(stdout);
if (wonx_display == NULL) Wonx_Create();
d = WonxDisplay_GetWWDisplay(wonx_display);
xy =
(((unsigned short int)WWDisplay_GetSpriteWindowY(d) << 8) & 0xff00) |
((unsigned short int)WWDisplay_GetSpriteWindowX(d) & 0x00ff);
wh =
(((unsigned short int)WWDisplay_GetSpriteWindowHeight(d) << 8) & 0xff00) |
((unsigned short int)WWDisplay_GetSpriteWindowWidth(d) & 0x00ff);
ret = ((unsigned long int)wh) << 16 | xy;
WonxDisplay_Sync(wonx_display);
printf("call : sprite_get_window() : return value = 0x%08x\n", (int)ret);
fflush(stdout);
return (ret);
}
void palette_set_color(unsigned int palette_num,
@@ -745,7 +813,7 @@ void palette_set_color(unsigned int palette_num,
int mapped_colors[4];
WWPalette palette;
printf("call : palette_set_color() : number = %u, colors = 0x%04x, ",
printf("call : palette_set_color() : number = %u, colors = 0x%04x\n",
(int)palette_num, (int)colors); fflush(stdout);
if (wonx_display == NULL) Wonx_Create();
@@ -761,7 +829,7 @@ void palette_set_color(unsigned int palette_num,
WonxDisplay_Flush(wonx_display);
printf("return value = none\n"); fflush(stdout);
printf("call : palette_set_color() : return value = none\n"); fflush(stdout);
return;
}
@@ -772,7 +840,7 @@ unsigned int palette_get_color(unsigned int palette_num)
WWPalette palette;
unsigned short int ret;
printf("call : palette_get_color() : number = %u, ", (int)palette_num);
printf("call : palette_get_color() : number = %u\n", (int)palette_num);
fflush(stdout);
if (wonx_display == NULL) Wonx_Create();
@@ -787,9 +855,10 @@ unsigned int palette_get_color(unsigned int palette_num)
ret |= (mapped_colors[2] & 0x07) << 8;
ret |= (mapped_colors[3] & 0x07) << 12;
WonxDisplay_Flush(wonx_display);
WonxDisplay_Sync(wonx_display);
printf("return value = %u\n", (int)ret); fflush(stdout);
printf("call : palette_get_color() : return value = %u\n", (int)ret);
fflush(stdout);
return (ret);
}
@@ -799,7 +868,7 @@ void lcd_set_color(unsigned int colors0, unsigned int colors1)
WWColorMap color_map;
int lcd_colors[8];
printf("call : lcd_set_color() : colors0 = 0x%04x, colors1 = 0x%04x, ",
printf("call : lcd_set_color() : colors0 = 0x%04x, colors1 = 0x%04x\n",
(int)colors0, (int)colors1); fflush(stdout);
if (wonx_display == NULL) Wonx_Create();
@@ -818,7 +887,7 @@ void lcd_set_color(unsigned int colors0, unsigned int colors1)
WonxDisplay_Flush(wonx_display);
printf("return value = none\n"); fflush(stdout);
printf("call : lcd_set_color() : return value = none\n"); fflush(stdout);
return;
}
@@ -829,7 +898,7 @@ unsigned long int lcd_get_color(void)
int lcd_colors[8];
unsigned long int ret;
printf("call : lcd_get_color() : "); fflush(stdout);
printf("call : lcd_get_color() : \n"); fflush(stdout);
if (wonx_display == NULL) Wonx_Create();
@@ -837,18 +906,19 @@ unsigned long int lcd_get_color(void)
WWColorMap_GetLCDColors(color_map, lcd_colors);
ret = 0;
ret |= lcd_colors[0] & 0x0f;
ret |= (lcd_colors[1] & 0x0f) << 4;
ret |= (lcd_colors[2] & 0x0f) << 8;
ret |= (lcd_colors[3] & 0x0f) << 12;
ret |= lcd_colors[0] & 0x0f;
ret |= (lcd_colors[1] & 0x0f) << 4;
ret |= (lcd_colors[2] & 0x0f) << 8;
ret |= (lcd_colors[3] & 0x0f) << 12;
ret |= (unsigned long int)lcd_colors[0] & 0x0f;
ret |= ((unsigned long int)lcd_colors[1] & 0x0f) << 4;
ret |= ((unsigned long int)lcd_colors[2] & 0x0f) << 8;
ret |= ((unsigned long int)lcd_colors[3] & 0x0f) << 12;
ret |= (unsigned long int)lcd_colors[0] & 0x0f;
ret |= ((unsigned long int)lcd_colors[1] & 0x0f) << 4;
ret |= ((unsigned long int)lcd_colors[2] & 0x0f) << 8;
ret |= ((unsigned long int)lcd_colors[3] & 0x0f) << 12;
WonxDisplay_Flush(wonx_display);
WonxDisplay_Sync(wonx_display);
printf("return value = 0x%08x\n", (int)ret); fflush(stdout);
printf("call : lcd_get_color() : return value = 0x%08x\n", (int)ret);
fflush(stdout);
return (ret);
}
@@ -866,7 +936,7 @@ unsigned lcd_get_segments(void)
if (wonx_display == NULL) Wonx_Create();
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD><EFBFBD>̤<EFBFBD><CCA4><EFBFBD>ݡ<EFBFBD><DDA1>Ȥ<EFBFBD><C8A4><EFBFBD> */
WonxDisplay_Flush(wonx_display);
WonxDisplay_Sync(wonx_display);
}
void lcd_set_sleep(unsigned sleep)
@@ -874,7 +944,7 @@ void lcd_set_sleep(unsigned sleep)
if (wonx_display == NULL) Wonx_Create();
/* ? */
WonxDisplay_Flush(wonx_display);
WonxDisplay_Sync(wonx_display);
}
unsigned lcd_get_sleep(void)
@@ -882,21 +952,21 @@ unsigned lcd_get_sleep(void)
if (wonx_display == NULL) Wonx_Create();
/* ? */
WonxDisplay_Flush(wonx_display);
WonxDisplay_Sync(wonx_display);
}
void screen_set_vram(int screen, int locationID)
{
if (wonx_display == NULL) Wonx_Create();
WonxDisplay_Flush(wonx_display);
WonxDisplay_Sync(wonx_display);
}
void sprite_set_vram(int locationID)
{
if (wonx_display == NULL) Wonx_Create();
WonxDisplay_Flush(wonx_display);
WonxDisplay_Sync(wonx_display);
}
/*****************************************************************************/

14
key.c
View File

@@ -21,6 +21,8 @@ int key_press_check(void)
ret = XDisplay_GetKeyPress(x_display);
WonxDisplay_Sync(wonx_display);
printf("return value = 0x%04x\n", (int)ret); fflush(stdout);
return (ret);
@@ -40,6 +42,8 @@ int key_hit_check(void)
ret = XDisplay_GetKeyPress(x_display);
WonxDisplay_Sync(wonx_display);
printf("return value = 0x%04x\n", (int)ret); fflush(stdout);
return (ret);
@@ -62,6 +66,8 @@ int key_wait(void)
ret = XDisplay_GetKeyPress(x_display);
} while (ret == 0);
WonxDisplay_Sync(wonx_display);
printf("return value = 0x%04x\n", (int)ret); fflush(stdout);
return (ret);
@@ -74,7 +80,11 @@ void key_set_repeat(int rate, int delay)
if (wonx_display == NULL) Wonx_Create();
WonxDisplay_Sync(wonx_display);
printf("return value = none\n"); fflush(stdout);
return;
}
int key_get_repeat(void)
@@ -87,6 +97,8 @@ int key_get_repeat(void)
ret = 0;
WonxDisplay_Sync(wonx_display);
printf("return value = 0x%04x\n", (int)ret); fflush(stdout);
return (ret);
@@ -106,6 +118,8 @@ int key_hit_check_with_repeat(void)
ret = XDisplay_GetKeyPress(x_display);
WonxDisplay_Sync(wonx_display);
printf("return value = 0x%04x\n", (int)ret); fflush(stdout);
return (ret);

184
timer.c
View File

@@ -1,4 +1,5 @@
#include <stdlib.h>
#include <time.h>
#include <sys/timer.h>
@@ -6,28 +7,185 @@
#include "WonxDisplay.h"
typedef struct {
unsigned char year;
unsigned char month;
unsigned char date;
unsigned char day_of_week;
unsigned char hour;
unsigned char minute;
unsigned char second;
} datetime_t;
/* int tm_year; year - 1900 */
static int get_year(struct tm * tblock) { return (tblock->tm_year - 100); }
/* int tm_mon; month of year (0-11) */
static int get_month(struct tm * tblock) { return (tblock->tm_mon + 1); }
/* int tm_mday; day of month (1-31) */
static int get_day(struct tm * tblock) { return (tblock->tm_mday); }
/* int tm_wday; day of week (Sunday = 0) */
static int get_week(struct tm * tblock) { return (tblock->tm_wday); }
/* int tm_hour; hours (0 - 23) */
static int get_hour(struct tm * tblock) { return (tblock->tm_hour); }
/* int tm_min; minutes (0 - 59) */
static int get_minute(struct tm * tblock) { return (tblock->tm_min); }
/* int tm_sec; seconds (0 - 60) */
static int get_second(struct tm * tblock) { return (tblock->tm_sec); }
void rtc_set_datetime(int field, unsigned int value)
{
printf("call : rtc_set_datetime() : field = %d, value = %d\n",
field, (int)value);
fflush(stdout);
/* ̤<><CCA4><EFBFBD>ݡ<EFBFBD><DDA1><EFBFBD> */
printf("call : rtc_set_datetime() : not supported\n");
printf("call : rtc_set_datetime() : return value = none\n");
fflush(stdout);
return;
}
unsigned int rtc_get_datetime(int field)
{
unsigned int t;
t = (unsigned int)time(NULL); /* <20><><EFBFBD><EFBFBD><EFBFBD>ϤƤ<CFA4><C6A4>Ȥ<EFBFBD><C8A4>ʤΤǡ<CEA4><C7A1><EFBFBD><EFBFBD>Ȥǽ<C8A4><C7BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBA4B3> */
return (t);
unsigned int ret;
time_t timer;
struct tm * tblock;
printf("call : rtc_get_datetime() : field = %d\n", field);
fflush(stdout);
time(&timer);
tblock = localtime(&timer);
switch (field) {
case RTC_YEAR : ret = get_year( tblock); break;
case RTC_MONTH : ret = get_month( tblock); break;
case RTC_DATE : ret = get_day( tblock); break;
case RTC_DAY_OF_WEEK : ret = get_week( tblock); break;
case RTC_HOUR : ret = get_hour( tblock); break;
case RTC_MIN : ret = get_minute(tblock); break;
case RTC_SEC : ret = get_second(tblock); break;
}
printf("call : rtc_get_datetime() : return value = %d\n", (int)ret);
fflush(stdout);
return (ret);
}
void rtc_set_datetime_struct(void * buffer)
{
printf("call : rtc_set_datetime_struct() : buffer = %p\n", buffer);
fflush(stdout);
/* ̤<><CCA4><EFBFBD>ݡ<EFBFBD><DDA1><EFBFBD> */
printf("call : rtc_set_datetime_struct() : not supported\n");
printf("call : rtc_set_datetime_struct() : return value = none\n");
fflush(stdout);
return;
}
void rtc_get_datetime_struct(void * buffer)
{
time_t timer;
struct tm * tblock;
datetime_t * p;
printf("call : rtc_get_datetime_struct() : buffer = %p\n", buffer);
fflush(stdout);
time(&timer);
tblock = localtime(&timer);
p = (datetime_t *)buffer;
p->year = get_year(tblock);
p->month = get_month(tblock);
p->date = get_day(tblock);
p->day_of_week = get_week(tblock);
p->hour = get_hour(tblock);
p->minute = get_minute(tblock);
p->second = get_second(tblock);
printf("call : rtc_get_datetime_struct() : return value = none\n");
fflush(stdout);
return;
}
void rtc_enable_alarm(int hour, int minute)
{
printf("call : rtc_enable_alarm() : hour = %d, minute = %d\n", hour, minute);
fflush(stdout);
/* ̤<><CCA4><EFBFBD>ݡ<EFBFBD><DDA1><EFBFBD> */
printf("call : rtc_enable_alarm() : not supported\n");
printf("call : rtc_enable_alarm() : return value = none\n");
fflush(stdout);
return;
}
void rtc_set_datetime_struct(void * buf)
{}
void rtc_get_datetime_struct(void * buf)
{}
void rtc_enable_alarm(int hour, int min)
{}
void rtc_disable_alarm(void)
{}
{
printf("call : rtc_disable_alarm() : \n");
fflush(stdout);
/* ̤<><CCA4><EFBFBD>ݡ<EFBFBD><DDA1><EFBFBD> */
printf("call : rtc_disable_alarm() : not supported\n");
printf("call : rtc_disable_alarm() : return value = none\n");
fflush(stdout);
return;
}
void timer_enable(int type, unsigned int auto_preset, unsigned int preset)
{}
{
printf("call : timer_enable() : type = %d, auto_preset = %u, preset = %u\n",
type, (int)auto_preset, (int)preset);
fflush(stdout);
/* ̤<><CCA4><EFBFBD>ݡ<EFBFBD><DDA1><EFBFBD> */
printf("call : timer_enable() : not supported\n");
printf("call : timer_enable() : return value = none\n");
fflush(stdout);
return;
}
void timer_disable(int type)
{}
{
printf("call : timer_disable() : type = %d\n", type);
fflush(stdout);
/* ̤<><CCA4><EFBFBD>ݡ<EFBFBD><DDA1><EFBFBD> */
printf("call : timer_disable() : not supported\n");
printf("call : timer_disable() : return value = none\n");
fflush(stdout);
return;
}
unsigned int timer_get_count(int type)
{}
{
unsigned int ret = 0;
printf("call : timer_get_count() : type = %d\n", type);
fflush(stdout);
/* ̤<><CCA4><EFBFBD>ݡ<EFBFBD><DDA1><EFBFBD> */
printf("call : timer_get_count() : not supported\n");
printf("call : timer_get_count() : return value = %u\n", ret);
fflush(stdout);
return;
}