User Tools

Site Tools


plato:portal.help:platoaccess.help:fancy

3.0 Sample use of -ascii- commands to access extra terminal features

1 2 This lesson provides usable blocks for 3 doing stylized text and graphics. 4 5 This is done by use of the tutor -ascii- 6 command to send ESCape sequences to the 7 "Smart" terminal - PlatoAccess.jar 8 9 Use of these units with non PlatoAccess programs 10 will result in "garbage" on the screen since 11 they do not understand the ESC sequences. 12 13 Execute the lesson to see a demo 14 15 * 16 * Full protocol spec found at: 17 * 18 * https://www.drsinder.com/plato/download/l1pp.pdf 19 * 20 Text sizes avaiable: 21 22 sans_sizes[] = {9,16,20,25,28,33,37,48}; 23 cent_sizes[] = {16,20,25,28,33,37,48}; 24 25 define fancy 26 * 27 * these are for styling text 28 * do tstyle(bits) 29 * 30 clear = 0 31 hthick = o1 $$ horiz thick 32 vthick = o2 $$ vert thick 33 italic = o4 $$ italic 34 under = o10 $$ underline 35 under1 = o20 $$ underlin (more) 36 strike = o40 $$ strikeout 37 strike1 = o100 $$ strikeout (more) 38 shadow = o200 $$ shadow / mask 39 * 40 * fonts - local native fonts - not plato 41 * do tfont(fontcode, size, bold, italic) 42 * font codes and legal sizes below 43 * bold and italic -1 or 0 44 * 45 times = 20 46 helvet = 21 47 couri = 22 48 sans = 24 49 mono = 25 50 century = 26 51 * 52 * sans_sizes[] = {9,16,20,25,28,33,37,48}; 53 * cent_sizes[] = {16,20,25,28,33,37,48}; 54 * 55 * ESC, c, i ... $$ with parity 56 * 57 esc = o33 $$ ESC 58 lc = o143 $$ lowercsae c 59 li = o151 $$ lowercase i 60 ua = o101 $$ uppercase A 61 ub = o102 $$ uppercase B 62 uc = o303 $$ uppercase C 63 ud = o104 $$ uppercase D 64 uf = o306 65 lq = o161 66 uk = o113 67 ut = o324 68 uy = o131 69 * 70 * ep returns input with even parity 71 ep(x) = x $union$ ((bitcnt(x) $mask$ 1) $cls$ 7) 72 * 73 unit tstyle(tstyle) $$ for styling text 74 esc = o33 $$ ESC 75 lc = o143 $$ lowercsae c 76 li = o151 $$ lowercase i 77 ua = o101 $$ uppercase A 78 ub = o102 $$ uppercase B 79 uc = o303 $$ uppercase C 80 ud = o104 $$ uppercase D 81 uf = o306 82 lq = o161 83 uk = o113 84 ut = o324 85 uy = o131 86 * 87 * ep returns input with even parity 88 ep(x) = x $union$ ((bitcnt(x) $mask$ 1) $cls$ 7) 89 * 90 tstyle $$ the style bits 91 ascii esc 92 ascii li 93 ascii lc 94 do sWord(tstyle) 95 * 96 unit lthick(tstyle) $$ set line thickness 97 esc = o33 $$ ESC 98 lc = o143 $$ lowercsae c 99 li = o151 $$ lowercase i 100 ua = o101 $$ uppercase A 101 ub = o102 $$ uppercase B 102 uc = o303 $$ uppercase C 103 ud = o104 $$ uppercase D 104 uf = o306 105 lq = o161 106 uk = o113 107 ut = o324 108 uy = o131 109 * 110 tstyle $$ the thickness 111 ascii esc 112 ascii li 113 ascii ub 114 do sWord(tstyle) 115 * 116 unit ldash(tstyle) $$ set dash style 117 esc = o33 $$ ESC 118 lc = o143 $$ lowercsae c 119 li = o151 $$ lowercase i 120 ua = o101 $$ uppercase A 121 ub = o102 $$ uppercase B 122 uc = o303 $$ uppercase C 123 ud = o104 $$ uppercase D 124 uf = o306 125 lq = o161 126 uk = o113 127 ut = o324 128 uy = o131 129 * 130 tstyle $$ the style bits 131 ascii esc 132 ascii li 133 ascii ud 134 do sWord(tstyle) 135 * 136 unit lfill(tstyle) $$ set or clear fill flag 137 esc = o33 $$ ESC 138 lc = o143 $$ lowercsae c 139 li = o151 $$ lowercase i 140 ua = o101 $$ uppercase A 141 ub = o102 $$ uppercase B 142 uc = o303 $$ uppercase C 143 ud = o104 $$ uppercase D 144 uf = o306 145 lq = o161 146 uk = o113 147 ut = o324 148 uy = o131 149 * ep returns input with even parity 150 ep(x) = x $union$ ((bitcnt(x) $mask$ 1) $cls$ 7) 151 * 152 tstyle $$ the style bits 153 w1 154 b7 = o100 $$ bit 7 is alway set in a word 155 bm = o077 $$ six bit mask 156 calc w1 - ep( tstyle $mask$ 1 $union$ b7 ) + < 157 ascii esc 158 ascii li 159 ascii uf 160 ascii w1 161 * 162 unit lpatt(tstyle) $$ set the pattern 163 esc = o33 $$ ESC 164 lc = o143 $$ lowercsae c 165 li = o151 $$ lowercase i 166 ua = o101 $$ uppercase A 167 ub = o102 $$ uppercase B 168 uc = o303 $$ uppercase C 169 ud = o104 $$ uppercase D 170 uf = o306 171 lq = o161 172 uk = o113 173 ut = o324 174 uy = o131 175 * ep returns input with even parity 176 ep(x) = x $union$ ((bitcnt(x) $mask$ 1) $cls$ 7) 177 * 178 tstyle $$ the style bits 179 w1 180 b7 = o100 $$ bit 7 is alway set in a word 181 bm = o077 $$ six bit mask 182 * 183 calc w1 - ep( tstyle $mask$ bm $union$ b7 ) + < 184 ascii esc 185 ascii li 186 ascii ua 187 ascii w1 188 * 189 unit ellipse(radx,rady) $$ draw an ellipse 190 esc = o33 $$ ESC 191 lc = o143 $$ lowercsae c 192 li = o151 $$ lowercase i 193 ua = o101 $$ uppercase A 194 ub = o102 $$ uppercase B 195 uc = o303 $$ uppercase C 196 ud = o104 $$ uppercase D 197 uf = o306 198 lq = o161 199 uk = o113 200 ut = o324 201 uy = o131 202 * 203 radx, rady 204 ascii esc 205 ascii lq 206 ascii ud 207 do sWord(radx) 208 do sWord(rady) 209 * 210 unit circle(rad1) $$ draw a circle 211 esc = o33 $$ ESC 212 lc = o143 $$ lowercsae c 213 li = o151 $$ lowercase i 214 ua = o101 $$ uppercase A 215 ub = o102 $$ uppercase B 216 uc = o303 $$ uppercase C 217 ud = o104 $$ uppercase D 218 uf = o306 219 lq = o161 220 uk = o113 221 ut = o324 222 uy = o131 223 * 224 rad1 225 ascii esc 226 ascii lq 227 ascii uc 228 do sWord(rad1) 229 * 230 unit mcircle $$ set circle mode 231 esc = o33 $$ ESC 232 lc = o143 $$ lowercsae c 233 li = o151 $$ lowercase i 234 ua = o101 $$ uppercase A 235 ub = o102 $$ uppercase B 236 uc = o303 $$ uppercase C 237 ud = o104 $$ uppercase D 238 uf = o306 239 lq = o161 240 uk = o113 241 ut = o324 242 uy = o131 243 * 244 ascii esc 245 ascii lq 246 ascii uc 247 * 248 unit carc(rad1, a1, a2) $$ circular arc 249 * merge,fancy 250 esc = o33 $$ ESC 251 lc = o143 $$ lowercsae c 252 li = o151 $$ lowercase i 253 ua = o101 $$ uppercase A 254 ub = o102 $$ uppercase B 255 uc = o303 $$ uppercase C 256 ud = o104 $$ uppercase D 257 uf = o306 258 lq = o161 259 uk = o113 260 ut = o324 261 uy = o131 262 * 263 rad1, a1, a2 264 ascii esc 265 ascii lq 266 ascii ub 267 do sWord(rad1) 268 do sWord(a1) 269 do sWord(a2) 270 * 271 unit earc(rad1, rad2, a1, a2) $$ elliptical arc 272 esc = o33 $$ ESC 273 lc = o143 $$ lowercsae c 274 li = o151 $$ lowercase i 275 ua = o101 $$ uppercase A 276 ub = o102 $$ uppercase B 277 uc = o303 $$ uppercase C 278 ud = o104 $$ uppercase D 279 uf = o306 280 lq = o161 281 uk = o113 282 ut = o324 283 uy = o131 284 * 285 rad1, rad2, a1, a2 286 ascii esc 287 ascii lq 288 ascii ua 289 do sWord(rad1) 290 do sWord(rad2) 291 do sWord(a1) 292 do sWord(a2) 293 * 294 unit getos 295 esc = o33 $$ ESC 296 lc = o143 $$ lowercsae c 297 li = o151 $$ lowercase i 298 ua = o101 $$ uppercase A 299 ub = o102 $$ uppercase B 300 uc = o303 $$ uppercase C 301 ud = o104 $$ uppercase D 302 uf = o306 303 lq = o161 304 uk = o113 305 ut = o324 306 uy = o131 307 * 308 ascii esc 309 ascii uy 310 do sWord(84) 311 pause 312 at 101 313 write OS: 314 writec (key-o3200),unknown,dos,mac,unix,win,os2,winnt,win95,platoaccess/misc,platoaccess/win,platoaccess/mac,unknown 315 * 316 * 317 unit tfont(family, sizet, boldt, ital) 318 esc = o33 $$ ESC 319 lc = o143 $$ lowercsae c 320 li = o151 $$ lowercase i 321 ua = o101 $$ uppercase A 322 ub = o102 $$ uppercase B 323 uc = o303 $$ uppercase C 324 ud = o104 $$ uppercase D 325 uf = o306 326 lq = o161 327 uk = o113 328 ut = o324 329 uy = o131 330 * 331 family, sizet, boldt, ital 332 w1 333 calc w1 - (family $mask$ o77) $cls$ 12 + < 334 w1 - w1 $union$ (sizet $mask$ 127) + < 335 if boldt 336 . calc w1 - w1 $union$ o4000 + < 337 endif 338 if ital 339 . calc w1 - w1 $union$ o2000 + < 340 endif 341 ascii esc 342 ascii lq 343 ascii ut 344 do sWord(w1) 345 * 346 unit sWord(tstyle) $$ send a "word" 347 esc = o33 $$ ESC 348 lc = o143 $$ lowercsae c 349 li = o151 $$ lowercase i 350 ua = o101 $$ uppercase A 351 ub = o102 $$ uppercase B 352 uc = o303 $$ uppercase C 353 ud = o104 $$ uppercase D 354 uf = o306 355 lq = o161 356 uk = o113 357 ut = o324 358 uy = o131 359 * ep returns input with even parity 360 ep(x) = x $union$ ((bitcnt(x) $mask$ 1) $cls$ 7) 361 * 362 tstyle $$ the style bits 363 w1, w2, w3 364 b7 = o100 $$ bit 7 is alway set in a word 365 bm = o077 $$ six bit mask 366 * 367 calc w1 - ep(( tstyle $mask$ bm) $union$ b7 ) + < 368 w2 - ep((( tstyle $ars$ 6) $mask$ bm) $union$ b7 ) + < 369 w3 - ep((( tstyle $ars$ 12) $mask$ bm) $union$ b7 ) + < 370 * 371 ascii w1 372 ascii w2 373 ascii w3 374 * 375 lvars 100 376 jump demo 377 * 380 * 381 * 382 unit demo 383 merge,fancy 384 color 385 do getos 386 color define;color,1,.5,0 $$ orange glow! 387 color display;color,zblack 388 do tstyle(strike) $$ text strikeout 389 at 1110 390 write This is a test... 391 do tstyle(under $union$ hthick) 392 write More fancy text. 393 do tstyle(italic $union$ under1) 394 at 1210 395 write This is italic and underlined text. 396 do tstyle(clear) 397 at 3105 398 do tfont(times, 28, 0,0) 399 write This is Times Font... 400 do tfont(century, 28, -1, -1) 401 write This is Century Font... 402 size 403 * 404 color display;zred,zblack 405 at 101 406 do lthick(11) 407 do ldash(4) 408 draw 1515;1547;2347;1515 409 at 101 410 do lthick(0) 411 do ldash(0) 412 mode rewrite 413 do lpatt(26) 414 do lfill(1) 415 draw 1907;2331;2513;1713;1705 416 draw ;1705;2405;1921;2821;2405 417 at 101 418 mode rewrite 419 do lpatt(10) 420 color display;zgreen,zblack 421 at 520 422 circle 60 423 mode write 424 at 540 425 do circle(60) 426 at 2535 427 do lfill(0) 428 do ellipse(80,60) 429 at 540 430 do circle(60) 431 at 520 432 do lfill(1) 433 color display;zgreen,zblack 434 do carc(60,0,1200) 435 color display;zcyan,zblack 436 at 1657 437 do earc(40,200,900,-2700) 438 at 1657 439 at wherex -4 , wherey + 4 440 color display;zyellow,zblack 441 do earc(40,200,900,900) 442 * 443 * 444 unit demo2 445 rad, color, loops 446 floating: base, cnt, red, green, blue 447 next demo 448 backgnd 449 calc loops - 0 + < 450 0 451 color display;zblack,zblack 452 erase 453 do lfill(1) 454 at 256,180+loops 455 do sun(loops) 456 pause .1 457 calc loops - loops + 4 + < 458 branch loops < 150, 0,x 459 color display;zblack,zblack 460 calc loops - 150 + < 461 1 462 color display;zblack,zblack 463 erase 464 do lfill(1) 465 at 256,180+loops 466 do sun(loops) 467 pause .1 468 calc loops - loops - 4 + < 469 branch loops > 4, 1,x 470 color display;zblack,zblack 471 *branch 0 472 * 473 unit sun(loops) 474 rad, color, loops 475 floating: base, cnt, red, green, blue 476 calc cnt - rad - 20 + loops + < < 477 base - 1.0/cnt + < 478 loop cnt > 4 479 . calc red - 1- ( base*(cnt)) + < 480 . green - red/2.0 + < 481 . blue - 0.0 + < 482 . color define;(color),red,green, blue 483 . color display;color,color 484 . do circle(cnt) $$ filled 485 . calc cnt - cnt - 2 + < 486 endloop

plato/portal.help/platoaccess.help/fancy.txt ยท Last modified: 2023/11/20 20:14 by Site Administrator