; ; TCONV.MAC Copyright Nicholas Zymaris 18-Jan-86 Version 1.2 ; ; Converts an RMS/FCS variable-record-length file (e.g. P/OS text file) to ; RT-11 text file format. ; ; P/OS file may be copied using my RT11FRPOS program running under P/OS. ; ; To use, type RUN TCONV outputfile=inputfile ; Or, type RUN TCONV. Each time you see the * prompt you may type another ; command string, so multiple commands can be issued rather that only one via ; the one-line method. To exit from this mode, wait for the * and type ^C. ; ; Default extension for input file is .MAC, default for output file is .MA1. ; Typing the /H switch will result in a short online help message. ; Typing the /I switch will result in the name of this program and its version ; number being displayed. ; ; Trailing nulls in a file become trailing CRLFs, which may be deleted in an ; editor if desired (there is no automatic way to distinguish between a null ; record and the nulls right before EOF, since F.FFBY is lost when the file ; leaves the P/OS environment). The unused bytes resulting from RMS/FCS ; rounding (to get the control words on word boundaries) are converted to ; embedded nulls. This means that when you enter and exit the editor, the ; file will be shortened by about 4% automatically. No data has been lost, ; since nulls are virtually meaningless in a normal RT-11 text file. ; .enabl lsb, lc .mcall .csigen,.readw,.writw,.close,.exit,.print,.qset q: .blkw 7*4 filbuf: .blkb 512. area: .blkw 10. hand: .blkw 20. block: .blkw 1 ; Block of file crlf: .byte 15,12 ; Word-aligned intmsg: .asciz /TCONV V1.2 (c) 1986 Nicholas Zymaris/ hlpmsg: .asciz /Type =/ err: .asciz /Error reading file./ illswt: .asciz /Illegal switch./ .even defext: .rad50 /MAC/ ; Default extension for input file .rad50 /MA1/ ; Default extension for output file ; ; Code ; error: .print #err ; Print error message br 6$ ; Reprompt start: .qset #q,#4 ; Reserve 4 Q-elements .print #intmsg ; Print introductory message 6$: .csigen #hand,#defext,#0 ; Get command line and open files ; Input file on chan. 3, output on 0 tst (sp)+ ; Any switches typed? bne 7$ ; Check for help switch if NE br ok ; Else continue with program 7$: cmpb #'H,(sp) ; Help switch typed? bne 8$ ; No, see if ID switch .print #hlpmsg ; Print help message clr (sp)+ ; Restore stack br 6$ ; Get another command 8$: cmpb #'I,(sp) ; Identification switch? bne 9$ ; No, illegal switch .print #intmsg ; Print message clr (sp)+ ; Restore stack br 6$ ; And get another command 9$: .print #illswt ; Give error clr (sp)+ ; Restore stack br 6$ ; And get another command ok: .readw #area,#3,#filbuf,#400,#0 ; Read block 0 of input file bcs error ; Error reading file -- reprompt clr block ; Current block clr r3 ; Pointer to file buffer mov filbuf(r3),r4 ; For first record, clr filbuf(r3) ; clear first control word to ; eliminate spurious CRLF. br 2$ ; Skip CRLF code first time only main: mov filbuf(r3),r4 ; Get RMS byte count 3$: mov crlf,filbuf(r3) ; Replace with CRLF for RT-11 2$: add r4,r3 ; Point to next record add #2,r3 ; Account for size of control word cmp r3,#1000 ; If past end of block, read new block bge 4$ ; before writing the null 5$: bit #1,r3 ; Odd address? beq 1$ ; Not if EQ movb #0,filbuf(r3) ; Fill extra byte with a null inc r3 ; Make odd number even 1$: cmp r3,#1000 ; End of block? blo main ; No, just continue 4$: .writw #area,#0,#filbuf,#400,block ; Write blks to output file inc block ; Read next block .readw #area,#3,#filbuf,#400,block ; Do it bcs done ; Read error = probable EOF sub #1000,r3 ; Update pointer br 5$ ; And continue done: .close #3 ; Close input file .close #0 ; Close output file jmp 6$ ; Get another command line if in "*" .end start ; mode.