display.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  1. // Displaying routines
  2. void *Port=0;
  3. int ycur=0;
  4. #ifdef FORCE_SMALL_FONT
  5. #define char_width 4
  6. #define virtual_char_width 1
  7. #define char_height 6
  8. #define physical_to_virtual(px) ((px)>>2)
  9. #define virtual_to_physical(vx) ((vx)<<2)
  10. typedef char CHAR[char_height];
  11. #else
  12. int small_font = -1;
  13. int char_width = 0;
  14. int virtual_char_width = 0;
  15. int char_height = 0;
  16. enum { FONT_MEDIUM = 0, FONT_SMALL = 1 };
  17. void set_font(int font) {
  18. small_font = font;
  19. char_width = font==FONT_MEDIUM ? 6 : 4;
  20. virtual_char_width = font==FONT_MEDIUM ? 6 : 1;
  21. char_height = font==FONT_MEDIUM ? 8 : 6;
  22. }
  23. int physical_to_virtual(int px) {
  24. if (small_font)
  25. return px>>2;
  26. return px;
  27. }
  28. int virtual_to_physical(int vx) {
  29. if (small_font)
  30. return vx<<2;
  31. return vx;
  32. }
  33. #endif
  34. #ifdef __GTC__
  35. void SmallDChar(int x,int y,char c) __attribute__((__regparm__(3,0)));
  36. void SmallDCharS(int x,int y,char c) __attribute__((__regparm__(3,0)));
  37. void SmallDCharX(int x,int y,char c) __attribute__((__regparm__(3,0)));
  38. #define xregparm(g,d,a) __attribute__((regparm(d,a)))
  39. #else
  40. void __attribute__((__regparm__(3))) SmallDChar(int x,int y,char c);
  41. void __attribute__((__regparm__(3))) SmallDCharS(int x,int y,char c);
  42. void __attribute__((__regparm__(3))) SmallDCharX(int x,int y,char c);
  43. #define xregparm(g,d,a) __attribute__((regparm(g)))
  44. #endif
  45. #ifdef __GTC__
  46. #define SECTION_FONT
  47. asm {
  48. even
  49. SmallDCharX:
  50. and.w #0xFF,d2
  51. add.w d2,d2
  52. move.w d2,a1
  53. add.w d2,d2
  54. add.w a1,d2
  55. lea font(pc),a1
  56. add.w d2,a1
  57. add.w d1,d1
  58. move.w d1,d2
  59. lsl.w #4,d1
  60. sub.w d2,d1
  61. moveq #0x0000000F,d2
  62. asr.w #1,d0
  63. bcs.s \X_ok_d2
  64. moveq #0xFFFFFFF0,d2
  65. \X_ok_d2:
  66. move.l Port,a0
  67. add.w d1,d0
  68. add.w d0,a0
  69. move.b (a1)+,d0
  70. and.b d2,d0
  71. eor.b d0,(a0)
  72. move.b (a1)+,d0
  73. and.b d2,d0
  74. eor.b d0,30(a0)
  75. move.b (a1)+,d0
  76. and.b d2,d0
  77. eor.b d0,60(a0)
  78. move.b (a1)+,d0
  79. and.b d2,d0
  80. eor.b d0,90(a0)
  81. move.b (a1)+,d0
  82. and.b d2,d0
  83. eor.b d0,120(a0)
  84. move.b (a1),d0
  85. and.b d2,d0
  86. eor.b d0,150(a0)
  87. rts
  88. even
  89. SmallDCharS:
  90. move.l Port,a0
  91. and.w #0xFF,d2
  92. add.w d2,d2
  93. move.w d2,a1
  94. add.w d2,d2
  95. add.w a1,d2
  96. lea font(pc),a1
  97. add.w d2,a1
  98. add.w d1,d1
  99. move.w d1,d2
  100. lsl.w #4,d1
  101. sub.w d2,d1
  102. moveq #0x0000000F,d2
  103. asr.w #1,d0
  104. bcs.s \S_ok_d2
  105. moveq #0xFFFFFFF0,d2
  106. \S_ok_d2:
  107. add.w d1,d0
  108. add.w d0,a0
  109. move.b (a1)+,d0
  110. not.b d0
  111. and.b d2,d0
  112. or.b d0,(a0)
  113. move.b (a1)+,d0
  114. not.b d0
  115. and.b d2,d0
  116. or.b d0,30(a0)
  117. move.b (a1)+,d0
  118. not.b d0
  119. and.b d2,d0
  120. or.b d0,60(a0)
  121. move.b (a1)+,d0
  122. not.b d0
  123. and.b d2,d0
  124. or.b d0,90(a0)
  125. move.b (a1)+,d0
  126. not.b d0
  127. and.b d2,d0
  128. or.b d0,120(a0)
  129. move.b (a1),d0
  130. not.b d0
  131. and.b d2,d0
  132. or.b d0,150(a0)
  133. rts
  134. even
  135. SmallDChar:
  136. and.w #0xFF,d2
  137. add.w d2,d2
  138. move.w d2,a1
  139. add.w d2,d2
  140. add.w a1,d2
  141. lea font(pc),a1
  142. add.w d2,a1
  143. add.w d1,d1
  144. move.w d1,d2
  145. lsl.w #4,d1
  146. sub.w d2,d1
  147. moveq #0x0000000F,d2
  148. asr.w #1,d0
  149. bcs.s \ok_d2
  150. moveq #0xFFFFFFF0,d2
  151. \ok_d2:
  152. move.l Port,a0
  153. add.w d1,d0
  154. add.w d0,a0
  155. move.b (a1)+,d0
  156. and.b d2,d0
  157. or.b d0,(a0)
  158. move.b (a1)+,d0
  159. and.b d2,d0
  160. or.b d0,30(a0)
  161. move.b (a1)+,d0
  162. and.b d2,d0
  163. or.b d0,60(a0)
  164. move.b (a1)+,d0
  165. and.b d2,d0
  166. or.b d0,90(a0)
  167. move.b (a1)+,d0
  168. and.b d2,d0
  169. or.b d0,120(a0)
  170. move.b (a1),d0
  171. and.b d2,d0
  172. or.b d0,150(a0)
  173. rts
  174. }
  175. #else
  176. #define ASM_SECTION_FONT //".section fontmanip"
  177. #define SECTION_FONT //__attribute__((section("fontmanip")))
  178. asm(ASM_SECTION_FONT "
  179. .even
  180. .globl SmallDCharX
  181. SmallDCharX:
  182. and.w #0xFF,%d2
  183. add.w %d2,%d2
  184. move.w %d2,%a1
  185. add.w %d2,%d2
  186. add.w #262,%d2 /* to be able to use PC-relative font */
  187. add.w %a1,%d2
  188. lea font-262(%pc,%d2.w),%a1 /* this offset should be 2 (0 doesn't seem to work) */
  189. add.w %d1,%d1
  190. move.w %d1,%d2
  191. lsl.w #4,%d1
  192. sub.w %d2,%d1
  193. moveq #0x0000000F,%d2
  194. asr.w #1,%d0
  195. bcs.s DChX_ok_d2
  196. moveq #0xFFFFFFF0,%d2
  197. DChX_ok_d2:
  198. move.l Port,%a0
  199. add.w %d1,%d0
  200. add.w %d0,%a0
  201. move.b (%a1)+,%d0
  202. and.b %d2,%d0
  203. eor.b %d0,(%a0)
  204. move.b (%a1)+,%d0
  205. and.b %d2,%d0
  206. eor.b %d0,30(%a0)
  207. move.b (%a1)+,%d0
  208. and.b %d2,%d0
  209. eor.b %d0,60(%a0)
  210. move.b (%a1)+,%d0
  211. and.b %d2,%d0
  212. eor.b %d0,90(%a0)
  213. move.b (%a1)+,%d0
  214. and.b %d2,%d0
  215. eor.b %d0,120(%a0)
  216. move.b (%a1),%d0
  217. and.b %d2,%d0
  218. eor.b %d0,150(%a0)
  219. rts
  220. .even
  221. .globl SmallDCharS
  222. SmallDCharS:
  223. move.l Port,%a0
  224. and.w #0xFF,%d2
  225. addq.w #8,%d2 /* to be able to use PC-relative font */
  226. add.w %d2,%d2
  227. move.w %d2,%a1
  228. add.w %d2,%d2
  229. add.w %a1,%d2
  230. lea font-48(%pc,%d2.w),%a1
  231. add.w %d1,%d1
  232. move.w %d1,%d2
  233. lsl.w #4,%d1
  234. sub.w %d2,%d1
  235. moveq #0x0000000F,%d2
  236. asr.w #1,%d0
  237. bcs.s DChS_ok_d2
  238. moveq #0xFFFFFFF0,%d2
  239. DChS_ok_d2:
  240. add.w %d1,%d0
  241. add.w %d0,%a0
  242. move.b (%a1)+,%d0
  243. not.b %d0
  244. and.b %d2,%d0
  245. or.b %d0,(%a0)
  246. move.b (%a1)+,%d0
  247. not.b %d0
  248. and.b %d2,%d0
  249. or.b %d0,30(%a0)
  250. move.b (%a1)+,%d0
  251. not.b %d0
  252. and.b %d2,%d0
  253. or.b %d0,60(%a0)
  254. move.b (%a1)+,%d0
  255. not.b %d0
  256. and.b %d2,%d0
  257. or.b %d0,90(%a0)
  258. move.b (%a1)+,%d0
  259. not.b %d0
  260. and.b %d2,%d0
  261. or.b %d0,120(%a0)
  262. move.b (%a1),%d0
  263. not.b %d0
  264. and.b %d2,%d0
  265. or.b %d0,150(%a0)
  266. rts
  267. .even
  268. .globl SmallDChar
  269. SmallDChar:
  270. and.w #0xFF,%d2
  271. add.w %d2,%d2
  272. move.w %d2,%a1
  273. add.w %d2,%d2
  274. add.w %a1,%d2
  275. lea font(%pc,%d2.w),%a1
  276. add.w %d1,%d1
  277. move.w %d1,%d2
  278. lsl.w #4,%d1
  279. sub.w %d2,%d1
  280. moveq #0x0000000F,%d2
  281. asr.w #1,%d0
  282. bcs.s DCh_ok_d2
  283. moveq #0xFFFFFFF0,%d2
  284. DCh_ok_d2:
  285. move.l Port,%a0
  286. add.w %d1,%d0
  287. add.w %d0,%a0
  288. move.b (%a1)+,%d0
  289. and.b %d2,%d0
  290. or.b %d0,(%a0)
  291. move.b (%a1)+,%d0
  292. and.b %d2,%d0
  293. or.b %d0,30(%a0)
  294. move.b (%a1)+,%d0
  295. and.b %d2,%d0
  296. or.b %d0,60(%a0)
  297. move.b (%a1)+,%d0
  298. and.b %d2,%d0
  299. or.b %d0,90(%a0)
  300. move.b (%a1)+,%d0
  301. and.b %d2,%d0
  302. or.b %d0,120(%a0)
  303. move.b (%a1),%d0
  304. and.b %d2,%d0
  305. or.b %d0,150(%a0)
  306. rts
  307. ");
  308. #endif
  309. const unsigned short SECTION_FONT font[]={
  310. #include "font.h"
  311. };
  312. #define DOTS "\xA0\x01"
  313. #define DOTS1 '\xA0'
  314. #define DOTS2 '\x01'
  315. #define UPARR '\x13'
  316. #define DNARR '\x14'
  317. char icons[]={
  318. 0b11111100,
  319. 0b11111100,
  320. 0b11000100,
  321. 0b10110100,
  322. 0b10110100,
  323. 0b11000100,
  324. 0b11111100,
  325. 0b11111100,
  326. 0b11001100,
  327. 0b10110100,
  328. 0b10000100,
  329. 0b10110100,
  330. 0b10110100,
  331. 0b11111100,
  332. 0b00000000,
  333. 0b00000000,
  334. 0b00111000,
  335. 0b01001000,
  336. 0b01001000,
  337. 0b00111000,
  338. 0b00000000,
  339. #ifdef _89
  340. 0b00000000,
  341. 0b00100000,
  342. 0b01110000,
  343. 0b11111000,
  344. 0b01110000,
  345. 0b00100000,
  346. 0b00000000,
  347. 0b00000000,
  348. 0b00100000,
  349. 0b01110000,
  350. 0b11111000,
  351. 0b01110000,
  352. 0b01110000,
  353. 0b00000000,
  354. #else
  355. 0b00000000,
  356. 0b00100000,
  357. 0b01110000,
  358. 0b11111000,
  359. 0b01110000,
  360. 0b01110000,
  361. 0b00000000,
  362. 0b00000000,
  363. 0b00100000,
  364. 0b01110000,
  365. 0b11111000,
  366. 0b01110000,
  367. 0b00100000,
  368. 0b00000000,
  369. #endif
  370. 0b00000000,
  371. 0b00110000,
  372. 0b01001000,
  373. 0b00010000,
  374. 0b00100000,
  375. 0b01111000,
  376. 0b00000000,
  377. };
  378. /*void __attribute__((__regparm__(3))) SmallDChar(int x,int y,char c) {
  379. char *p=((CHAR *)font)[c&255],*s=Port+(x>>1)+y*30;
  380. int m;
  381. if (x&1) m=0x0F;
  382. else m=0xF0;
  383. s[30*0]|=(*p++)&m;
  384. s[30*1]|=(*p++)&m;
  385. s[30*2]|=(*p++)&m;
  386. s[30*3]|=(*p++)&m;
  387. s[30*4]|=(*p++)&m;
  388. s[30*5]|=(*p++)&m;
  389. }
  390. void __attribute__((__regparm__(3))) SmallDCharS(int x,int y,char c) {
  391. char *p=((CHAR *)font)[c&255],*s=Port+(x>>1)+y*30;
  392. int m;
  393. if (x&1) m=0x0F;
  394. else m=0xF0;
  395. s[30*0]|=(~*p++)&m;
  396. s[30*1]|=(~*p++)&m;
  397. s[30*2]|=(~*p++)&m;
  398. s[30*3]|=(~*p++)&m;
  399. s[30*4]|=(~*p++)&m;
  400. s[30*5]|=(~*p++)&m;
  401. }
  402. */
  403. void xregparm(2,2,1) SmallDStr(int x,int y,char *s) {
  404. while (*s)
  405. SmallDChar(x,y,*s++),x++;
  406. }
  407. void xregparm(3,3,1) SmallDStrS(int x,int y,char *s,int w) {
  408. SmallDChar(x-1,y,0);
  409. while (*s)
  410. SmallDCharS(x,y,*s++),x++,w--;
  411. while (--w>0)
  412. SmallDCharS(x,y,' '),x++;
  413. }
  414. void xregparm(3,3,1) SmallDStrC(int x,int y,char *s,int w) {
  415. while (*s) {
  416. if (--w<0) return;
  417. SmallDChar(x,y,*s++),x++;
  418. }
  419. while (--w>0)
  420. SmallDChar(x,y,' '),x++;
  421. }
  422. void xregparm(3,3,1) SmallDStrCS(int x,int y,char *s,int w) {
  423. SmallDChar(x-1,y,0);
  424. while (*s) {
  425. if (--w<0) return;
  426. SmallDCharS(x,y,*s++),x++;
  427. }
  428. while (--w>0)
  429. SmallDCharS(x,y,' '),x++;
  430. }
  431. #ifdef FORCE_SMALL_FONT
  432. #define VariableDStr SmallDStr
  433. #define VariableDStrS SmallDStrS
  434. #define VariableDStrC SmallDStrC
  435. #define VariableDStrCS SmallDStrCS
  436. #define VariableDChar SmallDChar
  437. #define VariableDCharS SmallDCharS
  438. #define DChar SmallDChar
  439. #define DCharS SmallDCharS
  440. #define DCharX SmallDCharX
  441. #define DStr SmallDStr
  442. #define DStrS SmallDStrS
  443. #else
  444. void xregparm(2,2,1) MediumDStr(int x,int y,char *s) {
  445. while (*s)
  446. MediumDChar(x,y,*s++),x++;
  447. }
  448. void xregparm(3,3,1) MediumDStrS(int x,int y,char *s,int w) {
  449. MediumDChar(x-1,y,0);
  450. while (*s)
  451. MediumDCharS(x,y,*s++),x++,w--;
  452. while (--w>0)
  453. MediumDCharS(x,y,' '),x++;
  454. }
  455. void xregparm(3,3,1) MediumDStrC(int x,int y,char *s,int w) {
  456. while (*s) {
  457. if (--w<0) return;
  458. MediumDChar(x,y,*s++),x++;
  459. }
  460. while (--w>0)
  461. MediumDChar(x,y,' '),x++;
  462. }
  463. void xregparm(3,3,1) MediumDStrCS(int x,int y,char *s,int w) {
  464. MediumDChar(x-1,y,0);
  465. while (*s) {
  466. if (--w<0) return;
  467. MediumDCharS(x,y,*s++),x++;
  468. }
  469. while (--w>0)
  470. MediumDCharS(x,y,' '),x++;
  471. }
  472. void xregparm(2,2,1) VariableDStr(int x,int y,char *s) {
  473. if (small_font)
  474. SmallDStr(x,y,s);
  475. MediumDStr(x,y,s);
  476. }
  477. void xregparm(3,3,1) VariableDStrS(int x,int y,char *s,int w) {
  478. if (small_font)
  479. SmallDStrS(x,y,s,w);
  480. MediumDStrS(x,y,s,w);
  481. }
  482. void xregparm(3,3,1) VariableDStrC(int x,int y,char *s,int w) {
  483. if (small_font)
  484. SmallDStrC(x,y,s,w);
  485. MediumDStrC(x,y,s,w);
  486. }
  487. void xregparm(3,3,1) VariableDStrCS(int x,int y,char *s,int w) {
  488. if (small_font)
  489. SmallDStrCS(x,y,s,w);
  490. MediumDStrCS(x,y,s,w);
  491. }
  492. #endif
  493. void ScrRectFill2(SCR_RECT *scr,int attr) {
  494. int y=scr->xy.y0,n=scr->xy.y1-y;
  495. int x0=scr->xy.x0,x1=scr->xy.x1;
  496. do {
  497. FastDrawHLine(Port,x0,x1,y,attr); y++;
  498. } while (n--);
  499. }
  500. void DrawFrame(int x0,int y0,int x1,int y1) {
  501. FastDrawHLine(Port,x0+1,x1-1,y0,A_NORMAL);
  502. FastDrawHLine(Port,x0+1,x1-1,y1,A_NORMAL);
  503. FastDrawLine(Port,x0,y0+1,x0,y1-1,A_NORMAL);
  504. FastDrawLine(Port,x1,y0+1,x1,y1-1,A_NORMAL);
  505. }
  506. #define B_MOVEAROUND 0
  507. #define B_CENTER 0x8000
  508. int disp_box(int x1,int x2,int height,int attr,WIN_RECT *win) {
  509. WIN_RECT wbox; SCR_RECT box;
  510. if (attr&B_ROUNDED) height+=2;
  511. wbox.x0=virtual_to_physical(x1)-3; wbox.x1=virtual_to_physical(x2)+1;
  512. if (ycur+6+height+4>=_89_92(100-8,128-8) || (attr&B_CENTER) || ycur>=_89_92((100-8)/2,(128-8)/2)) {
  513. wbox.y0=ycur-height-4, wbox.y1=ycur-1;
  514. if (wbox.y0<0 || (attr&B_CENTER))
  515. wbox.y0=_89_92((100-8)/2-2,(128-8)/2-2)-height/2,wbox.y1=wbox.y0+height+3;
  516. } else
  517. wbox.y0=ycur+6, wbox.y1=ycur+5+height+4;
  518. box.xy.x0=wbox.x0;
  519. box.xy.x1=wbox.x1;
  520. box.xy.y0=wbox.y0;
  521. box.xy.y1=wbox.y1;
  522. ScrRectFill2(&box,A_REVERSE);
  523. DrawClipRect(&wbox,ScrRect,A_NORMAL|attr);
  524. if (win) *win=wbox;
  525. return box.xy.y0+2;
  526. }
  527. void dialog(char *title,int width,int height,int attr,WIN_RECT *w) {
  528. WIN_RECT win;
  529. int h=height,x0=(X-width)/2,x1=x0+width,y0;
  530. if (title) h+=8;
  531. x0 = physical_to_virtual(x0);
  532. x1 = physical_to_virtual(x1-1)+1;
  533. y0 = disp_box(x0,x1,h,attr,&win);
  534. x0 = virtual_to_physical(x0);
  535. x1 = virtual_to_physical(x1);
  536. if (title) {
  537. SmallDStr((X/4)/2-strlen(title)/2,y0,title);
  538. FastDrawHLine(Port,x0-2,x1,y0+6,A_NORMAL);
  539. y0+=8;
  540. }
  541. if (w) w->x0=x0,w->x1=x1,w->y0=y0,w->y1=y0+height; /* I doubt that w->y1 will ever be used, but... */
  542. }
  543. enum {
  544. W_NORMAL=0,
  545. W_NOKEY=0x10,
  546. W_ALLOW_F1=0x10<<1, W_ALLOW_F2=0x10<<2, W_ALLOW_F3=0x10<<3, W_ALLOW_F4=0x10<<4, W_ALLOW_F5=0x10<<5,
  547. };
  548. int SimpleDlg(char *title,char *text,int attr,int wattr);
  549. #define SDLG_BUF_SIZE 128
  550. extern char text_find[SDLG_BUF_SIZE],text_repl[SDLG_BUF_SIZE];
  551. extern int search_attr;
  552. int SearchDlg(int rep);
  553. int DoSearch();
  554. void FindDlg() {
  555. /* while (!kbhit())
  556. dialog("Find text",100,40,B_ROUNDED,NULL), LCD_restore(Port);
  557. ngetchx();*/
  558. SearchDlg(1);
  559. }
  560. LCD_BUFFER *scr_stk[8],**scr_sptr=0;
  561. #define NOT_MEMORY 2
  562. void PushScr() {
  563. LCD_BUFFER *p=malloc(LCD_SIZE);
  564. *scr_sptr++=p;
  565. if (p) memcpy(p,Port,LCD_SIZE);
  566. }
  567. void PopScr() {
  568. LCD_BUFFER *p=*--scr_sptr;
  569. if (p) {
  570. memcpy(Port,p,LCD_SIZE);
  571. free(p);
  572. }
  573. }
  574. /*void TestDisp() {
  575. void *PortSave=Port;
  576. Port=LCD_MEM;
  577. while (!kbhit()) {
  578. int c='a';
  579. memset(Port,0,30*92);
  580. while (c<='z') {
  581. int y=90;
  582. do {
  583. int x=40;
  584. while (x--) DChar(x,y,c);
  585. } while ((y-=6)>=0);
  586. c++;
  587. }
  588. }
  589. Port=PortSave;
  590. }*/
  591. #ifdef _89
  592. long MenuBar[5*8]={
  593. 0x7FFFFFFF,0x7FFFFFFF,0x7FFFFFFF,0x7FFFFFFF,0x7FFFFFFE,
  594. 0x80000000,0x80000000,0x80000000,0x80000000,0x80000001,
  595. 0x90000000,0xB0000000,0xB0000000,0xA0000000,0xB8000001,
  596. 0xB0000000,0x88000000,0x88000000,0xA8000000,0xA0000001,
  597. 0x90000000,0x90000000,0x90000000,0xB8000000,0xB0000001,
  598. 0x90000000,0xA0000000,0x88000000,0x88000000,0x88000001,
  599. 0xB8000000,0xB8000000,0xB0000000,0x88000000,0xB0000001,
  600. 0x80000000,0x80000000,0x80000000,0x80000000,0x80000001,
  601. };
  602. #define NMENU 5
  603. #else
  604. long MenuBar[8*8]={
  605. 0x7FFFFFFF,0x7FFFFFFF,0x7FFFFFFF,0x7FFFFFFF,0x7FFFFFFF,0x7FFFFFFF,0x7FFFFFFE,0,
  606. 0x80000000,0x80000000,0x80000000,0x80000000,0x80000000,0x80000000,0x80000001,0,
  607. 0x90000000,0xB0000000,0xB0000000,0xB0000000,0xB0000000,0xA0000000,0xB8000001,0,
  608. 0xB0000000,0x88000000,0x88000000,0x88000000,0x88000000,0xA8000000,0xA0000001,0,
  609. 0x90000000,0x90000000,0x90000000,0x90000000,0x90000000,0xB8000000,0xB0000001,0,
  610. 0x90000000,0xA0000000,0x88000000,0x88000000,0x88000000,0x88000000,0x88000001,0,
  611. 0xB8000000,0xB8000000,0xB0000000,0xB0000000,0xB0000000,0x88000000,0xB0000001,0,
  612. 0x80000000,0x80000000,0x80000000,0x80000000,0x80000000,0x80000000,0x80000001,0,
  613. };
  614. //#error Adapt 'MenuBar' to the 92+
  615. #define NMENU 7
  616. #endif
  617. void PutLine(void *src,int y) {
  618. memcpy(Port+30*y,src,30);
  619. }
  620. char **MenuContents=0;
  621. void DrawMenuBar() {
  622. void *p=MenuBar;
  623. int y;
  624. for (y=Y-8;y<Y;y++)
  625. PutLine(p,y),p+=q89(20,32);
  626. int i,skip=0;
  627. char **q=MenuContents;
  628. for (i=0;i<5;i++)
  629. if (!*q) {
  630. for (y=Y-8;y<Y;y++) ((long *)(Port+30*y))[i]=(skip || y==Y-8)?0:0x80000000;
  631. skip=1; q++;
  632. } else {
  633. SmallDStrC((i<<3)+2,Y-6,*q++,8-2/* ==6... */);
  634. skip=0;
  635. }
  636. }