home *** CD-ROM | disk | FTP | other *** search
/ Archive Magazine 1995 / ARCHIVE95.iso / text / hints / volume_01 / issue_11 < prev    next >
Text File  |  1995-02-16  |  10KB  |  351 lines

  1. Hints & Tips
  2. 1.11
  3. Å   *COMPACT Ö The User Guide says that *COMPACT ömoves files around on
  4. the disc, collecting all the free space into a continuous blockò.
  5. However, if you have a disc that has several gaps you will find that you
  6. need several compactions. One disc which had 5 gaps in the FS map had to
  7. be compacted eight times before the map showed only a single gap. (See
  8. review of R.A.Engineeringæs Utilities, page ?????)
  9. 1.11
  10. Å   *COPY Ö When copying multiple files using wildcards, you must ONLY
  11. specify the directory into which to copy and not try to specify the
  12. actual file name in any way e.g. if you want to copy files PROGA, PROGB,
  13. PROGC etc from the öBASICò directory into the öBACKUPò directory, use
  14. *COPY $.BASIC.PROG* $.BACKUP.* but if you try to use *COPY $.BASIC.PROG*
  15. $.BACKUP.PROG* it wonæt work. This is not desperately clear in the User
  16. Guide and Iæve only just worked out why 90% of my attempts to do
  17. wildcard copies have not worked!
  18. 1.11
  19. Å   CAPS LOCK Ö Another thing which is obvious if you know about it is
  20. that you can set up the keyboard to print upper case normally but then
  21. go into lower case when you press <shift>. This can be done either by
  22. *Configure SHCAPS if you want it to start up in that mode (or CAPS or
  23. NOCAPS if you donæt) or by holding the shift key down and pressing and
  24. releasing the Caps Lock key.
  25. 1.11
  26. Å   CHAINing programs Ö In response to our complaint in last monthæs Bug
  27. or Feature that programs chaining one another cannot be called from
  28. drive 1 using the desktop, Philip Colmer of Acornæs Customer Support
  29. Department tells us that it is definitely a feature. There are a number
  30. of ways of avoiding the problem. Firstly, you could reference files by
  31. disc name, so we could CHAINö:ProgDisc.$.Progs.Nextprogò or whatever.
  32. Alternatively, you could use the fact that when you run a BASIC program
  33. in drive 1 from the desktop, it generates a command something like
  34. *basic Öquit öADFS::1.$.Progs.FirstProgò. You could then use OS_GetEnv
  35. to read the command string and find out where the program has been
  36. called from. Thridly, have a look at PC.PC from the 1.20 version of the
  37. PC emulator to see an intelligent (incredibly so!) boot-up program which
  38. has been very carefully commented to enable you to modify it for your
  39. own use.
  40. 1.11
  41. Å   Auto-booting Ö Again from Philip Colmer comes the suggestion that
  42. you should use the PC.PC program to boot up applications from within
  43. directories on the hard disc. The program uses legal OS calls instead of
  44. re-configuring. It does a *DIR and then runs the program specified. The
  45. only restriction on it is that it cannot change the system sprite size
  46. but, he points out, if programs were written properly, they would not be
  47. using the system sprite area!
  48. 1.11
  49. Å   System Devices Ö You can treat devices as files, e.g.
  50. C%=OPENOUT(öNETPRINT:ò). This is particularly useful in the example
  51. given on page 9 last month because you can now open a channel to the
  52. network printer, send some stuff to it when you are ready (using BPUT
  53. #C%) and when everything is done, close the Éfileæ (CLOSE#0) and it will
  54. then be printed! (This also came from Philip Colmer Ö Thanks PC! Ö
  55. Funny, you know, I always thought that PC stood for Personal Computer!
  56. Ed.)
  57. 1.11
  58. The following Hints were prepared by Adrian Look╔
  59. 1.11
  60. Å   Smooth Scrolling Ö Using VDU 23,7 you can scroll the current text
  61. window up, down, left, or right. Horizontally, the picture can be
  62. scrolled by one byte, but vertically it can only be scrolled by one
  63. character cell. This can produce a smooth scroll by placing a WAIT (for
  64. the vertical sync pulse) command before the VDU 23,7. If any further
  65. delay is implemented then the picture shudders as it scrolls. This means
  66. that a slow smooth scroll cannot be used. The answer is to redefine the
  67. screen base address manually (as we used to do on the BBC). This is done
  68. using ÉOS_Wordæ &16.
  69. 1.11
  70. DIM block% 4
  71. 1.11
  72. :
  73. 1.11
  74. block%?0=type
  75. 1.11
  76. block%!1=offset
  77. 1.11
  78. WAIT
  79. 1.11
  80. SYS öOS_Wordò,&16,block%
  81. 1.11
  82. ötypeò   : when 1 Ö base used by VDU drivers (i.e. screen updated)
  83. 1.11
  84.    : when 2 Ö base used by hardware (i.e. screen displayed)
  85. 1.11
  86. öoffsetò   : from the address of the base of the screen buffer to the
  87. start of the screen display.
  88. 1.11
  89. The following example program should help to make it clearer.
  90. 1.11
  91.  10 REM >scrolling
  92. 1.11
  93.  20
  94. 1.11
  95.  30 REM **************************
  96. 1.11
  97.  40 REM *   Scrolling Screens??  *
  98. 1.11
  99.  50 REM * written by Adrian Look *
  100. 1.11
  101.  60 REM *     21st July 1988     *
  102. 1.11
  103.  70 REM **************************
  104. 1.11
  105.  80
  106. 1.11
  107.  90 MODE 0:OFF
  108. 1.11
  109. 100 DIM block% &10
  110. 1.11
  111. 110 count=0
  112. 1.11
  113. 120
  114. 1.11
  115. 130 PRINTTAB(3,15);öSome textò
  116. 1.11
  117. 140
  118. 1.11
  119. 150 REPEAT
  120. 1.11
  121. 160   PROCscroll(1)
  122. 1.11
  123. 170 UNTIL 0
  124. 1.11
  125. 180 END
  126. 1.11
  127. 190
  128. 1.11
  129. 200 DEFPROCscroll(speed)
  130. 1.11
  131. 210 PROCinfo
  132. 1.11
  133. 220 add=x/m
  134. 1.11
  135. 230 IF SGN(count)>0 THEN speed=-speed
  136. 1.11
  137. 240 REPEAT
  138. 1.11
  139. 250   block%?0=2
  140. 1.11
  141. 260   block%!1=add*count
  142. 1.11
  143. 270   WAIT
  144. 1.11
  145. 280   SYS öOS_Wordò,22,block%
  146. 1.11
  147. 290   count+=speed
  148. 1.11
  149. 300 UNTIL add*count>x*y/m+4160 OR count<0
  150. 1.11
  151. 310 ENDPROC
  152. 1.11
  153. 320
  154. 1.11
  155. 330 DEFPROCinfo
  156. 1.11
  157. 340 SYS öOS_ReadModeVariableò,MODE,4 TO ,,x
  158. 1.11
  159. 350 x=4-x:x=8*(2^x)*10
  160. 1.11
  161. 360 SYS öOS_ReadModeVariableò,MODE,5 TO ,,y
  162. 1.11
  163. 370 y=3-y:y=y*256
  164. 1.11
  165. 380 SYS öOS_ReadModeVariableò,MODE,3 TO ,,c
  166. 1.11
  167. 390 CASE c OF
  168. 1.11
  169. 400   WHEN 1  : m=8
  170. 1.11
  171. 410   WHEN 3  : m=4
  172. 1.11
  173. 420   WHEN 15 : m=2
  174. 1.11
  175. 430   WHEN 63 : m=1
  176. 1.11
  177. 440 ENDCASE
  178. 1.11
  179. 450 ENDPROC
  180. 1.11
  181.  
  182. 1.11
  183. Å   Desktop Utilities Ö The desktop is essentially a skeleton program
  184. which allows the programmer to install his/her own icons, windows,
  185. menus, commands, etc, which the DeskTop will then operate. This is done
  186. with a very clever set of FNæs. for example:
  187. 1.11
  188. PROCinstall(öadrianò)
  189. 1.11
  190. :
  191. 1.11
  192. DEFPROCinstall(file$)
  193. 1.11
  194. INSTALL file$
  195. 1.11
  196. void=EVAL(öFNinstall_file_ò+file$)
  197. 1.11
  198. ENDPROC
  199. 1.11
  200. This means that by EVALuating a string the DeskTop can call any file-
  201. specific function. In the case above, FNinstall_file_adrian will be
  202. called. By using this system, any command can be Éinstalledæ or even
  203. replaced. Explaining or even listing the functions and procedures
  204. available in the DeskTop program is not really possible in the magazine.
  205. However, bearing in mind the methods used, you will find before long you
  206. can write some very useful tools for the DeskTop. It should even
  207. possible to completely re-write the it! As an example, here is a program
  208. which will allow you to use star commands. Donæt forget to *SETTYPE
  209. Éfilenameæ FE0 to indicate that the program is a desktop utility (We
  210. have included several other utilities on the program disk).
  211. 1.11
  212.  10 REM >star
  213. 1.11
  214.  20
  215. 1.11
  216.  30 REM *******************************
  217. 1.11
  218.  40 REM *  Star Commands for Desk Top *
  219. 1.11
  220.  50 REM *    written by Adrian Look   *
  221. 1.11
  222.  60 REM * original idea Denis Howlett *
  223. 1.11
  224.  70 REM *******************************
  225. 1.11
  226.  80
  227. 1.11
  228.  90 DEFFNinstall_file_star
  229. 1.11
  230. 100 file=OPENIN(filehandler_path$+ö.istarò):CLOSE #file
  231. 1.11
  232. 110 IF file=0 THEN ERROR 1,öCanæt find icon file Éistaræò
  233. 1.11
  234. 120 OSCLI(öSMERGE ò+filehandler_path$+ö.istarò)
  235. 1.11
  236. 130
  237. PROCsys_addtoiconbar(östarò,öcommandò,&301A,icon_fgcol,icon_bgcol,48)
  238. 1.11
  239. 140 SYS öWimp_ForceRedrawò,-1,0,0,1279,100
  240. 1.11
  241. 150 =0
  242. 1.11
  243. 160
  244. 1.11
  245. 170 DEFFNaction_star
  246. 1.11
  247. 180 PROCstar_command(5,5,75,25,2,1)
  248. 1.11
  249. 190 =0
  250. 1.11
  251. 200
  252. 1.11
  253. 210 DEFPROCstar_command(x0,y0,x1,y1,bx,by)
  254. 1.11
  255. 220 *POINTER 0
  256. 1.11
  257. 230 VDU 26,4,28,x0,y1,x1,y0
  258. 1.11
  259. 240 y0=31-y0:y1=31-y1
  260. 1.11
  261. 250 gx=x0*16-bx*8:dx=(x1-x0)*16+bx*16+16
  262. 1.11
  263. 260 gy=y1*32-by*16:dy=(y0-y1)*32+by*32+32
  264. 1.11
  265. 270 GCOL 0,&4:RECTANGLE FILL gx-4,gy-4,dx+8,dy+8
  266. 1.11
  267. 280 GCOL 0,&0:RECTANGLE FILL gx,gy,dx,dy
  268. 1.11
  269. 290 LOCAL ERROR
  270. 1.11
  271. 300 REPEAT
  272. 1.11
  273. 310   ON ERROR LOCAL PRINT REPORT$
  274. 1.11
  275. 320   *FX 4,0
  276. 1.11
  277. 330   INPUTö*òstar$
  278. 1.11
  279. 340   *FX 4,1
  280. 1.11
  281. 350   OSCLI(star$)
  282. 1.11
  283. 360 UNTIL star$=öò
  284. 1.11
  285. 370 RESTORE ERROR
  286. 1.11
  287. 380 SYS öWimp_ForceRedrawò,-1,gx-4,gy-4,gx+dx+8,gy+dy+8
  288. 1.11
  289. 390 VDU 26,5
  290. 1.11
  291. 400 *FX 21,9
  292. 1.11
  293. 410 *POINTER
  294. 1.11
  295. 420 ENDPROC
  296. 1.11
  297. N.B. (i) You will need a STAR shaped icon called Écommandæ, saved as
  298. Éistaræ. However, if you want to test the program before designing an
  299. icon, skip lines 100-120 and change öcommandò in line 130 to öunknownò.
  300. 1.11
  301.   (ii) Because the DeskTop uses the filename of the utility as a Éseedæ,
  302. it important that the utilityæs filename be consistent with its
  303. procedure names. For example: if you rename Éstaræ to Écommandæ then the
  304. DeskTop will look for FNaction_command instead of FNaction_star, so you
  305. will get an error!
  306. 1.11
  307. Å   Making the Print Key Save Ö Last month it was suggested in Neil
  308. Strongæs article about making the print key print that a slight
  309. modification of the program could make it save screen shots to the disc
  310. using SCREENSAVE ö$.picò instead of HARDCOPYFX. However, this limits you
  311. to one screen shot at a time (otherwise you will overwrite your last
  312. one). If we use the system variables and update the Éprint keyæ program
  313. we can get it to save a screen called É$.scr0æ, followed by, É$.scr1æ,
  314. É$.scr2æ..etc!
  315. 1.11
  316. 871 adr r0,command1
  317. 1.11
  318. 872 swi öOS_CLIò
  319. 1.11
  320. 920 equs öScreenSave scr<file>ò  ; FastSave even!#?
  321. 1.11
  322. 941 .command1
  323. 1.11
  324. 942 equs öSetEval file file+1ò
  325. 1.11
  326. 943 EQUB 0
  327. 1.11
  328. 944 ALIGN
  329. 1.11
  330. 1020 OSCLI(öSetEval file 0ò)
  331. 1.11
  332. 1030 END
  333. 1.11
  334. If you wish to (re)set the Éfile countæ to n, then just type:
  335. 1.11
  336. *SETEVAL file n
  337. 1.11
  338. Å   SpellMaster Browse in Wordwise Plus Ö If you have Spell-Master and
  339. Wordwise Plus you can very easily write a two line segment program which
  340. will call the browse window. i.e.
  341. 1.11
  342. *BROWSE
  343. 1.11
  344. DISPLAY
  345. 1.11
  346. Thus if the program were in segment zero you could press <shift><print>
  347. while editing your text and check your spelling using the browse window.
  348. This obviously opens up all sorts of possibilities for Wordwise Plus to
  349. use Spell Masteræs facilities.
  350. 1.11
  351.