I've commited a change to as7 to use the C pre-processor. Not sure if it's

to everybody's taste.
This commit is contained in:
Warren Toomey
2016-03-13 21:08:43 +10:00
parent a3e3a263ef
commit 8b421eb27b
3 changed files with 60 additions and 42 deletions
+4 -2
View File
@@ -1,6 +1,8 @@
# Build the kernel, the filesystem and run SimH # Build the kernel, the filesystem and run SimH
# Put any defines for as7 here
#DEFINES=
AS=../tools/as7 AS=../tools/as7 $(DEFINES)
MKFS=../tools/mkfs7 MKFS=../tools/mkfs7
SYS=../src/sys SYS=../src/sys
@@ -18,7 +20,7 @@ coldboot:
$(AS) -f list -o a.lst $(SYS)/sop.s $(SYS)/s[1-9].s $(AS) -f list -o a.lst $(SYS)/sop.s $(SYS)/s[1-9].s
image.fs: image.fs:
$(MKFS) --debug --format simh proto $(MKFS) --format simh proto
clean: clean:
rm -f a.rim image.fs a.lst rm -f a.rim image.fs a.lst
+40 -38
View File
@@ -5,26 +5,28 @@ pibreak: " priority interrupt break processing "chain"
dac .ac " save interrupt AC dac .ac " save interrupt AC
"** CROSSED OUT.... "** CROSSED OUT....
" dpsf " Warren commented this code out to try and #ifdef GRAPHICS2
" jmp 1f " disable the Graphics-2 I/O dpsf
jmp 1f " disable the Graphics-2 I/O
" dpcf dpcf
" dprs dprs
" dac dpstat dac dpstat
" sma ral sma ral
" jmp 2f jmp 2f
" dprc dprc
" dac dpchar dac dpchar
" -1 -1
" dac dpread dac dpread
" lac dpstat lac dpstat
" ral ral
" 2: 2:
" sma sma
" jmp piret jmp piret
" -1 -1
" dac dpwrite dac dpwrite
" jmp piret "** END OF CROSSOUT jmp piret "** END OF CROSSOUT
#endif
1: clsf " clock overflow (line frequency ticks)? 1: clsf " clock overflow (line frequency ticks)?
jmp 1f " no jmp 1f " no
@@ -88,26 +90,26 @@ cnop: " fetched as constant in iread
dac .dspb dac .dspb
jmp piret jmp piret
dsprestart: dsprestart:
" Warren commented this out to try and #ifdef GRAPHICS2
" disable the Graphics-2 I/O lac d1
" lac d1 dac .dspb " set .dsbp = 1
" dac .dspb " set .dsbp = 1 lac dspbufp " load display buf pointer
" lac dspbufp " load display buf pointer beg " start display processor
" beg " start display processor -10
" -10 dac .dsptm " set .dsptm = -10 (10 ticks)
" dac .dsptm " set .dsptm = -10 (10 ticks) jmp piret
" jmp piret
" 1: sna ral " dataphone flag set (bit 7)?? 1: sna ral " dataphone flag set (bit 7)??
" jmp .+3 " no jmp .+3 " no
" raef " XXX: fix comment raef " XXX: fix comment
" jmp piret " return jmp piret " return
" sma " light pen flags (bit 2) sma " light pen flags (bit 2)
" jmp 1f " no jmp 1f " no
" lda " G-2: load display address lda " G-2: load display address
" dac .lpba " save dac .lpba " save
" rlpd " G-2: resume after light pen stop rlpd " G-2: resume after light pen stop
" jmp piret jmp piret
#endif
1: ksf " (TTY) keyboard flag set? 1: ksf " (TTY) keyboard flag set?
jmp 1f " no jmp 1f " no
+16 -2
View File
@@ -38,10 +38,13 @@ my $debug = 0; # Run in debug mode
my $format = 'a7out'; # output format my $format = 'a7out'; # output format
my $namelist = 0; # output n.out file my $namelist = 0; # output n.out file
my $output = 'a.out'; # output file my $output = 'a.out'; # output file
my @cppdefs; # C pre-processor defines
my @cppundefs; # C pre-processor undefines
# keep this near the GetOptions call to make it easy to add documentation! # keep this near the GetOptions call to make it easy to add documentation!
sub usage { sub usage {
die("Usage: $0 [--debug] [--format=a7out|list|ptr|rim ] [--out file] file1.s [file2.s ...]\n") die("Usage: $0 [-Dmacro] [-Umacro] [--debug] [--format=a7out|list|ptr|rim ]\n" .
"\t[--out file] file1.s [file2.s ...]\n");
} }
GetOptions( GetOptions(
@@ -49,6 +52,8 @@ GetOptions(
'format|f=s' => \$format, 'format|f=s' => \$format,
'namelist|n' => \$namelist, 'namelist|n' => \$namelist,
'output|o=s' => \$output, 'output|o=s' => \$output,
'D|D=s' => \@cppdefs,
'U|U=s' => \@cppundefs,
) or usage(); ) or usage();
usage() if ( @ARGV < 1 ); usage() if ( @ARGV < 1 );
@@ -265,9 +270,18 @@ sub err {
# Open and parse the given file # Open and parse the given file
sub parse_file { sub parse_file {
$file = shift; $file = shift;
open( my $IN, "<", $file ) || die("Cannot read $file: $!\n");
# Get the C pre-processor command-line arguments
my $defines= join(' ', map { "-D$_" } @cppdefs) || "";
my $undefines= join(' ', map { "-U$_" } @cppundefs) || "";
open( my $IN, "-|", "cpp -trigraphs $defines $undefines $file" )
|| die("Cannot pipe cpp $file: $!\n");
$lineno = 0; $lineno = 0;
while ( $line = <$IN> ) { while ( $line = <$IN> ) {
# Lose any C pre-processor comment lines
next if ($line=~ m{^#});
$lineno++; $lineno++;
chomp($line); # Lose the end of line chomp($line); # Lose the end of line
$origline = $line; $origline = $line;