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

  1. ;    WORDBEE  MODIFICATIONS
  2.  
  3. ;  Listing 2 which enables the additional printer dot
  4. ;  commands to be utilised mid-line with a '\' trip.
  5.  
  6.     DEFR    16
  7. UNDR    EQU    0CC5CH ;  Note the different EQU labels
  8. ITAL    EQU    0CC2DH ;  compared to listing 1.  In each
  9. EMPH    EQU    0CC39H ;  case the address jumps into the
  10. DUBL    EQU    0CC40H ;  routine just after the command:
  11. COND    EQU    0C05AH ;      LD    A,(IY+2)
  12. BIG    EQU    0CC54H ;  If you study the code below,
  13. SUBP    EQU    0C13BH ;  will see we load the A register
  14. PRINT    EQU    0CD54H ;  before jumping to the address.
  15.  
  16.     ORG    0CA96H ;  All printing goes to here.
  17.  
  18. START    CP    '\'    ;  Is this char a slosh ?
  19.     JP    NZ,PRINT;  If not, just print it.
  20.     DEC    C    ;  Adjust line length
  21.     LD    A,(HL)    ;  Get next char
  22.     AND    0DFH    ;  Convert to upper case
  23.     LD    (HL),A    ;  and put it back
  24.     INC    HL    ;  Ready for next char
  25.     PUSH    BC    ;  Save reg
  26.     CALL    FIRST    ;  Test for each attribute
  27.     POP    BC    ;  Restore reg
  28.     RET    ; To program for next character to print.
  29.  
  30.     ORG    0DF28    ;  Where there is now space
  31.  
  32. ;  Each possibility is tested until one is found:
  33.  
  34. FIRST    CP    'U'    ;  underline ?
  35.     JR    NZ,NXT1    ;  if not underline
  36.     LD    A,(547)    ;  get switch
  37.     XOR    1H    ;  change switch pointer    
  38.     BIT    0,A    ;  test for on or off
  39.     LD    (547),A    ;  save it again
  40.     JR    Z,UNDOUT;  if 0, switch underline off
  41.     LD    A,'Y'    ;  switch underline on
  42. UNDOUT    JP    UNDR    ;  to where A is tested for 'Y'
  43.  
  44. NXT1    CP    'I'    ;  italics ?
  45.     JR    NZ,NXT2    ;
  46.     LD    A,(547)    ;  Each one is the same as above
  47.     XOR    2H    ;
  48.     BIT    1,A
  49.     LD    (547),A
  50.     JR    Z,ITOUT
  51.     LD    A,'Y'
  52. ITOUT    JP    ITAL
  53.  
  54. NXT2    CP    'M'    ;  emphasised ?
  55.     JR    NZ,NXT3
  56.     LD    A,(547)
  57.     XOR    4H
  58.     BIT    2,A
  59.     LD    (547),Aè    JR    Z,EMPOUT
  60.     LD    A,'Y'
  61. EMPOUT    JP    EMPH
  62.  
  63. NXT3    CP    'D'    ;  double ?
  64.     JR    NZ,NXT4
  65.     LD    A,(547)
  66.     XOR    8H
  67.     BIT    3,A
  68.     LD    (547),A
  69.     JR    Z,DBLOUT
  70.     LD    A,'Y'
  71. DBLOUT    JP    DUBL
  72.  
  73. NXT4    CP    'C'    ;  condensed ?
  74.     JR    NZ,NXT5
  75.     LD    A,(547)
  76.     XOR    10H
  77.     BIT    4,A
  78.     LD    (547),A
  79.     JR    Z,CONOUT
  80.     LD    A,'Y'
  81. CONOUT    JP    COND
  82.  
  83. NXT5    CP    'B'    ;  BIG ?
  84.     JR    NZ,NXT6
  85.     LD    A,(547)
  86.     XOR    20H
  87.     BIT    5,A
  88.     LD    (547),A
  89.     JR    Z,BIGOUT
  90.     LD    A,'Y'
  91. BIGOUT    JP    BIG
  92.  
  93. NXT6    CP    ']'    ;  new identifier for SUBscript !
  94.     JR    NZ,NXT7
  95.     LD    A,(547)
  96.     XOR    40H
  97.     BIT    6,A
  98.     LD    (547),A
  99.     JR    Z,SBPOUT
  100.     LD    A,'B'
  101. SBPOUT    JP    SUBP
  102.  
  103. NXT7    CP    '^'    ;  new ident for SUPERscript !
  104.     JR    NZ,LAST    ; It was none of above, so . .
  105.     LD    A,(547)
  106.     XOR    80H
  107.     BIT    7,A
  108.     LD    (547),A
  109.     JR    Z,SBPOUT
  110.     LD    A,'P'
  111.     JR    SBPOUT
  112.  
  113. LAST    POP    DE    ;  This routine restores all
  114.     POP    BC    ;  pointers, registers, etc
  115.     INC    C
  116.     PUSH    BC
  117.     PUSH    DEè    DEC    HL
  118.     BIT    6,(HL)
  119.     JR    NZ,OUT
  120.     SET    5,(HL)
  121. OUT    LD    A,'\'    ;  Back to where we started
  122.     JP    PRINT
  123.  
  124.     END
  125.