Mercurial > hg > Members > kono > os9 > sbc09
changeset 186:ec1a044adef6
LISP09 start
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 06 Nov 2023 08:47:22 +0900 |
parents | f8a3a2819e2b |
children | 308f00b170f7 |
files | LISP09/LISP09.LST LISP09/LISP09.txt LISP09/Makefile LISP09/macro.pl LISP09/os9iodriver.asm |
diffstat | 3 files changed, 167 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LISP09/Makefile Mon Nov 06 08:47:22 2023 +0900 @@ -0,0 +1,7 @@ +lisp09 : LISP09.asm + ../src/a09 LISP09.asm -o LISP09 -l LISP09-os9.lst + +# a09 does not support MACRO +lisp09.asm : LISP09.txt os9iodriver.asm + perl macro.pl LISP09.txt > LISP09.asm +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LISP09/macro.pl Mon Nov 06 08:47:22 2023 +0900 @@ -0,0 +1,79 @@ +#!/usr/bin/perl + +use strict; + +my %macro; +my $mname = ""; +my $skip = 0; + +sub domacro { + my ($name, $args) = @_; + my (@args) = split(/,/, $args); + my $m = $macro{$name}; + $m =~ s/\&(\d+)/$args[$1-1]/ge; + print $m; +} + +while(<>) { + chop; + s/\r//g; + if (/^(\w+)\s+MACRO/) { + $mname = $1; + next; + } elsif (/^\s+ENDM/) { + $mname = ""; + next; + } elsif ($mname ne "") { + $macro{$mname} .= $_ . "\n"; + next; + } + if (/SYSTEM ADDRESSES/) { + # skip IO part + $skip = 1; + next; + } + if (/START UP INITIALIZATION/) { + system "cat os9iodriver.asm"; + $skip = 0; + } + next if ($skip); + if (/^\*/) { + print $_ . "\n"; + next; + } + ## easy fix + s/^QUOTIE/QUOTIENT/; + s/^DIFFER/DIFFERENCE/; + s/^REMAIN/REMAINDER/; + s/^ATOMLE/ATOMLENGTH/; + s/^IMPLOD/IMPLODE/; + s/^EXPLOD/EXPLODE/; + s/^ATOMCD/ATOMCDR/; + s/^ATOMCA/ATOMCAR/; + s/^PROPLI/PROPLIST/; + s/^CARMOD/CARMODE/; + s/^ECHOMO/ECHOMODE/; + s/^ALPHOR/ALPHORDER/; + s/^GREATE/GREATERP/; + s/^SYMBOL/SYMBOLP/; + s/^NUMBER/NUMBERP/; + s/^REVERS/REVERSE/; + + if (/^(\w+)\s+(\w+)\s*(.*)/ ) { + if (defined $macro{$2}) { + print $1 . " "; + domacro($2, $3); + next; + } + } elsif (/^\s+(\w+)\s*(.*)/ ) { + if (defined $macro{$1}) { + domacro($1, $2); + next; + } + } + print ; + print "\n"; +} + + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LISP09/os9iodriver.asm Mon Nov 06 08:47:22 2023 +0900 @@ -0,0 +1,81 @@ +********** +* +* SYSTEM ADDRESSES +* +* +* +OUTPT1 PSHS B,X,Y + LDX #OUTSW + TST ,X+ + BNE FLEXIO + JSR #0 + PULS B,X,Y,PC +* +INPUT1 PSHS B,X,Y + LDX #INSW + TST ,X+ + BNE FLEXIO + JSR #0 + PULS B,X,Y,PC +* +FLEXIO BSR CALFMS + PULS B,X,Y,PC +* +OPNFO1 BSR SETSTR + LDX #OUTFCB + JSR GETFIL + BCS FILERR + LDA #1 + STA OUTSW + JSR SETEXT + LDA #FMSW + BRA OPNFIL +* +OPNFI1 BSR SETSTR + LDX #INFCB + JSR GETFIL + BCS FILERR + LDA #1 + STA INSW + JSR SETEXT + LDA #FMSR +OPNFIL STA ,X +CALFMS JSR FMS + BEQ FMSRTS + LDA 1,X + CMPA #8 + BEQ FMSEOF +FILERR JSR RPTERR + LBRA WARMS +FMSEOF BSR CLSI1 + LDA #CR +FMSRTS RTS +* +SETSTR PSHS Y + LDY #FLBUF + STY FLBUFP +STSTR1 LDA ,X+ + STA ,Y+ + BNE STSTR1 + LDA #CR + STA ,-Y + PULS Y,PC +* +DODOS1 BSR SETSTR + JSR DOCMND + BRA INI1 +* +CLSO1 LDX #OUTSW + BRA CLSIO +* +CLSI1 LDX #INSW +CLSIO TST ,X + BEQ FMSRTS + CLR ,X+ + LDA #FMSC + BRA OPNFIL +* +INI1 LDD #WARMS + STD ESCRTN + RTS +