disp.c 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306
  1. /*****************************************************************************/
  2. /* ここから */
  3. /*****************************************************************************/
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include "wonx/disp.h"
  7. #include "WonX.h"
  8. /*****************************************************************************/
  9. /* 互換関数の定義 */
  10. /*****************************************************************************/
  11. /*
  12. * void * でデータを渡す関数は,型を間違えるバグが入る可能性があるので,
  13. * void * を適切な型に置き換えてある.
  14. */
  15. /*
  16. * Xサーバとの同期の整合性がとれなくなるなどの問題が考えられるので,
  17. * 互換関数の内部は UNIXTimer_Pause(), UNIXTimer_Unpause() でくくり,
  18. * タイマ割り込みを一時停止して処理を行う.また,unpause するまえに,
  19. * かならず sync するようにする.
  20. */
  21. /*
  22. * タイマの一時停止の2重解除の問題が出てくるので,
  23. * 互換関数から互換関数を呼んではいけない.
  24. * (一時停止はネストされるが,いちおう)
  25. * 似たような処理をする関数の場合は,必ず static な別関数に処理をまとめ,
  26. * そっちを呼び出すようにすること.
  27. * 引数の表示の問題もあるしね.
  28. */
  29. void display_control(unsigned int flags)
  30. {
  31. WWDisplay ww_display;
  32. if (!WonX_IsCreated()) WonX_Create();
  33. /* タイマを一時停止する */
  34. UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  35. printf("call : display_control() : flags = 0x%04x\n", (int)flags);
  36. fflush(stdout);
  37. ww_display = WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay());
  38. WWScreen_SetEnable(WWDisplay_GetScreen(ww_display, SCREEN1),
  39. (flags & DCM_SCR1) ? 1 : 0);
  40. WWScreen_SetEnable(WWDisplay_GetScreen(ww_display, SCREEN2),
  41. (flags & DCM_SCR2) ? 1 : 0);
  42. WWDisplay_SetSpriteEnable(ww_display, (flags & DCM_SPR) ? 1 : 0);
  43. WWDisplay_SetSpriteWindowEnable(ww_display, (flags & DCM_SPR_WIN) ? 1 : 0);
  44. if ((flags & 0x0030) == DCM_SCR2_WIN_INSIDE)
  45. WWScreen_SetMode(WWDisplay_GetScreen(ww_display, SCREEN2),
  46. WW_SCREEN_INSIDE_ONLY);
  47. else if ((flags & 0x0030) == DCM_SCR2_WIN_OUTSIDE)
  48. WWScreen_SetMode(WWDisplay_GetScreen(ww_display, SCREEN2),
  49. WW_SCREEN_OUTSIDE_ONLY);
  50. WWDisplay_SetBorderPalette(ww_display,
  51. WWDisplay_GetPalette(ww_display,
  52. (flags & 0xf000) >> 12));
  53. #if 0
  54. WWDisplay_SetBorderColor(ww_display, (flags & DCM_BORDER_COLOR) >> 8);
  55. #else /* カラー対応で,ボーダーカラーは4ビットに変更された */
  56. WWDisplay_SetBorderColor(ww_display, (flags & 0x0f00) >> 8);
  57. #endif
  58. WonXDisplay_Flush(WonX_GetWonXDisplay());
  59. printf("call : display_control() : return value = none\n"); fflush(stdout);
  60. /* タイマをもとに戻す */
  61. UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  62. return;
  63. }
  64. unsigned int display_status(void)
  65. {
  66. WWDisplay ww_display;
  67. unsigned short int ret;
  68. if (!WonX_IsCreated()) WonX_Create();
  69. /* タイマを一時停止する */
  70. UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  71. printf("call : display_status() : \n"); fflush(stdout);
  72. ww_display = WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay());
  73. ret = 0;
  74. if (WWScreen_GetEnable(WWDisplay_GetScreen(ww_display, SCREEN1)))
  75. ret |= DCM_SCR1;
  76. if (WWScreen_GetEnable(WWDisplay_GetScreen(ww_display, SCREEN2)))
  77. ret |= DCM_SCR2;
  78. if (WWDisplay_GetSpriteEnable(ww_display))
  79. ret |= DCM_SPR;
  80. if (WWDisplay_GetSpriteWindowEnable(ww_display))
  81. ret |= DCM_SPR_WIN;
  82. switch (WWScreen_GetMode(WWDisplay_GetScreen(ww_display, SCREEN2))) {
  83. case WW_SCREEN_INSIDE_ONLY:
  84. ret |= DCM_SCR2_WIN_INSIDE;
  85. break;
  86. case WW_SCREEN_OUTSIDE_ONLY:
  87. ret |= DCM_SCR2_WIN_OUTSIDE;
  88. break;
  89. default:
  90. }
  91. ret |= (unsigned short int)WWPalette_GetNumber(WWDisplay_GetBorderPalette(ww_display)) << 12;
  92. ret |= (unsigned short int)WWDisplay_GetBorderColor(ww_display) << 8;
  93. WonXDisplay_Sync(WonX_GetWonXDisplay());
  94. printf("call : display_status() : return value = %u\n", (int)ret);
  95. fflush(stdout);
  96. /* タイマをもとに戻す */
  97. UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  98. return (ret);
  99. }
  100. /*
  101. * data は char × 8 で 8 バイト.
  102. */
  103. void font_set_monodata(unsigned int number, unsigned int count,
  104. unsigned char * data)
  105. {
  106. WWCharacter ww_character;
  107. WWDisplay ww_display;
  108. int i, j, k, n;
  109. int f, b;
  110. unsigned short int pixel;
  111. unsigned short int bitmap;
  112. if (!WonX_IsCreated()) WonX_Create();
  113. /* タイマを一時停止する */
  114. UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  115. printf("call : font_set_monodata() : number = %u, count = %u, data = %p\n",
  116. (int)number, (int)count, (void *)data);
  117. fflush(stdout);
  118. ww_display = WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay());
  119. f = WWDisplay_GetForegroundColor(ww_display);
  120. b = WWDisplay_GetBackgroundColor(ww_display);
  121. n = 0;
  122. for (i = 0; i < count; i++) {
  123. ww_character = WWDisplay_GetCharacter(ww_display, number + i);
  124. for (j = 0; j < 8; j++) {
  125. bitmap = 0;
  126. for (k = 0; k < 8; k++) {
  127. pixel = (data[n] & (1 << k)) ? f : b;
  128. bitmap |= ( pixel & 1) << k;
  129. bitmap |= ((pixel >> 1) & 1) << (k + 8);
  130. }
  131. WWCharacter_SetBitmapAsShortInt(ww_character, j, bitmap);
  132. n++;
  133. }
  134. }
  135. WonXDisplay_Flush(WonX_GetWonXDisplay());
  136. printf("call : font_set_monodata() : return value = none\n");
  137. fflush(stdout);
  138. /* タイマをもとに戻す */
  139. UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  140. return;
  141. }
  142. /*
  143. * data は short int × 8 で 16 バイト.
  144. */
  145. void font_set_colordata(unsigned int number, unsigned int count,
  146. unsigned short int * data)
  147. {
  148. WWCharacter ww_character;
  149. WWDisplay ww_display;
  150. int i, j, n;
  151. if (!WonX_IsCreated()) WonX_Create();
  152. /* タイマを一時停止する */
  153. UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  154. printf("call : font_set_colordata() : number = %u, count = %u, data = %p\n",
  155. (int)number, (int)count, (void *)data);
  156. fflush(stdout);
  157. ww_display = WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay());
  158. n = 0;
  159. for (i = 0; i < count; i++) {
  160. ww_character = WWDisplay_GetCharacter(ww_display, number + i);
  161. for (j = 0; j < 8; j++) {
  162. WWCharacter_SetBitmapAsShortInt(ww_character, j, data[n]);
  163. n++;
  164. }
  165. }
  166. WonXDisplay_Flush(WonX_GetWonXDisplay());
  167. printf("call : font_set_colordata() : return value = none\n");
  168. fflush(stdout);
  169. /* タイマをもとに戻す */
  170. UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  171. return;
  172. }
  173. /*
  174. * data は short int × 8 で 16 バイト.
  175. */
  176. void font_get_data(unsigned int number, unsigned int count,
  177. unsigned short int * data)
  178. {
  179. /* 関数の仕様がわからんので適当に書くぞ */
  180. WWCharacter ww_character;
  181. WWDisplay ww_display;
  182. int i, j, n;
  183. if (!WonX_IsCreated()) WonX_Create();
  184. /* タイマを一時停止する */
  185. UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  186. printf("call : font_get_data() : number = %u, count = %u, data = %p\n",
  187. (int)number, (int)count, (void *)data);
  188. fflush(stdout);
  189. ww_display = WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay());
  190. n = 0;
  191. for (i = 0; i < count; i++) {
  192. ww_character = WWDisplay_GetCharacter(ww_display, number + i);
  193. for (j = 0; j < 8; j++) {
  194. data[n] = WWCharacter_GetBitmapAsShortInt(ww_character, j);
  195. n++;
  196. }
  197. }
  198. WonXDisplay_Sync(WonX_GetWonXDisplay());
  199. printf("call : font_get_data() : return value = none\n");
  200. fflush(stdout);
  201. /* タイマをもとに戻す */
  202. UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  203. return;
  204. }
  205. void font_set_color(unsigned int colors)
  206. {
  207. WWDisplay dis;
  208. if (!WonX_IsCreated()) WonX_Create();
  209. /* タイマを一時停止する */
  210. UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  211. printf("call : font_set_color() : colors = 0x%04x\n", (int)colors);
  212. fflush(stdout);
  213. dis = WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay());
  214. WWDisplay_SetForegroundColor(dis, colors & 0x03);
  215. WWDisplay_SetBackgroundColor(dis, (colors >> 2) & 0x03);
  216. WonXDisplay_Flush(WonX_GetWonXDisplay());
  217. printf("call : font_set_color() : return value = none\n"); fflush(stdout);
  218. /* タイマをもとに戻す */
  219. UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  220. return;
  221. }
  222. unsigned int font_get_color(void)
  223. {
  224. unsigned short int ret;
  225. WWDisplay dis;
  226. if (!WonX_IsCreated()) WonX_Create();
  227. /* タイマを一時停止する */
  228. UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  229. printf("call : font_get_color() : \n"); fflush(stdout);
  230. dis = WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay());
  231. ret = 0;
  232. ret |= WWDisplay_GetForegroundColor(dis);
  233. ret |= WWDisplay_GetBackgroundColor(dis) << 2;
  234. WonXDisplay_Sync(WonX_GetWonXDisplay());
  235. printf("call : font_get_color() : return value = 0x%04x\n", (int)ret);
  236. fflush(stdout);
  237. /* タイマをもとに戻す */
  238. UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  239. return (ret);
  240. }
  241. static void _screen_set_char1(int screen, int x, int y,
  242. unsigned short int data)
  243. {
  244. int horizontal; /* 横方向反転フラグ */
  245. int vertical; /* 縦方向反転フラグ */
  246. int palette_num; /* パレット番号 */
  247. int character_num; /* 表示キャラクタ */
  248. WWDisplay display;
  249. WWScreen s;
  250. WWPalette p;
  251. WWCharacter c;
  252. display = WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay());
  253. s = WWDisplay_GetScreen(display, screen);
  254. horizontal = (data & (1 << 15)) ? 1 : 0;
  255. vertical = (data & (1 << 14)) ? 1 : 0;
  256. palette_num = (data >> 9) & 0x0f;
  257. character_num = data & 0x1ff;
  258. p = WWDisplay_GetPalette(display, palette_num);
  259. c = WWDisplay_GetCharacter(display, character_num);
  260. WWScreen_SetHorizontal(s, x, y, horizontal);
  261. WWScreen_SetVertical( s, x, y, vertical);
  262. WWScreen_SetPalette( s, x, y, p);
  263. WWScreen_SetCharacter( s, x, y, c);
  264. return;
  265. }
  266. /*
  267. * void * data だと,まちがって int * でデータを指定するようなバグが
  268. * 入る可能性があるので,unsigned short int * data にした.
  269. */
  270. void screen_set_char(int screen, int x, int y, int w, int h,
  271. unsigned short int * data)
  272. {
  273. int i, j;
  274. if (!WonX_IsCreated()) WonX_Create();
  275. /* タイマを一時停止する */
  276. UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  277. printf("call : screen_set_char() : screen = %d, x = %d, y = %d, w = %d, h = %d, data = %p\n",
  278. screen, x, y, w, h, (void *)data);
  279. fflush(stdout);
  280. for (j = 0; j < h; j++) {
  281. for (i = 0; i < w; i++) {
  282. _screen_set_char1(screen, x + i, y + j, *data);
  283. data++;
  284. }
  285. }
  286. WonXDisplay_Flush(WonX_GetWonXDisplay());
  287. printf("call : screen_set_char() : return value = none\n");
  288. fflush(stdout);
  289. /* タイマをもとに戻す */
  290. UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  291. return;
  292. }
  293. static unsigned int _screen_get_char1(int screen, int x, int y)
  294. {
  295. int horizontal; /* 横方向反転フラグ */
  296. int vertical; /* 縦方向反転フラグ */
  297. int palette_num; /* パレット番号 */
  298. int character_num; /* 表示キャラクタ */
  299. WWScreen s;
  300. WWPalette p;
  301. WWCharacter c;
  302. unsigned short int ret;
  303. s = WWDisplay_GetScreen(WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()),
  304. screen);
  305. horizontal = WWScreen_GetHorizontal(s, x, y);
  306. vertical = WWScreen_GetVertical( s, x, y);
  307. p = WWScreen_GetPalette( s, x, y);
  308. c = WWScreen_GetCharacter( s, x, y);
  309. palette_num = WWPalette_GetNumber(p);
  310. character_num = WWCharacter_GetNumber(c);
  311. ret = 0;
  312. ret |= horizontal << 15;
  313. ret |= vertical << 14;
  314. ret |= palette_num << 9;
  315. ret |= character_num;
  316. return (ret);
  317. }
  318. /*
  319. * void * data だと,まちがって int * でデータを指定するようなバグが
  320. * 入る可能性があるので,unsigned short int * data にした.
  321. */
  322. void screen_get_char(int screen, int x, int y, int w, int h,
  323. unsigned short int * data)
  324. {
  325. int i, j;
  326. if (!WonX_IsCreated()) WonX_Create();
  327. /* タイマを一時停止する */
  328. UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  329. printf("call : screen_get_char() : screen = %d, x = %d, y = %d, w = %d, h = %d, data = %p\n",
  330. screen, x, y, w, h, (void *)data);
  331. fflush(stdout);
  332. for (j = 0; j < h; j++) {
  333. for (i = 0; i < w; i++) {
  334. *data = _screen_get_char1(screen, x, y);
  335. data++;
  336. }
  337. }
  338. WonXDisplay_Sync(WonX_GetWonXDisplay());
  339. printf("call : screen_get_char() : return value = none\n");
  340. fflush(stdout);
  341. /* タイマをもとに戻す */
  342. UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  343. return;
  344. }
  345. unsigned int screen_get_char1(int screen, int x, int y)
  346. {
  347. unsigned short int ret;
  348. if (!WonX_IsCreated()) WonX_Create();
  349. /* タイマを一時停止する */
  350. UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  351. printf("call : screen_get_char1() : screen = %d, x = %d, y = %d\n",
  352. screen, x, y);
  353. fflush(stdout);
  354. ret = _screen_get_char1(screen, x, y);
  355. WonXDisplay_Sync(WonX_GetWonXDisplay());
  356. printf("call : screen_get_char1() : return value = 0x%04x\n", (int)ret);
  357. fflush(stdout);
  358. /* タイマをもとに戻す */
  359. UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  360. return (ret);
  361. }
  362. void screen_fill_char(int screen, int x, int y, int w, int h,
  363. unsigned int data)
  364. {
  365. int i, j;
  366. if (!WonX_IsCreated()) WonX_Create();
  367. /* タイマを一時停止する */
  368. UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  369. printf("call : screen_fill_char() : screen = %d, x = %d, y = %d, w = %d, h = %d, data = 0x%04x\n",
  370. screen, x, y, w, h, (int)data);
  371. fflush(stdout);
  372. for (j = 0; j < h; j++) {
  373. for (i = 0; i < w; i++) {
  374. _screen_set_char1(screen, x + i, y + j, data);
  375. }
  376. }
  377. WonXDisplay_Flush(WonX_GetWonXDisplay());
  378. printf("call : screen_fill_char() : return value = none\n"); fflush(stdout);
  379. /* タイマをもとに戻す */
  380. UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  381. return;
  382. }
  383. void screen_fill_attr(int screen, int x, int y, int w, int h,
  384. unsigned int data, unsigned int mask)
  385. {
  386. int i, j;
  387. unsigned short int c;
  388. if (!WonX_IsCreated()) WonX_Create();
  389. /* タイマを一時停止する */
  390. UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  391. printf("call : screen_fill_attr() : screen = %d, x = %d, y = %d, w = %d, h = %d, data = 0x%04x, mask = 0x%04x\n",
  392. screen, x, y, w, h, (int)data, (int)mask); fflush(stdout);
  393. for (j = 0; j < h; j++) {
  394. for (i = 0; i < w; i++) {
  395. c = _screen_get_char1(screen, x + i, y + j);
  396. c &= mask;
  397. c |= data;
  398. _screen_set_char1(screen, x + i, y + j, c);
  399. }
  400. }
  401. WonXDisplay_Flush(WonX_GetWonXDisplay());
  402. printf("call : screen_fill_attr() : return value = none\n");
  403. fflush(stdout);
  404. /* タイマをもとに戻す */
  405. UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  406. return;
  407. }
  408. void sprite_set_range(unsigned int start, unsigned int number)
  409. {
  410. if (!WonX_IsCreated()) WonX_Create();
  411. /* タイマを一時停止する */
  412. UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  413. printf("call : sprite_set_range() : start = %u, number = %u\n",
  414. (int)start, (int)number); fflush(stdout);
  415. WWDisplay_SetSpriteStart(WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()),
  416. start);
  417. WWDisplay_SetSpriteCount(WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()),
  418. number);
  419. WonXDisplay_Flush(WonX_GetWonXDisplay());
  420. printf("call : sprite_set_range() : return value = none\n");
  421. fflush(stdout);
  422. /* タイマをもとに戻す */
  423. UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  424. return;
  425. }
  426. static void _sprite_set_char(unsigned int sprite_num, unsigned int data)
  427. {
  428. WWSprite s;
  429. WWPalette p;
  430. WWCharacter c;
  431. s = WWDisplay_GetSprite(WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()),
  432. sprite_num);
  433. WWSprite_SetHorizontal(s, (data >> 15) ? 1 : 0);
  434. WWSprite_SetVertical( s, (data >> 14) ? 1 : 0);
  435. WWSprite_SetPriority( s, (data >> 13) ? 1 : 0);
  436. WWSprite_SetClipping( s, (data >> 12) ? 1 : 0);
  437. /* 8を引いた値でパレット番号が指定されるので,8を足してやる */
  438. p = WWDisplay_GetPalette(WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()),
  439. ((data >> 9) & 0x07) + 8);
  440. c = WWDisplay_GetCharacter(WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()),
  441. data & 0x1ff);
  442. WWSprite_SetPalette(s, p);
  443. WWSprite_SetCharacter(s, c);
  444. return;
  445. }
  446. void sprite_set_char(unsigned int sprite_num, unsigned int data)
  447. {
  448. if (!WonX_IsCreated()) WonX_Create();
  449. /* タイマを一時停止する */
  450. UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  451. printf("call : sprite_set_char() : number = %u, data = 0x%04x\n",
  452. (int)sprite_num, (int)data); fflush(stdout);
  453. _sprite_set_char(sprite_num, data);
  454. WonXDisplay_Flush(WonX_GetWonXDisplay());
  455. printf("call : sprite_set_char() : return value = none\n");
  456. fflush(stdout);
  457. /* タイマをもとに戻す */
  458. UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  459. return;
  460. }
  461. static unsigned int _sprite_get_char(unsigned int sprite_num)
  462. {
  463. WWSprite s;
  464. WWPalette p;
  465. WWCharacter c;
  466. unsigned short int ret;
  467. s = WWDisplay_GetSprite(WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()),
  468. sprite_num);
  469. ret = 0;
  470. ret |= (WWSprite_GetHorizontal(s) ? 1 : 0) << 15;
  471. ret |= (WWSprite_GetVertical( s) ? 1 : 0) << 14;
  472. ret |= (WWSprite_GetPriority( s) ? 1 : 0) << 13;
  473. ret |= (WWSprite_GetClipping( s) ? 1 : 0) << 12;
  474. p = WWSprite_GetPalette(s);
  475. c = WWSprite_GetCharacter(s);
  476. /* 8を引いた値でパレット番号が指定されるので,8を引いてやる */
  477. ret |= ((WWPalette_GetNumber(p) - 8) & 0x07) << 9;
  478. ret |= WWCharacter_GetNumber(c);
  479. return (ret);
  480. }
  481. unsigned int sprite_get_char(unsigned int sprite_num)
  482. {
  483. unsigned short int ret;
  484. if (!WonX_IsCreated()) WonX_Create();
  485. /* タイマを一時停止する */
  486. UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  487. printf("call : sprite_get_char() : number = %u\n", (int)sprite_num);
  488. fflush(stdout);
  489. ret = _sprite_get_char(sprite_num);
  490. WonXDisplay_Sync(WonX_GetWonXDisplay());
  491. printf("call : sprite_get_char() : return value = 0x%04x\n", (int)ret);
  492. fflush(stdout);
  493. /* タイマをもとに戻す */
  494. UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  495. return (ret);
  496. }
  497. static void _sprite_set_location(unsigned int sprite_num, int x, int y)
  498. {
  499. WWSprite s;
  500. s = WWDisplay_GetSprite(WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()),
  501. sprite_num);
  502. WWSprite_SetPosition(s, x, y);
  503. return;
  504. }
  505. void sprite_set_location(unsigned int sprite_num, int x, int y)
  506. {
  507. if (!WonX_IsCreated()) WonX_Create();
  508. /* タイマを一時停止する */
  509. UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  510. printf("call : sprite_set_location() : number = %u, x = %d, y = %d\n",
  511. (int)sprite_num, x, y);
  512. fflush(stdout);
  513. _sprite_set_location(sprite_num, x, y);
  514. WonXDisplay_Flush(WonX_GetWonXDisplay());
  515. printf("call : sprite_set_location() : return value = none\n");
  516. fflush(stdout);
  517. /* タイマをもとに戻す */
  518. UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  519. return;
  520. }
  521. static unsigned int _sprite_get_location(unsigned int sprite_num)
  522. {
  523. WWSprite s;
  524. unsigned short int ret;
  525. s = WWDisplay_GetSprite(WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()),
  526. sprite_num);
  527. ret = (WWSprite_GetY(s) << 8) | WWSprite_GetX(s);
  528. return (ret);
  529. }
  530. unsigned int sprite_get_location(unsigned int sprite_num)
  531. {
  532. unsigned short int ret;
  533. if (!WonX_IsCreated()) WonX_Create();
  534. /* タイマを一時停止する */
  535. UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  536. printf("call : sprite_get_location() : number = %u\n", (int)sprite_num);
  537. fflush(stdout);
  538. ret = _sprite_get_location(sprite_num);
  539. WonXDisplay_Sync(WonX_GetWonXDisplay());
  540. printf("call : sprite_get_location() : return value = 0x%04x\n", (int)ret);
  541. fflush(stdout);
  542. /* タイマをもとに戻す */
  543. UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  544. return (ret);
  545. }
  546. static void _sprite_set_char_location(unsigned int sprite_num,
  547. unsigned int data, int x, int y)
  548. {
  549. _sprite_set_char(sprite_num, data);
  550. _sprite_set_location(sprite_num, x, y);
  551. return;
  552. }
  553. void sprite_set_char_location(unsigned int sprite_num,
  554. unsigned int data, int x, int y)
  555. {
  556. if (!WonX_IsCreated()) WonX_Create();
  557. /* タイマを一時停止する */
  558. UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  559. printf("call : sprite_set_char_location() : number = %u, data = 0x%04x, x = %d, y = %d\n",
  560. (int)sprite_num, (int)data, x, y);
  561. fflush(stdout);
  562. _sprite_set_char_location(sprite_num, data, x, y);
  563. WonXDisplay_Flush(WonX_GetWonXDisplay());
  564. printf("call : sprite_set_char_location() : return value = none\n");
  565. fflush(stdout);
  566. /* タイマをもとに戻す */
  567. UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  568. return;
  569. }
  570. unsigned long int sprite_get_char_location(unsigned int sprite_num)
  571. {
  572. unsigned long int ret;
  573. if (!WonX_IsCreated()) WonX_Create();
  574. /* タイマを一時停止する */
  575. UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  576. printf("call : sprite_get_char_location() : number = %u\n", (int)sprite_num);
  577. fflush(stdout);
  578. ret = 0;
  579. ret |= ((unsigned long int)_sprite_get_char(sprite_num));
  580. ret |= (unsigned long int)_sprite_get_location(sprite_num) << 16;
  581. WonXDisplay_Sync(WonX_GetWonXDisplay());
  582. printf("call : sprite_get_char_location() : return value = 0x%08x\n",
  583. (int)ret);
  584. fflush(stdout);
  585. /* タイマをもとに戻す */
  586. UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  587. return (ret);
  588. }
  589. /*
  590. * void * data だと,まちがって int * でデータを指定するようなバグが
  591. * 入る可能性があるので,unsigned long int * data にした.
  592. */
  593. void sprite_set_data(unsigned int sprite_num, unsigned int count,
  594. unsigned long int * data)
  595. {
  596. int i;
  597. if (!WonX_IsCreated()) WonX_Create();
  598. /* タイマを一時停止する */
  599. UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  600. printf("call : sprite_set_data() : number = %u, count = %u, data = %p\n",
  601. (int)sprite_num, (int)count, (void *)data);
  602. fflush(stdout);
  603. for (i = 0; i < count; i++) {
  604. _sprite_set_char_location(sprite_num + i,
  605. data[i] >> 16,
  606. (data[i] >> 8) & 0xff,
  607. data[i] & 0xff);
  608. }
  609. WonXDisplay_Flush(WonX_GetWonXDisplay());
  610. printf("call : sprite_set_data() : return value = none\n");
  611. fflush(stdout);
  612. /* タイマをもとに戻す */
  613. UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  614. return;
  615. }
  616. void screen_set_scroll(int screen, int x, int y)
  617. {
  618. WWScreen s;
  619. if (!WonX_IsCreated()) WonX_Create();
  620. /* タイマを一時停止する */
  621. UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  622. printf("call : screen_set_scroll() : screen = %d, x = %d, y = %d\n",
  623. screen, x, y);
  624. fflush(stdout);
  625. s = WWDisplay_GetScreen(WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()),
  626. screen);
  627. WWScreen_SetRollX(s, x);
  628. WWScreen_SetRollY(s, y);
  629. WonXDisplay_Flush(WonX_GetWonXDisplay());
  630. printf("call : screen_set_scroll() : return value = none\n");
  631. fflush(stdout);
  632. /* タイマをもとに戻す */
  633. UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  634. return;
  635. }
  636. unsigned int screen_get_scroll(int screen)
  637. {
  638. unsigned short int ret;
  639. WWScreen s;
  640. if (!WonX_IsCreated()) WonX_Create();
  641. /* タイマを一時停止する */
  642. UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  643. printf("call : screen_get_scroll() : screen = %d\n", screen); fflush(stdout);
  644. s = WWDisplay_GetScreen(WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()),
  645. screen);
  646. ret = 0;
  647. ret |= WWScreen_GetRollX(s);
  648. ret |= WWScreen_GetRollY(s) << 8;
  649. WonXDisplay_Sync(WonX_GetWonXDisplay());
  650. printf("call : screen_get_scroll() : return value = %u\n", (int)ret);
  651. fflush(stdout);
  652. /* タイマをもとに戻す */
  653. UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  654. return (ret);
  655. }
  656. void screen2_set_window(int x, int y, int w, int h)
  657. {
  658. WWScreen s;
  659. if (!WonX_IsCreated()) WonX_Create();
  660. /* タイマを一時停止する */
  661. UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  662. printf("call : screen2_set_window() : x = %d, y = %d, width = %d, height = %d\n",
  663. x, y, w, h); fflush(stdout);
  664. s = WWDisplay_GetScreen(WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()),
  665. SCREEN2);
  666. WWScreen_SetDrawX(s, x);
  667. WWScreen_SetDrawY(s, y);
  668. WWScreen_SetDrawWidth( s, w);
  669. WWScreen_SetDrawHeight(s, h);
  670. WonXDisplay_Flush(WonX_GetWonXDisplay());
  671. printf("call : screen2_set_window() : return value = none\n");
  672. fflush(stdout);
  673. /* タイマをもとに戻す */
  674. UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  675. return;
  676. }
  677. unsigned long int screen2_get_window(void)
  678. {
  679. WWScreen s;
  680. unsigned short int xy;
  681. unsigned short int wh;
  682. unsigned long int ret;
  683. if (!WonX_IsCreated()) WonX_Create();
  684. /* タイマを一時停止する */
  685. UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  686. printf("call : screen2_get_window() : \n"); fflush(stdout);
  687. s = WWDisplay_GetScreen(WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()),
  688. SCREEN2);
  689. xy =
  690. (((unsigned short int)WWScreen_GetDrawY(s) << 8) & 0xff00) |
  691. ((unsigned short int)WWScreen_GetDrawX(s) & 0x00ff);
  692. wh =
  693. (((unsigned short int)WWScreen_GetDrawHeight(s) << 8) & 0xff00) |
  694. ((unsigned short int)WWScreen_GetDrawWidth(s) & 0x00ff);
  695. ret = ((unsigned long int)wh) << 16 | xy;
  696. WonXDisplay_Sync(WonX_GetWonXDisplay());
  697. printf("call : screen2_get_window() : return value = 0x%08x\n", (int)ret);
  698. fflush(stdout);
  699. /* タイマをもとに戻す */
  700. UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  701. return (ret);
  702. }
  703. void sprite_set_window(int x, int y, int w, int h)
  704. {
  705. WWDisplay d;
  706. if (!WonX_IsCreated()) WonX_Create();
  707. /* タイマを一時停止する */
  708. UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  709. printf("call : sprite_set_window() : x = %d, y = %d, w = %d, h = %d\n",
  710. x, y, w, h);
  711. fflush(stdout);
  712. d = WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay());
  713. WWDisplay_SetSpriteWindowX(d, x);
  714. WWDisplay_SetSpriteWindowY(d, y);
  715. WWDisplay_SetSpriteWindowWidth(d, w);
  716. WWDisplay_SetSpriteWindowHeight(d, h);
  717. WonXDisplay_Flush(WonX_GetWonXDisplay());
  718. printf("call : sprite_set_window() : return value = none\n");
  719. fflush(stdout);
  720. /* タイマをもとに戻す */
  721. UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  722. return;
  723. }
  724. unsigned long int sprite_get_window(void)
  725. {
  726. WWDisplay d;
  727. unsigned short int xy;
  728. unsigned short int wh;
  729. unsigned long int ret;
  730. if (!WonX_IsCreated()) WonX_Create();
  731. /* タイマを一時停止する */
  732. UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  733. printf("call : sprite_get_window() : \n");
  734. fflush(stdout);
  735. d = WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay());
  736. xy =
  737. (((unsigned short int)WWDisplay_GetSpriteWindowY(d) << 8) & 0xff00) |
  738. ((unsigned short int)WWDisplay_GetSpriteWindowX(d) & 0x00ff);
  739. wh =
  740. (((unsigned short int)WWDisplay_GetSpriteWindowHeight(d) << 8) & 0xff00) |
  741. ((unsigned short int)WWDisplay_GetSpriteWindowWidth(d) & 0x00ff);
  742. ret = ((unsigned long int)wh) << 16 | xy;
  743. WonXDisplay_Sync(WonX_GetWonXDisplay());
  744. printf("call : sprite_get_window() : return value = 0x%08x\n", (int)ret);
  745. fflush(stdout);
  746. /* タイマをもとに戻す */
  747. UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  748. return (ret);
  749. }
  750. void palette_set_color(unsigned int palette_num, unsigned int colors)
  751. {
  752. int mapped_colors[4];
  753. WWPalette palette;
  754. if (!WonX_IsCreated()) WonX_Create();
  755. /* タイマを一時停止する */
  756. UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  757. printf("call : palette_set_color() : number = %u, colors = 0x%04x\n",
  758. (int)palette_num, (int)colors); fflush(stdout);
  759. mapped_colors[0] = colors & 0x07;
  760. mapped_colors[1] = (colors >> 4) & 0x07;
  761. mapped_colors[2] = (colors >> 8) & 0x07;
  762. mapped_colors[3] = (colors >> 12) & 0x07;
  763. palette =
  764. WWDisplay_GetPalette(WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()),
  765. palette_num);
  766. WWPalette_SetMappedColors(palette, mapped_colors);
  767. WonXDisplay_Flush(WonX_GetWonXDisplay());
  768. printf("call : palette_set_color() : return value = none\n");
  769. fflush(stdout);
  770. /* タイマをもとに戻す */
  771. UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  772. return;
  773. }
  774. unsigned int palette_get_color(unsigned int palette_num)
  775. {
  776. int mapped_colors[4];
  777. WWPalette palette;
  778. unsigned short int ret;
  779. if (!WonX_IsCreated()) WonX_Create();
  780. /* タイマを一時停止する */
  781. UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  782. printf("call : palette_get_color() : number = %u\n", (int)palette_num);
  783. fflush(stdout);
  784. palette =
  785. WWDisplay_GetPalette(WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()),
  786. palette_num);
  787. /* WonX-2.0 以前では,透明色は -1 で返されていたので注意が必要だった */
  788. WWPalette_GetMappedColors(palette, mapped_colors);
  789. #if 0 /* WonX-2.0 以前では,透明色の処理が必要だった.一応コードを残しておく */
  790. /* 透明色は -1 で表されるので,0にする */
  791. for (i = 0; i < 4; i++)
  792. if (mapped_colors[i] == -1) mapped_colors[i] = 0;
  793. #endif
  794. ret = 0;
  795. ret |= mapped_colors[0] & 0x07;
  796. ret |= (mapped_colors[1] & 0x07) << 4;
  797. ret |= (mapped_colors[2] & 0x07) << 8;
  798. ret |= (mapped_colors[3] & 0x07) << 12;
  799. WonXDisplay_Sync(WonX_GetWonXDisplay());
  800. printf("call : palette_get_color() : return value = 0x%04x\n", (int)ret);
  801. fflush(stdout);
  802. /* タイマをもとに戻す */
  803. UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  804. return (ret);
  805. }
  806. void lcd_set_color(unsigned int colors0, unsigned int colors1)
  807. {
  808. WWColorMap color_map;
  809. int lcd_colors[8];
  810. if (!WonX_IsCreated()) WonX_Create();
  811. /* タイマを一時停止する */
  812. UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  813. printf("call : lcd_set_color() : colors0 = 0x%04x, colors1 = 0x%04x\n",
  814. (int)colors0, (int)colors1); fflush(stdout);
  815. lcd_colors[0] = colors0 & 0x0f;
  816. lcd_colors[1] = (colors0 >> 4) & 0x0f;
  817. lcd_colors[2] = (colors0 >> 8) & 0x0f;
  818. lcd_colors[3] = (colors0 >> 12) & 0x0f;
  819. lcd_colors[4] = colors1 & 0x0f;
  820. lcd_colors[5] = (colors1 >> 4) & 0x0f;
  821. lcd_colors[6] = (colors1 >> 8) & 0x0f;
  822. lcd_colors[7] = (colors1 >> 12) & 0x0f;
  823. color_map =
  824. WWDisplay_GetColorMap(WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()));
  825. WWColorMap_SetLCDColors(color_map, lcd_colors);
  826. WonXDisplay_Flush(WonX_GetWonXDisplay());
  827. printf("call : lcd_set_color() : return value = none\n");
  828. fflush(stdout);
  829. /* タイマをもとに戻す */
  830. UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  831. return;
  832. }
  833. unsigned long int lcd_get_color(void)
  834. {
  835. WWColorMap color_map;
  836. int lcd_colors[8];
  837. unsigned long int ret;
  838. if (!WonX_IsCreated()) WonX_Create();
  839. /* タイマを一時停止する */
  840. UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  841. printf("call : lcd_get_color() : \n"); fflush(stdout);
  842. color_map =
  843. WWDisplay_GetColorMap(WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()));
  844. WWColorMap_GetLCDColors(color_map, lcd_colors);
  845. ret = 0;
  846. ret |= (unsigned long int)lcd_colors[0] & 0x0f;
  847. ret |= ((unsigned long int)lcd_colors[1] & 0x0f) << 4;
  848. ret |= ((unsigned long int)lcd_colors[2] & 0x0f) << 8;
  849. ret |= ((unsigned long int)lcd_colors[3] & 0x0f) << 12;
  850. ret |= ((unsigned long int)lcd_colors[4] & 0x0f) << 16;
  851. ret |= ((unsigned long int)lcd_colors[5] & 0x0f) << 20;
  852. ret |= ((unsigned long int)lcd_colors[6] & 0x0f) << 24;
  853. ret |= ((unsigned long int)lcd_colors[7] & 0x0f) << 28;
  854. WonXDisplay_Sync(WonX_GetWonXDisplay());
  855. printf("call : lcd_get_color() : return value = 0x%08x\n", (int)ret);
  856. fflush(stdout);
  857. /* タイマをもとに戻す */
  858. UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  859. return (ret);
  860. }
  861. void lcd_set_segments(unsigned int segments)
  862. {
  863. if (!WonX_IsCreated()) WonX_Create();
  864. /* タイマを一時停止する */
  865. UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  866. /* セグメント表示は未サポートか? */
  867. WonXDisplay_Flush(WonX_GetWonXDisplay());
  868. /* タイマをもとに戻す */
  869. UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  870. return;
  871. }
  872. unsigned int lcd_get_segments(void)
  873. {
  874. if (!WonX_IsCreated()) WonX_Create();
  875. /* タイマを一時停止する */
  876. UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  877. /* セグメント表示は未サポートか? */
  878. WonXDisplay_Sync(WonX_GetWonXDisplay());
  879. /* タイマをもとに戻す */
  880. UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  881. return (0);
  882. }
  883. void lcd_set_sleep(unsigned int slp)
  884. {
  885. if (!WonX_IsCreated()) WonX_Create();
  886. /* タイマを一時停止する */
  887. UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  888. /* ? */
  889. WonXDisplay_Sync(WonX_GetWonXDisplay());
  890. /* タイマをもとに戻す */
  891. UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  892. return;
  893. }
  894. unsigned int lcd_get_sleep(void)
  895. {
  896. if (!WonX_IsCreated()) WonX_Create();
  897. /* タイマを一時停止する */
  898. UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  899. /* ? */
  900. WonXDisplay_Sync(WonX_GetWonXDisplay());
  901. /* タイマをもとに戻す */
  902. UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  903. return (0);
  904. }
  905. void screen_set_vram(int screen, int location_id)
  906. {
  907. if (!WonX_IsCreated()) WonX_Create();
  908. /* タイマを一時停止する */
  909. UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  910. /* 未サポート */
  911. WonXDisplay_Sync(WonX_GetWonXDisplay());
  912. /* タイマをもとに戻す */
  913. UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  914. return;
  915. }
  916. void sprite_set_vram(int location_id)
  917. {
  918. if (!WonX_IsCreated()) WonX_Create();
  919. /* タイマを一時停止する */
  920. UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  921. /* 未サポート */
  922. WonXDisplay_Sync(WonX_GetWonXDisplay());
  923. /* タイマをもとに戻す */
  924. UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  925. return;
  926. }
  927. /*****************************************************************************/
  928. /* ここまで */
  929. /*****************************************************************************/
  930. /*****************************************************************************/
  931. /* End of File. */
  932. /*****************************************************************************/