home *** CD-ROM | disk | FTP | other *** search
- ;***************************************************************************
- ;** EPSPRN - a program to translate some IBM foreign characters to **
- ;** Epson foreign characters. **
- ;** **
- ;** To use, include the line 'EPSPRN' in AUTOEXEC.BAT **
- ;** **
- ;** CAUTION - does not work correctly with graphics programs!!! **
- ;** **
- ;** To assemble: MASM EPSPRN; **
- ;** LINK EPSPRN; **
- ;** EXE2BIN EPSPRN **
- ;** REN EPSPRN.BIN EPSPRN.COM **
- ;** ERASE EPSPRN.EXE **
- ;** **
- ;** Laine Stump, October 11, 1987 **
- ;** **
- ;** Permission granted to do whatever you damn well please with **
- ;** this program. **
- ;***************************************************************************
- ;
- CODE segment 'CODE'
- assume cs:code
- FIRSTBYTE equ this byte ;between here & LASTBYTE remains res.
-
- ORG 100h
- START: JMP INIT ;init code is at end so we can get rid of it.
-
- ;**********************************************************************
-
- XLATTABLE equ this byte
- XLTLEN equ 8 ;number of bytes in each xlation string
- ; structure is:
- ; IBMCHAR, up to 8 char xlation string terminated w/0FFh
- ; currently set up to do characters imp[ortant to Turkish alphabet
- ; unfortunately there is no way to properly do an undotted small "i"
- ; change to fit your requirements
-
- DB 80h,'C',8,',',0FFh,0,0,0,0 ;C
- DB 81h,1Bh,'R',2,'}',1Bh,'R',0,0FFh ;u
- DB 83h,'a',8,'^',0FFh,0,0,0,0 ;a
- DB 87h,'c',8,',',0FFh,0,0,0,0 ;c
- DB 8Dh,1Bh,'R',6,'~',1Bh,'R',0,0FFh ;i
- DB 8Eh,'A',8,'^',0FFh,0,0,0,0 ;A
- DB 94h,1Bh,'R',2,'|',1Bh,'R',0,0FFh ;o
- DB 98h,'I',8,'''',0FFh,0,0,0,0 ;I
- DB 99h,1Bh,'R',2,'\',1Bh,'R',0,0FFh ;O
- DB 9Ah,1Bh,'R',2,']',1Bh,'R',0,0FFh ;U
- DB 9Eh,'S',8,',',0FFh,0,0,0,0 ;S
- DB 9Fh,'s',8,',',0FFh,0,0,0,0 ;s
- DB 0A6h,'G',8,'~',0FFh,0,0,0,0 ;G
- DB 0A7h,'g',8,'~',0FFh,0,0,0,0 ;g
- DB 0 ;end of table sentinel
-
- ;**********************************************************************
-
- INT17h equ this dword
- INT17Ofs DW ?
- INT17Seg DW ?
-
- PREVCHAR DB 0
-
- ;**********************************************************************
-
- INTSERV:
- OR AH,AH ;IF function 0 (output char)
- JNZ INTSERV2
- CMP PREVCHAR,1Bh ; AND not midway in a printer command
- MOV PREVCHAR,AL
- JNE INTSERV0
- CMP AL,'$' ;only checking for these commands now
- JZ INTSERV00
- CMP AL,'C' ;because these are used by MS-WORD
- JZ INTSERV00
- CMP AL,'J'
- JZ INTSERV00
- CMP AL,'K'
- JNZ INTSERV01
- INTSERV00:
- MOV PREVCHAR,1Bh
- INTSERV01:
- JMP short INTSERV2
-
- INTSERV0:
- PUSH SI ;THEN translate
- MOV SI,offset XLATTABLE
- INTSERV1:
- CMP AL,CS:[SI] ;look for match in table
- JE INTSERV3
- ADD SI,XLTLEN+1
- CMP byte ptr CS:[SI],0; end of table?
- JNE INTSERV1
- POP SI
- INTSERV2:;output original character
- JMP INT17h
-
-
- INTSERV3:; output a string terminated w/FF
- ; string is at CS:[SI+1]
- INC SI
- CMP byte ptr CS:[SI],0FFh
- JE INTSERV9
- MOV AL,CS:[SI]
- MOV AH,0
- PUSH SI
- PUSH DX
- PUSHF
- CALL INT17h
- POP DX
- POP SI
- JMP INTSERV3
-
- INTSERV9:
- POP SI
- IRET
- LASTBYTE equ this byte
-
- ;************************************************************************
- ;
- ; Below this point only used during initialization, then discarded
- DOS equ 21h
- ;
- assume ds:code
- INIT: MOV AL,17h ;get the original INT 17h vector
- MOV AH,35h
- INT DOS
- MOV INT17Ofs,BX ;save to call later
- MOV INT17Seg,ES
-
- MOV AL,17h
- MOV DX,offset INTSERV
- MOV AH,25h
- INT DOS
-
- MOV DX,(LASTBYTE-FIRSTBYTE+15)/16
- MOV AL,0
- MOV AH,31h
- INT DOS
-
- CODE ends
- end START