home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
High Voltage Shareware
/
high1.zip
/
high1
/
DIR8
/
PCMCVT.ZIP
/
PCMASM.ZIP
/
WRICONV.INC
< prev
Wrap
Text File
|
1993-04-22
|
3KB
|
114 lines
;WRICONV.INC
;Copyright (c) 1993 Jay Munro
;First Published in PC Magazine June 29 1993
;PCMCVT Conversion module for Windows Write
;
WriCVT Proc Near
Invoke Seek, SHandle, 128 ;seek to start of file
Jnc @F
Jmp WRIExit ;error, bag out
@@:
Lea SI, HeaderBuffer ;get address of header to check
Mov Word Ptr AX, [SI].MSWdfcMac ;get low word of end of text
Mov MSW4DFileEnd,AX
Mov Word Ptr AX,[SI+2].MSWdfcMac ;and high byte
Mov MSW4DFileEnd[2],AX
Sub Word Ptr MSW4DFileEnd,127 ;clear off starting point
Sbb Word Ptr MSW4DFileEnd[2],0
ReadWRIFile:
Call WRIReadIt ;go read the file
RWRILoop: ;weed out control chars
LodSb ;grab a character
Sub Word Ptr MSW4DFileEnd, 1
Sbb Word Ptr MSW4DFileEnd[2], 0
Cmp Word Ptr MSW4DFileEnd, 0
Jnz @F
Cmp Word Ptr MSW4DFileEnd[2], 0
Jnz @F
Call FlushIt
Jmp WRIExit ;exit stage left
MSWRIFileEnd DW 0,0
@@:
Cmp AL,13 ;a carriage return?
Jnz @F
Jmp WriteWhatsLeft2 ;write what's in AL
@@:
Cmp AL,10 ;hard cr for WRI
Jnz @F
Jmp WriteWhatsLeft2 ;write what's in AL
@@:
Cmp AL,'Æ'
Jnz @F
Mov AL,39 ;apostrophe
Jmp WriteWhatsLeft2 ;write what's in AL
@@:
Cmp AL,15 ;em dash?
Jnz @F ;nope, keep going
Mov AL,'ù' ;em dash symbol???
@@:
Cmp AL,'ù'
Jnz @F
Mov AL,'-' ;store dual hyphans
Call WRIWrite
Mov AL,'-' ;store dual hyphans
Jmp WriteWhatsLeft2
@@:
Cmp AL,2 ;print current date;
Jnz @F ;future expansion
Jmp WRIReLoop
@@:
Cmp AL,3 ;print current time
Jnz @F ;future expansion
Jmp WRIReLoop
@@:
Cmp AL,9 ;tab
Jnz @F
Call DoTabs ;expand the tabs
Jmp WRIReLoop
@@:
Cmp AL,31 ;ok, skip the rest
Jbe WRIReLoop ;skip it
Cmp AL,196 ;two other skippers
Jz WRIReLoop
Cmp AL,254 ;skip
Jae WRIReLoop
;write what's left
WriteWhatsLeft2:
Call WRIWrite ;call our local write module
Jmp WRIReLoop
WRIReLoop:
Loop RWRILoop
Jmp ReadWRIFile ;go back for more
WRIWrite:
Call WriteIt ;no, then write it
Jc WRIExit
RetN
WRIReadIt:
Call ReadIt ;go read the file
Jnc @F ;a fine read, continue
Mov AL,-1 ;a bad read, quit now
Call WRIWrite ;flush buffer
Jmp WRIExit
@@:
RetN
WRIExit:
Ret
WriCVT EndP