home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / msdos / microcrn / issue_39.arc / 86WRLD39.FIG < prev    next >
Encoding:
Text File  |  1987-12-02  |  5.2 KB  |  141 lines

  1. ;***************************************************************************
  2. ;** EPSPRN - a program to translate some IBM foreign characters to        **
  3. ;**          Epson foreign characters.                                    **
  4. ;**                                                                       **
  5. ;**          To use, include the line 'EPSPRN' in AUTOEXEC.BAT            **
  6. ;**                                                                       **
  7. ;**          CAUTION - does not work correctly with graphics programs!!!  **
  8. ;**                                                                       **
  9. ;**          To assemble:   MASM EPSPRN;                                  **
  10. ;**                         LINK EPSPRN;                                  **
  11. ;**                         EXE2BIN EPSPRN                                **
  12. ;**                         REN EPSPRN.BIN EPSPRN.COM                     **
  13. ;**                         ERASE EPSPRN.EXE                              **
  14. ;**                                                                       **
  15. ;**         Laine Stump, October 11, 1987                                 **
  16. ;**                                                                       **
  17. ;**         Permission granted to do whatever you damn well please with   **
  18. ;**         this program.                                                 **
  19. ;***************************************************************************
  20. ;
  21. CODE    segment 'CODE'
  22.         assume  cs:code
  23. FIRSTBYTE       equ     this byte       ;between here & LASTBYTE remains res.
  24.  
  25.         ORG     100h
  26. START:  JMP     INIT            ;init code is at end so we can get rid of it.
  27.  
  28. ;**********************************************************************
  29.  
  30. XLATTABLE       equ     this byte
  31. XLTLEN      equ 8       ;number of bytes in each xlation string
  32.     ; structure is:
  33.     ;     IBMCHAR, up to 8 char xlation string terminated w/0FFh
  34.     ; currently set up to do characters imp[ortant to Turkish alphabet
  35.     ; unfortunately there is no way to properly do an undotted small "i"
  36.     ; change to fit your requirements
  37.  
  38.         DB 80h,'C',8,',',0FFh,0,0,0,0       ;C
  39.         DB 81h,1Bh,'R',2,'}',1Bh,'R',0,0FFh ;u
  40.         DB 83h,'a',8,'^',0FFh,0,0,0,0       ;a
  41.         DB 87h,'c',8,',',0FFh,0,0,0,0       ;c
  42.         DB 8Dh,1Bh,'R',6,'~',1Bh,'R',0,0FFh ;i
  43.         DB 8Eh,'A',8,'^',0FFh,0,0,0,0       ;A
  44.         DB 94h,1Bh,'R',2,'|',1Bh,'R',0,0FFh ;o
  45.         DB 98h,'I',8,'''',0FFh,0,0,0,0      ;I
  46.         DB 99h,1Bh,'R',2,'\',1Bh,'R',0,0FFh ;O
  47.         DB 9Ah,1Bh,'R',2,']',1Bh,'R',0,0FFh ;U
  48.         DB 9Eh,'S',8,',',0FFh,0,0,0,0       ;S
  49.         DB 9Fh,'s',8,',',0FFh,0,0,0,0       ;s
  50.         DB 0A6h,'G',8,'~',0FFh,0,0,0,0      ;G
  51.         DB 0A7h,'g',8,'~',0FFh,0,0,0,0      ;g
  52.         DB 0    ;end of table sentinel
  53.  
  54. ;**********************************************************************
  55.  
  56. INT17h  equ     this dword
  57.     INT17Ofs    DW      ?
  58.     INT17Seg    DW      ?
  59.  
  60. PREVCHAR    DB  0
  61.  
  62. ;**********************************************************************
  63.  
  64. INTSERV:
  65.         OR      AH,AH               ;IF function 0 (output char)
  66.         JNZ     INTSERV2
  67.         CMP     PREVCHAR,1Bh        ; AND not midway in a printer command
  68.         MOV     PREVCHAR,AL
  69.         JNE     INTSERV0
  70.         CMP     AL,'$'              ;only checking for these commands now
  71.         JZ      INTSERV00
  72.         CMP     AL,'C'              ;because these are used by MS-WORD
  73.         JZ      INTSERV00
  74.         CMP     AL,'J'
  75.         JZ      INTSERV00
  76.         CMP     AL,'K'
  77.         JNZ     INTSERV01
  78. INTSERV00:
  79.           MOV   PREVCHAR,1Bh
  80. INTSERV01:
  81.         JMP     short INTSERV2
  82.  
  83. INTSERV0:
  84.         PUSH    SI                  ;THEN translate
  85.         MOV     SI,offset XLATTABLE
  86. INTSERV1:
  87.           CMP     AL,CS:[SI]        ;look for match in table
  88.           JE      INTSERV3
  89.           ADD     SI,XLTLEN+1
  90.           CMP     byte ptr CS:[SI],0; end of table?
  91.           JNE     INTSERV1
  92.         POP     SI
  93. INTSERV2:;output original character
  94.         JMP     INT17h
  95.  
  96.  
  97. INTSERV3:; output a string terminated w/FF
  98.          ; string is at CS:[SI+1]
  99.         INC     SI
  100.         CMP     byte ptr CS:[SI],0FFh
  101.         JE      INTSERV9
  102.           MOV     AL,CS:[SI]
  103.           MOV     AH,0
  104.           PUSH    SI
  105.           PUSH    DX
  106.           PUSHF
  107.           CALL    INT17h
  108.           POP     DX
  109.           POP     SI
  110.           JMP     INTSERV3
  111.  
  112. INTSERV9:
  113.         POP     SI
  114.         IRET
  115. LASTBYTE        equ     this byte
  116.  
  117. ;************************************************************************
  118. ;
  119. ;       Below this point only used during initialization, then discarded
  120. DOS equ 21h
  121. ;
  122.         assume  ds:code
  123. INIT:   MOV     AL,17h                  ;get the original INT 17h vector
  124.         MOV     AH,35h
  125.         INT     DOS
  126.         MOV     INT17Ofs,BX             ;save to call later
  127.         MOV     INT17Seg,ES
  128.  
  129.         MOV     AL,17h
  130.         MOV     DX,offset INTSERV
  131.         MOV     AH,25h
  132.         INT     DOS
  133.  
  134.         MOV     DX,(LASTBYTE-FIRSTBYTE+15)/16
  135.         MOV     AL,0
  136.         MOV     AH,31h
  137.         INT     DOS
  138.  
  139. CODE    ends
  140.         end     START
  141.