disp.c 34 KB

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