home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / cpm / c64 / soft80.doc < prev    next >
Text File  |  1984-10-03  |  7KB  |  230 lines

  1. SOFT80
  2. by Chris Lampton 75275,1373
  3. Copyright (c) 1984 by Chris Lampton
  4. Licensed for unlimited non-commercial
  5.      distribution
  6.  
  7.  
  8.      SOFT80 is a software 80-column
  9. modification for Commodore 64 CP/M.  It
  10. runs only under the CP/M option from
  11. Commodore Business Machines.  SOFT80
  12. takes no memory away from CP/M and will
  13. work with a full 48K system.  For best
  14. results, use with a video monitor.
  15.      To run SOFT80, place a copy on a
  16. formatted C-64 CP/M diskette under the
  17. name SOFT80.COM and type 'SOFT80' at
  18. the prompt.  SOFT80 will install itself
  19. automatically, clear the screen, print
  20. a copyright notice, and return to CP/M.
  21.      Most standard CP/M programs should
  22. work with SOFT80.  Programs that are
  23. NOT compatible with SOFT80 include:
  24. programs that use non-BDOS screen
  25. output or that make direct calls to
  26. video and keyboard routines in the C-64
  27. Kernal (J. Teloh's version of VDO.COM
  28. and my own MODEM64 fall into this
  29. category), programs that use interrupts
  30. (such as Mark Campbell Adam's
  31. adaptation of MODEM712), and programs
  32. that use the RAM behind the Kernal for
  33. data storage.
  34.      SOFT80 offers a range of ESC
  35. sequences that can be used to interface
  36. C-64 CP/M with programs that require
  37. relative and absolute cursor
  38. positioning.  To maintain compatibility
  39. with programs written (or adapted) for
  40. C-64 CP/M, the Commodore IOTYPE byte is
  41. partially recognized, to allow certain
  42. CBM control codes (for functions such
  43. as relative cursor positioning, reverse
  44. video, etc.) to be obtained in this
  45. manner.  In addition, screen and
  46. character colors can be controlled
  47. through ESC sequences.  A special
  48. underline mode is also available, for
  49. programmers who wish to take advantage
  50. of the bit-mapped character set.
  51.  
  52.  
  53. HOW IT WORKS
  54.  
  55.      SOFT80 draws characters onto a
  56. bit-mapped high-resolution screen
  57. hidden discreetly behind the Kernal
  58. ROM, at 6510 address $E000.  Hi-res
  59. color memory is located at 6510 address
  60. $D000, behind the I/O area.  SOFT80
  61. itself resides in two locations:  at
  62. 6510 address $D400 (behind the I/O
  63. area) and at 6510 address $0400 (former
  64. location of the lo-res video screen). 
  65. The actual code is primarily 6510
  66. machine language, to facilitate the
  67. complex bank-switching routines.  The
  68. bit-maps for the 80-column characters
  69. are located within the program itself. 
  70. Standard ASCII characters are used,
  71. rather than the Commodore character
  72. set.
  73.      When SOFT80 is executed, a short
  74. Z80 header block-moves a small portion
  75. of Z80 code into its permanent position
  76. at 6510 address $0400 (Z80 address
  77. $F400) and passes control to the 6510
  78. portion, which moves the 6510 code into
  79. place and makes a few minor
  80. modifications to BIOS80 and BIOS65. 
  81. Modifications to BIOS80 are made
  82. through the jump table and
  83. modifications to BIOS65 are made
  84. through the IOTBL, in order to maintain
  85. compatibility with altered versions of
  86. the BIOS.  (Any BIOS that maintains the
  87. IOTBL at its normal location will
  88. probably be compatible with SOFT80.)
  89.      There is one known bug in SOFT80: 
  90. the carriage return following a warm
  91. boot lacks a line-feed, so that the
  92. ensuing string of asterisks overwrites
  93. the current screen line.  This is
  94. aesthetically annoying, but
  95. functionally harmless.  It results from
  96. an "illegal" call to the BIOS CONOUT
  97. routine from within BIOS80 itself.  The
  98. fix is simple, but is almost guaranteed
  99. to crash any BIOS in which CONOUT has
  100. been modified.  Future versions of
  101. SOFT80 may contain the fix for this
  102. problem as a user-selectable option.
  103.  
  104.  
  105. ESC SEQUENCES FOR SOFT80
  106.  
  107.     SOFT80 recognizes an ASCII 27 as an
  108. ESC character, that is, an "escape"
  109. code indicating that the next byte(s)
  110. carries special information.  All ESC
  111. sequences should be sent to SOFT80 via
  112. the BDOS Direct Console I/O call (BDOS
  113. function 6). Otherwise, some characters
  114. may be trapped out by BDOS.
  115.     The following is a list of these
  116. ESC functions.  'ESC' represents an
  117. ASCII 27; the character(s) following
  118. the ESC are the ASCII characters that
  119. carry the information.  The actual
  120. sequence of code numbers that should be
  121. sent follows this in parentheses.  All
  122. numbers are decimal, unless otherwise
  123. indicated.
  124.  
  125. ESC 'A' (27 65) - Cursor up one line.
  126. ESC 'B' (27 66) - Cursor down one line.
  127. ESC 'C' (27 67) - Cursor right one
  128.    column.
  129. ESC 'D' (27 68) - Cursor left one
  130.    column.
  131. ESC 'Y' LINE# COLUMN# (27 89 -- --) -      Move cursor to (line#) (column#).
  132.    Line # should be in the range 0 to
  133.    24. Column # should be in the range
  134.    0 to 79.
  135. ESC 'S' (27 83) - Scroll screen up one
  136.    line.
  137. ESC 'T' (27 84) - Scroll screen down
  138.    one line.
  139. ESC 'U' (27 85) - Turn on automatic
  140.    underline mode.  All characters are
  141.    printed with an underscore until ESC
  142.    'V' is received.
  143. ESC 'V' (27 86) - Turn off automatic
  144.    underline mode
  145. ESC 'K' COLOR# (27 75 --) - Set
  146.    background color to (color#). Color#
  147.    is a standard C-64 color poke code
  148.    in the range 0 to 15.
  149. ESC 'H' COLOR# (27 72 --) - Set
  150.    character color to (color#). Color#
  151.    is a standard C-64 color poke code
  152.    in the range 0 to 15. Note that the
  153.    the color of all characters on the
  154.    screen will be changed simulta-
  155.    neously.
  156.  
  157.  
  158. THE IOTYPE BYTE
  159.  
  160.      The Commodore IOTYPE byte is
  161. stored at Z80 address 0FCFFH (6510
  162. address $0CFF).  Each bit in this byte
  163. controls a specific feature of C-64
  164. CP/M output and/or input.  Bit 4
  165. controls the type of character codes
  166. recognized by CONOUT, the screen output
  167. routine.  If this bit is a 0, standard
  168. CP/M ASCII will be used.  If this bit
  169. is a 1, Commodore ASCII (Petscii, as
  170. Joel Rubin calls it) will be used. This
  171. feature can be used to obtain control
  172. codes not ordinarily available from
  173. CP/M.
  174.      SOFT80 partially recognizes this
  175. feature, and it may be used to obtain
  176. certain CBM control codes, some of
  177. which (such as relative cursor
  178. position, clear screen, etc.) may be
  179. obtained in other ways and some of
  180. which (such as reverse video and homing
  181. the cursor) may only be obtained in
  182. this fashion.  Upper and lowercase
  183. characters are NOT swapped when BIT 4
  184. of IOTYPE is set to 1. However, the
  185. following CBM codes are available
  186. through IOTYPE:
  187.  
  188. CODE       FUNCTION
  189.  
  190. 17         Cursor down
  191. 18         Reverse video on
  192. 19         Home cursor
  193. 20         Destructive backspace
  194. 29         Cursor right
  195. 145        Cursor up
  196. 146        Reverse video off
  197. 147        Clear screen
  198. 157        Cursor left
  199.  
  200.  
  201. NOTES
  202.  
  203.      Future versions of SOFT80 will be
  204. upwardly compatible with this version
  205. -- i.e. programs written or adapted to
  206. run under Version 1 will run under
  207. future versions, but not necessarily
  208. vice versa.
  209.      My experience with adapting CP/M
  210. programs to run on the C-64 is limited
  211. and I would appreciate hearing from
  212. anyone with an idea for a feature that
  213. would facilitate such adaptations under
  214. SOFT80.  I have several features in
  215. mind for future versions, and am open
  216. to any suggestions for additional
  217. features, especially ESC sequences. 
  218. And, of course, let me know about any
  219. bugs.  Correspondence should preferably
  220. be sent via Compuserve EMAIL or left in
  221. the Compuserve C-64 SIG or the CBM
  222. Programming SIG.
  223.      If anyone adapts the VDO screen
  224. editor to run under SOFT80, or has any
  225. suggestions regarding such an
  226. adaptation, I would like to hear from
  227. them.  In fact, I would like to hear
  228. about any programs configured to run
  229. under SOFT80.
  230.