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 / PROGRAMS / LIST / MDPRINT.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  6KB  |  139 lines

  1. ; This is a patch to Morrow MicroDecision 64K CP/M 2.2 - Rev 1.5
  2. ; This patch redefines the LST: device as the auxilary port of the
  3. ; terminal attached to the system.  This allows the otherwise 
  4. ; impossible feat of getting a hardcopy of a communications
  5. ; session (at least for those with earlier MDs) and removes the need
  6. ; to swap cables everytime you want to switch to use your modem.
  7. ;
  8. ; This patch is written as a COM file that will overwrite the space
  9. ; used by the LSTOUT routine.
  10. ;
  11. ; The patch consists of altering three BIOS routines.
  12. ; 1- The CONOUT routine is intercepted.  If the last use of the terminal
  13. ; was as the LST: device, an escape sequence is sent switching the output
  14. ; back to the screen.
  15. ; 2- The LSTOUT routine is replaced.  If the last use of the terminal was
  16. ; as the CON: device, an escape sequence is sent switching the output
  17. ; to the auxilary port.
  18. ; 3- The LSTSTATUS routine is replaced by the CONSTATUS routine.
  19. ;
  20. ; It appears that the auxilary port speed must be higher than the main
  21. ; port speed for this to work.
  22. ;
  23. ; If the system is reset while the unit is printing, the terminal will think 
  24. ; that everything coming down the line is still for the printer.  You should
  25. ; either power the terminal down and up or write something to the LST: device
  26. ; to get the terminal in the proper mode.
  27. ;
  28. ; This patch should be easily alterable to work with the other terminals
  29. ; supplied with the MicroDecision.  Replacing BUFON and BUFOFF with the
  30. ; appropriate sequences. (It is currently set up for the FREEDOM 100) 
  31. ;
  32. ; This patch should be easily alterable to work with other versions and memory
  33. ; sizes of Morrow CP/M.  The addresses JMPTBL,SCONOUT, and SLSTOUT should be
  34. ; the only things needing change.
  35. ;
  36. ; This patch was written by Curt Arnold on 12/31/83 and was placed in the
  37. ; public domain with the intent that it be freely distributed.
  38. ;
  39. ; The author realizes that this patch could be made prettier and smarter
  40. ; and encourages anyone who would like to to do so.  The author can offer
  41. ; little support because he does not own a Morrow.  (It was done as a
  42. ; favor for a friend)
  43. ;
  44. ; Hope you find this little patch useful and/or educational.
  45. ;
  46. ; By the way, this patch appears to be very tight.  Only one or two
  47. ; bytes remain for modifications.
  48. ;
  49. ; Equates
  50. ESC     EQU  1BH
  51. SCONOUT EQU  0F348H          ;address of the original CONOUT routine.
  52. SLSTOUT EQU  0F442H          ;address of the original LSTOUT routine.
  53. JUMPTB  EQU  0F200H          ;location of the BIOS jump table.
  54. ;OFFSET   EQU  0000H ;you may want to test the routines before
  55.                      ;you put them over your BIOS.
  56.         ORG  100H
  57. ;
  58. ; Routine to patch BIOS.
  59. ;
  60. ; Move code up to its new home.
  61. ;
  62.        LXI   B,ENDBYT-LSTOUT ;load BC with the # of bytes to move.
  63.        LXI   D,LSTOUT+OFFSET ;load DE with the destination (old LSTOUT)
  64.        LXI   H,LSTOUT        ;load HL with the source
  65.        DB    0EDH,0B0H       ;LDIR (Overlay the old LSTOUT)
  66. ; Patch the jump table to use new code.
  67.        LXI   H,CONOUT+OFFSET ;replace the jump to the old CONOUT with
  68.        SHLD  JUMPTB+0DH      ;a jump to the new CONOUT.
  69.        LXI   H,LSTOUT+OFFSET ;replace the jump to the old LSTOUT with
  70.        SHLD  JUMPTB+10H      ;a jump to the new LSTOUT.
  71.        LHLD  JUMPTB+07H      ;Load HL with the address of CONSTATUS.
  72.        SHLD  JUMPTB+2EH      ;Replace the jump to LSTSTATUS with a jump
  73.                              ;to CONSTATUS.
  74. ; Warm boot.
  75.        JMP   JUMPTB+03H      ;WARM START
  76. ;
  77. ; PATCH TESTING ROUTINE
  78. ;
  79.        LXI   H,STRING
  80. FRED   MOV   A,M
  81.        ORA   A
  82.        JZ    ENDTST
  83.        MOV   C,A
  84.        PUSH  H 
  85.        CALL  CONOUT
  86.        CALL  LSTOUT
  87.        POP   H
  88.        INX   H
  89.        JMP   FRED
  90. ENDTST JMP   0000H
  91. STRING DB    'THIS IS A TEST',0
  92. ;
  93. ;New BIOS routines
  94. ;
  95. ; LSTOUT - New LSTOUT
  96. ; Check TOGGLE to see if last use of terminal was a LST:
  97. ; If TOGGLE is non-zero, send byte to original CONOUT.
  98. ; If TOGGLE is zero, set toggle non-zero, send sequence to turn Buffer
  99. ; print on and send byte to original CONOUT.
  100. LSTOUT LDA   TOGGLE+OFFSET ;Check TOGGLE  
  101.        ORA   A              
  102.        JNZ   SCONOUT       ;If TOGGLE is NZ, then jump to original CONOUT
  103.        DCR   A              
  104.        STA   TOGGLE+OFFSET ;Set TOGGLE non zero. 
  105.        LXI   H,BUFON+OFFSET       ;address of buffer print on string.
  106.        CALL  SNDSEQ+OFFSET        ;Send the sequence
  107.        JMP   SCONOUT      ;send original byte to CONOUT
  108. ;
  109. ; CONOUT - New CONOUT, very similar to LSTOUT, but with polarity changed.
  110. ;
  111. CONOUT LDA  TOGGLE+OFFSET ;Check toggle
  112.        ORA  A
  113.        JZ   SCONOUT       ;If toggle is Z, then jump to original CONOUT
  114.        XRA  A
  115.        STA  TOGGLE+OFFSET ;set toggle zero
  116.        LXI   H,BUFOFF+OFFSET   ;address of buffer print off string.
  117.        CALL  SNDSEQ+OFFSET     ;send sequence
  118.        JMP  SCONOUT        ;send original byte to CONOUT
  119. ; Send a sequence of bytes terminated with a ZERO to the original CONOUT
  120. SNDSEQ PUSH  B             ;routine needs to save C
  121. SNDLP  MOV   A,M           ;load A with (HL)
  122.        ORA   A
  123.        POP   B             ;pop BC just in case it returns
  124.        RZ                  ;return if sequence finished
  125.        PUSH  B             ;push BC to keep stack even
  126.        MOV   C,A           ;move A to C 
  127.        PUSH  H             ;protect HL
  128.        CALL  SCONOUT       ;call original CONOUT
  129.        POP   H             ;get HL back
  130.        INX   H             ;increment HL
  131.        JMP   SNDLP+OFFSET
  132. TOGGLE  DB   00H
  133. ;BUFON   DB   '<',0      These are nice for testing.
  134. ;BUFOFF  DB   '>',0
  135. BUFON   DB   ESC,'`',0  ;buffer print on (you may want to enable handshaking)
  136. BUFOFF  DB   ESC,'a',0  ;buffer print off (and disable it here)
  137. ENDBYT  DB   00H
  138. OFFSET  EQU  SLSTOUT-LSTOUT
  139.