disp.c 33 KB

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