home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / cpminfo / cpm-cc14.art < prev    next >
Text File  |  1994-07-13  |  9KB  |  166 lines

  1.  
  2. ==============================================================================
  3. [   THE KAY*FOG RBBS  |  CPM-CC14.ART  |  posted 01/18/86  |  163 lines  9k  ]
  4.  
  5.           The CP/M Connection                   Originally published in    
  6.                   by                               Computer Currents       
  7.              Ted Silveira                           2550 9th Street        
  8.   (copyright and all rights reserved)             Berkeley, CA  94710      
  9.  
  10.  
  11.  
  12.                                November 5, 1985
  13.                            ONE FOR THE PROGRAMMERS
  14.  
  15.      In my last column, I mentioned some books that will introduce you to 
  16. the inner workings of CP/M and assembly language.  If that aroused your 
  17. curiosity, or if you're already a programmer, you'll also want to start 
  18. collecting some of the assembly language utilities available from the 
  19. public domain.  These utilities were written by and for programmers, 
  20. patchers, and other people who like to know what's going on inside their 
  21. computers.  (If you're not interested in assembly language, just skip to 
  22. the end to see what's coming up next time.)
  23.  
  24.  
  25. [TWO KINDS OF ASSEMBLY LANGUAGE]
  26.  
  27.      The CP/M operating system was originally designed for the Intel 8080 
  28. microprocessor chip and written in 8080 assembly language (the native 
  29. language of the 8080), and all its accompanying tools are designed to work 
  30. in that language.  Most modern CP/M computers use the newer Z80 chip 
  31. instead of the 8080.  The Z80 can execute all the instructions that the 
  32. 8080 can plus a number that the 8080 can't, so a Z80 chip can run any 
  33. program written in 8080 assembly language, but an 8080 chip can't 
  34. necessarily run a program written in Z80 assembly language.
  35.  
  36.      Most public domain assembly language programs are written in 8080 
  37. assembly language, the lowest common denominator.  Lately, however, more 
  38. programs are being written in Z80 assembly language to take advantage of 
  39. that chip's extra power.  Since almost all CP/M computers now use the Z80 
  40. chip, you probably won't have any trouble running either kind of program.  
  41. You will, however, need a different set of tools for each language--you 
  42. can't feed Z80 assembly language to an 8080 assembler and vice-versa.
  43.  
  44.  
  45. [ASSEMBLERS]
  46.  
  47.      You need an assembler and a loader to turn an assembly language source 
  48. file into a runnable program (a COM file).  Digital Research's ASM.COM and 
  49. LOAD.COM are the standard 8080 assembler and loader.  They aren't public 
  50. domain, but they are included with all CP/M 2.2 computers (CP/M Plus owners 
  51. get the MAC assembler instead).  With these two, you can assemble most 
  52. public domain 8080 assembly language programs.  You can't, however, 
  53. assemble an assembly language file that uses _macros_ or external _library 
  54. files_.  For these, you need a macro-assembler like Digital Research's MAC.  
  55. Unfortunately, there is no 8080 macro-assembler available in the public 
  56. domain.
  57.  
  58.      You can find several Z80 assemblers in the public domain.  The best 
  59. I've found is Z80MR, a macro-assembler, which you may also find under the 
  60. names ZASM and ZMAC.  (Just to confuse matters, there is another public 
  61. domain Z80 assembler circulating under the name of ZASM.)  With this 
  62. assembler, you can use the Digital Research loader LOAD.COM, which you 
  63. already have.
  64.  
  65.      No matter whether you're using 8080 or Z80 assembly language, you can 
  66. replace LOAD.COM with the public domain loader MLOAD.COM.  MLOAD is faster 
  67. than LOAD and can be used (in place of DDT) for installing assembly 
  68. language patches.
  69.  
  70.  
  71. [DEBUGGERS]
  72.  
  73.      A debugger is a very useful program that lets you examine, modify, and 
  74. even trace (execute instruction by instruction) another program in memory.  
  75. It's useful not only for debugging programs but also for patching them to 
  76. run on your own computer.  The standard 8080 debugger is Digital Research's 
  77. DDT, which you should have received with your computer (CP/M Plus users get 
  78. SID instead).  
  79.  
  80.      There is no alternative to DDT in the public domain--you don't need 
  81. one--but there is a useful set of patches to DDT that you can find in the 
  82. library file RDDT.LBR.  The most useful patch allows you to specify where 
  83. in memory DDT will load itself.  By loading DDT lower than you usually 
  84. would, you can examine and modify those parts of CP/M that DDT normally 
  85. overlays.
  86.  
  87.      For debugging Z80 assembly language programs, there's a new public 
  88. domain program called Z8E, a terrific tool that does everything DDT does 
  89. and more.  It's most fascinating feature is a trace function that executes 
  90. a program step by step.  During the trace, Z8E shows you the assembly 
  91. language instructions with an arrow pointing to the instruction currently 
  92. being executed.  At the same time, Z8E shows you what's happening in each 
  93. of the Z80 chip's registers (on-chip memory areas) so that you can follow 
  94. the effects of each instruction.  Watching the contents of the registers 
  95. change while the pointer arrow steps through a program can be mesmerizing 
  96. (if sometimes incomprehensible).  Z8E has a few problems--it gets lost if 
  97. you try to trace through CP/M itself--but it's close to being a dream tool.
  98.  
  99.  
  100. [DISASSEMBLERS]
  101.  
  102.      A disassembler lets you take a COM file (a runnable program) and 
  103. recreate the assembly language source file that it came from.  This kind of 
  104. tool isn't for everybody, but it's invaluable for learning how someone 
  105. else's program works (or doesn't work).  And disassembling a well-written 
  106. program, even a small one, will teach you a tremendous amount about 
  107. programming in assembly language.  It's also sometimes the only way to 
  108. modify a program written for one computer so that it will run on your own.
  109.  
  110.      The best public domain 8080 disassembler is RESOURCE.  It's been 
  111. around for years, and it's quirky in some ways, but it does the job.  Best 
  112. of all, it's interactive.  Unlike some "brute force" disassemblers, 
  113. RESOURCE lets you decide whether a particular byte is an assembly language 
  114. instruction or a value to be used by the program.  
  115.  
  116.      My favorite Z80 disassembler is DASM, a Z80 version of RESOURCE.  It 
  117. has all of RESOURCE's good features plus a few improvements.
  118.  
  119.      Recently, however, a challenger has appeared from England.  DAZLSTAR 
  120. (DazzleStar) is an amazing piece of work.  It has more features than DASM, 
  121. including some that make it much easier to trace a subroutine and then 
  122. return to your starting point.  It also--believe it or not--looks and acts 
  123. a lot like WordStar, complete with on-screen menus and cursor movement 
  124. commands.  It's a complicated program (most disassemblers are) that I 
  125. haven't really learned yet--when I need a disassembler I still tend to 
  126. reach for DASM.  But I have the feeling that once I get used to DAZLSTAR, 
  127. I'll be converted for life.  If this is a sample of English programming, 
  128. someone ought to set up an import business.
  129.  
  130.  
  131. [TRANSLATORS]
  132.  
  133.      People who write a lot of assembly language programs say that once you 
  134. start using Z80 assembly language, you'll never want to go back to 8080--
  135. Z80 can produce faster and more compact programs, and its assembly language 
  136. mnemonics are more logical.  But what do you do with those disks full of 
  137. 8080 assembly language source files?  You convert them into Z80 assembly 
  138. language with a translator.
  139.  
  140.      There are two main programs in the public domain that will read in an 
  141. 8080 assembly language source file and spit out a Z80 source file--XLATE5 
  142. and IZ.  XLATE5 is the smaller and faster of the two programs, but IZ has a 
  143. nice feature that allows you to see the translation being made so that you 
  144. know what it's doing.  I use IZ when I need such a program, but it's really 
  145. a toss-up--both are good.
  146.  
  147.  
  148. [COMING UP]
  149.  
  150.      You may have noticed this column now has a new name--[CP/M 
  151. Connection].  After writing about CP/M public domain software for some 
  152. months, I think it's time to broaden the horizons.  I'll continue to let 
  153. you know about useful public domain software, but now I'll also cover good 
  154. commercial software, tricks for getting the most out of CP/M, and 
  155. interesting trends in the CP/M world.  If you have any suggestions, let me 
  156. know.
  157.  
  158. ------------------------------------------------------------------------------
  159.       Ted Silveira is a freelance writer and contributing editor to several
  160.    computer-oriented publications.  He appreciates suggestions or feedback
  161.    and can be reached through the KAY*FOG RBBS (415)285-2687 and CompuServe
  162.    (72135,1447) or by mail to 2756 Mattison Lane, Santa Cruz, CA 95065.
  163.  
  164. -------------------------  End of CPM-CC14.ART Text  -------------------------
  165.  
  166.