WINDEMOM.BAK 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615
  1. (*========================================================
  2. == TopSpeed Modula-2 V3.10 ==
  3. == demo program: ==
  4. == ==
  5. == Window Demonstration: Window and Process Modules ==
  6. == ==
  7. ========================================================*)
  8. MODULE WinDemoM ;
  9. IMPORT SYSTEM,Window,IO,Lib,Str,Process ;
  10. (*%F _mthread *)
  11. "Make in mthread model only";
  12. (*%E *)
  13. (*%T _mthread *)
  14. (*%T _OS2 *)
  15. IMPORT Vio,Kbd;
  16. (*%E *)
  17. VAR
  18. IsBW : BOOLEAN ;
  19. TYPE KBFlagSet = SET OF ( RShift, LShift, Ctrl, Alt, Scroll, Num, Cap, Ins ) ;
  20. (*%F _OS2*)
  21. PROCEDURE KBFlags () : KBFlagSet ;
  22. VAR R : SYSTEM.Registers;
  23. BEGIN
  24. R.AH := 2 ;
  25. Lib.Intr(R,16H);
  26. RETURN KBFlagSet(R.AL) ;
  27. END KBFlags ;
  28. (*%E*)
  29. (*%T _OS2*)
  30. PROCEDURE KBFlags () : KBFlagSet ;
  31. VAR
  32. ks : Kbd.KBDINFO;
  33. CurFlags: KBFlagSet;
  34. BEGIN
  35. ks.b := SIZE(ks);
  36. IF Kbd.GetStatus(ks,0)=0 THEN
  37. CurFlags := KBFlagSet(ks.state);
  38. END;
  39. RETURN CurFlags ;
  40. END KBFlags ;
  41. (*%E*)
  42. PROCEDURE CheckScrollLock () ;
  43. VAR
  44. kf : KBFlagSet;
  45. BEGIN
  46. IF Scroll IN KBFlags() THEN
  47. Process.Lock();
  48. REPEAT Lib.Delay(10) UNTIL NOT (Scroll IN KBFlags());
  49. Process.Unlock();
  50. END;
  51. END CheckScrollLock ;
  52. PROCEDURE SetC ( cc,bwc : Window.Color ) ;
  53. BEGIN
  54. IF IsBW THEN cc := bwc END ;
  55. Window.TextColor(cc) ;
  56. END SetC ;
  57. PROCEDURE Intro ;
  58. (* Display startup and demonstration description *)
  59. TYPE W = RECORD x,y : CARDINAL END ;
  60. WW = ARRAY[0..29] OF W ;
  61. CONST
  62. ww = WW( W(0,0) ,W(5,0) ,W(10,0),W(15,0),W(20,0),
  63. W(10,2) ,W(10,4),W(10,6),W(10,8),W(10,10),
  64. W(5,10) ,W(0,10),W(35,4),W(35,2),W(35,0),
  65. W(40,0), W(45,0),W(50,2),W(50,4),W(45,6),
  66. W(40,6), W(35,6),W(35,8),W(35,10),W(65,0),
  67. W(65,2), W(65,4),W(65,6),W(65,8),W(65,10)
  68. ) ;
  69. PROCEDURE IntroText ;
  70. BEGIN
  71. SetC(Window.White,Window.LightGray);
  72. IO.WrLn ; IO.WrStr(' This is a demonstration of the ');
  73. SetC(Window.Yellow,Window.White); IO.WrStr('Window') ;
  74. SetC(Window.White,Window.LightGray); IO.WrStr(' and ') ;
  75. SetC(Window.Yellow,Window.White) ; IO.WrStr('Process') ;
  76. SetC(Window.White,Window.LightGray); IO.WrStr(' Modules') ;
  77. IO.WrLn ;
  78. IO.WrLn ;
  79. SetC(Window.LightGray,Window.LightGray);
  80. IO.WrStr(' 9 time-sliced processes are created, which output to,');IO.WrLn;
  81. IO.WrStr(' move, re-size and re-colour 4 overlapping windows');IO.WrLn;
  82. IO.WrLn ;
  83. SetC(Window.White,Window.White);
  84. IO.WrStr(' Press any key to start, Esc to finish and ScrollLock to freeze ');
  85. END IntroText ;
  86. VAR
  87. WD : Window.WinDef ;
  88. w : Window.WinType ;
  89. title : ARRAY[0..39] OF CHAR ;
  90. Win : ARRAY[0..29] OF Window.WinType ;
  91. i,j,wn : CARDINAL ;
  92. num : ARRAY[0..6] OF CHAR ;
  93. b,up : BOOLEAN ;
  94. DescWin : Window.WinType ;
  95. delay : CARDINAL ;
  96. exit,
  97. change : BOOLEAN ;
  98. CONST
  99. targetX = 32 ;
  100. targetY = 5 ;
  101. BEGIN
  102. Window.CursorOff;
  103. FOR i := 0 TO 29 DO
  104. WITH WD DO
  105. IF i<30 THEN
  106. IF IsBW THEN
  107. IF ODD(i) THEN
  108. Background := Window.Black ;
  109. Foreground := Window.White ;
  110. ELSE
  111. Background := Window.LightGray ;
  112. Foreground := Window.Black ;
  113. END ;
  114. ELSE
  115. Background := Window.Color(i MOD 8) ;
  116. Foreground := Window.Color(15-i MOD 8) ;
  117. END ;
  118. X1 := ww[i].x ; Y1 := ww[i].y ;
  119. X2 := X1+9 ; Y2 := Y1+3 ;
  120. END ;
  121. CursorOn := FALSE ;
  122. WrapOn := FALSE ;
  123. Hidden := FALSE ;
  124. FrameOn := TRUE ;
  125. FrameDef := Window.SingleFrame ;
  126. IF NOT IsBW AND (Background=Window.Black) THEN
  127. FrameBack := Window.Green ;
  128. ELSE
  129. FrameBack := Background ;
  130. END ;
  131. (* Window.Color(ORD(Foreground)MOD 8) *) ;
  132. IF FrameBack=Window.LightGray THEN FrameFore := Window.Black ;
  133. ELSE FrameFore := Window.LightGray ;
  134. END ;
  135. END ;
  136. Win[i] := Window.Open(WD) ;
  137. Window.SetTitle(Win[i],'JPI',Window.CenterUpperTitle);
  138. Str.CardToStr(LONGCARD(i+1),num,10,b) ;
  139. (*
  140. IF (i=29)OR(ww[i].x+5<>ww[i+1].x) THEN IO.WrChar(' '); END ;
  141. *)
  142. IO.WrStr('TopSpeed');
  143. IO.WrLn ;
  144. IO.WrStr('Modula-2');
  145. END ;
  146. WD := Window.WinDef(0,15,75,24,Window.White,Window.Black,
  147. FALSE,TRUE,FALSE,TRUE,
  148. Window.DoubleFrame,Window.Blue,Window.LightGray) ;
  149. IF IsBW THEN WD.FrameFore := Window.Black END ;
  150. DescWin := Window.Open(WD) ;
  151. Window.SetTitle(DescWin,' TopSpeed Modula-2 : Window Demonstration ',Window.CenterUpperTitle);
  152. IntroText ;
  153. delay := 1000 ;
  154. i := 0 ;
  155. WHILE NOT IO.KeyPressed() DO
  156. CheckScrollLock ;
  157. IF delay>100 THEN DEC(delay,20)
  158. ELSIF delay>1 THEN DEC(delay) ;
  159. END ;
  160. Lib.Delay(delay) ;
  161. Window.PutOnTop(Win[i]) ;
  162. i := (i+1)MOD 30 ;
  163. END ;
  164. REPEAT
  165. exit := TRUE ;
  166. FOR i := 0 TO 29 DO
  167. Window.Info(Win[i],WD) ;
  168. change := TRUE ;
  169. IF WD.X1<targetX-3 THEN INC(WD.X1,3);INC(WD.X2,3);
  170. ELSIF WD.X1>targetX+3 THEN DEC(WD.X1,3);DEC(WD.X2,3);
  171. ELSIF WD.Y1=targetY THEN change := FALSE ;
  172. END ;
  173. IF WD.Y1<targetY THEN INC(WD.Y1);INC(WD.Y2);
  174. ELSIF WD.Y1>targetY THEN DEC(WD.Y1);DEC(WD.Y2);
  175. END ;
  176. IF change THEN
  177. Window.Change(Win[i],WD.X1,WD.Y1,WD.X2,WD.Y2) ;
  178. exit := FALSE ;
  179. END ;
  180. END ;
  181. UNTIL exit ;
  182. FOR i := 0 TO 30 DO
  183. w := Window.Top() ;
  184. Lib.Delay(10) ;
  185. Window.Close(w) ;
  186. END ;
  187. IF IO.RdKey()=CHR(27) THEN HALT END ;
  188. END Intro;
  189. (* Actual demo starts here *)
  190. (* ----------------------- *)
  191. VAR
  192. W1,W2,W3,W4 : Window.WinType;
  193. DS : Process.SIGNAL ;
  194. Initialize : BOOLEAN ;
  195. pal : Window.PaletteDef ;
  196. (* Random Colouring *)
  197. PROCEDURE RandPalette ( VAR p : Window.PaletteDef ) ;
  198. VAR
  199. i : SHORTCARD ;
  200. TYPE BW3 = ARRAY[0..2] OF Window.Color ;
  201. CONST bw3 = BW3(Window.Black,Window.LightGray,Window.White) ;
  202. BEGIN
  203. FOR i := 0 TO Window.PaletteMax DO
  204. IF IsBW THEN
  205. p[i].Fore := bw3[Lib.RANDOM(3)];
  206. ELSE
  207. p[i].Fore := VAL(Window.Color,Lib.RANDOM(16)) ;
  208. END ;
  209. REPEAT
  210. IF IsBW THEN
  211. p[i].Back := bw3[Lib.RANDOM(2)] ;
  212. ELSE
  213. p[i].Back := VAL(Window.Color,Lib.RANDOM(8)) ;
  214. END ;
  215. UNTIL p[i].Back<>p[i].Fore ;
  216. END ;
  217. END RandPalette ;
  218. (* Random Movement *)
  219. PROCEDURE Rmove ( W : Window.WinType ) ;
  220. (* random move process *)
  221. VAR
  222. dx1,dy1 : CARDINAL ;
  223. ix,iy,nx,ny : CARDINAL ;
  224. BEGIN
  225. CheckScrollLock ;
  226. LOOP
  227. Process.Delay(5+Lib.RANDOM(15)) ;
  228. REPEAT
  229. dx1 := W^.WDef.X1+(Lib.RANDOM(16)-8)*2 ;
  230. dy1 := W^.WDef.Y1+Lib.RANDOM(16)-8 ;
  231. UNTIL (dx1<80)AND(dy1<24)
  232. AND(dx1+W^.OWidth<=80)AND(dy1+W^.ODepth<=24) ;
  233. IF dx1>W^.WDef.X1 THEN ix := 2 ELSE ix := 0 END ;
  234. IF dy1>W^.WDef.Y1 THEN iy := 2 ELSE iy := 0 END ;
  235. WHILE (dx1<>W^.WDef.X1) AND (dy1<>W^.WDef.Y1) DO
  236. IF (dx1<>W^.WDef.X1) THEN nx := W^.WDef.X1+ix-1 END ;
  237. IF (dy1<>W^.WDef.Y1) THEN ny := W^.WDef.Y1+iy-1 END ;
  238. Window.Change(W,nx,ny,nx+W^.OWidth-1,ny+W^.ODepth-1) ;
  239. END ;
  240. END ;
  241. END Rmove ;
  242. (* Random Change Size *)
  243. PROCEDURE RChangeSize ( W : Window.WinType ) ;
  244. (* this randomly changes the size of a window *)
  245. VAR
  246. nx,ny : CARDINAL ;
  247. BEGIN
  248. CheckScrollLock ;
  249. REPEAT
  250. nx := W^.WDef.X2+(Lib.RANDOM(16)-8)*2 ;
  251. ny := W^.WDef.Y2+Lib.RANDOM(16)-8 ;
  252. UNTIL (nx-W^.WDef.X1<70)AND(ny-W^.WDef.Y1<18)
  253. AND(nx-W^.WDef.X1>10)AND(ny-W^.WDef.Y1>4) ;
  254. Window.Change(W,W^.WDef.X1,W^.WDef.Y1,nx,ny) ;
  255. END RChangeSize ;
  256. (* Processes *)
  257. (* P1 prints out numbers in Hex, Dec and Binary *)
  258. PROCEDURE P1;
  259. VAR S : ARRAY[0..30] OF CHAR;
  260. i : CARDINAL;
  261. b : BOOLEAN ;
  262. BEGIN
  263. Window.Use(W1) ;
  264. LOOP
  265. FOR i := 0 TO 1000 DO
  266. Str.CardToStr(VAL(LONGCARD,i),S,2,b); IO.WrStr(S);
  267. IO.WrCharRep(' ',16-Str.Length(S));
  268. IO.WrCard(i,5) ;
  269. IO.WrStr(' ') ;
  270. Str.CardToStr(VAL(LONGCARD,i),S,16,b); IO.WrStr(S);
  271. IO.WrCharRep(' ',5-Str.Length(S));
  272. IO.WrLn;
  273. END;
  274. END ;
  275. END P1;
  276. (* P2 displays out a sideways barchart *)
  277. PROCEDURE P2;
  278. VAR i,j : CARDINAL;
  279. V : ARRAY[1..9] OF CARDINAL ;
  280. WD : Window.WinDef ;
  281. PROCEDURE DrawBar ( x,y : CARDINAL ; val : CARDINAL ; on : BOOLEAN ) ;
  282. BEGIN
  283. IF ODD(y) THEN
  284. IF IsBW THEN Window.TextColor(Window.White) ;
  285. ELSE Window.TextColor(Window.Red) ;
  286. END ;
  287. ELSE
  288. Window.TextColor(Window.LightGray) ;
  289. END ;
  290. IF val>0 THEN
  291. DEC(val) ;
  292. Window.GotoXY(x+val DIV 2,y) ;
  293. IF on THEN
  294. IF ODD(val) THEN IO.WrChar('Û') ELSE IO.WrChar('Ý') END ;
  295. ELSE
  296. IF ODD(val) THEN IO.WrChar('Ý') ELSE IO.WrChar(' ') END ;
  297. END ;
  298. END ;
  299. END DrawBar ;
  300. BEGIN
  301. Window.Use(W2) ;
  302. i := 0 ;
  303. FOR i := 1 TO 9 DO
  304. V[i] := Lib.RANDOM(50) ;
  305. FOR j := 0 TO V[i] DO
  306. DrawBar(1,i,j,TRUE) ;
  307. END ;
  308. END ;
  309. LOOP
  310. FOR i := 1 TO 9 DO
  311. Window.Info(W2,WD) ;
  312. IF i<WD.X2-WD.X1-2 THEN
  313. IF Lib.RANDOM(2)=0 THEN
  314. IF V[i]<50 THEN INC(V[i]) ; DrawBar(1,i,V[i],TRUE) END ;
  315. ELSE
  316. IF V[i]>0 THEN DrawBar(1,i,V[i],FALSE) ; DEC(V[i]) ; END ;
  317. END ;
  318. END ;
  319. END ;
  320. CheckScrollLock ;
  321. END ;
  322. END P2;
  323. (* P3 displays a character grid with randomly changing pallette colours *)
  324. PROCEDURE P3;
  325. VAR
  326. X,Y,D : CARDINAL;
  327. CH : CHAR;
  328. BEGIN
  329. CH := '*' ;
  330. D := 0 ;
  331. Window.Use(W3) ;
  332. LOOP
  333. FOR X := 1 TO 8 DO
  334. FOR Y := 1 TO 8 DO
  335. Window.SetPaletteColor(VAL(SHORTCARD,(Y*7+X+D))MOD 8) ;
  336. Window.GotoXY(X,Y);
  337. IO.WrChar(CH);
  338. Window.GotoXY(1,10);
  339. Window.SetPaletteColor(0) ;
  340. IO.WrCard(X,2);
  341. IO.WrChar(',');
  342. IO.WrCard(Y,2);
  343. END;
  344. END;
  345. RandPalette ( pal ) ;
  346. Window.SetPalette(W3,pal) ;
  347. INC(D) ;
  348. CheckScrollLock ;
  349. END ;
  350. END P3;
  351. (* P4 displays some text *)
  352. PROCEDURE P4;
  353. VAR i : CARDINAL ;
  354. BEGIN
  355. Window.Use(W4) ;
  356. REPEAT
  357. FOR i := 1 TO 50 DO
  358. IO.WrStr('This is a test of 9 time-sliced processes, and also of window writing, moving, rearranging and resizing.');
  359. W4^.WDef.Foreground := Window.White ;
  360. IF IsBW THEN
  361. W4^.WDef.Background := Window.Black ;
  362. END ;
  363. IO.WrStr(' Press any key to terminate, ScrollLock to freeze. ');
  364. W4^.WDef.Foreground := Window.Black ;
  365. IF IsBW THEN
  366. W4^.WDef.Background := Window.LightGray
  367. END ;
  368. END;
  369. CheckScrollLock ;
  370. UNTIL IO.KeyPressed() ;
  371. Process.SEND(DS);
  372. Process.StopScheduler ;
  373. Window.Use(Window.FullScreen) ;
  374. Window.SnapShot ;
  375. Window.PutOnTop(Window.FullScreen) ;
  376. Window.GotoXY(1,Window.ScreenDepth-1);
  377. Window.CursorOn ;
  378. IF IO.RdKey()=' ' THEN END ;
  379. HALT ;
  380. END P4;
  381. (* P5 Re-sizes and Re-arranges text *)
  382. PROCEDURE P5;
  383. BEGIN
  384. LOOP
  385. Process.Delay(10+Lib.RANDOM(20)) ;
  386. CASE Lib.RANDOM(4) OF
  387. 0 : Window.PutOnTop(W1) |
  388. 1 : Window.PutOnTop(W2) |
  389. 2 : Window.PutOnTop(W3) |
  390. 3 : Window.PutOnTop(W4)
  391. END ;
  392. Process.Delay(10+Lib.RANDOM(20)) ;
  393. CASE Lib.RANDOM(4) OF
  394. 0 : RChangeSize(W1) |
  395. 1 : |
  396. 2 : |
  397. 3 : RChangeSize(W4)
  398. END ;
  399. END ;
  400. END P5;
  401. (* P6 Moves window 1 *)
  402. PROCEDURE P6 ;
  403. BEGIN
  404. Rmove(W1) ;
  405. END P6 ;
  406. (* P7 Moves window 2 *)
  407. PROCEDURE P7 ;
  408. BEGIN
  409. Rmove(W2) ;
  410. END P7;
  411. (* P8 Moves window 2 *)
  412. PROCEDURE P8 ;
  413. BEGIN
  414. Rmove(W3) ;
  415. END P8;
  416. (* P9 Moves window 2 *)
  417. PROCEDURE P9 ;
  418. BEGIN
  419. Rmove(W4) ;
  420. END P9 ;
  421. PROCEDURE Demo ;
  422. VAR
  423. WD : Window.WinDef ;
  424. TW : Window.WinType;
  425. k : CHAR;
  426. BEGIN
  427. TW := Window.Top();
  428. Lib.RANDOMIZE ;
  429. Initialize := TRUE ;
  430. Window.SetProcessLocks(Process.Lock,Process.Unlock) ;
  431. Window.CursorOff ;
  432. Window.Clear ;
  433. WITH WD DO
  434. X1 := 10 ; Y1 := 2 ;
  435. X2 := 60 ; Y2 := 8 ;
  436. Foreground := Window.White ;
  437. IF IsBW THEN
  438. Background := Window.Black ;
  439. ELSE
  440. Background := Window.Red ;
  441. END ;
  442. CursorOn := FALSE ;
  443. WrapOn := TRUE ;
  444. Hidden := FALSE ;
  445. FrameOn := TRUE ;
  446. FrameDef := Window.SingleFrame ;
  447. FrameFore := Window.White ;
  448. FrameBack := Background ;
  449. END ;
  450. W1 := Window.Open(WD) ;
  451. Window.SetTitle(W1,' Process 1 ',Window.CenterUpperTitle);
  452. WITH WD DO
  453. X1 := 40 ; Y1 := 2 ;
  454. X2 := 70 ; Y2 := 12 ;
  455. Foreground := Window.White ;
  456. Background := Window.Blue ;
  457. CursorOn := FALSE ;
  458. WrapOn := TRUE ;
  459. Hidden := FALSE ;
  460. FrameOn := TRUE ;
  461. FrameDef := Window.DoubleFrame ;
  462. FrameFore := Window.Black ;
  463. FrameBack := Window.Cyan ;
  464. IF IsBW THEN
  465. Background := Window.Black ;
  466. FrameBack := Window.LightGray
  467. END ;
  468. END ;
  469. W2 := Window.Open(WD) ;
  470. Window.SetTitle(W2,' Process 2 ',Window.CenterUpperTitle);
  471. RandPalette(pal) ;
  472. WITH WD DO
  473. X1 := 40 ; Y1 := 6 ;
  474. X2 := 50 ; Y2 := 17 ;
  475. pal[0].Fore:= Window.Yellow ;
  476. pal[0].Back:= Window.Black ;
  477. CursorOn := FALSE ;
  478. WrapOn := TRUE ;
  479. Hidden := FALSE ;
  480. FrameOn := TRUE ;
  481. FrameDef := Window.SingleFrame ;
  482. pal[1].Fore:= Window.White ;
  483. pal[1].Back:= Window.Green ;
  484. IF IsBW THEN
  485. pal[0].Fore:= Window.LightGray ;
  486. pal[1].Back:= Window.Black ;
  487. END ;
  488. END ;
  489. W3 := Window.PaletteOpen(WD,pal) ;
  490. Window.SetTitle(W3,'Process 3',Window.CenterUpperTitle);
  491. WITH WD DO
  492. X1 := 10 ; Y1 := 10 ;
  493. X2 := 70 ; Y2 := 20 ;
  494. Foreground := Window.Black ;
  495. Background := Window.LightGray ;
  496. CursorOn := FALSE ;
  497. WrapOn := TRUE ;
  498. Hidden := FALSE ;
  499. FrameOn := TRUE ;
  500. FrameDef := Window.DoubleFrame ;
  501. FrameFore := Window.White ;
  502. FrameBack := Window.Green ;
  503. IF IsBW THEN
  504. FrameBack := Window.Black ;
  505. END ;
  506. END ;
  507. W4 := Window.Open(WD) ;
  508. Window.SetTitle(W4,' Process 4 ',Window.CenterUpperTitle);
  509. Process.StartScheduler ;
  510. Process.Init(DS) ;
  511. Process.StartProcess(P1,2000,1) ;
  512. Process.StartProcess(P2,2000,1) ;
  513. Process.StartProcess(P3,2000,1) ;
  514. Process.StartProcess(P4,2000,1) ;
  515. Process.StartProcess(P5,2000,1) ;
  516. Process.StartProcess(P6,2000,1) ;
  517. Process.StartProcess(P7,2000,1) ;
  518. Process.StartProcess(P8,2000,1) ;
  519. Process.StartProcess(P9,2000,1) ;
  520. Process.WAIT(DS) ;
  521. Window.PutOnTop(TW);
  522. Window.CursorOn ;
  523. WHILE IO.KeyPressed() DO k := IO.RdKey() END;
  524. END Demo;
  525. (*%F _OS2*)
  526. PROCEDURE CheckBW ;
  527. VAR
  528. R : SYSTEM.Registers ;
  529. BEGIN
  530. R.AH := 15 ;
  531. Lib.Intr(R,10H) ;
  532. IsBW := (R.AL = 0)OR(R.AL = 2)OR(R.AL = 5)OR(R.AL = 6)OR(R.AL = 7) ;
  533. END CheckBW ;
  534. (*%E*)
  535. (*%T _OS2*)
  536. PROCEDURE CheckBW;
  537. VAR
  538. mode : Vio.MODEINFO;
  539. r : CARDINAL;
  540. TYPE
  541. sb = SET OF [0..7] ;
  542. BEGIN
  543. mode.b := SIZE(mode);
  544. r := Vio.GetMode(mode,0);
  545. IsBW := (NOT (0 IN sb(mode.type)))OR(mode.color<=2)OR(2 IN sb(mode.type)) ;
  546. END CheckBW;
  547. (*%E*)
  548. (*%E*)
  549. BEGIN
  550. CheckBW ;
  551. Intro;
  552. Demo;
  553. END WinDemoM.
  554.