my $c = pack('W*', @binbytes);
print $out $c;
####
MESSAGE INIT WORKING DIRECTORIES-SETUP.MC
MESSAGE
INIT MACROS
INIT UTIL
INIT FORT
DIR PETE
GDIR
##
##
00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000190 4d 45 53 53 41 47 45 20 49 4e 49 54 20 57 4f 52 |MESSAGE INIT WOR|
000001a0 4b 49 4e 47 20 44 49 52 45 43 54 4f 52 49 45 53 |KING DIRECTORIES|
000001b0 2d 53 45 54 55 50 2e 4d 43 0d 4d 45 53 53 41 47 |-SETUP.MC.MESSAG|
000001c0 45 0d 49 4e 49 54 20 4d 41 43 52 4f 53 0d 49 4e |E.INIT MACROS.IN|
000001d0 49 54 20 55 54 49 4c 0d 49 4e 49 54 20 46 4f 52 |IT UTIL.INIT FOR|
000001e0 54 0d 44 49 52 20 50 45 54 45 0d 47 44 49 52 0d |T.DIR PETE.GDIR.|
000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000380
##
##
#! /usr/bin/perl
# ptreader.pl - Papertape decoder for the Simh Data General Nova/Eclipse Simulator
# The linux file PTP.OUT is produced by the RDOS BPUNCH command
# PTP.OUT is a binary file that has a lot of leading and trailing nulls
# The nulls are stripped off and the remainder is copied to the output
# file PTP.TXT. Line endings are converted.
#
# ptreader provides a way to copy text files from
# the simulated RDOS filesystem to the linux filesystem
#
# RDOS -> PTP.OUT -> ptreader.pl -> PTP.TXT
#
# Created by: James M. Lynes jr.
# Created on: January 29,2024
# Last Modified: 01/29/2024 - Initial version
# 01/30/2024 - Additional comments, fix line ending(0x0A)
#
# Usage: On RDOS: BPUNCH filename
# Creates the (binary formatted) linux file: PTP.OUT
#
# On linux: ./ptreader.pl
# Reads PTP.OUT and creates the reformated linux text file PTP.TXT
#
# Note: Use ptwriter.pl to format a linux text file to be read by RDOS
use strict;
use warnings;
open(my $in, '<:raw', "PTP.OUT") or die;
open(my $out, '>', "PTP.TXT") or die;
my $content;
my $length;
my $maxlength = 4000;
my @inbytes;
my @outbytes;
$length = read($in, $content, $maxlength); # Read the binary file
print "Length: $length\n"; # Show total bytes read
@inbytes = unpack("C*", $content); # Unpack bytes into an array
foreach(@inbytes) { # Delete null bytes
next if($_ == 0);
push(@outbytes, $_);
}
foreach(@outbytes){printf ("0x%02X ", $_)}; # Show a hex dump of array
print "\n";
foreach(@outbytes) { # Show the text read
my $code = chr($_);
if($_ == 0x0D) {
$code = chr(0x0A); # Fix linux line ending
}
print "$code";
print $out $code; # Copy text to output file
}
close $in;
close $out;
##
##
#! /usr/bin/perl
# ptwriter.pl - Papertape encoder for the Simh Data General Nova/Eclipse Simulator
# The linux file PTR.IN is a binary formatted file which can
# be read from the RDOS $PTR1 device.
#
# The user is prompted for the linux text file to convert
#
# ptwriter provides a way to copy text files from
# the linux filesystem to the simulated RDOS filesystem
#
# linux file -> ptwriter.pl -> PTR.IN -> RDOS
#
# Created by: James M. Lynes jr.
# Created on: January 30,2024
# Last Modified: 01/30/2024 - Initial version
#
#
# Usage: On linux: ./ptwriter.pl
# Creates the (binary formatted) linux file: PTR.IN
# User is prompted for the linux text file name
#
# On RDOS: XFER/A $PTR1 filename
# Copies linux file PTP.IN to RDOS file filename
#
#
# Note: Use ptreader.pl to format a RDOS binary file into a linux text file
use strict;
use warnings;
print "\n\n";
print "ptwriter - convert linux text file to RDOS papertape input file\n";
print "===============================================================\n";
print "Input linux text file name: ";
my $lfile = ;
chomp($lfile);
open(my $in, '<', $lfile) or die;
open(my $out, '>', "PTR.IN") or die;
my @inbytes;
my @bytes;
my @outbytes;
my $outbytes;
my @binbytes;
while(my $line = <$in>) { # Read text file convert to binary
@bytes = unpack('C*', $line);
push(@outbytes, @bytes);
}
my $len = $#outbytes + 1;
print "Characters Read: $len\n\n";
#foreach(@outbytes){printf ("0x%02X ", $_)}; # Show a hex dump of array
#print "\n\n";
foreach(@outbytes) {
my $code = $_;
if($code == 0x0A) { # Convert linux line end to RDOS line end
$code = 0x0C;
}
# printf("0x%02X ", $code); # Show the converted text
push(@binbytes, $code);
}
#print "\n\n";
#foreach(@binbytes) {printf ("0x%02X ", $_)}; # *** Output data looks good at this point ***
#print "\n\n";
my $ctr = 0;
foreach(@binbytes) { # *** This code not producing correct
my $c = $binbytes[$ctr]; # binary file ***
print "$c";
print $out $c;
$ctr = $ctr + 1;
}
close $in;
close $out;