home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 151 / 151.d81 / vls.main (.txt) < prev    next >
Encoding:
Commodore BASIC  |  1997-01-01  |  17.7 KB  |  685 lines

  1. 10 rem vls hypertext beta 2.4
  2. 11 rem
  3. 12 rem design/program : t.parker
  4. 13 rem (c) 1996 sirius cybernetics
  5. 14 rem          corporation
  6. 40 rem
  7. 42 rem life, the universe,                     and everything
  8. 43 rem
  9. 49 rem code starts here
  10. 50 clr:poke56,96:poke788,52:clr
  11. 53 gosub900
  12. 55 rem file default (null,$,fname)
  13. 56 f$=""
  14. 57 rem idriver default (1=mouse 0=joy)
  15. 58 z=1
  16. 63 rem load/init modules
  17. 65 sys57812"toolbox c000",dv,1:poke780,0:sys65493
  18. 67 systb+30,"vmx.ml",dv,24576
  19. 68 systb+30,"vls.charset",dv,2048:cb=18:sys57812"pointer.spr",dv,1:poke780,0
  20. 69 sys65493:goto71
  21. 70 poke788,52:gosub900:z=1:cb=18:rem debug restart
  22. 71 rem initialize objects
  23. 72 gosub800:gosub3020:gosub3600:gosub3700
  24. 73 gosub5000:gosub8300:gosub5500:gosub1000
  25. 74 c=7:gosub1300:gosub850
  26. 75 iff$=""then79
  27. 76 iff$="$"thensystb+18,s1:goto210
  28. 77 systb+18,s1:pn=0:xf$=f$:goto700
  29. 79 gosub850:goto100
  30. 80 rem full redraw
  31. 81 ifnottvthengv=0:gf=0:rf=0:gq=0
  32. 82 gosub5500:c=7:gosub1300:gosub3000:gosub3600:poke199,0
  33. 90 rem quick redraw
  34. 92 gosub5500:iftvthengosub3100
  35. 94 gosub3700
  36. 100 rem main loop
  37. 101 poke198,0:gosub5600:gosub5100:c=7:ifnottvandlt$(0)<>""then4000
  38. 102 ifnotbdthen600
  39. 103 ify<>0then 490
  40. 104 systb+18,s1:gosub1400:ifsm=0then110
  41. 105 gosub5100:gosub1500:ifmi=0then110
  42. 106 onsmgoto200,300,400
  43. 110 systb+21,s1:gosub3060:goto100
  44. 200 rem file menu
  45. 202 onmigoto210,205,220,9500,205,240,250,260,205,270
  46. 205 goto110
  47. 210 rem load
  48. 211 gosub 6000:gosub6100:iff$=""then110
  49. 213 pn=0:xf$=f$:goto700
  50. 220 ifnotrfthenol=ln-ws:rem save text
  51. 221 ifnottvthen110
  52. 222 p$=" File:":l=16:gosub1900:ifw$=""then230
  53. 223 open3,dv,3,w$+",p,w":ln=sl:gosub2200:gosub226:gosub5400:ifval(e$)=0then225
  54. 224 close3:m0$="Error saving text":gosub6800:ifmi=1then223
  55. 225 goto230
  56. 226 m0$="Saving":m1$=w$:l=0:bc=4:gosub1800
  57. 227 gosub5300
  58. 228 ifln>elthenprint#3,chr$(0):close3:systb+42,"",dv:systb+21,s2:return
  59. 229 sysgl:ln=ln+1:sys27264:goto228
  60. 230 ifnotrfthenln=ol:goto80
  61. 231 ifrfthen110
  62. 240 rem dos command
  63. 242 p$=str$(dv)+">":l=35:gosub1900:gosub5300:systb+42,w$,dv:gosub5400
  64. 243 m0$="Disk status":m1$=e$:l=1:i$(1)="OK":bc=13:c=3:gosub1800:goto110
  65. 250 rem change dv
  66. 251 gosub5500:l=0:fori=8to29:open2,i,2:close2:ifst=>0thenl=l+1:i$(l)=str$(i)
  67. 252 next:gosub5600:xp=12:yp=0:gosub1600:gosub5100:gosub1700
  68. 254 ifmi=0then110
  69. 255 dv=val(i$(mi))
  70. 256 goto110
  71. 260 i$(1)="Joystick":i$(2)="Mouse":l=2:xp=10:yp=8:gosub1600:gosub5100:gosub1700
  72. 262 ifmi=0then110
  73. 264 z=mi-1:gosub5000:goto256
  74. 270 dv=-dv:w$="hello connect":m0$="Exit"::systb+21,s1:goto581
  75. 300 rem link menu
  76. 301 ifgf or nottvthen110
  77. 303 ifmi<10then350
  78. 310 rem new path
  79. 311 gosub5500:x$=lt$(0):y$=lf$(0):q=lp%(0)
  80. 315 gosub4000:lt$(0)=x$:lf$(0)=y$:lp%(0)=q:ifpn>0thengosub4100
  81. 317 gosub4200
  82. 320 goto110
  83. 350 rem interp menu
  84. 353 xf$=lf$(mi-1):ifxf$=""then110
  85. 355 ifxf$=lf$thenxf$=""
  86. 357 pn=lp%(mi-1):hp=-1:li=mi-1:rf=0:goto700
  87. 400 rem option menu
  88. 402 onmigoto410,430,460,405,480
  89. 405 goto110
  90. 410 rem prefs
  91. 413 ifrfthen110
  92. 415 gosub8000:gosub2800:ln=ln-ws:goto80
  93. 430 bc=7:c=8:rem search
  94. 431 if(nottv)orrfthen110
  95. 432 ifsf>-1then455
  96. 435 p$=" Find:":l=32:gosub1900:ifw$=""then110
  97. 436 sf=sl:gosub452
  98. 437 fori=1tolen(w$):poke26495+i,asc(mid$(w$,i,1)):next:poke26592,len(w$)-1
  99. 440 ol=ln-ws:ln=sf:gosub2200
  100. 442 ln=ln+1:sysgl:sys26720:ifpeek(26593)=128then450
  101. 444 ifln<=elthen442
  102. 446 systb+21,s2:m1$="String not found":i$(1)="OK":l=1:gosub1800:sf=0
  103. 448 sf=-1:ln=ol:goto80
  104. 450 sf=ln-1:ln=ol:ifsf<tlorsf>blthenln=sf-int(ws/2)
  105. 451 goto80
  106. 452 m0$="Searching":m1$="Please Wait":l=0:gosub1800:gosub5500:return
  107. 455 m0$="Search document":m1$="Same search again?":i$(1)="Yes":i$(2)="No"
  108. 456 l=2:gosub1800
  109. 457 ifmi=1thensf=sf+1:goto440
  110. 458 sf=-1:goto435
  111. 460 rem bookmark
  112. 461 ifnottvthen110
  113. 462 xp=20:yp=6:c=7:i$(1)="Mark position":i$(2)="Go to mark":l=2
  114. 463 gosub1600:gosub5100:gosub1700:ifmi=0then110
  115. 464 ifmi=1andrf=0thengosub9000:goto110
  116. 465 ifmi=2thengoto9100
  117. 467 goto110
  118. 480 rem help
  119. 481 gosub5300:poke198,0:systb+51,"vls.help",dv
  120. 482 gosub5400:goto110
  121. 489 rem click handle
  122. 490 u=-1:ifnottvthen100
  123. 500 ifrfthen540
  124. 501 ifx=0andy=23thengosub3200:gosub590:ifa=0thenu=0:goto501
  125. 502 ifx=0andy=3thengosub3300:gosub590:ifa=0thenu=0:goto502
  126. 503 ln=bl:ifu=0thengosub3700
  127. 504 ifx=38andy=23thengosub3400:gosub590:ifa=0then504
  128. 506 ifx=38andy=3thengosub3500:gosub590:ifa=0then506
  129. 508 ifx=39andy>2andy<24andnotdbthengosub3800:goto90
  130. 510 ify<>3then550
  131. 512 ifx<>8then520
  132. 514 li=li-1:ifli<0thenli=0:goto100
  133. 516 mi=li+1:goto350
  134. 520 ifx<>14then530
  135. 522 li=li+1:ifli>8orlt$(li)=""thenli=li-1:goto100
  136. 524 mi=li+1:goto350
  137. 530 ifx<>11thengoto537
  138. 535 mi=1:goto350
  139. 537 ifx<25orx>28ornotgvthen100
  140. 538 goto4500
  141. 540 ifrfandgfthen4600
  142. 550 ifrfandnotgfthen563
  143. 551 ify<4ory>22orx>38then100
  144. 552 l=peek(lm+x+y*40):ifl=255then100
  145. 553 gosub5500:gosub2700
  146. 555 ifm$<>"t"then560
  147. 556 gosub558:pn=a:goto700
  148. 558 pokear,asc(p$):syscv:a=peek(ar):return
  149. 560 ifm$<>"m"then570
  150. 561 gosub730:gosub558:pn=a:gosub740:goto100
  151. 563 if(bd=-1andy=b)ora$=chr$(13)thengoto700
  152. 565 goto100
  153. 570 ifm$<>"g"then580
  154. 575 lg=-1:gosub558:gp=a:goto4500
  155. 580 systb+18,s1:w$=xf$:m0$="Launch Program":ifm$<>"p"then100
  156. 581 m1$="Are you sure?":i$(1)="Yes":i$(2)="No":l=2
  157. 582 bc=5:c=13:gosub1800:ifmi=2thendv=abs(dv):goto110
  158. 583 goto9800
  159. 590 a=(peek(56320+z)and16):return
  160. 600 u=-1:ifnottvorrfthen650
  161. 601 ifa$=""thengosub3200:gosub690:ifa=0thenu=0:goto601
  162. 602 ifa$=""thengosub3300:gosub690:ifa=0thenu=0:goto602
  163. 603 ln=bl:ifu=0thengosub3700
  164. 604 ifa$=""thengosub3400:gosub690:ifa=0then604
  165. 606 ifa$=""thengosub3500:gosub690:ifa=0then606
  166. 608 ifa$=""andnotdbtheny=3:gosub3800:goto90
  167. 609 ifa$=""andnotdbtheny=23:gosub3800:goto90
  168. 620 ifa$="v"andgvthen4500
  169. 640 ifa$=","ora$="<"thengoto514
  170. 641 ifa$="."ora$=">"thengoto522
  171. 642 ifa$="_"thengoto535
  172. 650 ifa$="I"thenz=1-z:gosub5000:gosub3060:goto100ory>22orx>38then100
  173. 651 ifa$<>"#"then660
  174. 652 gosub5300
  175. 653 dv=dv+1:ifdv=30thendv=8
  176. 654 open 2,dv,2:close2:ifst<0then653
  177. 655 gosub3060:gosub5400:ifdcthenreturn
  178. 656 goto100
  179. 660 ifrfandnotgfthen563
  180. 662 ifrfandgfthen4600
  181. 689 goto100
  182. 690 a=(peek(197)=64):return
  183. 700 rem main login
  184. 701 ifxf$="*"thenxf$=""
  185. 702 ifxf$=""orrfthen705
  186. 703 f$=xf$:lf$=xf$:gosub6200:ifnottvthengosub4000:goto80
  187. 705 m0$="Scanning Document":m1$="Please Wait":bc=14:l=0:ifrfthenpn=op:hp=-1
  188. 706 gosub5500:gosub1800:sf=-1
  189. 710 gosub2000:gosub2100:gosub2800:ln=sl:gosub3600
  190. 711 ifhpthengosub4200:goto714
  191. 712 ifpn=0thengosub4000:li=-1
  192. 713 gosub4100
  193. 714 systb+21,s2:ifgqthenreturn
  194. 715 ifrf or bmthenln=ol:rf=0:bm=0
  195. 720 hp=0:goto80
  196. 730 rem suspend current
  197. 733 op=pn:rf=-1:sf=-1
  198. 735 ol=ln-ws:ifol<slthenol=sl
  199. 737 return
  200. 740 rem message box
  201. 743 m0$="Scanning Document":m1$="Please Wait":bc=14:l=0
  202. 745 gosub5500:gosub1800:ov=rv:oc=c0:c0=val(xf$)
  203. 747 gosub2000:gosub2100:gosub2800:ln=sl::gosub2200:a=el-sl:t=int(12-a/2-1)
  204. 748 systb+21,s2:b=int(12+a/2+1):ifnotgqthensystb+72,0,39,1,23
  205. 750 rv=-1:systb+15,0,39,t,b,160,val(xf$):systb+72,0,39,t,t:systb+72,0,39,b,b
  206. 752 poke646,peek(55296+40*t):systb+27,t,""+pt$
  207. 753 systb+27,b,"Click here to Exit"
  208. 755 r=t+1:fori=sltoel:gosub2400:r=r+1:next:rv=ov:c0=oc
  209. 760 return
  210. 800 rem title page
  211. 805 poke53281,0:poke53280,0:print"":poke53272,cb
  212. 807 systb+27,6,"Welcome to the"
  213. 809 systb+27,8,"VLS HYPERTEXT SYSTEM"
  214. 815 systb+27,12,"Designed and Programmed by T. Parker"
  215. 819 systb+27,15,"Copyright 1996 J&F Publishing
  216.  
  217. 820 systb+27,18,"Initializing, please wait..."
  218. 849 return
  219. 850 systb+27,18,"                                      "
  220. 851 systb+27,18,"To get started:"
  221. 852 systb+27,19,"Click on FILE, then OPEN,"
  222. 853 systb+27,20,"and select a document."
  223. 899 return
  224. 900 rem define addresses/constants
  225. 905 dim lf$(8),lt$(8),lp%(8):h$(0)="Normal   ":h$(1)="Boldface "
  226. 906 h$(3)="Underline":h$(2)="Italic   "
  227. 910 tb=49152:up=25088:s1=53248/256:s2=55296/256:dv=peek(186):ifdv<8thendv=8
  228. 915 c0=15:c1=14:c2=10:c3=13:c4=7:p1=1:p2=2:p3=3:rv=-1:hp=0:sf=-1
  229. 999 return
  230. 1000 rem menu handler object module
  231. 1001 rem initialize handler
  232. 1005 read a,b:mi=a:dim m$(a,b),w%(a),l%(a),sp%(39),sm%(a):dim i$(21)
  233. 1015 fori=1toa:read m$(i,0),l%(i):w%(i)=0:forj=1tol%(i):readm$(i,j)
  234. 1020 l=len(m$(i,j)):ifl>w%(i)thenw%(i)=l
  235. 1025 next:next
  236. 1100 rem menu data
  237. 1105 data 3,10
  238. 1110 data "File",10
  239. 1120 data "Open",,"Save text","Print",,"DOS command","Disk Device"
  240. 1125 data "Input device",,"Exit"
  241. 1130 data "Link",10
  242. 1135 data,,,,,,,,,"New Path"
  243. 1136 data "Options",5
  244. 1140 data "Preferences","Find text","Bookmark",,"Help!"
  245. 1200 rem create menu string/map
  246. 1210 mb$=" ":fori=1tomi:mb$=mb$+m$(i,0)+" ":next
  247. 1215 fori=len(mb$)to39:mb$=mb$+" ":next
  248. 1220 p=0:fori=0to38
  249. 1225 ifmid$(mb$,i+1,1)=" "thenp=p+1:j=i+1:goto1235
  250. 1230 sp%(i)=p:sm%(p)=j
  251. 1235 next
  252. 1240 return
  253. 1300 rem display menu bar
  254. 1310 poke646,c:systb+24,0,0,""+mb$+""
  255. 1320 return
  256. 1400 rem disp submenu
  257. 1410 sm=0:i=sp%(x):ifi=0thenreturn
  258. 1415 sm=i
  259. 1420 a=sm%(i):systb+72,a,a+1+w%(i),1,l%(i)+3
  260. 1423 ifa>2thensystb+72,0,a-2,0,0
  261. 1425 systb+72,a+1+len(m$(i,0)),39,0,0
  262. 1430 systb+15,a-1,a+w%(i),1,l%(i)+2,160,c
  263. 1435 poke646,c
  264. 1440 forj=1tol%(i):systb+24,a,j+1,""+m$(i,j):next
  265. 1450 return
  266. 1500 rem interpret submenu
  267. 1505 a=sm%(sm):mi=0
  268. 1510 ifx<a-1orx>a+w%(sm)thenreturn
  269. 1513 ify>l%(sm)+1ory<2thenreturn
  270. 1515 mi=y-1:fori=1tol%(sm)+2:ifi=ythen1530
  271. 1520 systb+72,a-1,a+w%(sm),i,i
  272. 1530 next
  273. 1599 return
  274. 1600 rem disp imm submenu
  275. 1610 w=0:fori=1tol:iflen(i$(i))>wthenw=len(i$(i)):next
  276. 1615 ifdbthenxp=xp-w:rem handle db pos
  277. 1620 systb+72,xp+1,xp+2+w,yp+1,yp+l+2
  278. 1630 systb+15,xp,xp+w+1,yp,yp+l+1,160,c
  279. 1635 poke646,c
  280. 1640 forj=1tol:systb+24,xp+1,yp+j,""+i$(j):next
  281. 1650 return
  282. 1700 rem interpret imm submenu
  283. 1705 mi=0
  284. 1710 ifx<xporx>xp+w+1thenreturn
  285. 1713 ify>yp+lory<yp+1thenreturn
  286. 1715 mi=y-yp:fori=yptoyp+l+1:ifi=ythen1730
  287. 1720 systb+72,xp,xp+w+1,i,i
  288. 1730 next
  289. 1799 return
  290. 1800 rem standard message/dialog box
  291. 1803 systb+18,s2
  292. 1805 l0=len(m0$):l1=len(m1$):a=l0:ifl1>athena=l1
  293. 1810 a=a/2:x1=18-a:x2=22+a:systb+72,x1+1,x2+1,11,15
  294. 1815 systb+15,x1,x2,10,14,160,bc:poke646,bc
  295. 1820 print"";:systb+27,11,m0$
  296. 1825 print"";:systb+27,13,m1$
  297. 1830 ifl=0thenreturn
  298. 1840 yp=14:xp=x2:db=-1:gosub1600:db=0
  299. 1850 gosub5600:gosub5100:gosub1700:ifmi=0then1850
  300. 1860 systb+21,s2:return
  301. 1900 rem bottom line entry
  302. 1901 gosub5300:poke198,0
  303. 1905 a=len(p$)+l:systb+15,0,a,24,24,32,0:systb+24,0,24,""+p$
  304. 1910 systb+66,7,1,l:gosub5400:return
  305. 2000 rem vls kernal routines
  306. 2010 rem initialize vmx
  307. 2020 iv=25856:ld=iv+3:jl=iv+6:gl=iv+9:pl=iv+16:cl=iv+19:rc=iv+22:rt=iv+25
  308. 2022 cv=iv+32:sd=26624
  309. 2024 ct=28416:lm=31744
  310. 2026 row=182:lc=247:hc=lc+1:ls=249:hs=ls+1:ar=780
  311. 2028 pokels,0:pokehs,0:sysiv
  312. 2029 a=1:poke26237,a:poke26362,a:poke26370,a:poke26265,37:rem margins
  313. 2030 ifpn=0thengosub2300:hp$=w$
  314. 2040 fori=0to2:poke26316+i,234:next
  315. 2050 ln=0:return
  316. 2100 rem log in document
  317. 2105 pokear,pn:pokerow,0:sysld
  318. 2110 sl=peek(ls)+peek(hs)*256:el=peek(lc)+peek(hc)*256:el=el-2
  319. 2115 ln=sl-1:gosub2200:gosub2300:pt$=mid$(w$,4,40)
  320. 2120 syscl:return
  321. 2200 rem jump to line
  322. 2205 syscl
  323. 2210 hb=int(ln/256):lb=ln-hb*256
  324. 2215 pokels,lb:pokehs,hb:sysjl
  325. 2220 gosub2250:return
  326. 2250 rem return curlin value
  327. 2255 ln=peek(hc)*256+peek(lc)
  328. 2260 return
  329. 2300 rem return line in w$
  330. 2307 sysgl
  331. 2310 print"";
  332. 2315 a=peek(646):poke1018,peek(ar):systb+3697:poke646,a
  333. 2320 return
  334. 2400 rem get/print line
  335. 2401 pokect+255,c0:ifln=sfthenpokect+255,c4
  336. 2403 ifrvthensystb+15,0,38,r,r,160,c0
  337. 2404 poke199,-rv:ifln=sfthenpoke199,1
  338. 2405 poke row,r:sysgl:syspl:poke199,0
  339. 2415 return
  340. 2500 rem get link code
  341. 2505 poke ar,l:sysrc:gosub2310
  342. 2510 return
  343. 2600 rem get link text
  344. 2605 poke ar,l:sysrt:gosub2310
  345. 2610 return
  346. 2700 rem interpret link
  347. 2710 gosub2500:c$=w$:ifc$=""thenreturn
  348. 2715 gosub2600:t$=w$
  349. 2720 m$=mid$(c$,3,1):p$=mid$(c$,4,1):xf$=mid$(c$,6,40)
  350. 2730 pokear,asc(p$):syscv:p=peek(ar)
  351. 2740 return
  352. 2800 rem set up lct
  353. 2810 pokect+255,c0:poke24997,c1:poke25003,c2:poke25009,c3:sys24976:return
  354. 3000 rem vls screen handler
  355. 3010 systb+15,0,39,3,24,32,0
  356. 3015 tl=0:bl=0:ws=22-4
  357. 3020 rem
  358. 3025 systb+69:systb+24,0,3,"{CBM--}":systb+24,0,23,"~"
  359. 3027 systb+24,38,3,"{CBM-*}":systb+24,38,23,"{CBM-K}"
  360. 3030 systb+24,8,3,"{CBM-I}  {CBM-G}  {CBM-T}"
  361. 3032 ifgvthensystb+24,25,3,"VIEW"
  362. 3043 ifnottvthensystb+15,0,39,1,2,32,0:goto3060
  363. 3045 systb+15,0,39,1,1,160,3:systb+15,0,39,2,2,160,13
  364. 3050 print"";:systb+27,1,hp$:print"";:systb+27,2,pt$
  365. 3060 rem status
  366. 3061 systb+15,0,39,24,24,32,0:iff$<>""thenxf$=f$
  367. 3062 systb+24,0,24," File: "+xf$:systb+24,25,24,"Device:"+str$(dv)
  368. 3063 ifz=0thensystb+24,37,24,"J"
  369. 3064 ifz=1thensystb+24,37,24,"M"
  370. 3099 return
  371. 3100 rem new location
  372. 3103 gosub5500
  373. 3104 a=32:ifrvthena=160
  374. 3105 systb+15,0,38,4,22,a,c0
  375. 3107 ifln<slthenln=sl
  376. 3110 tl=ln:bl=ln+ws:gosub2200
  377. 3115 ifbl>elthenbl=el
  378. 3125 r=4:forln=tltobl:gosub2400:r=r+1:next:ln=bl:gosub3700
  379. 3150 return
  380. 3200 rem scroll next
  381. 3205 if bl=elthenreturn
  382. 3207 ifuthengosub2250
  383. 3210 systb+36,0,38,4,22,0:systb+39,32,0
  384. 3215 systb+54,lm+40*5,lm+40*24,lm+40*4
  385. 3220 tl=tl+1:bl=bl+1:ln=ln+1:r=22
  386. 3230 ifln<>blthenln=bl:gosub2210
  387. 3240 gosub2400:ifuthengosub3700
  388. 3250 return
  389. 3300 rem scroll prev
  390. 3305 iftl=slthenreturn
  391. 3307 ifuthengosub2250
  392. 3310 systb+36,0,38,4,22,1:systb+39,32,0
  393. 3315 syssd
  394. 3320 tl=tl-1:bl=bl-1:r=4
  395. 3325 ln=tl:gosub2210
  396. 3330 gosub2400:ifuthenln=bl:gosub3700
  397. 3350 return
  398. 3400 rem page fwd
  399. 3405 ifbl=elthenreturn
  400. 3410 ln=bl:ifln+18>elthenln=el-18
  401. 3415 gosub3100:return
  402. 3500 rem page back
  403. 3505 iftl=slthenreturn
  404. 3510 ln=tl-18:ifln<slthenln=sl
  405. 3515 gosub3100
  406. 3540 return
  407. 3600 rem init scrollbar
  408. 3605 n=el-sl:bi=n/(ws+3):bp=0
  409. 3610 ifbi=0thenbi=1
  410. 3699 return
  411. 3700 rem calc new pos
  412. 3710 a=int((ln-sl-ws+1)/bi)
  413. 3720 db=0:ifa<0thena=0:db=-1
  414. 3750 rem draw scrollbar
  415. 3760 systb+24,39,3,"{CBM-M}":systb+24,39,23,"{CBM-POUND}":systb+15,39,39,4,22,105,7
  416. 3761 ifnottvthenprint"";:systb+27,23,"No Document in Memory":return
  417. 3763 bp=a:systb+24,39,3+bp,"{CBM-N}"
  418. 3770 if nottvthenreturn
  419. 3771 print"";:systb+15,1,37,23,23,32,0
  420. 3772 systb+27,23,str$(ln-sl)+" of"+str$(el-sl)
  421. 3773 return
  422. 3799 return
  423. 3800 rem set scrollbar
  424. 3803 a=y-3:gosub3750:ln=int((bp*bi)+sl)
  425. 3805 ifln>el-wsthenln=el-ws
  426. 2018 return
  427. 4000 rem link path/menu handler
  428. 4005 rem reset path
  429. 4007 fori=0to8:lt$(i)="":lf$(i)="":lp%(i)=0:next
  430. 4010 li=0:gosub4200:return
  431. 4100 rem new entry
  432. 4103 li=li+1:ifli>8thenli=8
  433. 4105 lt$(li)=pt$:lf$(li)=lf$:lp%(li)=pn
  434. 4200 rem upd menu
  435. 4202 l=len(m$(2,10))
  436. 4203 fori=0to8:a$=" ":if(i=li)andtvthena$="{CBM-N}"
  437. 4205 m$(2,i+1)=a$+left$(lt$(i),31):a=len(m$(2,i+1)):ifl<athenl=a
  438. 4207 next:w%(2)=l:return
  439. 4500 ifnotgqthengosub730:rem graphic handler
  440. 4551 f$=xf$:xf$="13":pn=gp:gosub740:tc=peek(646)and15
  441. 4561 ifnotlgthen4577
  442. 4565 systb+15,0,39,b,b,160,tc:m0$="Loading Graphic":gosub6700:gosub5300
  443. 4570 systb+30,f$,dv,31744:systb+21,s2
  444. 4573 gosub5400:gosub5500:ifval(e$)=0thengv=-2:goto4577
  445. 4574 m0$="Error loading graphic":gosub6800
  446. 4575 ifmi=1then4565
  447. 4576 goto 4700
  448. 4577 gf=-1:systb+15,0,39,b,b,160,tc:poke646,tc:gosub5600
  449. 4578 ifgqthenreturn
  450. 4579 systb+27,b,"Click here to exit - any key to view":ifnotlgthen100
  451. 4580 systb+18,s1:gosub7000:goto4640
  452. 4600 rem gfx click handler
  453. 4620 if a$=chr$(13)or(bdandy=b)then4700
  454. 4630 systb+18,s1:gosub7200
  455. 4640 gosub590:ifa=0then4650
  456. 4645 gosub690:ifa=0then4650
  457. 4647 goto4640
  458. 4650 gosub7300:systb+21,s1:goto100
  459. 4700 rem reload
  460. 4701 gf=0:ifnotlgthen700
  461. 4703 systb+15,0,39,b,b,160,tc:poke646,tc
  462. 4705 systb+27,b,"Reloading document - Please wait"
  463. 4710 xf$=lf$:lg=0:goto703
  464. 5000 rem input driver object module
  465. 5010 id=24576:sp=2040
  466. 5060 ifpeek(789)<>234thensysid+6
  467. 5070 poke53248,180:poke53249,148:poke2040,13:poke53287,1:poke53264,0
  468. 5080 poke53269,1:ifz=1thensysid
  469. 5090 ifz=0thensysid+256
  470. 5095 return
  471. 5100 rem get x y wait for click/key a$
  472. 5105 poke198,0
  473. 5110 if(peek(56320+z)and16)<>0thenbd=0:goto5180
  474. 5120 ifbdthen5110
  475. 5130 bd=-1
  476. 5140 x=peek(53248)+(peek(53264)and1)*256-20:y=peek(53249)-48
  477. 5150 ifx<0orx>320ory<0ory>199then5110
  478. 5160 x=int(x/8):y=int(y/8)
  479. 5170 a$="":return
  480. 5180 a=peek(197):ifa=60ora=64then5110
  481. 5190 geta$:return
  482. 5200 rem get x y bd direct return
  483. 5210 bd=-1:if(peek(56320+z)and16)<>0thenbd=0         
  484. 5220 x=peek(53248)+(peek(53264)and1)*256-20:y=peek(53249)-48
  485. 5230 x=int(x/8):y=int(y/8)
  486. 5240 return
  487. 5300 rem suspend driver
  488. 5310 poke53269,0
  489. 5315 sysid+6
  490. 5320 return
  491. 5400 rem resume driver
  492. 5405 poke53269,1:gosub5600
  493. 5460 ifz=1thensysid
  494. 5470 ifz=0thensysid+256
  495. 5480 return
  496. 5500 rem wait pointer
  497. 5510 pokesp,14:return
  498. 5600 rem normal pointer
  499. 5700 pokesp,13:return
  500. 6000 rem vls hypertext file handler
  501. 6030 wc$="$:vh.*":fv=0:up=25088
  502. 6035 dl=57344
  503. 6050 return
  504. 6100 rem read directory
  505. 6105 systb+18,s2
  506. 6110 gv=0
  507. 6113 gosub5300
  508. 6115 systb,wc$,dv,dl,10,7,10,3,1
  509. 6117 gosub5400
  510. 6120 iff%>0then6150
  511. 6130 m0$="Error reading directory":ifnotf%thenm0$="No documents found"
  512. 6135 gosub6800
  513. 6140 ifmi=1thengoto6100
  514. 6150 systb+21,s2:return
  515. 6200 rem load document
  516. 6205 gv=gv+1:ifgv>0thengv=0
  517. 6210 gosub5300:tv=0:systb+18,s2
  518. 6215 m0$="Loading document":gosub6700
  519. 6220 sysup,f$,dv,32768:systb+21,s2
  520. 6230 gosub5400
  521. 6235 systb+42,"",dv
  522. 6240 ifval(e$)=0thentv=-1:return
  523. 6243 m0$="Error loading document":gosub6800
  524. 6245 ifmi=1thengoto6210
  525. 6247 return
  526. 6700 rem activity message
  527. 6710 m1$=f$:bc=3:l=0
  528. 6720 gosub1800:return
  529. 6800 rem error message dialog
  530. 6806 m1$=str$(dv)+"> "+e$:bc=2:c=10
  531. 6810 i$(1)="Retry":i$(3)="Cancel":l=3:i$(2)="Device":ifddtheni$(2)=""
  532. 6814 gosub1800:rem error db
  533. 6815 ifmi=2andddthen6814
  534. 6816 ifmi=2thendc=-1:gosub652:dc=0:goto6814
  535. 6817 ifmi=3thenmi=2
  536. 6818 return
  537. 7000 rem vls hypertext graphic/print handler
  538. 7015 gosub5500
  539. 7020 poke251,124:poke252,224:poke253,184:sys26880
  540. 7025 poke53281,0:poke53280,0
  541. 7030 if(peek(53265)and32)=0thensys26880+3:goto7030
  542. 7035 rem save color memory (cm rom in)
  543. 7040 gm=peek(53270):gb=peek(53281):systb+60,55296,56320,48128
  544. 7060 rem hi res on
  545. 7065 gosub5300
  546. 7070 poke56576,0:poke53265,27+32:poke53270,gm:poke53272,96+8:poke53281,gb
  547. 7075 rem restore data
  548. 7080 systb+54,47104,48127,55296
  549. 7085 sys25728:rem custom bc00 to cm xfer
  550. 7090 return
  551. 7095 rem hi res off
  552. 7100 gosub5400
  553. 7105 poke56576,3:poke53265,27:poke53270,200:poke53272,cb:poke53281,0
  554. 7110 return
  555. 7115 rem medres print
  556. 7130 pokepd+163,224:pokepd+179,184:pokepd+186,4:rem secondary
  557. 7135 syspd-16:rem $01 handler entry pt
  558. 7136 open4,4,4:fori=1to5:print#4:next:close4
  559. 7140 return
  560. 7145 rem hires print
  561. 7160 syspd,4,4,0,0,0,39,24,224,75,35,65,8,0
  562. 7161 open4,4,4:fori=1to5:print#4:next:close4
  563. 7165 return
  564. 7199 rem ux interface
  565. 7200 goto7060:rem hires on
  566. 7300 goto7095:rem hires off
  567. 7400 goto7115:rem mprint
  568. 7500 goto7145:rem hprint
  569. 8000 rem prefrences
  570. 8005 systb+72,0,39,0,23:systb+15,5,34,5,17,102,12:systb+15,6,33,6,16,32,0
  571. 8007 systb+27,5,"Preferences":systb+27,17,"Click here to Exit"
  572. 8010 systb+24,8,7,"{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}":systb+24,22,9,"{CBM-T}{CBM-T}{CBM-T}{CBM-T}"
  573. 8020 systb+24,8,15,"{CBM-T}Save   {CBM-T}Load   {CBM-T}Default"
  574. 8050 poke646,c0:systb+24,9,7,"Text Color":poke646,c1:systb+24,9,9,"Text Link"
  575. 8053 poke646,c2:systb+24,9,10,"Graphic Link":poke646,c3
  576. 8055 systb+24,9,11,"Program Link":poke646,c4:systb+24,9,13,"Find Bar"
  577. 8057 systb+24,23,9,""+h$(p1)+""+h$(p2)+""+h$(p3)
  578. 8058 a$="Normal Text ":ifrvthena$="Inverse Text"
  579. 8059 systb+24,20,13,a$
  580. 8100 gosub5100:ifx<6orx>33ory<6ory>17then8100
  581. 8103 ify=17thenreturn
  582. 8110 ifx<>8then8120
  583. 8112 ify=7thenc0=(c0+1):ifc0=16thenc0=1
  584. 8113 ify=9thenc1=(c1+1):ifc1=16thenc1=1
  585. 8114 ify=10thenc2=(c2+1):ifc2=16thenc2=1
  586. 8115 ify=11thenc3=(c3+1):ifc3=16thenc3=1
  587. 8116 ify=13thenc4=(c4+1):ifc4=16thenc4=1
  588. 8120 ifx<>22then8130
  589. 8123 ify=9thenp1=(p1+1):ifp1=4thenp1=0
  590. 8124 ify=10thenp2=(p2+1):ifp2=4thenp2=0
  591. 8126 ify=11thenp3=(p3+1):ifp3=4thenp3=0
  592. 8130 ifx=19andy=13thenrv=notrv
  593. 8135 ify<>15then8150
  594. 8136 ifx=8thengosub8200
  595. 8137 ifx=16thengosub8300
  596. 8138 ifx=24thengosub910
  597. 8150 goto8050
  598. 8200 rem save prefs
  599. 8201 gosub5300
  600. 8205 systb+42,"i",dv:systb+42,"s0:vp.config",dv:open2,dv,2,"vp.config,s,w"
  601. 8210 print#2,c0","c1","c2","c3","c4","p1","p2","p3","rv:close2
  602. 8220 gosub5400:return
  603. 8300 rem load prefs
  604. 8301 gosub5300:systb+42,"i",dv
  605. 8305 open2,dv,2,"vp.config"
  606. 8307 input#2,c0,c1,c2,c3,c4,p1,p2,p3,rv:close2
  607. 8310 systb+42,"",dv:ifval(e$)<>0thengosub910
  608. 8320 gosub5400:return
  609. 9000 rem save mark
  610. 9010 w$="vb."+mid$(lf$(0),4,13) :gosub5300
  611. 9015 systb+42,"s0:"+w$,dv:open2,dv,2,w$+",s,w"
  612. 9020 fori=0to8:print#2,lt$(i)","lf$(i)","lp%(i):next
  613. 9030 print#2,li","ln-ws
  614. 9040 close2:gosub5400:return
  615. 9100 rem load mark
  616. 9110 w$="vb."+mid$(lf$(0),4,13):gosub5300:systb+42,"r0:"+w$+"="+w$,dv:gosub5400
  617. 9112 ifval(e$)=63then9115
  618. 9113 m0$="Document not Marked":gosub6800:ifmi=1then9110
  619. 9114 goto110
  620. 9115 gosub5300:open2,dv,2,w$
  621. 9120 fori=0to8:input#2,lt$(i),lf$(i),lp%(i):next
  622. 9130 input#2,li,ol:close2:gosub5400
  623. 9140 mi=li+1:bm=-1:goto350
  624. 9500 rem print handler
  625. 9505 ifnottvthen110
  626. 9507 ifnotrfthenol=ln-ws
  627. 9508 iflgthengq=-1:systb+21,s1:gosub4700:gosub4500:gq=0
  628. 9510 open4,4,0:close4:ifst>=0then9550
  629. 9520 m0$="Printer not found":m1$="Make sure printer is on line"
  630. 9530 bc=2:c=10:dd=-1:gosub6810:dd=0
  631. 9535 ifmi=1then9510
  632. 9540 ifmi=2then110
  633. 9545 systb+18,s1
  634. 9550 ifgfthengosub9700:systb+21,s1
  635. 9553 open5,4,5:print#5,chr$(27)chr$(50);:close5
  636. 9555 gosub9600:gosub5400:gosub2800:systb+21,s1:goto230
  637. 9560 rem load driver
  638. 9562 bc=3:l=0:m0$="Loading print driver":systb+18,s2:m1$=w$:gosub1800
  639. 9564 gosub5300:systb+30,w$,dv,27392:systb+21,s2:gosub5400
  640. 9566 ifval(e$)=0thenpd=27392:mi=0:return
  641. 9570 m0$="Error loading driver":gosub6800:ifmi=1then9560
  642. 9575 return
  643. 9600 rem text print
  644. 9601 w$="tdrv6b00":gosub9560:ifmi<>0thenreturn
  645. 9602 gosub5300:pokect+255,0:poke24997,p1:poke25003,p2:poke25009,p3:sys24976
  646. 9603 m0$="Printing":m1$="Please Wait...":bc=15:l=0:gosub1800
  647. 9605 open4,4,7:open5,4,5:pg=0:ln=sl:gosub2200
  648. 9610 pp=4:pg=pg+1:bk=0:ifln>elthenclose4:close5:return
  649. 9611 cr=-1:ifpg=1thencr=0
  650. 9612 print#4:print#5,chr$(27)chr$(45)chr$(1);:print#4,hp$" - "pt$:print#4
  651. 9613 print#5,chr$(27)chr$(45)chr$(0);:print#4,"   ";
  652. 9620 ifcrthenprint#4:print#4,"   ";:pp=pp+1
  653. 9621 ifln>slandpeek(513)<>94thensyspd
  654. 9622 pokerow,24:syscl:sysgl:systb+15,0,39,24,24,32,0:sys26261
  655. 9624 cr=notcr:a=peek(513)
  656. 9625 ifa=32thencr=-1
  657. 9626 ifbk=0anda=13thenbk=-1:print#4:pp=pp+1
  658. 9627 if(a<>13)andbkthenbk=0:cr=-1:ln=ln+1:goto9621
  659. 9628 ifa=13thencr=-1
  660. 9635 ifln>elthena=pp:pp=61:ifnotrfthenfori=atopp:print#4:next
  661. 9636 if(pp>60)andcrthensys27480:print#4
  662. 9637 ln=ln+1:if(pp>60)andrfthenprint#4,chr$(12):goto9610
  663. 9640 if(pp>60)andcrthenprint#4:print#4,pgspc(60)f$:print#4,chr$(12);:goto9610
  664. 9650 goto9620
  665. 9700 rem graphics print
  666. 9705 w$="hdrv6b00":ifgm=216thenw$="mdrv6b00"
  667. 9710 gosub9560:ifmi<>0thenreturn
  668. 9715 gosub5300
  669. 9720 ifgm=216thengosub7200:gosub7400:gosub5400:gosub7300:return
  670. 9730 gosub7200:gosub7500:gosub5400:gosub7300:return
  671. 9800 rem exit/program link
  672. 9810 gosub5300:ifdv>0then9900
  673. 9815 dv=7
  674. 9820 dv=dv+1:ifdv=30thenpoke186,8:w$="":goto9900
  675. 9830 open2,dv,2:close2:ifst<0then9820
  676. 9840 systb+42,"r0:"+w$+"="+w$,dv:ifval(e$)<>63then9820
  677. 9900 print"":poke53272,23:print"pO44,8:pO56,160:pO2048,0:new"
  678. 9910 print"";:ifw$<>""thenprint"load"chr$(34)w$chr$(34)","dv:a=3
  679. 9930 ifw$=""thenprint"?chr$(147)chr$(5)":a=2
  680. 9935 print"run"
  681. 9940 print"";:fori=1toa:poke630+i,13:next:poke198,a
  682. 9950 end
  683. 10000 @"s0:vls.main":@:_"vls.main
  684.  
  685. 10010 verify"vls.main
  686.  
  687. 10020 end
  688.