Classy Front End: Windows

CLASSY FRONT END Windows title art
CLASSY FRONT END Windows title art

I would like to begin this time by taking a big step backward. Let me explain that sometimes we writers send in our copy to meet deadline and then in the weeks that follow sometimes come up with something better. Such a thing happened to me since last issue.

Last time we looked at a short machine code program (as listing 2) that among other things used ROM calls to draw round post-it-notes I call portholes. Now ordinarily using ROM code is a good idea because it saves the programmer from having to write routines that already exist, which saves RAM space. But what kept sticking in my craw was how slow the ROM code drew those portholes. Then an idea hit me that I figured would do the job a little quicker. But it involved (gulp) scrapping some code I had already sent in and had published last issue. I knew such thoughts would bring a fire storm of mail from all those loyal typists who had finally got it all entered.

Well I tried out my new route to quicker portholes and found that it meant more code: almost a half K more! But when I ran it and saw the SPEED, I knew I had to do it, come what may. The old code drew a porthole with a shadow and all in just over 4 seconds. So to draw 1000 portholes would take about an hour and ten minutes. The new code will draw 1000 portholes in 58.8 SECONDS. Can you blame me?

This new code appears as Listing 1. Also included are 448 bytes (lines 1485 through 1500) which include all the graphic info for CLASSY’s seven window styles. Once these 1164 bytes of code are in place, we can use the demo program in Listing 2 to do portholes and windows! Two samples are found in Figure A and B.

As always, pay close attention to the line numbers in these listings and SAVE your efforts. Sooner or later we can all have a MERGE party and put the whole 5K CFE together! Remember to scrap Listing 2 of last time in favor of Listing 1 this issue. However, don’t scrap the other Listings of last issue. Listing 1 is fine and Listing 3 only needs some changes (these are detailed in Figure C).

Windows are facinating and out of twenty or more good ones I came up with, the seven included in the program were the top vote getters. The demo will use BASIC to draw them and labels each A through G, because this is how the program ultimately will address them. They have names, too, although I’m open to change if anyone has better titles. For now they are A) Avery, B) Standard, C) Conventioneer, D) Notebook, E) Cloth Frame, F) Gaudy, and G) Parchment.

The windows use the top left corner as placement coordinates, but portholes don’t have any corners, let alone an upper left corner. So portholes use a near-center set of coordinates, which the demo prints out. The spot is marked on one porthole in Figure A.

The big secret to speed was to forego the ROM CIRCE routines and instead PRINT the paterns needed with a call to the ROM’s simple printing routine using RST 10h. This puts the CHR$ code in the A register to any spot on the screen. “But the 2068 has no characters like those!”, you say? Its true, but the machine code tricks the 2068 into looking elsewhere for its character table by putting another address in CHARS, 2 memory locations at 23606 and 23607. If you should BREAK while running the demo, and CHARS has not been reset, the screen will look like arabic, cuneiform or worse. Type in GO SUB 4150 and it will restore CHARS giving you Sinclair english back again.

If space permits next time, we will look at restoring what was under the last window we drew — a complex subject indeed! Until then fool with these programs and let me know if you discover anything. As always, if data entry isn’t worth the eye-strain, I’ll be happy to send you the complete version of Windows & Portholes as is available on a tape of three most requested programs (called Jazzofire: $9.95ppd) or with eight most requested (called Bingham’s Best+: $12.95ppd). Please write to Paul Bingham, PO Box 2034, Mesa, AZ 85214. And keep those 2068s up and running.

Figure A - a screen of overlapping portholes with their coordinates
Figure A – a screen of overlapping portholes with their coordinates

Listing 1

   1 REM  window & porthole code
5 FOR t=55000 TO 56163: READ
o: POKE t,o: NEXT t: DATA 213,19
7,229,245,217,8,213,197,229,245,
17,216,214,33,3,4
10 DATA 125,1,3,15,185,40,5,12
,16,250,24,10,124,1,4,25,185,40,
6,12,16,250,33,10,16,34,118,92
1360 DATA 1,8,168,62,0,189,40,8,
60,245,120,145,71,241,24,245,120
,217,71,217,65,62,0,203,68,40,1,
129,203,33,203,44,16,245
1370 DATA 217,79,197,217,235,209
,229,1,112,0,9,126,254,128,40,16
,131,79,35,126,130,71,35,229,213
,205,62,38,209,225,24,235,35,233
1380 DATA 237,24,238,24,239,25,2
0,24,21,24,19,25,18,26,17,27,16,
27,230,16,231,16,231,17,231,18,2
7,16,26,17,26,18,25,19,24,20,24,
21
1390 DATA 231,235,230,236,231,23
6,229,237,230,237,231,237,229,23
8,230,238,231,238,228,239,229,23
9,230,239,231,239,24,236,24,237,
25,238,26,239
1400 DATA 239,228,237,229,238,22
9,239,229,236,230,237,230,238,23
0,239,230,234,231,235,231,236,23
1,237,231,238,231,239,231,16,229
,16,230,17,230,17,231,18,231,18,
231,128
1410 DATA 37,1,36,0,9,229,62,2,2
05,48,18,42,118,92,62,35,148,103
,62,27,149,111,69,76,205,20,9,1,
157,3,225,34,54,92,9,233
1420 DATA 0,0,0,0,0,0,0,0.,0,1,6
,24,32,192,3,12.,63,192,0,0,31,2
24,0,0.,255,0,0,0,255,0,0,0.,128
,112,12,3,0,224,28,3
1430 DATA 12,24,48,97,194,132,13
6,8.,16,96,128,0,0,0,0,0.,130,65
,32,16,8,4,4,2.,7,6,14,12,28,24,
56,56.,16,32,32,64,64,128,128,12
8
1440 DATA 1,1,0,0,0,0,0,0.,16,8,
136,132,68,66,66,34.,49,113,113,
97,226,226,226,226.,34,33,33,17,
17,17,17,17.,226,226,226,226,226
,225,241,241
1450 DATA 17,17,17,17,33,33,34,3
4.,248,120,120,124,60,62,30,31.,
128,128,64,64,32,16,8,4.,0,0,0,0
,1,1,2,2.,68,68,132,136,8,16,16,
32.,132,194,225,240,248,252,255,
127
1460 DATA 0,0,0,192,32,24,6,129.
,0,0,0,0,0,1,6,24.,4,8,16,32,193
,2,12,24.,224,248,252,255,127,31
,7,0.,240,15,0,0,224,255,255,127
1465 DATA 1,254,0,0,0,255,255,25
4.,224,1,7,31,252,240,192,0
1470 DATA 1,6,24,32,96,224,224,2
24.,255,0,0,0,0,0,0,0.,224,224,2
24,224,224,224,224,224.,224,24,6
,1,1,1,1,1.,1,1,1,1,1,1,1,1.,1,1
,1,6,28,248,240,192.,224,224,224
,248,254,127,31,7.,0,0,0,0,0,255
,255,255
1475 DATA 63,32,239,232,232,232,
232,232.,255,0,255,0,0,0,0,0.,23
2,232,232,232,232,232,232,232.,2
55,1,253,5,5,5,5,5.,5,5,5,5,5,5,
5,5.,5,5,5,253,1,255,252,252.,23
2,232,232,239,224,255,255,255.,0
,0,0,255,0,255,255,255
1480 DATA 1,6,8,16,49,98,228,228
.,255,0,0,255,0,0,0,0.,228,228,2
28,228,228,228,228,228.,224,24,4
,194,34,17,9,9.,9,9,9,9,9,9,9,9.
,17,34,194,4,24,240,224,128.,226
,241,240,120,126,63,31,7.,0,0,25
5,0,0,255,255,255
1485 DATA 0,0,7,12,20,52,212,212
.,14,19,253,1,7,15,9,6.,212,212,
212,212,212,212,212,212.,0,0,255
,1,1,1,1,1.,1,1,1,1,1,1,1,1.,1,1
,255,2,254,4,252,248.,212,212,21
5,208,223,192,255,255.,0,0,255,0
,255,0,255,255
1490 DATA 0,63,42,250,230,254,22
5,255.,0,255,170,170,170,170,170
,255.,225,255,225,255,225,255,22
5,255.,0,254,170,174,178,190,194
,254.,130,254,130,254,130,254,13
0,254.,130,254,178,174,170,254,2
48,248.,225,255,230,250,234,255,
255,255.,255,170,170,170,170,255
,255,255
1495 DATA 123,196,192,202,192,23
5,66,202.,219,36,0,170,0,255,0,0
.,194,234,66,202,226,74,194,202.
,239,17,1,169,2,233,33,41.,33,41
,34,41,33,42,33,41.,33,233,2,169
,1,17,255,222.,194,235,64,202,19
2,196,255,247.,0,255,0,170,0,36,
255,183
1500 DATA 7,62,82,209,209,255,12
6,12.,255,0,0,0,0,0,0,0.,14,28,1
5,30,4,14,28,28.,240,30,9,9,9,30
,56,32.,16,48,64,32,16,16,32,32.
,16,30,9,9,9,30,248,192.,14,62,8
2,209,209,254,127,15.,0,0,0,0,0,
0,255,255
1510 DATA 62,33,215,62,34,215,62
,35,215,62,36,215,42,136,92,37,6
2,5,133,111,229,193,205,20,9,62,
37,215,62,38,215,6,3,62,32,215,1
6,251
1520 DATA 62,39,215,42,136,92,37
,62,7,133,111,229,193,205,20,9,6
2,40,215,62,41,215,6,4,62,32,215
,16,251,62,42,215,62,43,215,42,1
36,92,37
1530 DATA 62,8,133,111,229,193,2
05,20,9,62,44,215,6,6,62,32,215,
16,251,62,45,215,42,136,92,37,62
,8,133,111,229,193,205,20,9,62,4
6,215
1540 DATA 6,6,62,32,215,16,251,6
2,47,215,42,136,92,37,62,8,133,1
11,229,193,205,20,9,62,48,215,62
,49,215,6,4,62,32,215,16,251,62,
50,215
1550 DATA 62,51,215,42,136,92,37
,62,7,133,111,229,193,205,20,9,6
2,52,215,62,53,215,62,32,215,62,
32,215,62,54,215,62,55,215,42,13
6,92,37
1560 DATA 62,5,133,111,229,193,2
05,20,9,62,56,215,62,57,215,62,5
8,215,62,59,215,209,33,0,60,34,5
4,92
2000 DATA 241,225,193,209,8,217,
241,225,193,209,201
Figure B - the seven window styles stacked, "WINDOW A Press any key to STOP."
Figure B – the seven window styles stacked, "WINDOW A Press any key to STOP."
w&p code's CKT:

1        35      4134
5        191     12997
10       254     9470
1360     316     14902
1370     324     17922
1380     350     13450
1390     337     18640
1400     405     21936
1410     328     13780
1420     343     11514
1430     361     12625
1440     372     17577
1450     443     17274
1460     360     14160
1465     147     6871
1470     576     25950
1475     590     28714
1480     585     26567
1485     582     25449
1490     640     39847
1495     607     29426
1500     577     20849
1510     353     15345
1520     362     15768
1530     353     16789
1540     360     16511
1550     355     16329
1560     260     11815
2000     109     5932

Figure C; Changes to Listing 2 of last issue:

  • Lines 1200, 1210 & 1270 are fine & can be left intact.
  • Lines 1240 and 1280 should be omitted.
  • Lines 1205 and 1240 below are new and should be added.
  • Lines 1220, 1230, 1250 & 1260 need to be altered. See the altered lines below to see how they should look.

Figure C

1205 DATA 0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,255
1220 DATA 151,18,126,254,80,40,4
,254,112,32,6,62,1,18,35,24,9,25
4,82,40,93,254,114,24,87,35,126,
214,48,203,87,32,107,71,198,1,16
,252
1230 DATA 229,213,213,33,9,0,25,
22,0,95,25,235,225,35,115,35,114
,209,225
1240 DATA 35,126,254,61,32,81,22
9,213,225,35,126,35,102,111,229,
26,254,1,32,23,213,225,1,185,0,9
,229,1,166,0,9,233,225,58,118,92
,119,35
1250 DATA 6,70,24,13,6,68,24,9,6
,69,24,5,6,71,24,1,225,86,213,24
,6,72,24,248,0,0,0
1260 DATA 62,0,205,48,18,62,69,2
15,62,82,215,62,82,215,62,79,215
,62,82,215,62,32,215,120,215,62,
44,215,241,254,13,40,1,215,205,9
,32,56,251
1205     155     3926
1220     352     16029
1230     178     8606
1240     355     17204
1250     236     8343
1260     364     18944

Listing 2

3000 CLS : LET l=55000: FOR t=1
TO 44: PRINT "@@@@@@@@@@@@@@@@";
: NEXT t
3010 LET x=RND*28: IF x<4 THEN G
O TO 3010
3020 LET y=RND*17: IF y<3 THEN R
ANDOMIZE : GO TO 3010
3030 POKE l+14,y: POKE l+15,x: L
ET k=USR l
3040 PRINT AT y,x-2;INT (y+.5);"
,";INT (x+.5): IF INKEY$="2" THE
N GO TO 4000
3050 GO TO 3010
4000 LET x=0: LET y=0: LET chars
=23606: GO SUB 4160
4010 FOR g=108 TO 60 STEP -8
4020 PRINT AT y,x;CHR$ g;
4030 FOR h=x+1 TO x+18: PRINT CH
R$ (g+1);: NEXT h: PRINT CHR$ (g
+3)
4040 FOR h=y+1 TO y+14: PRINT AT
h,x;CHR$ (g+2);"
";CHR$ (g+4): NEXT h
4050 PRINT AT y+15,x;CHR$ (g+6);
: FOR h=x+1 TO x+18: PRINT CHR$
(g+7);: NEXT h
4060 PRINT CHR$ (g+5)
4090 LET d=((g-60)/8+65): GO SUB
4150: PRINT AT y+4,x+6;"WINDOW
";CHR$ d;AT y+9,x+3;"Press any k
ey": IF d<>65 THEN PRINT AT y+10
,x+2;"for next window.": GO SUB
4160: GO TO 4110
4100 PRINT AT y+10,x+6;"to STOP.
": GO SUB 4160
4110 IF INKEY$="1" THEN GO SUB 4
150: GO TO 3000
4120 IF INKEY$="" THEN GO TO 411
0
4130 LET x=x+2: LET y=y+1: NEXT
g
4140 GO SUB 4150: STOP
4150 POKE chars,0: POKE chars+1,
60: RETURN
4160 POKE chars,221: POKE chars+
1,214: RETURN
w&p demo's CKT:

3000     61      6288
3010     37      3295
3020     39      3635
3030     34      3576
3040     65      6062
3050     12      1190
4000     53      4413
4010     31      2137
4020     10      1869
4030     56      4790
4040     80      6465
4050     71      5872
4060     14      1134
4090     197     15682
4100     46      3679
4110     31      2924
4120     18      1931
4130     29      2742
4140     14      1434
4150     41      3440
4160     44      4446