Mercurial > hg > Members > kono > os9 > sbc09
changeset 187:308f00b170f7
lisp09
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 03 Dec 2023 12:54:59 +0900 |
parents | ec1a044adef6 |
children | d9dbd943db21 |
files | LISP09/Makefile LISP09/macro.pl LISP09/os9iodriver.asm |
diffstat | 3 files changed, 120 insertions(+), 54 deletions(-) [+] |
line wrap: on
line diff
--- a/LISP09/Makefile Mon Nov 06 08:47:22 2023 +0900 +++ b/LISP09/Makefile Sun Dec 03 12:54:59 2023 +0900 @@ -1,7 +1,7 @@ -lisp09 : LISP09.asm +LISP09 : LISP09.asm ../src/a09 LISP09.asm -o LISP09 -l LISP09-os9.lst # a09 does not support MACRO -lisp09.asm : LISP09.txt os9iodriver.asm +LISP09.asm : LISP09.txt os9iodriver.asm perl macro.pl LISP09.txt > LISP09.asm
--- a/LISP09/macro.pl Mon Nov 06 08:47:22 2023 +0900 +++ b/LISP09/macro.pl Sun Dec 03 12:54:59 2023 +0900 @@ -14,6 +14,27 @@ print $m; } +print <<'EOM'; + ifp1 + use defsfile + endc + nam Lisp09 + ttl Lisp09 +tylg set Prgrm+Objct +atrv set ReEnt+rev +rev set $01 +edition set 1 +size set $BFFF + + mod eom,name,tylg,atrv,START,size + org 0 + +name fcs "Lisp09" + fcb edition + +EOM + + while(<>) { chop; s/\r//g; @@ -27,7 +48,7 @@ $macro{$mname} .= $_ . "\n"; next; } - if (/SYSTEM ADDRESSES/) { + if (/SYSTEM ADDRESSES/ ) { # skip IO part $skip = 1; next; @@ -58,6 +79,8 @@ s/^SYMBOL/SYMBOLP/; s/^NUMBER/NUMBERP/; s/^REVERS/REVERSE/; + next if (/ORG LSPTOP/); + next if (/ORG ATMTOP/); if (/^(\w+)\s+(\w+)\s*(.*)/ ) { if (defined $macro{$2}) { @@ -75,5 +98,43 @@ print "\n"; } +print <<'EOM'; + emod +eom equ * + end +EOM +__END__ +* ADDRESS MAP +* +HSHTOP EQU $0000 +HSHBTM EQU HSHTOP+$800 +* atom hash table +* # of atoms : 1024 +* if contents=0 : undefined +* else : pointer to atom information table +* +CELTOP EQU HSHBTM +CELBTM EQU $8000 +* cell area ( lists and numbers ) +* # of cells : 7680 +* +LSPTOP EQU CELBTM +LSPBTM EQU XXXXX +* LISP-09 interpreter +* +* S stack is here +SSKBTM EQU $A000 +ATMTOP EQU SSKBTM +* atom information table +* +* ATMEND indicates table's end ( variable ) +* USKTOP indicates U stack's barrier ( variable ) +* ( [USKTOP] == [ATMEND] + 30 ) +* +* U stack is here +USKBTM EQU $C000 +* +* $C000-$FFFF FLEX SYSTEM +
--- a/LISP09/os9iodriver.asm Mon Nov 06 08:47:22 2023 +0900 +++ b/LISP09/os9iodriver.asm Sun Dec 03 12:54:59 2023 +0900 @@ -1,55 +1,56 @@ + ********** * * SYSTEM ADDRESSES * * * -OUTPT1 PSHS B,X,Y - LDX #OUTSW - TST ,X+ - BNE FLEXIO - JSR #0 - PULS B,X,Y,PC +* OUTPUT LBRA OUTPT1 +* output char in A to terminal ( OUTSW = 0 ) or +* disk (OUTSW <> 0 ) * -INPUT1 PSHS B,X,Y + +OUTPT1 PSHS A,B,X,Y + LDA OUTSW + LEAX ,S + LDY #1 + os9 I$Write + PULS A,B,X,Y,PC +* +* INPUT LBRA INPUT1 +* input char from terminal ( INSW = 0 ) or disk +* ( INSW <> 0 ) without echo +INPUT1 PSHS A,B,X,Y + LDA INSW + LEAX ,S LDX #INSW - TST ,X+ - BNE FLEXIO - JSR #0 - PULS B,X,Y,PC + LDY #1 + os9 I$Read + PULS A,B,X,Y,PC * -FLEXIO BSR CALFMS - PULS B,X,Y,PC -* -OPNFO1 BSR SETSTR - LDX #OUTFCB - JSR GETFIL - BCS FILERR - LDA #1 +* OPENFO LBRA OPNFO1 +* open file for output +* X = filename pointer ( terminater = 0 ) +* +OPNFO1 LDA #2 * Write Mode + os9 I$Open STA OUTSW - JSR SETEXT - LDA #FMSW - BRA OPNFIL + RTS * -OPNFI1 BSR SETSTR - LDX #INFCB - JSR GETFIL - BCS FILERR - LDA #1 +* OPENFI LBRA OPNFI1 +* open file for input +* X = filename pointer +OPNFI1 LDA #0 * Read Mode + os9 I$Open 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 + RTS + +* CLOSEO LBRA CLSO1 +* close output file +* +OPNFIL LDA #OUTSW + os9 I$Close + RTS * SETSTR PSHS Y LDY #FLBUF @@ -61,21 +62,25 @@ STA ,-Y PULS Y,PC * -DODOS1 BSR SETSTR - JSR DOCMND - BRA INI1 +* DODOS LBRA DODOS1 +* execute DOS command +* X = pointer to DOS command string * -CLSO1 LDX #OUTSW - BRA CLSIO +DODOS1 + RTS * -CLSI1 LDX #INSW -CLSIO TST ,X - BEQ FMSRTS - CLR ,X+ - LDA #FMSC - BRA OPNFIL +* CLOSEI LBRA CLSI1 +* close input file +* +CLSI1 LDA #INSW + os9 I$Close + RTS * +* INIT LBRA INI1 +* initialize system INI1 LDD #WARMS STD ESCRTN RTS +FLEX clrb + os9 F$Exit