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 / CPM / ZCPR33 / TCJ / TCJ34.MAG < prev    next >
Text File  |  2000-06-30  |  24KB  |  509 lines

  1. For this issue I am going to live up to a long-standing tradition: once
  2. again I am not going to cover the material that I said I was.  Last time I
  3. presented half the new material on ARUNZ and said I would cover the second
  4. half this time.  Well, I am not going to.  ARUNZ is now up to version 'N'
  5. (it was 'J' last time).  Until it settles down a bit, it is probably futile
  6. to try to describe it.    Besides that, I am getting a little bored with the
  7. subject (though obviously not with the program), and perhaps you are, too.
  8.  
  9. Though living up to tradition, I am going to reverse a trend.  For some time
  10. now my columns have been getting longer and longer.  This time I really am
  11. going to write a short one.  Besides the fact that because of me Art Carlson
  12. is apparently running low on printer's ink, I am just about written out,
  13. having just completed the manuals for NZ-COM and Z3PLUS.
  14.  
  15.  
  16.                  NZ-COM and Z3PLUS
  17.  
  18. Those manuals started out being simple affairs, but I just don't seem to be
  19. able to get my obsession with thoroughness and completeness under control,
  20. and they soon turned into full-fledged books about the respective product
  21. and Z-System in general.  I've been burning the midnight (actually, 2 am)
  22. oil for the past two or three months.  Each manual now runs about 80 pages!
  23. No wonder I don't have many words left in my system at this point.
  24.  
  25. Though somewhat reluctant to indulge in self-praise, I have to say that the
  26. manuals are really quite good, and the products (NZ-COM and Z3PLUS) are
  27. absolutely fantastic.  Joe Wright (NZ-COM), Bridger Mitchell (Z3PLUS), and I
  28. have had a very enjoyable and highly productive partnership in this effort.
  29. I sincerely urge you all to buy the automatic, universal, dynamic Z-System
  30. appropriate for your computer: NZ-COM for CP/M-2.2 computers and Z3PLUS for
  31. CP/M-Plus computers.  Both are $69.95 from Sage Microsystems East,
  32. Plu*Perfect Systems, or Alpha Systems (see ads in TCJ).
  33.  
  34. After the experience bringing these products to market, I will no longer
  35. laugh so heartily when I hear stories about Borland or Lotus or Ashton-Tate
  36. not delivering their products on the promised dates.  Hopefully you have
  37. lost your TCJ issue #32 and have forgotten that I wrote there, and I quote:
  38. "By the time you read this, they will definitely be available."  In issue
  39. #33 I said, "the two new dynamic Z-Systems that will have been released by
  40. the time you read this."  That almost made a double liar out of me. Luckily,
  41. issue #33 was delivered just enough behind schedule to let that statement
  42. squeak through -- barely.
  43.  
  44. With respect to NZ-COM, Joe Wright and I have agreed to publicly blame each
  45. other for the delay.  Actually, following common practice, we originally
  46. both agreed to blame Bridger Mitchell, though he, of course, had nothing to
  47. do with the NZ-COM delay (Z3PLUS is another story).  However, now that
  48. Bridger has a TCJ column, too, we worried that such a slander might not go
  49. unanswered.  Anyway, Joe can blame me for not getting the manual done on
  50. time, and I can blame Joe for not writing the code to conform to my
  51. description of it in the manual!  You can readily see that no one should
  52. ever get involved in a product development all by himself.  Always make sure
  53. there is someone else to blame.
  54.  
  55. The truth of the matter is that we really thought the coding was complete by
  56. early April and that a simple manual could be knocked off in a week
  57. (naive!!).  In fact, as I alluded to above, the scope of the manual kept
  58. expanding.  At the same time, as we attempted to describe the programs very
  59. precisely, we discovered a number of deficiencies in the code.    Some coding
  60. limitations that we thought we would accept in the current version of NZ-COM
  61. and would upgrade later just didn't seem acceptable any more once we wrote
  62. them down on paper.  As a result, we have really skipped version 1 of NZ-COM
  63. and have gone directly to version 2.  There are quite a few exciting new
  64. features beyond what I described in issue #32; many will appeal especially
  65. to those with a penchant for the unconventional (but I won't say any more
  66. about them now).
  67.  
  68.  
  69.                PRL Files and Type-4 Programs
  70.  
  71. One of the new features introduced with ZCPR34 is the type-4 program.  A
  72. number of questions have been appearing in messages on Z-Nodes, so I thought
  73. I would say a few words on this subject.
  74.  
  75. Just to refresh your memory, ordinary CP/M program files are loaded
  76. beginning at an address of 100H.  This was also true of Z-System programs.
  77. They differ from standard CP/M programs in that the code starts with a
  78. special header.  One item in the header is the text string 'Z3ENV' beginning
  79. with the fourth byte of the program.  This string is used to identify the
  80. program as a Z-System program.
  81.  
  82. After the text string comes a number, now called the program type
  83. identifier. If the number is 2, then the so-called environment descriptor is
  84. included in the first page of the program file.  These type-2 programs are
  85. rarely seen today.  If the number is 1, then the program was designed to run
  86. in a ZCPR3 system with a permanent operating system memory buffer containing
  87. the environment descriptor.  The program only has to store the address of
  88. that descriptor, and it can then adapt to any system in which it is run.
  89.  
  90. The environment or ENV address is stored in the two bytes immediately
  91. following the program type byte.  Prior to ZCPR version 3.3, the address had
  92. to be installed into programs using a utility like Z3INS before they could
  93. be used.  Starting with ZCPR33, the command processor installs the value as
  94. part of the process of loading the file from disk.
  95.  
  96. With ZCPR33, the type-3 program was introduced.  These programs are not
  97. limited to execution at 100H, as all previous programs had been.  The two
  98. bytes after the ENV address contain the address at which the code is
  99. designed to run.  The Z33 command processor examines the program type byte,
  100. and if it is 3, it reads the load address from the header and proceeds to
  101. load the program to the designated address and execute it there.
  102.  
  103. The type-3 program made it possible to load and run programs at addresses
  104. other than 100H, but the address at which any given program file would run
  105. was still fixed.  In his column in the last issue, Bridger Mitchell
  106. described a fascinating and remarkable program structure that allows a
  107. program to run at whatever address it is loaded to.  That same idea is the
  108. basis for the new type-4 program.  Bridger's ANYWHERE program could be
  109. loaded manually to any address and then executed.  Type-4 programs are
  110. loaded automatically by the command processor to the highest address in
  111. memory at which they can run without overwriting the command processor or
  112. any resident system extension (RSX) that is present.  I would like to
  113. provide some additional details on how type-4 programs work and how they are
  114. constructed.
  115.  
  116. As with ANYWHERE, type-4 programs are derived from so-called (and, as
  117. Bridger pointed out, mis-named) page-relocatable or PRL files.    Bridger
  118. defined and described those files in his column in the last issue, but
  119. another shot at it probably won't hurt.  I will approach the subject
  120. somewhat differently -- with a concrete example.  Consider the short and
  121. simple program in Listing 1.  It is set up for a starting address of 100H.
  122. Fig. 1 shows the binary image of the sort one would see if the program were
  123. loaded with a debugger (e.g., DDT) and displayed.
  124.  
  125. If we change the argument of the ORG directive from 100H to 200H and
  126. assemble again, we get the results shown in Listing 2 and Fig. 2.  You
  127. should examine those results and note the things that have stayed the same
  128. and the things that have changed.  Note in particular that only three bytes
  129. in the code have actually changed.  One is the high order byte of the
  130. address of the initial jump instruction.  The destination of that jump is in
  131. the program, and, since the program has moved up by 100H, the jump address
  132. has increased by an identical amount.  The second change is in the data word
  133. containing the entry point address.  Obviously that address changes when the
  134. program origin is changed.  The third change is in the value loaded into the
  135. DE register pair.  It is the address of the message string, which is
  136. likewise a part of the program.
  137.  
  138. Note that the argument of the jump to DOS has not changed.  It is an
  139. absolute address outside the program.  Therefore, it does not change.
  140.  
  141. Now let's look at a PRL file for the same program.  I am not aware of any
  142. assemblers that can produce a PRL file directly.  The usual procedure is to
  143. remove the ORG statement from the source code, assemble the program to a REL
  144. (normal relocatable format), and then use a linker to generate the PRL file
  145. from the REL file.  Fig. 3 shows the binary image of a PRL file produced
  146. using the SLR virtual-memory linker SLRNK+.  Unfortunately, inexpensive
  147. linkers, such as SLRNK and ZLINK, are not able to produce PRL files.  Later
  148. we will show you a method, though somewhat tedious, that allows you to
  149. construct a reasonable approximation to a PRL file using an ordinary
  150. assembler (no linker at all).
  151.  
  152. SLRNK+ actually cannot produce a PRL directly using the source code as
  153. listed.  The SLR manual discusses in a somewhat opaque way the technique for
  154. generating a correct PRL file.    The problem is that the one-page nearly
  155. empty header at the beginning of the program is not generated.    Joe Wright
  156. invented the trick of linking in the file SLR.REL derived by assembling
  157. source code with the sole statement
  158.  
  159.     DS    256
  160.  
  161. This allocates one page of memory.  The PRL file is produced by the linker
  162. command
  163.  
  164.     SLRNK+ TEST/K,SLR,TEST,/E
  165.  
  166. The term "TEST/K" defines the output file, the term "SLR" allocates the
  167. empty header, and the term "TEST" links in the actual program code.
  168.  
  169. You should notice in Fig. 3 the following things.  First, the PRL file
  170. begins with a one-page header, which is entirely zero except for a word at
  171. address 101H (you can't tell from this example that it is a word, but it
  172. is).  This word is the length of the code, 001BH or 27 decimal in this
  173. example.  The program code itself begins on the next page (200H) and is the
  174. same as the code in Fig. 1.
  175.  
  176. The other new bytes in the PRL file are those that follow the last byte of
  177. the program code.  These bytes comprise the relocation bitmap that Bridger
  178. Mitchell described in his column in the previous issue of TCJ.    The first
  179. byte is 20H, which expanded to binary is 00100000.  This means that the
  180. third byte in the program code is the high byte of an address that must be
  181. relocated to make the program code execute at an address other than 100H.
  182. Indeed, the third byte is the address to which the JP instruction jumps. The
  183. second byte in the bitmap is 08H or 00001000 binary.  This tells us that the
  184. 13th byte in the program code is an address that has to be relocated when
  185. the program is relocated.  Indeed, this is the address of the start of the
  186. program in the Z-header.  The third byte in the bitmap is 01H or 00000001
  187. binary.  It tells us that byte 23 is an address.  If we look carefully, this
  188. is the address part of the "LD DE,MSG" instruction.
  189.  
  190.  
  191. How Does ZCPR34 Load and Execute a Type-4
  192.  
  193. Bridger Mitchell explained last time in some detail how a PRL file can be
  194. relocated to run at any address.  It really is not necessary to understand
  195. all the details.  The basic idea is that the bitmap tells a loader which
  196. bytes in the code to adjust.
  197.  
  198. The Z34 command processor has a special mechanism for processing type-4
  199. programs.  After the command processor has located a transient program, it
  200. loads the first record of the file into the default buffer at 80h.  Here it
  201. can examine it to see what kind of program it is.  If it is a standard CP/M
  202. program or a type-1 or type-2 Z-System program, it sets up the load address
  203. as 100H and proceeds to load the entire file into memory, starting over with
  204. the first record.  If it is a type-3 program, the same procedure is followed
  205. except that the load address is extracted from the program header.
  206.  
  207. With the type-4 program things are not so simple, because the load address
  208. has to be calculated and the code has to be relocated.    Z34 gets these tasks
  209. accomplished in a very clever and tricky way.  It could have done all the
  210. work itself, but that would have added a lot of code to the command
  211. processor.  Instead, we took advantage of the fact that a PRL file has that
  212. two-record header with almost nothing in it.  To make a type-4 program, we
  213. overlay onto this header a special loader program.  Z34 executes the code
  214. there to calculate the load address and then to perform the code relocation.
  215.  
  216. The loader is available in HEX format (TYP4LDR.HEX) and can be grafted onto
  217. the PRL file using the command
  218.  
  219.     MLOAD file=file.PRL,TYP4LDR
  220.  
  221. where 'file' is the name of the PRL file that you want to convert to a type-
  222. 4 executable file.
  223.  
  224. By putting the loader code in the program rather than in the command
  225. processor, we provide additional flexibility.  TYP4LDR calculates the
  226. highest address in the TPA to which a program can be loaded, but other
  227. loaders could return the address of the RCP or FCP and make possible self-
  228. installing modules.  Clever users will undoubtedly come up with some other
  229. interesting applications that use special header code.
  230.  
  231.  
  232. How Do We Make a PRL File
  233.  
  234. The easiest way to make a PRL file and from that a type-4 program is with a
  235. capable linker like LINK from Digital Research or SLRNK+ from SLR Systems.
  236. LINK came with my CP/M-Plus computer; I do not know how much it costs or how
  237. to obtain it otherwise.  SLRNK+, which offers many very useful and powerful
  238. features besides the ability to make PRL files, costs $195.  For someone who
  239. wants to experiment casually with type-4 programming, this is probably too
  240. much money to spend.  If you are not going to do it very often and don't
  241. mind a little work, you can hand craft a PRL file using a debugger like DDT.
  242. I will take you through the procedure using our sample program from Listing
  243. 1.
  244.  
  245. Making the bitmap is the hard part of the procedure.  You should key in the
  246. program called MAKEPRL.Z80 in Listing 3 and assemble it to a HEX file.    We
  247. will use that code in the debugger first to make a "byte-map" and then to
  248. convert the byte-map into a bitmap.  We assume that we have already
  249. assembled versions of the program with ORGs of 100H and 200H.
  250.  
  251. To construct the PRL file, we invoke the debugger (assumed to be DDT) and
  252. issue the commands shown in Fig. 4.  The first pair of commands loads the
  253. utility program MAKEPRL.  The next two lines load the version of our program
  254. that was assembled to run at 100H.  At this point we have to note the "next
  255. load address" reported by the debugger (I suggest you write it down).  Now
  256. we load the version of the program assembled to run at 200H so that it
  257. follows right on the end of the 100H version.  To do this, we use an offset
  258. value in the "R" command that is 100H lower than the "next address" that was
  259. reported a moment ago.
  260.  
  261. There is one other very important step we need to perform at this point.
  262. MAKEPRL has to be told the address at which the second program image was
  263. loaded.  The value is patched in at address 10EH using the commands shown in
  264. Fig. 4 starting with "S10E".  For our example program, the next address is
  265. reported as 0280.  Therefore, low-nextaddr is 80 and the high-nextaddris 02.
  266.  
  267. Now we let MAKEPRL do the hard part by running it with the "G" command. When
  268. it is finished, we need to examine the value in the HL register, since it
  269. tells us the next address after the bitmap.  After leaving DDT we have to
  270. save the code image from 100H up to but not including that address.  For the
  271. example program, the value in HL is reported to be 290H.  Since we are
  272. presumably running Z34 and have the type-4 SAVE program, we save the result
  273. using the command
  274.  
  275.     SAVE 100-28F PRLTEST.COM
  276.  
  277. If you do not have the type-4 SAVE,you will have to calculate the number of
  278. sectors to save.
  279.  
  280. Fig. 4 lists one DDT command that we did not discuss.  The "F103,1FF,0"
  281. command fills the part of the header after the code size word with zeros.
  282. This makes the file look prettier, but it is not absolutely necessary,
  283. especially if you are later going to overlay the type-4 loader as described
  284. below.
  285.  
  286. The PRL files made this way can be used to make type-4 programs, and they
  287. can be used in Bridger Mitchell's ANYWHERE program.  However, we should
  288. point out that these PRL files are not as efficient as those produced by a
  289. linker.  We assumed that the code in the COM files extended to the end of
  290. the last record in the file.
  291.  
  292. Perhaps you can build on my simple method and figure out how to extend it to
  293. produce an optimal PRL file just like the one from SLRNK+.  It would also
  294. not be too difficult to write a program using routines in SYSLIB to read in
  295. the pair of COM files and generate a PRL file from them completely
  296. automatically.    The most elegant method for doing this would use random-
  297. record writes.    I invite readers to send me such a program.
  298.  
  299. =============================================================================
  300.  
  301.     00 01 02 03    04 05 06 07    08 09 0A 0B    0C 0D 0E 0F
  302. -------------------------------------------------------------------
  303. 0100    C3 13 01 5A    33 45 4E 56    03 00 00 00    01 48 65 6C
  304. 0110    6C 6F 24 0E    09 11 0D 01    C3 05 00
  305.  
  306. Fig. 1.  Binary image of the sample program in Listing 1.
  307.  
  308. =============================================================================
  309.  
  310.     00 01 02 03    04 05 06 07    08 09 0A 0B    0C 0D 0E 0F
  311. -------------------------------------------------------------------
  312. 0100    C3 13 02 5A    33 45 4E 56    03 00 00 00    02 48 65 6C
  313. 0110    6C 6F 24 0E    09 11 0D 02    C3 05 00
  314.  
  315. Fig. 2.  Binary image of the sample program in Listing 1 when linked to run
  316. at a starting address of 200H and loaded at 100H.
  317.  
  318. =============================================================================
  319.  
  320.     00 01 02 03    04 05 06 07    08 09 0A 0B    0C 0D 0E 0F
  321. -------------------------------------------------------------------
  322. 0100    00 1B 00 00    00 00 00 00    00 00 00 00    00 00 00 00
  323. 0110    00 00 00 00    00 00 00 00    00 00 00 00    00 00 00 00
  324.  
  325. 0200    C3 13 01 5A    33 45 4E 56    03 00 00 00    01 48 65 6C
  326. 0210    6C 6F 24 0E    09 11 0D 01    C3 05 00 20    08 01 00
  327.  
  328. Fig. 3.  Binary image of PRL file produced for the same test program and
  329. loaded at address 100H.  Some memory regions containing bytes of 00 have
  330. been omitted from the display here.
  331.  
  332. =============================================================================
  333.  
  334.     IMAKEPRL.HEX<cr>    ; Ready to load PRL maker routine
  335.     R,<cr>            ; Load it to address 100h
  336.     ITEST100.COM<cr>    ; Ready to load program ORGed for 100h
  337.     R100<cr>        ; Load it to address 200h (offset 100)
  338.     ITEST200.COM<cr>    ; Ready to load program ORGed for 200h
  339.     R<nextaddr-100><cr>    ; Load it to proper offset
  340.     s10E<cr>        ; Ready to patch in code size
  341.     low-nextaddr<cr>    ; Low byte of code size
  342.     high-nextaddr<cr>    ; High byte of code size
  343.     .<cr>            ; End patch with period
  344.     G<cr>            ; Run MAKEPRL code at 100h
  345.     X<cr>            ; Display registers -- note value of HL
  346.     F103,1FF,0        ; Clean up the header area
  347.     G0<cr>            ; Exit from DDT
  348.  
  349. Figure 4.  Commands issued to DDT to produce a PRL file from two COM files
  350. assembled to run at addresses of 100h and 200h.
  351.  
  352. =============================================================================
  353.  
  354. Z80ASM SuperFast Relocating Macro Assembler    Z80ASM 1.31 Page   1
  355. PRLTEST Z80
  356.  
  357.     1          0100        org    100h
  358.     2
  359.     3 0100        entry:
  360.     4 0100  C3 0113        jp    start
  361.     5
  362.     6 0103  5A 33 45 4E     db    'Z3ENV'
  363.     7 0108  03            db    3
  364.     8 0109  0000        dw    0
  365.     9 010B  0100        dw    entry
  366.    10
  367.    11 010D  48 65 6C 6C msg:    db    'Hello','$'
  368.    12
  369.    13 0113        start:
  370.    14 0113  0E 09        ld    c,9
  371.    15 0115  11 010D        ld    de,msg
  372.    16 0118  C3 0005        jp    0005h
  373.    17
  374.    18                end
  375.  0 Error(s) Detected.
  376.  27 Absolute Bytes. 3 Symbols Detected.
  377.  
  378. Listing 1.  Simple example program assembled for a load address of 100H.
  379.  
  380. =============================================================================
  381.  
  382. Z80ASM SuperFast Relocating Macro Assembler    Z80ASM 1.31 Page   1
  383. PRLTEST Z80
  384.  
  385.     1          0200        org    200h
  386.     2
  387.     3 0200        entry:
  388.     4 0200  C3 0213        jp    start
  389.     5
  390.     6 0203  5A 33 45 4E     db    'Z3ENV'
  391.     7 0208  03            db    3
  392.     8 0209  0000        dw    0
  393.     9 020B  0200        dw    entry
  394.    10
  395.    11 020D  48 65 6C 6C msg:    db    'Hello','$'
  396.    12
  397.    13 0213        start:
  398.    14 0213  0E 09        ld    c,9
  399.    15 0215  11 020D        ld    de,msg
  400.    16 0218  C3 0005        jp    0005h
  401.    17
  402.    18                end
  403.  0 Error(s) Detected.
  404.  27 Absolute Bytes. 3 Symbols Detected.
  405.  
  406. Listing 2.  Simple example program assembled for a load address of 200H.
  407.  
  408. =============================================================================
  409.  
  410. ; This code, which assists in the generation of a PRL file from a pair of COM
  411. ; files assembled for execution at 100H and 200H, is by no means optimized for
  412. ; speed or size.  I have tried to optimize it for clarity!
  413.  
  414.     org    100h
  415.  
  416.     db    0        ; Standard PRL header (and NOP)
  417. size:    dw    0        ; PRL file size (filled in by code)
  418.  
  419.     jp    start
  420.  
  421.     db    'CODE200:'    ; Identification string
  422. c200:
  423.     dw    0        ; Patch to address of code linked to 200h
  424.  
  425. start:
  426.  
  427. ; The first step is to compute the size of the code and store the value at
  428. ; address 101h as required for a PRL file.  We also put this value in BC.
  429. ; We set up DE to point to the code assembled for 200H and HL to point to
  430. ; the code assembled for 100H.
  431.  
  432.     ld    hl,(c200)    ; Start of code for 200h
  433.     ld    de,200h     ; Start of code for 100h
  434.     xor    a
  435.     sbc    hl,de        ; Difference is assumed size of code
  436.     ld    (size),hl    ; Store in proper place for PRL file
  437.     ld    b,h        ; ..and in BC
  438.     ld    c,l
  439.  
  440.     ld    hl,(c200)
  441.     ex    de,hl        ; DE -> code for 200h, HL -> code for 100h
  442.  
  443. ; Now we subtract the code for 100h from the code for 200h to generate the map
  444. ; of bytes that are addresses that have to be relocated.  There will be a byte
  445. ; of 01 corresponding to each byte in the code that is the high order byte of
  446. ; an address that must be relocated.  There will be bytes of 00 everywhere
  447. ; else.
  448.  
  449. bytemap:
  450.     ld    a,(de)        ; Get byte from 200h version
  451.     sub    (hl)        ; Subtract byte from 100h version
  452.     ld    (de),a        ; Replace 200h code with byte map
  453.     inc    hl        ; Point to next bytes
  454.     inc    de
  455.     dec    bc        ; Any more to do?
  456.     ld    a,b
  457.     or    c
  458.     jr    nz,bytemap    ; Loop until done
  459.  
  460. ; Now we have to compress the byte map into a bit map, taking each 8 bytes of
  461. ; the byte map and packing the values into a single byte in the bit map.  The
  462. ; result is written immediately following the code (i.e., at the location of
  463. ; the code linked to 200h).
  464.  
  465.     ld    hl,(size)    ; Get number of bytes in byte map
  466.     ld    b,3        ; Divide by 8 (2 to the 3rd power)
  467. divide:
  468.     xor    a        ; Clear carry
  469.     rr    h        ; Rotate H right, low bit to carry
  470.     rr    l        ; Rotate L right, carry into high bit
  471.     djnz    divide        ; Repeat 3 times
  472.     ld    (mapsize),hl    ; Save the value
  473.  
  474.     ld    de,(c200)    ; Point to byte map
  475.     ld    hl,(c200)    ; Point to bit map (same place!)
  476.  
  477. makemap:
  478.     ld    b,8        ; Process block of 8 bytes into 1 byte
  479.     ld    c,0        ; Initial value for byte in bit map
  480.  
  481. makebyte:
  482.     ld    a,(de)        ; Get byte from byte map
  483.     inc    de        ; Advance pointer
  484.     rr    a        ; Move relocation bit into carry flag
  485.     rl    c        ; Move carry flag into byte in C
  486.     djnz    makebyte    ; Repeat 8 times
  487.  
  488.     ld    (hl),c        ; Put result into bit map
  489.     inc    hl        ; ..and advance its pointer
  490.  
  491.     push    hl
  492.     ld    hl,(mapsize)    ; See if we are done
  493.     dec    hl
  494.     ld    (mapsize),hl
  495.     ld    a,h
  496.     or    l
  497.     pop    hl
  498.     jr    nz,makemap
  499.  
  500.     rst    38h        ; Breakpoint to end program
  501.  
  502. mapsize:
  503.     ds    2        ; Scratch area
  504.  
  505.     end
  506.  
  507. Listing 3.  Utility program to perform the hard part of making a PRL file
  508. using a debugger.
  509.