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 / WSTAR / WS3550.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  5KB  |  149 lines

  1. ;
  2. ;
  3. ;     NEC 3550 Printer install for Wordstar ver 3.30.
  4. ;                    by Brad Harrison
  5. ;                      12/03/86
  6. ;
  7. ; NOTE: This patch will only work if you use the Wordstar Port driver.
  8. ;
  9. ; This patch allows Wordstar ver 3.3 to function correctly with
  10. ; a NEC 3550 printer. The WINSTALL program has a selection for
  11. ; the NEC-3550 but this definition is flawed. There are two
  12. ; basic errors in the NEC-3550 definition as supplied by Micropro:
  13. ;
  14. ;    1. The DRLF sequence is incorrect. This sequence is used to
  15. ;    reverse line feed a daisy wheel printer. The sequence
  16. ;    supplied is - 1B 0A <ESC LF>. This patch will correct the
  17. ;    sequence to 1B 37 <ESC 7>.
  18. ;
  19. ;    2. The NEC 3550 printer is unique in that it requires an escape
  20. ;    sequence after the VMI (vertical motion index) sequence.
  21. ;    WS 3.3 added the DVMITR area to accomplish this but when
  22. ;    it is used, Wordstar seems to lose track of the page length
  23. ;    and basically just doesn't work right. This patch will clear
  24. ;    out the DVMITR sequence so that WS will print correctly.
  25. ;    In order to send the VMI trailer sequence, the Wordstar port
  26. ;    driver will be changed to look at the characters being printed
  27. ;    and append a 1B 32 <ESC 2> after it finds a 1B 41 xx.
  28. ;
  29. ;    Example:                    (DVMITR)
  30. ;                    <---->  --- VMI trailer sequence
  31. ;            1B   41   01   1B   42
  32. ;         VMI header --    <---->    ! 
  33. ;      (DVMILE)          !----- VMI value (0 to 56)
  34. ;
  35. ; INSTALLATION:
  36. ;    1. Use the WINSTALL program to set up wordstar. Install the NEC-3550
  37. ;    printer and use the port driver.
  38. ;    2. Change the DATOUT equate below to match the output port for
  39. ;    your printer. (should be the same value you used with WINSTALL)
  40. ;    3. Assemble this patch.  ex: ASM WS3550
  41. ;    4. Overlay the resulting hex file onto your installed WS COM file.
  42. ;    example:   MLOAD WS.COM=WS.COM,WS3550.HEX
  43. ;
  44. DATOUT:    EQU    0F8H        ; output port  ** HARDWARE DEPENDANT **
  45. ;
  46. ;
  47. ; change signon message    - show date of this mod
  48.     ORG    1AEH
  49.     DB    'NEC-3550 Printer   (12/03/86 BH)'
  50. ;
  51. ;
  52. ; ---- begin of WS port driver patch for NEC 3550
  53. ;    scan all outgoing characters to printer and when
  54. ;    a ESC,'A',x is found, append a ESC,'2' afterwards
  55.     ORG    2BDH        ; space in user1 for patch
  56. NECOUT: EQU    $
  57.     PUSH    A        ; save registers
  58.     PUSH    H
  59.     PUSH    B
  60.     LXI    H,NSTAT        ; (HL) is our status flag
  61.     MOV    C,A        ; char to be sent in C
  62.     LDA    NSTAT        ; find out where we are
  63.     ORA    A
  64.     JZ    NEC00        ; nstat=0 (looking for esc)
  65.     CPI    1
  66.     JZ    NEC01        ; nstat=1 (looking for 'A')
  67. ; nstat must be a 2 - we need to append esc '2' after this char
  68.     DCR    M        ; put nstat back to 0
  69.     DCR    M
  70.     CALL    CHOUT
  71.     MVI    C,ESC        ; add on an ESC '2'
  72.     CALL    CHOUT
  73.     MVI    C,'2'
  74. NEC99:    CALL    CHOUT        ; send char and return
  75.     POP    B        ; restore registers
  76.     POP    H
  77.     POP    A
  78.     RET            ; back to the ws driver
  79. ;
  80. ; nstat must be a 0 - we need to look for ESC that begins ESC 'A'
  81. NEC00:    EQU    $
  82.     MOV    A,C
  83.     CPI    ESC        ; first thing to look for is esc
  84.     JNZ    NEC99        ; n - just send char
  85.     INR    M        ; y - change from 0 to 1
  86.     JMP    NEC99        ;     send char and return
  87. ;
  88. ; nstat must be a 1 - we found an ESC now check for 'A'
  89. NEC01:    EQU    $
  90.     DCR    M        ; put back to 0 just in case
  91.     MOV    A,C
  92.     CPI    'A'
  93.     JNZ    NEC99        ; nstat is back to 0 : look for esc
  94.     INR    M        ; 0 --> 1
  95.     INR    M        ; 1 --> 2 
  96.     JMP    NEC99
  97. ;
  98. CHOUT:    CALL    POBSY        ; printer busy?
  99.     JC    CHOUT        ; y- we will wait
  100.     MOV    A,C        ; get back the char to print
  101.     OUT    DATOUT        ; send the char
  102.     RET
  103. ;
  104. NSTAT:    DB    0        ; 0= check for esc
  105.                 ; 1= found esc, check for 'A'
  106.                 ; 2= found esc and 'A' append after this chr
  107. ;
  108. ; ---- end of wordstar port driver patch
  109. ;
  110. ;
  111. BS:    EQU    8            ; backspace
  112. LF:    EQU    10            ; line feed    
  113. FF:    EQU    12            ; form feed    
  114. CR:    EQU    13            ; carriage return
  115. DEL:    EQU    7FH            ; delete or rubout
  116. ESC:    EQU    01BH            ; escape
  117. ;
  118. ;
  119. ; ********************************************************************
  120. ; we must modify the WS port driver so that it calls our
  121. ; extension which is located in USER1 (and listed above).    
  122. ;
  123. POBSY:    EQU    727H            ; port driver : status check
  124. ;
  125.     ORG    732H            ; port driver : character out
  126. POSEND:    EQU    $
  127.     CALL    NECOUT            ; call our modified driver
  128.     RET
  129. ;
  130. ; ----- daisy wheel printer stuff ------------------
  131. ; the nec 3550 driver normally has WS append a ESC '2' after
  132. ; a VMI sequence. WS doesn't do this correctly, so we blank
  133. ; out the VMI trailing sequence and let the printer driver
  134. ; (above) append the ESC '2'
  135. ;
  136.     ORG    77FH
  137. DVMITR:    DB    0
  138.     DB    0,0,0,0
  139. ;
  140. ;
  141. ; this was just a bug in the NEC driver as supplied from MICROPRO
  142. ; The reverse line feed sequence shoud be 1B 37 <ESC 7>
  143. ;
  144. ; ----- fix up :drlf+2 from 0A to 37
  145.     ORG    7ABH+2
  146.     DB    '7'
  147. ;
  148.     END
  149.