home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / mbug / mbug005.arc / WILKIN1.ASC < prev    next >
Text File  |  1979-12-31  |  5KB  |  175 lines

  1. ;    WORDBEE  MODIFICATIONS
  2. ;  Listing 1 which implements additional dot commands for
  3. ;  printing enhancements using Alpha-80 or similar.
  4. ;
  5.     DEFR    16
  6. LINE    EQU    0CC6EH    ;  Line space, Left margin, etc
  7. HEAD    EQU    0CCE1H    ;  Page header
  8. PAGE    EQU    0CCA9H    ;  Page number, length, gap
  9. CRLF    EQU    0CD04H    ;  Line feed suppression (.ZN)
  10. ES    EQU    0CD14H    ;  .ES 
  11.     ORG    0CBDCH    ;  Where the existing test routine is located
  12. CJUST    CP    'J'    ;  .JY ?
  13.     JR    Z,JUST
  14. CNEW    CP    'N'    ;  .NP ?
  15.     JR    Z,NEW
  16. CLINE    CP    'L'    ;  .LS#xx, .LM#xx, .LL#xx ?
  17.     JP    Z,LINE
  18. ;   To add a .LH letterhead, amend line 210 to read 
  19.                 JP    Z,LHEAD - refer text
  20. CHEAD    CP    'H'    ;  .HE ?
  21.     JP    Z,HEAD
  22. CPAGE    CP    'P'    ;  .PN#xx ?
  23.     JP    Z,PAGE
  24. CCRLF    CP    'Z'    ;  .ZN ?
  25.     JP    Z,CRLF
  26. CUNDR    CP    'U'    ;  Underline ?
  27.     JR    Z,UNDR
  28. CITAL    CP    'I'    ;  Italics ?
  29.     JR    Z,ITAL
  30. CEMPH    CP    'M'    ;  eMphasised ?
  31.     JR    Z,EMPH
  32. CDUBL    CP    'D'    ;  Double strike ?
  33.     JR    Z,DUBL
  34. ;
  35.     JP    CFORM    ;  Tests are continued at another location ( C039 )
  36. ;
  37.     NOP        ;  a few spare bytes
  38.     NOP
  39.     NOP
  40. CONTIN    POP    HL    ;  an unchanged part of the original program @ CC0E
  41.     LD    (0521H),IY  ; put back pointer
  42.     RET        ; to the normal printing routine
  43. ;
  44. JUST    LD    A,(IY+2)    ;  Get the next char
  45.     CP    'Y'        ; is it .JY ?
  46.     JR    Z,JY        ; if yes
  47.     XOR    A        ; else it must be .JN
  48. JY      LD    (0512H),A   ; flag for Justify ( 0 if no )
  49.     RET
  50. ; The justify routine has been shortened by deleting the 
  51.   test for .JN assuming it must be, if it was not a .JY
  52. ;
  53. NEW    LD    A,(IY+2)  ; Get next char
  54.     CP    'P'      ; .NP ?
  55.     JR    NZ,CONTIN ; if no then the test failed
  56.     JP    0CA0EH    ; the .NP routine has not changed
  57. ;
  58. ITAL    LD    A,(IY+2)  ; Get next char
  59.     LD    B,34H      ; ESC 34 turns italics onè;
  60. ; The following short OUT routine sends ESC and the
  61. ; contents of B to the print routine if YES or else
  62. ; the B register is increased by 1 before sending
  63. SOUT    CP    'Y'      ; is char 'Y' in register A ?
  64.     JR    Z,PRINT   ; if yes
  65.     INC    B      ; else increase B register
  66.     JR    PRINT      ; and then send it
  67. ;
  68. EMPH    LD    A,(IY+2)  ; Get next char
  69.     LD    B,45H      ; eMphasised on is ESC 45
  70.     JR    SOUT      ; use same routine as italics
  71. ;
  72. DUBL    LD    A,(IY+2)  ; Get next char
  73.     LD    B,47H       ; Double on is ESC 47
  74.     JR    SOUT      ; as above, increases B for no
  75. ;
  76. PRINT    LD    A,1BH      ; the ESC char
  77.     CALL    0CD54H      ; actually send it to printer
  78.     LD    A,B      ; ready to send contents of B
  79. PRINT2    CALL    0CD54H      ; send that to printer too
  80.     RET  ; printer codes have now been sent, continue
  81. PRINT3    LD    B,C      ; if there are more codes to go
  82.     JR    PRINT      ; send them too
  83. ;
  84. BIG    LD    A,(IY+2)  ; Get next char
  85.     LD    BC,5701H  ; ESC 57 1 for on, ESC 57 0 off
  86.     JR    LOUT      ; a longer OUT routine below
  87. ;
  88. UNDR    LD    A,(IY+2)  ; Get next char
  89.     LD    BC,2D01H  ; ESC 2D 1 - on, ESC 2D 0 - off
  90. ;
  91. ; This longer OUT routine sends (if yes) ESC, contents
  92. ; of B, contents of C.   If no, C is decreased by 1.
  93. ;
  94. LOUT    CP    'Y'      ; is it yes ?
  95.     JR    Z,LPRINT  ; if yes, print ESC, (B), (C)
  96.     DEC    C      ; must be no, decrease C
  97. LPRINT    CALL    PRINT      ; print ESC, (B)
  98.     LD    A,C      ; ready with next code
  99.     JR    PRINT2      ; now print that too
  100. ;
  101.     NOP
  102.     NOP
  103.     NOP
  104.     NOP
  105. ;
  106. ;
  107.     ORG    0C017    ; The start of 'Checking . . .
  108. ;
  109.     CALL    0C1C8    ; switches on parallel port
  110.     LD    A,2    ; but is no longer required
  111.     LD    (00E3),A ; as parallel is now default.
  112. ;
  113. ; The next part is just a copy of C057 - C068 which has
  114. ; in effect been moved to C01F
  115. ;
  116.     LD    HL,0500è    LD    A,(HL)
  117.     CP    55
  118.     JP    Z,0C1D5    ; Top of file
  119.     LD    (HL),55
  120.     LD    B,0E1
  121. AGAIN    INC    HL
  122.     LD    (HL),0
  123.     DJNZ    AGAIN
  124.     JP    0C069    ; which used to follow this
  125. ; a few NOPs to fill a hole
  126.     NOP
  127.     NOP
  128.     NOP
  129.     NOP
  130.     NOP
  131. ;
  132. CFORM    CP    'F'    ; Form feed ?
  133.     JR    NZ,CCOND
  134.     LD    A,0CH    ; FF character
  135.     CALL    0CD54    ; send it to printer
  136.     RET        ; finished
  137. ;
  138. CCOND    CP    'C'    ; Condensed ?
  139.     JR    Z,COND
  140. CSUBP    CP    'S'    ; Subscript or Superscript ?
  141.     JP    Z,SUBP
  142. CES    CP    'E'    ; .ES command ?
  143.     JP    Z,ES
  144. CBIG    CP    'B'    ; Big (enlarged) ?
  145.     JP    Z,BIG
  146. ; No more tests, so must have been a wrong command.
  147.     JP    CONTIN    ; Continue on with printing
  148. ;
  149. COND    LD    A,(IY+2)  ; Get next char
  150.     CP    'Y'      ; is it .CY ?
  151.     LD    A,0FH      ; it may be
  152.     JR    Z,CONOUT  ; if it was
  153.     LD    A,12      ; must be no
  154. CONOUT    JP    0CD54 ; send char 0F for yes or 12 for no
  155.     NOP
  156.     NOP        ; a few more gaps
  157. ;
  158. ; Out of space so jump to another hole
  159. ;
  160.     ORG    0C138    ; Where 'Are you sure' used to be
  161. ;
  162. SUBP    LD    A,(IY+2)  ; Get next char
  163.     LD    BC,5301      ; Subscript perhaps
  164.     CP    'B'      ; is it ?
  165.     JR    Z,SUB      ; if so
  166.     CP    'P'      ; superscript ?
  167.     JR    Z,SUPER      ; if correct
  168.     LD    BC,4854      ; must be a cancellation
  169.     CALL    PRINT      ; to send ESC (B)
  170.     JP    PRINT3      ; to send ESC (C)
  171. SUPER    DEC    C      ; change BC to 5300
  172. SUB    JP    LPRINT      ; which sends ESC (B) (C)
  173. ; Note how the contents of BC vary for each condition.
  174.     END          ; of listing 1è