home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / ENTERPRS / CPM / UTILS / S / ZPM3N10.ARK / ZPM3.TXT < prev    next >
Text File  |  1993-02-01  |  21KB  |  483 lines

  1.  
  2.                     Z P M 3   by Simeon Cran
  3.                     ========================
  4.  
  5.           A Z80 coded CP/M 3.0 compatible BDOS replacement.
  6.  
  7.                The first public release: 27/3/92
  8.                     This document dated: 16/6/92
  9.  
  10.           Distributed at: Z-Node 62 (Perth, Western Australia)
  11.                      V21,V22,V22bis 09 450 0200
  12.  
  13.  
  14. WELCOME TO ZPM3
  15. ~~~~~~~~~~~~~~~
  16. Welcome to the best CP/M compatible operating system for Z80 
  17. based computers with banked memory. The best? Yes, we believe so. 
  18. CP/M 3.0 has had bad press, but the fact is that it is faster 
  19. than CP/M 2.2 ever was, and it offered more integrated 
  20. facilities. Perhaps it was all the Z80 replacement BDOSes for 
  21. CP/M 2.2 which stole the limelight from CP/M 3.0, or was it just 
  22. that few computers had the required banked memory?
  23.  
  24. Whatever the reason for CP/M 3.0's lack of success in the 
  25. marketplace, there are still plenty of users who will stand by 
  26. its wonderful facilities and speed. For those users ZPM3 provides 
  27. the long awaited Z80 coded update.
  28.  
  29. ZPM3 offers all the good things that CP/M 3.0 does, and then it 
  30. offers more. Because ZPM3 is written in Z80 code rather than the 
  31. 8080 code of CP/M 3.0, it can do everything that CP/M 3.0 does, 
  32. but in much less space. With the extra space recovered, ZPM3 
  33. packs in a number of new facilities. Yet the whole package fits 
  34. in exactly the same space as CP/M 3.0 so you can directly replace 
  35. your old CP/M 3.0 BDOS with ZPM3 without a worry.
  36.  
  37. ZPM3 is also fast. Faster, in fact, than CP/M 3.0. This is 
  38. possible because the rich Z80 instruction set allows many 
  39. algorithms to be implemented more efficiently. In addition, the 
  40. extra space available in ZPM3 has been put to use to further 
  41. optimise the code. Lots of small optimisations smooth the 
  42. execution flow, so ZPM3 becomes the fastest operating system on 
  43. most banked CP/M computers.
  44.  
  45.  
  46. THE FEATURES
  47. ~~~~~~~~~~~~
  48. ZPM3, in addition to complete CP/M 3.0 compatibility, offers the 
  49. following features:
  50.  
  51.  
  52. Random Read Bug fixed.
  53. ++++++++++++++++++++++
  54. Maybe you didn't know, but CP/M 3.0 has a bug. It affects random 
  55. reads under very specific circumstances, and can result in a 
  56. program thinking that you don't have some pieces of data in a 
  57. file when in fact you do. The bug would occur very, very rarely, 
  58. but it is real. ZPM3 finally squashes it.
  59.  
  60.  
  61. Protected SCB User code
  62. +++++++++++++++++++++++
  63. The System Control Block of CP/M 3.0 was a revolution at the 
  64. time. ZCPR has a system environment and most other operating 
  65. systems have other similar structures, but the SCB of CP/M 3.0 
  66. was one of the very first.
  67.  
  68. Unfortunately, Digital Research never properly documented it, and 
  69. some programmers found things out about it that weren't quite 
  70. true and started programming accordingly. As well, because it is 
  71. available in the TPA bank, runaway programs can overwrite it 
  72. causing problems.
  73.  
  74. Mostly though, the SCB will survive, or at least any problems 
  75. will be so obvious that the user will realise that a crash has 
  76. occurred and will reboot. A real problem exists with the CP/M 3.0 
  77. code however when the user value is written over with a value 
  78. above 15. Many programs now directly write to this byte, and if 
  79. they put a value in that is above 15, all sorts of havoc can 
  80. happen with the disk system. Actually, CP/M 3.0 will handle user 
  81. areas above 15 with this method, and all seems ok until the 
  82. operating system mistakes one of these directory entries as an 
  83. XFCB. Simply put, user areas above 15 must not be used with CP/M 
  84. 3.0.
  85.  
  86. ZPM3 has code which prevents these problems, making the system 
  87. even more stable.
  88.  
  89.  
  90. Obsoleted Trap system.
  91. ++++++++++++++++++++++
  92. One of the problems of the banked operating system was that it 
  93. was possible to redirect the BIOS to code below common memory, in 
  94. which case the banked BDOS could not access it. One solution is 
  95. to call all BIOS code from common memory, but this involves a 
  96. bank switch for every BIOS call, and this slows things down 
  97. considerably.
  98.  
  99. CP/M 3.0 got around the problem by providing special code just 
  100. below the SCB. If you redirected the BIOS, you also had to change 
  101. this code which caused a bank switch when your new BIOS routine 
  102. was called. When you removed the redirection, you also had to 
  103. restore the special code.
  104.  
  105. This system has major drawbacks. For a start, if you redirect the 
  106. BIOS, then another program redirects your redirection, then you 
  107. remove your first redirection (along with the special code), the 
  108. bank switch won't happen for the second redirection and the 
  109. system will crash.
  110.  
  111. If a CP/M 2.2 program tried to do the redirection, it would know 
  112. nothing about CP/M 3.0 and would not adjust the special code, so 
  113. a crash would result in that case too.
  114.  
  115. The special code was called the "Trap System" as it was meant to 
  116. trap redirection (as long as you set the trap). ZPM3 has 
  117. eliminated the need for the traps. They are still there, and 
  118. programs can still fiddle with them, but it doesn't matter how 
  119. they are set, they are ignored. There is simply no need for them 
  120. anymore. And this has been achieved without a performance 
  121. penalty. In fact, in the case of a program which sets the traps 
  122. but forgets to restore them, performance is now much better.
  123.  
  124.  
  125. Semi-Permanent Read Only status for drives.
  126. +++++++++++++++++++++++++++++++++++++++++++
  127. In recent years, a trend in CP/M 2.2 is to make drives which have 
  128. been set read only to remain that way until explicitly changed by 
  129. function 37. ZPM3 now adopts this logic. Previously a control-C 
  130. would return a read only drive to read write. The advantage is 
  131. that a program can now make a drive read only for a session and 
  132. know that it will stay that way.
  133.  
  134.  
  135. ZCPR compatible function 152
  136. ++++++++++++++++++++++++++++
  137. Function 152 is the CP/M 3.0 parser. It was a great innovation at 
  138. the time as parsing is one of the more tedious aspects of 
  139. programming for CP/M. Unfortunately, almost as soon as it 
  140. appeared, it was made obsolete by the fact that it didn't handle 
  141. references to user number (DU references). A line such as 
  142. A:FILE.TYP would be correctly parsed, but A3:FILE.TYP would not. 
  143. CP/M 3.0 programs would often parse the drive and user 
  144. separately, then give function 152 the line without the DU: 
  145. reference. All this extra work should not have been necessary if 
  146. CP/M 3.0 had included user number parsing.
  147.  
  148. ZPM3 parses the user number, and goes even further by handling 
  149. named directories for ZCPR. This is possible as long as you set a 
  150. special word in the SCB which tells ZPM3 where to find the ZCPR 
  151. system environment descriptor. ZCCP, a companion CCP for ZPM3, 
  152. handles this automatically, but for Z3PLUS users, a special 
  153. utility is available which automatically sets this word.
  154.  
  155. The result is that CP/M 3.0 programs will not balk at DU: 
  156. references and ZPM3 aware programs can use the full DU: and DIR: 
  157. facilities of function 152. It has also made the brilliant ZCCP 
  158. code possible.
  159.  
  160.  
  161. New Functions 54 and 55
  162. +++++++++++++++++++++++
  163. Datestamps in CP/M 3.0 are wonderful, but difficult to 
  164. manipulate. Two new functions make them easier to handle and at 
  165. the same time give compatibility to Z80DOS aware programs.
  166.  
  167. Function 54 (Get Stamp) returns a Z80DOS compatible datestamp. 
  168. Any program (such as many directory programs) which recognise the 
  169. Z80DOS standard can make use of function 54. There is only one 
  170. slight difference between Z80DOS datestamps and ZPM3's which you 
  171. should be aware of. Z80DOS will return a correct datestamp after 
  172. any successful open or search of any extent. ZPM3 can only return 
  173. a correct datestamp after a successful open or search of the 
  174. first extent of the file. This is because CP/M 3.0 datestamps are 
  175. only saved for the first extents of each file, in order to 
  176. provide the highest performance.
  177.  
  178. Even more interesting is Function 55 (Use Stamp) which provides a 
  179. mechanism for changing datestamps on files. Trying to do this 
  180. with CP/M 3.0 was virtually impossible because it involved direct 
  181. sector writes. With Function 55 you can simply set the stamp and 
  182. then write.
  183.  
  184.  
  185. Wheel protected files
  186. +++++++++++++++++++++
  187. If you are using a ZCPR system (ZCCP or Z3PLUS), ZPM3 has access 
  188. to the wheel byte and supports wheel protected files. Such files 
  189. act normally if the wheel is set (signifying a priveleged user), 
  190. but if the wheel is not set, the files can not be changed. This 
  191. is of most benefit to BBS systems. The implementation is 
  192. virtually the same as most current Z80 CP/M 2.2 compatible 
  193. BDOSes.
  194.  
  195.  
  196. Better error messages
  197. +++++++++++++++++++++
  198. CP/M 3.0 introduced the best error messages that CP/M had ever 
  199. had. ZPM3 goes further. The main difference you will notice is 
  200. that the user number as well as the drive is shown in the error 
  201. message. This is invaluable in helping you identify which file 
  202. might have caused a problem.
  203.  
  204.  
  205. Function 10 history buffer and improved editing.
  206. ++++++++++++++++++++++++++++++++++++++++++++++++
  207. Function 10 is used by the CCP to input command lines. Many other 
  208. programs use function 10 for input.
  209.  
  210. CP/M 3.0 introduced a history buffer for function 10. You press 
  211. control-W and you were returned the last command. It is a great 
  212. facility, but because it only remembers one command it is rather 
  213. limited. There have been RSXes written which give a much larger 
  214. history buffer, but RSXes take up extra program memory so are 
  215. undesirable.
  216.  
  217. ZPM3 gives a large (approximately 250 bytes) history buffer which 
  218. can store multiple commands. It also makes very intelligent use 
  219. of the buffer so that identical commands are not stored twice, 
  220. and commands of less than three characters are not stored. The 
  221. history buffer takes up no additional memory, and is always 
  222. available.
  223.  
  224. For security, it is possible to clear the history buffer so that 
  225. other users can not see what commands you have used.
  226.  
  227. The ZPM3 history buffer feature is so good, that for many users, 
  228. the ZPM3 upgrade is completely justified by it.
  229.  
  230. As part of the history buffer system, ZPM3 also offers a facility 
  231. called Automatic Command Prompting. This can be disabled, or can 
  232. be made switchable from the keyboard. When it is on, ZPM3 tries 
  233. to fill in the rest of your command based on what commands you 
  234. used most recently. It is like magic, and can save you typing out 
  235. complicated commands many times. In effect, it looks through the 
  236. history buffer for you and finds the command it thinks you want. 
  237. As you keep typing, if it turns out that the command doesn't 
  238. match anymore, it will try to match another command, and if it 
  239. can't, it lets you make the command by yourself. This facility is 
  240. quite amazing to watch.
  241.  
  242. And to integrate the history buffer and the automatic command 
  243. prompting, function 10 has the best command line editing you'll 
  244. find anywhere. Most of the control keys do something when you are 
  245. editing a function 10 line, and for the most part they mimic the 
  246. standard WordStar/NewWord/ZDE functions. You can jump to 
  247. different words in the command, delete individual words, delete 
  248. individual letters, insert letters, and a whole lot more.
  249.  
  250.  
  251. Here is a list of what the various control keys do for function 
  252. 10:
  253.  
  254. A    Move left one word
  255. B    Go to the beginning or end of the line
  256. C    Warm boot if at start of line, otherwise nothing
  257. D    Go right one character
  258. E    Go backwards one command in the history buffer
  259. F    Go right one word
  260. G    Delete current character
  261. H    Destructive backspace
  262. I
  263. J    Enter line
  264. K    Delete all to the right
  265. L
  266. M    Enter line
  267. N
  268. O
  269. P    Toggle printing
  270. Q    Toggle automatic command prompting (if enabled)
  271. R
  272. S    Go left one character
  273. T    Delete current word
  274. U    Add current line to history buffer
  275. V    Clear line and delete from history buffer
  276. W    Go forwards one command in the history buffer
  277. X    Delete all to the left
  278. Y    Clear the whole line
  279. Z
  280.  
  281.  
  282. CPMLDR.REL bug fixed.
  283. +++++++++++++++++++++
  284. If you have ever tried to use the CPMLDR.REL code supplied with 
  285. CP/M 3.0 to load a CPM3.SYS file larger than 16k, you have 
  286. probably come across the CPMLDR.REL bug. The computer probably 
  287. crashed, and you were left wondering what you did wrong in your 
  288. bios.
  289.  
  290. Well CPMLDR.REL has a bug. To solve this for you ZPM3 comes with 
  291. ZPM3LDR.REL which directly replaces CPMLDR.REL. It is also 
  292. somewhat better in that all the messages, and the fcb for loading 
  293. CPM3.SYS, are at the start of the file along with plenty of spare 
  294. room. As a result you can easily patch the signon and error 
  295. messages to say whatever you like and even change the FCB to load 
  296. a file called something other than CPM3.SYS.
  297.  
  298.  
  299.  
  300.  
  301. All About the Random Read Bug.
  302. ==============================
  303. Never heard of it? Well it's there in CP/M 3.0. I spent a lot of 
  304. time trying to work out what it was and just why it was 
  305. happening, and if you are interested, here are the details.
  306.  
  307. CP/M 3.0 uses the Record Count byte of an active FCB a little 
  308. differently from the way CP/M 2.2 does. It is mentioned in the 
  309. CP/M 3.0 manuals that the record count may contain numbers 
  310. greater than 128, but in such a case it implies that the record 
  311. count is really 128. CP/M 2.2 would not return record counts 
  312. greater than 128.
  313.  
  314. The reason for the use of the record count in this way is to help 
  315. speed up some of the logic used to find records in a file. It 
  316. works very well for sequential access. When it comes to random 
  317. access, the system has some failings.
  318.  
  319. The idea behind CP/M 3.0's unusual use of the record count is to 
  320. keep the record count of the last logical extent of the current 
  321. physical extent always in the Record Count byte. When accessing 
  322. extents before the last one, bit 7 of the byte is set. That way 
  323. it will always be at least 128 for logical extents before the 
  324. last (which CP/M 3.0 translates to mean equal to 128), and the 
  325. lower 7 bits are used as convenient storage for the record count 
  326. of the last logical extent. This is particularly convenient 
  327. because it means there is no need to go and read the directory 
  328. entry again when it comes time to read the last logical extent.
  329.  
  330. I hope you have followed that! In sequential access, this scheme 
  331. is great. The problem occurs with random access. In this case it 
  332. is possible to access a logical extent which has no records in 
  333. it. This could be any logical extent past the last one. In such a 
  334. case the record count must be returned as 0 (which is correct). 
  335. If we then go back to a previous logical extent in the same 
  336. physical extent, CP/M 3.0 gets confused and assumes that there 
  337. must be 128 records in that extent because the one we just came 
  338. from had no records and we are now accessing an earlier extent. 
  339. You're probably well and truly lost by now!
  340.  
  341. Anyhow, the assumption that CP/M 3.0 makes is quite wrong. The 
  342. record count ends up being set to 128, a read is allowed to go 
  343. ahead as if nothing was wrong, no error is returned, and the 
  344. record count remains incorrectly set until a different physical 
  345. extent is opened. The result could be chaos, but mostly it just 
  346. means that a program returns the wrong information.
  347.  
  348. Remember, a logical extent is always 16k. A physical extent can 
  349. be a multiple of 16k and is all the data described by one 
  350. directory entry. If your system has physical extents which are 
  351. 16k, you would never have the problem because a new physical 
  352. extent would be properly opened for every new logical extent that 
  353. was accessed.
  354.  
  355. Typically though, a physical extent is 32k, so it holds 2 logical 
  356. extents. The problem won't arise until the file grows past the 
  357. 32k mark in such a case. And when the file gets over 48k the 
  358. problem can't occur again until it gets over 64k... and so on. 
  359. Even then, it can only happen if reads are attempted to 
  360. particular extents in a particular order. So you shouldn't be too 
  361. surprised if the bug hasn't been too noticeable to you.
  362.  
  363. ZPM3 squashes the bug once and for all by using the correct 
  364. logic. In the situation where the bug would normally occur, ZPM3 
  365. makes sure it gets the correct record count information, and the 
  366. reads return the correct record count every time.
  367.  
  368. If you are interested in seeing a demonstration of the bug in 
  369. action (on CP/M 3.0) and comparing it with ZPM3, there is a file 
  370. floating around various bulletin boards which contains 
  371. demonstrations for the bug and an RSX to fix it. The RSX is a 
  372. less than perfect way of overcoming the bug, although it seems to 
  373. work. However, now that you have ZPM3, you don't need to worry.
  374.  
  375.  
  376.  
  377.  
  378. Other things you should know about ZPM3
  379. =======================================
  380. ZPM3 has worked on EVERY CP/M 3.0 system tried so far except one. 
  381. This is a Bondwell computer, and as yet it isn't clear why it 
  382. won't work. I will study the source code of its BIOS and come up 
  383. with a fix shortly.
  384.  
  385. The MAKEDOS.COM utility is not perfect (as mentioned previously) 
  386. and it seems that nobody has managed to get it to work with the 
  387. Commodore C128 system. You must use the conventional method for 
  388. installing ZPM3 on such systems.
  389.  
  390. If you have a computer that ZPM3 will not install on with MAKEDOS 
  391. and you do not have access to the files required to do a 
  392. conventional install, please contact me. I am interested in 
  393. making ZPM3 as universal as possible and will help you to install 
  394. it on your system.
  395.  
  396. The ESCAPE key is ignored by function 10. There has been some 
  397. lively discussion about this but the decision is final: it stays 
  398. ignored. Remember what function 10 is for and you will understand 
  399. why I made it ignore the ESCAPE key. The argument against this 
  400. has been from people who control their terminals from the command 
  401. line. Apparently some people type in an escape sequence at the 
  402. command line (which CP/M 3.0 will not output correctly anyhow 
  403. (converting the escape character to ^[)) then press return to 
  404. have the CCP echo back the line including the escape character.
  405.  
  406. Sorry folks, that is a KLUDGE in my books! Anybody using Z-System 
  407. would of course use an ALIAS and ECHO to do this properly, but 
  408. for those who will continue to complain that I have sacrificed 
  409. CP/M 3.0 compatibility I am now including ECHOTERM.COM to solve 
  410. your problems. Run it and whatever you type will be sent to the 
  411. terminal correctly after you press RETURN. Press RETURN twice to 
  412. exit the program.
  413.  
  414. And a reminder that the ability to put control characters into 
  415. function 10 lines was always limited by the fact that some 
  416. control keys were used to edit the command line. CP/M 3.0 added 
  417. even more, and ZPM3 uses virtually all the control keys. The few 
  418. that aren't used are ignored, and this is in fact a FEATURE which 
  419. guarantees that unusable characters can't get into function 10 
  420. lines by accident.
  421.  
  422.  
  423.  
  424.  
  425. LEGALS and SUCH
  426. ===============
  427. The ZPM3 package is supplied free of charge, on the condition 
  428. that you don't use it to make money. If you want to use it 
  429. commercially you must contact me to get the OK (and negotiate our 
  430. fee).
  431.  
  432. If you find anyone (except myself) charging money for ZPM3, 
  433. please inform me!
  434.  
  435. Nobody is making any guarantees about this software. None at all. 
  436. If it causes your house to burn down, or a divorce, or just a bad 
  437. day, this is unfortunate, regrettable, but there is nothing that 
  438. I can or will do about it. You have been warned.
  439.  
  440. The ZPM3 package must only be distributed in the form that you 
  441. found it. Do not change or add anything. Don't even change it 
  442. into a different type of archive. Just leave it alone. However 
  443. you are free to distribute it to as many places and people that 
  444. you can. Just don't charge for it.
  445.  
  446.  
  447.  
  448. If in using ZPM3 you find that it doesn't act as described, 
  449. please forward the details to me so that either the ZPM3 code or 
  450. the documentation can be changed. If you would like further 
  451. details, please forward your specific questions to me. SJC.
  452.  
  453.  
  454.  
  455.  
  456. As a service to all our ZPM3 fans, the latest version of the ZPM3 
  457. package can now be ordered. At this stage we can only supply IBM 
  458. formatted 3.5 inch 720k disks, however if you are keen enough 
  459. that shouldn't matter. ZPM3 remains free, however this service 
  460. will cost you $15 Australian (for the disk, copying, postage and 
  461. packing) to most places in the Western World (others by 
  462. arrangement).
  463.  
  464. This is a good way to guarantee you have the latest version, and 
  465. to guarantee that your package has not been corrupted by some 
  466. unscrupulous person.
  467.  
  468. When we fill your order, we will make sure to include the latest 
  469. demonstration copy of MYZ80 - the fastest and best Z80 emulator 
  470. for IBM AT (and better) compatibles. MYZ80 can run ZPM3 with 
  471. ease. It also handles ZCPR and CP/M 2.2. And yes, we do mean 
  472. FASTEST.
  473.  
  474. Send your international money order to:
  475.  
  476.           Software by Simeon
  477.           ZPM3 Package
  478.           2 Maytone Ave
  479.           Killara   NSW
  480.           Australia 2071
  481.  
  482. Your order will be promptly filled.
  483.