Mercurial > hg > Members > kono > os9 > sbc09
changeset 188:d9dbd943db21
LISP09 worked
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 03 Dec 2023 22:30:53 +0900 |
parents | 308f00b170f7 |
children | f524c0c95559 |
files | LISP09/LISP09.txt LISP09/Makefile LISP09/macro.pl LISP09/os9iodriver.asm |
diffstat | 4 files changed, 93 insertions(+), 70 deletions(-) [+] |
line wrap: on
line diff
--- a/LISP09/LISP09.txt Sun Dec 03 12:54:59 2023 +0900 +++ b/LISP09/LISP09.txt Sun Dec 03 22:30:53 2023 +0900 @@ -206,7 +206,7 @@ *** PLUS LDD #NADD PLUS1 TST ,X - BMI ZERO + BMI LZERO * * execute arithmetic functions * X : list of arguments @@ -245,7 +245,7 @@ *** n=0 0 *** n<0 -1 *** -SIGN BSR NUMX +LSIGN BSR NUMX BMI MONE BNE ONE LDD 2,X @@ -253,7 +253,7 @@ * * value <= 0 * -ZERO LDX #ZEROV +LZERO LDX #ZEROV BRA MNA * * value <= -1 @@ -718,7 +718,7 @@ *** val <= length of atom *** ATOMLE CMPX #CELTOP - LBCC ZERO + LBCC LZERO LDX ,X LEAX 7,X LDY #0 @@ -3080,7 +3080,10 @@ FN PLUS,LSUBR FN MAX,LSUBR FN MIN,LSUBR - FN SIGN,SUBR +* FN SIGN,SUBR + FDB UNDEFI,NIL,LSIGN + FCB NSIGN + FCC /SIGN/,0 FN ADD1,SUBR FN SUB1,SUBR FN ABS,SUBR
--- a/LISP09/Makefile Sun Dec 03 12:54:59 2023 +0900 +++ b/LISP09/Makefile Sun Dec 03 22:30:53 2023 +0900 @@ -1,7 +1,7 @@ -LISP09 : LISP09.asm - ../src/a09 LISP09.asm -o LISP09 -l LISP09-os9.lst +lisp09.s : LISP09.asm + ../src/a09 LISP09.asm -s lisp09.s -l LISP09-os9.lst # a09 does not support MACRO -LISP09.asm : LISP09.txt os9iodriver.asm +LISP09.asm : LISP09.txt os9iodriver.asm macro.pl perl macro.pl LISP09.txt > LISP09.asm
--- a/LISP09/macro.pl Sun Dec 03 12:54:59 2023 +0900 +++ b/LISP09/macro.pl Sun Dec 03 22:30:53 2023 +0900 @@ -18,19 +18,22 @@ 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 +# 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 +# mod eom,name,tylg,atrv,START,size +# org 0 +# +# name fcs "Lisp09" +# fcb edition + org $400 + LBSR IOINIT + jmp LSPTOP EOM @@ -53,6 +56,7 @@ $skip = 1; next; } + s/^HSHTOP EQU \$0000/HSHTOP EQU \$0400/; if (/START UP INITIALIZATION/) { system "cat os9iodriver.asm"; $skip = 0; @@ -63,6 +67,8 @@ next; } ## easy fix + s/TRUE/LTRUE/; + s/FALSE/LFALSE/; s/^QUOTIE/QUOTIENT/; s/^DIFFER/DIFFERENCE/; s/^REMAIN/REMAINDER/; @@ -79,8 +85,8 @@ s/^SYMBOL/SYMBOLP/; s/^NUMBER/NUMBERP/; s/^REVERS/REVERSE/; - next if (/ORG LSPTOP/); - next if (/ORG ATMTOP/); + # next if (/ORG LSPTOP/); + # next if (/ORG ATMTOP/); if (/^(\w+)\s+(\w+)\s*(.*)/ ) { if (defined $macro{$2}) { @@ -99,42 +105,10 @@ } print <<'EOM'; - emod -eom equ * - end +# 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 Sun Dec 03 12:54:59 2023 +0900 +++ b/LISP09/os9iodriver.asm Sun Dec 03 22:30:53 2023 +0900 @@ -3,6 +3,19 @@ * * SYSTEM ADDRESSES * +INSW EQU $30 +OUTSW EQU $32 +FLBUFP EQU $34 +FLBUF EQU $36 + +IOINIT + LDA #1 + sta OUTSW + clra + sta INSW + bsr noecho + rts + * * * OUTPUT LBRA OUTPT1 @@ -21,11 +34,11 @@ * input char from terminal ( INSW = 0 ) or disk * ( INSW <> 0 ) without echo INPUT1 PSHS A,B,X,Y - LDA INSW +retry1 LDA INSW LEAX ,S - LDX #INSW LDY #1 os9 I$Read + bcs retry1 PULS A,B,X,Y,PC * * OPENFO LBRA OPNFO1 @@ -37,19 +50,21 @@ STA OUTSW RTS * +* CLOSEO LBRA CLSO1 +* close output file +CLSO1 LDA OUTSW + cmpa #1 + beq RTS00 don' cloe terminal + os9 I$Close +RTS00 RTS +* * OPENFI LBRA OPNFI1 * open file for input * X = filename pointer -OPNFI1 LDA #0 * Read Mode + +OPNFI1 LDA #2 * Read Mode os9 I$Open - STA INSW - RTS - -* CLOSEO LBRA CLSO1 -* close output file -* -OPNFIL LDA #OUTSW - os9 I$Close + STA OUTSW RTS * SETSTR PSHS Y @@ -72,15 +87,46 @@ * CLOSEI LBRA CLSI1 * close input file * -CLSI1 LDA #INSW +CLSI1 LDA INSW + tsta + beq RTS00 don' cloe terminal os9 I$Close RTS * * INIT LBRA INI1 * initialize system INI1 LDD #WARMS - STD ESCRTN RTS +setecho lda #1 + bra sss +noecho clra +sss leas -128,s + leax ,s + pshs a + lda INSW + ldb #SS.Opt + OS9 I$GetStt + bcs err2 + LDA ,s + STA PD.EKO-PD.OPT,X +setopts + ldb #SS.Opt + clra + OS9 I$SetStt +err2 + puls a + leas 128,s + rts + + +delay PSHS D,X * address **$21** + * On input the D register contains the number of timer + * ticks to wait. Each timer tick is 20ms + TFR D,X + OS9 F$Sleep + PULS D,X,PC + + FLEX clrb os9 F$Exit