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 / UTILS / ARC-LBR / PATVLU11.AZM / PATVLU11.ASM
Assembly Source File  |  2000-06-30  |  12KB  |  420 lines

  1. ;PATVLU  version 1.0  01/11/88
  2.  
  3. ;This file patches VLU101-D.COM so that it will run on a non-ZCPR3 system.
  4. ;It was put together from Z3BASE2.LIB and SYSENV.LIB.  What it does is to
  5. ;tack the environment descriptor onto the end of VLU and patch a couple of
  6. ;addresses to keep VLU happy.  The file is currently set up for an Osborne I
  7. ;so unless that's the computer that you're using you will want to change the
  8. ;terminal stuff starting at the label 'envorg2'.  Make sure that you don't
  9. ;change the size of the code before CL string.  The code can be variable
  10. ;length after that, with a 0 terminator on each string.  You may also want
  11. ;to change things like the maximum disk and screen size.  After you've made
  12. ;the necessary changes, just ASM and MLOAD.
  13.  
  14. ;Thanks to Steve Greenberg and Ben Grey for their help.
  15. ;    enjoy
  16. ;        Bob Schultz
  17.  
  18.  
  19. ;================================================================
  20. ; Update 1/17/88                     v. blade
  21.  
  22. false    equ    0
  23. true    equ    not false
  24.  
  25. ; Now capable of patching dim- or reverse-video version of VLU for
  26. ; Osborne I, Kaypro II, Kaypro 4/10/2X, Epson QX-10, Commodore 128
  27. ; or TVI955.  Though these are the only equates provided, notice
  28. ; that many terminals share the same video commands.  For example,
  29. ; the Osborne I, Epson QX-10, Qume QVT-102, TVI912, TVI920, and
  30. ; C-128 are exactly the same as far as VLU is concerned.  The TVI955
  31. ; (and TVI905) differ only in the clear screen sequence.    vb
  32.  
  33. dimvideo    equ    false
  34.  
  35. OsborneI    equ    false        ;elect only one
  36. KayproII    equ    false
  37. Kaypro2X    equ    true        ;4/10/2X
  38. EpsonQX        equ    false
  39. C128        equ    false
  40. TVI955        equ    false
  41.  
  42.  
  43.  
  44. ; EXTERNAL PATH
  45. ;
  46. ;    The following equates define the address of the ZCPR3 External
  47. ; Path and the number of two-byte elements contained in this path (maximum).
  48. ; If there is no ZCPR3 External Path, both of these values should be set to 0.
  49. ;
  50. EXPATH    EQU    0    ; EXTERNAL PATH
  51. EXPATHS    EQU    0    ;  (PATH SIZE = EXPATHS*2 + 1)
  52.  
  53. ; WHEEL BYTE
  54. ;
  55. ;    The following equate defines the address of the ZCPR3 Wheel Byte.
  56. ; If there is no ZCPR3 Wheel Byte, this value should be set to 0.
  57. ;
  58. Z3WHL    EQU    0    ; WHEEL BYTE ADDRESS
  59.  
  60. ; RCP LOCATION
  61. ;
  62. ;    The following equates define the address of the ZCPR3 Resident
  63. ; Command Package and its size in 128-byte blocks.  If there is no
  64. ; ZCPR3 Resident Command Package, both of these values should be 0.
  65. ;
  66. RCP    EQU    00000H    ; RESIDENT COMMAND PACKAGE
  67. RCPS    EQU    00    ; 00 128-byte Blocks (0K bytes)
  68.  
  69. ; IOP LOCATION
  70. ;
  71. ;    The following equates define the address of the ZCPR3 Input/Output
  72. ; Package and its size in 128-byte blocks.  If there is no ZCPR3 Input/Output
  73. ; Package, both of these values should be 0.
  74. ;
  75. IOP    EQU    00000H    ; REDIRECTABLE I/O PACKAGE
  76. IOPS    EQU    00    ; 00 128-byte Blocks (0K bytes)
  77.  
  78. ; FCP LOCATION
  79. ;
  80. ;    The following equates define the address of the ZCPR3 Flow Command
  81. ; Package and its size in 128-byte blocks.  If there is no ZCPR3 Flow Command
  82. ; Package, both of these values should be 0.
  83. ;
  84. FCP    EQU    00000H    ; FLOW COMMAND PACKAGE
  85. FCPS    EQU    0    ; 0 128-byte Blocks (0K bytes)
  86.  
  87. ; ENV LOCATION
  88. ;
  89. ;    The following equates define the address of the ZCPR3 Environment
  90. ; Descriptor and its size in 128-byte blocks.  If there is no ZCPR3 Environment
  91. ; Descriptor, both of these values should be 0.
  92. ;
  93. ;**************************************************
  94. ;***        DON'T change this        *** 
  95. ;**************************************************
  96.  
  97.      if dimvideo
  98. z3env    equ    03e19h    ; environment descriptor
  99.      else
  100. z3env    equ    03dcbh
  101.      endif
  102.  
  103. z3envs    equ    2    ; size of environment descriptor in 128-byte blocks
  104.  
  105. ; SHELL STACK
  106. ;
  107. ;    The following equates define the address of the ZCPR3 Shell Stack,
  108. ; the number of entries permitted in the ZCPR3 Shell Stack, and the size
  109. ; of each entry in the Shell Stack in terms of bytes.  If there is no ZCPR3
  110. ; Shell Stack, all three values should be 0.
  111. ;
  112. SHSTK    EQU    0    ; ZCPR3 SHELL STACK
  113. SHSTKS    EQU    0    ; NUMBER OF SHSIZE-BYTE SHELL STACK ENTRIES
  114. SHSIZE    EQU    0    ; SIZE OF A SHELL STACK ENTRY
  115.             ;   (STACK SIZE = SHSTKS * SHSIZE)
  116.  
  117. ; ZCPR3 MESSAGES
  118. ;
  119. ;    The following equate defines the address of the ZCPR3 Message Buffer.
  120. ; This buffer is always 80 bytes long.  If there is no ZCPR3 Message Buffer,
  121. ; this address should be 0.
  122. ;
  123. Z3MSG    EQU    0    ; ZCPR3 MESSAGE BUFFER
  124.  
  125. ; EXTERNAL FCB
  126. ;
  127. ;    The following equate defines the address of the ZCPR3 External FCB.
  128. ; This buffer is always 36 bytes long.  If there is no ZCPR3 External FCB,
  129. ; this address should be 0.
  130. ;
  131. EXTFCB    EQU    0    ; ZCPR3 EXTERNAL FCB
  132.  
  133. ; NAMED DIRECTORY BUFFER
  134. ;
  135. ;    The following equates define the address and size (in terms of 18-byte
  136. ; entries) of the ZCPR3 Named Directory Buffer.  If there is no such buffer,
  137. ; both of these values should be 0.
  138. ;
  139. Z3NDIR    EQU    0    ; ZCPR3 NAMED DIRECTORY AREA
  140. Z3NDIRS    EQU    0    ; 14 18-byte Named Directory Elements permitted
  141.             ;   (NDIR SIZE = Z3NDIRS*18 + 1 for trailing 0)
  142.  
  143. ; COMMAND LINE
  144. ;
  145. ;    The following equates define the address and size (in terms of bytes)
  146. ; of the ZCPR3 Command Line Buffer (formerly called the Multiple Command Line
  147. ; Buffer under ZCPR2).  If there is no such buffer, both of these values should
  148. ; be 0.
  149. ;
  150. Z3CL    EQU    0    ; ZCPR3 COMMAND LINE BUFFER
  151. Z3CLS    EQU    0    ; SIZE OF COMMAND LINE BUFFER
  152.  
  153. ; EXTERNAL STACK
  154. ;
  155. ;    The following equate defines the address of the ZCPR3 External Stack.
  156. ; This stack is always 48 bytes in size.  If there is no such stack, this
  157. ; value should be 0.
  158. ;
  159. EXTSTK    EQU    0    ; ZCPR3 EXTERNAL STACK
  160.  
  161.  
  162.  
  163.     org    109h
  164.     dw    z3env        ;patch envptr
  165.  
  166.      if dimvideo
  167.     org    0127ch        ;patch free memory pointer
  168.      else
  169.     org    01244h
  170.      endif
  171.  
  172.     dw    z3env+z3envs*80h
  173.  
  174.  
  175. ;
  176. ;  Environment Descriptor
  177. ;    If inline, there is a leading JMP just before this
  178. ;
  179.     org    z3env
  180.  
  181.     ds    3
  182. envorg1:
  183.     db    'Z3ENV'        ; Environment ID
  184.     db    2        ; class 2 environment (internal)
  185.  
  186.     dw    expath        ; external path address
  187.     db    expaths        ; number of 2-byte elements in path
  188.  
  189.     dw    rcp        ; RCP address
  190.     db    rcps        ; number of 128-byte blocks in RCP
  191.  
  192.     dw    iop        ; IOP address
  193.     db    iops        ; number of 128-byte blocks in IOP
  194.  
  195.     dw    fcp        ; FCP address
  196.     db    fcps        ; number of 128-byte blocks in FCP
  197.  
  198.     dw    z3ndir        ; NDR address
  199.     db    z3ndirs        ; number of 18-byte entries in NDR
  200.  
  201.     dw    z3cl        ; ZCPR3 Command Line
  202.     db    z3cls        ; number of bytes in Command Line
  203.  
  204.     dw    z3env        ; ZCPR3 Environment Descriptor
  205.     db    z3envs        ; number of 128-byte blocks in Descriptor
  206.  
  207.     dw    shstk        ; Shell Stack address
  208.     db    shstks        ; number of shsize-byte entires in Shell Stack
  209.     db    shsize        ; size of a Shell Stack entry
  210.  
  211.     dw    z3msg        ; ZCPR3 Message buffer
  212.  
  213.     dw    extfcb        ; ZCPR3 External FCB
  214.  
  215.     dw    extstk        ; ZCPR3 External Stack
  216.  
  217.     db    0        ; quiet flag (1=quiet, 0=not quiet)
  218.  
  219.     dw    z3whl        ; address of Wheel Byte
  220.  
  221.     db    4        ; Processor Speed in MHz
  222.  
  223.     db    'C'-'@'        ; maximum disk
  224.     db    31        ; maximum user
  225.  
  226.     db    1        ; 1=OK to accept DU, 0=not OK
  227.  
  228.     db    0        ; CRT selection (0=CRT 0, 1=CRT 1)
  229.     db    0        ; Printer selection (n=Printer n)
  230.  
  231.     db    80        ; width of CRT 0
  232.     db    24        ; number of lines on CRT 0
  233.     db    24        ; number of lines of text on CRT 0
  234.  
  235.     db    128        ; width of CRT 1
  236.     db    24        ; number of lines on CRT 1
  237.     db    24        ; number of lines of text on CRT 1
  238.  
  239.     db    80        ; width of Printer 0
  240.     db    66        ; number of lines on Printer 0
  241.     db    58        ; number of lines of text on Printer 0
  242.     db    1        ; form feed flag (0=can't formfeed, 1=can)
  243.  
  244.     db    102        ; width of Printer 1
  245.     db    66        ; number of lines on Printer 1
  246.     db    58        ; number of lines of text on Printer 1
  247.     db    1        ; form feed flag (0=can't formfeed, 1=can)
  248.  
  249.     db    80        ; width of Printer 2
  250.     db    66        ; number of lines on Printer 2
  251.     db    58        ; number of lines of text on Printer 2
  252.     db    0        ; form feed flag (0=can't formfeed, 1=can)
  253.  
  254.     db    102        ; width of Printer 3
  255.     db    66        ; number of lines on Printer 3
  256.     db    58        ; number of lines of text on Printer 3
  257.     db    0        ; form feed flag (0=can't formfeed, 1=can)
  258.  
  259.     db    'SH      '    ; shell variable filename
  260.     db    'VAR'        ; shell variable filetype
  261.  
  262.     db    '        '    ; filename 1
  263.     db    '   '        ; filetype 1
  264.  
  265.     db    '        '    ; filename 2
  266.     db    '   '        ; filetype 2
  267.  
  268.     db    '        '    ; filename 3
  269.     db    '   '        ; filetype 3
  270.  
  271.     db    '        '    ; filename 4
  272.     db    '   '        ; filetype 4
  273.  
  274.     ds    80H-($-envorg1+3)    ; make exactly 80H bytes long
  275.                     ; (+3 compensates for leading JMP)
  276. ;
  277. ; Terminal Capabilities Data
  278. ;
  279. envorg2:
  280.      if OsborneI or EpsonQX or TVI955 or C128
  281.  
  282.      if OsborneI
  283.     DB    'Osborne I       '    ;Name of Terminal
  284.      endif
  285.      if EpsonQX
  286.     DB    'QX-10 Epson     '
  287.      endif
  288.      if TVI955
  289.     DB    'TVI955          '
  290.      endif
  291.      if C128
  292.     DB    'C128 Commodore  '
  293.      endif
  294.  
  295.     DB    'K'-'@'            ;Cursor UP
  296.     DB    'J'-'@'            ;Cursor DOWN
  297.     DB    'L'-'@'            ;Cursor RIGHT
  298.     DB    'H'-'@'            ;Cursor LEFT
  299.     DB    00            ;CL Delay
  300.     DB    00            ;CM Delay
  301.     DB    00            ;CE Delay
  302.      if TVI955
  303.     DB    1bh,'+',0
  304.      else
  305.     DB    1ah,0            ;CL String   clear screen
  306.      endif ;TVI955
  307.     DB    1bh,'=%+ %+ ',0        ;CM String   cursor addressing
  308.     DB    1bh,'T',0        ;CE String   clear to end of line
  309.     DB    1bh,')',0        ;SO String   into highlighting
  310.     DB    1bh,'(',0        ;SE String   exit highlighting
  311.     DB    0            ;TI String   terminal initialization
  312.     DB    0            ;TE String   terminal deinitialization
  313.  
  314.      endif ;OsborneI or EpsonQX or TVI955 or C128
  315.  
  316.      if KayproII or Kaypro2X
  317.  
  318.      if Kaypro2X
  319.     DB    'KP-10 Kaypro 10 '
  320.      else
  321.     DB    'KP-2 Kaypro II  '    ;Name of Terminal
  322.      endif ;Kaypro2X
  323.  
  324.     DB    'K'-'@'            ;Cursor UP
  325.     DB    'J'-'@'            ;Cursor DOWN
  326.     DB    'L'-'@'            ;Cursor RIGHT
  327.     DB    'H'-'@'            ;Cursor LEFT
  328.     DB    00            ;CL Delay
  329.     DB    00            ;CM Delay
  330.     DB    00            ;CE Delay
  331.     DB    1ah,0            ;CL String   clear screen
  332.     DB    1bh,'=%+ %+ ',0        ;CM String   cursor addressing
  333.     DB    18h,0            ;CE String   clear to end of line
  334.      if Kaypro2X
  335.      if dimvideo
  336.     DB    1bh,'B1',0        ;SO String   into highlighting
  337.     DB    1bh,'C1',0        ;SE String   exit highlighting
  338.      else
  339.     DB    1bh,'B0',0        ;you don't really like inverse-video
  340.     DB    1bh,'C0',0        ;do you?
  341.      endif ;dimvideo
  342.      else
  343.     DB    0            ;SO String   into highlighting
  344.     DB    0            ;SE String   exit highlighting
  345.      endif ;Kaypro2X
  346.     DB    0            ;TI String   terminal initialization
  347.     DB    0            ;TE String   terminal deinitialization
  348.  
  349.      endif ;KayproII of Kaypro2X
  350.  
  351.      if 0    ;model tcap for those who still need to build their own
  352.  
  353.     DB    'Terminal name   '    ;16 characters
  354.  
  355.                     ;arrow keys, one byte each
  356.     DB    'K'-'@'            ;Cursor UP
  357.     DB    'J'-'@'            ;Cursor DOWN
  358.     DB    'L'-'@'            ;Cursor RIGHT
  359.     DB    'H'-'@'            ;Cursor LEFT
  360.  
  361.                     ;delays for cursor routines
  362.     DB    00            ;CL Delay
  363.     DB    00            ;CM Delay
  364.     DB    00            ;CE Delay
  365.  
  366.                     ;cursor routines, 0 terminated
  367.     DB    1ah,0            ;CL String   clear screen
  368.     DB    1bh,'=%+ %+ ',0        ;CM String   cursor addressing
  369.     DB    18h,0            ;CE String   clear to end of line
  370.     DB    1bh,'B1',0        ;SO String   into highlighting
  371.     DB    1bh,'C1',0        ;SE String   exit highlighting
  372.     DB    0            ;TI String   terminal initialization
  373.     DB    0            ;TE String   terminal deinitialization
  374.  
  375. ; cursor addressing sequence:
  376. ; %    represents the row and column coordinates (first one is row)
  377. ; %+c  add offset c to coordinate ('%+ ' adds a space, 20h, to coordinate)
  378. ; %d   output coordinate as decimal characters (as many as needed)
  379. ; %2   output coordinate as two decimal characters
  380. ; %3   output coordinate as three decimal characters
  381. ;
  382. ; the following codes affect interpretation of the entire string and
  383. ; may appear anytime before the first coordinate
  384. ; %i   increment, home position is (1,1) instead of (0,0)
  385. ; %r   reverse, send column figure first
  386. ;
  387. ; %%   send '%' character
  388. ;
  389. ; example:  1bh,'[%i%d;%dH'  translates as   esc  [   1   ;   1   H
  390. ;                         1bh 5bh 31h 3bh 31h 48h
  391. ;           1bh,'=%+ %+ '    translates as   esc  =           
  392. ;                         1bh 3dh 20h 20h
  393. ;
  394. ; Of course, you could get Z3TCAP26.LBR and look in the source code,
  395. ; but what fun would that be?
  396.  
  397.      endif ;0
  398.  
  399.     ds    80H-($-envorg2)        ; make exactly 80H bytes long
  400.  
  401. ;
  402. ;  End of Environment Descriptor
  403. ;
  404.  
  405. ; The following code change corrects an intermittent bug that could
  406. ; inhibit constructing libraries under ZCPR3 and standard CP/M.
  407. ; It sacrifices nothing under ZCPR33.
  408. ;                                vb
  409.  
  410.      if dimvideo
  411.     org    00d44h
  412.     call    02776h
  413.      else
  414.     org    00d17h
  415.     call    02728h
  416.      endif
  417.  
  418.  
  419.     end
  420.