home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / EPSONCHR.ZIP / EPSONCHR.ASM
Encoding:
Assembly Source File  |  1989-03-20  |  32.0 KB  |  785 lines

  1.  
  2. PAGE
  3. PAGE 60,132
  4. TITLE PR256 - IBM CHAR SET FOR MX100
  5.  
  6. ;******************************************************************************
  7. ;
  8. ;   PR256...Copyright Tim Field, 1982 (BYTE March 1983)
  9. ;
  10. ;   IBM CHARACTER SET - This program resides on the IBM
  11. ;     personal computer. All 256 characters used by the IBM will
  12. ;     be available to be printed out using the MX1000 or MX80 with
  13. ;     graphics option. The non-standard characters are printed
  14. ;     automatically by any process or program executing the IBM
  15. ;     interrupt #17H (normal print routine in BIOS).
  16. ;
  17. ;******************************************************************************
  18.  
  19.  
  20. ;******************************************************************************
  21. ;
  22. ;   DEFINE THE CONSTANTS USED BY PROGRAM
  23. ;
  24. ;******************************************************************************
  25.  
  26. INTADDR  EQU  017H * 4        ; Address to interrupt vector addr
  27. NEWINT     EQU  027H        ; DOS interrupt code for "End but stay resident"
  28. ESC_CHAR EQU  1BH        ; ASCII escape character
  29. NUL     EQU  0         ; ASCII NUL character
  30.  
  31. ;
  32. ; Define mask bytes used to turn on and off SYS_MODE for each printer
  33. ;
  34.  
  35. MASK$BIT_GRAF EQU 11111110B    ; Printer in bit-graphics mode
  36. MASK$SEC_BITG EQU 11111101B    ; Next character is 2nd graf char count
  37. MASK$FST_BITG EQU 11111011B    ; Next character is 1st graf char count
  38. MASK$NEW_INTL EQU 11110111B    ; Next char international char defn
  39. MASK$ESC_SING EQU 11101111B    ; Expect one more control character
  40. MASK$ESC_NULL EQU 11011111B    ; Expect control chars until NUL found
  41. MASK$ESC_C    EQU 10111111B    ; One more control char if non-zero, else 2 more
  42. MASK$PREV_ESC EQU 01111111B    ; Next char is escape defn char
  43.  
  44. ;
  45. ; Define structure used to hold each of the three (possibly existing)
  46. ; printers.
  47. ;
  48.  
  49. PRINTERS STRUC
  50.   SYS_MODE    DB  0        ; Stores bits pertaining to current printer code
  51.   GRAF_CNT    DW  0        ; 16 bit count of graphics chars...for bit-graf mode
  52.   FULL_INSTR    DB  0        ; <0 : CR/LF mode, >0 : No control codes, = 0 : normal
  53.   GRAF_PRINTER    DB  0        ; =0; Printer has EPSON graphics, >0; no
  54.   INTLSET    DB  0        ; 0-7 value of current international set for Epson
  55. PRINTERS ENDS
  56.  
  57. ;*******************************************************************************
  58. ;
  59. ; Define a temporary stack. Required for initialization of program only ...
  60. ;
  61. ;*******************************************************************************
  62.  
  63. STACK SEGMENT PARA STACK
  64.   DB   10 DUP ('STACK   ')
  65.  
  66. STACK ENDS
  67.       page
  68. ;********************
  69. ;
  70. ; Start code area!!
  71. ;
  72. ;********************
  73.  
  74. CODE SEGMENT
  75. ASSUME CS:CODE,DS:CODE,SS:STACK,ES:NOTHING
  76.  
  77. PR256 PROC FAR
  78.      ;
  79.      ; Initialization code...used only once, on system startup
  80.      ;
  81.      CALL INIT_CODE        ; Call initialization routine
  82.      RET            ; Return from initialization
  83.  
  84. ;******************************************************************************
  85. ;
  86. ; Define storage area here
  87. ;
  88. ;******************************************************************************
  89.  
  90.      DWORD_ADDR DW 0,0        ; Save address to BIOS print routine here
  91.      TMPBYTE    DB 9        ; A multiplicand
  92.      PR1    PRINTERS <>    ; Set aside area for three printers
  93.      PR2    PRINTERS <>
  94.      PR3    PRINTERS <>
  95.  
  96. ;******************************************************************************
  97. ;
  98. ; Start of actual print runtime code
  99. ;
  100. ;******************************************************************************
  101.  
  102. START_UP:    ; Start of actual print routine
  103.  
  104.      PUSH DS            ; Save segment register
  105.      PUSH SI            ;
  106.      PUSH BX            ;
  107.      PUSH CX            ;
  108.      PUSH DX            ;
  109.      PUSH AX            ;
  110.      MOV  BX,CS         ;
  111.      MOV  DS,BX         ;
  112.      CMP  AH,0            ; Is this to print out a char?
  113.      JE   PCHAR         ; Br if yes
  114.      CALL PR2BYTE        ; Otherwise, just print char
  115.      JMP  DONE            ;   and exit
  116.  
  117. PCHAR:
  118.  
  119.      MOV  BX,OFFSET PR1     ; Now get offset to printer structure
  120.      CMP  DL,0            ; DX contains 0,1,2 for printer number
  121.      JE   T1            ; Br if printer 0
  122.      ADD  BX,5            ; Move to next printer area
  123.      CMP  DL,1            ; Is it printer 1?
  124.      JE   T1            ; Br if yes
  125.      ADD  BX,5            ; Offset to printer 2 structure
  126.  
  127. T1:
  128.  
  129.      CMP  GRAF_PRINTER[BX],0    ; Are we talking to a printer with Epson graphics?
  130.      JNE  MORE$TO$COME        ; Send out char if not graphics printer
  131.      MOV  CH,SYS_MODE[bx]    ; Get system mode bits
  132.      RCR  CH,1            ; BIT_GRAP_MODE?
  133.      JNC  NOT$BIT$MODE        ; Branch if not
  134.      ;
  135.      ; We are in bit-graphics mode... decrement mode count and send character
  136.      ; as is to printer.
  137.      ;
  138.      DEC  GRAF_CNT[BX]        ; Decrement count of graphics chars left
  139.      JNZ  MORE$TO$COME        ; Are we done with graphics mode?
  140.      AND  SYS_MODE[BX],MASK$BIT_GRAF    ; If yes, clear bit to indicate
  141.      page
  142. MORE$TO$COME:
  143.  
  144.      JMP  SHORT SENDCHAR    ; Send bit-graf mode character
  145.  
  146. NOT$BIT$MODE:
  147.  
  148.      CMP  FULL_INSTR[BX],1    ; Are we "Full Instr Set" mode?
  149.      JE   TO$CHKCHAR        ; Br if yes... no "control char" check
  150.      JL   NORM_MODE        ; Br if in normal mode
  151.      ;
  152.      ; If we reach here, we are in CR/LF mode. The only "printer action"
  153.      ; codes expected in this mode are CR (ASCII 13) and LF (ASCII 10).
  154.      ; All other ASCII values are interpreted as characters to print.
  155.      ;
  156.      CMP  AL,13         ; Is Carriage Return character?
  157.      JE   SENDCHAR        ; Send to printer if yes
  158.      CMP  AL,10         ; Is Line Feed char?
  159.      JE   SENDCHAR        ; Send to printer if yes
  160.  
  161. TO$CHKCHAR:
  162.  
  163.      JMP  CHKCHAR        ; else print character from character set
  164.  
  165. NORM_MODE:
  166.  
  167.      RCR  CH,1                ; SEG_BITG_CNT?
  168.      JNC  NOT$SEC            ; Br if no
  169.      ;
  170.      ; If we reach here, the current character is the second count value for
  171.      ; the bit-graphics mode. It is the high-order byte and must be added
  172.      ; to the low oder byte which was the previous character.
  173.      ;
  174.      MOV  (FULL_INSTR-1)[BX],AL     ; Save Graf Cnt
  175.      AND  SYS_MODE[BX],MASK$SEC_BITG    ; Turn off SEC_BITG_CNT bit
  176.      CMP  GRAF_CNT[BX],0        ; Is count equal zero?
  177.      JLE  SENDCHAR            ; If yes, don't set Bit-graf mode
  178.      OR   SYS_MODE[BX],NOT MASK$BIT_GRAF; Indicate in Bit-graph mode
  179.      JMP  SHORT SENDCHAR        ; Send out count character
  180.      page
  181. NOT$SEC:
  182.  
  183.      RCR  CH,1                ; FST_BITG_CNT?
  184.      JNC  NOT$FST            ; Br if not
  185.      ;
  186.      ; If this bit is set, it indicates that the last character printed out
  187.      ; was "Start Bit Graphics mode" indication. The current character is
  188.      ; to be used as the low order byte of the count of bit-graphics characters
  189.      ; to be sent. The next character expected is the high-order byte for the
  190.      ; count.
  191.      ;
  192.      AND SYS_MODE[BX],MASK$FST_BITG    ; Turn off FST_BITG_CNT bit
  193.      OR  SYS_MODE[BX],NOT MASK$SEC_BITG ; Turn on SEC_BITG_CNT bit
  194.      MOV GRAF_CNT[BX],AX        ; Save low order count
  195.      JMP SHORT SENDCHAR         ; Send count to printer
  196.  
  197. NOT$FST:
  198.  
  199.      RCR CH,1                ; NEW_INTL?
  200.      JNC NOT$INTL            ; Br if not
  201.      ;
  202.      ; If this bit is set, it indicates that we previously saw request for a
  203.      ; new "International" character set to be used. The current bute is
  204.      ; expected to be a value from 0 to 7 indicating the set to be used. If
  205.      ; an error is found, no set charge is accomplished.
  206.      ;
  207.      CMP AL,0                ; Is current char less than 0?
  208.      JL  NOT$VALID            ; Br if yes
  209.      CMP AL,7                ; Is it greater than 7?
  210.      JG  NOT$VALID            ; Br if yes
  211.      ;
  212.      ; If reach here, have valid set...update in memory
  213.      ;
  214.      MOV INTLSET[BX],AL
  215.  
  216. NOT$VALID:
  217.  
  218.      AND SYS_MODE[BX],MASK$NEW_INTL     ; Clear NEW_INTL bit
  219.      JMP SHORT SENDCHAR         ; Send out value to printer
  220.  
  221. NOT$INTL:
  222.  
  223.      RCR CH,1                ; ESC_SINGLE mode?
  224.      JNC NOT$ESC_NULL            ; Br if not
  225.      AND SYS_MODE[BX],MASK$ESC_SING    ; Turn off ESC_SINGLE mode
  226.      JMP SHORT SENDCHAR         ; Send char to printer
  227.  
  228. NOT$ESC_SING:
  229.  
  230.      RCR CH,1                ; ESC_NULL mode?
  231.      JNC NOT$ESC_NULL            ; Br if not
  232.      CMP AL,NUL             ; Is this a NUL character?
  233.      JNE SENDCHAR            ; If not, print out character
  234.      AND SYS_MODE[BX],MASK$ESC_NULL    ; Otherwise, turn off ESC_NULL mode 1st
  235.      JMP SHORT SENDCHAR         ;
  236.  
  237. NOT$ESC_NULL:
  238.  
  239.      RCR CH,1                ; ESC_NULL mode?
  240.      JNC NOT$ESC_C            ; Br if not
  241.      CMP AL,NUL             ; Is character NUL?
  242.      JNE NOT$NUL            ; Skip next if not
  243.      OR  SYS_MODE[BX],NOT MASK$ESC_SING ; Expect one more control char
  244.  
  245. NOT$NUL:
  246.  
  247.      AND SYS_MODE[BX],MASK$ESC_C    ; Turn off ESC_C mode
  248.  
  249. SENDCHAR:                ; Print out current character and return
  250.  
  251.      CALL PRBYTE            ; Call print routine
  252.      JMP  DONE                ; Go to end
  253.      page
  254. NOT$ESC_C:
  255.  
  256.      RCR  CH,1                ; PREV_ESC mode?
  257.      JNC  NOT$ESC            ; Br if not
  258.      ;
  259.      ; If PREV_ESC bit is set, it indicates that the last character seen by
  260.      ; this printer was an "Escape" code. We will now look and see if it is
  261.      ; a control code that we need to remember. These are:
  262.      ;
  263.      ;      ESC "L" - Puts printer in dual density bit graphics mode
  264.      ;      ESC "K" - Puts printer in single density bit graphics mode
  265.      ;      ESC "R" - Selects an International character set in printer
  266.      ;
  267.      ; In addition to the codes that we need to remember, we have some
  268.      ; codes which set a temporary mode. These temporary modes are:
  269.      ;
  270.      ;      "ESC_SINGLE"  : Expect one more control code. This is to be
  271.      ;              sent to the printer.
  272.      ;      "ESC_NULL"    : Expect control codes to continue until a NULL
  273.      ;              character (ASCII 0) is received.
  274.      ;      "ESC_C"       ; Expect one more control code. If that code is
  275.      ;              an ASCII 0, expect one more after that.
  276.      ;
  277.      ; The escape sequences which set these modes are:
  278.      ;
  279.      ;      ESC "A" - ESC_SINGLE mode
  280.      ;      ESC "D" - ESC_NULL mode
  281.      ;      ESC "Q" - ESC_SINGLE mode
  282.      ;      ESC "B" - ESC_NULL mode
  283.      ;      ESC "C" - ESC_C mode
  284.      ;      ESC "N" - ESC_SINGLE mode
  285.      ;
  286.      AND SYS_MODE[BX],MASK$PREV_ESC    ; Turn off PREV_ESC mode bit
  287.      CMP AL,'L'                         ; CTRL-K?
  288.      JE  SET$BIT_GRAF            ; Br if yes
  289.      CMP AL,'K'                         ; CTRL-K?
  290.      JNE ARND$BIT_GRAF            ; Br if not
  291.  
  292. SET$BIT_GRAF:
  293.  
  294.      OR  SYS_MODE[BX],NOT MASK$FST_BITG ; Ind.that next char is FST_BITG_CNT
  295.      JMP SHORT SENDCHAR         ; Done, send out
  296.  
  297. ARND$BIT_GRAF:
  298.  
  299.      CMP AL,'R'                         ; CTRL-R?
  300.      JNE NOT$INT            ; Br if not
  301.      OR  SYS_MODE[BX],NOT MASK$NEW_INTL ; Indicate next char is NEW_INTL bit
  302.      JMP SHORT SENDCHAR         ; Send out character
  303.  
  304. NOT$INT:
  305.  
  306.      CMP AL,'A'                         ; ESC A?
  307.      JE  DO$ESC_SINGLE            ; Br if yes
  308.      CMP AL,'Q'                         ; ESC Q?
  309.      JE  DO$ESC_SINGLE            ; Br if yes
  310.      CMP AL,'N'                         ; ESC N?
  311.      JNE NOT$SINGLE            ; Br if not ESC_SINGLE mode
  312.  
  313. DO$ESC_SINGLE:                ; Set ESC_SINGLE mode
  314.  
  315.      OR  SYS_MODE[BX],NOT MASK$ESC_SING ;
  316.      JMP SHORT SENDCHAR         ; Print out char
  317.  
  318. NOT$SINGLE:                ; Check for ESC_NULL mode now
  319.  
  320.      CMP AL,'D'                         ; ESC D?
  321.      JE  DO$ESC_NULL            ; Br if yes
  322.      CMP AL,'B'                         ; ESC B?
  323.      JNE NOT$NULL            ; Br if not ESC NULL mode
  324.  
  325. DO$ESC_NULL:                ; Set ESC_NULL mode
  326.  
  327.      OR  SYS_MODE[BX],NOT MASK$ESC_NULL ;
  328.      JMP SHORT SENDCHAR         ; Print out char
  329.  
  330. NOT$NULL:                ; Check for ESC_C mode now
  331.  
  332.      CMP AL,'C'                         ; ESC C?
  333.      JNE NOT$ESCC            ; Br if not
  334.      OR SYS_MODE[BX],NOT MASK$ESC_C    ; Set ESC_C mode bit
  335.  
  336. NOT$ESCC:            ; Whatever type of char this is...print it
  337.  
  338.      JMP SHORT SENDCHAR
  339.  
  340. NOT$ESC:            ; Previous char was not an ESCAPE control char
  341.      ;
  342.      ; Is thia an ESCAPE code?
  343.      ;
  344.      CMP AL,ESC_CHAR            ;
  345.      JNE NESC                ; Br if not
  346.      OR SYS_MODE[BX],NOT MASK$PREV_ESC    ; Set escape found bit
  347.      JMP SHORT SENDCHAR         ; Send out character
  348.  
  349. NESC:
  350.  
  351.      ;
  352.      ; See if we have any standard control codes...ASCII 7-20
  353.      ;
  354.      CMP AL,07H             ; Is character less than 7?
  355.      JL  CHKCHAR            ; Br if yes, not control code
  356.      CMP AL,14H             ; Is character greater than 14?
  357.      JLE SENDCHAR            ; If not, is a control code...print it
  358.  
  359. CHKCHAR:
  360.      ;
  361.      ; Here we ckeck to see if the character to be printed is in the range
  362.      ; of 20H to 7EH (ASCII value of the character to be printed.) If in
  363.      ; that range, use standard Epson character set. Otherwise, we have
  364.      ; a special character to print.
  365.      ;
  366.      MOV AH,0                ; Make sure nothing is in upper byte
  367.      CMP AX,20H             ; Is character less than 20H?
  368.      JL  BIT$CHAR            ; Br if yes, special character
  369.      CMP AX,7EH             ;
  370.      JLE SENDCHAR            ; Not a special character, just print it
  371.      SUB AL,7EH-20H+1            ; Subtract non-special character set out
  372.  
  373. BIT$CHAR:
  374.      ;
  375.      ; See if current character is part of the Epson's International character
  376.      ; set. (If its offset into BITTYP array is 0, international.
  377.      ;
  378.      PUSH BX                ; Save offset to starage area
  379.      PUSH AX                ; Save current character
  380.      MOV BX,AX                ;
  381.      MOV CL,3                ; Shift count
  382.      SHR BL,CL                ; Shift lower three bits from AL
  383.      MOV CH,BITTYP[BX]            ; Get byte containing type bit
  384.      SHL BL,CL                ; Move AL back to original position
  385.      ; Note: we have now lost the lower three bits from AL.
  386.      NEG BX                ; Take two's complement of BL
  387.      ADD BL,AL                ; Add original contents of AL to negated
  388.                     ;   value to get right three bits
  389.      INC BL                ; This is now our index to type bit
  390.      MOV CL,BL                ; Let's use value as shift count
  391.      MUL TMPBYTE            ; Offset into array
  392.      MOV SI,AX                ; Get index into array
  393.      POP AX                ; Once again, get original char
  394.      SHL CH,CL                ; Recall CH holds bit-type byte
  395.      JC  DO$BIT_GRAF            ; Carry now is type of the char
  396.      ;
  397.      ; Well, we see that the bit type was 0, so we are to specify a char
  398.      ; from the Epson international character set. To determine which, we
  399.      ; expect the first byte in BITVAL array to tell us which international
  400.      ; set to use and the second byte to tell us the character to print.
  401.      ;
  402.      MOV CH,BITVAL[SI]            ; Get character set
  403.      CMP INTLSET[BX],CH         ; Is this the set we are now using?
  404.      JNE NEW$INTSET            ; Br if not
  405.      POP BX                ; Keep stack clean
  406.      MOV AL,BITVAL[SI][1]        ; If yes, just send out character
  407.      JMP SENDCHAR            ;
  408.  
  409. NEW$INTSET:            ; Must temporarily set up new international set
  410.  
  411.      MOV AL,ESC_CHAR            ; Print out "ESC" char
  412.      CALL PRBYTE            ;
  413.      MOV AL,'R'                         ; Send  out new international signal
  414.      CALL PRBYTE            ;
  415.      MOV AL,CH                ; Print out character set to use
  416.      CALL PRBYTE            ;
  417.      MOV AL,BITVAL[SI][1]        ; Get intl character to print
  418.      CALL PRBYTE            ;
  419.      MOV AL,ESC_CHAR            ; Now restore original character set
  420.      CALL PRBYTE            ;
  421.      MOV AL,'R'                         ;
  422.      CALL PRBYTE            ;
  423.      POP  BX                ; Restore address to store area
  424.      MOV  AL,INTLSET[BX]        ; Set type
  425.      CALL PRBYTE            ;
  426.      JMP  DONE                ; We are done so exit program
  427.  
  428. DO$BIT_GRAF:            ; Special bit-graphics mode
  429.  
  430.      POP  BX                ; Restore to keep stack straight
  431.      PUSH AX                ; Save current character for indexing
  432.      MOV  AL,ESC_CHAR            ; Put printer in dual density bit mode
  433.      CALL PRBYTE            ;
  434.      MOV  AL,'L'                        ;
  435.      CALL PRBYTE            ;
  436.      MOV  AL,12             ; Each graphics character consists of
  437.      CALL PRBYTE            ; exactly 9 columns of bits followed
  438.      MOV  AL,0                ; by 3 blank columns (12 columns total)
  439.      CALL PRBYTE            ;
  440.      POP  AX                ;
  441.      CMP  AX,0B3H-(7EH-20H+1)        ; See if extended set
  442.      JL   NON_EXTND            ; Br if not
  443.      CMP  AX,0E0H-(7EH-20H+1)        ;
  444.      JGE  NON_EXTND            ;
  445.      ;
  446.      ; The character is in the "extended" set. (ASCII 176 to 223)
  447.      ;
  448.      MOV  AL,BITVAL[SI]         ; Pre-extended first column
  449.      CALL PR9BYTS            ; Print out character
  450.      JMP  AROUND            ; Move around non-extended set
  451.  
  452. NON_EXTND:            ; Character is non-extended
  453.  
  454.      MOV  AL,0                ; First column is blank
  455.      CALL PR9BYTS            ; Print out character
  456.      MOV  AL,0                ; Last two columns are blank
  457.  
  458. AROUND:
  459.  
  460.      CALL PRBYTE            ; Print out last two columns
  461.      CALL PRBYTE            ;
  462.  
  463. DONE:                ; Exit Program
  464.  
  465.      POP  DX                ; Restore AL without disturbing AH
  466.      MOV  AL,DL             ;
  467.      POP  DX                ; Rsetore registers
  468.      POP  CX                ;
  469.      POP  BX                ;
  470.      POP  SI                ;
  471.      POP  DS                ;
  472.      IRET                ; Return from interrupt
  473.  
  474. PR256 ENDP            ; Done with main routine !!!
  475.      page
  476. ;******************************************************************************
  477. ;
  478. ;    PRBYTE - clears current value of AH and prints out character in AL
  479. ;
  480. ;*****************************************************************************
  481.  
  482. PRBYTE PROC NEAR
  483.  
  484.      MOV  AH,0                    ; Clear out for printing w/BIOS
  485.      CALL PR2BYTE                ; Do actual printout of char
  486.      RET                    ; Done
  487.  
  488. PRBYTE      ENDP
  489.  
  490. ;******************************************************************************
  491. ;
  492. ;    PR2BYTE - Calls IBM's BIOS print routine to print out contents of AX
  493. ;
  494. ;******************************************************************************
  495.  
  496. PR2BYTE PROC NEAR
  497.  
  498.      PUSH DS
  499.      PUSH SI
  500.      PUSHF                    ; IBM print proc expects interrupt call
  501.      MOV  SI,SEG DWORD_ADDR            ; Get segment to ROM code
  502.      MOV  DS,SI                 ;
  503.      MOV  SI,OFFSET DWORD_ADDR            ; Get address to ROM code for print
  504.      CALL DWORD PTR [SI]            ; Call print routine
  505.      POP  SI
  506.      POP  DS
  507.      RET                    ; Return
  508.  
  509. PR2BYTE   ENDP
  510.  
  511. ;******************************************************************************
  512. ;
  513. ;    PR9BYTS - Prints out a graphics character using BITVAL table below.
  514. ;           On entry, AL contains byte value of first column to be printed.
  515. ;           Next nine columns of character are fetched from indexing thru
  516. ;           SI (which must be initialized by calling routine) into the
  517. ;           BITVAL table.
  518. ;
  519. ;*****************************************************************************
  520.  
  521. PR9BYTS PROC NEAR
  522.  
  523.      CALL PRBYTE                ; Print out first column
  524.      MOV  CX,9                    ; Loop through 9 columns
  525.  
  526. LOOP$SEND:
  527.  
  528.      MOV  AL,BITVAL[SI]             ; Get next column to print
  529.      CALL PRBYTE                ; Print it out
  530.      INC  SI                    ; Move to next column
  531.      LOOP LOOP$SEND                ; Loop until done
  532.      RET                    ; If done, then return
  533.  
  534. PR9BYTS ENDP
  535.      PAGE
  536. ;******************************************************************************
  537. ;
  538. ;    Define characters... 9 bytes per character
  539. ;
  540. ;******************************************************************************
  541.  
  542.      .RADIX 16 ; All value in hexadecimal
  543.  
  544. BITVAL      DB   000,000,000,000,000,000,000,000,000    ; 0 (Decimal ASCII)
  545.       DB   03C,042,089,0A5,085,0A5,089,042,03C    ; 1
  546.       DB   03C,07E,093,9BH,0FBH,9BH,93,07E,03C    ; 2
  547.       DB   060,0F0,0F8,07C,07E,07C,0F8,0F0,060    ; 3
  548.       DB   000,010,038,07C,0FE,07C,038,010,000    ; 4
  549.       DB   010,038,038,0D0,0EE,0D0,038,038,010    ; 5
  550.       DB   000,000,030,072,0FE,072,030,000,000    ; 6
  551.       DB   000,000,030,078,078,078,030,000,000    ; 7
  552.       DB   0FF,0FF,0CF,087,087,087,0CF,0FF,0FF    ; 8
  553.       DB   000,018,024,042,042,042,024,018,000    ; 9
  554.       DB   0FF,0E7,0DBH,0DBH,0DBH,0DBH,0DBH,0E7,0FF ; 10
  555.       DB   000,00C,012,012,012,0B2,0CC,0E0,000    ; 11
  556.       DB   000,000,064,094,09F,094,064,000,000    ; 12
  557.       DB   000,006,006,0FE,0A0,0A0,0A0,0E0,000    ; 13
  558.       DB   006,006,0FE,0A0,0A0,0A0,0AC,0AC,0FC    ; 14
  559.       DB   054,010,038,028,0EE,028,038,010,054    ; 15
  560.       DB   000,0FE,07C,07C,038,038,010,010,000    ; 16
  561.       DB   000,010,010,038,038,07C,07C,0FE,000    ; 17
  562.       DB   000,000,028,06C,0FE,06C,028,000,000    ; 18
  563.       DB   000,0F2,0F2,000,000,000,0F2,0F2,000    ; 19
  564.       DB   060,090,090,0FE,080,080,0FE,080,080    ; 20
  565.       DB   001,5DH,000,000,000,000,000,000,000    ; 21 * FRANCE - 5D
  566.       DB   000,03C,03C,03C,03C,03C,03C,03C,000    ; 22
  567.       DB   000,001,029,6DH,0FF,6DH,029,001,000    ; 23
  568.       DB   000,000,020,060,0FE,060,020,000,000    ; 24
  569.       DB   000,000,008,00C,0FE,00C,008,000,000    ; 25
  570.       DB   000,010,010,010,010,07C,038,010,000    ; 26
  571.       DB   000,010,038,07C,010,010,010,010,000    ; 27
  572.       DB   000,000,038,008,008,008,008,000,000    ; 28
  573.       DB   010,038,07C,010,010,010,07C,038,010    ; 29
  574.       DB   000,004,00C,01C,03C,01C,00C,004,000    ; 30
  575.       DB   000,020,030,038,03C,038,030,020,000    ; 31
  576.       DB   000,006,0AH,012,022,012,0AH,006,000    ; 127
  577.       DB   001,05C,000,000,000,000,000,000,000    ; 128 * FRANCE - 5C
  578.       DB   002,7DH,000,000,000,000,000,000,000    ; 129 * GERMANY - 7D
  579.       DB   001,7BH,000,000,000,000,000,000,000    ; 130 * FRANCE - 7B
  580.       DB   005,7DH,000,000,000,000,000,000,000    ; 131 * SWEDEN - 7D
  581.       DB   002,7BH,000,000,000,000,000,000,000    ; 132 * GERMANY - 7B
  582.       DB   001,040,000,000,000,000,000,000,000    ; 133 * FRANCE - 40
  583.       DB   002,007,055,0F5,0B5,0B5,0FE,04F,001    ; 134
  584.       DB   000,071,089,089,08F,088,088,050,000    ; 135
  585.       DB   000,00E,05F,0D5,095,095,0D5,5DH,00C    ; 136
  586.       DB   000,01C,0BE,0AA,02A,02A,0AA,0BA,018    ; 137
  587.       DB   001,7DH,000,000,000,000,000,000,000    ; 138 * FRANCE - 7D
  588.       DB   000,0A2,0A2,03E,01E,082,082,000,000    ; 139
  589.       DB   000,052,0D2,09E,08E,0C2,042,000,000    ; 140
  590.       DB   000,012,092,0DE,04E,002,002,000,000    ; 141
  591.       DB   002,5BH,000,000,000,000,000,000,000    ; 142 * GERMANY - 5B
  592.       DB   003,047,04E,0BA,0B2,0BA,04E,047,003    ; 143
  593.       DB   005,040,000,000,000,000,000,000,000    ; 144 * SWEDEN - 40
  594.       DB   004,7BH,000,000,000,000,000,000,000    ; 145 * DENMARK - 7B
  595.       DB   004,5BH,000,000,000,000,000,000,000    ; 146 * DENMARK - 5B
  596.       DB   000,00E,05F,0D1,091,091,0D1,05F,00E    ; 147
  597.       DB   002,07C,000,000,000,000,000,000,000    ; 148 * GERMANY - 7C
  598.       DB   000,00E,01F,091,0D1,051,011,01F,001    ; 149
  599.       DB   000,05E,0DF,081,081,0C1,05E,01F,001    ; 150
  600.       DB   001,07C,000,000,000,000,000,000,000    ; 151 * FRANCE - 7C
  601.       DB   020,0B0,099,00F,006,00C,098,0B0,020    ; 152
  602.       DB   002,05C,000,000,000,000,000,000,000    ; 153 * GERMANY - 5C
  603.       DB   002,05C,000,000,000,000,000,000,000    ; 154 * GERMANY - 5D
  604.       DB   018,03C,066,042,0FF,0FF,042,066,024    ; 155
  605.       DB   003,023,000,000,000,000,000,000,000    ; 156 * ENGLAND - 23
  606.       DB   000,000,094,054,03F,054,094,000,000    ; 157
  607.       DB   007,023,000,000,000,000,000,000,000    ; 158 * SPAIN - 23
  608.       DB   000,004,012,012,07C,090,090,040,000    ; 159
  609.       DB   004,00E,02A,06A,0EA,0AA,03C,01E,002    ; 160
  610.       DB   000,012,012,05E,0CE,082,002,000,000    ; 161
  611.       DB   000,00E,01F,011,051,0D1,091,01F,00E    ; 162
  612.       DB   000,01E,01F,041,0C1,081,01E,01F,001    ; 163
  613.       DB   007,07C,000,000,000,000,000,000,000    ; 164 * SPAIN - 7C
  614.       DB   007,05C,000,000,000,000,000,000,000    ; 165 * SPAIN - 5C
  615.       DB   000,012,0BA,0AA,0AA,0AA,072,07A,00A    ; 166
  616.       DB   000,072,0FA,08A,08A,08A,08A,0FA,072    ; 167
  617.       DB   007,5DH,000,000,000,000,000,000,000    ; 168 * SPAIN - 5D
  618.       DB   000,000,038,020,020,020,020,000,000    ; 169
  619.       DB   000,000,020,020,020,020,038,000,000    ; 170
  620.       DB   000,042,0F4,008,010,029,053,015,009    ; 171
  621.       DB   000,042,0F4,008,012,026,04A,01F,002    ; 172
  622.       DB   007,5BH,000,000,000,000,000,000,000    ; 173 * SPAIN - 5B
  623.       DB   010,038,06C,044,010,038,06C,044,000    ; 174
  624.       DB   000,044,06C,038,010,044,06C,038,010    ; 175
  625.       DB   000,055,000,0AA,000,055,000,0AA,000    ; 176
  626.       DB   055,0AA,055,0AA,055,0AA,055,0AA,055    ; 177
  627.       DB   0FF,0AA,0FF,055,0FF,0AA,0FF,055,0FF    ; 178
  628.       DB   000,000,000,000,0FF,000,000,000,000    ; 179
  629.       DB   008,008,008,008,0FF,000,000,000,000    ; 180
  630.       DB   028,028,028,028,0FF,000,000,000,000    ; 181
  631.       DB   008,008,008,0FF,000,000,0FF,000,000    ; 182
  632.       DB   008,008,008,00F,008,008,00F,000,000    ; 183
  633.       DB   028,028,028,028,03F,000,000,000,000    ; 184
  634.       DB   028,028,028,0EF,000,000,0FF,000,000    ; 185
  635.       DB   000,000,000,0FF,000,000,0FF,000,000    ; 186
  636.       DB   028,028,028,02F,020,020,03F,000,000    ; 187
  637.       DB   028,028,028,0E8,008,008,0F8,000,000    ; 188
  638.       DB   008,008,008,0F8,008,008,0F8,000,000    ; 189
  639.       DB   028,028,028,028,0F8,000,000,000,000    ; 190
  640.       DB   008,008,008,008,00F,000,000,000,000    ; 191
  641.       DB   000,000,000,000,0F8,008,008,008,008    ; 192
  642.       DB   008,008,008,008,0F8,008,008,008,008    ; 193
  643.       DB   008,008,008,008,00F,008,008,008,008    ; 194
  644.       DB   000,000,000,000,0FF,008,008,008,008    ; 195
  645.       DB   008,008,008,008,008,008,008,008,008    ; 196
  646.       DB   008,008,008,008,0FF,008,008,008,008    ; 197
  647.       DB   000,000,000,000,0FF,028,028,028,028    ; 198
  648.       DB   000,000,000,0FF,000,000,0FF,008,008    ; 199
  649.       DB   000,000,000,0F8,008,008,0E8,028,028    ; 200
  650.       DB   000,000,000,03F,020,020,02F,028,028    ; 201
  651.       DB   028,028,028,0E8,008,008,0E8,028,028    ; 202
  652.       DB   028,028,028,02F,020,020,02F,028,028    ; 203
  653.       DB   000,000,000,0FF,000,000,0EF,028,028    ; 204
  654.       DB   028,028,028,028,028,028,028,028,028    ; 205
  655.       DB   028,028,028,0EF,000,000,0EF,028,028    ; 206
  656.       DB   028,028,028,028,0E8,028,028,028,028    ; 207
  657.       DB   008,008,008,0F8,008,008,0F8,008,008    ; 208
  658.       DB   028,028,028,028,02F,028,028,028,028    ; 209
  659.       DB   008,008,008,00F,008,008,00F,008,008    ; 210
  660.       DB   000,000,000,0F8,008,008,0F8,008,008    ; 211
  661.       DB   000,000,000,000,0F8,028,028,028,028    ; 212
  662.       DB   000,000,000,000,03F,028,028,028,028    ; 213
  663.       DB   000,000,000,00F,008,008,00F,008,008    ; 214
  664.       DB   008,008,008,0FF,008,008,0FF,008,008    ; 215
  665.       DB   028,028,028,028,0FF,028,028,028,028    ; 216
  666.       DB   008,008,008,008,0F8,000,000,000,000    ; 217
  667.       DB   000,000,000,000,00F,008,008,008,008    ; 218
  668.       DB   0FF,0FF,0FF,0FF,0FF,0FF,0FF,0FF,0FF    ; 219
  669.       DB   00F,00F,00F,00F,00F,00F,00F,00F,00F    ; 220
  670.       DB   0FF,0FF,0FF,0FF,0FF,000,000,000,000    ; 221
  671.       DB   000,000,000,000,000,0FF,0FF,0FF,0FF    ; 222
  672.       DB   0F0,0F0,0F0,0F0,0F0,0F0,0F0,0F0,0F0    ; 223
  673.       DB   000,03C,042,042,042,03C,024,042,000    ; 224
  674.       DB   002,07E,000,000,000,000,000,000,000    ; 225 * GERMANY - 7E
  675.       DB   000,07E,040,040,040,040,040,070,000    ; 226
  676.       DB   000,040,07E,040,040,040,07E,040,000    ; 227
  677.       DB   082,0C6,0AA,092,082,082,082,0C6,000    ; 228
  678.       DB   000,03C,042,042,042,07C,040,040,040    ; 229
  679.       DB   000,001,07E,004,004,004,004,078,000    ; 230
  680.       DB   000,020,040,040,03E,020,040,040,000    ; 231
  681.       DB   000,099,0A5,0A5,0E7,0A5,0A5,099,000    ; 232
  682.       DB   000,038,054,092,092,092,054,038,000    ; 233
  683.       DB   002,03A,046,080,080,080,046,03A,002    ; 234
  684.       DB   000,000,04C,0B2,092,092,08C,000,000    ; 235
  685.       DB   038,044,044,044,038,044,044,044,038    ; 236
  686.       DB   000,03A,044,04C,054,064,044,0B8,000    ; 237
  687.       DB   000,000,038,054,092,082,000,000,000    ; 238
  688.       DB   000,01E,020,040,040,040,020,01E,000    ; 239
  689.       DB   000,054,054,054,054,054,054,054,000    ; 240
  690.       DB   000,022,022,022,0FA,022,022,022,000    ; 241
  691.       DB   000,002,08A,08A,052,052,022,022,000    ; 242
  692.       DB   000,022,022,052,052,08A,08A,002,000    ; 243
  693.       DB   000,000,000,000,07F,080,080,060,000    ; 244
  694.       DB   000,006,001,001,0FE,000,000,000,000    ; 245
  695.       DB   000,010,010,010,054,010,010,010,000    ; 246
  696.       DB   000,024,048,048,024,012,012,024,000    ; 247
  697.       DB   000,000,030,048,048,048,030,000,000    ; 248
  698.       DB   000,000,030,078,078,078,030,000,000    ; 249
  699.       DB   000,000,000,010,038,010,000,000,000    ; 250
  700.       DB   010,010,010,008,004,07E,040,040,040    ; 251
  701.       DB   080,070,080,080,078,000,000,000,000    ; 252
  702.       DB   044,08C,094,064,000,000,000,000,000    ; 253
  703.       DB   000,000,07C,07C,07C,07C,07C,000,000    ; 254
  704.       DB   000,000,000,000,000,000,000,000,000    ; 255
  705.     PAGE
  706. ;******************************************************************************
  707. ;
  708. ;    Set up bits to distinguish between normal graphics characters
  709. ;    and those which can use the MX100 International character sets
  710. ;
  711. ;*****************************************************************************
  712.  
  713. .RADIX 10      ; Back to decimal
  714.  
  715. BITTYP      DB   11111111B    ; ASCII 0 to 7
  716.       DB   11111111B    ;   8 -  15
  717.       DB   11111011B    ;  16 -  23
  718.       DB   11111111B    ;  24 -  31
  719.       DB   10000001B    ; 127 - 134
  720.       DB   11101110B    ; 135 - 142
  721.       DB   10001011B    ; 143 - 150
  722.       DB   01001010B    ; 151 - 158
  723.       DB   11111001B    ; 159 - 166
  724.       DB   10111101B    ; 167 - 174
  725.       DB   11111111B    ; 175 - 182
  726.       DB   11111111B    ; 183 - 190
  727.       DB   11111111B    ; 191 - 198
  728.       DB   11111111B    ; 199 - 206
  729.       DB   11111111B    ; 207 - 214
  730.       DB   11111111B    ; 215 - 222
  731.       DB   11011111B    ; 223 - 230
  732.       DB   11111111B    ; 231 - 238
  733.       DB   11111111B    ; 239 - 246
  734.       DB   11111111B    ; 247 - 254
  735.       DB   10000000B    ; 255
  736.  
  737.       PAGE
  738. LASTONE:  ; All code after this label is freed to DOS use after
  739.       ; initialization of the program
  740.  
  741.  
  742. ;******************************************************************************
  743. ;
  744. ;    Code to load and initialize the printing program ...
  745. ;    sets up DOS to keep all code before "LASTONE" label
  746. ;    safe from overlaying during system operation.
  747. ;
  748. ;******************************************************************************
  749.  
  750. INIT_CODE PROC NEAR
  751.  
  752.      POP  AX                ; Remove return address of CALL
  753.      ;
  754.      ; After this initialization routine is finished, we wish to return
  755.      ; to DOS and prevent DOS from overlaying the PR256 code.
  756.      ; This is done by replacing the INT X`20' command found at the front
  757.      ; of the Program Segment Prefix control block with an INT X`27'
  758.      ; "Program end but stay resident" command. The address to this instruction
  759.      ; is placed on the front of the stack, behind the return address
  760.      ; used by this subroutine. When the initialization is finished, this
  761.      ; routine returns to its caller (the main program) which executes a
  762.      ; return to the PSP, resulting in the INT X`27' command execution.
  763.      ;
  764.      PUSH DS                ; move segment address to PSP onto stack
  765.      MOV  DI,0                ; Set return to first location in PSP
  766.      PUSH DI                ;
  767.      PUSH AX                ; Restore return address
  768.      MOV  AL,NEWINT            ; Set up INT X`27' in PSP
  769.      MOV  [DI+1],AL            ;
  770.  
  771.      MOV  AX,0                ; set up address to INT 17H vector
  772.      MOV  DS,AX             ;
  773.      MOV  BX,INTADDR            ;
  774.      LES  DI,DWORD PTR [BX]        ; Load double word addr to BIOS print routine
  775.      MOV  AX,SEG DWORD_ADDR        ; Now set up addr to store BIOS addr
  776.      MOV  DS,AX             ;
  777.      MOV  DWORD_ADDR,DI         ;
  778.      MO B,8ccccccccccccccccccccccccccccccccz,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,mt a
  779. 1rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrse2-l1r,                                                                  h1rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr2MB88888888888888888888888888888888,A11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111r,                                                        c 02tCrrtcreA11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmvCA111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110e2x8r2rtve rrt
  780. 88888888888888888888888888888888888888888888888888888888888888888r2
  781. 8c -acXcSrrt
  782. 88888888888888888888888888888888888888888888888888888888888888888r r M t  88888888888888888888888888888888888888888888888888888888888888888r,                                                PcCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCrA
  783. 8 P 2C290SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSB tt1111111111111111111111111111111111111111111111111111111111111111112v c29x 2rSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSc 02tC,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,88E8BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBr, 81CA111111111111111111111111111111111111111111111111111111111111111111111rI    1 2rct111111111111111111111111111111111111111111111111111111111111111111111                                                                  h1rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrg  10t2     rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrA0PcCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCr1CIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII0 0A. ,                                                PcCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCr:t2Prrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr_Xa1rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr22cCtB8B L0e                                                        t
  784. 8 tCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC08CCrcP
  785. cSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSPcCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC