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 / JSAGE / ZSUS / PROGPACK / ZCPR-HLL.ART < prev    next >
Text File  |  2000-06-30  |  27KB  |  599 lines

  1. ========================================================================
  2.  
  3. This file contains transcripts of some articles which appeared on the
  4. Usenet (comp.os.cpm) between Dec 23, 1988, and Jan 12, 1989.  The
  5. discussion is about ways in which a high level language might learn
  6. about the Z-system environment in which it is operating, and developed
  7. into a plea for a formal system of passing this information.
  8.  
  9. My apologies for the lengthy headers on each message, but I thought it
  10. best to leave everything in context.
  11.  
  12. ========================================================================
  13.  
  14.  
  15. Relay-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site portal.UUcp
  16. Posting-Version: version 10.1 Portal gateway; site portal
  17. Path: portal!cup.portal.com!dgee
  18. From: dgee@cup.portal.com (David O Goodman)
  19. Newsgroups: comp.os.cpm
  20. Subject: Zcpr & High Level Languages
  21. Message-ID: <12879@cup.portal.com>
  22. Date: 23 Dec 88 18:32:09 GMT
  23. Date-Received: 23 Dec 88 18:33:19 GMT
  24. Distribution: world
  25. Organization: The Portal System (TM)
  26. Lines: 46
  27. Portal-Origin: Usenet
  28. Portal-Type: text
  29. Portal-Location: 1038.3.1415.1
  30.  
  31. Does anyone have suggestions for a graceful way in which to pass the
  32. address of a ZCPR 3.x environment descriptor to a program written in a
  33. high level language, so that the program can make use of the various ZCPR
  34. facilities?  Specifically, rather than hard-wiring the environment
  35. descriptor address into the program, thus making it non-portable, what
  36. would be a good way for a utility written in bds-c to learn the
  37. environment descriptor address?
  38.  
  39.  
  40. Discussion:
  41. ----------
  42.  
  43. As some of you know, an assembly language program using the zcpr
  44. environment is written with a header which tells the command processor
  45. that it is a 'Z3ENV' program.  At run time, the command processor plugs
  46. the environment descriptor address into a specific location in this
  47. header; now the program contains the address needed to get information on
  48. its environment.
  49.  
  50. Since the object code of a program compiled under bds-c starts with the
  51. bds runtime package, there seems to be no way to create the required
  52. header, other than (perhaps) relocating the runtime package and finding
  53. some way to link in a header underneath the package.  I have not yet
  54. played with this approach, but it does not seem very fruitful, since 1)
  55. the bds documentation indicates that all code must run directly above the
  56. runtime package, and 2) even if it could be done, relocating the runtime
  57. package would require a full reassembly and/or recompilation of the
  58. libraries, making them completely non-standard.
  59.  
  60. A second mechanism for communicating the environment descriptor address
  61. from the command processor to a transient program apparently exists.
  62. Inspection of the source code for ZCPR 3.3 (I haven't checked other
  63. versions, yet) reveals that when zcpr 'calls' the transient program,
  64. register pair HL contains the desired address.  However, upon entry into
  65. the runtime package, this register is immediately clobbered.
  66.  
  67. Any ideas, suggestions, or further discussion would be appreciated.  If I
  68. receive mail on this subject, I will summarize to the net.
  69.  
  70. Thanks.
  71.  
  72. --
  73.  
  74. Dave Goodman
  75. dgee@cup.portal.com
  76. ...sun!portal!cup.portal.com!dgee
  77.  
  78.  
  79. ========================================================================
  80.  
  81.  
  82. Relay-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site portal.UUcp
  83. Path: portal!atari!imagen!sun!decwrl!ucbvax!hplabs!hp-sdd!ncr-sd!crash!mwilson
  84. From: mwilson@crash.cts.com (Marc Wilson)
  85. Newsgroups: comp.os.cpm
  86. Subject: Re: Zcpr & High Level Languages
  87. Message-ID: <3649@crash.cts.com>
  88. Date: 26 Dec 88 04:53:26 GMT
  89. Date-Received: 27 Dec 88 08:27:11 GMT
  90. References: <12879@cup.portal.com>
  91. Reply-To: mwilson@crash.CTS.COM (Marc Wilson)
  92. Organization: Mesa College, San Diego, Ca.
  93. Lines: 37
  94. Keywords: ZCPR3 Z33 ENV HLL
  95. Portal-Origin: Usenet
  96. Portal-Type: text
  97. Portal-Location: 1038.3.1415.2
  98.  
  99. In article <12879@cup.portal.com> dgee@cup.portal.com (David O Goodman) writes:
  100. >Does anyone have suggestions for a graceful way in which to pass the
  101. >address of a ZCPR 3.x environment descriptor to a program written in a
  102. >high level language, so that the program can make use of the various ZCPR
  103. >facilities?
  104.  
  105.      The *easiest* way is to code a loop that begins at the top of memory
  106. and scans downwards for the string "Z3ENV".  As long as you're between the
  107. BIOS and the top of memory, the only place that that string should appear
  108. is at address ENV+3.  That'll give you the environment address.
  109.  
  110.      Note that this technique is *extremely* dangerous on any system that
  111. supports memory-mapped I/O ( i.e. Apple CP/M ), for obvious reasons.
  112.  
  113.      This technique is not new.  Several of the Z-System utilities include
  114. a routine called FENV.  This is the _F_ind _ENV_ironment routine, originally
  115. developed by Joe Wright.  The first program I saw use this technique was a
  116. version of LX.
  117.  
  118.      Note that this method *should* work under NZ-COM, as long as you use
  119. the address of the pseudo BIOS, rather than the real one.
  120.  
  121. >--
  122. >
  123. >Dave Goodman
  124. >dgee@cup.portal.com
  125. >...sun!portal!cup.portal.com!dgee
  126.  
  127.  
  128. -- 
  129. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  130. Marc Wilson
  131.      ARPA: ...!crash!mwilson@nosc.mil
  132.            ...!crash!pnet01!pro-sol!mwilson@nosc.mil
  133.      UUCP: [ cbosgd | hp-sdd!hplabs | sdcsvax | nosc ]!crash!mwilson
  134.      INET: mwilson@crash.CTS.COM
  135. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  136.  
  137.  
  138. ========================================================================
  139.  
  140.  
  141. Relay-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site portal.UUcp
  142. Path: portal!atari!imagen!sun!pitstop!sundc!seismo!uunet!lll-winken!lll-lcc!ames!pasteur!ucbvax!LL.ARPA!SAGE
  143. From: SAGE@LL.ARPA
  144. Newsgroups: comp.os.cpm
  145. Subject: Finding the Z Environment
  146. Message-ID: <SAGE.36247463@LL.ARPA>
  147. Date: 27 Dec 88 17:11:03 GMT
  148. Date-Received: 28 Dec 88 08:52:14 GMT
  149. Sender: daemon@ucbvax.BERKELEY.EDU
  150. Organization: The Internet
  151. Lines: 48
  152. Portal-Origin: Usenet
  153. Portal-Type: text
  154. Portal-Location: 1038.3.1419.1
  155.  
  156.  
  157.    Mark Wilson's proposed method for determining the Z3ENV address by
  158. scanning high memory is a suggestion in the right direction, but it ignores
  159. some very important details.  A program I tried using recently failed on my
  160. system because it used the very scheme Mark describes.
  161.  
  162.    ENV+3 is not the only place in memory where the string "Z3ENV" may occur. 
  163. On my system I have a directory with that name (it's where I work on the
  164. source code for the ENV module).  A user might have loaded that name into
  165. one of the four system file names in the message buffer.  There might be a
  166. reference to "Z3ENV" in a pending command line in the multiple command line
  167. buffer.  The disk deblocking buffers in the BIOS might happen to contain
  168. this string if a file had been accessed that contained that text.  In short,
  169. there are quite a few other places where such a string might appear.
  170.  
  171.    ONE CANNOT ASSUME THAT ANYTHING ONE IS LOOKING FOR IS UNIQUE!  It is
  172. always necessary to validate the address that one thinks is the ENV.  This
  173. can be done by looking at the word in offset 1BH in the assumed ENV
  174. descriptor.  That is where the ENV address itself is stored in the ENV. 
  175. This might have seemed redundant; after all, if you know where the ENV is,
  176. why do you need to look it up in the ENV?  This is one good reason.
  177.  
  178.    So, the strategy comes down to this.  Determine the range of memory to be
  179. scanned and the direction.  Then scan for the string "Z3ENV".  When it is
  180. found, assign an address 3 lower as the tentative ENV address.  Add 1BH to
  181. this, and see if the word there is the same ENV address.  If it is, you can
  182. be pretty sure that you have the ENV.  If not, continue the scan where you
  183. left off last time.
  184.  
  185.    There are probably various arguments that could be made as to what range
  186. of memory should be scanned and in which direction.  Joe Wright has
  187. experimented with putting Z-System modules (notably the FCP) in an RSX that
  188. lives not only below the BIOS but below the command processor.  To cover
  189. such a case, the lower bound in memory should probably be the bottom of
  190. protected memory, namely, the address stored at location 0006H.  From here
  191. one would have to scan up all the way to FF03H (the highest possible
  192. location for a two-record ENV descriptor).  Scanning up is probably safer
  193. than scanning down, I think, since it would be less likely to hit memory-
  194. mapped I/O before finding the ENV.
  195.  
  196.    I suppose there is always a slight chance that this procedure will detect
  197. the image of a different ENV descriptor whose file was examined and happens
  198. to be in the BIOS deblocking buffer.  It would be hard to prevent this kind
  199. of problem.  That memory image would, indeed, pass every test for an ENV
  200. module since it is, in fact, such a module.  However, this would be unlikely
  201. in general and virtually impossible if one has just loaded a transient
  202. program, since its code would be in the buffer.
  203.  
  204.  
  205. ========================================================================
  206.  
  207.  
  208. Relay-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site portal.UUcp
  209. Path: portal!atari!imagen!sun!pitstop!sundc!seismo!uunet!lll-winken!lll-lcc!ames!pasteur!agate!ucbvax!RAND.ORG!bridger%rcc
  210. From: bridger%rcc@RAND.ORG (Bridger Mitchell)
  211. Newsgroups: comp.os.cpm
  212. Subject: Passing Z3ENV to BDS-C
  213. Message-ID: <8812271905.AA06973@newton>
  214. Date: 27 Dec 88 19:05:13 GMT
  215. Date-Received: 28 Dec 88 14:07:51 GMT
  216. References: <8812250903.AA16431@rand.org>
  217. Sender: daemon@ucbvax.BERKELEY.EDU
  218. Organization: The Internet
  219. Lines: 70
  220. Portal-Origin: Usenet
  221. Portal-Type: text
  222. Portal-Location: 1038.3.1422.1
  223.  
  224. David O Goodman requested suggestions for passing the system's
  225. external environment address to a BDS-C or other high level
  226. language application.
  227.  
  228. This is a sketch of an approach that should be usable with most any
  229. existing .COM file.  It requires patching together the final .COM
  230. (after linking the BDS-C relocatable modules)j.
  231.  
  232. The standard Z-System application begins with this structure
  233. (addresses are when loaded to 0100h):
  234.  
  235.     0100:    jp    start        ; 
  236.     0103:    db    'Z3ENV',1    ; signature for ZCPR command processor
  237.     0109:    dw    0000        ; where ZCPR puts z3env address
  238.  
  239. When the ZCPR 3.3 or 3.4 command processor loads a COM file to 100h
  240. and finds the 'Z3ENV' signature at 103 it "installs" the z3env
  241. external environment address at 109.
  242.  
  243. Append a copy of the first 10 bytes of the linked .COM file to the end
  244. of the file.  Follow that with some startup code:
  245.  
  246.     image100:
  247.         ds    10
  248.  
  249.     start:    ld    hl,(0109)        ; save z3env address
  250.         ld    xxxx,hl            ; at a known, safe location
  251.         ld    hl,image100        ; restore the original
  252.         ld    de,100            ; code at 100
  253.         ld    bc,10
  254.         ldir
  255.         jp    100            ; and execute it
  256.  
  257. The address xxxx needs to be known, at compile/link time, 
  258. to your HLL routines.  On most systems 003Bh will be ok, just following
  259. the RST 38 jump location.  Another possibility is to check the BDS-C
  260. runtime library's locations for storing pointers to the parsed
  261. command line.  I remember there being room for perhaps 30 pointers; in
  262. almost any application the 30th should be free!
  263.  
  264. I believe this patching process can be largely automated into a ZEX
  265. script that loads a debugger, which then loads the .COM image, and
  266. finds the end of the image from the address of the external data area
  267. in the first bytes of the BDS-C header. The code above can the
  268. be assembled in the debugger, using a "load hl direct" instead
  269. of "ld hl, image100", and the 10 bytes moved with the debugger's
  270. Move command.
  271.  
  272. This approach should run on any Z-System, including Apples with
  273. "non-readable" high memories.  The C code should check the z3env value
  274. for non-zero before using it, for the cases in which the code runs on
  275. a non-ZCPR 3.3 or 3.4 system.  In fact, this test should really also
  276. fail if the patch itself has not been made to the linked BDS-C file.
  277. (That may be a good reason to choose a free NUL word inside the BDS-C
  278. library for the xxxx address).  And the startup code should be
  279. extended to include a Z-80 test.
  280.  
  281. When you have a smooth approach, please post an application note "for
  282. the rest of us"!
  283.  
  284. Marc Wilson suggested the approach of scanning high memory for the
  285. string 'Z3ENV'.  This technique, necessary for pre-ZCPR version 3.3
  286. systems, needs to be made rigorous.  After finding a match, the
  287. routine must check that the "self-reference" address in the z3env
  288. structure does, in fact, agree with the address at which the match has
  289. been found, and, if not, continue searching.  High memory may contain
  290. several Z3ENV strings -- a named directory, or the host disk buffer.
  291.  
  292.  
  293. -- bridger
  294.  
  295.  
  296. ========================================================================
  297.  
  298.  
  299. Relay-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site portal.UUcp
  300. Path: portal!atari!imagen!sun!pitstop!sundc!seismo!uunet!husc6!bbn!apple!well!bandy
  301. From: bandy@well.UUCP (Andrew Scott Beals)
  302. Newsgroups: comp.os.cpm
  303. Subject: Re: Passing Z3ENV to BDS-C
  304. Message-ID: <10150@well.UUCP>
  305. Date: 28 Dec 88 15:50:01 GMT
  306. Date-Received: 29 Dec 88 11:05:01 GMT
  307. References: <8812250903.AA16431@rand.org> <8812271905.AA06973@newton>
  308. Reply-To: bandy@well.UUCP (Andrew Scott Beals)
  309. Organization: Whole Earth 'Lectronic Link, Sausalito, CA
  310. Lines: 15
  311. Portal-Origin: Usenet
  312. Portal-Type: text
  313. Portal-Location: 1038.3.1422.2
  314.  
  315.  
  316. Have my eyes been deceiving me?
  317.  
  318. Everyone who owns a [legal] copy of BDS C knows that you get the source to
  319. "C.CCC", which is the run-time header that gets prepended to all .COM
  320. programs.  The solution is to simply take Bridger's code (jmp 10bh ! db
  321. 'ZENV3',1 ! dw 0) and put it at the head of the source to C.CCC (sorry I
  322. can't do this for you, as I'm at the office and not at home - GNUUCP doesn't
  323. work on my system yet) and use the ZCPR3-compatible C.CCC file with your
  324. programs that know to check for the signature bytes at 103h.
  325.  
  326.     andy
  327. -- 
  328. for those of you who don't trust the headers:
  329. bandy@lll-crg.llnl.gov or {pacbell,lll-winken,hoptoad,hplabs,apple}!well!bandy
  330.  
  331.  
  332. ========================================================================
  333.  
  334.  
  335. Relay-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site portal.UUcp
  336. Posting-Version: version 10.1 Portal gateway; site portal
  337. Path: portal!cup.portal.com!dgee
  338. From: dgee@cup.portal.com (David O Goodman)
  339. Newsgroups: comp.os.cpm
  340. Subject: Zcpr & HLLs - Summary (long)
  341. Message-ID: <13221@cup.portal.com>
  342. Date: 5 Jan 89 11:26:17 GMT
  343. Date-Received: 5 Jan 89 11:26:12 GMT
  344. Distribution: na
  345. Organization: The Portal System (TM)
  346. Lines: 136
  347. Portal-Origin: Usenet
  348. Portal-Type: text
  349. Portal-Location: 1038.3.1434.1
  350.  
  351. Recently, in article <12879@cup.portal.com>, I inquired:
  352. > Does anyone have suggestions for a graceful way in which to pass the
  353. > address of a ZCPR 3.x environment descriptor to a program written in a
  354. > high level language, so that the program can make use of the various ZCPR
  355. > facilities?  Specifically, rather than hard-wiring the environment
  356. > descriptor address into the program, thus making it non-portable, what
  357. > would be a good way for a utility written in bds-c to learn the
  358. > environment descriptor address?
  359. > ...
  360. > Any ideas, suggestions, or further discussion would be appreciated.  If I
  361. > receive mail on this subject, I will summarize to the net.
  362.  
  363. Most of the comments received were public postings, so  I won't quote them
  364. extensively.
  365.  
  366. Apparently, according to the collective wisdom of the net, there is no
  367. formal mechanism for passing a pointer to the environment descriptor (ENV)
  368. to a program written in an HLL.  Should such a mechanism exist?  More on
  369. that latter.
  370.  
  371. Several different approaches were mentioned, some of which were generally
  372. applicable to any language, and some of which were peculiar to bds-c.
  373.  
  374.  
  375. I. Find the environment descriptor by searching memory for the identifying
  376. string 'Z3ENV'.
  377.  
  378.   Marc Wilson (mwilson@crash.cts.com) in <3649@crash.cts.com> wrote:
  379.   >      The *easiest* way is to code a loop that begins at the top of memory
  380.   > and scans downwards for the string "Z3ENV".  As long as you're between the
  381.   > BIOS and the top of memory, the only place that that string should appear
  382.   > is at address ENV+3.  That'll give you the environment address.
  383.   >
  384.   >      Note that this technique is *extremely* dangerous on any system that
  385.   > supports memory-mapped I/O ( i.e. Apple CP/M ), for obvious reasons.
  386.  
  387.   Both Jay Sage (SAGE@LL.ARPA) and Bridger Mitchell (bridger%rcc@RAND.ORG)
  388.   pointed out that a simple memory search is not sufficient, since 'Z3ENV'
  389.   could exist at other locations than the ENV, (named directory buffer,
  390.   disk i/o buffers, etc).  They mentioned that if this technique is used,
  391.   a check should be made to be sure the ENV address indicated by the
  392.   search agrees with the self-contained address at ENV+1Bh.
  393.  
  394.   I used this technique several years ago for a few programs, but finally
  395.   rejected it because it is not bulletproof.  As Marc Wilson mentioned,
  396.   the search can produce very interesting results on any system with
  397.   memory mapped i/o; that alone seems sufficient reason to reject it for
  398.   any program meant for general distribution.
  399.  
  400.  
  401. II. Write a module, perhaps ASM or a C structure, which mimics the z3env
  402. header, then jumps to the runtime package entry point; link this module in
  403. at the correct address.
  404.  
  405.   Several good folks from whom I received mail suggested this approach.
  406.   The catch, of course, is linking such a module at the correct address.
  407.   I don't see that one has that option.  I'm no authority on HLLs as run
  408.   under cp/m, but since the final binary must start execution at 100h,
  409.   would not a designer place the runtime package/initialization code at
  410.   that address?
  411.  
  412.  
  413. III. Compile and link in the usual way; hand patch the final binary by
  414. moving the first few bytes (where the Z3 header goes) to the end of the
  415. file, together with a mover routine.  Patch a Z3 header in the space thus
  416. left at the beginning.  At run time, pick up the ENV pointer from the
  417. header, store it at some fixed location, move the first few bytes back to
  418. the beginning of the file, and jump to the beginning.
  419.  
  420.   This ingenious idea came from Bridger Mitchell (bridger%rcc@RAND.ORG).
  421.   It is certainly generally applicable, not only to bds-c, but to any .COM
  422.   file.  The only negative is the rather kludgy way in which the final
  423.   binary must be put together, but even that could be automated, as
  424.   Bridger points out, with a ZEX script.
  425.  
  426.  
  427. IV. Incorporate a Z3 header in CCC.ASM, the source code for the bds-c
  428. runtime package.  Assemble to a customized runtime package (C.CCC) to be
  429. used with ZCPR.
  430.  
  431.   Andrew Scott Beals (bandy@well.UUCP) in <10150@well.UUCP> wrote:
  432.   > Have my eyes been deceiving me?
  433.   >
  434.   > Everyone who owns a [legal] copy of BDS C knows that you get the source to
  435.   > "C.CCC", which is the run-time header that gets prepended to all .COM
  436.   > programs.  The solution is to simply take Bridger's code (jmp 10bh ! db
  437.   > 'ZENV3',1 ! dw 0) and put it at the head of the source to C.CCC ...
  438.  
  439.   No, Andy, your eyes haven't been deceiving you!  And yes, I own a legal
  440.   copy of bds-c!
  441.  
  442.   Andy's suggestion makes a lot of sense, though it is applicable to bds-c
  443.   only, and is not a general solution to the problem of Zcpr/HLLs.  It was
  444.   also my first tentative solution to the problem, before posting my
  445.   inquiry.  It can perhaps be done, but it is not quite as simple as Andy
  446.   suggests, and has a few disadvantages.
  447.  
  448.   According to the documentation (I haven't actually tried this, yet), and
  449.   without going into excessive detail, that part of the standard library
  450.   which is written in C would have to be recompiled, using a new standard
  451.   header which accorded with the new C.CCC.  That part of the library
  452.   written in assembly language would have to be reassembled, as most such
  453.   functions reference absolute addresses in the runtime package.  So, now
  454.   we have a second, non-standard set of libraries and a second,
  455.   non-standard runtime package, different files with identical names, and
  456.   we must remember to get the right pieces of the right package when we
  457.   put it all together at 4:00 AM!
  458.  
  459.   Also, the linker (CLINK) plugs certain information into absolute
  460.   addresses in C.CCC.  This can be worked around by using various linker
  461.   options; unfortunately using those options deprives us of the
  462.   possibility of using the -n (no warm boot) option, which allows the
  463.   application to simply 'return' rather than warm booting.
  464.  
  465.   Nevertheless, this could work for bds-c.
  466.  
  467.  
  468. Without getting into a debate on the side-issue of assembly language vs
  469. high-level language programming for cp/m, a few thoughts come to mind.
  470.  
  471. Cp/m has come a long way since plain vanilla cp/m 2.2, and offers many
  472. more advanced facilities.  The environment descriptor is fundamental to
  473. making use of these facilities.  If we were designing the operating system
  474. from scratch, no doubt the environment descriptor address would be
  475. available from a system call.
  476.  
  477. This could not be done when we had only the Digital Research bdos.  Now,
  478. however, we have a whole new generation of bdos replacements being used in
  479. our 'Z' systems.  Would it not be appropriate to consider incorporating a
  480. system call which returns a pointer to ENV in these new bdos's?
  481.  
  482. --
  483.  
  484. Dave Goodman
  485. dgee@cup.portal.com
  486. ...sun!portal!cup.portal.com!dgee
  487.  
  488.  
  489. ========================================================================
  490.  
  491.  
  492. Relay-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site portal.UUcp
  493. Path: portal!atari!imagen!sun!amdcad!ames!pasteur!ucbvax!LL.ARPA!SAGE
  494. From: SAGE@LL.ARPA
  495. Newsgroups: comp.os.cpm
  496. Subject: ZCPR and HLLs
  497. Message-ID: <SAGE.01053864@LL.ARPA>
  498. Date: 10 Jan 89 18:57:44 GMT
  499. Date-Received: 11 Jan 89 15:14:24 GMT
  500. Sender: daemon@ucbvax.BERKELEY.EDU
  501. Organization: The Internet
  502. Lines: 28
  503. Portal-Origin: Usenet
  504. Portal-Type: text
  505. Portal-Location: 1038.3.1447.1
  506.  
  507.  
  508.    There is one comment about gaining access to Z-System facilities with
  509. programs written in high level languages that I neglected to make earlier. 
  510. There is, in a weak sense, an operating system call that returns the ENV
  511. address.  The ZCPR command processor since version 3.3 has placed the
  512. environment address in the HL register on entry to a program.  If the high
  513. level language allows the user to gain control before some initialization
  514. package loses the information in HL, then this can be used (but, as always,
  515. should be validated before it is trusted).  This is essentially a
  516. modification of Bridger's patch suggestion or the suggestion of recoding
  517. C.CCC.  It is much easier just to save the contents of HL than it is to
  518. create the whole Z header as Bridger described.  Such a program, however,
  519. will fail with versions of ZCPR before 3.3.  BackGrounder ii has supported
  520. this facility from the beginning, however, and will work fine.
  521.  
  522.    Having a real DOS call is a very interesting idea.  Perhaps the DOS
  523. version function call could return the ENV address as well.  The problem is
  524. that the new DOSs may already be absolutely full, with no spare bytes for
  525. this.  But it is certainly a suggestion worth passing along to the authors. 
  526. Also, if you are using one of the public-domain DOSs (Z80DOS, P2DOS,
  527. NOVADOS), then you can try putting it in yourself.
  528.  
  529.    Another possibility is to load an RSX that would provide this extended
  530. service.  The roughly 2K memory cost might, however, be too much to pay.  It
  531. might be an interesting and easy way to experiment, however.
  532.  
  533. -- Jay
  534.  
  535.  
  536. ========================================================================
  537.  
  538.  
  539. Relay-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site portal.UUcp
  540. Posting-Version: version 10.1 Portal gateway; site portal
  541. Path: portal!cup.portal.com!dgee
  542. From: dgee@cup.portal.com (David O Goodman)
  543. Newsgroups: comp.os.cpm
  544. Subject: ZCPR and HLLs
  545. Message-ID: <13471@cup.portal.com>
  546. Date: 12 Jan 89 23:39:54 GMT
  547. Date-Received: 12 Jan 89 23:39:55 GMT
  548. References: <SAGE.01053864@LL.ARPA>
  549. Distribution: na
  550. Organization: The Portal System (TM)
  551. Lines: 43
  552. Portal-Origin: Usenet
  553. Portal-Type: text
  554. Portal-Location: 1038.3.1447.2
  555.  
  556. In article <SAGE.01053864@LL.ARPA> SAGE@LL.ARPA writes:
  557.     
  558. > There is, in a weak sense, an operating system call that returns the ENV
  559. > address.  The ZCPR command processor since version 3.3 has placed the
  560. > environment address in the HL register on entry to a program.  If the high
  561. > level language allows the user to gain control before some initialization
  562. > package loses the information in HL, then this can be used (but, as always,
  563. > should be validated before it is trusted).  ...
  564.  
  565. The problem, or course, is that the IF ("if the high level language..."), 
  566. is a very big IF indeed!  It seems to me that most HLLs running 
  567. under cp/m must, of necessity, have the entry to their initialization 
  568. routines at 100h, where they will execute before any routine the 
  569. programmer provides.
  570.  
  571. >   Having a real DOS call is a very interesting idea.  Perhaps the DOS
  572. > version function call could return the ENV address as well.  The problem is
  573. > that the new DOSs may already be absolutely full, with no spare bytes for
  574. > this.  But it is certainly a suggestion worth passing along to the authors. 
  575.  
  576. The suggestion was a system call which would return the ENV address.  It 
  577. seems to me that this would provide a standardized way for any program, 
  578. ASM or HLL, to obtain the information.  Presumably, the present system 
  579. would also have to be maintained for backward compatibility.
  580.  
  581. But the present system is really, with all due respect to Jay, a kludge, 
  582. albeit an ingenious one.  When ZCPR 3.0 was written, the Cp/m world was 
  583. stuck with the Digital Research bdos, so another way had to found to 
  584. transfer the ENV address to a transient program.  Z3INS was the answer; 
  585. and under ZCPR 3.3/3.4 Jay ingeniously converted the original installation 
  586. system to an auto-install system.
  587.  
  588. Now, however, we have alternatives to the Digital Research bdos, and one 
  589. or the other of these alternatives are probably going to be used on most 
  590. up to date systems.  We expect to be able use calls such as #27 (return 
  591. ALLOC address), #31 (return DPB address); what is conceptually different 
  592. about call #nn (return ENV address)?
  593.  
  594. --
  595.  
  596. Dave Goodman
  597. dgee@cup.portal.com
  598. ...sun!portal!cup.portal.com!dgee
  599.