Home » Archimedes archive » Acorn User » AU 1998-02 B.adf » JFShared » !JFShared/BasicLib/DispLib

!JFShared/BasicLib/DispLib

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn User » AU 1998-02 B.adf » JFShared
Filename: !JFShared/BasicLib/DispLib
Read OK:
File size: 41DB bytes
Load address: 0000
Exec address: 0000
File contents
   10REM >DispLib
   20REM Simple text file display library
   30REM We require HeapLibrary - include this before DispLib
   40REM Version 1.00 (10 May 1997) - simple creation
   50REM Version 1.01 (14 May 1997) - colours and window creator
   60REM Version 1.02 (14 May 1997) - resizes and finding
   70REM Version 1.03 (06 Jun 1997) - adding lines mid-way
   80REM Version 1.04 (06 Jun 1997) - reading lines and opening
   90REM Version 1.05 (06 Jun 1997) - private handle
  100REM Version 1.06 (12 Jun 1997) - minimum and natural sizes
  110REM Version 1.07 (20 Jun 1997) - selection (partial)
  120REM Version 1.08 (30 Jun 1997) - delete lines, clear display
  130REM Version 1.09 (02 Jul 1997) - more selection stuff
  140REM Version 1.10 (07 Aug 1997) - fixed PROCdisplay_resize bugs
  150ERROR &802,"Don't run this - it's a library"
  160:
  170REM You'll need to add :
  180REM PROCclosedisp
  190REM - before any exit routines
  200REM WHEN 1:REM Redraw handler
  210REM  disp%=FNdisplay_find(!b%)
  220REM  IF disp% THENPROCdisplay_redraw(disp%)
  230REM - in the poll handler
  240:
  250REM PROCinitdisp : Initialise the display handler
  260DEFPROCinitdisp
  270disp_yloc%=-1
  280disp_list%=0
  290ENDPROC
  300:
  310REM PROCclosedisp : Closedown the display handler (MUST be called)
  320DEFPROCclosedisp
  330ENDPROC
  340:
  350REM FNdisplay_new : Create a new display
  360DEFFNdisplay_new(title$)
  370LOCAL p%:p%=FNclaim(60+4):REM Size of block + 4 for link
  380!p%=disp_list%:disp_list%=p%:p%+=4:REM Link us to the list
  390!p%=-1:REM No window handle as yet
  400p%!4=0:REM No lines in the display yet
  410p%!8=0:REM Pointer to the bottom of the window
  420p%!12=FNstrdup(FNmsgtext(title$)):REM The title of the window
  430p%!16=-1:REM Default background
  440p%!20=7:REM Default foreground
  450p%!24=6*16:REM The max width so far
  460p%!28=0:REM Pointer to the top of the window
  470p%!32=0:REM Private word (for miscellaneous program use)
  480p%!36=6:REM Minimum window width (in characters)
  490p%!40=12:REM Natural window height (in lines)
  500p%!44=0:REM Flags :
  510        REM b0 = window has moved since last time
  520        REM b1 = we are dragging the start (not the end)
  530p%!48=-1:REM Start line number for selection (-1 = none)
  540p%!52=0:REM Start character in line for selection
  550p%!56=-1:REM End line number for selection
  560p%!60=0:REM End character in line for selection
  570=p%
  580:
  590REM PROCdisplay_colours : Change the default display colours
  600DEFPROCdisplay_colours(disp%,fg%,bg%)
  610IF fg%<>-2 THENp%!20=fg%
  620IF bg%<>-2 THENp%!16=bg%
  630ENDPROC
  640:
  650DEFPROCdisplay_size(disp%,w%,h%)
  660IF w%<>-1 THENp%!36=w%:IF w%>p%!24 THENp%!24=w%*16
  670IF h%<>-1 THENp%!40=h%
  680ENDPROC
  690:
  700REM Read and write the private word
  710DEFPROCdisplay_setpriv(disp%,priv%):disp%!32=priv%:ENDPROC
  720DEFFNdisplay_getpriv(disp%):=disp%!32
  730:
  740REM PROCdisplay_kill : Destroy the display
  750DEFPROCdisplay_kill(disp%)
  760LOCAL p%,o%,n%:p%=disp%!8
  770WHILE p%<>0
  780 o%=p%!4:REM Read the chain head
  790 WHILE o%<>0
  800  n%=!o%:PROCrelease(o%):o%=n%:REM Release this part of chain
  810 ENDWHILE
  820 n%=!p%:PROCrelease(p%):p%=n%:REM Release this part of chain
  830ENDWHILE
  840IF !disp%<>-1 THEN
  850 REM Kill any windows
  860 SYS "Wimp_DeleteWindow",,disp%
  870ENDIF
  880PROCrelease(disp%!12)
  890p%=disp_list%:o%=0:REM Kill it off from the list
  900WHILE p%<>0
  910 n%=!p%
  920 IF p%+4=disp% THEN
  930  PROCrelease(p%):IF o%=0 THENdisp_list%=n% ELSE!o%=n%
  940  p%=o%
  950 ENDIF
  960 o%=p%:p%=n%
  970ENDWHILE
  980ENDPROC
  990:
 1000DEFPROCdisplay_clear(disp%)
 1010LOCAL p%,o%,n%:p%=disp%!8
 1020IF !disp%<>-1 THENSYS "Wimp_ForceRedraw",!disp%,0,-disp%!4*36-8,disp%!24+12,0:REM Redraw all
 1030WHILE p%<>0
 1040 o%=p%!4:REM Read the chain head
 1050 WHILE o%<>0
 1060  n%=!o%:PROCrelease(o%):o%=n%:REM Release this part of chain
 1070 ENDWHILE
 1080 n%=!p%:PROCrelease(p%):p%=n%:REM Release this part of chain
 1090ENDWHILE
 1100disp%!4=0:REM No lines at present
 1110disp%!8=0:REM No tail
 1120disp%!28=0:REM No head
 1130disp%!24=disp%!40*16
 1140PROCdisplay_resize(disp%)
 1150ENDPROC
 1160:
 1170DEFPROCdisplay_deleteline(disp%,p%)
 1180LOCAL o%
 1190IF p%<=0 THENp%=disp%!8
 1200IF p%=0 THENENDPROC
 1210REM Last's next = our next
 1220IF !p%<>0 THEN!(!p%+8)=p%!8 ELSEdisp%!28=p%!8
 1230REM Next's last = our last
 1240IF p%!8<>0 THEN!(p%!8+0)=!p% ELSEdisp%!8=!p%
 1250o%=p%!4:REM Read the chain head
 1260WHILE o%<>0
 1270 n%=!o%:PROCrelease(o%):o%=n%:REM Release this part of chain
 1280ENDWHILE
 1290PROCrelease(p%):REM And release the line itself
 1300disp%!4=disp%!4-1
 1310PROCdisplay_resize(disp%)
 1320IF !disp%<>-1 THENSYS "Wimp_ForceRedraw",!disp%,0,-disp%!4*36-8,disp%!24+12,0
 1330ENDPROC
 1340:
 1350REM PROCdisplay_add : Add the text to the display
 1360DEFPROCdisplay_add(disp%,a$)
 1370LOCAL p%,o%
 1380IF a$<>"" THEN
 1390 o%=FNclaim(16+LEN(a$)+1)
 1400 o%!0=0:REM No next entry in the line
 1410 o%!4=-1:o%!8=-1:REM Set the colours (default)
 1420 o%!12=LEN(a$)*16:REM Length of text on this line
 1430 $(o%+16)=a$:REM Store the string
 1440 IF o%!12>disp%!24 THENdisp%!24=o%!12
 1450ELSE
 1460 o%=0
 1470ENDIF
 1480p%=FNclaim(12):REM The chain link
 1490IF disp%!28=0 THENdisp%!28=p% ELSE!(disp%!8+8)=p%
 1500!p%=disp%!8:disp%!8=p%:REM Link us to the vertical chain
 1510p%!4=o%:REM Link the first entry in the chain
 1520disp%!4=disp%!4+1:REM Increment number of lines in the list
 1530p%!8=0:REM We're not linked on to anyone
 1540PROCdisplay_resize(disp%)
 1550IF !disp%<>-1 THENSYS "Wimp_ForceRedraw",!disp%,0,-disp%!4*36-8,disp%!24+12,-disp%!4*36+36
 1560ENDPROC
 1570:
 1580REM PROCdispay_addat : Add a line at a particular point
 1590DEFPROCdisplay_addat(disp%,l%,a$)
 1600LOCAL p%,o%
 1610IF a$<>"" THEN
 1620 o%=FNclaim(16+LEN(a$)+1)
 1630 o%!0=0:REM No next entry in the line
 1640 o%!4=-1:o%!8=-1:REM Set the colours (default)
 1650 o%!12=LEN(a$)*16:REM Width of the line
 1660 $(o%+16)=a$:REM Store the string
 1670 IF o%!12>disp%!24 THENdisp%!24=o%!12
 1680ELSE
 1690 o%=0
 1700ENDIF
 1710p%=FNclaim(12):REM The chain link
 1720IF l%=0 THEN
 1730 IF disp%!28=0 THENdisp%!8=p% ELSE!(disp%!28)=p%
 1740 p%!8=disp%!28:REM Link to the next one
 1750 disp%!28=p%:REM Add at the top
 1760ELSE
 1770 !p%=l%:REM Link after an item
 1780 IF l%!8=0 THENdisp%!8=p% ELSE!(l%!8)=p%
 1790 p%!8=l%!8:l%!8=p%
 1800ENDIF
 1810p%!4=o%:REM Link the first entry in the chain
 1820disp%!4=disp%!4+1:REM Increment number of lines in the list
 1830PROCdisplay_resize(disp%)
 1840ENDPROC
 1850:
 1860REM PROCdisplay_addatto : Add to the end of a line at a point
 1870DEFPROCdisplay_addatto(disp%,l%,a$,bg%,fg%)
 1880LOCAL p%,o%,n%
 1890IF a$<>"" THEN
 1900 o%=FNclaim(16+LEN(a$)+1)
 1910 o%!0=0:REM No next entry in the line
 1920 o%!4=bg%:o%!8=fg%:REM Set the colours (as given)
 1930 o%!12=LEN(a$)*16:REM The string width
 1940 $(o%+16)=a$:n%=o%!12:REM Store the string
 1950 p%=l%!4:l%=l%+4
 1960 WHILE p%<>0:n%+=p%!12:l%=p%:p%=!p%:ENDWHILE:REM Find the last
 1970 IF n%>disp%!24 THENdisp%!24=n%
 1980 !l%=o%:REM Link to the last
 1990 PROCdisplay_resize(disp%)
 2000 IF !disp%<>-1 THENSYS "Wimp_ForceRedraw",!disp%,0,-disp%!4*36-8,disp%!24+12,-disp%!4*36+36
 2010ENDIF
 2020ENDPROC
 2030:
 2040REM FNdisplay_lineh : Return handle of line specified
 2050DEFFNdisplay_lineh(disp%,l%)
 2060LOCALp%:IF l%<0 THEN=disp%!8
 2070p%=disp%!8:l%=disp%!4-l%
 2080WHILE l%>0:p%=!p%:l%-=1:ENDWHILE
 2090=p%
 2100:
 2110REM PROCdisplay_addto : Add to the end of line
 2120DEFPROCdisplay_addto(disp%,a$,bg%,fg%)
 2130PROCdisplay_addatto(disp%,disp%!8,a$,bg%,fg%)
 2140ENDPROC
 2150:
 2160REM PROCdisplay_resize : Resize the display
 2170DEFPROCdisplay_resize(disp%)
 2180LOCAL ybot%,xfull%,open%
 2190IF !disp%<>-1 THEN
 2200 !b%=!disp%:SYS "Wimp_GetWindowState",,b%
 2210 REM If full size, open full size, and if open, re-open
 2220 open%=(b%!32 AND (1<<16))>0
 2230 IF NOT open% THENb%!28=-3
 2240 SYS "Wimp_OpenWindow",,b%:SYS "Wimp_GetWindowInfo",,b%+1
 2250 IF NOT open% THENb%!28=-3
 2260 yfull%=(b%!16-b%!8)>=(b%!56-b%!48)
 2270 ybot%=(b%!24-(b%!16-b%!8))=(b%!48-b%!56)
 2280 xfull%=(b%!12-b%!4)>=(b%!52-b%!44)
 2290 IF b%!28=-3 THENybot%=TRUE
 2300 IF open% THENSYS "Wimp_ForceRedraw",!disp%,0,-disp%!4*36-8,disp%!24+12,b%!48+8
 2310 b%!68=b%!44:b%!72=-disp%!4*36-8:b%!76=disp%!24+12:b%!80=b%!56
 2320 SYS "Wimp_SetExtent",!disp%,b%+68
 2330 IF yfull% THEN
 2340  b%!8=b%!16-(b%!80-b%!72)
 2350  IF disp%!4=disp%!40 THENb%!8=b%!8+36 ELSEdisp%!44=disp%!44 OR 1:REM Moved
 2360 ENDIF
 2370 IF ybot% THENb%!24=b%!48-(b%!16-b%!8)
 2380 IF xfull% THENb%!12=b%!4+disp%!24+12:disp%!44=disp%!44 OR 1:REM Moved
 2390 SYS "Wimp_OpenWindow",,b%
 2400ENDIF
 2410ENDPROC
 2420:
 2430REM True if the window has moved
 2440DEFFNdisplay_moved(disp%):LOCAL m%:m%=disp%!44:disp%!44=disp%!44 AND NOT1:=m%
 2450:
 2460REM PROCdisplay_fullsize : Make the display full size
 2470DEFPROCdisplay_fullsize(disp%)
 2480LOCAL open%
 2490IF !disp%<>-1 THEN
 2500 !b%=!disp%:SYS "Wimp_GetWindowState",,b%
 2510 open%=(b%!32 AND (1<<16))>0
 2520 IF open% THENSYS "Wimp_ForceRedraw",!disp%,0,-disp%!4*36-8,disp%!24+12,b%!48+8
 2530 b%!68=b%!44:b%!72=-disp%!4*36-8:b%!76=disp%!24+12:b%!80=b%!56
 2540 SYS "Wimp_SetExtent",!disp%,b%+68
 2550 b%!8=b%!16-(disp%!4*36)-8:b%!12=b%!4+disp%!24+12:REM Full size
 2560 SYS "Wimp_OpenWindow",,b%
 2570 disp%!44=disp%!44 OR 1:REM We'll assume that it has been moved
 2580ENDIF
 2590ENDPROC
 2600:
 2610REM PROCdisplay_redraw : Redraw the window
 2620DEFPROCdisplay_redraw(disp%)
 2630LOCAL b,t,st,end,lf%,rt%
 2640LOCAL p%,o%,x%,bg%,fg%
 2650!b%=!disp%:SYS "Wimp_RedrawWindow",,b% TO more%
 2660bl=b%!4-b%!20:bt=b%!16-b%!24
 2670WHILE more%
 2680 b=b%!32-bt:t=b%!40-bt
 2690 IF disp%!16<>-1 THEN
 2700  PROCdisplay_colour(disp%!16)
 2710  RECTANGLE FILL b%!28,b%!32,b%!36-b%!28,b%!40-b%!32
 2720 ENDIF
 2730 st=INT(-t/36)-1:end=INT(-b/36)
 2740 IF end>disp%!4-1 THENend=disp%!4-1
 2750 IF st<0 THENst=0
 2760 b=disp%!4-1:p%=disp%!8
 2770 WHILE b>end:b-=1:p%=!p%:ENDWHILE
 2780 WHILE st<=end
 2790  o%=p%!4:x%=0
 2800  fg%=disp%!20:bg%=-1:PROCdisplay_colour(fg%)
 2810  WHILE o%<>0
 2820   IF (o%!8)<>-1 THENfg%=o%!8:PROCdisplay_colour(fg%)
 2830   IF (o%!4)<>-1 THENbg%=o%!4:IF bg%=-2 THENbg%=-1
 2840   IF bg%<>-1 THEN
 2850    PROCdisplay_colour(bg%)
 2860    IF x%=0 THENRECTANGLE FILL x%+bl,bt-42-36*end,o%!12+4,35 ELSERECTANGLE FILL 4+x%+bl,bt-42-36*end,o%!12,35
 2870    IF x%<0 THENx%=0
 2880    PROCdisplay_colour(fg%)
 2890   ENDIF
 2900   MOVE 4+x%+bl,bt-8-36*end:PRINT$(o%+16)
 2910   x%+=o%!12:o%=!o%
 2920  ENDWHILE
 2930  IF bg%<>-1 THEN
 2940   PROCdisplay_colour(bg%)
 2950   RECTANGLE FILL 4+x%+bl,bt-42-36*end,255*16,35
 2960  ENDIF
 2970  IF disp%!48<>-1 THEN
 2980   IF disp%!48<=end AND disp%!56>=end THEN
 2990    REM There is a selection and we are inside it
 3000    PROCdisplay_colourinv
 3010    IF disp%!56=end THEN
 3020     rt%=disp%!60:REM The last line of the selection (to char)
 3030     IF rt%>x%/16 THENrt%=x%/16
 3040     IF disp%!48=end THEN
 3050      REM ... and the first line too
 3060      lf%=disp%!52
 3070      IF lf%>x%/16 THENlf%=x%/16
 3080     ELSE
 3090      REM Fill from left to the end point
 3100      lf%=-1
 3110     ENDIF
 3120    ELSE
 3130     IF disp%!48=end THEN
 3140      REM The first line of the selection (fill to right)
 3150      lf%=disp%!52:rt%=255
 3160      IF lf%>x%/16 THENlf%=x%/16
 3170     ELSE
 3180      lf%=-1:rt%=255
 3190      REM Within the selection, fill whole lines
 3200     ENDIF
 3210    ENDIF
 3220    REM Do the fill (inverts it)
 3230    RECTANGLE FILL 4+lf%*16+bl,bt-42-36*end,(rt%-lf%)*16,35
 3240   ENDIF
 3250  ENDIF
 3260  end-=1:p%=!p%
 3270 ENDWHILE
 3280 SYS "Wimp_GetRectangle",,b% TO more%
 3290ENDWHILE
 3300ENDPROC
 3310:
 3320REM Get the inverting colour
 3330DEFPROCdisplay_colourinv
 3340LOCAL c%:SYS "OS_ReadModeVariable",-1,3 TO ,,c%
 3350REM Normal 16 colour and less modes use Wimp_SetColour
 3360REM 8bpp or more (32M gives 65536, 1M gives -1) for others
 3370IF c%<16 AND c%<>-1 THENSYS "Wimp_SetColour",7+(3<<4) ELSESYS "ColourTrans_SetGCOL",-256,,,0,3:REM -256 = white
 3380ENDPROC
 3390:
 3400REM PROCdisplay_selstart : Start a selection
 3410REM x and y in relative co-ordinates
 3420DEFPROCdisplay_selstart(disp%,x%,y%)
 3430IF disp%!48<>-1 THENPROCdisplay_selclear(disp%)
 3440y%=-(y%+8)/36:x%=x%/16:IF y%<0 THENy%=0
 3450REM Start and End are the same
 3460disp%!48=y%:disp%!52=x%:disp%!56=y%:disp%!60=x%
 3470b%!40=!disp%:SYS "Wimp_GetWindowInfo",,b%+40
 3480b%!24=b%!44-b%!60+b%!84:REM Min x
 3490b%!28=b%!56-b%!64+b%!88:REM Min y
 3500b%!32=b%!24+b%!92-b%!84:REM Max x
 3510b%!36=b%!28+b%!96-b%!88:REM Max y
 3520SYS "Wimp_GetPointerInfo",,b%+40
 3530b%!8=b%!40:b%!12=b%!44:b%!16=b%!40:b%!20=b%!44
 3540b%!4=7:REM Drag a point
 3550SYS "Wimp_DragBox",,b%
 3560ENDPROC
 3570:
 3580DEFPROCdisplay_selclear(disp%)
 3590IF disp%!48=-1 THENENDPROC:REM If no selection exit
 3600SYS "Wimp_ForceRedraw",!disp%,0,-disp%!56*36-36-8,disp%!24+12,-disp%!48*36:disp%!48=-1
 3610ENDPROC
 3620:
 3630REM PROCdisplay_selmodify : Modify a selection
 3640DEFPROCdisplay_selmodify(disp%,x%,y%)
 3650LOCAL m%,n%,r%:REM Minimum and maximum
 3660IF disp%!48=-1 THENENDPROC:REM If no selection, abort
 3670y%=-(y%+8)/36:x%=x%/16:IF y%<0 THENy%=0
 3680n%=disp%!48:m%=disp%!56:REM Set min and max
 3690IF (disp%!44 AND 2) THEN
 3700 REM We're dragging the end, are we before the start ?
 3710 IF y%<disp%!48 OR (y%=disp%!48 AND x%<disp%!52) THENdisp%!44=disp%!44 EOR 2:disp%!56=disp%!48:disp%!60=disp%!52
 3720ELSE
 3730 REM We're dragging the start, are we after the end ?
 3740 IF y%>disp%!56 OR (y%=disp%!56 AND x%>disp%!60) THENdisp%!44=disp%!44 EOR 2:disp%!48=disp%!56:disp%!52=disp%!60
 3750ENDIF
 3760IF (disp%!44 AND 2) THEN
 3770 IF y%<>disp%!56 OR x%<>disp%!60 THENdisp%!56=y%:disp%!60=x%:r%=TRUE
 3780ELSE
 3790 IF y%<>disp%!48 OR x%<>disp%!52 THENdisp%!48=y%:disp%!52=x%:r%=TRUE
 3800ENDIF
 3810IF r% THEN
 3820 IF disp%!48<>n% THEN
 3830  IF disp%!56=m% THEN
 3840   IF n%>disp%!48 THENm%=n%:n%=disp%!48 ELSEm%=disp%!48
 3850  ELSE
 3860   IF n%>disp%!48 THENn%=disp%!48
 3870   IF m%<disp%!56 THENm%=disp%!56
 3880  ENDIF
 3890 ELSE
 3900  IF disp%!56=m% THEN
 3910   n%=y%:m%=y%
 3920  ELSE
 3930   IF m%<disp%!56 THENn%=m%:m%=disp%!56 ELSEn%=disp%!56
 3940  ENDIF
 3950 ENDIF
 3960 SYS "Wimp_ForceRedraw",!disp%,0,-m%*36-36-8,255*16,-n%*36
 3970ENDIF
 3980ENDPROC
 3990:
 4000REM PROCdisplay_selend : End a selection
 4010DEFPROCdisplay_selend(disp%)
 4020ENDPROC
 4030:
 4040REM PROCdisplay_relxy : Convert x and y to relative co-ords
 4050DEFPROCdisplay_relxy(disp%,RETURN x%,RETURN y%)
 4060!b%=!disp%:SYS "Wimp_GetWindowState",,b%
 4070y%=y%-b%!16+b%!24:x%=x%-b%!4+b%!20
 4080ENDPROC
 4090:
 4100REM FNdisplay_liney : Find the handle of the line from y
 4110DEFFNdisplay_liney(disp%,y%)
 4120LOCAL p%:p%=disp%!28:REM Top of the window
 4130IF y%>-8 OR y%<-36*disp%!4 THEN=0:REM outside range
 4140WHILE p%<>0 AND y%<=-8-36:p%=p%!8:y%+=36:ENDWHILE
 4150=p%
 4160:
 4170REM FNdisplay_line : Find the number of the line from y
 4180DEFFNdisplay_lineno(disp%,y%)
 4190LOCAL p%,n%:p%=disp%!28:REM Top of the window
 4200WHILE p%<>0 AND y%<=-8:p%=p%!8:y%+=36:n%+=1:ENDWHILE
 4210=n%
 4220:
 4230DEFFNdisplay_next(disp%,p%):IF p%=0 THEN=disp%!28
 4240=p%!8
 4250DEFFNdisplay_prev(disp%,p%):IF p%=0 THEN=disp%!8
 4260=!p%
 4270:
 4280REM FNdisplay_linefrom : return line from a particular point
 4290DEFFNdisplay_linefrom(disp%,p%,RETURN x%)
 4300LOCAL c%:c%=x%-4
 4310p%=p%!4:REM Pointer to the first piece of text
 4320IF p%<>0 THENx%=p%!12:REM The end of this text
 4330WHILE p%<>0 AND x%<=c%:p%=!p%
 4340 IF p%<>0 THENx%+=p%!12:REM add the length of this line
 4350ENDWHILE:REM Find the right one
 4360x%+=4:IF p%=0 THEN=""
 4370=MID$($(p%+16),(c%-x%+p%!12)/16+1)
 4380:
 4390REM FNdisplay_lineword : Return the word at a particular point
 4400DEFFNdisplay_wordat(disp%,p%,RETURN x%)
 4410LOCAL c%,a$:c%=x%-4
 4420p%=p%!4:REM Pointer to the first piece of text
 4430IF p%<>0 THENx%=p%!12:REM The end of this text
 4440WHILE p%<>0 AND x%<=c%:p%=!p%
 4450 IF p%<>0 THENx%+=p%!12:REM add the length of this line
 4460ENDWHILE:REM Find the right one
 4470x%+=4:IF p%=0 THEN=""
 4480c%=(c%-x%+p%!12)/16+1:a$=$(p%+16)
 4490WHILE c%>0 AND MID$(a$,c%,1)<>" ":c%=c%-1:ENDWHILE
 4500c%+=1:a$=MID$(a$,c%):=LEFT$(a$,INSTR(a$+" "," ")-1)
 4510:
 4520REM FNdisplay_lineto : return line to a particular point
 4530DEFFNdisplay_lineto(disp%,p%,RETURN x%)
 4540ERROR 999,"This doesn't work yet"
 4550LOCAL c%:c%=x%-4
 4560p%=p%!4:REM Pointer to the first piece of text
 4570IF p%<>0 THENx%=p%!12:REM The end of this text
 4580WHILE p%<>0 AND x%<=c%:p%=!p%
 4590 IF p%<>0 THENx%+=p%!12:REM add the length of this line
 4600ENDWHILE:REM Find the right one
 4610x%+=4:IF p%=0 THEN=""
 4620=MID$($(p%+16),(c%-x%+p%!12)/16+1)
 4630:
 4640DEFFNdisplay_linefroms(disp%,p%,RETURN x%,RETURN bg%,RETURN fg%)
 4650LOCAL c%:c%=x%-4
 4660p%=p%!4:REM Pointer to the first piece of text
 4670IF p%<>0 THENx%=p%!12:REM The end of this text
 4680WHILE p%<>0 AND x%<=c%:p%=!p%
 4690 IF p%<>0 THENx%+=p%!12:REM add the length of this line
 4700ENDWHILE:REM Find the right one
 4710x%+=4:IF p%=0 THEN=""
 4720bg%=p%!4:fg%=p%!8:REM The colour of this part
 4730=$(p%+16)
 4740:
 4750REM PROCdisplay_colour : Select the colour we want
 4760DEFPROCdisplay_colour(c%)
 4770IF (c%AND&FF)<>&10 THENSYS "Wimp_SetColour",c% ELSESYS "ColourTrans_SetGCOL",c%,,,&100,0
 4780ENDPROC
 4790:
 4800REM PROCdisplay_open : Open the display on the screen
 4810DEFPROCdisplay_open(disp%)
 4820IF !disp%=-1 THENPROCdisplay_makewin(disp%)
 4830PROCopenwin(!disp%)
 4840ENDPROC
 4850:
 4860REM PROCdisplay_close : Close the display on the screen
 4870DEFPROCdisplay_close(disp%)
 4880IF !disp%<>-1 THEN
 4890 !b%=!disp%:SYS "Wimp_DeleteWindow",,b%
 4900 !disp%=-1
 4910ENDIF
 4920ENDPROC
 4930:
 4940REM PROCdisplay_makewin : Build a window for the display
 4950DEFPROCdisplay_makewin(disp%)
 4960LOCAL e%,y%
 4970IF disp_yloc%<256 THEN
 4980 REM We need to re-locate the windows, get the screen size
 4990 SYS "OS_ReadModeVariable",-1,5 TO ,,e%
 5000 SYS "OS_ReadModeVariable",-1,12 TO ,,y%:y%=((y%+1)<<e%)
 5010 disp_yloc%=(y%*3/4) AND NOT 3
 5020ENDIF
 5030b%!0=64:b%!4=disp_yloc%-256:REM bottom left
 5040b%!8=256:b%!12=disp_yloc%:REM top right
 5050disp_yloc%-=44:IF disp_yloc%<320 THENdisp_yloc%=600
 5060b%!16=0:b%!20=0:REM Scroll offsets
 5070b%!24=-1:REM Open on top
 5080b%!28=&FF000002:REM Flags (all the standard stuff)
 5090b%!32=&01070207:REM The colours we want
 5100b%!36=&000C0103:REM Scroll colours and stuff
 5110b%!40=0:b%!44=0:REM Bottom left of area
 5120b%!48=0:b%!52=0:REM Top right of area
 5130b%!56=&13D:b%!60=&A000:REM Title bar flags and button flags
 5140b%!64=1:b%!68=disp%!36*36:REM Minimum size is as small as possible
 5150b%!72=disp%!12:b%!76=0:b%!80=LEN($(disp%!12)):REM Title
 5160b%!84=0:REM No initial icons
 5170SYS "Wimp_CreateWindow",,b% TO !disp%
 5180PROCdisplay_resize(disp%)
 5190ENDPROC
 5200:
 5210REM FNdisplay_find : Find a window
 5220DEFFNdisplay_find(win%)
 5230LOCAL p%:p%=disp_list%
 5240WHILE p%<>0
 5250 IF p%!4=win% THEN=p%+4
 5260 p%=!p%
 5270ENDWHILE
 5280=0
 5290:
 5300REM PROCdisplay_title : Set the display title
 5310DEFPROCdisplay_title(disp%,title$)
 5320PROCrelease(disp%!12):REM Get rid of old title
 5330disp%!12=FNstrdup(FNmsgtext(title$))
 5340IF !disp%<>-1 THEN
 5350 !b%=!disp%:SYS "Wimp_GetWindowInfo",,b%:b%!76=disp%!12
 5360 IF (b%!32 AND (1<<16))>0 THENSYS "Wimp_OpenWindow",,b%
 5370 !b%=!disp%:SYS "Wimp_GetWindowState",,b%
 5380 b%!32=!disp%:SYS "Wimp_GetWindowOutline",,b%+32
 5390 SYS "Wimp_ForceRedraw",-1,b%!36,b%!16,b%!44,b%!48
 5400ENDIF
 5410ENDPROC

� >DispLib
&� Simple text file display library
:� We require HeapLibrary - include this before DispLib
(2� Version 1.00 (10 May 1997) - simple creation
2=� Version 1.01 (14 May 1997) - colours and window creator
<6� Version 1.02 (14 May 1997) - resizes and finding
F7� Version 1.03 (06 Jun 1997) - adding lines mid-way
P<� Version 1.04 (06 Jun 1997) - reading lines and opening
Z1� Version 1.05 (06 Jun 1997) - private handle
d<� Version 1.06 (12 Jun 1997) - minimum and natural sizes
n6� Version 1.07 (20 Jun 1997) - selection (partial)
x>� Version 1.08 (30 Jun 1997) - delete lines, clear display
�7� Version 1.09 (02 Jul 1997) - more selection stuff
�@� Version 1.10 (07 Aug 1997) - fixed PROCdisplay_resize bugs
�,� &802,"Don't run this - it's a library"
�:
�� You'll need to add :
�� PROCclosedisp
� � - before any exit routines
�� WHEN 1:REM Redraw handler
� �  disp%=FNdisplay_find(!b%)
�-�  IF disp% THENPROCdisplay_redraw(disp%)
�� - in the poll handler
�:
�3� PROCinitdisp : Initialise the display handler
��initdisp
disp_yloc%=-1
disp_list%=0
"�
,:
6D� PROCclosedisp : Closedown the display handler (MUST be called)
@��closedisp
J�
T:
^*� FNdisplay_new : Create a new display
hݤdisplay_new(title$)
r5� p%:p%=�claim(60+4):� Size of block + 4 for link
|<!p%=disp_list%:disp_list%=p%:p%+=4:� Link us to the list
�$!p%=-1:� No window handle as yet
�(p%!4=0:� No lines in the display yet
�0p%!8=0:� Pointer to the bottom of the window
�=p%!12=�strdup(�msgtext(title$)):� The title of the window
�!p%!16=-1:� Default background
� p%!20=7:� Default foreground
�%p%!24=6*16:� The max width so far
�.p%!28=0:� Pointer to the top of the window
�:p%!32=0:� Private word (for miscellaneous program use)
�2p%!36=6:� Minimum window width (in characters)
�/p%!40=12:� Natural window height (in lines)
�p%!44=0:� Flags :
�3        � b0 = window has moved since last time
:        � b1 = we are dragging the start (not the end)
:p%!48=-1:� Start line number for selection (-1 = none)
3p%!52=0:� Start character in line for selection
&,p%!56=-1:� End line number for selection
01p%!60=0:� End character in line for selection
:=p%
D:
N>� PROCdisplay_colours : Change the default display colours
X$��display_colours(disp%,fg%,bg%)
b� fg%<>-2 �p%!20=fg%
l� bg%<>-2 �p%!16=bg%
v�
�:
���display_size(disp%,w%,h%)
�.� w%<>-1 �p%!36=w%:� w%>p%!24 �p%!24=w%*16
�� h%<>-1 �p%!40=h%
��
�:
�%� Read and write the private word
�3��display_setpriv(disp%,priv%):disp%!32=priv%:�
�&ݤdisplay_getpriv(disp%):=disp%!32
�:
�,� PROCdisplay_kill : Destroy the display
���display_kill(disp%)
�� p%,o%,n%:p%=disp%!8
ȕ p%<>0
" o%=p%!4:� Read the chain head

 ȕ o%<>0
 <  n%=!o%:�release(o%):o%=n%:� Release this part of chain
* �
4; n%=!p%:�release(p%):p%=n%:� Release this part of chain
>�
H� !disp%<>-1 �
R � Kill any windows
\" ș "Wimp_DeleteWindow",,disp%
f�
p�release(disp%!12)
z2p%=disp_list%:o%=0:� Kill it off from the list
�ȕ p%<>0
� n%=!p%
� � p%+4=disp% �
�0  �release(p%):� o%=0 �disp_list%=n% �!o%=n%
�  p%=o%
� �
� o%=p%:p%=n%
��
��
�:
���display_clear(disp%)
�� p%,o%,n%:p%=disp%!8
�Y� !disp%<>-1 �ș "Wimp_ForceRedraw",!disp%,0,-disp%!4*36-8,disp%!24+12,0:� Redraw all
ȕ p%<>0
" o%=p%!4:� Read the chain head

 ȕ o%<>0
$<  n%=!o%:�release(o%):o%=n%:� Release this part of chain
. �
8; n%=!p%:�release(p%):p%=n%:� Release this part of chain
B�
L#disp%!4=0:� No lines at present
Vdisp%!8=0:� No tail
`disp%!28=0:� No head
jdisp%!24=disp%!40*16
t�display_resize(disp%)
~�
�:
�"��display_deleteline(disp%,p%)
�� o%
�� p%<=0 �p%=disp%!8
�
� p%=0 ��
�� Last's next = our next
�*� !p%<>0 �!(!p%+8)=p%!8 �disp%!28=p%!8
�� Next's last = our last
�)� p%!8<>0 �!(p%!8+0)=!p% �disp%!8=!p%
�!o%=p%!4:� Read the chain head
�ȕ o%<>0
�; n%=!o%:�release(o%):o%=n%:� Release this part of chain
�

.�release(p%):� And release the line itself
disp%!4=disp%!4-1
�display_resize(disp%)
(L� !disp%<>-1 �ș "Wimp_ForceRedraw",!disp%,0,-disp%!4*36-8,disp%!24+12,0
2�
<:
F3� PROCdisplay_add : Add the text to the display
P��display_add(disp%,a$)
Z� p%,o%
d� a$<>"" �
n o%=�claim(16+�(a$)+1)
x' o%!0=0:� No next entry in the line
�0 o%!4=-1:o%!8=-1:� Set the colours (default)
�1 o%!12=�(a$)*16:� Length of text on this line
�# $(o%+16)=a$:� Store the string
�% � o%!12>disp%!24 �disp%!24=o%!12
��
�	 o%=0
��
�"p%=�claim(12):� The chain link
�.� disp%!28=0 �disp%!28=p% �!(disp%!8+8)=p%
�:!p%=disp%!8:disp%!8=p%:� Link us to the vertical chain
�/p%!4=o%:� Link the first entry in the chain
�=disp%!4=disp%!4+1:� Increment number of lines in the list
�*p%!8=0:� We're not linked on to anyone
�display_resize(disp%)
Y� !disp%<>-1 �ș "Wimp_ForceRedraw",!disp%,0,-disp%!4*36-8,disp%!24+12,-disp%!4*36+36
�
":
,9� PROCdispay_addat : Add a line at a particular point
6 ��display_addat(disp%,l%,a$)
@� p%,o%
J� a$<>"" �
T o%=�claim(16+�(a$)+1)
^' o%!0=0:� No next entry in the line
h0 o%!4=-1:o%!8=-1:� Set the colours (default)
r' o%!12=�(a$)*16:� Width of the line
|# $(o%+16)=a$:� Store the string
�% � o%!12>disp%!24 �disp%!24=o%!12
��
�	 o%=0
��
�"p%=�claim(12):� The chain link
�� l%=0 �
�- � disp%!28=0 �disp%!8=p% �!(disp%!28)=p%
�) p%!8=disp%!28:� Link to the next one
�! disp%!28=p%:� Add at the top
��
�  !p%=l%:� Link after an item
�% � l%!8=0 �disp%!8=p% �!(l%!8)=p%
� p%!8=l%!8:l%!8=p%
�
/p%!4=o%:� Link the first entry in the chain
=disp%!4=disp%!4+1:� Increment number of lines in the list
&�display_resize(disp%)
0�
::
D?� PROCdisplay_addatto : Add to the end of a line at a point
N*��display_addatto(disp%,l%,a$,bg%,fg%)
X� p%,o%,n%
b� a$<>"" �
l o%=�claim(16+�(a$)+1)
v' o%!0=0:� No next entry in the line
�3 o%!4=bg%:o%!8=fg%:� Set the colours (as given)
�& o%!12=�(a$)*16:� The string width
�, $(o%+16)=a$:n%=o%!12:� Store the string
� p%=l%!4:l%=l%+4
�6 ȕ p%<>0:n%+=p%!12:l%=p%:p%=!p%:�:� Find the last
� � n%>disp%!24 �disp%!24=n%
� !l%=o%:� Link to the last
� �display_resize(disp%)
�Z � !disp%<>-1 �ș "Wimp_ForceRedraw",!disp%,0,-disp%!4*36-8,disp%!24+12,-disp%!4*36+36
��
��
�:
�7� FNdisplay_lineh : Return handle of line specified
ݤdisplay_lineh(disp%,l%)
�p%:� l%<0 �=disp%!8
p%=disp%!8:l%=disp%!4-l%
 ȕ l%>0:p%=!p%:l%-=1:�
*=p%
4:
>0� PROCdisplay_addto : Add to the end of line
H%��display_addto(disp%,a$,bg%,fg%)
R.�display_addatto(disp%,disp%!8,a$,bg%,fg%)
\�
f:
p-� PROCdisplay_resize : Resize the display
z��display_resize(disp%)
�� ybot%,xfull%,open%
�� !disp%<>-1 �
�, !b%=!disp%:ș "Wimp_GetWindowState",,b%
�9 � If full size, open full size, and if open, re-open
� open%=(b%!32 � (1<<16))>0
� � � open% �b%!28=-3
�; ș "Wimp_OpenWindow",,b%:ș "Wimp_GetWindowInfo",,b%+1
� � � open% �b%!28=-3
�' yfull%=(b%!16-b%!8)>=(b%!56-b%!48)
�- ybot%=(b%!24-(b%!16-b%!8))=(b%!48-b%!56)
�' xfull%=(b%!12-b%!4)>=(b%!52-b%!44)
� � b%!28=-3 �ybot%=�
�N � open% �ș "Wimp_ForceRedraw",!disp%,0,-disp%!4*36-8,disp%!24+12,b%!48+8
	B b%!68=b%!44:b%!72=-disp%!4*36-8:b%!76=disp%!24+12:b%!80=b%!56
	% ș "Wimp_SetExtent",!disp%,b%+68
	 � yfull% �
	$  b%!8=b%!16-(b%!80-b%!72)
	.E  � disp%!4=disp%!40 �b%!8=b%!8+36 �disp%!44=disp%!44 � 1:� Moved
	8 �
	B& � ybot% �b%!24=b%!48-(b%!16-b%!8)
	LC � xfull% �b%!12=b%!4+disp%!24+12:disp%!44=disp%!44 � 1:� Moved
	V ș "Wimp_OpenWindow",,b%
	`�
	j�
	t:
	~"� True if the window has moved
	�Fݤdisplay_moved(disp%):� m%:m%=disp%!44:disp%!44=disp%!44 � �1:=m%
	�:
	�7� PROCdisplay_fullsize : Make the display full size
	���display_fullsize(disp%)
	�� open%
	�� !disp%<>-1 �
	�, !b%=!disp%:ș "Wimp_GetWindowState",,b%
	� open%=(b%!32 � (1<<16))>0
	�N � open% �ș "Wimp_ForceRedraw",!disp%,0,-disp%!4*36-8,disp%!24+12,b%!48+8
	�B b%!68=b%!44:b%!72=-disp%!4*36-8:b%!76=disp%!24+12:b%!80=b%!56
	�% ș "Wimp_SetExtent",!disp%,b%+68
	�A b%!8=b%!16-(disp%!4*36)-8:b%!12=b%!4+disp%!24+12:� Full size
 ș "Wimp_OpenWindow",,b%

@ disp%!44=disp%!44 � 1:� We'll assume that it has been moved
�
�
(:
2,� PROCdisplay_redraw : Redraw the window
<��display_redraw(disp%)
F� b,t,st,end,lf%,rt%
P� p%,o%,x%,bg%,fg%
Z1!b%=!disp%:ș "Wimp_RedrawWindow",,b% � more%
d bl=b%!4-b%!20:bt=b%!16-b%!24
nȕ more%
x b=b%!32-bt:t=b%!40-bt
� � disp%!16<>-1 �
�  �display_colour(disp%!16)
�/  ȓ Ȑ b%!28,b%!32,b%!36-b%!28,b%!40-b%!32
� �
� st=�(-t/36)-1:end=�(-b/36)
�# � end>disp%!4-1 �end=disp%!4-1
� � st<0 �st=0
� b=disp%!4-1:p%=disp%!8
� ȕ b>end:b-=1:p%=!p%:�
� ȕ st<=end
�  o%=p%!4:x%=0
�.  fg%=disp%!20:bg%=-1:�display_colour(fg%)
�  ȕ o%<>0
2   � (o%!8)<>-1 �fg%=o%!8:�display_colour(fg%)
.   � (o%!4)<>-1 �bg%=o%!4:� bg%=-2 �bg%=-1
   � bg%<>-1 �
"    �display_colour(bg%)
,X    � x%=0 �ȓ Ȑ x%+bl,bt-42-36*end,o%!12+4,35 �ȓ Ȑ 4+x%+bl,bt-42-36*end,o%!12,35
6    � x%<0 �x%=0
@    �display_colour(fg%)
J   �
T&   � 4+x%+bl,bt-8-36*end:�$(o%+16)
^   x%+=o%!12:o%=!o%
h  �
r  � bg%<>-1 �
|   �display_colour(bg%)
�+   ȓ Ȑ 4+x%+bl,bt-42-36*end,255*16,35
�  �
�  � disp%!48<>-1 �
�(   � disp%!48<=end � disp%!56>=end �
�3    � There is a selection and we are inside it
�    �display_colourinv
�    � disp%!56=end �
�@     rt%=disp%!60:� The last line of the selection (to char)
�     � rt%>x%/16 �rt%=x%/16
�     � disp%!48=end �
�&      � ... and the first line too
�      lf%=disp%!52
�       � lf%>x%/16 �lf%=x%/16

     �
+      � Fill from left to the end point
      lf%=-1
&
     �
0	    �
:     � disp%!48=end �
D;      � The first line of the selection (fill to right)
N      lf%=disp%!52:rt%=255
X       � lf%>x%/16 �lf%=x%/16
b
     �
l      lf%=-1:rt%=255
v2      � Within the selection, fill whole lines
�
     �
�	    �
�"    � Do the fill (inverts it)
�6    ȓ Ȑ 4+lf%*16+bl,bt-42-36*end,(rt%-lf%)*16,35
�   �
�  �
�  end-=1:p%=!p%
� �
�' ș "Wimp_GetRectangle",,b% � more%
��
��
�:
�� Get the inverting colour

��display_colourinv

-� c%:ș "OS_ReadModeVariable",-1,3 � ,,c%

8� Normal 16 colour and less modes use Wimp_SetColour

 <� 8bpp or more (32M gives 65536, 1M gives -1) for others

*f� c%<16 � c%<>-1 �ș "Wimp_SetColour",7+(3<<4) �ș "ColourTrans_SetGCOL",-256,,,0,3:� -256 = white

4�

>:

H.� PROCdisplay_selstart : Start a selection

R&� x and y in relative co-ordinates

\#��display_selstart(disp%,x%,y%)

f,� disp%!48<>-1 ��display_selclear(disp%)

p'y%=-(y%+8)/36:x%=x%/16:� y%<0 �y%=0

z � Start and End are the same

�3disp%!48=y%:disp%!52=x%:disp%!56=y%:disp%!60=x%

�/b%!40=!disp%:ș "Wimp_GetWindowInfo",,b%+40

�#b%!24=b%!44-b%!60+b%!84:� Min x

�#b%!28=b%!56-b%!64+b%!88:� Min y

�#b%!32=b%!24+b%!92-b%!84:� Max x

�#b%!36=b%!28+b%!96-b%!88:� Max y

�#ș "Wimp_GetPointerInfo",,b%+40

�2b%!8=b%!40:b%!12=b%!44:b%!16=b%!40:b%!20=b%!44

�b%!4=7:� Drag a point

�ș "Wimp_DragBox",,b%

��

�:

���display_selclear(disp%)
+� disp%!48=-1 ��:� If no selection exit
Yș "Wimp_ForceRedraw",!disp%,0,-disp%!56*36-36-8,disp%!24+12,-disp%!48*36:disp%!48=-1
�
$:
.0� PROCdisplay_selmodify : Modify a selection
8$��display_selmodify(disp%,x%,y%)
B$� m%,n%,r%:� Minimum and maximum
L-� disp%!48=-1 ��:� If no selection, abort
V'y%=-(y%+8)/36:x%=x%/16:� y%<0 �y%=0
`-n%=disp%!48:m%=disp%!56:� Set min and max
j� (disp%!44 � 2) �
t8 � We're dragging the end, are we before the start ?
~k � y%<disp%!48 � (y%=disp%!48 � x%<disp%!52) �disp%!44=disp%!44 � 2:disp%!56=disp%!48:disp%!60=disp%!52
��
�7 � We're dragging the start, are we after the end ?
�k � y%>disp%!56 � (y%=disp%!56 � x%>disp%!60) �disp%!44=disp%!44 � 2:disp%!48=disp%!56:disp%!52=disp%!60
��
�� (disp%!44 � 2) �
�@ � y%<>disp%!56 � x%<>disp%!60 �disp%!56=y%:disp%!60=x%:r%=�
��
�@ � y%<>disp%!48 � x%<>disp%!52 �disp%!48=y%:disp%!52=x%:r%=�
��
�
� r% �
� � disp%!48<>n% �
�  � disp%!56=m% �
4   � n%>disp%!48 �m%=n%:n%=disp%!48 �m%=disp%!48

  �
!   � n%>disp%!48 �n%=disp%!48
!   � m%<disp%!56 �m%=disp%!56
(  �
2 �
<  � disp%!56=m% �
F   n%=y%:m%=y%
P  �
Z4   � m%<disp%!56 �n%=m%:m%=disp%!56 �n%=disp%!56
d  �
n �
x= ș "Wimp_ForceRedraw",!disp%,0,-m%*36-36-8,255*16,-n%*36
��
��
�:
�*� PROCdisplay_selend : End a selection
���display_selend(disp%)
��
�:
�=� PROCdisplay_relxy : Convert x and y to relative co-ords
�$��display_relxy(disp%,� x%,� y%)
�+!b%=!disp%:ș "Wimp_GetWindowState",,b%
�&y%=y%-b%!16+b%!24:x%=x%-b%!4+b%!20
��
�:
:� FNdisplay_liney : Find the handle of the line from y
ݤdisplay_liney(disp%,y%)
(� p%:p%=disp%!28:� Top of the window
"0� y%>-8 � y%<-36*disp%!4 �=0:� outside range
,)ȕ p%<>0 � y%<=-8-36:p%=p%!8:y%+=36:�
6=p%
@:
J9� FNdisplay_line : Find the number of the line from y
Tݤdisplay_lineno(disp%,y%)
^+� p%,n%:p%=disp%!28:� Top of the window
h,ȕ p%<>0 � y%<=-8:p%=p%!8:y%+=36:n%+=1:�
r=n%
|:
�.ݤdisplay_next(disp%,p%):� p%=0 �=disp%!28
�	=p%!8
�-ݤdisplay_prev(disp%,p%):� p%=0 �=disp%!8
�=!p%
�:
�>� FNdisplay_linefrom : return line from a particular point
�%ݤdisplay_linefrom(disp%,p%,� x%)
�� c%:c%=x%-4
�0p%=p%!4:� Pointer to the first piece of text
�,� p%<>0 �x%=p%!12:� The end of this text
�ȕ p%<>0 � x%<=c%:p%=!p%
�5 � p%<>0 �x%+=p%!12:� add the length of this line
��:� Find the right one
x%+=4:� p%=0 �=""
"=�$(p%+16),(c%-x%+p%!12)/16+1)
:
&@� FNdisplay_lineword : Return the word at a particular point
0#ݤdisplay_wordat(disp%,p%,� x%)
:� c%,a$:c%=x%-4
D0p%=p%!4:� Pointer to the first piece of text
N,� p%<>0 �x%=p%!12:� The end of this text
Xȕ p%<>0 � x%<=c%:p%=!p%
b5 � p%<>0 �x%+=p%!12:� add the length of this line
l�:� Find the right one
vx%+=4:� p%=0 �=""
�%c%=(c%-x%+p%!12)/16+1:a$=$(p%+16)
�&ȕ c%>0 � �a$,c%,1)<>" ":c%=c%-1:�
�)c%+=1:a$=�a$,c%):=�a$,�a$+" "," ")-1)
�:
�:� FNdisplay_lineto : return line to a particular point
�#ݤdisplay_lineto(disp%,p%,� x%)
�!� 999,"This doesn't work yet"
�� c%:c%=x%-4
�0p%=p%!4:� Pointer to the first piece of text
�,� p%<>0 �x%=p%!12:� The end of this text
�ȕ p%<>0 � x%<=c%:p%=!p%
�5 � p%<>0 �x%+=p%!12:� add the length of this line
��:� Find the right one
x%+=4:� p%=0 �=""
"=�$(p%+16),(c%-x%+p%!12)/16+1)
:
 2ݤdisplay_linefroms(disp%,p%,� x%,� bg%,� fg%)
*� c%:c%=x%-4
40p%=p%!4:� Pointer to the first piece of text
>,� p%<>0 �x%=p%!12:� The end of this text
Hȕ p%<>0 � x%<=c%:p%=!p%
R5 � p%<>0 �x%+=p%!12:� add the length of this line
\�:� Find the right one
fx%+=4:� p%=0 �=""
p/bg%=p%!4:fg%=p%!8:� The colour of this part
z
=$(p%+16)
�:
�4� PROCdisplay_colour : Select the colour we want
���display_colour(c%)
�Q� (c%�&FF)<>&10 �ș "Wimp_SetColour",c% �ș "ColourTrans_SetGCOL",c%,,,&100,0
��
�:
�7� PROCdisplay_open : Open the display on the screen
���display_open(disp%)
�(� !disp%=-1 ��display_makewin(disp%)
��openwin(!disp%)
��
�:
�9� PROCdisplay_close : Close the display on the screen
��display_close(disp%)
� !disp%<>-1 �
* !b%=!disp%:ș "Wimp_DeleteWindow",,b%
$ !disp%=-1
.�
8�
B:
L:� PROCdisplay_makewin : Build a window for the display
V��display_makewin(disp%)
`� e%,y%
j� disp_yloc%<256 �
t< � We need to re-locate the windows, get the screen size
~) ș "OS_ReadModeVariable",-1,5 � ,,e%
�: ș "OS_ReadModeVariable",-1,12 � ,,y%:y%=((y%+1)<<e%)
� disp_yloc%=(y%*3/4) � � 3
��
�-b%!0=64:b%!4=disp_yloc%-256:� bottom left
�)b%!8=256:b%!12=disp_yloc%:� top right
�3disp_yloc%-=44:� disp_yloc%<320 �disp_yloc%=600
�$b%!16=0:b%!20=0:� Scroll offsets
�b%!24=-1:� Open on top
�4b%!28=&FF000002:� Flags (all the standard stuff)
�)b%!32=&01070207:� The colours we want
�.b%!36=&000C0103:� Scroll colours and stuff
�)b%!40=0:b%!44=0:� Bottom left of area
'b%!48=0:b%!52=0:� Top right of area

=b%!56=&13D:b%!60=&A000:� Title bar flags and button flags
Db%!64=1:b%!68=disp%!36*36:� Minimum size is as small as possible
7b%!72=disp%!12:b%!76=0:b%!80=�($(disp%!12)):� Title
(b%!84=0:� No initial icons
2'ș "Wimp_CreateWindow",,b% � !disp%
<�display_resize(disp%)
F�
P:
Z$� FNdisplay_find : Find a window
dݤdisplay_find(win%)
n� p%:p%=disp_list%
xȕ p%<>0
� � p%!4=win% �=p%+4
� p%=!p%
��
�=0
�:
�/� PROCdisplay_title : Set the display title
�!��display_title(disp%,title$)
�-�release(disp%!12):� Get rid of old title
�&disp%!12=�strdup(�msgtext(title$))
�� !disp%<>-1 �
�: !b%=!disp%:ș "Wimp_GetWindowInfo",,b%:b%!76=disp%!12
�4 � (b%!32 � (1<<16))>0 �ș "Wimp_OpenWindow",,b%
�, !b%=!disp%:ș "Wimp_GetWindowState",,b%
3 b%!32=!disp%:ș "Wimp_GetWindowOutline",,b%+32
5 ș "Wimp_ForceRedraw",-1,b%!36,b%!16,b%!44,b%!48
�
"�
�
00000000  0d 00 0a 0e f4 20 3e 44  69 73 70 4c 69 62 0d 00  |..... >DispLib..|
00000010  14 26 f4 20 53 69 6d 70  6c 65 20 74 65 78 74 20  |.&. Simple text |
00000020  66 69 6c 65 20 64 69 73  70 6c 61 79 20 6c 69 62  |file display lib|
00000030  72 61 72 79 0d 00 1e 3a  f4 20 57 65 20 72 65 71  |rary...:. We req|
00000040  75 69 72 65 20 48 65 61  70 4c 69 62 72 61 72 79  |uire HeapLibrary|
00000050  20 2d 20 69 6e 63 6c 75  64 65 20 74 68 69 73 20  | - include this |
00000060  62 65 66 6f 72 65 20 44  69 73 70 4c 69 62 0d 00  |before DispLib..|
00000070  28 32 f4 20 56 65 72 73  69 6f 6e 20 31 2e 30 30  |(2. Version 1.00|
00000080  20 28 31 30 20 4d 61 79  20 31 39 39 37 29 20 2d  | (10 May 1997) -|
00000090  20 73 69 6d 70 6c 65 20  63 72 65 61 74 69 6f 6e  | simple creation|
000000a0  0d 00 32 3d f4 20 56 65  72 73 69 6f 6e 20 31 2e  |..2=. Version 1.|
000000b0  30 31 20 28 31 34 20 4d  61 79 20 31 39 39 37 29  |01 (14 May 1997)|
000000c0  20 2d 20 63 6f 6c 6f 75  72 73 20 61 6e 64 20 77  | - colours and w|
000000d0  69 6e 64 6f 77 20 63 72  65 61 74 6f 72 0d 00 3c  |indow creator..<|
000000e0  36 f4 20 56 65 72 73 69  6f 6e 20 31 2e 30 32 20  |6. Version 1.02 |
000000f0  28 31 34 20 4d 61 79 20  31 39 39 37 29 20 2d 20  |(14 May 1997) - |
00000100  72 65 73 69 7a 65 73 20  61 6e 64 20 66 69 6e 64  |resizes and find|
00000110  69 6e 67 0d 00 46 37 f4  20 56 65 72 73 69 6f 6e  |ing..F7. Version|
00000120  20 31 2e 30 33 20 28 30  36 20 4a 75 6e 20 31 39  | 1.03 (06 Jun 19|
00000130  39 37 29 20 2d 20 61 64  64 69 6e 67 20 6c 69 6e  |97) - adding lin|
00000140  65 73 20 6d 69 64 2d 77  61 79 0d 00 50 3c f4 20  |es mid-way..P<. |
00000150  56 65 72 73 69 6f 6e 20  31 2e 30 34 20 28 30 36  |Version 1.04 (06|
00000160  20 4a 75 6e 20 31 39 39  37 29 20 2d 20 72 65 61  | Jun 1997) - rea|
00000170  64 69 6e 67 20 6c 69 6e  65 73 20 61 6e 64 20 6f  |ding lines and o|
00000180  70 65 6e 69 6e 67 0d 00  5a 31 f4 20 56 65 72 73  |pening..Z1. Vers|
00000190  69 6f 6e 20 31 2e 30 35  20 28 30 36 20 4a 75 6e  |ion 1.05 (06 Jun|
000001a0  20 31 39 39 37 29 20 2d  20 70 72 69 76 61 74 65  | 1997) - private|
000001b0  20 68 61 6e 64 6c 65 0d  00 64 3c f4 20 56 65 72  | handle..d<. Ver|
000001c0  73 69 6f 6e 20 31 2e 30  36 20 28 31 32 20 4a 75  |sion 1.06 (12 Ju|
000001d0  6e 20 31 39 39 37 29 20  2d 20 6d 69 6e 69 6d 75  |n 1997) - minimu|
000001e0  6d 20 61 6e 64 20 6e 61  74 75 72 61 6c 20 73 69  |m and natural si|
000001f0  7a 65 73 0d 00 6e 36 f4  20 56 65 72 73 69 6f 6e  |zes..n6. Version|
00000200  20 31 2e 30 37 20 28 32  30 20 4a 75 6e 20 31 39  | 1.07 (20 Jun 19|
00000210  39 37 29 20 2d 20 73 65  6c 65 63 74 69 6f 6e 20  |97) - selection |
00000220  28 70 61 72 74 69 61 6c  29 0d 00 78 3e f4 20 56  |(partial)..x>. V|
00000230  65 72 73 69 6f 6e 20 31  2e 30 38 20 28 33 30 20  |ersion 1.08 (30 |
00000240  4a 75 6e 20 31 39 39 37  29 20 2d 20 64 65 6c 65  |Jun 1997) - dele|
00000250  74 65 20 6c 69 6e 65 73  2c 20 63 6c 65 61 72 20  |te lines, clear |
00000260  64 69 73 70 6c 61 79 0d  00 82 37 f4 20 56 65 72  |display...7. Ver|
00000270  73 69 6f 6e 20 31 2e 30  39 20 28 30 32 20 4a 75  |sion 1.09 (02 Ju|
00000280  6c 20 31 39 39 37 29 20  2d 20 6d 6f 72 65 20 73  |l 1997) - more s|
00000290  65 6c 65 63 74 69 6f 6e  20 73 74 75 66 66 0d 00  |election stuff..|
000002a0  8c 40 f4 20 56 65 72 73  69 6f 6e 20 31 2e 31 30  |.@. Version 1.10|
000002b0  20 28 30 37 20 41 75 67  20 31 39 39 37 29 20 2d  | (07 Aug 1997) -|
000002c0  20 66 69 78 65 64 20 50  52 4f 43 64 69 73 70 6c  | fixed PROCdispl|
000002d0  61 79 5f 72 65 73 69 7a  65 20 62 75 67 73 0d 00  |ay_resize bugs..|
000002e0  96 2c 85 20 26 38 30 32  2c 22 44 6f 6e 27 74 20  |.,. &802,"Don't |
000002f0  72 75 6e 20 74 68 69 73  20 2d 20 69 74 27 73 20  |run this - it's |
00000300  61 20 6c 69 62 72 61 72  79 22 0d 00 a0 05 3a 0d  |a library"....:.|
00000310  00 aa 1a f4 20 59 6f 75  27 6c 6c 20 6e 65 65 64  |.... You'll need|
00000320  20 74 6f 20 61 64 64 20  3a 0d 00 b4 13 f4 20 50  | to add :..... P|
00000330  52 4f 43 63 6c 6f 73 65  64 69 73 70 0d 00 be 20  |ROCclosedisp... |
00000340  f4 20 2d 20 62 65 66 6f  72 65 20 61 6e 79 20 65  |. - before any e|
00000350  78 69 74 20 72 6f 75 74  69 6e 65 73 0d 00 c8 1f  |xit routines....|
00000360  f4 20 57 48 45 4e 20 31  3a 52 45 4d 20 52 65 64  |. WHEN 1:REM Red|
00000370  72 61 77 20 68 61 6e 64  6c 65 72 0d 00 d2 20 f4  |raw handler... .|
00000380  20 20 64 69 73 70 25 3d  46 4e 64 69 73 70 6c 61  |  disp%=FNdispla|
00000390  79 5f 66 69 6e 64 28 21  62 25 29 0d 00 dc 2d f4  |y_find(!b%)...-.|
000003a0  20 20 49 46 20 64 69 73  70 25 20 54 48 45 4e 50  |  IF disp% THENP|
000003b0  52 4f 43 64 69 73 70 6c  61 79 5f 72 65 64 72 61  |ROCdisplay_redra|
000003c0  77 28 64 69 73 70 25 29  0d 00 e6 1b f4 20 2d 20  |w(disp%)..... - |
000003d0  69 6e 20 74 68 65 20 70  6f 6c 6c 20 68 61 6e 64  |in the poll hand|
000003e0  6c 65 72 0d 00 f0 05 3a  0d 00 fa 33 f4 20 50 52  |ler....:...3. PR|
000003f0  4f 43 69 6e 69 74 64 69  73 70 20 3a 20 49 6e 69  |OCinitdisp : Ini|
00000400  74 69 61 6c 69 73 65 20  74 68 65 20 64 69 73 70  |tialise the disp|
00000410  6c 61 79 20 68 61 6e 64  6c 65 72 0d 01 04 0e dd  |lay handler.....|
00000420  f2 69 6e 69 74 64 69 73  70 0d 01 0e 11 64 69 73  |.initdisp....dis|
00000430  70 5f 79 6c 6f 63 25 3d  2d 31 0d 01 18 10 64 69  |p_yloc%=-1....di|
00000440  73 70 5f 6c 69 73 74 25  3d 30 0d 01 22 05 e1 0d  |sp_list%=0.."...|
00000450  01 2c 05 3a 0d 01 36 44  f4 20 50 52 4f 43 63 6c  |.,.:..6D. PROCcl|
00000460  6f 73 65 64 69 73 70 20  3a 20 43 6c 6f 73 65 64  |osedisp : Closed|
00000470  6f 77 6e 20 74 68 65 20  64 69 73 70 6c 61 79 20  |own the display |
00000480  68 61 6e 64 6c 65 72 20  28 4d 55 53 54 20 62 65  |handler (MUST be|
00000490  20 63 61 6c 6c 65 64 29  0d 01 40 0f dd f2 63 6c  | called)..@...cl|
000004a0  6f 73 65 64 69 73 70 0d  01 4a 05 e1 0d 01 54 05  |osedisp..J....T.|
000004b0  3a 0d 01 5e 2a f4 20 46  4e 64 69 73 70 6c 61 79  |:..^*. FNdisplay|
000004c0  5f 6e 65 77 20 3a 20 43  72 65 61 74 65 20 61 20  |_new : Create a |
000004d0  6e 65 77 20 64 69 73 70  6c 61 79 0d 01 68 19 dd  |new display..h..|
000004e0  a4 64 69 73 70 6c 61 79  5f 6e 65 77 28 74 69 74  |.display_new(tit|
000004f0  6c 65 24 29 0d 01 72 35  ea 20 70 25 3a 70 25 3d  |le$)..r5. p%:p%=|
00000500  a4 63 6c 61 69 6d 28 36  30 2b 34 29 3a f4 20 53  |.claim(60+4):. S|
00000510  69 7a 65 20 6f 66 20 62  6c 6f 63 6b 20 2b 20 34  |ize of block + 4|
00000520  20 66 6f 72 20 6c 69 6e  6b 0d 01 7c 3c 21 70 25  | for link..|<!p%|
00000530  3d 64 69 73 70 5f 6c 69  73 74 25 3a 64 69 73 70  |=disp_list%:disp|
00000540  5f 6c 69 73 74 25 3d 70  25 3a 70 25 2b 3d 34 3a  |_list%=p%:p%+=4:|
00000550  f4 20 4c 69 6e 6b 20 75  73 20 74 6f 20 74 68 65  |. Link us to the|
00000560  20 6c 69 73 74 0d 01 86  24 21 70 25 3d 2d 31 3a  | list...$!p%=-1:|
00000570  f4 20 4e 6f 20 77 69 6e  64 6f 77 20 68 61 6e 64  |. No window hand|
00000580  6c 65 20 61 73 20 79 65  74 0d 01 90 28 70 25 21  |le as yet...(p%!|
00000590  34 3d 30 3a f4 20 4e 6f  20 6c 69 6e 65 73 20 69  |4=0:. No lines i|
000005a0  6e 20 74 68 65 20 64 69  73 70 6c 61 79 20 79 65  |n the display ye|
000005b0  74 0d 01 9a 30 70 25 21  38 3d 30 3a f4 20 50 6f  |t...0p%!8=0:. Po|
000005c0  69 6e 74 65 72 20 74 6f  20 74 68 65 20 62 6f 74  |inter to the bot|
000005d0  74 6f 6d 20 6f 66 20 74  68 65 20 77 69 6e 64 6f  |tom of the windo|
000005e0  77 0d 01 a4 3d 70 25 21  31 32 3d a4 73 74 72 64  |w...=p%!12=.strd|
000005f0  75 70 28 a4 6d 73 67 74  65 78 74 28 74 69 74 6c  |up(.msgtext(titl|
00000600  65 24 29 29 3a f4 20 54  68 65 20 74 69 74 6c 65  |e$)):. The title|
00000610  20 6f 66 20 74 68 65 20  77 69 6e 64 6f 77 0d 01  | of the window..|
00000620  ae 21 70 25 21 31 36 3d  2d 31 3a f4 20 44 65 66  |.!p%!16=-1:. Def|
00000630  61 75 6c 74 20 62 61 63  6b 67 72 6f 75 6e 64 0d  |ault background.|
00000640  01 b8 20 70 25 21 32 30  3d 37 3a f4 20 44 65 66  |.. p%!20=7:. Def|
00000650  61 75 6c 74 20 66 6f 72  65 67 72 6f 75 6e 64 0d  |ault foreground.|
00000660  01 c2 25 70 25 21 32 34  3d 36 2a 31 36 3a f4 20  |..%p%!24=6*16:. |
00000670  54 68 65 20 6d 61 78 20  77 69 64 74 68 20 73 6f  |The max width so|
00000680  20 66 61 72 0d 01 cc 2e  70 25 21 32 38 3d 30 3a  | far....p%!28=0:|
00000690  f4 20 50 6f 69 6e 74 65  72 20 74 6f 20 74 68 65  |. Pointer to the|
000006a0  20 74 6f 70 20 6f 66 20  74 68 65 20 77 69 6e 64  | top of the wind|
000006b0  6f 77 0d 01 d6 3a 70 25  21 33 32 3d 30 3a f4 20  |ow...:p%!32=0:. |
000006c0  50 72 69 76 61 74 65 20  77 6f 72 64 20 28 66 6f  |Private word (fo|
000006d0  72 20 6d 69 73 63 65 6c  6c 61 6e 65 6f 75 73 20  |r miscellaneous |
000006e0  70 72 6f 67 72 61 6d 20  75 73 65 29 0d 01 e0 32  |program use)...2|
000006f0  70 25 21 33 36 3d 36 3a  f4 20 4d 69 6e 69 6d 75  |p%!36=6:. Minimu|
00000700  6d 20 77 69 6e 64 6f 77  20 77 69 64 74 68 20 28  |m window width (|
00000710  69 6e 20 63 68 61 72 61  63 74 65 72 73 29 0d 01  |in characters)..|
00000720  ea 2f 70 25 21 34 30 3d  31 32 3a f4 20 4e 61 74  |./p%!40=12:. Nat|
00000730  75 72 61 6c 20 77 69 6e  64 6f 77 20 68 65 69 67  |ural window heig|
00000740  68 74 20 28 69 6e 20 6c  69 6e 65 73 29 0d 01 f4  |ht (in lines)...|
00000750  15 70 25 21 34 34 3d 30  3a f4 20 46 6c 61 67 73  |.p%!44=0:. Flags|
00000760  20 3a 0d 01 fe 33 20 20  20 20 20 20 20 20 f4 20  | :...3        . |
00000770  62 30 20 3d 20 77 69 6e  64 6f 77 20 68 61 73 20  |b0 = window has |
00000780  6d 6f 76 65 64 20 73 69  6e 63 65 20 6c 61 73 74  |moved since last|
00000790  20 74 69 6d 65 0d 02 08  3a 20 20 20 20 20 20 20  | time...:       |
000007a0  20 f4 20 62 31 20 3d 20  77 65 20 61 72 65 20 64  | . b1 = we are d|
000007b0  72 61 67 67 69 6e 67 20  74 68 65 20 73 74 61 72  |ragging the star|
000007c0  74 20 28 6e 6f 74 20 74  68 65 20 65 6e 64 29 0d  |t (not the end).|
000007d0  02 12 3a 70 25 21 34 38  3d 2d 31 3a f4 20 53 74  |..:p%!48=-1:. St|
000007e0  61 72 74 20 6c 69 6e 65  20 6e 75 6d 62 65 72 20  |art line number |
000007f0  66 6f 72 20 73 65 6c 65  63 74 69 6f 6e 20 28 2d  |for selection (-|
00000800  31 20 3d 20 6e 6f 6e 65  29 0d 02 1c 33 70 25 21  |1 = none)...3p%!|
00000810  35 32 3d 30 3a f4 20 53  74 61 72 74 20 63 68 61  |52=0:. Start cha|
00000820  72 61 63 74 65 72 20 69  6e 20 6c 69 6e 65 20 66  |racter in line f|
00000830  6f 72 20 73 65 6c 65 63  74 69 6f 6e 0d 02 26 2c  |or selection..&,|
00000840  70 25 21 35 36 3d 2d 31  3a f4 20 45 6e 64 20 6c  |p%!56=-1:. End l|
00000850  69 6e 65 20 6e 75 6d 62  65 72 20 66 6f 72 20 73  |ine number for s|
00000860  65 6c 65 63 74 69 6f 6e  0d 02 30 31 70 25 21 36  |election..01p%!6|
00000870  30 3d 30 3a f4 20 45 6e  64 20 63 68 61 72 61 63  |0=0:. End charac|
00000880  74 65 72 20 69 6e 20 6c  69 6e 65 20 66 6f 72 20  |ter in line for |
00000890  73 65 6c 65 63 74 69 6f  6e 0d 02 3a 07 3d 70 25  |selection..:.=p%|
000008a0  0d 02 44 05 3a 0d 02 4e  3e f4 20 50 52 4f 43 64  |..D.:..N>. PROCd|
000008b0  69 73 70 6c 61 79 5f 63  6f 6c 6f 75 72 73 20 3a  |isplay_colours :|
000008c0  20 43 68 61 6e 67 65 20  74 68 65 20 64 65 66 61  | Change the defa|
000008d0  75 6c 74 20 64 69 73 70  6c 61 79 20 63 6f 6c 6f  |ult display colo|
000008e0  75 72 73 0d 02 58 24 dd  f2 64 69 73 70 6c 61 79  |urs..X$..display|
000008f0  5f 63 6f 6c 6f 75 72 73  28 64 69 73 70 25 2c 66  |_colours(disp%,f|
00000900  67 25 2c 62 67 25 29 0d  02 62 18 e7 20 66 67 25  |g%,bg%)..b.. fg%|
00000910  3c 3e 2d 32 20 8c 70 25  21 32 30 3d 66 67 25 0d  |<>-2 .p%!20=fg%.|
00000920  02 6c 18 e7 20 62 67 25  3c 3e 2d 32 20 8c 70 25  |.l.. bg%<>-2 .p%|
00000930  21 31 36 3d 62 67 25 0d  02 76 05 e1 0d 02 80 05  |!16=bg%..v......|
00000940  3a 0d 02 8a 1f dd f2 64  69 73 70 6c 61 79 5f 73  |:......display_s|
00000950  69 7a 65 28 64 69 73 70  25 2c 77 25 2c 68 25 29  |ize(disp%,w%,h%)|
00000960  0d 02 94 2e e7 20 77 25  3c 3e 2d 31 20 8c 70 25  |..... w%<>-1 .p%|
00000970  21 33 36 3d 77 25 3a e7  20 77 25 3e 70 25 21 32  |!36=w%:. w%>p%!2|
00000980  34 20 8c 70 25 21 32 34  3d 77 25 2a 31 36 0d 02  |4 .p%!24=w%*16..|
00000990  9e 16 e7 20 68 25 3c 3e  2d 31 20 8c 70 25 21 34  |... h%<>-1 .p%!4|
000009a0  30 3d 68 25 0d 02 a8 05  e1 0d 02 b2 05 3a 0d 02  |0=h%.........:..|
000009b0  bc 25 f4 20 52 65 61 64  20 61 6e 64 20 77 72 69  |.%. Read and wri|
000009c0  74 65 20 74 68 65 20 70  72 69 76 61 74 65 20 77  |te the private w|
000009d0  6f 72 64 0d 02 c6 33 dd  f2 64 69 73 70 6c 61 79  |ord...3..display|
000009e0  5f 73 65 74 70 72 69 76  28 64 69 73 70 25 2c 70  |_setpriv(disp%,p|
000009f0  72 69 76 25 29 3a 64 69  73 70 25 21 33 32 3d 70  |riv%):disp%!32=p|
00000a00  72 69 76 25 3a e1 0d 02  d0 26 dd a4 64 69 73 70  |riv%:....&..disp|
00000a10  6c 61 79 5f 67 65 74 70  72 69 76 28 64 69 73 70  |lay_getpriv(disp|
00000a20  25 29 3a 3d 64 69 73 70  25 21 33 32 0d 02 da 05  |%):=disp%!32....|
00000a30  3a 0d 02 e4 2c f4 20 50  52 4f 43 64 69 73 70 6c  |:...,. PROCdispl|
00000a40  61 79 5f 6b 69 6c 6c 20  3a 20 44 65 73 74 72 6f  |ay_kill : Destro|
00000a50  79 20 74 68 65 20 64 69  73 70 6c 61 79 0d 02 ee  |y the display...|
00000a60  19 dd f2 64 69 73 70 6c  61 79 5f 6b 69 6c 6c 28  |...display_kill(|
00000a70  64 69 73 70 25 29 0d 02  f8 19 ea 20 70 25 2c 6f  |disp%)..... p%,o|
00000a80  25 2c 6e 25 3a 70 25 3d  64 69 73 70 25 21 38 0d  |%,n%:p%=disp%!8.|
00000a90  03 02 0c c8 95 20 70 25  3c 3e 30 0d 03 0c 22 20  |..... p%<>0..." |
00000aa0  6f 25 3d 70 25 21 34 3a  f4 20 52 65 61 64 20 74  |o%=p%!4:. Read t|
00000ab0  68 65 20 63 68 61 69 6e  20 68 65 61 64 0d 03 16  |he chain head...|
00000ac0  0d 20 c8 95 20 6f 25 3c  3e 30 0d 03 20 3c 20 20  |. .. o%<>0.. <  |
00000ad0  6e 25 3d 21 6f 25 3a f2  72 65 6c 65 61 73 65 28  |n%=!o%:.release(|
00000ae0  6f 25 29 3a 6f 25 3d 6e  25 3a f4 20 52 65 6c 65  |o%):o%=n%:. Rele|
00000af0  61 73 65 20 74 68 69 73  20 70 61 72 74 20 6f 66  |ase this part of|
00000b00  20 63 68 61 69 6e 0d 03  2a 06 20 ce 0d 03 34 3b  | chain..*. ...4;|
00000b10  20 6e 25 3d 21 70 25 3a  f2 72 65 6c 65 61 73 65  | n%=!p%:.release|
00000b20  28 70 25 29 3a 70 25 3d  6e 25 3a f4 20 52 65 6c  |(p%):p%=n%:. Rel|
00000b30  65 61 73 65 20 74 68 69  73 20 70 61 72 74 20 6f  |ease this part o|
00000b40  66 20 63 68 61 69 6e 0d  03 3e 05 ce 0d 03 48 12  |f chain..>....H.|
00000b50  e7 20 21 64 69 73 70 25  3c 3e 2d 31 20 8c 0d 03  |. !disp%<>-1 ...|
00000b60  52 17 20 f4 20 4b 69 6c  6c 20 61 6e 79 20 77 69  |R. . Kill any wi|
00000b70  6e 64 6f 77 73 0d 03 5c  22 20 c8 99 20 22 57 69  |ndows..\" .. "Wi|
00000b80  6d 70 5f 44 65 6c 65 74  65 57 69 6e 64 6f 77 22  |mp_DeleteWindow"|
00000b90  2c 2c 64 69 73 70 25 0d  03 66 05 cd 0d 03 70 16  |,,disp%..f....p.|
00000ba0  f2 72 65 6c 65 61 73 65  28 64 69 73 70 25 21 31  |.release(disp%!1|
00000bb0  32 29 0d 03 7a 32 70 25  3d 64 69 73 70 5f 6c 69  |2)..z2p%=disp_li|
00000bc0  73 74 25 3a 6f 25 3d 30  3a f4 20 4b 69 6c 6c 20  |st%:o%=0:. Kill |
00000bd0  69 74 20 6f 66 66 20 66  72 6f 6d 20 74 68 65 20  |it off from the |
00000be0  6c 69 73 74 0d 03 84 0c  c8 95 20 70 25 3c 3e 30  |list...... p%<>0|
00000bf0  0d 03 8e 0b 20 6e 25 3d  21 70 25 0d 03 98 13 20  |.... n%=!p%.... |
00000c00  e7 20 70 25 2b 34 3d 64  69 73 70 25 20 8c 0d 03  |. p%+4=disp% ...|
00000c10  a2 30 20 20 f2 72 65 6c  65 61 73 65 28 70 25 29  |.0  .release(p%)|
00000c20  3a e7 20 6f 25 3d 30 20  8c 64 69 73 70 5f 6c 69  |:. o%=0 .disp_li|
00000c30  73 74 25 3d 6e 25 20 8b  21 6f 25 3d 6e 25 0d 03  |st%=n% .!o%=n%..|
00000c40  ac 0b 20 20 70 25 3d 6f  25 0d 03 b6 06 20 cd 0d  |..  p%=o%.... ..|
00000c50  03 c0 10 20 6f 25 3d 70  25 3a 70 25 3d 6e 25 0d  |... o%=p%:p%=n%.|
00000c60  03 ca 05 ce 0d 03 d4 05  e1 0d 03 de 05 3a 0d 03  |.............:..|
00000c70  e8 1a dd f2 64 69 73 70  6c 61 79 5f 63 6c 65 61  |....display_clea|
00000c80  72 28 64 69 73 70 25 29  0d 03 f2 19 ea 20 70 25  |r(disp%)..... p%|
00000c90  2c 6f 25 2c 6e 25 3a 70  25 3d 64 69 73 70 25 21  |,o%,n%:p%=disp%!|
00000ca0  38 0d 03 fc 59 e7 20 21  64 69 73 70 25 3c 3e 2d  |8...Y. !disp%<>-|
00000cb0  31 20 8c c8 99 20 22 57  69 6d 70 5f 46 6f 72 63  |1 ... "Wimp_Forc|
00000cc0  65 52 65 64 72 61 77 22  2c 21 64 69 73 70 25 2c  |eRedraw",!disp%,|
00000cd0  30 2c 2d 64 69 73 70 25  21 34 2a 33 36 2d 38 2c  |0,-disp%!4*36-8,|
00000ce0  64 69 73 70 25 21 32 34  2b 31 32 2c 30 3a f4 20  |disp%!24+12,0:. |
00000cf0  52 65 64 72 61 77 20 61  6c 6c 0d 04 06 0c c8 95  |Redraw all......|
00000d00  20 70 25 3c 3e 30 0d 04  10 22 20 6f 25 3d 70 25  | p%<>0..." o%=p%|
00000d10  21 34 3a f4 20 52 65 61  64 20 74 68 65 20 63 68  |!4:. Read the ch|
00000d20  61 69 6e 20 68 65 61 64  0d 04 1a 0d 20 c8 95 20  |ain head.... .. |
00000d30  6f 25 3c 3e 30 0d 04 24  3c 20 20 6e 25 3d 21 6f  |o%<>0..$<  n%=!o|
00000d40  25 3a f2 72 65 6c 65 61  73 65 28 6f 25 29 3a 6f  |%:.release(o%):o|
00000d50  25 3d 6e 25 3a f4 20 52  65 6c 65 61 73 65 20 74  |%=n%:. Release t|
00000d60  68 69 73 20 70 61 72 74  20 6f 66 20 63 68 61 69  |his part of chai|
00000d70  6e 0d 04 2e 06 20 ce 0d  04 38 3b 20 6e 25 3d 21  |n.... ...8; n%=!|
00000d80  70 25 3a f2 72 65 6c 65  61 73 65 28 70 25 29 3a  |p%:.release(p%):|
00000d90  70 25 3d 6e 25 3a f4 20  52 65 6c 65 61 73 65 20  |p%=n%:. Release |
00000da0  74 68 69 73 20 70 61 72  74 20 6f 66 20 63 68 61  |this part of cha|
00000db0  69 6e 0d 04 42 05 ce 0d  04 4c 23 64 69 73 70 25  |in..B....L#disp%|
00000dc0  21 34 3d 30 3a f4 20 4e  6f 20 6c 69 6e 65 73 20  |!4=0:. No lines |
00000dd0  61 74 20 70 72 65 73 65  6e 74 0d 04 56 17 64 69  |at present..V.di|
00000de0  73 70 25 21 38 3d 30 3a  f4 20 4e 6f 20 74 61 69  |sp%!8=0:. No tai|
00000df0  6c 0d 04 60 18 64 69 73  70 25 21 32 38 3d 30 3a  |l..`.disp%!28=0:|
00000e00  f4 20 4e 6f 20 68 65 61  64 0d 04 6a 18 64 69 73  |. No head..j.dis|
00000e10  70 25 21 32 34 3d 64 69  73 70 25 21 34 30 2a 31  |p%!24=disp%!40*1|
00000e20  36 0d 04 74 1a f2 64 69  73 70 6c 61 79 5f 72 65  |6..t..display_re|
00000e30  73 69 7a 65 28 64 69 73  70 25 29 0d 04 7e 05 e1  |size(disp%)..~..|
00000e40  0d 04 88 05 3a 0d 04 92  22 dd f2 64 69 73 70 6c  |....:..."..displ|
00000e50  61 79 5f 64 65 6c 65 74  65 6c 69 6e 65 28 64 69  |ay_deleteline(di|
00000e60  73 70 25 2c 70 25 29 0d  04 9c 08 ea 20 6f 25 0d  |sp%,p%)..... o%.|
00000e70  04 a6 17 e7 20 70 25 3c  3d 30 20 8c 70 25 3d 64  |.... p%<=0 .p%=d|
00000e80  69 73 70 25 21 38 0d 04  b0 0d e7 20 70 25 3d 30  |isp%!8..... p%=0|
00000e90  20 8c e1 0d 04 ba 1c f4  20 4c 61 73 74 27 73 20  | ....... Last's |
00000ea0  6e 65 78 74 20 3d 20 6f  75 72 20 6e 65 78 74 0d  |next = our next.|
00000eb0  04 c4 2a e7 20 21 70 25  3c 3e 30 20 8c 21 28 21  |..*. !p%<>0 .!(!|
00000ec0  70 25 2b 38 29 3d 70 25  21 38 20 8b 64 69 73 70  |p%+8)=p%!8 .disp|
00000ed0  25 21 32 38 3d 70 25 21  38 0d 04 ce 1c f4 20 4e  |%!28=p%!8..... N|
00000ee0  65 78 74 27 73 20 6c 61  73 74 20 3d 20 6f 75 72  |ext's last = our|
00000ef0  20 6c 61 73 74 0d 04 d8  29 e7 20 70 25 21 38 3c  | last...). p%!8<|
00000f00  3e 30 20 8c 21 28 70 25  21 38 2b 30 29 3d 21 70  |>0 .!(p%!8+0)=!p|
00000f10  25 20 8b 64 69 73 70 25  21 38 3d 21 70 25 0d 04  |% .disp%!8=!p%..|
00000f20  e2 21 6f 25 3d 70 25 21  34 3a f4 20 52 65 61 64  |.!o%=p%!4:. Read|
00000f30  20 74 68 65 20 63 68 61  69 6e 20 68 65 61 64 0d  | the chain head.|
00000f40  04 ec 0c c8 95 20 6f 25  3c 3e 30 0d 04 f6 3b 20  |..... o%<>0...; |
00000f50  6e 25 3d 21 6f 25 3a f2  72 65 6c 65 61 73 65 28  |n%=!o%:.release(|
00000f60  6f 25 29 3a 6f 25 3d 6e  25 3a f4 20 52 65 6c 65  |o%):o%=n%:. Rele|
00000f70  61 73 65 20 74 68 69 73  20 70 61 72 74 20 6f 66  |ase this part of|
00000f80  20 63 68 61 69 6e 0d 05  00 05 ce 0d 05 0a 2e f2  | chain..........|
00000f90  72 65 6c 65 61 73 65 28  70 25 29 3a f4 20 41 6e  |release(p%):. An|
00000fa0  64 20 72 65 6c 65 61 73  65 20 74 68 65 20 6c 69  |d release the li|
00000fb0  6e 65 20 69 74 73 65 6c  66 0d 05 14 15 64 69 73  |ne itself....dis|
00000fc0  70 25 21 34 3d 64 69 73  70 25 21 34 2d 31 0d 05  |p%!4=disp%!4-1..|
00000fd0  1e 1a f2 64 69 73 70 6c  61 79 5f 72 65 73 69 7a  |...display_resiz|
00000fe0  65 28 64 69 73 70 25 29  0d 05 28 4c e7 20 21 64  |e(disp%)..(L. !d|
00000ff0  69 73 70 25 3c 3e 2d 31  20 8c c8 99 20 22 57 69  |isp%<>-1 ... "Wi|
00001000  6d 70 5f 46 6f 72 63 65  52 65 64 72 61 77 22 2c  |mp_ForceRedraw",|
00001010  21 64 69 73 70 25 2c 30  2c 2d 64 69 73 70 25 21  |!disp%,0,-disp%!|
00001020  34 2a 33 36 2d 38 2c 64  69 73 70 25 21 32 34 2b  |4*36-8,disp%!24+|
00001030  31 32 2c 30 0d 05 32 05  e1 0d 05 3c 05 3a 0d 05  |12,0..2....<.:..|
00001040  46 33 f4 20 50 52 4f 43  64 69 73 70 6c 61 79 5f  |F3. PROCdisplay_|
00001050  61 64 64 20 3a 20 41 64  64 20 74 68 65 20 74 65  |add : Add the te|
00001060  78 74 20 74 6f 20 74 68  65 20 64 69 73 70 6c 61  |xt to the displa|
00001070  79 0d 05 50 1b dd f2 64  69 73 70 6c 61 79 5f 61  |y..P...display_a|
00001080  64 64 28 64 69 73 70 25  2c 61 24 29 0d 05 5a 0b  |dd(disp%,a$)..Z.|
00001090  ea 20 70 25 2c 6f 25 0d  05 64 0e e7 20 61 24 3c  |. p%,o%..d.. a$<|
000010a0  3e 22 22 20 8c 0d 05 6e  1a 20 6f 25 3d a4 63 6c  |>"" ...n. o%=.cl|
000010b0  61 69 6d 28 31 36 2b a9  28 61 24 29 2b 31 29 0d  |aim(16+.(a$)+1).|
000010c0  05 78 27 20 6f 25 21 30  3d 30 3a f4 20 4e 6f 20  |.x' o%!0=0:. No |
000010d0  6e 65 78 74 20 65 6e 74  72 79 20 69 6e 20 74 68  |next entry in th|
000010e0  65 20 6c 69 6e 65 0d 05  82 30 20 6f 25 21 34 3d  |e line...0 o%!4=|
000010f0  2d 31 3a 6f 25 21 38 3d  2d 31 3a f4 20 53 65 74  |-1:o%!8=-1:. Set|
00001100  20 74 68 65 20 63 6f 6c  6f 75 72 73 20 28 64 65  | the colours (de|
00001110  66 61 75 6c 74 29 0d 05  8c 31 20 6f 25 21 31 32  |fault)...1 o%!12|
00001120  3d a9 28 61 24 29 2a 31  36 3a f4 20 4c 65 6e 67  |=.(a$)*16:. Leng|
00001130  74 68 20 6f 66 20 74 65  78 74 20 6f 6e 20 74 68  |th of text on th|
00001140  69 73 20 6c 69 6e 65 0d  05 96 23 20 24 28 6f 25  |is line...# $(o%|
00001150  2b 31 36 29 3d 61 24 3a  f4 20 53 74 6f 72 65 20  |+16)=a$:. Store |
00001160  74 68 65 20 73 74 72 69  6e 67 0d 05 a0 25 20 e7  |the string...% .|
00001170  20 6f 25 21 31 32 3e 64  69 73 70 25 21 32 34 20  | o%!12>disp%!24 |
00001180  8c 64 69 73 70 25 21 32  34 3d 6f 25 21 31 32 0d  |.disp%!24=o%!12.|
00001190  05 aa 05 cc 0d 05 b4 09  20 6f 25 3d 30 0d 05 be  |........ o%=0...|
000011a0  05 cd 0d 05 c8 22 70 25  3d a4 63 6c 61 69 6d 28  |....."p%=.claim(|
000011b0  31 32 29 3a f4 20 54 68  65 20 63 68 61 69 6e 20  |12):. The chain |
000011c0  6c 69 6e 6b 0d 05 d2 2e  e7 20 64 69 73 70 25 21  |link..... disp%!|
000011d0  32 38 3d 30 20 8c 64 69  73 70 25 21 32 38 3d 70  |28=0 .disp%!28=p|
000011e0  25 20 8b 21 28 64 69 73  70 25 21 38 2b 38 29 3d  |% .!(disp%!8+8)=|
000011f0  70 25 0d 05 dc 3a 21 70  25 3d 64 69 73 70 25 21  |p%...:!p%=disp%!|
00001200  38 3a 64 69 73 70 25 21  38 3d 70 25 3a f4 20 4c  |8:disp%!8=p%:. L|
00001210  69 6e 6b 20 75 73 20 74  6f 20 74 68 65 20 76 65  |ink us to the ve|
00001220  72 74 69 63 61 6c 20 63  68 61 69 6e 0d 05 e6 2f  |rtical chain.../|
00001230  70 25 21 34 3d 6f 25 3a  f4 20 4c 69 6e 6b 20 74  |p%!4=o%:. Link t|
00001240  68 65 20 66 69 72 73 74  20 65 6e 74 72 79 20 69  |he first entry i|
00001250  6e 20 74 68 65 20 63 68  61 69 6e 0d 05 f0 3d 64  |n the chain...=d|
00001260  69 73 70 25 21 34 3d 64  69 73 70 25 21 34 2b 31  |isp%!4=disp%!4+1|
00001270  3a f4 20 49 6e 63 72 65  6d 65 6e 74 20 6e 75 6d  |:. Increment num|
00001280  62 65 72 20 6f 66 20 6c  69 6e 65 73 20 69 6e 20  |ber of lines in |
00001290  74 68 65 20 6c 69 73 74  0d 05 fa 2a 70 25 21 38  |the list...*p%!8|
000012a0  3d 30 3a f4 20 57 65 27  72 65 20 6e 6f 74 20 6c  |=0:. We're not l|
000012b0  69 6e 6b 65 64 20 6f 6e  20 74 6f 20 61 6e 79 6f  |inked on to anyo|
000012c0  6e 65 0d 06 04 1a f2 64  69 73 70 6c 61 79 5f 72  |ne.....display_r|
000012d0  65 73 69 7a 65 28 64 69  73 70 25 29 0d 06 0e 59  |esize(disp%)...Y|
000012e0  e7 20 21 64 69 73 70 25  3c 3e 2d 31 20 8c c8 99  |. !disp%<>-1 ...|
000012f0  20 22 57 69 6d 70 5f 46  6f 72 63 65 52 65 64 72  | "Wimp_ForceRedr|
00001300  61 77 22 2c 21 64 69 73  70 25 2c 30 2c 2d 64 69  |aw",!disp%,0,-di|
00001310  73 70 25 21 34 2a 33 36  2d 38 2c 64 69 73 70 25  |sp%!4*36-8,disp%|
00001320  21 32 34 2b 31 32 2c 2d  64 69 73 70 25 21 34 2a  |!24+12,-disp%!4*|
00001330  33 36 2b 33 36 0d 06 18  05 e1 0d 06 22 05 3a 0d  |36+36.......".:.|
00001340  06 2c 39 f4 20 50 52 4f  43 64 69 73 70 61 79 5f  |.,9. PROCdispay_|
00001350  61 64 64 61 74 20 3a 20  41 64 64 20 61 20 6c 69  |addat : Add a li|
00001360  6e 65 20 61 74 20 61 20  70 61 72 74 69 63 75 6c  |ne at a particul|
00001370  61 72 20 70 6f 69 6e 74  0d 06 36 20 dd f2 64 69  |ar point..6 ..di|
00001380  73 70 6c 61 79 5f 61 64  64 61 74 28 64 69 73 70  |splay_addat(disp|
00001390  25 2c 6c 25 2c 61 24 29  0d 06 40 0b ea 20 70 25  |%,l%,a$)..@.. p%|
000013a0  2c 6f 25 0d 06 4a 0e e7  20 61 24 3c 3e 22 22 20  |,o%..J.. a$<>"" |
000013b0  8c 0d 06 54 1a 20 6f 25  3d a4 63 6c 61 69 6d 28  |...T. o%=.claim(|
000013c0  31 36 2b a9 28 61 24 29  2b 31 29 0d 06 5e 27 20  |16+.(a$)+1)..^' |
000013d0  6f 25 21 30 3d 30 3a f4  20 4e 6f 20 6e 65 78 74  |o%!0=0:. No next|
000013e0  20 65 6e 74 72 79 20 69  6e 20 74 68 65 20 6c 69  | entry in the li|
000013f0  6e 65 0d 06 68 30 20 6f  25 21 34 3d 2d 31 3a 6f  |ne..h0 o%!4=-1:o|
00001400  25 21 38 3d 2d 31 3a f4  20 53 65 74 20 74 68 65  |%!8=-1:. Set the|
00001410  20 63 6f 6c 6f 75 72 73  20 28 64 65 66 61 75 6c  | colours (defaul|
00001420  74 29 0d 06 72 27 20 6f  25 21 31 32 3d a9 28 61  |t)..r' o%!12=.(a|
00001430  24 29 2a 31 36 3a f4 20  57 69 64 74 68 20 6f 66  |$)*16:. Width of|
00001440  20 74 68 65 20 6c 69 6e  65 0d 06 7c 23 20 24 28  | the line..|# $(|
00001450  6f 25 2b 31 36 29 3d 61  24 3a f4 20 53 74 6f 72  |o%+16)=a$:. Stor|
00001460  65 20 74 68 65 20 73 74  72 69 6e 67 0d 06 86 25  |e the string...%|
00001470  20 e7 20 6f 25 21 31 32  3e 64 69 73 70 25 21 32  | . o%!12>disp%!2|
00001480  34 20 8c 64 69 73 70 25  21 32 34 3d 6f 25 21 31  |4 .disp%!24=o%!1|
00001490  32 0d 06 90 05 cc 0d 06  9a 09 20 6f 25 3d 30 0d  |2......... o%=0.|
000014a0  06 a4 05 cd 0d 06 ae 22  70 25 3d a4 63 6c 61 69  |......."p%=.clai|
000014b0  6d 28 31 32 29 3a f4 20  54 68 65 20 63 68 61 69  |m(12):. The chai|
000014c0  6e 20 6c 69 6e 6b 0d 06  b8 0c e7 20 6c 25 3d 30  |n link..... l%=0|
000014d0  20 8c 0d 06 c2 2d 20 e7  20 64 69 73 70 25 21 32  | ....- . disp%!2|
000014e0  38 3d 30 20 8c 64 69 73  70 25 21 38 3d 70 25 20  |8=0 .disp%!8=p% |
000014f0  8b 21 28 64 69 73 70 25  21 32 38 29 3d 70 25 0d  |.!(disp%!28)=p%.|
00001500  06 cc 29 20 70 25 21 38  3d 64 69 73 70 25 21 32  |..) p%!8=disp%!2|
00001510  38 3a f4 20 4c 69 6e 6b  20 74 6f 20 74 68 65 20  |8:. Link to the |
00001520  6e 65 78 74 20 6f 6e 65  0d 06 d6 21 20 64 69 73  |next one...! dis|
00001530  70 25 21 32 38 3d 70 25  3a f4 20 41 64 64 20 61  |p%!28=p%:. Add a|
00001540  74 20 74 68 65 20 74 6f  70 0d 06 e0 05 cc 0d 06  |t the top.......|
00001550  ea 20 20 21 70 25 3d 6c  25 3a f4 20 4c 69 6e 6b  |.  !p%=l%:. Link|
00001560  20 61 66 74 65 72 20 61  6e 20 69 74 65 6d 0d 06  | after an item..|
00001570  f4 25 20 e7 20 6c 25 21  38 3d 30 20 8c 64 69 73  |.% . l%!8=0 .dis|
00001580  70 25 21 38 3d 70 25 20  8b 21 28 6c 25 21 38 29  |p%!8=p% .!(l%!8)|
00001590  3d 70 25 0d 06 fe 16 20  70 25 21 38 3d 6c 25 21  |=p%.... p%!8=l%!|
000015a0  38 3a 6c 25 21 38 3d 70  25 0d 07 08 05 cd 0d 07  |8:l%!8=p%.......|
000015b0  12 2f 70 25 21 34 3d 6f  25 3a f4 20 4c 69 6e 6b  |./p%!4=o%:. Link|
000015c0  20 74 68 65 20 66 69 72  73 74 20 65 6e 74 72 79  | the first entry|
000015d0  20 69 6e 20 74 68 65 20  63 68 61 69 6e 0d 07 1c  | in the chain...|
000015e0  3d 64 69 73 70 25 21 34  3d 64 69 73 70 25 21 34  |=disp%!4=disp%!4|
000015f0  2b 31 3a f4 20 49 6e 63  72 65 6d 65 6e 74 20 6e  |+1:. Increment n|
00001600  75 6d 62 65 72 20 6f 66  20 6c 69 6e 65 73 20 69  |umber of lines i|
00001610  6e 20 74 68 65 20 6c 69  73 74 0d 07 26 1a f2 64  |n the list..&..d|
00001620  69 73 70 6c 61 79 5f 72  65 73 69 7a 65 28 64 69  |isplay_resize(di|
00001630  73 70 25 29 0d 07 30 05  e1 0d 07 3a 05 3a 0d 07  |sp%)..0....:.:..|
00001640  44 3f f4 20 50 52 4f 43  64 69 73 70 6c 61 79 5f  |D?. PROCdisplay_|
00001650  61 64 64 61 74 74 6f 20  3a 20 41 64 64 20 74 6f  |addatto : Add to|
00001660  20 74 68 65 20 65 6e 64  20 6f 66 20 61 20 6c 69  | the end of a li|
00001670  6e 65 20 61 74 20 61 20  70 6f 69 6e 74 0d 07 4e  |ne at a point..N|
00001680  2a dd f2 64 69 73 70 6c  61 79 5f 61 64 64 61 74  |*..display_addat|
00001690  74 6f 28 64 69 73 70 25  2c 6c 25 2c 61 24 2c 62  |to(disp%,l%,a$,b|
000016a0  67 25 2c 66 67 25 29 0d  07 58 0e ea 20 70 25 2c  |g%,fg%)..X.. p%,|
000016b0  6f 25 2c 6e 25 0d 07 62  0e e7 20 61 24 3c 3e 22  |o%,n%..b.. a$<>"|
000016c0  22 20 8c 0d 07 6c 1a 20  6f 25 3d a4 63 6c 61 69  |" ...l. o%=.clai|
000016d0  6d 28 31 36 2b a9 28 61  24 29 2b 31 29 0d 07 76  |m(16+.(a$)+1)..v|
000016e0  27 20 6f 25 21 30 3d 30  3a f4 20 4e 6f 20 6e 65  |' o%!0=0:. No ne|
000016f0  78 74 20 65 6e 74 72 79  20 69 6e 20 74 68 65 20  |xt entry in the |
00001700  6c 69 6e 65 0d 07 80 33  20 6f 25 21 34 3d 62 67  |line...3 o%!4=bg|
00001710  25 3a 6f 25 21 38 3d 66  67 25 3a f4 20 53 65 74  |%:o%!8=fg%:. Set|
00001720  20 74 68 65 20 63 6f 6c  6f 75 72 73 20 28 61 73  | the colours (as|
00001730  20 67 69 76 65 6e 29 0d  07 8a 26 20 6f 25 21 31  | given)...& o%!1|
00001740  32 3d a9 28 61 24 29 2a  31 36 3a f4 20 54 68 65  |2=.(a$)*16:. The|
00001750  20 73 74 72 69 6e 67 20  77 69 64 74 68 0d 07 94  | string width...|
00001760  2c 20 24 28 6f 25 2b 31  36 29 3d 61 24 3a 6e 25  |, $(o%+16)=a$:n%|
00001770  3d 6f 25 21 31 32 3a f4  20 53 74 6f 72 65 20 74  |=o%!12:. Store t|
00001780  68 65 20 73 74 72 69 6e  67 0d 07 9e 14 20 70 25  |he string.... p%|
00001790  3d 6c 25 21 34 3a 6c 25  3d 6c 25 2b 34 0d 07 a8  |=l%!4:l%=l%+4...|
000017a0  36 20 c8 95 20 70 25 3c  3e 30 3a 6e 25 2b 3d 70  |6 .. p%<>0:n%+=p|
000017b0  25 21 31 32 3a 6c 25 3d  70 25 3a 70 25 3d 21 70  |%!12:l%=p%:p%=!p|
000017c0  25 3a ce 3a f4 20 46 69  6e 64 20 74 68 65 20 6c  |%:.:. Find the l|
000017d0  61 73 74 0d 07 b2 1f 20  e7 20 6e 25 3e 64 69 73  |ast.... . n%>dis|
000017e0  70 25 21 32 34 20 8c 64  69 73 70 25 21 32 34 3d  |p%!24 .disp%!24=|
000017f0  6e 25 0d 07 bc 1e 20 21  6c 25 3d 6f 25 3a f4 20  |n%.... !l%=o%:. |
00001800  4c 69 6e 6b 20 74 6f 20  74 68 65 20 6c 61 73 74  |Link to the last|
00001810  0d 07 c6 1b 20 f2 64 69  73 70 6c 61 79 5f 72 65  |.... .display_re|
00001820  73 69 7a 65 28 64 69 73  70 25 29 0d 07 d0 5a 20  |size(disp%)...Z |
00001830  e7 20 21 64 69 73 70 25  3c 3e 2d 31 20 8c c8 99  |. !disp%<>-1 ...|
00001840  20 22 57 69 6d 70 5f 46  6f 72 63 65 52 65 64 72  | "Wimp_ForceRedr|
00001850  61 77 22 2c 21 64 69 73  70 25 2c 30 2c 2d 64 69  |aw",!disp%,0,-di|
00001860  73 70 25 21 34 2a 33 36  2d 38 2c 64 69 73 70 25  |sp%!4*36-8,disp%|
00001870  21 32 34 2b 31 32 2c 2d  64 69 73 70 25 21 34 2a  |!24+12,-disp%!4*|
00001880  33 36 2b 33 36 0d 07 da  05 cd 0d 07 e4 05 e1 0d  |36+36...........|
00001890  07 ee 05 3a 0d 07 f8 37  f4 20 46 4e 64 69 73 70  |...:...7. FNdisp|
000018a0  6c 61 79 5f 6c 69 6e 65  68 20 3a 20 52 65 74 75  |lay_lineh : Retu|
000018b0  72 6e 20 68 61 6e 64 6c  65 20 6f 66 20 6c 69 6e  |rn handle of lin|
000018c0  65 20 73 70 65 63 69 66  69 65 64 0d 08 02 1d dd  |e specified.....|
000018d0  a4 64 69 73 70 6c 61 79  5f 6c 69 6e 65 68 28 64  |.display_lineh(d|
000018e0  69 73 70 25 2c 6c 25 29  0d 08 0c 18 ea 70 25 3a  |isp%,l%).....p%:|
000018f0  e7 20 6c 25 3c 30 20 8c  3d 64 69 73 70 25 21 38  |. l%<0 .=disp%!8|
00001900  0d 08 16 1c 70 25 3d 64  69 73 70 25 21 38 3a 6c  |....p%=disp%!8:l|
00001910  25 3d 64 69 73 70 25 21  34 2d 6c 25 0d 08 20 1a  |%=disp%!4-l%.. .|
00001920  c8 95 20 6c 25 3e 30 3a  70 25 3d 21 70 25 3a 6c  |.. l%>0:p%=!p%:l|
00001930  25 2d 3d 31 3a ce 0d 08  2a 07 3d 70 25 0d 08 34  |%-=1:...*.=p%..4|
00001940  05 3a 0d 08 3e 30 f4 20  50 52 4f 43 64 69 73 70  |.:..>0. PROCdisp|
00001950  6c 61 79 5f 61 64 64 74  6f 20 3a 20 41 64 64 20  |lay_addto : Add |
00001960  74 6f 20 74 68 65 20 65  6e 64 20 6f 66 20 6c 69  |to the end of li|
00001970  6e 65 0d 08 48 25 dd f2  64 69 73 70 6c 61 79 5f  |ne..H%..display_|
00001980  61 64 64 74 6f 28 64 69  73 70 25 2c 61 24 2c 62  |addto(disp%,a$,b|
00001990  67 25 2c 66 67 25 29 0d  08 52 2e f2 64 69 73 70  |g%,fg%)..R..disp|
000019a0  6c 61 79 5f 61 64 64 61  74 74 6f 28 64 69 73 70  |lay_addatto(disp|
000019b0  25 2c 64 69 73 70 25 21  38 2c 61 24 2c 62 67 25  |%,disp%!8,a$,bg%|
000019c0  2c 66 67 25 29 0d 08 5c  05 e1 0d 08 66 05 3a 0d  |,fg%)..\....f.:.|
000019d0  08 70 2d f4 20 50 52 4f  43 64 69 73 70 6c 61 79  |.p-. PROCdisplay|
000019e0  5f 72 65 73 69 7a 65 20  3a 20 52 65 73 69 7a 65  |_resize : Resize|
000019f0  20 74 68 65 20 64 69 73  70 6c 61 79 0d 08 7a 1b  | the display..z.|
00001a00  dd f2 64 69 73 70 6c 61  79 5f 72 65 73 69 7a 65  |..display_resize|
00001a10  28 64 69 73 70 25 29 0d  08 84 18 ea 20 79 62 6f  |(disp%)..... ybo|
00001a20  74 25 2c 78 66 75 6c 6c  25 2c 6f 70 65 6e 25 0d  |t%,xfull%,open%.|
00001a30  08 8e 12 e7 20 21 64 69  73 70 25 3c 3e 2d 31 20  |.... !disp%<>-1 |
00001a40  8c 0d 08 98 2c 20 21 62  25 3d 21 64 69 73 70 25  |...., !b%=!disp%|
00001a50  3a c8 99 20 22 57 69 6d  70 5f 47 65 74 57 69 6e  |:.. "Wimp_GetWin|
00001a60  64 6f 77 53 74 61 74 65  22 2c 2c 62 25 0d 08 a2  |dowState",,b%...|
00001a70  39 20 f4 20 49 66 20 66  75 6c 6c 20 73 69 7a 65  |9 . If full size|
00001a80  2c 20 6f 70 65 6e 20 66  75 6c 6c 20 73 69 7a 65  |, open full size|
00001a90  2c 20 61 6e 64 20 69 66  20 6f 70 65 6e 2c 20 72  |, and if open, r|
00001aa0  65 2d 6f 70 65 6e 0d 08  ac 1e 20 6f 70 65 6e 25  |e-open.... open%|
00001ab0  3d 28 62 25 21 33 32 20  80 20 28 31 3c 3c 31 36  |=(b%!32 . (1<<16|
00001ac0  29 29 3e 30 0d 08 b6 18  20 e7 20 ac 20 6f 70 65  |))>0.... . . ope|
00001ad0  6e 25 20 8c 62 25 21 32  38 3d 2d 33 0d 08 c0 3b  |n% .b%!28=-3...;|
00001ae0  20 c8 99 20 22 57 69 6d  70 5f 4f 70 65 6e 57 69  | .. "Wimp_OpenWi|
00001af0  6e 64 6f 77 22 2c 2c 62  25 3a c8 99 20 22 57 69  |ndow",,b%:.. "Wi|
00001b00  6d 70 5f 47 65 74 57 69  6e 64 6f 77 49 6e 66 6f  |mp_GetWindowInfo|
00001b10  22 2c 2c 62 25 2b 31 0d  08 ca 18 20 e7 20 ac 20  |",,b%+1.... . . |
00001b20  6f 70 65 6e 25 20 8c 62  25 21 32 38 3d 2d 33 0d  |open% .b%!28=-3.|
00001b30  08 d4 27 20 79 66 75 6c  6c 25 3d 28 62 25 21 31  |..' yfull%=(b%!1|
00001b40  36 2d 62 25 21 38 29 3e  3d 28 62 25 21 35 36 2d  |6-b%!8)>=(b%!56-|
00001b50  62 25 21 34 38 29 0d 08  de 2d 20 79 62 6f 74 25  |b%!48)...- ybot%|
00001b60  3d 28 62 25 21 32 34 2d  28 62 25 21 31 36 2d 62  |=(b%!24-(b%!16-b|
00001b70  25 21 38 29 29 3d 28 62  25 21 34 38 2d 62 25 21  |%!8))=(b%!48-b%!|
00001b80  35 36 29 0d 08 e8 27 20  78 66 75 6c 6c 25 3d 28  |56)...' xfull%=(|
00001b90  62 25 21 31 32 2d 62 25  21 34 29 3e 3d 28 62 25  |b%!12-b%!4)>=(b%|
00001ba0  21 35 32 2d 62 25 21 34  34 29 0d 08 f2 18 20 e7  |!52-b%!44).... .|
00001bb0  20 62 25 21 32 38 3d 2d  33 20 8c 79 62 6f 74 25  | b%!28=-3 .ybot%|
00001bc0  3d b9 0d 08 fc 4e 20 e7  20 6f 70 65 6e 25 20 8c  |=....N . open% .|
00001bd0  c8 99 20 22 57 69 6d 70  5f 46 6f 72 63 65 52 65  |.. "Wimp_ForceRe|
00001be0  64 72 61 77 22 2c 21 64  69 73 70 25 2c 30 2c 2d  |draw",!disp%,0,-|
00001bf0  64 69 73 70 25 21 34 2a  33 36 2d 38 2c 64 69 73  |disp%!4*36-8,dis|
00001c00  70 25 21 32 34 2b 31 32  2c 62 25 21 34 38 2b 38  |p%!24+12,b%!48+8|
00001c10  0d 09 06 42 20 62 25 21  36 38 3d 62 25 21 34 34  |...B b%!68=b%!44|
00001c20  3a 62 25 21 37 32 3d 2d  64 69 73 70 25 21 34 2a  |:b%!72=-disp%!4*|
00001c30  33 36 2d 38 3a 62 25 21  37 36 3d 64 69 73 70 25  |36-8:b%!76=disp%|
00001c40  21 32 34 2b 31 32 3a 62  25 21 38 30 3d 62 25 21  |!24+12:b%!80=b%!|
00001c50  35 36 0d 09 10 25 20 c8  99 20 22 57 69 6d 70 5f  |56...% .. "Wimp_|
00001c60  53 65 74 45 78 74 65 6e  74 22 2c 21 64 69 73 70  |SetExtent",!disp|
00001c70  25 2c 62 25 2b 36 38 0d  09 1a 0f 20 e7 20 79 66  |%,b%+68.... . yf|
00001c80  75 6c 6c 25 20 8c 0d 09  24 1e 20 20 62 25 21 38  |ull% ...$.  b%!8|
00001c90  3d 62 25 21 31 36 2d 28  62 25 21 38 30 2d 62 25  |=b%!16-(b%!80-b%|
00001ca0  21 37 32 29 0d 09 2e 45  20 20 e7 20 64 69 73 70  |!72)...E  . disp|
00001cb0  25 21 34 3d 64 69 73 70  25 21 34 30 20 8c 62 25  |%!4=disp%!40 .b%|
00001cc0  21 38 3d 62 25 21 38 2b  33 36 20 8b 64 69 73 70  |!8=b%!8+36 .disp|
00001cd0  25 21 34 34 3d 64 69 73  70 25 21 34 34 20 84 20  |%!44=disp%!44 . |
00001ce0  31 3a f4 20 4d 6f 76 65  64 0d 09 38 06 20 cd 0d  |1:. Moved..8. ..|
00001cf0  09 42 26 20 e7 20 79 62  6f 74 25 20 8c 62 25 21  |.B& . ybot% .b%!|
00001d00  32 34 3d 62 25 21 34 38  2d 28 62 25 21 31 36 2d  |24=b%!48-(b%!16-|
00001d10  62 25 21 38 29 0d 09 4c  43 20 e7 20 78 66 75 6c  |b%!8)..LC . xful|
00001d20  6c 25 20 8c 62 25 21 31  32 3d 62 25 21 34 2b 64  |l% .b%!12=b%!4+d|
00001d30  69 73 70 25 21 32 34 2b  31 32 3a 64 69 73 70 25  |isp%!24+12:disp%|
00001d40  21 34 34 3d 64 69 73 70  25 21 34 34 20 84 20 31  |!44=disp%!44 . 1|
00001d50  3a f4 20 4d 6f 76 65 64  0d 09 56 1d 20 c8 99 20  |:. Moved..V. .. |
00001d60  22 57 69 6d 70 5f 4f 70  65 6e 57 69 6e 64 6f 77  |"Wimp_OpenWindow|
00001d70  22 2c 2c 62 25 0d 09 60  05 cd 0d 09 6a 05 e1 0d  |",,b%..`....j...|
00001d80  09 74 05 3a 0d 09 7e 22  f4 20 54 72 75 65 20 69  |.t.:..~". True i|
00001d90  66 20 74 68 65 20 77 69  6e 64 6f 77 20 68 61 73  |f the window has|
00001da0  20 6d 6f 76 65 64 0d 09  88 46 dd a4 64 69 73 70  | moved...F..disp|
00001db0  6c 61 79 5f 6d 6f 76 65  64 28 64 69 73 70 25 29  |lay_moved(disp%)|
00001dc0  3a ea 20 6d 25 3a 6d 25  3d 64 69 73 70 25 21 34  |:. m%:m%=disp%!4|
00001dd0  34 3a 64 69 73 70 25 21  34 34 3d 64 69 73 70 25  |4:disp%!44=disp%|
00001de0  21 34 34 20 80 20 ac 31  3a 3d 6d 25 0d 09 92 05  |!44 . .1:=m%....|
00001df0  3a 0d 09 9c 37 f4 20 50  52 4f 43 64 69 73 70 6c  |:...7. PROCdispl|
00001e00  61 79 5f 66 75 6c 6c 73  69 7a 65 20 3a 20 4d 61  |ay_fullsize : Ma|
00001e10  6b 65 20 74 68 65 20 64  69 73 70 6c 61 79 20 66  |ke the display f|
00001e20  75 6c 6c 20 73 69 7a 65  0d 09 a6 1d dd f2 64 69  |ull size......di|
00001e30  73 70 6c 61 79 5f 66 75  6c 6c 73 69 7a 65 28 64  |splay_fullsize(d|
00001e40  69 73 70 25 29 0d 09 b0  0b ea 20 6f 70 65 6e 25  |isp%)..... open%|
00001e50  0d 09 ba 12 e7 20 21 64  69 73 70 25 3c 3e 2d 31  |..... !disp%<>-1|
00001e60  20 8c 0d 09 c4 2c 20 21  62 25 3d 21 64 69 73 70  | ...., !b%=!disp|
00001e70  25 3a c8 99 20 22 57 69  6d 70 5f 47 65 74 57 69  |%:.. "Wimp_GetWi|
00001e80  6e 64 6f 77 53 74 61 74  65 22 2c 2c 62 25 0d 09  |ndowState",,b%..|
00001e90  ce 1e 20 6f 70 65 6e 25  3d 28 62 25 21 33 32 20  |.. open%=(b%!32 |
00001ea0  80 20 28 31 3c 3c 31 36  29 29 3e 30 0d 09 d8 4e  |. (1<<16))>0...N|
00001eb0  20 e7 20 6f 70 65 6e 25  20 8c c8 99 20 22 57 69  | . open% ... "Wi|
00001ec0  6d 70 5f 46 6f 72 63 65  52 65 64 72 61 77 22 2c  |mp_ForceRedraw",|
00001ed0  21 64 69 73 70 25 2c 30  2c 2d 64 69 73 70 25 21  |!disp%,0,-disp%!|
00001ee0  34 2a 33 36 2d 38 2c 64  69 73 70 25 21 32 34 2b  |4*36-8,disp%!24+|
00001ef0  31 32 2c 62 25 21 34 38  2b 38 0d 09 e2 42 20 62  |12,b%!48+8...B b|
00001f00  25 21 36 38 3d 62 25 21  34 34 3a 62 25 21 37 32  |%!68=b%!44:b%!72|
00001f10  3d 2d 64 69 73 70 25 21  34 2a 33 36 2d 38 3a 62  |=-disp%!4*36-8:b|
00001f20  25 21 37 36 3d 64 69 73  70 25 21 32 34 2b 31 32  |%!76=disp%!24+12|
00001f30  3a 62 25 21 38 30 3d 62  25 21 35 36 0d 09 ec 25  |:b%!80=b%!56...%|
00001f40  20 c8 99 20 22 57 69 6d  70 5f 53 65 74 45 78 74  | .. "Wimp_SetExt|
00001f50  65 6e 74 22 2c 21 64 69  73 70 25 2c 62 25 2b 36  |ent",!disp%,b%+6|
00001f60  38 0d 09 f6 41 20 62 25  21 38 3d 62 25 21 31 36  |8...A b%!8=b%!16|
00001f70  2d 28 64 69 73 70 25 21  34 2a 33 36 29 2d 38 3a  |-(disp%!4*36)-8:|
00001f80  62 25 21 31 32 3d 62 25  21 34 2b 64 69 73 70 25  |b%!12=b%!4+disp%|
00001f90  21 32 34 2b 31 32 3a f4  20 46 75 6c 6c 20 73 69  |!24+12:. Full si|
00001fa0  7a 65 0d 0a 00 1d 20 c8  99 20 22 57 69 6d 70 5f  |ze.... .. "Wimp_|
00001fb0  4f 70 65 6e 57 69 6e 64  6f 77 22 2c 2c 62 25 0d  |OpenWindow",,b%.|
00001fc0  0a 0a 40 20 64 69 73 70  25 21 34 34 3d 64 69 73  |..@ disp%!44=dis|
00001fd0  70 25 21 34 34 20 84 20  31 3a f4 20 57 65 27 6c  |p%!44 . 1:. We'l|
00001fe0  6c 20 61 73 73 75 6d 65  20 74 68 61 74 20 69 74  |l assume that it|
00001ff0  20 68 61 73 20 62 65 65  6e 20 6d 6f 76 65 64 0d  | has been moved.|
00002000  0a 14 05 cd 0d 0a 1e 05  e1 0d 0a 28 05 3a 0d 0a  |...........(.:..|
00002010  32 2c f4 20 50 52 4f 43  64 69 73 70 6c 61 79 5f  |2,. PROCdisplay_|
00002020  72 65 64 72 61 77 20 3a  20 52 65 64 72 61 77 20  |redraw : Redraw |
00002030  74 68 65 20 77 69 6e 64  6f 77 0d 0a 3c 1b dd f2  |the window..<...|
00002040  64 69 73 70 6c 61 79 5f  72 65 64 72 61 77 28 64  |display_redraw(d|
00002050  69 73 70 25 29 0d 0a 46  18 ea 20 62 2c 74 2c 73  |isp%)..F.. b,t,s|
00002060  74 2c 65 6e 64 2c 6c 66  25 2c 72 74 25 0d 0a 50  |t,end,lf%,rt%..P|
00002070  16 ea 20 70 25 2c 6f 25  2c 78 25 2c 62 67 25 2c  |.. p%,o%,x%,bg%,|
00002080  66 67 25 0d 0a 5a 31 21  62 25 3d 21 64 69 73 70  |fg%..Z1!b%=!disp|
00002090  25 3a c8 99 20 22 57 69  6d 70 5f 52 65 64 72 61  |%:.. "Wimp_Redra|
000020a0  77 57 69 6e 64 6f 77 22  2c 2c 62 25 20 b8 20 6d  |wWindow",,b% . m|
000020b0  6f 72 65 25 0d 0a 64 20  62 6c 3d 62 25 21 34 2d  |ore%..d bl=b%!4-|
000020c0  62 25 21 32 30 3a 62 74  3d 62 25 21 31 36 2d 62  |b%!20:bt=b%!16-b|
000020d0  25 21 32 34 0d 0a 6e 0c  c8 95 20 6d 6f 72 65 25  |%!24..n... more%|
000020e0  0d 0a 78 1a 20 62 3d 62  25 21 33 32 2d 62 74 3a  |..x. b=b%!32-bt:|
000020f0  74 3d 62 25 21 34 30 2d  62 74 0d 0a 82 15 20 e7  |t=b%!40-bt.... .|
00002100  20 64 69 73 70 25 21 31  36 3c 3e 2d 31 20 8c 0d  | disp%!16<>-1 ..|
00002110  0a 8c 1f 20 20 f2 64 69  73 70 6c 61 79 5f 63 6f  |...  .display_co|
00002120  6c 6f 75 72 28 64 69 73  70 25 21 31 36 29 0d 0a  |lour(disp%!16)..|
00002130  96 2f 20 20 c8 93 20 c8  90 20 62 25 21 32 38 2c  |./  .. .. b%!28,|
00002140  62 25 21 33 32 2c 62 25  21 33 36 2d 62 25 21 32  |b%!32,b%!36-b%!2|
00002150  38 2c 62 25 21 34 30 2d  62 25 21 33 32 0d 0a a0  |8,b%!40-b%!32...|
00002160  06 20 cd 0d 0a aa 1f 20  73 74 3d a8 28 2d 74 2f  |. ..... st=.(-t/|
00002170  33 36 29 2d 31 3a 65 6e  64 3d a8 28 2d 62 2f 33  |36)-1:end=.(-b/3|
00002180  36 29 0d 0a b4 23 20 e7  20 65 6e 64 3e 64 69 73  |6)...# . end>dis|
00002190  70 25 21 34 2d 31 20 8c  65 6e 64 3d 64 69 73 70  |p%!4-1 .end=disp|
000021a0  25 21 34 2d 31 0d 0a be  11 20 e7 20 73 74 3c 30  |%!4-1.... . st<0|
000021b0  20 8c 73 74 3d 30 0d 0a  c8 1b 20 62 3d 64 69 73  | .st=0.... b=dis|
000021c0  70 25 21 34 2d 31 3a 70  25 3d 64 69 73 70 25 21  |p%!4-1:p%=disp%!|
000021d0  38 0d 0a d2 1b 20 c8 95  20 62 3e 65 6e 64 3a 62  |8.... .. b>end:b|
000021e0  2d 3d 31 3a 70 25 3d 21  70 25 3a ce 0d 0a dc 0f  |-=1:p%=!p%:.....|
000021f0  20 c8 95 20 73 74 3c 3d  65 6e 64 0d 0a e6 12 20  | .. st<=end.... |
00002200  20 6f 25 3d 70 25 21 34  3a 78 25 3d 30 0d 0a f0  | o%=p%!4:x%=0...|
00002210  2e 20 20 66 67 25 3d 64  69 73 70 25 21 32 30 3a  |.  fg%=disp%!20:|
00002220  62 67 25 3d 2d 31 3a f2  64 69 73 70 6c 61 79 5f  |bg%=-1:.display_|
00002230  63 6f 6c 6f 75 72 28 66  67 25 29 0d 0a fa 0e 20  |colour(fg%).... |
00002240  20 c8 95 20 6f 25 3c 3e  30 0d 0b 04 32 20 20 20  | .. o%<>0...2   |
00002250  e7 20 28 6f 25 21 38 29  3c 3e 2d 31 20 8c 66 67  |. (o%!8)<>-1 .fg|
00002260  25 3d 6f 25 21 38 3a f2  64 69 73 70 6c 61 79 5f  |%=o%!8:.display_|
00002270  63 6f 6c 6f 75 72 28 66  67 25 29 0d 0b 0e 2e 20  |colour(fg%).... |
00002280  20 20 e7 20 28 6f 25 21  34 29 3c 3e 2d 31 20 8c  |  . (o%!4)<>-1 .|
00002290  62 67 25 3d 6f 25 21 34  3a e7 20 62 67 25 3d 2d  |bg%=o%!4:. bg%=-|
000022a0  32 20 8c 62 67 25 3d 2d  31 0d 0b 18 12 20 20 20  |2 .bg%=-1....   |
000022b0  e7 20 62 67 25 3c 3e 2d  31 20 8c 0d 0b 22 1c 20  |. bg%<>-1 ...". |
000022c0  20 20 20 f2 64 69 73 70  6c 61 79 5f 63 6f 6c 6f  |   .display_colo|
000022d0  75 72 28 62 67 25 29 0d  0b 2c 58 20 20 20 20 e7  |ur(bg%)..,X    .|
000022e0  20 78 25 3d 30 20 8c c8  93 20 c8 90 20 78 25 2b  | x%=0 ... .. x%+|
000022f0  62 6c 2c 62 74 2d 34 32  2d 33 36 2a 65 6e 64 2c  |bl,bt-42-36*end,|
00002300  6f 25 21 31 32 2b 34 2c  33 35 20 8b c8 93 20 c8  |o%!12+4,35 ... .|
00002310  90 20 34 2b 78 25 2b 62  6c 2c 62 74 2d 34 32 2d  |. 4+x%+bl,bt-42-|
00002320  33 36 2a 65 6e 64 2c 6f  25 21 31 32 2c 33 35 0d  |36*end,o%!12,35.|
00002330  0b 36 14 20 20 20 20 e7  20 78 25 3c 30 20 8c 78  |.6.    . x%<0 .x|
00002340  25 3d 30 0d 0b 40 1c 20  20 20 20 f2 64 69 73 70  |%=0..@.    .disp|
00002350  6c 61 79 5f 63 6f 6c 6f  75 72 28 66 67 25 29 0d  |lay_colour(fg%).|
00002360  0b 4a 08 20 20 20 cd 0d  0b 54 26 20 20 20 ec 20  |.J.   ...T&   . |
00002370  34 2b 78 25 2b 62 6c 2c  62 74 2d 38 2d 33 36 2a  |4+x%+bl,bt-8-36*|
00002380  65 6e 64 3a f1 24 28 6f  25 2b 31 36 29 0d 0b 5e  |end:.$(o%+16)..^|
00002390  17 20 20 20 78 25 2b 3d  6f 25 21 31 32 3a 6f 25  |.   x%+=o%!12:o%|
000023a0  3d 21 6f 25 0d 0b 68 07  20 20 ce 0d 0b 72 11 20  |=!o%..h.  ...r. |
000023b0  20 e7 20 62 67 25 3c 3e  2d 31 20 8c 0d 0b 7c 1b  | . bg%<>-1 ...|.|
000023c0  20 20 20 f2 64 69 73 70  6c 61 79 5f 63 6f 6c 6f  |   .display_colo|
000023d0  75 72 28 62 67 25 29 0d  0b 86 2b 20 20 20 c8 93  |ur(bg%)...+   ..|
000023e0  20 c8 90 20 34 2b 78 25  2b 62 6c 2c 62 74 2d 34  | .. 4+x%+bl,bt-4|
000023f0  32 2d 33 36 2a 65 6e 64  2c 32 35 35 2a 31 36 2c  |2-36*end,255*16,|
00002400  33 35 0d 0b 90 07 20 20  cd 0d 0b 9a 16 20 20 e7  |35....  .....  .|
00002410  20 64 69 73 70 25 21 34  38 3c 3e 2d 31 20 8c 0d  | disp%!48<>-1 ..|
00002420  0b a4 28 20 20 20 e7 20  64 69 73 70 25 21 34 38  |..(   . disp%!48|
00002430  3c 3d 65 6e 64 20 80 20  64 69 73 70 25 21 35 36  |<=end . disp%!56|
00002440  3e 3d 65 6e 64 20 8c 0d  0b ae 33 20 20 20 20 f4  |>=end ....3    .|
00002450  20 54 68 65 72 65 20 69  73 20 61 20 73 65 6c 65  | There is a sele|
00002460  63 74 69 6f 6e 20 61 6e  64 20 77 65 20 61 72 65  |ction and we are|
00002470  20 69 6e 73 69 64 65 20  69 74 0d 0b b8 1a 20 20  | inside it....  |
00002480  20 20 f2 64 69 73 70 6c  61 79 5f 63 6f 6c 6f 75  |  .display_colou|
00002490  72 69 6e 76 0d 0b c2 18  20 20 20 20 e7 20 64 69  |rinv....    . di|
000024a0  73 70 25 21 35 36 3d 65  6e 64 20 8c 0d 0b cc 40  |sp%!56=end ....@|
000024b0  20 20 20 20 20 72 74 25  3d 64 69 73 70 25 21 36  |     rt%=disp%!6|
000024c0  30 3a f4 20 54 68 65 20  6c 61 73 74 20 6c 69 6e  |0:. The last lin|
000024d0  65 20 6f 66 20 74 68 65  20 73 65 6c 65 63 74 69  |e of the selecti|
000024e0  6f 6e 20 28 74 6f 20 63  68 61 72 29 0d 0b d6 1f  |on (to char)....|
000024f0  20 20 20 20 20 e7 20 72  74 25 3e 78 25 2f 31 36  |     . rt%>x%/16|
00002500  20 8c 72 74 25 3d 78 25  2f 31 36 0d 0b e0 19 20  | .rt%=x%/16.... |
00002510  20 20 20 20 e7 20 64 69  73 70 25 21 34 38 3d 65  |    . disp%!48=e|
00002520  6e 64 20 8c 0d 0b ea 26  20 20 20 20 20 20 f4 20  |nd ....&      . |
00002530  2e 2e 2e 20 61 6e 64 20  74 68 65 20 66 69 72 73  |... and the firs|
00002540  74 20 6c 69 6e 65 20 74  6f 6f 0d 0b f4 16 20 20  |t line too....  |
00002550  20 20 20 20 6c 66 25 3d  64 69 73 70 25 21 35 32  |    lf%=disp%!52|
00002560  0d 0b fe 20 20 20 20 20  20 20 e7 20 6c 66 25 3e  |...       . lf%>|
00002570  78 25 2f 31 36 20 8c 6c  66 25 3d 78 25 2f 31 36  |x%/16 .lf%=x%/16|
00002580  0d 0c 08 0a 20 20 20 20  20 cc 0d 0c 12 2b 20 20  |....     ....+  |
00002590  20 20 20 20 f4 20 46 69  6c 6c 20 66 72 6f 6d 20  |    . Fill from |
000025a0  6c 65 66 74 20 74 6f 20  74 68 65 20 65 6e 64 20  |left to the end |
000025b0  70 6f 69 6e 74 0d 0c 1c  10 20 20 20 20 20 20 6c  |point....      l|
000025c0  66 25 3d 2d 31 0d 0c 26  0a 20 20 20 20 20 cd 0d  |f%=-1..&.     ..|
000025d0  0c 30 09 20 20 20 20 cc  0d 0c 3a 19 20 20 20 20  |.0.    ...:.    |
000025e0  20 e7 20 64 69 73 70 25  21 34 38 3d 65 6e 64 20  | . disp%!48=end |
000025f0  8c 0d 0c 44 3b 20 20 20  20 20 20 f4 20 54 68 65  |...D;      . The|
00002600  20 66 69 72 73 74 20 6c  69 6e 65 20 6f 66 20 74  | first line of t|
00002610  68 65 20 73 65 6c 65 63  74 69 6f 6e 20 28 66 69  |he selection (fi|
00002620  6c 6c 20 74 6f 20 72 69  67 68 74 29 0d 0c 4e 1e  |ll to right)..N.|
00002630  20 20 20 20 20 20 6c 66  25 3d 64 69 73 70 25 21  |      lf%=disp%!|
00002640  35 32 3a 72 74 25 3d 32  35 35 0d 0c 58 20 20 20  |52:rt%=255..X   |
00002650  20 20 20 20 e7 20 6c 66  25 3e 78 25 2f 31 36 20  |    . lf%>x%/16 |
00002660  8c 6c 66 25 3d 78 25 2f  31 36 0d 0c 62 0a 20 20  |.lf%=x%/16..b.  |
00002670  20 20 20 cc 0d 0c 6c 18  20 20 20 20 20 20 6c 66  |   ...l.      lf|
00002680  25 3d 2d 31 3a 72 74 25  3d 32 35 35 0d 0c 76 32  |%=-1:rt%=255..v2|
00002690  20 20 20 20 20 20 f4 20  57 69 74 68 69 6e 20 74  |      . Within t|
000026a0  68 65 20 73 65 6c 65 63  74 69 6f 6e 2c 20 66 69  |he selection, fi|
000026b0  6c 6c 20 77 68 6f 6c 65  20 6c 69 6e 65 73 0d 0c  |ll whole lines..|
000026c0  80 0a 20 20 20 20 20 cd  0d 0c 8a 09 20 20 20 20  |..     .....    |
000026d0  cd 0d 0c 94 22 20 20 20  20 f4 20 44 6f 20 74 68  |...."    . Do th|
000026e0  65 20 66 69 6c 6c 20 28  69 6e 76 65 72 74 73 20  |e fill (inverts |
000026f0  69 74 29 0d 0c 9e 36 20  20 20 20 c8 93 20 c8 90  |it)...6    .. ..|
00002700  20 34 2b 6c 66 25 2a 31  36 2b 62 6c 2c 62 74 2d  | 4+lf%*16+bl,bt-|
00002710  34 32 2d 33 36 2a 65 6e  64 2c 28 72 74 25 2d 6c  |42-36*end,(rt%-l|
00002720  66 25 29 2a 31 36 2c 33  35 0d 0c a8 08 20 20 20  |f%)*16,35....   |
00002730  cd 0d 0c b2 07 20 20 cd  0d 0c bc 13 20 20 65 6e  |.....  .....  en|
00002740  64 2d 3d 31 3a 70 25 3d  21 70 25 0d 0c c6 06 20  |d-=1:p%=!p%.... |
00002750  ce 0d 0c d0 27 20 c8 99  20 22 57 69 6d 70 5f 47  |....' .. "Wimp_G|
00002760  65 74 52 65 63 74 61 6e  67 6c 65 22 2c 2c 62 25  |etRectangle",,b%|
00002770  20 b8 20 6d 6f 72 65 25  0d 0c da 05 ce 0d 0c e4  | . more%........|
00002780  05 e1 0d 0c ee 05 3a 0d  0c f8 1e f4 20 47 65 74  |......:..... Get|
00002790  20 74 68 65 20 69 6e 76  65 72 74 69 6e 67 20 63  | the inverting c|
000027a0  6f 6c 6f 75 72 0d 0d 02  17 dd f2 64 69 73 70 6c  |olour......displ|
000027b0  61 79 5f 63 6f 6c 6f 75  72 69 6e 76 0d 0d 0c 2d  |ay_colourinv...-|
000027c0  ea 20 63 25 3a c8 99 20  22 4f 53 5f 52 65 61 64  |. c%:.. "OS_Read|
000027d0  4d 6f 64 65 56 61 72 69  61 62 6c 65 22 2c 2d 31  |ModeVariable",-1|
000027e0  2c 33 20 b8 20 2c 2c 63  25 0d 0d 16 38 f4 20 4e  |,3 . ,,c%...8. N|
000027f0  6f 72 6d 61 6c 20 31 36  20 63 6f 6c 6f 75 72 20  |ormal 16 colour |
00002800  61 6e 64 20 6c 65 73 73  20 6d 6f 64 65 73 20 75  |and less modes u|
00002810  73 65 20 57 69 6d 70 5f  53 65 74 43 6f 6c 6f 75  |se Wimp_SetColou|
00002820  72 0d 0d 20 3c f4 20 38  62 70 70 20 6f 72 20 6d  |r.. <. 8bpp or m|
00002830  6f 72 65 20 28 33 32 4d  20 67 69 76 65 73 20 36  |ore (32M gives 6|
00002840  35 35 33 36 2c 20 31 4d  20 67 69 76 65 73 20 2d  |5536, 1M gives -|
00002850  31 29 20 66 6f 72 20 6f  74 68 65 72 73 0d 0d 2a  |1) for others..*|
00002860  66 e7 20 63 25 3c 31 36  20 80 20 63 25 3c 3e 2d  |f. c%<16 . c%<>-|
00002870  31 20 8c c8 99 20 22 57  69 6d 70 5f 53 65 74 43  |1 ... "Wimp_SetC|
00002880  6f 6c 6f 75 72 22 2c 37  2b 28 33 3c 3c 34 29 20  |olour",7+(3<<4) |
00002890  8b c8 99 20 22 43 6f 6c  6f 75 72 54 72 61 6e 73  |... "ColourTrans|
000028a0  5f 53 65 74 47 43 4f 4c  22 2c 2d 32 35 36 2c 2c  |_SetGCOL",-256,,|
000028b0  2c 30 2c 33 3a f4 20 2d  32 35 36 20 3d 20 77 68  |,0,3:. -256 = wh|
000028c0  69 74 65 0d 0d 34 05 e1  0d 0d 3e 05 3a 0d 0d 48  |ite..4....>.:..H|
000028d0  2e f4 20 50 52 4f 43 64  69 73 70 6c 61 79 5f 73  |.. PROCdisplay_s|
000028e0  65 6c 73 74 61 72 74 20  3a 20 53 74 61 72 74 20  |elstart : Start |
000028f0  61 20 73 65 6c 65 63 74  69 6f 6e 0d 0d 52 26 f4  |a selection..R&.|
00002900  20 78 20 61 6e 64 20 79  20 69 6e 20 72 65 6c 61  | x and y in rela|
00002910  74 69 76 65 20 63 6f 2d  6f 72 64 69 6e 61 74 65  |tive co-ordinate|
00002920  73 0d 0d 5c 23 dd f2 64  69 73 70 6c 61 79 5f 73  |s..\#..display_s|
00002930  65 6c 73 74 61 72 74 28  64 69 73 70 25 2c 78 25  |elstart(disp%,x%|
00002940  2c 79 25 29 0d 0d 66 2c  e7 20 64 69 73 70 25 21  |,y%)..f,. disp%!|
00002950  34 38 3c 3e 2d 31 20 8c  f2 64 69 73 70 6c 61 79  |48<>-1 ..display|
00002960  5f 73 65 6c 63 6c 65 61  72 28 64 69 73 70 25 29  |_selclear(disp%)|
00002970  0d 0d 70 27 79 25 3d 2d  28 79 25 2b 38 29 2f 33  |..p'y%=-(y%+8)/3|
00002980  36 3a 78 25 3d 78 25 2f  31 36 3a e7 20 79 25 3c  |6:x%=x%/16:. y%<|
00002990  30 20 8c 79 25 3d 30 0d  0d 7a 20 f4 20 53 74 61  |0 .y%=0..z . Sta|
000029a0  72 74 20 61 6e 64 20 45  6e 64 20 61 72 65 20 74  |rt and End are t|
000029b0  68 65 20 73 61 6d 65 0d  0d 84 33 64 69 73 70 25  |he same...3disp%|
000029c0  21 34 38 3d 79 25 3a 64  69 73 70 25 21 35 32 3d  |!48=y%:disp%!52=|
000029d0  78 25 3a 64 69 73 70 25  21 35 36 3d 79 25 3a 64  |x%:disp%!56=y%:d|
000029e0  69 73 70 25 21 36 30 3d  78 25 0d 0d 8e 2f 62 25  |isp%!60=x%.../b%|
000029f0  21 34 30 3d 21 64 69 73  70 25 3a c8 99 20 22 57  |!40=!disp%:.. "W|
00002a00  69 6d 70 5f 47 65 74 57  69 6e 64 6f 77 49 6e 66  |imp_GetWindowInf|
00002a10  6f 22 2c 2c 62 25 2b 34  30 0d 0d 98 23 62 25 21  |o",,b%+40...#b%!|
00002a20  32 34 3d 62 25 21 34 34  2d 62 25 21 36 30 2b 62  |24=b%!44-b%!60+b|
00002a30  25 21 38 34 3a f4 20 4d  69 6e 20 78 0d 0d a2 23  |%!84:. Min x...#|
00002a40  62 25 21 32 38 3d 62 25  21 35 36 2d 62 25 21 36  |b%!28=b%!56-b%!6|
00002a50  34 2b 62 25 21 38 38 3a  f4 20 4d 69 6e 20 79 0d  |4+b%!88:. Min y.|
00002a60  0d ac 23 62 25 21 33 32  3d 62 25 21 32 34 2b 62  |..#b%!32=b%!24+b|
00002a70  25 21 39 32 2d 62 25 21  38 34 3a f4 20 4d 61 78  |%!92-b%!84:. Max|
00002a80  20 78 0d 0d b6 23 62 25  21 33 36 3d 62 25 21 32  | x...#b%!36=b%!2|
00002a90  38 2b 62 25 21 39 36 2d  62 25 21 38 38 3a f4 20  |8+b%!96-b%!88:. |
00002aa0  4d 61 78 20 79 0d 0d c0  23 c8 99 20 22 57 69 6d  |Max y...#.. "Wim|
00002ab0  70 5f 47 65 74 50 6f 69  6e 74 65 72 49 6e 66 6f  |p_GetPointerInfo|
00002ac0  22 2c 2c 62 25 2b 34 30  0d 0d ca 32 62 25 21 38  |",,b%+40...2b%!8|
00002ad0  3d 62 25 21 34 30 3a 62  25 21 31 32 3d 62 25 21  |=b%!40:b%!12=b%!|
00002ae0  34 34 3a 62 25 21 31 36  3d 62 25 21 34 30 3a 62  |44:b%!16=b%!40:b|
00002af0  25 21 32 30 3d 62 25 21  34 34 0d 0d d4 19 62 25  |%!20=b%!44....b%|
00002b00  21 34 3d 37 3a f4 20 44  72 61 67 20 61 20 70 6f  |!4=7:. Drag a po|
00002b10  69 6e 74 0d 0d de 19 c8  99 20 22 57 69 6d 70 5f  |int...... "Wimp_|
00002b20  44 72 61 67 42 6f 78 22  2c 2c 62 25 0d 0d e8 05  |DragBox",,b%....|
00002b30  e1 0d 0d f2 05 3a 0d 0d  fc 1d dd f2 64 69 73 70  |.....:......disp|
00002b40  6c 61 79 5f 73 65 6c 63  6c 65 61 72 28 64 69 73  |lay_selclear(dis|
00002b50  70 25 29 0d 0e 06 2b e7  20 64 69 73 70 25 21 34  |p%)...+. disp%!4|
00002b60  38 3d 2d 31 20 8c e1 3a  f4 20 49 66 20 6e 6f 20  |8=-1 ..:. If no |
00002b70  73 65 6c 65 63 74 69 6f  6e 20 65 78 69 74 0d 0e  |selection exit..|
00002b80  10 59 c8 99 20 22 57 69  6d 70 5f 46 6f 72 63 65  |.Y.. "Wimp_Force|
00002b90  52 65 64 72 61 77 22 2c  21 64 69 73 70 25 2c 30  |Redraw",!disp%,0|
00002ba0  2c 2d 64 69 73 70 25 21  35 36 2a 33 36 2d 33 36  |,-disp%!56*36-36|
00002bb0  2d 38 2c 64 69 73 70 25  21 32 34 2b 31 32 2c 2d  |-8,disp%!24+12,-|
00002bc0  64 69 73 70 25 21 34 38  2a 33 36 3a 64 69 73 70  |disp%!48*36:disp|
00002bd0  25 21 34 38 3d 2d 31 0d  0e 1a 05 e1 0d 0e 24 05  |%!48=-1.......$.|
00002be0  3a 0d 0e 2e 30 f4 20 50  52 4f 43 64 69 73 70 6c  |:...0. PROCdispl|
00002bf0  61 79 5f 73 65 6c 6d 6f  64 69 66 79 20 3a 20 4d  |ay_selmodify : M|
00002c00  6f 64 69 66 79 20 61 20  73 65 6c 65 63 74 69 6f  |odify a selectio|
00002c10  6e 0d 0e 38 24 dd f2 64  69 73 70 6c 61 79 5f 73  |n..8$..display_s|
00002c20  65 6c 6d 6f 64 69 66 79  28 64 69 73 70 25 2c 78  |elmodify(disp%,x|
00002c30  25 2c 79 25 29 0d 0e 42  24 ea 20 6d 25 2c 6e 25  |%,y%)..B$. m%,n%|
00002c40  2c 72 25 3a f4 20 4d 69  6e 69 6d 75 6d 20 61 6e  |,r%:. Minimum an|
00002c50  64 20 6d 61 78 69 6d 75  6d 0d 0e 4c 2d e7 20 64  |d maximum..L-. d|
00002c60  69 73 70 25 21 34 38 3d  2d 31 20 8c e1 3a f4 20  |isp%!48=-1 ..:. |
00002c70  49 66 20 6e 6f 20 73 65  6c 65 63 74 69 6f 6e 2c  |If no selection,|
00002c80  20 61 62 6f 72 74 0d 0e  56 27 79 25 3d 2d 28 79  | abort..V'y%=-(y|
00002c90  25 2b 38 29 2f 33 36 3a  78 25 3d 78 25 2f 31 36  |%+8)/36:x%=x%/16|
00002ca0  3a e7 20 79 25 3c 30 20  8c 79 25 3d 30 0d 0e 60  |:. y%<0 .y%=0..`|
00002cb0  2d 6e 25 3d 64 69 73 70  25 21 34 38 3a 6d 25 3d  |-n%=disp%!48:m%=|
00002cc0  64 69 73 70 25 21 35 36  3a f4 20 53 65 74 20 6d  |disp%!56:. Set m|
00002cd0  69 6e 20 61 6e 64 20 6d  61 78 0d 0e 6a 16 e7 20  |in and max..j.. |
00002ce0  28 64 69 73 70 25 21 34  34 20 80 20 32 29 20 8c  |(disp%!44 . 2) .|
00002cf0  0d 0e 74 38 20 f4 20 57  65 27 72 65 20 64 72 61  |..t8 . We're dra|
00002d00  67 67 69 6e 67 20 74 68  65 20 65 6e 64 2c 20 61  |gging the end, a|
00002d10  72 65 20 77 65 20 62 65  66 6f 72 65 20 74 68 65  |re we before the|
00002d20  20 73 74 61 72 74 20 3f  0d 0e 7e 6b 20 e7 20 79  | start ?..~k . y|
00002d30  25 3c 64 69 73 70 25 21  34 38 20 84 20 28 79 25  |%<disp%!48 . (y%|
00002d40  3d 64 69 73 70 25 21 34  38 20 80 20 78 25 3c 64  |=disp%!48 . x%<d|
00002d50  69 73 70 25 21 35 32 29  20 8c 64 69 73 70 25 21  |isp%!52) .disp%!|
00002d60  34 34 3d 64 69 73 70 25  21 34 34 20 82 20 32 3a  |44=disp%!44 . 2:|
00002d70  64 69 73 70 25 21 35 36  3d 64 69 73 70 25 21 34  |disp%!56=disp%!4|
00002d80  38 3a 64 69 73 70 25 21  36 30 3d 64 69 73 70 25  |8:disp%!60=disp%|
00002d90  21 35 32 0d 0e 88 05 cc  0d 0e 92 37 20 f4 20 57  |!52........7 . W|
00002da0  65 27 72 65 20 64 72 61  67 67 69 6e 67 20 74 68  |e're dragging th|
00002db0  65 20 73 74 61 72 74 2c  20 61 72 65 20 77 65 20  |e start, are we |
00002dc0  61 66 74 65 72 20 74 68  65 20 65 6e 64 20 3f 0d  |after the end ?.|
00002dd0  0e 9c 6b 20 e7 20 79 25  3e 64 69 73 70 25 21 35  |..k . y%>disp%!5|
00002de0  36 20 84 20 28 79 25 3d  64 69 73 70 25 21 35 36  |6 . (y%=disp%!56|
00002df0  20 80 20 78 25 3e 64 69  73 70 25 21 36 30 29 20  | . x%>disp%!60) |
00002e00  8c 64 69 73 70 25 21 34  34 3d 64 69 73 70 25 21  |.disp%!44=disp%!|
00002e10  34 34 20 82 20 32 3a 64  69 73 70 25 21 34 38 3d  |44 . 2:disp%!48=|
00002e20  64 69 73 70 25 21 35 36  3a 64 69 73 70 25 21 35  |disp%!56:disp%!5|
00002e30  32 3d 64 69 73 70 25 21  36 30 0d 0e a6 05 cd 0d  |2=disp%!60......|
00002e40  0e b0 16 e7 20 28 64 69  73 70 25 21 34 34 20 80  |.... (disp%!44 .|
00002e50  20 32 29 20 8c 0d 0e ba  40 20 e7 20 79 25 3c 3e  | 2) ....@ . y%<>|
00002e60  64 69 73 70 25 21 35 36  20 84 20 78 25 3c 3e 64  |disp%!56 . x%<>d|
00002e70  69 73 70 25 21 36 30 20  8c 64 69 73 70 25 21 35  |isp%!60 .disp%!5|
00002e80  36 3d 79 25 3a 64 69 73  70 25 21 36 30 3d 78 25  |6=y%:disp%!60=x%|
00002e90  3a 72 25 3d b9 0d 0e c4  05 cc 0d 0e ce 40 20 e7  |:r%=.........@ .|
00002ea0  20 79 25 3c 3e 64 69 73  70 25 21 34 38 20 84 20  | y%<>disp%!48 . |
00002eb0  78 25 3c 3e 64 69 73 70  25 21 35 32 20 8c 64 69  |x%<>disp%!52 .di|
00002ec0  73 70 25 21 34 38 3d 79  25 3a 64 69 73 70 25 21  |sp%!48=y%:disp%!|
00002ed0  35 32 3d 78 25 3a 72 25  3d b9 0d 0e d8 05 cd 0d  |52=x%:r%=.......|
00002ee0  0e e2 0a e7 20 72 25 20  8c 0d 0e ec 15 20 e7 20  |.... r% ..... . |
00002ef0  64 69 73 70 25 21 34 38  3c 3e 6e 25 20 8c 0d 0e  |disp%!48<>n% ...|
00002f00  f6 15 20 20 e7 20 64 69  73 70 25 21 35 36 3d 6d  |..  . disp%!56=m|
00002f10  25 20 8c 0d 0f 00 34 20  20 20 e7 20 6e 25 3e 64  |% ....4   . n%>d|
00002f20  69 73 70 25 21 34 38 20  8c 6d 25 3d 6e 25 3a 6e  |isp%!48 .m%=n%:n|
00002f30  25 3d 64 69 73 70 25 21  34 38 20 8b 6d 25 3d 64  |%=disp%!48 .m%=d|
00002f40  69 73 70 25 21 34 38 0d  0f 0a 07 20 20 cc 0d 0f  |isp%!48....  ...|
00002f50  14 21 20 20 20 e7 20 6e  25 3e 64 69 73 70 25 21  |.!   . n%>disp%!|
00002f60  34 38 20 8c 6e 25 3d 64  69 73 70 25 21 34 38 0d  |48 .n%=disp%!48.|
00002f70  0f 1e 21 20 20 20 e7 20  6d 25 3c 64 69 73 70 25  |..!   . m%<disp%|
00002f80  21 35 36 20 8c 6d 25 3d  64 69 73 70 25 21 35 36  |!56 .m%=disp%!56|
00002f90  0d 0f 28 07 20 20 cd 0d  0f 32 06 20 cc 0d 0f 3c  |..(.  ...2. ...<|
00002fa0  15 20 20 e7 20 64 69 73  70 25 21 35 36 3d 6d 25  |.  . disp%!56=m%|
00002fb0  20 8c 0d 0f 46 12 20 20  20 6e 25 3d 79 25 3a 6d  | ...F.   n%=y%:m|
00002fc0  25 3d 79 25 0d 0f 50 07  20 20 cc 0d 0f 5a 34 20  |%=y%..P.  ...Z4 |
00002fd0  20 20 e7 20 6d 25 3c 64  69 73 70 25 21 35 36 20  |  . m%<disp%!56 |
00002fe0  8c 6e 25 3d 6d 25 3a 6d  25 3d 64 69 73 70 25 21  |.n%=m%:m%=disp%!|
00002ff0  35 36 20 8b 6e 25 3d 64  69 73 70 25 21 35 36 0d  |56 .n%=disp%!56.|
00003000  0f 64 07 20 20 cd 0d 0f  6e 06 20 cd 0d 0f 78 3d  |.d.  ...n. ...x=|
00003010  20 c8 99 20 22 57 69 6d  70 5f 46 6f 72 63 65 52  | .. "Wimp_ForceR|
00003020  65 64 72 61 77 22 2c 21  64 69 73 70 25 2c 30 2c  |edraw",!disp%,0,|
00003030  2d 6d 25 2a 33 36 2d 33  36 2d 38 2c 32 35 35 2a  |-m%*36-36-8,255*|
00003040  31 36 2c 2d 6e 25 2a 33  36 0d 0f 82 05 cd 0d 0f  |16,-n%*36.......|
00003050  8c 05 e1 0d 0f 96 05 3a  0d 0f a0 2a f4 20 50 52  |.......:...*. PR|
00003060  4f 43 64 69 73 70 6c 61  79 5f 73 65 6c 65 6e 64  |OCdisplay_selend|
00003070  20 3a 20 45 6e 64 20 61  20 73 65 6c 65 63 74 69  | : End a selecti|
00003080  6f 6e 0d 0f aa 1b dd f2  64 69 73 70 6c 61 79 5f  |on......display_|
00003090  73 65 6c 65 6e 64 28 64  69 73 70 25 29 0d 0f b4  |selend(disp%)...|
000030a0  05 e1 0d 0f be 05 3a 0d  0f c8 3d f4 20 50 52 4f  |......:...=. PRO|
000030b0  43 64 69 73 70 6c 61 79  5f 72 65 6c 78 79 20 3a  |Cdisplay_relxy :|
000030c0  20 43 6f 6e 76 65 72 74  20 78 20 61 6e 64 20 79  | Convert x and y|
000030d0  20 74 6f 20 72 65 6c 61  74 69 76 65 20 63 6f 2d  | to relative co-|
000030e0  6f 72 64 73 0d 0f d2 24  dd f2 64 69 73 70 6c 61  |ords...$..displa|
000030f0  79 5f 72 65 6c 78 79 28  64 69 73 70 25 2c f8 20  |y_relxy(disp%,. |
00003100  78 25 2c f8 20 79 25 29  0d 0f dc 2b 21 62 25 3d  |x%,. y%)...+!b%=|
00003110  21 64 69 73 70 25 3a c8  99 20 22 57 69 6d 70 5f  |!disp%:.. "Wimp_|
00003120  47 65 74 57 69 6e 64 6f  77 53 74 61 74 65 22 2c  |GetWindowState",|
00003130  2c 62 25 0d 0f e6 26 79  25 3d 79 25 2d 62 25 21  |,b%...&y%=y%-b%!|
00003140  31 36 2b 62 25 21 32 34  3a 78 25 3d 78 25 2d 62  |16+b%!24:x%=x%-b|
00003150  25 21 34 2b 62 25 21 32  30 0d 0f f0 05 e1 0d 0f  |%!4+b%!20.......|
00003160  fa 05 3a 0d 10 04 3a f4  20 46 4e 64 69 73 70 6c  |..:...:. FNdispl|
00003170  61 79 5f 6c 69 6e 65 79  20 3a 20 46 69 6e 64 20  |ay_liney : Find |
00003180  74 68 65 20 68 61 6e 64  6c 65 20 6f 66 20 74 68  |the handle of th|
00003190  65 20 6c 69 6e 65 20 66  72 6f 6d 20 79 0d 10 0e  |e line from y...|
000031a0  1d dd a4 64 69 73 70 6c  61 79 5f 6c 69 6e 65 79  |...display_liney|
000031b0  28 64 69 73 70 25 2c 79  25 29 0d 10 18 28 ea 20  |(disp%,y%)...(. |
000031c0  70 25 3a 70 25 3d 64 69  73 70 25 21 32 38 3a f4  |p%:p%=disp%!28:.|
000031d0  20 54 6f 70 20 6f 66 20  74 68 65 20 77 69 6e 64  | Top of the wind|
000031e0  6f 77 0d 10 22 30 e7 20  79 25 3e 2d 38 20 84 20  |ow.."0. y%>-8 . |
000031f0  79 25 3c 2d 33 36 2a 64  69 73 70 25 21 34 20 8c  |y%<-36*disp%!4 .|
00003200  3d 30 3a f4 20 6f 75 74  73 69 64 65 20 72 61 6e  |=0:. outside ran|
00003210  67 65 0d 10 2c 29 c8 95  20 70 25 3c 3e 30 20 80  |ge..,).. p%<>0 .|
00003220  20 79 25 3c 3d 2d 38 2d  33 36 3a 70 25 3d 70 25  | y%<=-8-36:p%=p%|
00003230  21 38 3a 79 25 2b 3d 33  36 3a ce 0d 10 36 07 3d  |!8:y%+=36:...6.=|
00003240  70 25 0d 10 40 05 3a 0d  10 4a 39 f4 20 46 4e 64  |p%..@.:..J9. FNd|
00003250  69 73 70 6c 61 79 5f 6c  69 6e 65 20 3a 20 46 69  |isplay_line : Fi|
00003260  6e 64 20 74 68 65 20 6e  75 6d 62 65 72 20 6f 66  |nd the number of|
00003270  20 74 68 65 20 6c 69 6e  65 20 66 72 6f 6d 20 79  | the line from y|
00003280  0d 10 54 1e dd a4 64 69  73 70 6c 61 79 5f 6c 69  |..T...display_li|
00003290  6e 65 6e 6f 28 64 69 73  70 25 2c 79 25 29 0d 10  |neno(disp%,y%)..|
000032a0  5e 2b ea 20 70 25 2c 6e  25 3a 70 25 3d 64 69 73  |^+. p%,n%:p%=dis|
000032b0  70 25 21 32 38 3a f4 20  54 6f 70 20 6f 66 20 74  |p%!28:. Top of t|
000032c0  68 65 20 77 69 6e 64 6f  77 0d 10 68 2c c8 95 20  |he window..h,.. |
000032d0  70 25 3c 3e 30 20 80 20  79 25 3c 3d 2d 38 3a 70  |p%<>0 . y%<=-8:p|
000032e0  25 3d 70 25 21 38 3a 79  25 2b 3d 33 36 3a 6e 25  |%=p%!8:y%+=36:n%|
000032f0  2b 3d 31 3a ce 0d 10 72  07 3d 6e 25 0d 10 7c 05  |+=1:...r.=n%..|.|
00003300  3a 0d 10 86 2e dd a4 64  69 73 70 6c 61 79 5f 6e  |:......display_n|
00003310  65 78 74 28 64 69 73 70  25 2c 70 25 29 3a e7 20  |ext(disp%,p%):. |
00003320  70 25 3d 30 20 8c 3d 64  69 73 70 25 21 32 38 0d  |p%=0 .=disp%!28.|
00003330  10 90 09 3d 70 25 21 38  0d 10 9a 2d dd a4 64 69  |...=p%!8...-..di|
00003340  73 70 6c 61 79 5f 70 72  65 76 28 64 69 73 70 25  |splay_prev(disp%|
00003350  2c 70 25 29 3a e7 20 70  25 3d 30 20 8c 3d 64 69  |,p%):. p%=0 .=di|
00003360  73 70 25 21 38 0d 10 a4  08 3d 21 70 25 0d 10 ae  |sp%!8....=!p%...|
00003370  05 3a 0d 10 b8 3e f4 20  46 4e 64 69 73 70 6c 61  |.:...>. FNdispla|
00003380  79 5f 6c 69 6e 65 66 72  6f 6d 20 3a 20 72 65 74  |y_linefrom : ret|
00003390  75 72 6e 20 6c 69 6e 65  20 66 72 6f 6d 20 61 20  |urn line from a |
000033a0  70 61 72 74 69 63 75 6c  61 72 20 70 6f 69 6e 74  |particular point|
000033b0  0d 10 c2 25 dd a4 64 69  73 70 6c 61 79 5f 6c 69  |...%..display_li|
000033c0  6e 65 66 72 6f 6d 28 64  69 73 70 25 2c 70 25 2c  |nefrom(disp%,p%,|
000033d0  f8 20 78 25 29 0d 10 cc  10 ea 20 63 25 3a 63 25  |. x%)..... c%:c%|
000033e0  3d 78 25 2d 34 0d 10 d6  30 70 25 3d 70 25 21 34  |=x%-4...0p%=p%!4|
000033f0  3a f4 20 50 6f 69 6e 74  65 72 20 74 6f 20 74 68  |:. Pointer to th|
00003400  65 20 66 69 72 73 74 20  70 69 65 63 65 20 6f 66  |e first piece of|
00003410  20 74 65 78 74 0d 10 e0  2c e7 20 70 25 3c 3e 30  | text...,. p%<>0|
00003420  20 8c 78 25 3d 70 25 21  31 32 3a f4 20 54 68 65  | .x%=p%!12:. The|
00003430  20 65 6e 64 20 6f 66 20  74 68 69 73 20 74 65 78  | end of this tex|
00003440  74 0d 10 ea 1c c8 95 20  70 25 3c 3e 30 20 80 20  |t...... p%<>0 . |
00003450  78 25 3c 3d 63 25 3a 70  25 3d 21 70 25 0d 10 f4  |x%<=c%:p%=!p%...|
00003460  35 20 e7 20 70 25 3c 3e  30 20 8c 78 25 2b 3d 70  |5 . p%<>0 .x%+=p|
00003470  25 21 31 32 3a f4 20 61  64 64 20 74 68 65 20 6c  |%!12:. add the l|
00003480  65 6e 67 74 68 20 6f 66  20 74 68 69 73 20 6c 69  |ength of this li|
00003490  6e 65 0d 10 fe 1a ce 3a  f4 20 46 69 6e 64 20 74  |ne.....:. Find t|
000034a0  68 65 20 72 69 67 68 74  20 6f 6e 65 0d 11 08 15  |he right one....|
000034b0  78 25 2b 3d 34 3a e7 20  70 25 3d 30 20 8c 3d 22  |x%+=4:. p%=0 .="|
000034c0  22 0d 11 12 22 3d c1 24  28 70 25 2b 31 36 29 2c  |"..."=.$(p%+16),|
000034d0  28 63 25 2d 78 25 2b 70  25 21 31 32 29 2f 31 36  |(c%-x%+p%!12)/16|
000034e0  2b 31 29 0d 11 1c 05 3a  0d 11 26 40 f4 20 46 4e  |+1)....:..&@. FN|
000034f0  64 69 73 70 6c 61 79 5f  6c 69 6e 65 77 6f 72 64  |display_lineword|
00003500  20 3a 20 52 65 74 75 72  6e 20 74 68 65 20 77 6f  | : Return the wo|
00003510  72 64 20 61 74 20 61 20  70 61 72 74 69 63 75 6c  |rd at a particul|
00003520  61 72 20 70 6f 69 6e 74  0d 11 30 23 dd a4 64 69  |ar point..0#..di|
00003530  73 70 6c 61 79 5f 77 6f  72 64 61 74 28 64 69 73  |splay_wordat(dis|
00003540  70 25 2c 70 25 2c f8 20  78 25 29 0d 11 3a 13 ea  |p%,p%,. x%)..:..|
00003550  20 63 25 2c 61 24 3a 63  25 3d 78 25 2d 34 0d 11  | c%,a$:c%=x%-4..|
00003560  44 30 70 25 3d 70 25 21  34 3a f4 20 50 6f 69 6e  |D0p%=p%!4:. Poin|
00003570  74 65 72 20 74 6f 20 74  68 65 20 66 69 72 73 74  |ter to the first|
00003580  20 70 69 65 63 65 20 6f  66 20 74 65 78 74 0d 11  | piece of text..|
00003590  4e 2c e7 20 70 25 3c 3e  30 20 8c 78 25 3d 70 25  |N,. p%<>0 .x%=p%|
000035a0  21 31 32 3a f4 20 54 68  65 20 65 6e 64 20 6f 66  |!12:. The end of|
000035b0  20 74 68 69 73 20 74 65  78 74 0d 11 58 1c c8 95  | this text..X...|
000035c0  20 70 25 3c 3e 30 20 80  20 78 25 3c 3d 63 25 3a  | p%<>0 . x%<=c%:|
000035d0  70 25 3d 21 70 25 0d 11  62 35 20 e7 20 70 25 3c  |p%=!p%..b5 . p%<|
000035e0  3e 30 20 8c 78 25 2b 3d  70 25 21 31 32 3a f4 20  |>0 .x%+=p%!12:. |
000035f0  61 64 64 20 74 68 65 20  6c 65 6e 67 74 68 20 6f  |add the length o|
00003600  66 20 74 68 69 73 20 6c  69 6e 65 0d 11 6c 1a ce  |f this line..l..|
00003610  3a f4 20 46 69 6e 64 20  74 68 65 20 72 69 67 68  |:. Find the righ|
00003620  74 20 6f 6e 65 0d 11 76  15 78 25 2b 3d 34 3a e7  |t one..v.x%+=4:.|
00003630  20 70 25 3d 30 20 8c 3d  22 22 0d 11 80 25 63 25  | p%=0 .=""...%c%|
00003640  3d 28 63 25 2d 78 25 2b  70 25 21 31 32 29 2f 31  |=(c%-x%+p%!12)/1|
00003650  36 2b 31 3a 61 24 3d 24  28 70 25 2b 31 36 29 0d  |6+1:a$=$(p%+16).|
00003660  11 8a 26 c8 95 20 63 25  3e 30 20 80 20 c1 61 24  |..&.. c%>0 . .a$|
00003670  2c 63 25 2c 31 29 3c 3e  22 20 22 3a 63 25 3d 63  |,c%,1)<>" ":c%=c|
00003680  25 2d 31 3a ce 0d 11 94  29 63 25 2b 3d 31 3a 61  |%-1:....)c%+=1:a|
00003690  24 3d c1 61 24 2c 63 25  29 3a 3d c0 61 24 2c a7  |$=.a$,c%):=.a$,.|
000036a0  61 24 2b 22 20 22 2c 22  20 22 29 2d 31 29 0d 11  |a$+" "," ")-1)..|
000036b0  9e 05 3a 0d 11 a8 3a f4  20 46 4e 64 69 73 70 6c  |..:...:. FNdispl|
000036c0  61 79 5f 6c 69 6e 65 74  6f 20 3a 20 72 65 74 75  |ay_lineto : retu|
000036d0  72 6e 20 6c 69 6e 65 20  74 6f 20 61 20 70 61 72  |rn line to a par|
000036e0  74 69 63 75 6c 61 72 20  70 6f 69 6e 74 0d 11 b2  |ticular point...|
000036f0  23 dd a4 64 69 73 70 6c  61 79 5f 6c 69 6e 65 74  |#..display_linet|
00003700  6f 28 64 69 73 70 25 2c  70 25 2c f8 20 78 25 29  |o(disp%,p%,. x%)|
00003710  0d 11 bc 21 85 20 39 39  39 2c 22 54 68 69 73 20  |...!. 999,"This |
00003720  64 6f 65 73 6e 27 74 20  77 6f 72 6b 20 79 65 74  |doesn't work yet|
00003730  22 0d 11 c6 10 ea 20 63  25 3a 63 25 3d 78 25 2d  |"..... c%:c%=x%-|
00003740  34 0d 11 d0 30 70 25 3d  70 25 21 34 3a f4 20 50  |4...0p%=p%!4:. P|
00003750  6f 69 6e 74 65 72 20 74  6f 20 74 68 65 20 66 69  |ointer to the fi|
00003760  72 73 74 20 70 69 65 63  65 20 6f 66 20 74 65 78  |rst piece of tex|
00003770  74 0d 11 da 2c e7 20 70  25 3c 3e 30 20 8c 78 25  |t...,. p%<>0 .x%|
00003780  3d 70 25 21 31 32 3a f4  20 54 68 65 20 65 6e 64  |=p%!12:. The end|
00003790  20 6f 66 20 74 68 69 73  20 74 65 78 74 0d 11 e4  | of this text...|
000037a0  1c c8 95 20 70 25 3c 3e  30 20 80 20 78 25 3c 3d  |... p%<>0 . x%<=|
000037b0  63 25 3a 70 25 3d 21 70  25 0d 11 ee 35 20 e7 20  |c%:p%=!p%...5 . |
000037c0  70 25 3c 3e 30 20 8c 78  25 2b 3d 70 25 21 31 32  |p%<>0 .x%+=p%!12|
000037d0  3a f4 20 61 64 64 20 74  68 65 20 6c 65 6e 67 74  |:. add the lengt|
000037e0  68 20 6f 66 20 74 68 69  73 20 6c 69 6e 65 0d 11  |h of this line..|
000037f0  f8 1a ce 3a f4 20 46 69  6e 64 20 74 68 65 20 72  |...:. Find the r|
00003800  69 67 68 74 20 6f 6e 65  0d 12 02 15 78 25 2b 3d  |ight one....x%+=|
00003810  34 3a e7 20 70 25 3d 30  20 8c 3d 22 22 0d 12 0c  |4:. p%=0 .=""...|
00003820  22 3d c1 24 28 70 25 2b  31 36 29 2c 28 63 25 2d  |"=.$(p%+16),(c%-|
00003830  78 25 2b 70 25 21 31 32  29 2f 31 36 2b 31 29 0d  |x%+p%!12)/16+1).|
00003840  12 16 05 3a 0d 12 20 32  dd a4 64 69 73 70 6c 61  |...:.. 2..displa|
00003850  79 5f 6c 69 6e 65 66 72  6f 6d 73 28 64 69 73 70  |y_linefroms(disp|
00003860  25 2c 70 25 2c f8 20 78  25 2c f8 20 62 67 25 2c  |%,p%,. x%,. bg%,|
00003870  f8 20 66 67 25 29 0d 12  2a 10 ea 20 63 25 3a 63  |. fg%)..*.. c%:c|
00003880  25 3d 78 25 2d 34 0d 12  34 30 70 25 3d 70 25 21  |%=x%-4..40p%=p%!|
00003890  34 3a f4 20 50 6f 69 6e  74 65 72 20 74 6f 20 74  |4:. Pointer to t|
000038a0  68 65 20 66 69 72 73 74  20 70 69 65 63 65 20 6f  |he first piece o|
000038b0  66 20 74 65 78 74 0d 12  3e 2c e7 20 70 25 3c 3e  |f text..>,. p%<>|
000038c0  30 20 8c 78 25 3d 70 25  21 31 32 3a f4 20 54 68  |0 .x%=p%!12:. Th|
000038d0  65 20 65 6e 64 20 6f 66  20 74 68 69 73 20 74 65  |e end of this te|
000038e0  78 74 0d 12 48 1c c8 95  20 70 25 3c 3e 30 20 80  |xt..H... p%<>0 .|
000038f0  20 78 25 3c 3d 63 25 3a  70 25 3d 21 70 25 0d 12  | x%<=c%:p%=!p%..|
00003900  52 35 20 e7 20 70 25 3c  3e 30 20 8c 78 25 2b 3d  |R5 . p%<>0 .x%+=|
00003910  70 25 21 31 32 3a f4 20  61 64 64 20 74 68 65 20  |p%!12:. add the |
00003920  6c 65 6e 67 74 68 20 6f  66 20 74 68 69 73 20 6c  |length of this l|
00003930  69 6e 65 0d 12 5c 1a ce  3a f4 20 46 69 6e 64 20  |ine..\..:. Find |
00003940  74 68 65 20 72 69 67 68  74 20 6f 6e 65 0d 12 66  |the right one..f|
00003950  15 78 25 2b 3d 34 3a e7  20 70 25 3d 30 20 8c 3d  |.x%+=4:. p%=0 .=|
00003960  22 22 0d 12 70 2f 62 67  25 3d 70 25 21 34 3a 66  |""..p/bg%=p%!4:f|
00003970  67 25 3d 70 25 21 38 3a  f4 20 54 68 65 20 63 6f  |g%=p%!8:. The co|
00003980  6c 6f 75 72 20 6f 66 20  74 68 69 73 20 70 61 72  |lour of this par|
00003990  74 0d 12 7a 0d 3d 24 28  70 25 2b 31 36 29 0d 12  |t..z.=$(p%+16)..|
000039a0  84 05 3a 0d 12 8e 34 f4  20 50 52 4f 43 64 69 73  |..:...4. PROCdis|
000039b0  70 6c 61 79 5f 63 6f 6c  6f 75 72 20 3a 20 53 65  |play_colour : Se|
000039c0  6c 65 63 74 20 74 68 65  20 63 6f 6c 6f 75 72 20  |lect the colour |
000039d0  77 65 20 77 61 6e 74 0d  12 98 18 dd f2 64 69 73  |we want......dis|
000039e0  70 6c 61 79 5f 63 6f 6c  6f 75 72 28 63 25 29 0d  |play_colour(c%).|
000039f0  12 a2 51 e7 20 28 63 25  80 26 46 46 29 3c 3e 26  |..Q. (c%.&FF)<>&|
00003a00  31 30 20 8c c8 99 20 22  57 69 6d 70 5f 53 65 74  |10 ... "Wimp_Set|
00003a10  43 6f 6c 6f 75 72 22 2c  63 25 20 8b c8 99 20 22  |Colour",c% ... "|
00003a20  43 6f 6c 6f 75 72 54 72  61 6e 73 5f 53 65 74 47  |ColourTrans_SetG|
00003a30  43 4f 4c 22 2c 63 25 2c  2c 2c 26 31 30 30 2c 30  |COL",c%,,,&100,0|
00003a40  0d 12 ac 05 e1 0d 12 b6  05 3a 0d 12 c0 37 f4 20  |.........:...7. |
00003a50  50 52 4f 43 64 69 73 70  6c 61 79 5f 6f 70 65 6e  |PROCdisplay_open|
00003a60  20 3a 20 4f 70 65 6e 20  74 68 65 20 64 69 73 70  | : Open the disp|
00003a70  6c 61 79 20 6f 6e 20 74  68 65 20 73 63 72 65 65  |lay on the scree|
00003a80  6e 0d 12 ca 19 dd f2 64  69 73 70 6c 61 79 5f 6f  |n......display_o|
00003a90  70 65 6e 28 64 69 73 70  25 29 0d 12 d4 28 e7 20  |pen(disp%)...(. |
00003aa0  21 64 69 73 70 25 3d 2d  31 20 8c f2 64 69 73 70  |!disp%=-1 ..disp|
00003ab0  6c 61 79 5f 6d 61 6b 65  77 69 6e 28 64 69 73 70  |lay_makewin(disp|
00003ac0  25 29 0d 12 de 14 f2 6f  70 65 6e 77 69 6e 28 21  |%).....openwin(!|
00003ad0  64 69 73 70 25 29 0d 12  e8 05 e1 0d 12 f2 05 3a  |disp%).........:|
00003ae0  0d 12 fc 39 f4 20 50 52  4f 43 64 69 73 70 6c 61  |...9. PROCdispla|
00003af0  79 5f 63 6c 6f 73 65 20  3a 20 43 6c 6f 73 65 20  |y_close : Close |
00003b00  74 68 65 20 64 69 73 70  6c 61 79 20 6f 6e 20 74  |the display on t|
00003b10  68 65 20 73 63 72 65 65  6e 0d 13 06 1a dd f2 64  |he screen......d|
00003b20  69 73 70 6c 61 79 5f 63  6c 6f 73 65 28 64 69 73  |isplay_close(dis|
00003b30  70 25 29 0d 13 10 12 e7  20 21 64 69 73 70 25 3c  |p%)..... !disp%<|
00003b40  3e 2d 31 20 8c 0d 13 1a  2a 20 21 62 25 3d 21 64  |>-1 ....* !b%=!d|
00003b50  69 73 70 25 3a c8 99 20  22 57 69 6d 70 5f 44 65  |isp%:.. "Wimp_De|
00003b60  6c 65 74 65 57 69 6e 64  6f 77 22 2c 2c 62 25 0d  |leteWindow",,b%.|
00003b70  13 24 0e 20 21 64 69 73  70 25 3d 2d 31 0d 13 2e  |.$. !disp%=-1...|
00003b80  05 cd 0d 13 38 05 e1 0d  13 42 05 3a 0d 13 4c 3a  |....8....B.:..L:|
00003b90  f4 20 50 52 4f 43 64 69  73 70 6c 61 79 5f 6d 61  |. PROCdisplay_ma|
00003ba0  6b 65 77 69 6e 20 3a 20  42 75 69 6c 64 20 61 20  |kewin : Build a |
00003bb0  77 69 6e 64 6f 77 20 66  6f 72 20 74 68 65 20 64  |window for the d|
00003bc0  69 73 70 6c 61 79 0d 13  56 1c dd f2 64 69 73 70  |isplay..V...disp|
00003bd0  6c 61 79 5f 6d 61 6b 65  77 69 6e 28 64 69 73 70  |lay_makewin(disp|
00003be0  25 29 0d 13 60 0b ea 20  65 25 2c 79 25 0d 13 6a  |%)..`.. e%,y%..j|
00003bf0  16 e7 20 64 69 73 70 5f  79 6c 6f 63 25 3c 32 35  |.. disp_yloc%<25|
00003c00  36 20 8c 0d 13 74 3c 20  f4 20 57 65 20 6e 65 65  |6 ...t< . We nee|
00003c10  64 20 74 6f 20 72 65 2d  6c 6f 63 61 74 65 20 74  |d to re-locate t|
00003c20  68 65 20 77 69 6e 64 6f  77 73 2c 20 67 65 74 20  |he windows, get |
00003c30  74 68 65 20 73 63 72 65  65 6e 20 73 69 7a 65 0d  |the screen size.|
00003c40  13 7e 29 20 c8 99 20 22  4f 53 5f 52 65 61 64 4d  |.~) .. "OS_ReadM|
00003c50  6f 64 65 56 61 72 69 61  62 6c 65 22 2c 2d 31 2c  |odeVariable",-1,|
00003c60  35 20 b8 20 2c 2c 65 25  0d 13 88 3a 20 c8 99 20  |5 . ,,e%...: .. |
00003c70  22 4f 53 5f 52 65 61 64  4d 6f 64 65 56 61 72 69  |"OS_ReadModeVari|
00003c80  61 62 6c 65 22 2c 2d 31  2c 31 32 20 b8 20 2c 2c  |able",-1,12 . ,,|
00003c90  79 25 3a 79 25 3d 28 28  79 25 2b 31 29 3c 3c 65  |y%:y%=((y%+1)<<e|
00003ca0  25 29 0d 13 92 1e 20 64  69 73 70 5f 79 6c 6f 63  |%).... disp_yloc|
00003cb0  25 3d 28 79 25 2a 33 2f  34 29 20 80 20 ac 20 33  |%=(y%*3/4) . . 3|
00003cc0  0d 13 9c 05 cd 0d 13 a6  2d 62 25 21 30 3d 36 34  |........-b%!0=64|
00003cd0  3a 62 25 21 34 3d 64 69  73 70 5f 79 6c 6f 63 25  |:b%!4=disp_yloc%|
00003ce0  2d 32 35 36 3a f4 20 62  6f 74 74 6f 6d 20 6c 65  |-256:. bottom le|
00003cf0  66 74 0d 13 b0 29 62 25  21 38 3d 32 35 36 3a 62  |ft...)b%!8=256:b|
00003d00  25 21 31 32 3d 64 69 73  70 5f 79 6c 6f 63 25 3a  |%!12=disp_yloc%:|
00003d10  f4 20 74 6f 70 20 72 69  67 68 74 0d 13 ba 33 64  |. top right...3d|
00003d20  69 73 70 5f 79 6c 6f 63  25 2d 3d 34 34 3a e7 20  |isp_yloc%-=44:. |
00003d30  64 69 73 70 5f 79 6c 6f  63 25 3c 33 32 30 20 8c  |disp_yloc%<320 .|
00003d40  64 69 73 70 5f 79 6c 6f  63 25 3d 36 30 30 0d 13  |disp_yloc%=600..|
00003d50  c4 24 62 25 21 31 36 3d  30 3a 62 25 21 32 30 3d  |.$b%!16=0:b%!20=|
00003d60  30 3a f4 20 53 63 72 6f  6c 6c 20 6f 66 66 73 65  |0:. Scroll offse|
00003d70  74 73 0d 13 ce 1a 62 25  21 32 34 3d 2d 31 3a f4  |ts....b%!24=-1:.|
00003d80  20 4f 70 65 6e 20 6f 6e  20 74 6f 70 0d 13 d8 34  | Open on top...4|
00003d90  62 25 21 32 38 3d 26 46  46 30 30 30 30 30 32 3a  |b%!28=&FF000002:|
00003da0  f4 20 46 6c 61 67 73 20  28 61 6c 6c 20 74 68 65  |. Flags (all the|
00003db0  20 73 74 61 6e 64 61 72  64 20 73 74 75 66 66 29  | standard stuff)|
00003dc0  0d 13 e2 29 62 25 21 33  32 3d 26 30 31 30 37 30  |...)b%!32=&01070|
00003dd0  32 30 37 3a f4 20 54 68  65 20 63 6f 6c 6f 75 72  |207:. The colour|
00003de0  73 20 77 65 20 77 61 6e  74 0d 13 ec 2e 62 25 21  |s we want....b%!|
00003df0  33 36 3d 26 30 30 30 43  30 31 30 33 3a f4 20 53  |36=&000C0103:. S|
00003e00  63 72 6f 6c 6c 20 63 6f  6c 6f 75 72 73 20 61 6e  |croll colours an|
00003e10  64 20 73 74 75 66 66 0d  13 f6 29 62 25 21 34 30  |d stuff...)b%!40|
00003e20  3d 30 3a 62 25 21 34 34  3d 30 3a f4 20 42 6f 74  |=0:b%!44=0:. Bot|
00003e30  74 6f 6d 20 6c 65 66 74  20 6f 66 20 61 72 65 61  |tom left of area|
00003e40  0d 14 00 27 62 25 21 34  38 3d 30 3a 62 25 21 35  |...'b%!48=0:b%!5|
00003e50  32 3d 30 3a f4 20 54 6f  70 20 72 69 67 68 74 20  |2=0:. Top right |
00003e60  6f 66 20 61 72 65 61 0d  14 0a 3d 62 25 21 35 36  |of area...=b%!56|
00003e70  3d 26 31 33 44 3a 62 25  21 36 30 3d 26 41 30 30  |=&13D:b%!60=&A00|
00003e80  30 3a f4 20 54 69 74 6c  65 20 62 61 72 20 66 6c  |0:. Title bar fl|
00003e90  61 67 73 20 61 6e 64 20  62 75 74 74 6f 6e 20 66  |ags and button f|
00003ea0  6c 61 67 73 0d 14 14 44  62 25 21 36 34 3d 31 3a  |lags...Db%!64=1:|
00003eb0  62 25 21 36 38 3d 64 69  73 70 25 21 33 36 2a 33  |b%!68=disp%!36*3|
00003ec0  36 3a f4 20 4d 69 6e 69  6d 75 6d 20 73 69 7a 65  |6:. Minimum size|
00003ed0  20 69 73 20 61 73 20 73  6d 61 6c 6c 20 61 73 20  | is as small as |
00003ee0  70 6f 73 73 69 62 6c 65  0d 14 1e 37 62 25 21 37  |possible...7b%!7|
00003ef0  32 3d 64 69 73 70 25 21  31 32 3a 62 25 21 37 36  |2=disp%!12:b%!76|
00003f00  3d 30 3a 62 25 21 38 30  3d a9 28 24 28 64 69 73  |=0:b%!80=.($(dis|
00003f10  70 25 21 31 32 29 29 3a  f4 20 54 69 74 6c 65 0d  |p%!12)):. Title.|
00003f20  14 28 1e 62 25 21 38 34  3d 30 3a f4 20 4e 6f 20  |.(.b%!84=0:. No |
00003f30  69 6e 69 74 69 61 6c 20  69 63 6f 6e 73 0d 14 32  |initial icons..2|
00003f40  27 c8 99 20 22 57 69 6d  70 5f 43 72 65 61 74 65  |'.. "Wimp_Create|
00003f50  57 69 6e 64 6f 77 22 2c  2c 62 25 20 b8 20 21 64  |Window",,b% . !d|
00003f60  69 73 70 25 0d 14 3c 1a  f2 64 69 73 70 6c 61 79  |isp%..<..display|
00003f70  5f 72 65 73 69 7a 65 28  64 69 73 70 25 29 0d 14  |_resize(disp%)..|
00003f80  46 05 e1 0d 14 50 05 3a  0d 14 5a 24 f4 20 46 4e  |F....P.:..Z$. FN|
00003f90  64 69 73 70 6c 61 79 5f  66 69 6e 64 20 3a 20 46  |display_find : F|
00003fa0  69 6e 64 20 61 20 77 69  6e 64 6f 77 0d 14 64 18  |ind a window..d.|
00003fb0  dd a4 64 69 73 70 6c 61  79 5f 66 69 6e 64 28 77  |..display_find(w|
00003fc0  69 6e 25 29 0d 14 6e 16  ea 20 70 25 3a 70 25 3d  |in%)..n.. p%:p%=|
00003fd0  64 69 73 70 5f 6c 69 73  74 25 0d 14 78 0c c8 95  |disp_list%..x...|
00003fe0  20 70 25 3c 3e 30 0d 14  82 17 20 e7 20 70 25 21  | p%<>0.... . p%!|
00003ff0  34 3d 77 69 6e 25 20 8c  3d 70 25 2b 34 0d 14 8c  |4=win% .=p%+4...|
00004000  0b 20 70 25 3d 21 70 25  0d 14 96 05 ce 0d 14 a0  |. p%=!p%........|
00004010  06 3d 30 0d 14 aa 05 3a  0d 14 b4 2f f4 20 50 52  |.=0....:.../. PR|
00004020  4f 43 64 69 73 70 6c 61  79 5f 74 69 74 6c 65 20  |OCdisplay_title |
00004030  3a 20 53 65 74 20 74 68  65 20 64 69 73 70 6c 61  |: Set the displa|
00004040  79 20 74 69 74 6c 65 0d  14 be 21 dd f2 64 69 73  |y title...!..dis|
00004050  70 6c 61 79 5f 74 69 74  6c 65 28 64 69 73 70 25  |play_title(disp%|
00004060  2c 74 69 74 6c 65 24 29  0d 14 c8 2d f2 72 65 6c  |,title$)...-.rel|
00004070  65 61 73 65 28 64 69 73  70 25 21 31 32 29 3a f4  |ease(disp%!12):.|
00004080  20 47 65 74 20 72 69 64  20 6f 66 20 6f 6c 64 20  | Get rid of old |
00004090  74 69 74 6c 65 0d 14 d2  26 64 69 73 70 25 21 31  |title...&disp%!1|
000040a0  32 3d a4 73 74 72 64 75  70 28 a4 6d 73 67 74 65  |2=.strdup(.msgte|
000040b0  78 74 28 74 69 74 6c 65  24 29 29 0d 14 dc 12 e7  |xt(title$)).....|
000040c0  20 21 64 69 73 70 25 3c  3e 2d 31 20 8c 0d 14 e6  | !disp%<>-1 ....|
000040d0  3a 20 21 62 25 3d 21 64  69 73 70 25 3a c8 99 20  |: !b%=!disp%:.. |
000040e0  22 57 69 6d 70 5f 47 65  74 57 69 6e 64 6f 77 49  |"Wimp_GetWindowI|
000040f0  6e 66 6f 22 2c 2c 62 25  3a 62 25 21 37 36 3d 64  |nfo",,b%:b%!76=d|
00004100  69 73 70 25 21 31 32 0d  14 f0 34 20 e7 20 28 62  |isp%!12...4 . (b|
00004110  25 21 33 32 20 80 20 28  31 3c 3c 31 36 29 29 3e  |%!32 . (1<<16))>|
00004120  30 20 8c c8 99 20 22 57  69 6d 70 5f 4f 70 65 6e  |0 ... "Wimp_Open|
00004130  57 69 6e 64 6f 77 22 2c  2c 62 25 0d 14 fa 2c 20  |Window",,b%..., |
00004140  21 62 25 3d 21 64 69 73  70 25 3a c8 99 20 22 57  |!b%=!disp%:.. "W|
00004150  69 6d 70 5f 47 65 74 57  69 6e 64 6f 77 53 74 61  |imp_GetWindowSta|
00004160  74 65 22 2c 2c 62 25 0d  15 04 33 20 62 25 21 33  |te",,b%...3 b%!3|
00004170  32 3d 21 64 69 73 70 25  3a c8 99 20 22 57 69 6d  |2=!disp%:.. "Wim|
00004180  70 5f 47 65 74 57 69 6e  64 6f 77 4f 75 74 6c 69  |p_GetWindowOutli|
00004190  6e 65 22 2c 2c 62 25 2b  33 32 0d 15 0e 35 20 c8  |ne",,b%+32...5 .|
000041a0  99 20 22 57 69 6d 70 5f  46 6f 72 63 65 52 65 64  |. "Wimp_ForceRed|
000041b0  72 61 77 22 2c 2d 31 2c  62 25 21 33 36 2c 62 25  |raw",-1,b%!36,b%|
000041c0  21 31 36 2c 62 25 21 34  34 2c 62 25 21 34 38 0d  |!16,b%!44,b%!48.|
000041d0  15 18 05 cd 0d 15 22 05  e1 0d ff                 |......"....|
000041db