Converting simh .tap file to real tape

From: Kevin Handy <kth_at_srv.net>
Date: Mon Feb 17 11:24:00 2003

Christopher McNabb wrote:

>I've a .tap file with an image of the micro 83 maintenance tape. I
>tried writing the image to a real tape using vtserver, however,
>vtserver appears to want to put the entire .tap image into one tape file
>on the real tape. Is there a program out there that will do the correct
>thing (boot blocks in file 0, data in file 1, etc, etc)?
>
>I'm running RSTS/E 9.7 on the machine and can xfer the .tap file to the
>-11 using kermit.
>

Not sure how much help this will be, but here is a program I
used to create TAP files on RSTS and VMS systems. This
particular copy was used on a VAX system, so you will need
to adjust the value assigned to MAX_RECORD% for the smaller
memory available on a PDP-11 (8192 should work well).
You may also need to strip down the "open" statement for
the tape drive (lose organization, recordtype and access;
but leave the recordsize), but you might need them if you
compile with Basic+2.

Code is ugly, but it worked. Images created were usable with
simh.

It might at least give you a start at reversing the process.
1 !
        ! Program to read a tape into simh format file
        !
        ! Ugly and rough, but it works.
        ! Anything unexpected will cause it to crash.
        !
        ! You must first "mount mka500:/for/blo=65000" before
        ! running this
        !
        ! 08/16/2002 - Kevin Handy
        ! Fixed it so it actualy works
        !

100 TAPE.CH% = 7%

        LINPUT "Tape device <MKA500:> ", TAPE_DEVICE$
        TAPE_DEVICE$ = "MKA500:" IF TAPE_DEVICE$ = ""

        !
        ! Make this smaller for RSTS, else it will run out of memory
        !
        MAX_RECORD% = 50240%

        OPEN TAPE_DEVICE$ for input AS FILE TAPE.CH%, &
                ORGANIZATION SEQUENTIAL, &
                RECORDTYPE NONE, &
                RECORDSIZE MAX_RECORD%, &
                ACCESS READ

        V% = MAGTAPE(3%, 0%, tape.CH%) ! Rewind tape

110 FILE.CH% = 8%

        LINPUT "Save into <tape.tape> ", FILE_NAME$
        FILE_NAME$ = "TAPE.TAPE" IF FILE_NAME$ = ""

        !
        ! Lose everything from ORGANIZATION on for RSTS, which doesn't
        ! need it.
        !
        OPEN FILE_NAME$ FOR OUTPUT AS FILE FILE.CH%, &
                ORGANIZATION SEQUENTIAL fixed, &
                RECORDTYPE NONE, &
                RECORDSIZE 512%

        EOF% = 0%

200 WHEN ERROR IN
                GET #TAPE.CH%
                RCT% = recount
        USE
                IF ERR = 11% OR ERR=252%
                THEN
                        CONTINUE WriteEOF
                END IF

                PRINT "Unhandled error"; err; " "; ert$(err)
                stop

        END WHEN

        EOF% = 0%

        print "!";rct%;
        print RCT% if ccpos(0%) >= 50%

250 FIELD #TAPE.CH%, RCT% AS TBUFFER$

        BUFFER$ = BUFFER$ + &
                CHR$(RCT% AND 255%) + &
                CHR$(RCT% / 256% AND 255%) + &
                CHR$(RCT% / (256% * 256%) AND 255%) + &
                CHR$(RCT% / (256% * 256%* 256%) AND 255%) + &
                &
                TBUFFER$ + &
                &
                CHR$(RCT% AND 255%) + &
                CHR$(RCT% / 256% AND 255%) + &
                CHR$(RCT% / (256% * 256%) AND 255%) + &
                CHR$(RCT% / (256% * 256%* 256%) AND 255%)

        GOSUB WriteBlocks

        GOTO 200

 WriteEof:
        IF EOF% = 0%
        THEN
                !
                ! First EOF
                !
                RCT% = 0%
                GOSUB WriteLength
                EOF% = 1%
        ELSE
                !
                ! Second EOF
                !
                RCT% = 0%
                GOSUB WriteLength
                GOSUB WriteLength
                GOTO ExitProgram
        END IF

        GOTO 200

 WriteLength:
500 BUFFER$ = BUFFER$ + &
                CHR$(RCT% AND 255%) + &
                CHR$(RCT% / 256% AND 255%) + &
                CHR$(RCT% / (256% * 256%) AND 255%) + &
                CHR$(RCT% / (256% * 256%* 256%) AND 255%)

        GOSUB WriteBlocks

        RETURN

 WriteBlocks:
600 WHILE LEN(BUFFER$) >= 512%

                FIELD #FILE.CH%, 512% AS XBUFFER$
                LSET XBUFFER$ = BUFFER$
                PUT #FILE.CH%
                BUFFER$ = RIGHT(BUFFER$, 513%)

        NEXT

        RETURN

 ExitProgram:
10000 GOSUB WriteBlocks

        IF BUFFER$ <> ""
        THEN
                FIELD #FILE.CH%, 512% AS XBUFFER$
                LSET XBUFFER$ = BUFFER$
                PUT #FILE.CH%
        END IF

        CLOSE FILE.CH%
        CLOSE TAPE.CH%

32767 END
Received on Mon Feb 17 2003 - 11:24:00 GMT

This archive was generated by hypermail 2.3.0 : Fri Oct 10 2014 - 23:35:55 BST