diff --git a/.Docs/Commands.md b/.Docs/Commands.md index 6131c66e..4c444bb6 100644 --- a/.Docs/Commands.md +++ b/.Docs/Commands.md @@ -24,6 +24,45 @@ exists, thus return value is limited to whether or not a valid argument was given. +# SEQ +Prints sequences of numbers. +* + +## Arguments +**** +Starting number for the sequence of numbers. +* +**** +Count in increments of . Default is 1 if omitted. +* +**** +Last number to count to. If is less than , then the default is -1. +* + +## Return Value +N/A +* + +### Author +2021-11-17, Brian J. Bernstein . + +# XMASTREE +Displays a Christmas Tree of user defined height. Ho Ho Ho. +* + +## Arguments +**** +Height of the tree. A positive number up to about 41 is realistic, beyond that you're on your own... +* + +## Return Value +N/A +* + +### Author +Original algorithm Jan 2012, Brian J. Bernstein. +Updated for A2osx 2021-07-02. + ## License A2osX is licensed under the GNU General Public License. diff --git a/.Docs/KERNEL.md b/.Docs/KERNEL.md index 91348402..c46dc339 100644 --- a/.Docs/KERNEL.md +++ b/.Docs/KERNEL.md @@ -79,15 +79,15 @@ CC = OK, CS = ERROR Y,A = FD X = hFD -# GetDevStatus +# MkFD ## C -`int getdevstatus(short int DevID, S.DIB *dstat);` +`short int mkfd(short int type, );` ## ASM `>PUSHB DevID` `>PUSHW S.DIB` -`>SYSCALL GetDevStatus` +`>SYSCALL MkFD` ## RETURN VALUE @@ -317,7 +317,7 @@ CC Initialize a MD5 computation # C -`hMD5 md5init ();` +`short int md5init();` # ASM `>SYSCALL MD5Init` @@ -430,10 +430,49 @@ Y,A = PTR to MemBlock CS : error A = EC +# ChTyp +Change The type of a ProDOS File + +## C +`int chtyp(const char *filepath, short int filetype);` + +## ASM +`>PUSHW filepath` +`>PUSHB filetype` +`>SYSCALL ChTyp` + +## RETURN VALUE + +# ChAux +Change The type of a ProDOS File + +## C +`int chaux(const char *filepath, int auxtype);` + +## ASM +`>PUSHW filepath` +`>PUSHB filetype` +`>SYSCALL ChAux` + +## RETURN VALUE + +# SetAttr +Change Attributes of a ProDOS File + +## C +`int setattr(const char *filepath, short int attributes);` + +## ASM +`>PUSHW filepath` +`>PUSHB attributes` +`>SYSCALL setattr` + +## RETURN VALUE + # ExecL ## C / CSH -`int execl(const char *cmdline, short int flags);` +`short int execl(const char *cmdline, short int flags);` ## ASM `>PUSHW cmdline` @@ -446,7 +485,7 @@ A = Child PSID # ExecV ## C / CSH -`int execv(const char* argv[], short int flags);` +`short int execv(const char* argv[], short int flags);` ## ASM `>PUSHW argv` @@ -729,29 +768,29 @@ CS : not found ## RETURN VALUE A=hSList -# ChTyp -Change The type of a ProDOS File +# ChMod +change permissions of a file ## C -`int chtyp(const char *filepath, short int filetype);` +`int chmod(const char *pathname, int mode);` ## ASM -`>PUSHW filepath` -`>PUSHB filetype` -`>SYSCALL chtyp` +`>PUSHW pathname` +`>PUSHW mode` +`>SYSCALL chmod` ## RETURN VALUE -# SetAttr -Change Attributes of a ProDOS File +# FStat +Return information about a hFILE ## C -`int setattr(const char *filepath, short int attributes);` +`int fstat(short int hFILE, struct stat *statbuf);` ## ASM -`>PUSHW filepath` -`>PUSHB attributes` -`>SYSCALL setattr` +`>PUSHB hFILE` +`>PUSHW statbuf` +`>SYSCALL fstat` ## RETURN VALUE diff --git a/.Floppies/A2OSX.BUILD.po b/.Floppies/A2OSX.BUILD.po index 99f937b3..c88e5ba7 100644 Binary files a/.Floppies/A2OSX.BUILD.po and b/.Floppies/A2OSX.BUILD.po differ diff --git a/.Floppies/A2OSX.TEST.po b/.Floppies/A2OSX.TEST.po index 1cfe44a1..2bdff64a 100644 Binary files a/.Floppies/A2OSX.TEST.po and b/.Floppies/A2OSX.TEST.po differ diff --git a/BASIC.15/BASIC.S.A.txt b/BASIC.15/BASIC.S.A.txt new file mode 100644 index 00000000..d5e0fcc0 --- /dev/null +++ b/BASIC.15/BASIC.S.A.txt @@ -0,0 +1,1300 @@ +NEW + AUTO 3,1 +*-------------------------------------- +BS.ResetCSWKSW pha + lda GP.VECTOUT + sta ZP.CSW + lda GP.VECTOUT+1 + sta ZP.CSW+1 + lda GP.VECTIN + sta ZP.KSW + lda GP.VECTIN+1 + sta ZP.KSW+1 + pla + rts + +BS.SetState0 ldx #$00 + jsr BS.SetState + lda ZP.KSW+1 + cmp GP.VDOSI+1 + bne L9A26 + + jmp BS.SetCSWKSW2VDOS + +L9A26 lda ZP.CSW+1 + cmp GP.VDOSO+1 + beq BS.SetCSWKSW2VDOS + + bne BS.SaveCSWKSW + +BS.IO.OUT cmp X9F65 + bne L9A54 + + stx GP.PREGX + tsx + lda $103,x + cmp #$12 + bne L9A6E + + lda $104,x + cmp #$D8 + bne L9A6E + + ldx #$04 + jsr BS.SetState + lda X9F65 + ldx GP.PREGX + jmp BS.JMP.GP.VSYSO + +L9A54 cmp GP.CHRLAST + sta GP.CHRLAST + bne L9A74 + + cmp #$8D + bne L9A74 + + lda ZP.CH + bne L9A69 + + lda BS.CMDBUF + cmp #$3F + +L9A69 lda #$8D + bcs L9A74 + + rts + +L9A6E ldx GP.PREGX + lda X9F65 + +L9A74 jsr BS.ResetCSWKSW + jsr MON.COUT + cmp #$8D + bne BS.SaveCSWKSW + + lda AS.TRCFLG + cmp #$A5 + beq L9A8B + + sta GP.DTRACE + lda #$A5 + sta AS.TRCFLG + +L9A8B lda #$8D +BS.SaveCSWKSW pha + lda ZP.KSW+1 + sta GP.VECTIN+1 + lda ZP.KSW + sta GP.VECTIN + lda ZP.CSW+1 + sta GP.VECTOUT+1 + lda ZP.CSW + sta GP.VECTOUT + pla + +BS.SetCSWKSW2VDOS + pha + lda GP.VDOSO + sta ZP.CSW + lda GP.VDOSO+1 + sta ZP.CSW+1 + lda GP.VDOSI + sta ZP.KSW + lda GP.VDOSI+1 + sta ZP.KSW+1 + pla + rts + +BS.IO.IN bit GP.EXECACTV + bpl L9AC5 + + jsr BS.SaveAXY + jmp BS.IO.IN.EXEC + +L9AC5 jsr BS.ResetCSWKSW + jsr MON.KEYIN0 + cmp #$8D + bne L9AEB + + jsr BS.SaveAXY + sta IO.LINEBUF,x + +BS.CheckDOSCMD jsr BS.DOSCMD + bit GP.XCNUM + bmi L9AE8 + + bcs BS.ERROUT + + ldy GP.PREGY + lda #$88 + ldx #$00 + beq L9AEB + +L9AE8 jsr BS.RestoreAXY +L9AEB jmp BS.SaveCSWKSW + +BS.NODEVERR lda #$03 + +BS.ERROUT sta GP.ERRCODE + sta AS.ERRNUM + lda GP.STATE + cmp #$01 + php + lda #$0F + sta MLI.LEVEL + lda #$00 + sta GP.IFILACTV + sta GP.OFILACTV + sta GP.PFXACTV + sta GP.MLICF.REFNUM + lda #MLI.C.CLOSE + jsr GP.GOSYSTEM + bcs L9B27 + + jsr LA004 + bcs L9B27 + + lda #$00 + sta MLI.LEVEL + sta GP.MLICF.REFNUM + lda #MLI.C.FLUSH + jsr GP.GOSYSTEM + +L9B27 plp + ldx #$04 + bit AS.ERRFLG + bcs L9B30 + + ldx #$00 + +L9B30 php + jsr BS.SetState + jsr BS.SetCSWKSW2VDOS + lda GP.ERRCODE + plp + bmi L9B4D + + php + jsr GP.PRINTERR + jsr LB36B + plp + bcs L9B53 + + jsr BS.CROUT + jmp AS.RESTART1 + +L9B4D ldx AS.REMSTK + dex + dex + txs + tax + +L9B53 lda #$03 + jmp AS.BITERRFLG + +L9B58 lda #$00 + sta AS.ERRNUM + lda #$A3 + sta X9F65 + jsr AS.NORMAL + jsr BS.ResetCSWKSW + jsr BS.WriteTBUF + jsr BS.SetState0 + jsr BS.RestoreAXY + jmp BS.IO.IN + +BS.IO.IN0 jsr BS.SaveAXY + bit GP.PFXACTV + bpl L9B7E + jmp BS.IO.IN.CAT + +L9B7E bit GP.IFILACTV + bpl L9B86 + jmp BS.IO.IN.FILE + +L9B86 bit GP.EXECACTV + bmi BS.IO.IN.EXEC + + lda ZP.PROMPT + cmp #$DD + beq L9B58 + + jsr BS.ResetCSWKSW + +L9B94 lda GP.PREGA + ldy GP.PREGY + jsr MON.KEYIN0 + cmp #$88 + bne L9BAC + + lda ZP.PROMPT + cmp #$BE + beq L9BAA + + txa + beq L9B94 + +L9BAA lda #$88 +L9BAC jmp BS.SaveCSWKSW + +BS.IO.IN.EXEC sta (ZP.BASL),y + lda ZP.PROMPT + cmp #$BE + beq L9BF2 + + lda IO.KBD + bpl L9BCD + + cmp #$83 + bne L9BCD + + jsr LB36B + lda GP.STATE + bne L9C01 + + sta IO.KSTROBE + beq L9C01 + +L9BCD jsr BS.Setup4readEFBytesAt200 + jsr L9C6C + bcs L9BFA + + jsr BS.SaveAXY + bcc L9BDE + +L9BDA dex + lda IO.LINEBUF,x + +L9BDE ora #$80 + sta IO.LINEBUF,x + txa + bne L9BDA + + jsr BS.ResetCSWKSW + jsr BS.CheckDOSCMD + bit GP.XCNUM + bpl L9BCD + +L9BF1 rts + +L9BF2 jsr BS.Setup4readEFBytesAt200 + jsr BS.ReadOneByte + bcc L9BF1 + +L9BFA jsr LB2B5 + cmp #$05 + bne L9C13 + +L9C01 ldx #$00 + ldy ZP.CH + bne L9C0E + + lda #$DD + sta ZP.PROMPT + lda #$88 + rts + +L9C0E lda (ZP.BASL),y + jmp (ZP.KSW) +L9C13 jmp BS.ERROUT + +BS.IO.IN.FILE lda ZP.PROMPT + cmp #$DD + bne L9C1F + jmp L9B58 + +L9C1F lda GP.PREGA + sta (ZP.BASL),y + lda IO.KBD + bpl L9C31 + + cmp #$83 + bne L9C31 + + bit IO.KSTROBE + rts + +L9C31 lda ZP.PROMPT + bit GP.DIRFLG + bmi L9C95 + + cmp #$BE + beq L9C42 + + jsr L9C67 + bcs L9C13 + + rts + +L9C42 jsr BS.ReadOneByte + bcs L9C13 + + rts + +BS.ReadOneByte lda GP.MLIRW.COUNT + sta GP.ParamL + lda #$01 + sta GP.MLIRW.COUNT + lda #MLI.C.READ + jsr GP.GOSYSTEM + bcs L9C66 + + lda GP.ParamL + sta GP.MLIRW.COUNT + ldx GP.MLIRW.DATAPTR + lda IO.LINEBUF,x + +L9C66 rts + +L9C67 lda GP.PREGA + sta (ZP.BASL),y + +L9C6C lda #MLI.C.READ + jsr GP.GOSYSTEM + bcs L9C66 + + lda GP.MLIRW.TRANS + beq L9C8E + + clc + adc GP.MLIRW.DATAPTR + tax + lda IO.LINEBUF-1,x + and #$7F + cmp #$0D + bne L9C8E + + lda GP.FoundBITS+1 + and #$10 + bne L9C8E + + dex + +L9C8E lda #$8D + ldy GP.PREGY + clc + rts + +L9C95 cmp #$BE + beq L9C8E + + lda GP.PREGA + sta (ZP.BASL),y + lda #$4F + sta BS.CATWIDTH + lda #MLI.C.GETMARK + jsr GP.GOSYSTEM + bcs L9D1F + + lda GP.SBUFADR + ora GP.SBUFADR+1 + bne L9CDF + + lda #$02 + sta GP.CATFLAG + jsr BS.ReadDirEnt + bcs L9D1F + + lda GP.MLIRW.REFNUM + lsr + ror + ror + ror + tax + lda XBC12 + sta XBC5A,x + lda XBC13 + sta XBC5B,x + jsr LB128 + +L9CD3 lda #$A2 + sta IO.LINEBUF + lda #$8D + sta IO.LINEBUF,x + clc + rts + +L9CDF lda GP.CATFLAG + beq L9D22 + bmi L9CF9 + ldx #$00 + dec GP.CATFLAG + beq L9CD3 + jsr BS.LINEBUFCLR80 + ldx #$10 + jsr BS.PRINTERRMSGX + +L9CF5 ldx #$50 + bne L9CD3 + +L9CF9 cmp #$FF + bne L9D1C + + dec GP.CATFLAG + lda #$00 + sta GP.MLIRW.COUNT + sta GP.MLIRW.COUNT+1 + lda #MLI.C.READ + jsr GP.GOSYSTEM + jsr LB157 + pha + lda GP.MLIRW.REFNUM + sta GP.MLIMRKEOFBUF.REFNUM + pla + bcc L9CF5 + + bcs L9D1F + +L9D1C lda #$05 + sec + +L9D1F jmp BS.ERROUT + +L9D22 lda #$FF + sta XBC16 + lda GP.MLIRW.REFNUM + lsr + ror + ror + ror + tax + lda XBC5A,x + sta XBC12 + lda XBC5B,x + sta XBC13 + lda GP.SBUFADR+1 + and #$01 + tax + lda GP.SBUFADR + sec + +L9D45 inc XBC16 + sbc XBC12 + bcs L9D45 + + dex + beq L9D45 + + jsr LB241 + bcc L9D65 + + cmp #$02 + beq L9D5D + + cmp #$05 + bne L9D1F + +L9D5D dec GP.CATFLAG + ldx #$00 + jmp L9CD3 + +L9D65 jsr LA4D2 + jmp L9CF5 + +BS.IO.IN.CAT cmp #$DD + bne L9D72 + + jmp L9B58 + +L9D72 lda GP.PREGA + sta (ZP.BASL),y + lda #$00 + sta GP.PFXACTV + ldx BS.CMDBUF.LEN + +L9D7F lda BS.CMDBUF.LEN,x + sta IO.LINEBUF-1,x + dex + bne L9D7F + + ldx BS.CMDBUF.LEN + lda #$8D + rts + +BS.Setup4readEFBytesAt200 + lda XBBFE + sta GP.MLIRW.REFNUM + lda #$02 + sta GP.MLIRW.DATAPTR+1 + lda #$EF + sta GP.MLIRW.COUNT + lda #$00 + sta GP.MLIRW.COUNT+1 + sta GP.MLIRW.DATAPTR + rts + +BS.VSYSO jsr BS.SaveAXY + cmp #$84 + bne L9DC5 + + jsr BS.WriteTBUF + sta GP.INPTR + sta GP.IFILACTV + sta GP.OFILACTV + sta GP.PFXACTV + ldx #$08 + jsr BS.SetState + jmp BS.RestoreAXY + +L9DC5 ldx #$04 + jsr BS.SetState + jsr BS.RestoreAXY + jmp BS.JMP.GP.VSYSO + +BS.IO.OUT.CAT jsr BS.SaveAXY + ldx GP.INPTR + sta IO.LINEBUF,x + cmp #$8D + beq L9DEB + + inc GP.INPTR + bne L9DE7 + + lda #$10 + +L9DE4 jmp BS.ERROUT + +L9DE7 ldx GP.PREGX + rts + +L9DEB inx + dex + beq L9DFA + + jsr BS.ResetCSWKSW + jsr BS.DOSCMD + bcs L9DE4 + + jsr BS.SaveCSWKSW + +L9DFA ldx #$04 + jsr BS.SetState + jmp BS.RestoreAXY + +L9E02 sty GP.PREGY + ldy ZP.PROMPT + beq L9E15 + + dey + beq L9E15 + + dey + beq L9E15 + + ldy GP.PREGY + jmp L9A74 + +L9E15 ldy GP.TBUFPTR + and #$7F + sta (AS.HIMEM),y + ldy GP.PREGY + inc GP.TBUFPTR + bne L9E2F + + jsr BS.SaveAXY + jsr BS.WriteTBUF256 + bcs L9DE4 + + jsr BS.RestoreAXY + +L9E2F rts + +BS.IO.OUT.TRACE pha + stx GP.PREGX + tsx + lda $104,x + cmp #$12 + bne L9E46 + + lda $105,x + cmp #$D8 + bne L9E46 + + pla + bcs L9EBA + +L9E46 pla + nop + nop + nop + ldx GP.PREGX + bit GP.OFILACTV + bpl L9E70 + + cmp #$DD + bne L9E5A + + cmp ZP.PROMPT + beq L9E8A + +L9E5A cmp #$8D + bne L9E02 + + lda ZP.PROMPT + cmp #$FF + lda #$8D + bcc L9E02 + + jsr BS.WriteTBUF + sta GP.OFILACTV + lda #$8D + bne L9EA3 + +L9E70 pha + lda GP.IFILACTV + ora GP.PFXACTV + bpl L9E81 + + lda ZP.PROMPT + ora #$04 + cmp #$84 + beq L9EA6 + +L9E81 pla + cmp #$DD + bne L9EA3 + + cmp ZP.PROMPT + bne L9EA3 + +L9E8A jsr BS.SaveAXY + lda GP.OPENCNT + beq L9EA0 + + jsr BS.WriteTBUF + sta GP.OFILACTV + jsr BS.ResetCSWKSW + lda #$15 + jsr GP.PRINTERR + +L9EA0 jsr BS.RestoreAXY +L9EA3 jmp L9A74 + +L9EA6 pla + cmp #$8D + bne L9EAE + + cmp GP.CHRLAST + +L9EAE sta GP.CHRLAST + bne L9EB5 + + sta ZP.PROMPT + +L9EB5 rts + +L9EB6 inc AS.TXTPTR+1 + bne L9EBE + +L9EBA inc AS.TXTPTR + beq L9EB6 + +L9EBE ldx #$FF + stx ZP.PROMPT + ldx AS.REMSTK + txs + bit GP.DTRACE + bmi L9F3D + +L9ECA ldy #$00 + lda (AS.TXTPTR),y + bmi L9EF5 + + beq L9EF2 + +L9ED2 dec GP.STRINGS + bne L9EF0 + + lda AS.STRINGSTART+1 + sbc AS.ARRAYEND+1 + cmp #$03 + bcs L9EE9 + + jsr BS.WriteTBUF + jsr BS.KW.01 + lda AS.STRINGSTART+1 + sbc AS.ARRAYEND+1 + +L9EE9 sta GP.STRINGS + ldy #$00 + lda (AS.TXTPTR),y + +L9EF0 cmp #$3A +L9EF2 jmp AS.EXECSTMT + +L9EF5 sta ZP.PROMPT + tay + lda BS.BYTES-$80,y + bmi L9EF2 + + sta X9F00+1 + +X9F00 bne L9F02 SELF MODIFIED + +L9F02 sta ZP.PROMPT + sta GP.CHRLAST + lda BS.VSYSO.LO + sta GP.VSYSO + lda BS.VSYSO.HI + sta GP.VSYSO+1 + bne L9F32 + + lda #$01 + sta ZP.PROMPT + bne L9F32 + + lda #$02 + sta ZP.PROMPT + bne L9F32 + + tya + jmp L9ED2 + + sty GP.DTRACE + bne L9F2E + + sta GP.DTRACE + dey + +L9F2E lda #$4A + sta AS.TRCFLG + +L9F32 tya + jmp AS.EXECSTMT + + lda #$00 + sta AS.ERRNUM + tya + bne L9EF0 + +L9F3D jsr BS.ResetCSWKSW + lda #$A3 + jsr MON.COUT + ldx AS.CURLINE + lda AS.CURLINE+1 + jsr AS.INTPRINTAX + lda #$A0 + jsr MON.COUT + jsr BS.SaveCSWKSW + sec + jmp L9ECA + + lda #$E3 + bne L9F5E + + lda #$A3 + +L9F5E sta X9F65 + tya + bne L9EF0 + + brk + +X9F65 .DA #$A3 + +BS.SaveAXY sta GP.PREGA + stx GP.PREGX + sty GP.PREGY + rts + +BS.RestoreAXY lda GP.PREGA + ldx GP.PREGX + ldy GP.PREGY + rts + +BS.SetState stx GP.STATE + ldy #$00 + +L9F7F lda BS.SYSIOVECTS,x + sta GP.VSYSO,y + inx + iny + cpy #$04 + bne L9F7F + + rts + +BS.PRINTERR tay + ldx BS.ERRCODES-1,y + +BS.PRINTERRX jsr BS.PRINTERRMSGX + ldx GP.INPTR + stx BS.CATWIDTH + jsr BS.CROUT + lda #$87 + jsr BS.COUT + +BS.LINEBUFOUT ldx #$00 + +L9FA3 lda IO.LINEBUF+1,x + jsr BS.COUT + inx + cpx BS.CATWIDTH + bcc L9FA3 + +BS.CROUT lda #$8D +BS.COUT jmp MON.COUT + +BS.PRINTERRMSGX ldy #$00 + clc + sty GP.INPTR + +L9FBA jsr L9FD6 + bne L9FC4 + + jsr L9FD6 + ora #$10 + +L9FC4 tay + lda BS.TBL6,y + beq L9FD5 + + ldy GP.INPTR + sta IO.LINEBUF+1,y + inc GP.INPTR + bne L9FBA + +L9FD5 rts + +L9FD6 lda BS.TBL7,x + bcs L9FED + + beq L9FE3 + + lsr + lsr + lsr + lsr + sec + rts + +L9FE3 inx + lda BS.TBL7,x + sta GP.INPTR + inx + bne L9FD6 + +L9FED inx + and #$0F + clc + rts + +BS.WriteTBUF256 lda #$00 + ldy #$01 + bne LA00B + +BS.WriteTBUF jsr LA004 + bcc LA020 + + tay + pla + pla + tya + jmp BS.ERROUT + +LA004 ldy #$00 + lda GP.TBUFPTR + beq LA01F + +LA00B sta GP.MLIRW.COUNT + sty GP.MLIRW.COUNT+1 + lda #MLI.C.WRITE + jsr GP.GOSYSTEM + pha + lda #$00 + sta GP.TBUFPTR + pla + bcs LA020 + +LA01F clc +LA020 rts + +LA021 jsr BS.KW.01 + bcs LA047 + + lda AS.PGRMSTART+1 + sta BS.TXTTAB+1 + lda AS.PGRMSTART + sta BS.TXTTAB + lda AS.HIMEM+1 + sta XBBD8 + lda #$03 + sta XBBD9 + lda AS.STRINGSTART+1 + sta BS.MEMSIZE+1 + lda #$00 + sta BS.MEMSIZE + jsr LA089 + +LA047 rts + +BS.KW.01 lda #$00 + sta BS.TXTTAB + lda #$03 + sta XBBD9 + lda AS.HIMEM+1 + sta XBBD8 + lda AS.STRINGSTART+1 + sta BS.TXTTAB+1 + sec + sbc AS.ARRAYEND+1 + cmp #$07 + bcc LA07D + + sbc #$03 + sta XBBD9 + lda AS.ARRAYEND+1 + adc #$00 + sta XBBD8 + lda AS.HIMEM+1 + sbc AS.STRINGSTART+1 + adc #$01 + cmp XBBD9 + bcs LA07D + + sta XBBD9 + +LA07D lda AS.HIMEM+1 + sta BS.MEMSIZE+1 + lda AS.HIMEM + sta BS.MEMSIZE + sta AS.STRINGSTART + +LA089 clc + beq LA08D + + sec + +LA08D lda BS.MEMSIZE+1 + sta AS.STRINGSTART+1 + sbc #$00 + sta XBBDA + adc #$00 + sta XBBDB + lda AS.ARRAYEND+1 + adc #$01 + sta XBBDD + +LA0A3 lda AS.VARSTART + sbc #$06 + sta ZP.A2L + lda AS.VARSTART+1 + sbc #$00 + sta ZP.A2H + lda AS.ARRAYSTART + sta XBBDC + lda XBBDA + cmp BS.TXTTAB+1 + bcc LA0FA + + sbc XBBD9 + sta XBBD7 + lda AS.STRINGSTART+1 + sbc XBBDA + sbc XBBD7 + eor #$FF + adc #$02 + cmp XBBD7 + bcc LA0D6 + + lda XBBD7 + +LA0D6 cmp BS.TXTTAB+1 + bcs LA0E0 + + lda BS.TXTTAB+1 + sbc #$00 + +LA0E0 sta XBBDA + jsr LA199 + ldx AS.ARRAYSTART+1 + jsr LA0FB + bcs LA0F8 + + jsr LA131 + lda XBBDA + sta XBBDB + bcc LA0A3 + +LA0F8 lda #$0C +LA0FA rts + +LA0FB clc + +LA0FC lda ZP.A2L + adc #$07 + sta ZP.A2L + bcc LA106 + + inc ZP.A2H + +LA106 eor AS.ARRAYSTART + bne LA10E + + cpx ZP.A2H + beq LA12F + +LA10E ldy #$00 + lda (ZP.A2L),y + iny + eor (ZP.A2L),y + bpl LA0FB + + lda (ZP.A2L),y + bpl LA0FB + + ldy #$04 + lda (ZP.A2L),y + cmp XBBDA + bcc LA0FC + + cmp XBBDB + bcs LA0FB + + jsr LA1BC + bcc LA0FC + + rts + +LA12F clc + rts + +LA131 jsr LA160 + bcs LA12F + +LA136 ldy #$02 + lda (ZP.A2L),y + cmp XBBDA + bcc LA14A + + cmp XBBDB + bcs LA14A + + jsr LA1BC + bcc LA14B + + rts + +LA14A clc +LA14B lda #$03 + adc ZP.A2L + sta ZP.A2L + bcc LA155 + + inc ZP.A2H + +LA155 cmp XBBDC + bne LA136 + + cpx ZP.A2H + bne LA136 + + beq LA131 + +LA160 clc + lda XBBDC + sta ZP.A2L + stx ZP.A2H + eor AS.ARRAYEND + bne LA170 + + cpx AS.ARRAYEND+1 + beq LA198 + +LA170 ldy #$02 + lda (ZP.A2L),y + adc ZP.A2L + sta XBBDC + iny + lda (ZP.A2L),y + adc ZP.A2H + tax + ldy #$00 + lda (ZP.A2L),y + iny + eor (ZP.A2L),y + bpl LA160 + + ldy #$04 + lda (ZP.A2L),y + asl + adc #$05 + adc ZP.A2L + sta ZP.A2L + bcc LA198 + + inc ZP.A2H + + clc +LA198 rts + +LA199 lda XBBD7 + sta ZP.PCH + lda XBBD8 + sta ZP.A1H + ldy #$00 + sty ZP.PCL + sty ZP.A1L + ldx XBBD9 + inx + +LA1AD lda (ZP.PCL),y + sta (ZP.A1L),y + iny + bne LA1AD + + inc ZP.A1H + inc ZP.PCH + dex + bne LA1AD + + rts + +LA1BC cmp XBBD7 + bcc LA1C8 + + sbc XBBD7 + clc + adc XBBD8 + +LA1C8 sta ZP.PCH + dey + lda (ZP.A2L),y + sta ZP.PCL + dey + sec + lda AS.STRINGSTART + sbc (ZP.A2L),y + sta AS.STRINGSTART + iny + sta (ZP.A2L),y + lda AS.STRINGSTART+1 + sbc #$00 + sta AS.STRINGSTART+1 + iny + sta (ZP.A2L),y + dey + dey + lda (ZP.A2L),y + beq LA1F2 + + tay + +LA1EA dey + lda (ZP.PCL),y + sta (AS.STRINGSTART),y + tya + bne LA1EA + +LA1F2 clc + lda XBBDD + sbc AS.STRINGSTART+1 + rts + +LA1F9 lda #$04 +LA1FB sta XBBB5 + jsr BS.KW.01 + bcs LA24E + + lda AS.STRINGSTART+1 + sbc AS.ARRAYEND+1 + cmp XBBB5 + lda #$0C + bcc LA24E + + lda AS.STRINGSTART+1 + sta ZP.PCH + sbc XBBB5 + sta ZP.A1H + sta AS.STRINGSTART+1 + lda AS.STRINGSTART + sta ZP.PCL + sta ZP.A1L + lda AS.HIMEM + sbc ZP.PCL + sta XBBED + lda AS.HIMEM+1 + sbc ZP.PCH + sta XBBEE + jsr LA35F + lda #$00 + sec + sbc XBBB5 + sta XBBE2 + jsr LA3A3 + lda AS.HIMEM+1 + sta XBBB7 + sec + sbc XBBB5 + sta AS.HIMEM+1 + clc + adc #$04 + sta XBBE3 + rts + +LA24E sec + rts + +LA250 jsr BS.KW.01 + bcs LA29D + + lda AS.HIMEM+1 + sbc #$00 + sta ZP.PCH + adc #$03 + sta ZP.A1H + lda AS.STRINGSTART + sta ZP.PCL + sta ZP.A1L + lda AS.HIMEM + sec + sbc AS.STRINGSTART + sta XBBED + lda AS.HIMEM+1 + sbc AS.STRINGSTART+1 + sta XBBEE + jsr LA383 + lda #$04 + sta XBBE2 + clc + adc AS.HIMEM+1 + sta AS.HIMEM+1 + jsr LA3A3 + lda XBBE3 + cmp AS.HIMEM+1 + beq LA2B7 + + pha + ldx GP.OPENCNT + beq LA29B + + lda AS.HIMEM+1 + +LA293 cmp XBBEE,x + beq LA29E + + dex + bne LA293 + +LA29B pla + sec +LA29D rts + +LA29E pla +LA29F sta GP.SBUFADR+1 + sta XBBEE,x + lda #$00 + sta GP.SBUFADR + lda XBBF6,x + sta GP.MLIMRKEOFBUF.REFNUM + lda #MLI.C.SETBUF + jsr GP.GOSYSTEM + bcs LA29D + +LA2B7 clc + rts +*-------------------------------------- +MAN +SAVE usr/src/basic.15/basic.s.a +LOAD usr/src/basic.15/basic.s +ASM diff --git a/BASIC.15/BASIC.S.B.txt b/BASIC.15/BASIC.S.B.txt new file mode 100644 index 00000000..61c03350 --- /dev/null +++ b/BASIC.15/BASIC.S.B.txt @@ -0,0 +1,1687 @@ +NEW + AUTO 3,1 +*-------------------------------------- +BS.GETBUFR jsr LA1FB + bcs LA304 + pha + sbc #$03 + sta XBBB8 + pla + +LA2C5 sta GP.SBUFADR+1 + ldx GP.OPENCNT + beq LA2EE + + lda XBBB7 + clc + adc #$04 + sta XBBB7 + +LA2D6 cmp XBBEE,x + bne LA2EB + + lda GP.SBUFADR+1 + jsr LA356 + jsr LA29F + lda GP.SBUFADR+1 + adc #$04 + bcc LA2C5 + +LA2EB dex + bne LA2D6 + +LA2EE lda GP.SBUFADR+1 + bit GP.EXECACTV + bpl LA303 + +LA2F6 ldx #$08 + jsr LA356 + jsr LA29F + lda GP.SBUFADR+1 + adc #$04 + +LA303 clc +LA304 rts + +BS.FREEBUFR lda GP.OPENCNT + asl + asl + adc AS.HIMEM+1 + sta XBBB7 + lda AS.HIMEM+1 + sta XBBB8 + lda GP.RSHIMEM + cmp AS.HIMEM+1 + beq LA354 + + sta AS.HIMEM+1 + bit GP.EXECACTV + bpl LA327 + + jsr LA2F6 + bcc LA345 + +LA327 lda XBBB7 + ldx GP.OPENCNT + beq LA351 + +LA32F cmp XBBEE,x + bne LA34E + + lda AS.HIMEM+1 + jsr LA356 + jsr LA29F + sec + lda XBBB7 + sbc #$04 + sta XBBB7 + +LA345 lda AS.HIMEM+1 + sec + sbc #$04 + sta AS.HIMEM+1 + bcs LA327 + +LA34E dex + bne LA32F + +LA351 jsr BS.KW.01 +LA354 clc + rts + +LA356 pha + lda XBBB8 + jsr LA29F + pla + rts + +LA35F ldy #$00 + cpy XBBEE + beq LA376 + +LA366 lda (ZP.PCL),y + sta (ZP.A1L),y + iny + bne LA366 + + inc ZP.PCH + inc ZP.A1H + dec XBBEE + bne LA366 + +LA376 cpy XBBED + beq LA382 + + lda (ZP.PCL),y + sta (ZP.A1L),y + iny + bne LA376 + +LA382 rts + +LA383 ldy XBBED +XA386 beq LA38F SELF MODIFIED + +LA388 jsr LA39A + dec ZP.A1H + dec ZP.PCH + +LA38F cpy XBBEE + beq LA3A2 + + dec XBBEE + jmp LA388 + +LA39A dey + lda (ZP.PCL),y + sta (ZP.A1L),y + tya + bne LA39A + +LA3A2 rts + +LA3A3 lda AS.VARSTART+1 + sta ZP.A2H + lda AS.VARSTART + ldx AS.ARRAYSTART+1 + clc + bcc LA3B3 + +LA3AE clc + lda ZP.A2L + adc #$07 + +LA3B3 sta ZP.A2L + bcc LA3B9 + + inc ZP.A2H + +LA3B9 eor AS.ARRAYSTART + bne LA3BF + + cpx ZP.A2H + +LA3BF clc + beq LA3D6 + + ldy #$00 + lda (ZP.A2L),y + iny + eor (ZP.A2L),y + bpl LA3AE + + lda (ZP.A2L),y + bpl LA3AE + + iny + jsr LA3FD + jmp LA3AE + +LA3D6 lda ZP.A2L + sta XBBDC + +LA3DB clc + jsr LA160 + bcs LA410 + +LA3E1 ldy #$00 + clc + jsr LA3FD + clc + lda #$03 + adc ZP.A2L + sta ZP.A2L + bcc LA3F2 + + inc ZP.A2H + +LA3F2 cmp XBBDC + bne LA3E1 + + cpx ZP.A2H + bne LA3E1 + + beq LA3DB + +LA3FD lda (ZP.A2L),y + beq LA410 + + iny + iny + lda AS.VARSTART+1 + cmp (ZP.A2L),y + bcs LA410 + + lda (ZP.A2L),y + adc XBBE2 + sta (ZP.A2L),y + +LA410 rts + +LA411 jsr LA021 + bcs LA47F + + lda AS.ARRAYEND + sec + sbc AS.VARSTART + sta BS.BAS.HDR + sta XBBED + lda AS.ARRAYEND+1 + sbc AS.VARSTART+1 + sta BS.BAS.HDR+1 + sta XBBEE + lda AS.ARRAYSTART + sbc AS.VARSTART + sta BS.BAS.HDR+2 + lda AS.ARRAYSTART+1 + sbc AS.VARSTART+1 + sta BS.BAS.HDR+3 + lda AS.STRINGSTART + sbc XBBED + sta ZP.A1L + lda AS.STRINGSTART+1 + sbc #$00 + sta ZP.A1H + lda AS.ARRAYEND + sbc XBBED + sta ZP.PCL + lda AS.ARRAYEND+1 + sbc #$00 + sta ZP.PCH + lda #$03 + sta XA386+1 + jsr LA383 + lda #$07 + sta XA386+1 + lda ZP.A1L + sta XBBE9 + inc ZP.A1H + lda ZP.A1H + sta XBBEA + lda AS.HIMEM + sec + sbc ZP.A1L + sta XBBEB + lda AS.HIMEM+1 + sta BS.BAS.HDR+4 + sbc ZP.A1H + sta XBBEC + clc +LA47F rts + +LA480 lda BS.BAS.HDR + sta XBBED + clc + adc AS.VARSTART + sta AS.ARRAYEND + lda BS.BAS.HDR+1 + sta XBBEE + adc AS.VARSTART+1 + sta AS.ARRAYEND+1 + lda AS.VARSTART + sta ZP.A1L + adc BS.BAS.HDR+2 + sta AS.ARRAYSTART + lda AS.VARSTART+1 + sta ZP.A1H + adc BS.BAS.HDR+3 + sta AS.ARRAYSTART+1 + lda XBBE9 + sta ZP.PCL + lda XBBEA + sta ZP.PCH + jsr LA35F + lda XBBED + clc + adc ZP.PCL + sta AS.STRINGSTART + lda ZP.PCH + adc #$00 + sta AS.STRINGSTART+1 + sec + lda AS.HIMEM+1 + sbc BS.BAS.HDR+4 + beq LA4D0 + + sta XBBE2 + jsr LA3A3 + +LA4D0 clc + rts + +LA4D2 jsr BS.LINEBUFCLR80 + lda #$A2 + sta IO.LINEBUF + lda DIRENTBUF + and #$0F + tay + +LA4E0 lda DIRENTBUF,y + ora #$80 + sta IO.LINEBUF+1,y + dey + bne LA4E0 + + sty BS.TMPBUF4+2 + lda DIRENTBUF.TYPE + ldx #$0E + +LA4F3 iny + iny + cmp BS.PRODOSTYPES.H,x + beq LA505 + + iny + dex + bpl LA4F3 + + ldy #$13 + jsr BS.AHEX2LINEBUFY + bne LA549 + +LA505 ldx #$02 + pha + +LA508 lda BS.PRODOSTYPES.ASC,y + sta $212,x + dey + dex + bpl LA508 + pla + bit BS.CATWIDTH + bvc LA561 + + ldy #$4E + cmp #$06 + beq LA533 + + cmp #$04 + bne LA549 + + lda #$D2 + sta $249 + lda DIRENTBUF.AUXT + ldx DIRENTBUF.AUXT+1 + jsr BS.AXDEC2LINEBUFY + jmp LA544 + +LA533 lda #$C1 + sta $249 + lda DIRENTBUF.AUXT + jsr BS.AHEX2LINEBUFY + lda DIRENTBUF.AUXT+1 + jsr BS.AHEX2LINEBUFY + +LA544 lda #$BD + sta $24A + +LA549 lda DIRENTBUF.EOF+2 + sta BS.TMPBUF4+2 + lda DIRENTBUF.EOF + ldx DIRENTBUF.EOF+1 + ldy #$46 + jsr BS.AXDEC2LINEBUFY + ldx #$18 + ldy #$3D + jsr LA57E + +LA561 ldy #$1B + lda DIRENTBUF.UBLK + ldx DIRENTBUF.UBLK+1 + jsr BS.AXDEC2LINEBUFY + lda DIRENTBUF.ACCESS + and #$C2 + cmp #$C2 + beq LA57A + + lda #$AA + sta IO.LINEBUF+1 + +LA57A ldx #$21 + ldy #$2C + +LA57E lda $25A,x + lsr + sta XBC10 + lda DIRENTBUF,x + pha + and #$1F + sta XBC0F + pla + rol + rol + rol + rol + and #$0F + beq LA5B1 + + cmp #$0D + bcs LA5B1 + + sta XBC0E + asl + adc XBC0E + sta XBC0E + lda XBC0F + beq LA5B1 + + lda XBC10 + cmp #$64 + bcc LA5C3 + +LA5B1 tya + sec + sbc #$06 + tay + ldx #$08 + +LA5B8 lda BS.NODATE,x + sta IO.LINEBUF+1,y + dey + dex + bpl LA5B8 + + rts + +LA5C3 lda $25C,x + pha + lda $25B,x + ldx #$00 + cmp #$3C + bcc LA5D1 + + txa + +LA5D1 jsr LA618 + lda #$BA + sta IO.LINEBUF+1,y + dey + pla + ldx #$00 + cmp #$18 + bcc LA5E2 + + txa + +LA5E2 cmp #$0A + php + jsr BS.AXDEC2LINEBUFY + plp + bcs LA5EC + + dey + +LA5EC dey + lda XBC10 + jsr LA618 + dey + ldx XBC0E + inx + inx + inx + +LA5FA lda BS.MONTHS-4,x + sta IO.LINEBUF+1,y + dey + dex + cpx XBC0E + bne LA5FA + + lda #$AD + sta IO.LINEBUF+1,y + sta $205,y + dey + lda XBC0F + ldx #$00 + jmp BS.AXDEC2LINEBUFY + +LA618 clc + adc #$64 + jsr BS.AXDEC2LINEBUFY + iny + rts + +BS.AHEX2LINEBUFY + pha + and #$0F + jsr LA62B + pla + lsr + lsr + lsr + lsr + +LA62B ora #$B0 + cmp #$BA + bcc LA633 + + adc #$06 + +LA633 sta IO.LINEBUF+1,y + dey + lda #$A4 + sta IO.LINEBUF+1,y + rts + +BS.AXDEC2LINEBUFY + stx BS.TMPBUF4+1 + sta BS.TMPBUF4 + +LA643 jsr LA65B + lda BS.TMPBUF4+3 + ora #$B0 + sta IO.LINEBUF+1,y + dey + lda BS.TMPBUF4 + ora BS.TMPBUF4+1 + ora BS.TMPBUF4+2 + bne LA643 + + rts + +LA65B ldx #$18 + lda #$00 + sta BS.TMPBUF4+3 + +LA662 jsr BS.TMPBUF3x2 + rol BS.TMPBUF4+3 + sec + lda BS.TMPBUF4+3 + sbc #$0A + bcc LA676 + + sta BS.TMPBUF4+3 + inc BS.TMPBUF4 + +LA676 dex + bne LA662 + + rts + +BS.LINEBUFCLR80 lda #$A0 + ldx #$4F + +LA67E sta IO.LINEBUF+1,x + dex + bpl LA67E + + rts + +BS.DOSCMD lda #$FF + sta GP.XCNUM + lda #$20 + sta BS.GetCharSep + lda #$08 + sta BS.GetCharMax + jsr BS.GetKWInCmdBuf + lda BS.CMDBUF + cmp #$41 + bcs LA6A5 + + eor #$2D + beq LA6A5 + +LA6A2 jmp BS.ERR10 + +LA6A5 jsr BS.IsIntCmdMTR + bcs LA6A2 + + lda GP.STATE + bne LA6BA + + lda GP.EXECACTV + bne LA6BA + + jsr MON.CLREOL + jsr BS.CROUT + +LA6BA lda #$00 + sta GP.FoundBITS + sta GP.FoundBITS+1 + sta BS.CMDBUF + sta MLI.PATHBUF + lda GP.VDEFSLT + sta GP.ParamS + lda GP.VDEFDRV + sta GP.ParamD + lda AS.HIMEM+1 + sta XBBE3 + ldx GP.XLEN + inx + inx + stx BS.GetCharMax + lda GP.AllowedBITS + beq LA744 + + asl + bmi LA747 + + jsr BS.GetKWInCmdBuf + php + pha + lda GP.AllowedBITS + bpl LA6F8 + + lda #MLI.C.GETPREFIX + jsr GP.GOSYSTEM + +LA6F8 pla + plp + beq LA744 + + cmp #$2C + bne LA703 + jmp LA795 + +LA703 cmp #$2F + beq LA70B + + cmp #$41 + bcc LA73D + +LA70B dex + lda #$82 + sta BS.GetCharSep + lsr + sta BS.GetCharMax + ldy #$00 + jsr LAA2D + dey + sty BS.CMDBUF.LEN + lda #$01 + sta GP.FoundBITS + +LA723 lda BS.CMDBUF.LEN,y + sta MLI.PATHBUF,y + dey + bpl LA723 + + dex + jsr BS.GetCharSpaceSep + bne LA73A + + bcc LA7A6 + + lda GP.AllowedBITS + lsr + bcs LA770 + +LA73A jmp BS.ERR10 + +LA73D lda GP.XCNUM + cmp #$06 + bne LA73A + +LA744 jmp LA7A6 + +LA747 jsr BS.GetKWInCmdBuf + beq LA73A + + cmp #$41 + beq LA79A + + jsr BS.TMPBUF3Reset + sty XBC08 + ldy #$13 + sty XBC09 + ldy #$40 + sty GP.FoundBITS + jsr LA96E + bcs LA76F + + lda GP.ParamINPR + cmp #$08 + bcc LA79F + +LA76C lda #$02 + sec +LA76F rts + +LA770 lsr + bcc LA795 + + jsr BS.GetCharSpaceSep + beq LA73A + + dex + lda #$82 + sta BS.GetCharSep + ldy #$01 + jsr BS.GetPathInPathBuf + dey + dey + sty MLI.PATHBUF + lda #$03 + sta GP.FoundBITS + dex + jsr BS.GetCharSpaceSep + bne LA73A + + bcc LA7A6 + +LA795 jsr BS.GetCharSpaceSep + beq LA73A + +LA79A jsr LA8F6 + bcs LA76F + +LA79F jsr BS.GetCharSpaceSep + bne LA73A + + bcs LA795 + +LA7A6 lda GP.ParamS + beq LA76C + + cmp #$08 + bcs LA76C + + lda GP.ParamD + beq LA76C + + cmp #$03 + bcs LA76C + + lda GP.AllowedBITS + and #$21 + lsr + beq LA7C9 + + lda GP.STATE + bne LA7C9 + + lda #$0F + sec + rts + +LA7C9 bcc LA80B + + lda GP.AllowedBITS+1 + and #$04 + beq LA80B + + lda GP.FoundBITS + lsr + bcs LA7E1 + + lda GP.AllowedBITS + and #$90 + beq BS.ERR10 + + bpl LA80B + +LA7E1 lda BS.CMDBUF + eor #$2F + beq LA7ED + + lda MLI.PFIXPTR + beq LA806 + +LA7ED lda GP.FoundBITS+1 + and #$04 + beq LA80B + + bcs LA806 + + lda #$00 + sta BS.CMDBUF.LEN + sta BS.CMDBUF + lda #$01 + ora GP.FoundBITS + sta GP.FoundBITS + +LA806 jsr BS.GetVolAtSxDy + bcs LA849 + +LA80B lda GP.XCNUM + asl + tax + lda BS.KW.JMP,x + sta BS.KW.JMPADDR + lda BS.KW.JMP+1,x + sta BS.KW.JMPADDR+1 + clc + txa + beq LA844 + + eor #$32 + beq LA844 + + lda GP.AllowedBITS+1 + and #$04 + + beq LA844 + lda GP.FoundBITS + lsr + bcc LA844 + + jsr BS.GetFileInfo + bcc LA844 + + cmp #$07 + bne LA849 + + lda GP.AllowedBITS + and #$08 + bne LA844 + + lda #$06 + rts + +LA844 jmp (BS.KW.JMPADDR) + +BS.ERR10 lda #$10 +LA849 sec + rts + +BS.GetVolAtSxDy lda GP.ParamS + asl + asl + asl + asl + asl + pha + lda GP.ParamD + eor #$01 + lsr + pla + ror + sta GP.MLIMRKEOFBUF.REFNUM + lda #$01 + sta GP.SBUFADR + lda #$02 + sta GP.SBUFADR+1 + lda #MLI.C.ONLINE + jsr GP.GOSYSTEM + bcs LA849 + + lda GP.ParamD + sta GP.VDEFDRV + lda GP.ParamS + sta GP.VDEFSLT + lda BS.CMDBUF + eor #$2F + beq LA8F4 + + lda IO.LINEBUF+1 + and #$0F + adc #$02 + sta IO.LINEBUF+1 + adc BS.CMDBUF.LEN + cmp #$40 + tax + lda #$10 + bcs LA8F5 + + ldy BS.CMDBUF.LEN + stx BS.CMDBUF.LEN + +LA89D dex + dey + bmi LA8AA + + lda BS.CMDBUF,y + sta BS.CMDBUF,x + jmp LA89D + +LA8AA lda #$2F + sta BS.CMDBUF + +LA8AF sta BS.CMDBUF,x + lda IO.LINEBUF,x + dex + bne LA8AF + + lda GP.XCNUM + cmp #$0B + beq LA8F4 + + cmp #$16 + beq LA8F4 + + cmp #$08 + beq LA8F4 + + lda MLI.PATHBUF + tay + clc + adc IO.LINEBUF+1 + cmp #$40 + tax + lda #$10 + bcs LA8F5 + + stx MLI.PATHBUF + +LA8D9 dex + dey + bmi LA8E6 + + lda MLI.PATHBUF+1,y + sta MLI.PATHBUF+1,x + jmp LA8D9 + +LA8E6 lda #$2F + sta MLI.PATHBUF+1 + +LA8EB sta MLI.PATHBUF+1,x + lda IO.LINEBUF,x + dex + bne LA8EB + +LA8F4 clc + +LA8F5 rts + +LA8F6 jsr BS.TMPBUF3Reset + ldy #$09 + +LA8FB cmp BS.KW.OPT,y + beq LA935 + + dey + bpl LA8FB + + cmp #$54 + beq LA90A + +LA907 jmp BS.ERR10 + +LA90A lda #$04 + and GP.AllowedBITS + beq LA931 + + ora GP.FoundBITS + sta GP.FoundBITS + lda #$00 + sta XBC08 + lda #$12 + sta XBC09 + jsr BS.GetCharSpaceSep + beq LA907 + + cmp #$24 + beq LA984 + + cmp #$41 + bcc LA96E + + jmp BS.GetFTypeASC + +LA931 sec + lda #$0B + rts + +LA935 lda BS.KW.OPT.PBITSLO,y + beq LA955 + + and GP.AllowedBITS+1 + beq LA931 + + cmp #$04 + bne LA94F + + and GP.FoundBITS+1 + bne LA955 + + lda #$01 + sta GP.ParamD + lda #$04 + +LA94F ora GP.FoundBITS+1 + sta GP.FoundBITS+1 + +LA955 lda BS.KW.OPT.PBITSHI,y + and #$03 + sta XBC08 + lda BS.KW.OPT.PBITSHI,y + lsr + lsr + sta XBC09 + jsr BS.GetCharSpaceSep + beq LA9BE + + cmp #$24 + beq LA984 + +LA96E stx GP.INPTR + jsr LAA6A + bcc LA97A + + bmi LA9C1 + + bcs LA9BE + +LA97A ldx GP.INPTR + jsr BS.GetCharSpaceSep + bne LA96E + + beq LA99D + +LA984 jsr BS.GetCharSpaceSep + beq LA9BE + +LA989 stx GP.INPTR + jsr LAABC + bcc LA995 + + bmi LA9C1 + + bcs LA9BE + +LA995 ldx GP.INPTR + jsr BS.GetCharSpaceSep + bne LA989 + +LA99D ldx #$02 +LA99F cpx XBC08 + beq LA9AC + + lda BS.TMPBUF4,x + bne LA9C1 + + dex + bne LA99F + +LA9AC ldy XBC09 +LA9AF lda BS.TMPBUF4,x + sta GP.ParamA,y + dey + dex + bpl LA9AF + + ldx GP.INPTR + clc + rts + +LA9BE jmp BS.ERR10 +LA9C1 jmp LA76C + +BS.GetFTypeASC ldy #$00 + +LA9C6 sta BS.TMPBUF4,y + iny + cpy #$03 + beq LA9D5 + + jsr BS.GetCharSpaceSep + bne LA9C6 + + beq LA9BE + +LA9D5 stx GP.INPTR +LA9D8 ldx #$00 + lda XBC08 + cmp #$0F + beq LA9BE + + asl + adc XBC08 + tay + +LA9E6 lda BS.TMPBUF4,x + eor BS.PRODOSTYPES.ASC,y + asl + bne LA9F7 + + iny + inx + cpx #$03 + bne LA9E6 + + beq LA9FC + +LA9F7 inc XBC08 + bne LA9D8 + +LA9FC lda #$0E + sec + sbc XBC08 + tay + lda BS.PRODOSTYPES.H,y + sta GP.ParamT + ldx GP.INPTR + clc + rts + +BS.GetPathInPathBuf + jsr BS.GetCharUC + sta MLI.PATHBUF,y + iny + cmp #$2C + beq LAA45 + + cmp #$20 + beq LAA45 + + cmp #$0D + beq LAA56 + + cpy BS.GetCharMax + bcc BS.GetPathInPathBuf + + ora #$00 + rts + +BS.GetKWInCmdBuf + ldx #$00 + ldy #$00 + +LAA2D jsr BS.GetCharUC + sta BS.CMDBUF,y + iny + cmp #$2C + beq LAA45 + + cmp #$20 + beq LAA45 + + cmp #$0D + beq LAA56 + + cpy BS.GetCharMax + bcc LAA2D + +LAA45 ora #$00 + rts + +BS.GetCharSpaceSep + lda #$20 + sta BS.GetCharSep + jsr BS.GetCharUC + cmp #$2C + beq LAA57 + + cmp #$0D + +LAA56 clc +LAA57 rts + +BS.GetCharUC lda IO.LINEBUF,x + and #$7F + cmp #$61 + bcc LAA63 + + and #$5F + +LAA63 inx + cmp BS.GetCharSep + beq BS.GetCharUC + + rts + +LAA6A cmp #$30 + bcc LAA72 + + cmp #$3A + bcc LAA76 + +LAA72 sec + ora #$00 + rts + +LAA76 and #$0F + pha + lda BS.TMPBUF4+2 + cmp #$1A + bcs LAAA2 + + ldx #$02 + +LAA82 lda BS.TMPBUF4,x + pha + dex + bpl LAA82 + + jsr BS.TMPBUF3x2 + jsr BS.TMPBUF3x2 + ldx #$00 + clc + +LAA92 pla + adc BS.TMPBUF4,x + sta BS.TMPBUF4,x + inx + txa + eor #$03 + bne LAA92 + + jsr BS.TMPBUF3x2 + +LAAA2 pla + bcs LAAB8 + + adc BS.TMPBUF4 + sta BS.TMPBUF4 + bcc LAABB + + clc + inc BS.TMPBUF4+1 + bne LAABB + + inc BS.TMPBUF4+2 + bne LAABB + +LAAB8 lda #$FF + sec +LAABB rts + +LAABC cmp #$30 + bcc LAACC + + cmp #$3A + bcc LAAD2 + + cmp #$41 + bcc LAACC + + cmp #$47 + bcc LAAD0 + +LAACC sec + ora #$00 + rts + +LAAD0 sbc #$06 +LAAD2 and #$0F + ldx #$03 + +LAAD6 jsr BS.TMPBUF3x2 + bcs LAAB8 + + dex + bpl LAAD6 + + ora BS.TMPBUF4 + sta BS.TMPBUF4 + rts + +BS.TMPBUF3x2 asl BS.TMPBUF4 + rol BS.TMPBUF4+1 + rol BS.TMPBUF4+2 + rts + +BS.IsIntCmd ldx #$1F + stx GP.XCNUM + lda BS.CMDBUF + eor #$2D + bne LAB03 + + inc GP.XCNUM + sta GP.XLEN + bne LAB20 + +LAB03 ldy #$08 + sty GP.XLEN + +LAB08 lda BS.KW.LEN,x + bpl LAB13 + + and #$7F + dey + dec GP.XLEN + +LAB13 tax +LAB14 lda BS.CMDBUF,y + cmp BS.KW.TABLE,x + bne LAB33 + + dex + dey + bpl LAB14 + +LAB20 lda GP.XCNUM + asl + tax + lda BS.KW.PBITS-1,x + sta GP.AllowedBITS+1 + lda BS.KW.PBITS-2,x + sta GP.AllowedBITS + clc + rts + +LAB33 ldy GP.XLEN + dec GP.XCNUM + ldx GP.XCNUM + bne LAB08 + + dec GP.XCNUM + sec + jmp GP.EXTRNCMD + +BS.TMPBUF3Reset ldy #$00 + sty BS.TMPBUF4 + sty BS.TMPBUF4+1 + sty BS.TMPBUF4+2 + rts + +BS.KW.APPEND lda GP.FITYPE + cmp #$FC + beq BS.KW.02 + + cmp #$06 + beq LABA3 + + cmp #$04 + bne LAB63 + + jmp BS.KW.EXEC + +LAB63 cmp #$FF + beq LAB6F + cmp #$B3 + beq LAB6F + lda #$0D + sec + rts + +LAB6F pha + jsr LB562 + jsr LB36B + lda #$00 + sta GP.ParamA + sta MLI.MEMTABL+19 + sta MLI.MEMTABL+20 + sta MLI.MEMTABL+21 + sta MLI.MEMTABL+22 + lda #$01 + sta MLI.MEMTABL+23 + lda #$20 + sta GP.ParamA+1 + pla + cmp #$FF + bne LABA6 + + sta GP.ParamT + lda #$80 + sta GP.FoundBITS+1 + lda #$05 + sta GP.FoundBITS +LABA3 jmp BS.KW.BRUN + +LABA6 sec + jsr MON.IIGSID + bcs LABA3 + + jmp LB099 + +BS.KW.X05 jsr LA411 + lda AS.HIMEM+1 + sta BS.AS.HIMEMSave + ldx XBBEA + dex + stx AS.HIMEM+1 + jsr LAC22 + ldx BS.AS.HIMEMSave + stx AS.HIMEM+1 + bcs LAC33 + + jsr AS.CLEAR1 + jsr LA480 + lda #$00 + beq LABE6 + +BS.KW.02 lda #$00 + sta GP.IFILACTV + sta AS.ERRNUM + lda GP.FoundBITS + lsr + bcc LABF4 + + jsr LAC1D + bcs LAC33 + + jsr AS.CLEAR1 + +LABE6 sta AS.ERRFLG + jsr LACB6 + jsr BS.SaveCSWKSW + jsr LABF4 + jmp AS.NEXTSTMT + +LABF4 jsr AS.NORMAL + lda #$A3 + sta X9F65 + lda #$FF + sta GP.XCNUM + sta ZP.PROMPT + ldx #$04 + jsr BS.SetState + jmp BS.ERR10 + +BS.KW.RESTORE jsr LAC1D + bcs LAC33 + +BS.ENTRY jsr AS.CLEAR1 + jsr BS.SetState0 + lda #$00 + sta ZP.CH + jmp AS.RESTART1 + +LAC1D jsr LB562 + bcs LAC33 + +LAC22 jsr LAC34 + bcs LAC33 + + sty AS.ARRAYSTART + sty AS.VARSTART + sty AS.ARRAYEND + stx AS.ARRAYSTART+1 + stx AS.VARSTART+1 + stx AS.ARRAYEND+1 + +LAC33 rts + +LAC34 lda #$01 + ldx #$FC + jsr BS.CheckFTypeXAccessA + bcs LAC33 + + lda #MLI.C.GETEOF + jsr GP.GOSYSTEM + bcs LAC33 + + lda AS.PGRMSTART + sta GP.MLIRW.DATAPTR + adc GP.SBUFADR + sta GP.ParamA + lda AS.PGRMSTART+1 + sta GP.MLIRW.DATAPTR+1 + adc GP.SBUFADR+1 + sta GP.ParamA+1 + bcs LAC5E + + cmp AS.HIMEM+1 + +LAC5E lda #$0E + bcs LAC33 + + ldx GP.SBUFADR + ldy GP.SBUFADR+1 + jsr BS.ReadXYBytes + bcs LAC33 + + jsr BS.FileClose + bcs LAC33 + + jsr LAC80 + ldx GP.ParamA+1 + ldy GP.ParamA + stx AS.PGRMEND+1 + sty AS.PGRMEND + rts + +LAC80 sec + lda AS.PGRMSTART + sbc GP.FIAUXTYPE + sta ZP.A1L + lda AS.PGRMSTART+1 + sbc GP.FIAUXTYPE+1 + sta ZP.A1H + ora ZP.A1L + clc + beq LACD9 + + ldx AS.PGRMSTART + lda AS.PGRMSTART+1 + +LAC98 stx ZP.PCL + sta ZP.PCH + ldy #$01 + lda (ZP.PCL),y + dey + ora (ZP.PCL),y + beq LACD9 + + lda (ZP.PCL),y + adc ZP.A1L + tax + sta (ZP.PCL),y + iny + lda (ZP.PCL),y + adc ZP.A1H + sta (ZP.PCL),y + clc + bcc LAC98 + +LACB6 lda GP.FoundBITS+1 + and #$08 + clc + beq LACD9 + + lda GP.ParamAT + sta AS.LINNUM + lda GP.ParamAT+1 + sta AS.LINNUM+1 + jsr AS.FINDLINE + clc + lda AS.LOWTR + adc #$FF + sta AS.TXTPTR + lda AS.LOWTR+1 + adc #$FF + sta AS.TXTPTR+1 + clc +LACD9 rts + +BS.KW.STORE bcc LACFE + + lda #$FC + sta GP.ParamT + sta GP.FITYPE + lda #$C3 + sta GP.FIACCESS + lda AS.PGRMSTART + sta GP.CRAUXTYPE + sta GP.FIAUXTYPE + lda AS.PGRMSTART+1 + sta GP.CRAUXTYPE+1 + sta GP.FIAUXTYPE+1 + jsr BS.CreateFileOrDir + bcs LAD47 + +LACFE lda #$02 + ldx #$FC + jsr BS.CheckFTypeXAccessA + bcs LAD47 + + lda AS.PGRMEND + sec + sbc AS.PGRMSTART + tax + sta GP.SBUFADR + lda AS.PGRMEND+1 + sbc AS.PGRMSTART+1 + tay + sta GP.SBUFADR+1 + lda #$00 + sta GP.SBUFADR+2 + lda AS.PGRMSTART + sta GP.MLIRW.DATAPTR + lda AS.PGRMSTART+1 + sta GP.MLIRW.DATAPTR+1 + jsr BS.WriteXYBytes + bcs LAD47 + + lda #MLI.C.SETEOF + jsr GP.GOSYSTEM + bcs LAD47 + + jsr BS.FileClose + bcs LAD47 + + lda AS.PGRMSTART+1 + ldx AS.PGRMSTART + cmp GP.FIAUXTYPE+1 + bne LAD48 + + cpx GP.FIAUXTYPE + clc + bne LAD48 + +LAD47 rts + +LAD48 stx GP.FIAUXTYPE + sta GP.FIAUXTYPE+1 + jmp BS.SetFileInfoNoDate + +BS.KW.CREATE lda #$00 + sta GP.CRAUXTYPE + sta GP.CRAUXTYPE+1 + lda GP.FoundBITS + and #$04 + bne BS.CreateFileOrDir + + lda #$0F + sta GP.ParamT +BS.CreateFileOrDir + lda GP.EXECACTV + asl + lda #$00 + adc GP.OPENCNT + cmp #$08 + bcs LAD8D + + lda GP.ParamT + sta GP.CRTYPE + ldx #$C3 + ldy #$01 + cmp #$0F + bne LAD82 + + ldy #$0D + +LAD82 stx GP.CRACCESS + sty GP.CRSTTYPE + lda #MLI.C.CREATE + jmp GP.GOSYSTEM + +LAD8D lda #$0C + rts + +BS.KW.RENAME lda GP.FoundBITS + lsr + lsr + lda #MLI.C.RENAME + bcs LAD9E + + jmp BS.ERR10 + +BS.KW.DELETE lda #MLI.C.DESTROY + +LAD9E jmp GP.GOSYSTEM + +BS.KW.LOCK jsr BS.GetFileInfo + lda GP.FIACCESS + and #$3C + ora #$01 + sta GP.FIACCESS + jmp BS.SetFileInfo + +BS.KW.UNLOCK jsr BS.GetFileInfo + lda #$C3 + ora GP.FIACCESS + sta GP.FIACCESS + jmp BS.SetFileInfo + +BS.KW.PREFIX lda GP.FoundBITS+1 + and #$04 + sec + bne LADCB + + lda GP.FoundBITS + lsr + +LADCB lda #$C6 + bcs LAD9E + + lda ZP.PROMPT + beq LADF0 + + jsr BS.CROUT + ldx #$00 + +LADD8 cpx BS.CMDBUF.LEN + beq LADE8 + + lda BS.CMDBUF,x + ora #$80 + jsr BS.COUT + inx + bne LADD8 + +LADE8 jsr BS.CROUT + jsr BS.CROUT + clc + rts + +LADF0 lda #$FF + sta GP.PFXACTV + clc + rts +*-------------------------------------- +MAN +SAVE usr/src/basic.15/basic.s.b +LOAD usr/src/basic.15/basic.s +ASM diff --git a/BASIC.15/BASIC.S.C.txt b/BASIC.15/BASIC.S.C.txt new file mode 100644 index 00000000..0640f461 --- /dev/null +++ b/BASIC.15/BASIC.S.C.txt @@ -0,0 +1,1506 @@ +NEW + AUTO 3,1 +*-------------------------------------- +BS.KW.BSAVE bcc LAE2D + + lda GP.FoundBITS+1 + and #$B0 + cmp #$90 + +XAE00 bcc LAE31 + + lda GP.ParamA + sta GP.CRAUXTYPE + sta GP.FIAUXTYPE + lda GP.ParamA+1 + sta GP.CRAUXTYPE+1 + sta GP.FIAUXTYPE+1 + lda #$06 + sta GP.ParamT + sta GP.FITYPE + lda GP.FoundBITS + and #$04 + bne LAE31 + + jsr BS.CreateFileOrDir + bcs LAE33 + + jsr BS.GetFileInfo + bcs LAE33 + +LAE2D lda #$02 + bne LAE44 + +LAE31 lda #$06 + +LAE33 sec + rts + +BS.KW.BRUN jsr BS.KW.BLOAD + bcs LAE33 + + jsr LAE3F + clc + rts + +LAE3F jmp (GP.MLIRW.DATAPTR) + +BS.KW.BLOAD lda #$01 +LAE44 ldx #$06 + jsr BS.CheckFTypeXAccessA + bcs LAE33 + + ldx GP.ParamA + ldy GP.ParamA+1 + lda GP.FoundBITS+1 + bmi LAE66 + + ldx GP.FIAUXTYPE + ldy GP.FIAUXTYPE+1 + lda GP.FoundBITS + and #$04 + bne LAEAB + + lda GP.FoundBITS+1 + +LAE66 stx GP.MLIRW.DATAPTR + sty GP.MLIRW.DATAPTR+1 + bit GP.FoundBITS+1 + bvs LAE80 + + pha + lda GP.FITYPE + cmp #$06 + bne LAE7F + + stx GP.FIAUXTYPE + sty GP.FIAUXTYPE+1 + +LAE7F pla +LAE80 ldx GP.ParamL + ldy GP.ParamL+1 + and #$30 + beq LAEAF + + eor #$30 + beq LAEAB + + and #$10 + beq LAEC5 + + lda GP.ParamE + sec + sbc GP.ParamA + tax + lda GP.ParamE+1 + sbc GP.ParamA+1 + tay + inx + bne LAEA5 + + iny + +LAEA5 bcs LAEC5 + + lda #$02 + sec + rts + +LAEAB lda #$0B + sec + rts + +LAEAF lda #MLI.C.GETEOF + jsr GP.GOSYSTEM + bcs LAEC3 + + ldx GP.SBUFADR + ldy GP.SBUFADR+1 + lda GP.SBUFADR+2 + beq LAEC5 + + lda #$0E +LAEC3 sec + rts + +LAEC5 stx GP.MLIRW.COUNT + sty GP.MLIRW.COUNT+1 + lda GP.FoundBITS+1 + and #$40 + beq LAEF7 + + ldx #$02 +LAED4 lda GP.ParamB,x + sta GP.SBUFADR,x + dex + bpl LAED4 + +LAEDD lda #MLI.C.SETMARK + jsr GP.GOSYSTEM + ldx GP.XCNUM + bcc LAEF7 + + cmp #$02 + bne LAEC3 + + cpx #$0F + bne LAEC3 + + lda #MLI.C.SETEOF + jsr GP.GOSYSTEM + bcc LAEDD + rts + +LAEF7 ldx GP.XCNUM + lda #$CA + cpx #$0F + bne LAF24 + + bit GP.FoundBITS+1 + bvs LAF22 + + lda GP.FoundBITS+1 + and #$30 + beq LAF22 + + lda GP.MLIRW.COUNT + sta GP.SBUFADR + lda GP.MLIRW.COUNT+1 + sta GP.SBUFADR+1 + lda #$00 + sta GP.SBUFADR+2 + lda #MLI.C.SETEOF + jsr GP.GOSYSTEM + +LAF22 lda #MLI.C.WRITE + +LAF24 jsr GP.GOSYSTEM + bcs LAF38 + bit GP.FoundBITS+1 + bvs LAF35 + + cpx #$0F + bne LAF35 + + jsr BS.SetFileInfoNoDate + +LAF35 jmp BS.FileClose + +LAF38 sec + rts + +BS.KW.SAVE bcc LAF4E + + lda #$FD + sta GP.ParamT + sta GP.FITYPE + lda #$C3 + sta GP.FIACCESS + jsr BS.CreateFileOrDir + bcs LAF9C + +LAF4E jsr LA411 + bcs LAF9C + + ldx #$FD + lda #$02 + jsr BS.CheckFTypeXAccessA + bcs LAF95 + + jsr BS.SetupRW5AtBBE4 + jsr BS.WriteXYBytes + bcs LAF95 + + lda XBBE9 + sta GP.MLIRW.DATAPTR + sta GP.FIAUXTYPE + lda XBBEA + sta GP.MLIRW.DATAPTR+1 + sta GP.FIAUXTYPE+1 + ldy XBBEC + ldx XBBEB + jsr BS.WriteXYBytes + bcs LAF95 + + lda #MLI.C.GETMARK + jsr GP.GOSYSTEM + lda #MLI.C.SETEOF + jsr GP.GOSYSTEM + bcs LAF95 + + jsr BS.SetFileInfoNoDate + bcs LAF95 + + jsr BS.FileClose + +LAF95 php + pha + jsr LA480 + pla + plp +LAF9C rts + +BS.SetupRW5AtBBE4 + lda #$E4 + sta GP.MLIRW.DATAPTR + lda #$BB + sta GP.MLIRW.DATAPTR+1 + ldy #$00 + ldx #$05 + rts + +BS.KW.LOAD ldx #$FD + lda #$01 + jsr BS.CheckFTypeXAccessA + bcs LAF9C + + jsr BS.SetupRW5AtBBE4 + jsr BS.ReadXYBytes + bcs LAF9C + + lda GP.FIAUXTYPE + sta XBBE9 + sta GP.MLIRW.DATAPTR + lda AS.HIMEM+1 + sec + sbc BS.BAS.HDR+4 + clc + adc GP.FIAUXTYPE+1 + sta GP.MLIRW.DATAPTR+1 + sta XBBEA + cmp AS.PGRMEND+1 + bcc LAFF3 + + beq LAFF3 + + lda #$00 + sbc XBBE9 + tax + lda AS.HIMEM+1 + sbc XBBEA + tay + jsr BS.ReadXYBytes + bcs LAF9C + + jsr BS.FileClose + jmp LAF95 + +LAFF3 lda #$0E + sec + rts + +BS.FileClose lda #MLI.C.CLOSE + bne LB007 + +BS.ReadXYBytes lda #MLI.C.READ + bne LB001 + +BS.WriteXYBytes lda #MLI.C.WRITE +LB001 sty GP.MLIRW.COUNT+1 + stx GP.MLIRW.COUNT + +LB007 jmp GP.GOSYSTEM + +BS.KW.IN lda #$00 + sta BS.GetCharSep + beq LB018 + +BS.KW.PR lda #$02 + sta BS.GetCharSep + lda #$08 +LB018 ora GP.ParamINPR + asl + tax + lda GP.FoundBITS + and #$40 + beq LB035 + + lda GP.FoundBITS+1 + bmi LB04A + + lda GP.OUTVECT0,x + sta GP.ParamA + lda GP.OUTVECT0+1,x + sta GP.ParamA+1 + +LB035 jsr LB05C + bcs LB049 + + ldy BS.GetCharSep + lda GP.ParamA + sta ZP.CSW,y + lda GP.ParamA+1 + sta ZP.CSW+1,y +LB049 rts + +LB04A jsr LB05C + bcs LB05B + + lda GP.ParamA+1 + sta GP.OUTVECT0+1,x + lda GP.ParamA + sta GP.OUTVECT0,x +LB05B rts + +LB05C lda GP.ParamA + sta ZP.PCL + lda GP.ParamA+1 + sta ZP.PCH + ldy #$00 + cmp #$C0 + bcc LB081 + + lda $CFFF + sty ZP.A1L + lda (ZP.PCL),y + cmp #$FF + beq LB087 + +LB077 cmp (ZP.PCL),y + bne LB087 + + dec ZP.A1L + bne LB077 + +LB07F clc + rts + +LB081 lda (ZP.PCL),y + cmp #$D8 + beq LB07F + +LB087 lda #$03 + sec + rts + +BS.KW.BYE jsr LB562 + jsr LB36B + lda #$65 + jsr MLI + .DA #MLI.C.QUIT + .DA GP.MLIRW + +LB099 jsr MLI + .DA #MLI.C.QUIT + .DA BS.MLIQUIT2.Param +BS.MLIQUIT2.Param + .DA #4 + .DA #$EE + .DA MLI.PATHBUF + .DA #0 + .DA 0 + +BS.KW.CAT lda #$27 + bne LB0AC + +BS.KW.CATALOG lda #$4F + +LB0AC sta BS.CATWIDTH + lda GP.FoundBITS + and #$05 + lsr + bne LB0BA + + sta GP.ParamT + +LB0BA bcs LB0C1 + + jsr BS.GetFileInfo + bcs LB127 + +LB0C1 jsr LB1BA + bcs LB127 + + jsr BS.CROUT + jsr LB128 + jsr BS.LINEBUFOUT + jsr BS.CROUT + jsr BS.LINEBUFCLR80 + ldx #$10 + jsr BS.PRINTERRMSGX + jsr BS.LINEBUFOUT + jsr BS.CROUT + lda XBC14 + ora XBC15 + nop + nop + +LB0E8 jsr LB241 + bcs LB113 + + lda GP.ParamT + beq LB0F7 + + cmp DIRENTBUF.TYPE + bne LB0FD + +LB0F7 jsr LA4D2 + jsr BS.LINEBUFOUT + +LB0FD lda IO.KBD + cmp #$83 + bne LB10E + + lda GP.STATE + bne LB113 + + bit IO.KSTROBE + bcs LB113 + +LB10E nop + lda #$FF + bne LB0E8 + +LB113 jsr BS.FileClose + bcs LB127 + + jsr BS.CROUT + jsr LB157 + bcs LB127 + + jsr BS.LINEBUFOUT + jsr BS.CROUT + + clc +LB127 rts + +LB128 jsr BS.LINEBUFCLR80 + ldx #$01 + ldy DIRENTBUF.STNL + lda #$AF + cpy #$F0 + bcc LB13A + + sta IO.LINEBUF,x + inx + +LB13A tya + and #$0F + sta IO.LINEBUF + ldy #$05 + +LB142 lda DIRENTBUF,y + ora #$80 + sta IO.LINEBUF,x + iny + inx + dec IO.LINEBUF + bne LB142 + + lda #$A2 + sta IO.LINEBUF + rts + +LB157 lda #$18 + sta GP.SBUFADR + lda #$BC + sta GP.SBUFADR+1 + lda MLI.DEVNUM + sta GP.MLIMRKEOFBUF.REFNUM + lda #MLI.C.ONLINE + jsr GP.GOSYSTEM + bcs LB127 + + lda BS.CMDBUF + and #$0F + tax + inx + stx BS.CMDBUF.LEN + lda #$AF + sta BS.CMDBUF + jsr BS.GetFileInfo + bcs LB127 + + jsr BS.LINEBUFCLR80 + ldx #$36 + jsr BS.PRINTERRMSGX + jsr BS.TMPBUF3Reset + lda GP.FIAUXTYPE + ldx GP.FIAUXTYPE+1 + ldy #$3D + jsr BS.AXDEC2LINEBUFY + lda GP.FIBLOKS + ldx GP.FIBLOKS+1 + ldy #$26 + jsr BS.AXDEC2LINEBUFY + lda GP.FIAUXTYPE + sec + sbc GP.FIBLOKS + pha + lda GP.FIAUXTYPE+1 + sbc GP.FIBLOKS+1 + tax + pla + ldy #$10 + jsr BS.AXDEC2LINEBUFY + clc + rts + +LB1BA lda #$01 + ldx #$0F + ldy GP.STTYPE + cpy #$0F + bne LB1C8 + + stx GP.FITYPE + +LB1C8 jsr LB210 + bcs LB203 + +BS.ReadDirEnt lda #$59 + sta GP.MLIRW.DATAPTR + lda #$02 + sta GP.MLIRW.DATAPTR+1 + lda #$2B + sta GP.MLIRW.COUNT + lda #$00 + sta GP.MLIRW.COUNT+1 + lda #MLI.C.READ + jsr GP.GOSYSTEM + bcs LB203 + + ldx #$03 + +LB1EA lda $27C,x + sta XBC12,x + dex + bpl LB1EA + + sta GP.MLIRW.COUNT + lda #$01 + sta XBC16 + lda #$00 + sta GP.SBUFADR+1 + sta GP.SBUFADR+2 +LB203 rts + +BS.CheckFTypeXAccessA + pha + lda GP.FoundBITS + and #$04 + beq LB20F + + ldx GP.ParamT + +LB20F pla + +LB210 cpx GP.FITYPE + bne LB239 + + and GP.FIACCESS + beq LB23D + + lda XBBE3 + sta GP.OSYSBUF+1 + lda #$0F + sta MLI.LEVEL + lda #MLI.C.OPEN + jsr GP.GOSYSTEM + bcs LB238 + + lda GP.OREFNUM + sta GP.MLIRW.REFNUM + sta GP.MLICF.REFNUM + sta GP.MLIMRKEOFBUF.REFNUM + +LB238 rts + +LB239 lda #$0D + sec + rts + +LB23D lda #$0A + sec + rts + +LB241 lda GP.SBUFADR+1 + and #$FE + sta GP.SBUFADR+1 + ldy XBC16 + lda #$00 + cpy XBC13 + bcc LB25D + + tay + sty XBC16 + inc GP.SBUFADR+1 + +LB25A inc GP.SBUFADR+1 + +LB25D dey + clc + bmi LB268 + + adc XBC12 + bcc LB25D + + bcs LB25A + +LB268 adc #$04 + sta GP.SBUFADR + lda #MLI.C.SETMARK + jsr GP.GOSYSTEM + bcs LB28D + + lda #MLI.C.READ + jsr GP.GOSYSTEM + bcs LB28D + + inc XBC16 + lda DIRENTBUF + and #$F0 + beq LB241 + + dec XBC14 + bne LB28D + + dec XBC15 + +LB28D rts +BS.JMP.XTRNADDR jmp (GP.XTRNADDR) + +BS.KW.EXEC jsr BS.CheckFilename + bcs LB2C0 + + bit GP.EXECFILE + bpl LB2BC + + sta GP.MLIMRKEOFBUF.REFNUM + lda #$00 + sta GP.SBUFADR + sta GP.SBUFADR+1 + sta GP.SBUFADR+2 + lda #MLI.C.SETMARK + jsr GP.GOSYSTEM + bcs LB2B5 + + lda GP.MLIMRKEOFBUF.REFNUM + bne LB333 + +LB2B5 pha + jsr LB36B + pla + sec + rts + +LB2BC lda #$14 + sec + rts + +LB2C0 bit GP.EXECACTV + bpl LB2CA + + jsr LB36B + bcs LB2D3 + +LB2CA lda GP.FITYPE + cmp #$04 + beq LB2D5 + + lda #$0D +LB2D3 sec + rts + +LB2D5 jsr LA1F9 + bcs LB2D3 + + lda #$00 + sta GP.SBUFADR + lda XBBE3 + sta GP.SBUFADR+1 + ldx GP.OPENCNT + beq LB30E + + tay + txa + asl + asl + adc XBBE3 + pha +LB2F2 cmp XBBEE,x + beq LB2FB + + dex + bne LB2F2 + + brk + +LB2FB tya + sta XBBEE,x + lda XBBF6,x + sta GP.MLIMRKEOFBUF.REFNUM + lda #MLI.C.SETBUF + jsr GP.GOSYSTEM + bcc LB30D + + brk + +LB30D pla +LB30E sta XBBE3 + sta GP.OSYSBUF+1 + lda #$00 + sta MLI.LEVEL + lda #MLI.C.OPEN + jsr GP.GOSYSTEM + bcc LB327 + + pha + jsr LA250 + pla + sec + rts + +LB327 ldx GP.OSYSBUF+1 + stx XBBF6 + lda GP.OREFNUM + sta XBBFE +LB333 sta GP.MLIRW.REFNUM + sta GP.MLIMRKEOFBUF.REFNUM + sta GP.NEWLREF + ldx GP.FIAUXTYPE + stx GP.ParamL + ldx GP.FIAUXTYPE+1 + stx GP.ParamL+1 + jsr LB45B + lda #$7F + sta GP.NLINEMASK + lda #MLI.C.NEWLINE + jsr GP.GOSYSTEM + lda GP.FoundBITS+1 + and #$03 + beq LB364 + + jsr LB592 + bcc LB364 + + jmp LB2B5 + +LB364 lda #$FF + sta GP.EXECACTV + clc + rts + +LB36B lda GP.EXECACTV + bpl LB37B + + sta GP.EXECFILE + ldx #$08 + lda XBBF6,x + jsr LB515 + +LB37B rts + +BS.KW.X10 bcs LB3B7 + + lda GP.FoundBITS + and #$01 + bne LB38D + + ldx #$00 + jsr BS.PRINTERRX + jsr BS.CROUT + +LB38D clc + rts + + lda #$00 + beq LB39F + +BS.KW.FLUSH lda GP.FoundBITS + and #$01 + beq LB39F + + jsr BS.CheckFilename + bcs LB3A7 + +LB39F sta GP.MLICF.REFNUM + lda #MLI.C.FLUSH + jsr GP.GOSYSTEM + +LB3A7 rts + +BS.KW.03 php + jsr BS.CheckFilename + bcs LB3BB + + plp + lda #$14 + sec + rts + +LB3B3 lda #$0D + sec + rts + +LB3B7 lda #$06 +LB3B9 sec + rts + +LB3BB plp + ldx #$00 + ldy #$00 + lda GP.FoundBITS+1 + and #$10 + bne LB3CD + + stx GP.ParamL+1 + sty GP.ParamL + +LB3CD lda GP.FoundBITS + and #$04 + eor #$04 + beq LB3DB + + lda #$04 + sta GP.ParamT + +LB3DB bcc LB3FE + + beq LB3B7 + + sta GP.FITYPE + lda #$C3 + sta GP.FIACCESS + ldx GP.ParamL+1 + ldy GP.ParamL + stx GP.CRAUXTYPE+1 + stx GP.FIAUXTYPE+1 + sty GP.CRAUXTYPE + sty GP.FIAUXTYPE + jsr BS.CreateFileOrDir + bcs LB3B9 + +LB3FE lda GP.FITYPE + cmp GP.ParamT + bne LB3B3 + + cmp #$04 + bne LB41D + + ldx GP.FIAUXTYPE+1 + ldy GP.FIAUXTYPE + lda GP.FoundBITS+1 + and #$10 + bne LB41D + + stx GP.ParamL+1 + sty GP.ParamL + +LB41D jsr LA1F9 + bcs LB3B9 + + lda XBBE3 + sta GP.OSYSBUF+1 + lda #$07 + sta MLI.LEVEL + lda #MLI.C.OPEN + jsr GP.GOSYSTEM + bcc LB43B + + pha + jsr LA250 + pla + sec + rts + +LB43B lda GP.FITYPE + cmp #$0F + beq LB443 + + clc + +LB443 lda #$00 + ror + sta GP.DIRFLG + ldx GP.OPENCNT + lda XBBE3 + sta XBBEF,x + lda GP.OREFNUM + sta XBBF7,x + inc GP.OPENCNT +LB45B asl + asl + asl + asl + asl + tax + lda MLI.PATHBUF + ora GP.DIRFLG + sta XBC59,x + and #$7F + tay + cmp #$1E + bcc LB473 + + lda #$1D + +LB473 sta ZP.PCL + lda GP.ParamL + sta XBC5A,x + lda GP.ParamL+1 + sta XBC5B,x + +LB481 inx + lda MLI.PATHBUF,y + sta XBC5B,x + dey + dec ZP.PCL + bne LB481 + +BS.KW.X07 clc + rts + +BS.CheckFilename + lda GP.FoundBITS + and #$01 + bne LB49A + + lda #$10 + sec + rts + +LB49A ldx GP.OPENCNT + beq LB4B8 + + stx GP.EXECFILE + +LB4A2 stx ZP.PCH + lda XBBF6,x + jsr LB4D2 + bne LB4B3 + + ldx ZP.PCH + +LB4AE lda XBBF6,x +LB4B1 clc + rts + +LB4B3 ldx ZP.PCH + dex + bne LB4A2 + +LB4B8 lda GP.EXECACTV + bpl LB4CE + + lda XBBFE + jsr LB4D2 + bne LB4CE + + lda #$FF + sta GP.EXECFILE + ldx #$08 + bne LB4AE + +LB4CE lda #$12 + sec + rts + +LB4D2 asl + asl + asl + asl + asl + tax + lda XBC59,x + sta GP.DIRFLG + and #$7F + cmp MLI.PATHBUF + bne LB508 + + tay + cmp #$1E + bcc LB4EC + + lda #$1D + +LB4EC sta ZP.PCL + lda XBC5A,x + sta XBBFF + lda XBC5B,x + sta XBC00 + +LB4FA inx + lda MLI.PATHBUF,y + cmp XBC5B,x + bne LB508 + + dey + dec ZP.PCL + bne LB4FA + +LB508 rts + +BS.KW.X06 lda GP.FoundBITS + and #$01 + beq LB562 + + jsr BS.CheckFilename + bcs LB4B1 + +LB515 sta GP.MLICF.REFNUM + lda XBBEE,x + sta XBBE3 + bit GP.EXECFILE + bmi LB53F + + ldy GP.OPENCNT + pha + lda XBBEE,y + sta XBBEE,x + pla + sta XBBEE,y + lda XBBF6,x + pha + lda XBBF6,y + sta XBBF6,x + pla + sta XBBF6,y + +LB53F lda #$00 + sta MLI.LEVEL + lda #MLI.C.CLOSE + jsr GP.GOSYSTEM + bcs LB572 + + jsr LA250 + bit GP.EXECFILE + bpl LB55E + + pha + lda #$00 + sta GP.EXECACTV + sta GP.EXECFILE + pla + rts + +LB55E dec GP.OPENCNT + rts + +LB562 ldx GP.OPENCNT + beq LB573 + + stx GP.EXECFILE + lda XBBF6,x + jsr LB515 + bcc LB562 + +LB572 rts + +LB573 lda #$00 + sta GP.MLICF.REFNUM + lda #$07 + sta MLI.LEVEL + lda #MLI.C.CLOSE + jmp GP.GOSYSTEM + +BS.KW.CLOSE jsr BS.CheckFilename + bcs LB5EF + + sta GP.MLIRW.REFNUM + sta GP.NEWLREF + bit GP.DIRFLG + bmi LB5F0 + +LB592 lda GP.FoundBITS+1 + and #$03 + beq LB5ED + + cmp #$03 + beq LB5ED + + and #$01 + beq LB5AD + + lda GP.ParamR + sta GP.ParamF + lda GP.ParamR+1 + sta GP.ParamF+1 + +LB5AD lda #$EF + sta GP.MLIRW.COUNT + lda #$00 + sta GP.MLIRW.COUNT+1 + sta GP.MLIRW.DATAPTR + lda #$02 + sta GP.MLIRW.DATAPTR+1 + lda #$7F + sta GP.NLINEMASK + lda #MLI.C.NEWLINE + jsr GP.GOSYSTEM + bcs LB5EF + +LB5CB lda GP.ParamF + ora GP.ParamF+1 + clc + beq LB5F0 + + lda #MLI.C.READ + jsr GP.GOSYSTEM + bcs LB5EF + + lda GP.ParamF + sbc #$00 + sta GP.ParamF + lda GP.ParamF+1 + sbc #$00 + sta GP.ParamF+1 + bcs LB5CB + +LB5ED lda #$0B +LB5EF sec +LB5F0 rts + +LB5F1 lda XBBFF + sta BS.TMPBUF4 + lda XBC00 + sta BS.TMPBUF4+1 + lda #$00 + sta BS.TMPBUF4+2 + sta BS.TMPBUF4+3 + sta GP.SBUFADR + sta GP.SBUFADR+1 + sta GP.SBUFADR+2 +LB60E lsr GP.ParamR+1 + ror GP.ParamR + ldx #$00 + bcc LB62F + + clc + +LB619 lda BS.TMPBUF4,x + adc GP.SBUFADR,x + sta GP.SBUFADR,x + inx + txa + eor #$03 + bne LB619 + + bcs LB642 + + ldx BS.TMPBUF4+3 + bne LB642 + +LB62F rol BS.TMPBUF4,x + inx + txa + eor #$04 + bne LB62F + + lda GP.ParamR + ora GP.ParamR+1 + bne LB60E + + clc + rts + +LB642 lda #$02 + sec + rts + +BS.KW.X04 jsr BS.CheckFilename + bcs LB69B + + sta GP.MLIRW.REFNUM + sta GP.MLIMRKEOFBUF.REFNUM + sta GP.NEWLREF + bit GP.DIRFLG + bmi LB69C + + jsr LB6D0 + bcs LB69B + + ldx #$7F + ldy #$EF + lda GP.FoundBITS+1 + and #$10 + beq LB67C + + ldy GP.ParamL + ldx GP.ParamL+1 + bne LB6CB + + cpy #$EF + bcs LB6CB + + lda #$22 + sta IO.LINEBUF + + lda #$01 + +LB67C sta GP.MLIRW.DATAPTR + sty GP.MLIRW.COUNT + stx GP.NLINEMASK + lda #$02 + sta GP.MLIRW.DATAPTR+1 + lda #$00 + sta GP.MLIRW.COUNT+1 + lda #MLI.C.NEWLINE + jsr GP.GOSYSTEM + bcs LB69B + +LB696 lda #$FF + sta GP.IFILACTV +LB69B rts + +LB69C lda #$59 + sta GP.MLIRW.DATAPTR + lda #$02 + sta GP.MLIRW.DATAPTR+1 + lda #$01 + sta GP.CATFLAG + lda GP.FoundBITS+1 + and #$01 + clc + beq LB696 + + lda #$00 + sta GP.SBUFADR + sta GP.SBUFADR+1 + sta GP.SBUFADR+2 + lda #MLI.C.SETMARK + jsr GP.GOSYSTEM + bcs LB6CA + + lda #$FF + sta GP.IFILACTV + +LB6CA rts + +LB6CB lda #$02 + tax + sec + rts + +LB6D0 lda GP.FoundBITS+1 + and #$43 + beq LB719 + + and #$01 + beq LB6E5 + + jsr LB5F1 + bcs LB6CB + +LB6E0 jsr LB712 + bcs LB71A +LB6E5 + lda GP.FoundBITS+1 + and #$02 + beq LB6F1 + + jsr LB5AD + bcs LB71A + +LB6F1 lda GP.FoundBITS+1 + and #$40 + beq LB719 + + lda #MLI.C.GETMARK + jsr GP.GOSYSTEM + bcs LB71A + + ldx #$00 + ldy #$02 + +LB703 lda GP.ParamB,x + adc GP.SBUFADR,x + sta GP.SBUFADR,x + inx + dey + bpl LB703 + + bcs LB6CB + +LB712 lda #MLI.C.SETMARK + jsr GP.GOSYSTEM + bcs LB71A + +LB719 clc +LB71A ldx #$00 + rts + +BS.KW.X08 jsr BS.CheckFilename + bcs LB732 + + sta GP.MLIRW.REFNUM + sta GP.MLIMRKEOFBUF.REFNUM + sta GP.NEWLREF + bit GP.DIRFLG + bpl LB734 + + lda #$0A + +LB732 sec + rts + +LB734 lda #$00 + sta GP.MLIRW.DATAPTR + lda #$02 + sta GP.MLIRW.DATAPTR+1 + jsr LB6D0 + bcc LB757 + + cmp #$02 + bne LB732 + + cpx #$02 + beq LB732 + +LB74B lda #MLI.C.SETEOF + jsr GP.GOSYSTEM + bcs LB732 + + jsr LB6E0 + bcs LB732 + +LB757 lda AS.HIMEM + sta GP.MLIRW.DATAPTR + lda AS.HIMEM+1 + sta GP.MLIRW.DATAPTR+1 + lda #$FF + sta GP.OFILACTV + clc + rts + +BS.KW.X09 php + jsr BS.CheckFilename + bcc LB77A + + plp + jsr BS.KW.03 + bcs LB788 + + lda GP.OREFNUM + bne LB77B + + brk + +LB77A plp + +LB77B sta GP.MLIRW.REFNUM + sta GP.MLIMRKEOFBUF.REFNUM + bit GP.DIRFLG + bpl LB78A + + lda #$0A + +LB788 sec + rts + +LB78A ldx GP.ParamL + ldy GP.ParamL+1 + lda GP.FoundBITS+1 + and #$10 + bne LB79D + + ldx GP.FIAUXTYPE + ldy GP.FIAUXTYPE+1 +LB79D txa + pha + lda GP.MLIRW.REFNUM + lsr + ror + ror + ror + tax + pla + sta XBC5A,x + sta XBBFF + tya + sta XBC5B,x + sta XBC00 + lda #MLI.C.GETEOF + jsr GP.GOSYSTEM + bcs LB788 + + lda XBC00 + bne LB7C8 + + lda XBBFF + cmp #$02 + bcc LB7CD + +LB7C8 jsr LB7D0 + bcs LB788 + +LB7CD jmp LB74B + +LB7D0 ldx #$03 +LB7D2 lda GP.MLIMRKEOFBUF.REFNUM,x + sta XBC09,x + dex + bne LB7D2 + + stx BS.TMPBUF4+3 + stx XBC0E + ldy #$18 + +LB7E3 jsr BS.TMPBUF3x2 + rol BS.TMPBUF4+3 + rol XBC0E + sec + lda BS.TMPBUF4+3 + sbc XBBFF + tax + lda XBC0E + sbc XBC00 + bcc LB805 + + stx BS.TMPBUF4+3 + sta XBC0E + inc BS.TMPBUF4 + +LB805 dey + bne LB7E3 + + lda BS.TMPBUF4+3 + ora XBC0E + clc + beq LB839 + + lda XBBFF + sec + sbc BS.TMPBUF4+3 + tax + lda XBC00 + sbc XBC0E + tay + txa + clc + adc GP.SBUFADR + sta GP.SBUFADR + tya + adc GP.SBUFADR+1 + sta GP.SBUFADR+1 + lda GP.SBUFADR+2 + adc #$00 + sta GP.SBUFADR+2 + lda #$02 + +LB839 rts + +BS.GetFileInfo lda #$0A + sta GP.SSGINFO + lda #MLI.C.GETFILEINFO + bne LB858 + +BS.SetFileInfoNoDate + lda #$00 + sta GP.FIMDATE + sta GP.FIMDATE+1 + sta GP.FICDATE + sta GP.FICDATE+1 + +BS.SetFileInfo lda #$07 + sta GP.SSGINFO + lda #MLI.C.SETFILEINFO + +LB858 jmp GP.GOSYSTEM + +BS.JMP.GP.VSYSO jmp (GP.VSYSO) +BS.JMP.GP.VSYSI jmp (GP.VSYSI) +*-------------------------------------- +MAN +SAVE usr/src/basic.15/basic.s.c +LOAD usr/src/basic.15/basic.s +ASM diff --git a/BASIC.15/BASIC.S.D.txt b/BASIC.15/BASIC.S.D.txt new file mode 100644 index 00000000..549a9962 --- /dev/null +++ b/BASIC.15/BASIC.S.D.txt @@ -0,0 +1,659 @@ +NEW + AUTO 3,1 +*-------------------------------------- +BS.SYSIOVECTS .DA BS.IO.OUT + .DA BS.IO.IN + .DA BS.IO.OUT.TRACE + .DA BS.IO.IN0 + .DA BS.IO.OUT.CAT + .DA BS.IO.IN0 +BS.VSYSO.LO .DA #$A7 +BS.VSYSO.HI .DA #$9D +BS.ParamLByte .DA #$A0 + .DA #$AC + .DA #$AF + .DA #$B4 + .DA #$B4 + .DA #$C6 + .DA #$AC + .DA #$AC + .DA #$CB + .DA #$D1 + .DA #$D5 + .DA #$D5 + .DA #$DD + .DA #$DD + .DA #$C6 + .DA #$C6 + .DA #$C6 + .DA #$C6 + .DA #$C6 + .DA #$C6 +BS.BYTES .DA #$80 + .DA #$81 + .DA #$82 + .DA #$83 + .DA #$84 + .DA #$85 + .DA #$86 + .DA #$87 + .DA #$88 + .DA #$89 + .DA #$8A + .DA #$8B + .DA #$19 + .DA #$8D + .DA #$8E + .DA #$8F + .DA #$90 + .DA #$91 + .DA #$92 + .DA #$93 + .DA #$94 + .DA #$95 + .DA #$96 + .DA #$97 + .DA #$98 + .DA #$99 + .DA #$9A + .DA #$23 + .DA #$28 + .DA #$5A + .DA #$5A + .DA #$56 + .DA #$A0 + .DA #$A1 + .DA #$A2 + .DA #$A3 + .DA #$A4 + .DA #$A5 + .DA #$34 + .DA #$A7 + .DA #$A8 + .DA #$A9 + .DA #$1F + .DA #$AB + .DA #$AC + .DA #$00 + .DA #$AE + .DA #$AF + .DA #$B0 + .DA #$B1 + .DA #$B2 + .DA #$B3 + .DA #$B4 + .DA #$B5 + .DA #$B6 + .DA #$B7 + .DA #$B8 + .DA #$B9 + .DA #$00 + .DA #$BB + .DA #$13 + .DA #$BD + .DA #$BE +BS.KW.LEN .DA #$BF + .DA #$47 + .DA #$5F + .DA #$18 + .DA #$30 + .DA #$15 + .DA #$BD + .DA #$3D + .DA #$28 + .DA #$0D + .DA #$41 + .DA #$20 + .DA #$50 + .DA #$84 + .DA #$0D + .DA #$04 + .DA #$46 + .DA #$6A + .DA #$4C + .DA #$5C + .DA #$35 + .DA #$A5 + .DA #$70 + .DA #$2D + .DA #$12 + .DA #$65 + .DA #$39 + .DA #$41 + .DA #$88 + .DA #$1C + .DA #$B5 + .DA #$D8 +BS.KW.TABLE .AS "BSAVERIFYBLOADELETEBYECATALOGOPENWRITEXECREATEFRESTORENAMEBRUNLOCKCHAIN#FLUSHREADPOSITIONOMONPR#PREFIXCLOSEAPPEND" +BS.KW.JMP .DA BS.JMP.XTRNADDR + .DA BS.KW.PR + .DA BS.KW.IN + .DA BS.KW.CAT + .DA BS.KW.01 + .DA BS.KW.BYE + .DA BS.KW.02 + .DA BS.KW.BRUN + .DA BS.KW.EXEC + .DA BS.KW.RESTORE + .DA BS.KW.LOCK + .DA BS.KW.03 + .DA BS.KW.X04 + .DA BS.KW.STORE + .DA BS.KW.BLOAD + .DA BS.KW.BSAVE + .DA BS.KW.X05 + .DA BS.KW.X06 + .DA BS.KW.FLUSH + .DA BS.KW.X07 + .DA BS.KW.SAVE + .DA BS.KW.X08 + .DA BS.KW.X09 + .DA BS.KW.CREATE + .DA BS.KW.DELETE + .DA BS.KW.PREFIX + .DA BS.KW.RENAME + .DA BS.KW.UNLOCK + .DA BS.KW.X10 + .DA BS.KW.CATALOG + .DA BS.KW.LOAD + .DA BS.KW.CLOSE + .DA BS.KW.APPEND +BS.KW.PBITS .DA $8040 + .DA $8040 + .DA $0495 + .DA $0000 + .DA $0000 + .DA $0C11 + .DA $F401 + .DA $0701 + .DA $0401 + .DA $0401 + .DA $142D + .DA $5321 + .DA $0409 + .DA $F405 + .DA $F40D + .DA $0C01 + .DA $0001 + .DA $0001 + .DA $0000 + .DA $0409 + .DA $4321 + .DA $142D + .DA $040D + .DA $0401 + .DA $0491 + .DA $0403 + .DA $0401 + .DA $0411 + .DA $0495 + .DA $0401 + .DA $0321 + .DA $0401 +BS.KW.OPT .AS "ABELSDFRV@" +BS.KW.OPT.PBITSLO + .DA #$80 + .DA #$40 + .DA #$20 + .DA #$10 + .DA #$04 + .DA #$04 + .DA #$02 + .DA #$01 + .DA #$00 + .DA #$08 +BS.KW.OPT.PBITSHI + .DA #$05 + .DA #$12 + .DA #$19 + .DA #$21 + .DA #$24 + .DA #$28 + .DA #$31 + .DA #$39 + .DA #$40 + .DA #$45 +BS.PRODOSTYPES.H + .DA #$FF + .DA #$FE + .DA #$FD + .DA #$FC + .DA #$FB + .DA #$FA + .DA #$F0 + .DA #$0F + .DA #$06 + .DA #$04 + .DA #$EF + .DA #$1A + .DA #$1B + .DA #$19 + .DA #$B3 +BS.PRODOSTYPES.ASC + .AS -"S16ADBASPAWPPASTXTBINDIRCMDINTIVRBASVARRELSYS" +BS.MONTHS .AS -"JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC" +BS.NODATE .AS -"" +BS.MLIERTBL .DA #$28 + .DA #$2B + .DA #$40 + .DA #$41 + .DA #$42 + .DA #$43 + .DA #$44 + .DA #$45 + .DA #$46 + .DA #$47 + .DA #$48 + .DA #$49 + .DA #$4B + .DA #$4C + .DA #$4D + .DA #$4E + .DA #$50 + .DA #$53 + .DA #$56 +BS.BIERRTBL .DA #$03 + .DA #$04 + .DA #$10 + .DA #$0C + .DA #$0C + .DA #$12 + .DA #$06 + .DA #$06 + .DA #$07 + .DA #$13 + .DA #$09 + .DA #$11 + .DA #$0D + .DA #$05 + .DA #$02 + .DA #$0A + .DA #$14 + .DA #$0B + .DA #$0C +BS.ERRCODES .DA #$08 + .DA #$54 + .DA #$5B + .DA #$66 + .DA #$6F + .DA #$75 + .DA #$75 + .DA #$7E + .DA #$84 + .DA #$8A + .DA #$91 + .DA #$9B + .DA #$A8 + .DA #$B4 + .DA #$BF + .DA #$C9 + .DA #$D1 + .DA #$D9 + .DA #$E1 + .DA #$EC +BS.TBL6 .DA #$F3 + .DA #$C1 + .DA #$C3 + .DA #$C4 + .DA #$C5 + .DA #$C6 + .DA #$C9 + .DA #$CC + .DA #$CD + .DA #$CE + .DA #$CF + .DA #$D2 + .DA #$D4 + .DA #$D5 + .DA #$A0 + .DA #$00 + .DA #$00 + .DA #$C2 + .DA #$C7 + .DA #$C8 + .DA #$CB + .DA #$D0 + .DA #$D3 + .DA #$D6 + .DA #$D7 + .DA #$D8 + .DA #$D9 + .DA #$AF + .DA #$A8 + .DA #$A9 + .DA #$AE + .DA #$BA +BS.TBL7 .DA #$2A + .DA #$05 + .DA #$0A + .DA #$B6 + .DA #$02 + .DA #$03 + .DA #$CE + .DA #$10 + .DA #$50 + .DA #$57 + .DA #$4E + .DA #$2A + .DA #$80 + .DA #$5D + .DA #$C4 + .DA #$BF + .DA #$E9 + .DA #$18 + .DA #$4E + .DA #$00 + .DA #$10 + .DA #$C0 + .DA #$A0 + .DA #$54 + .DA #$EE + .DA #$01 + .DA #$7A + .DA #$20 + .DA #$40 + .DA #$6E + .DA #$00 + .DA #$1E + .DA #$8A + .DA #$36 + .DA #$56 + .DA #$43 + .DA #$00 + .DA #$2F + .DA #$2B + .DA #$41 + .DA #$C4 + .DA #$3E + .DA #$00 + .DA #$40 + .DA #$49 + .DA #$35 + .DA #$67 + .DA #$4E + .DA #$06 + .DA #$D0 + .DA #$1C + .DA #$0A + .DA #$05 + .DA #$4F + .DA #$01 + .DA #$7A + .DA #$20 + .DA #$40 + .DA #$6E + .DA #$5B + .DA #$44 + .DA #$0F + .DA #$00 + .DA #$16 + .DA #$01 + .DA #$7A + .DA #$20 + .DA #$40 + .DA #$6E + .DA #$D0 + .DA #$64 + .DA #$30 + .DA #$FE + .DA #$00 + .DA #$2C + .DA #$CA + .DA #$C1 + .DA #$7E + .DA #$01 + .DA #$7A + .DA #$20 + .DA #$40 + .DA #$60 + .DA #$FF + .DA #$B1 + .DA #$90 + .DA #$24 + .DA #$E4 + .DA #$BB + .DA #$AB + .DA #$F0 + .DA #$9A + .DA #$E3 + .DA #$40 + .DA #$76 + .DA #$24 + .DA #$E2 + .DA #$A9 + .DA #$94 + .DA #$2C + .DA #$43 + .DA #$F0 + .DA #$08 + .DA #$B6 + .DA #$C4 + .DA #$E0 + .DA #$5B + .DA #$AC + .DA #$42 + .DA #$C4 + .DA #$3F + .DA #$49 + .DA #$3E + .DA #$A5 + .DA #$E3 + .DA #$1C + .DA #$1F + .DA #$05 + .DA #$1C + .DA #$03 + .DA #$E9 + .DA #$AC + .DA #$E5 + .DA #$AD + .DA #$93 + .DA #$F0 + .DA #$60 + .DA #$BA + .DA #$E4 + .DA #$BB + .DA #$AB + .DA #$F0 + .DA #$36 + .DA #$06 + .DA #$04 + .DA #$E5 + .DA #$D7 + .DA #$7F + .DA #$56 + .DA #$74 + .DA #$E7 + .DA #$A2 + .DA #$04 + .DA #$43 + .DA #$F0 + .DA #$69 + .DA #$07 + .DA #$17 + .DA #$63 + .DA #$E0 + .DA #$51 + .DA #$B1 + .DA #$84 + .DA #$C4 + .DA #$BF + .DA #$9A + .DA #$E0 + .DA #$1D + .DA #$55 + .DA #$4B + .DA #$06 + .DA #$E1 + .DA #$07 + .DA #$16 + .DA #$71 + .DA #$01 + .DA #$74 + .DA #$F0 + .DA #$56 + .DA #$74 + .DA #$EC + .DA #$0A + .DA #$05 + .DA #$4E + .DA #$86 + .DA #$06 + .DA #$81 + .DA #$C2 + .DA #$03 + .DA #$F0 + .DA #$05 + .DA #$BA + .DA #$02 + .DA #$B1 + .DA #$8E + .DA #$CA + .DA #$AE + .DA #$71 + .DA #$B0 + .DA #$24 + .DA #$F0 + .DA #$9A + .DA #$CE + .DA #$36 + .DA #$B4 + .DA #$2C + .DA #$E2 + .DA #$A8 + .DA #$81 + .DA #$93 + .DA #$F0 + .DA #$06 + .DA #$0A + .DA #$9C + .DA #$10 + .DA #$9E + .DA #$4B + .DA #$BA + .DA #$BF + .DA #$36 + .DA #$B4 + .DA #$2C + .DA #$AB + .DA #$0A + .DA #$E5 + .DA #$D7 + .DA #$7F + .DA #$56 + .DA #$74 + .DA #$E9 + .DA #$AC + .DA #$EA + .DA #$05 + .DA #$49 + .DA #$F0 + .DA #$3D + .DA #$05 + .DA #$76 + .DA #$21 + .DA #$C4 + .DA #$E5 + .DA #$67 + .DA #$4E + .DA #$91 + .DA #$84 + .DA #$F0 + .DA #$56 + .DA #$74 + .DA #$E0 + .DA #$1D + .DA #$06 + .DA #$0A + .DA #$F0 + .DA #$56 + .DA #$74 + .DA #$0C + .DA #$06 + .DA #$0D + .DA #$E0 + .DA #$6C + .DA #$67 + .DA #$7E + .DA #$A0 + .DA #$54 + .DA #$9F + +XBBB5 .BS 2 +XBBB7 .BS 1 +XBBB8 .BS 1 +BS.IsIntCmdMTR ldy #$02 +LBBBB lda BS.CMDBUF,y + cmp BS.MTR,y + bne LBBCF + dey + bpl LBBBB + jsr BS.SetState0 + jsr MON.CLREOL + jmp MON.ENTERMON +LBBCF jmp BS.IsIntCmd + +BS.MTR .AS "MTR" +BS.IVERSION .DA #5 + +BS.AS.HIMEMSave .BS 1 +XBBD7 .BS 1 +XBBD8 .BS 1 + +XBBD9 .DA #4 +XBBDA .BS 1 +XBBDB .BS 1 +XBBDC .BS 1 +XBBDD .BS 1 + +BS.TXTTAB .DA $0800 +BS.MEMSIZE .DA $9600 + +XBBE2 .BS 1 +XBBE3 .BS 1 + +BS.BAS.HDR .BS 5 +XBBE9 .BS 1 +XBBEA .BS 1 +XBBEB .BS 1 +XBBEC .BS 1 +XBBED .BS 1 +XBBEE .BS 1 +XBBEF .BS 7 +XBBF6 .BS 1 +XBBF7 .BS 7 +XBBFE .BS 1 +XBBFF .BS 1 +XBC00 .BS 3 +BS.CALLX .BS 1 +BS.GetCharSep .BS 1 +BS.GetCharMax .BS 1 +BS.KW.JMPADDR .BS 2 +XBC08 .BS 1 +XBC09 .BS 1 + +BS.TMPBUF4 .BS 4 + +XBC0E .BS 1 +XBC0F .BS 1 +XBC10 .BS 1 + +BS.CATWIDTH .BS 1 + +XBC12 .BS 1 +XBC13 .BS 1 +XBC14 .BS 1 +XBC15 .BS 1 +XBC16 .BS 1 + +BS.CMDBUF.LEN .BS 1 +BS.CMDBUF .BS 65 + +XBC59 .BS 1 +XBC5A .BS 1 +XBC5B .BS 165 +*-------------------------------------- +MAN +SAVE usr/src/basic.15/basic.s.d +LOAD usr/src/basic.15/basic.s +ASM diff --git a/BASIC.15/BASIC.S.GP..txt b/BASIC.15/BASIC.S.GP..txt new file mode 100644 index 00000000..c0e21041 --- /dev/null +++ b/BASIC.15/BASIC.S.GP..txt @@ -0,0 +1,155 @@ +NEW + AUTO 3,1 +*-------------------------------------- +GP.ENTRY jmp BS.ENTRY +GP.DOSCMD jmp BS.DOSCMD +GP.EXTRNCMD jmp GP.RTS +GP.ERROUT jmp BS.ERROUT +GP.PRINTERR jmp BS.PRINTERR +GP.ERRCODE .BS 1 +*-------------------------------------- +GP.OUTVECT0 .DA MON.COUT1 +GP.OUTVECT1 .DA BS.NODEVERR +GP.OUTVECT2 .DA BS.NODEVERR +GP.OUTVECT3 .DA BS.NODEVERR +GP.OUTVECT4 .DA BS.NODEVERR +GP.OUTVECT5 .DA BS.NODEVERR +GP.OUTVECT6 .DA BS.NODEVERR +GP.OUTVECT7 .DA BS.NODEVERR +GP.INVECT0 .DA MON.KEYIN +GP.INVECT1 .DA BS.NODEVERR +GP.INVECT2 .DA BS.NODEVERR +GP.INVECT3 .DA BS.NODEVERR +GP.INVECT4 .DA BS.NODEVERR +GP.INVECT5 .DA BS.NODEVERR +GP.INVECT6 .DA BS.NODEVERR +GP.INVECT7 .DA BS.NODEVERR +GP.VECTOUT .DA MON.COUT1 +GP.VECTIN .DA MON.KEYIN +GP.VDOSO .DA BS.JMP.GP.VSYSO +GP.VDOSI .DA BS.JMP.GP.VSYSI +GP.VSYSO .BS 2 +GP.VSYSI .BS 2 +GP.VDEFSLT .DA #6 +GP.VDEFDRV .DA #1 +GP.PREGA .BS 1 +GP.PREGX .BS 1 +GP.PREGY .BS 1 +GP.DTRACE .BS 1 +GP.STATE .BS 1 +GP.EXECACTV .BS 1 +GP.IFILACTV .BS 1 +GP.OFILACTV .BS 1 +GP.PFXACTV .BS 1 +GP.DIRFLG .BS 1 +GP.EDIRFLG .BS 1 +GP.STRINGS .BS 1 +GP.TBUFPTR .BS 1 +GP.INPTR .BS 1 +GP.CHRLAST .BS 1 +GP.OPENCNT .BS 1 +GP.EXECFILE .BS 1 +GP.CATFLAG .BS 1 +GP.XTRNADDR .BS 2 +GP.XLEN .BS 1 +GP.XCNUM .BS 1 +GP.AllowedBITS .BS 2 +GP.FoundBITS .BS 2 +GP.ParamA .BS 2 +GP.ParamB .BS 3 +GP.ParamE .BS 2 +GP.ParamL .BS 2 +GP.ParamS .BS 1 +GP.ParamD .BS 1 +GP.ParamF .BS 2 +GP.ParamR .BS 2 +GP.ParamV .BS 1 +GP.ParamAT .BS 2 +GP.ParamT .BS 1 +GP.ParamINPR .BS 1 +GP.VPATH1 .DA BS.CMDBUF.LEN +GP.VPATH2 .DA MLI.PATHBUF +*-------------------------------------- +GP.GOSYSTEM sta GP.GOSYSTEM.C + stx BS.CALLX + and #$1F + tax + lda BS.ParamLByte,x + sta GP.GOSYSTEM.P + ldx BS.CALLX + jsr MLI +GP.GOSYSTEM.C .BS 1 +GP.GOSYSTEM.P .DA GP.GOSYSTEM.P + bcs GP.BADCALL + rts +*-------------------------------------- +GP.BADCALL ldx #$12 + +LBE8D cmp BS.MLIERTBL,x + beq LBE97 + + dex + bpl LBE8D + + ldx #$13 + +LBE97 lda BS.BIERRTBL,x + ldx BS.CALLX + sec + +GP.RTS rts +*-------------------------------------- +GP.CISPARE1 .BS 1 +GP.SCREATE .DA #7 +GP.SCREATEPATH .DA BS.CMDBUF.LEN +GP.CRACCESS .DA #$C3 +GP.CRTYPE .BS 1 +GP.CRAUXTYPE .BS 2 +GP.CRSTTYPE .BS 1 +GP.DATETIME .BS 4 +GP.SDSTROY .DA #1 +GP.SDSTROYPATH .DA BS.CMDBUF.LEN +GP.SRECNAME .DA #2 +GP.SRECNAMEOLD .DA BS.CMDBUF.LEN +GP.SRECNAMENEW .DA MLI.PATHBUF +GP.SSGINFO .BS 1 +GP.SSGINFOPATH .DA BS.CMDBUF.LEN +GP.FIACCESS .BS 1 +GP.FITYPE .BS 1 +GP.FIAUXTYPE .BS 2 +GP.STTYPE .BS 1 +GP.FIBLOKS .BS 2 +GP.FIMDATE .BS 2 +GP.FICDATE .BS 2 + + .BS 4 + +GP.MLIMRKEOFBUF .DA #2 +GP.MLIMRKEOFBUF.REFNUM + .BS 1 +GP.SBUFADR .BS 3 +GP.SOPEN .DA #3 +GP.TXTBUF .DA BS.CMDBUF.LEN +GP.OSYSBUF .BS 2 +GP.OREFNUM .BS 1 +GP.SNEWLIN .DA #3 +GP.NEWLREF .BS 1 +GP.NLINEMASK .DA #$7F +GP.NLINECHAR .DA #13 +GP.MLIRW .DA #4 +GP.MLIRW.REFNUM .BS 1 +GP.MLIRW.DATAPTR .BS 2 +GP.MLIRW.COUNT .BS 2 +GP.MLIRW.TRANS .BS 2 +GP.MLICF .DA #1 +GP.MLICF.REFNUM .BS 1 +GP.CCCSPARE .BS 1 +GP.COPYRIGHT .AS -"COPYRIGHT APPLE, 1983" +GP.GETBUFR jmp BS.GETBUFR +GP.FREEBUFR jmp BS.FREEBUFR +GP.RSHIMEM .BS 5 +*-------------------------------------- +MAN +SAVE usr/src/basic.15/basic.s.gp +LOAD usr/src/basic.15/basic.s +ASM diff --git a/BASIC.15/BASIC.S.LDR.txt b/BASIC.15/BASIC.S.LDR.txt new file mode 100644 index 00000000..8d2d0bd3 --- /dev/null +++ b/BASIC.15/BASIC.S.LDR.txt @@ -0,0 +1,310 @@ +NEW + AUTO 3,1 +*-------------------------------------- +LDR.START jmp LDR.START1 +LDR.SIG .DA $EEEE + .DA #MLI.MAXPATH+1 +LDR.STARTUP.LEN .DA #7 +LDR.STARTUP .AS "STARTUP" + .BS MLI.MAXPATH-7 +LDR.START1 lda #$9A + sta Ptr2+1 + lda #$24 + sta Ptr1+1 + lda #$00 + sta Ptr1 + sta Ptr2 + ldx #$23 + tay + jsr LDR.MoveXpages + ldx #$01 + lda #$BE + sta Ptr2+1 + jsr LDR.MoveXpages + lda #$15 + jsr MON.COUT + jsr MON.SETNORM + jsr MON.INIT + jsr MON.MON + ldx #$17 + lda #$00 + +L2076 sta MLI.MEMTABL,x + dex + bne L2076 + + lda #$CF + sta MLI.MEMTABL + lda #$3F + sta MLI.MEMTABL+19 + lda #$FF + sta MLI.MEMTABL+20 + sta MLI.MEMTABL+21 + sta MLI.MEMTABL+22 + lda #$C3 + sta MLI.MEMTABL+23 + lda AS.COLDBOOT + cmp #$4C + bne L20B1 + + lda MLI.MACHID + and #$20 + beq L20B1 + + ldx #$03 + +L20A6 lda LDR.CSWVECT,x + sta ZP.CSW,x + dex + bpl L20A6 + + jmp AS.COLDBOOT + +L20B1 ldx #$27 + +L20B3 lda LDR.UNABLE,x + sta $628,x + dex + bpl L20B3 + + sta MON.POWERUPBYTE + sta MON.POWERUP+1 + +L20C2 bmi L20C2 + +LDR.MoveXpages dey + lda (Ptr1),y + sta (Ptr2),y + tya + bne LDR.MoveXpages + + inc Ptr1+1 + inc Ptr2+1 + dex + bne LDR.MoveXpages + +L20D3 rts + +LDR.CSW cmp #$DD + bne L20D3 + + lda GP.OUTVECT0 + sta ZP.CSW + lda GP.OUTVECT0+1 + sta ZP.CSW+1 + lda MLI.DEVNUM + sta LDR.ONLINE.P.DEVNUM + ldx #$01 + asl + bcc L20EE + + inx + +L20EE stx GP.VDEFDRV + asl + rol + rol + rol + and #$07 + sta GP.VDEFSLT + ldx #$C1 + ldy #$02 + lda MLI.SLTBYT + lsr + +L2102 lsr + pha + bcc L2115 + + lda #$00 + sta GP.OUTVECT0,y + sta GP.INVECT0,y + txa + sta GP.OUTVECT0+1,y + sta GP.INVECT0+1,y + +L2115 iny + iny + inx + pla + bne L2102 + + lda #$96 + sta AS.HIMEM+1 + sta AS.STRINGSTART+1 + sta GP.RSHIMEM + lda MLI.PFIXPTR + beq L214E + + jsr MLI + .DA #MLI.C.GETPREFIX + .DA LDR.GETSETPFX2.P + bne L218B + + ldx MLI.PATHBUF + lda #$2F + +L2136 cmp MLI.PATHBUF,x + bne L213E + + inc LDR.PFXLEN + +L213E dex + bne L2136 + + lda LDR.PFXLEN + cmp #$03 + bcs L216F + + jsr MLI + .DA #MLI.C.SETPREFIX + .DA LDR.GETSETPFX1.P + +L214E jsr MLI + .DA #MLI.C.ONLINE + .DA LDR.ONLINE.P + bne L218B + + lda MLI.PATHBUF+1 + and #$0F + beq L218B + + tax + inx + stx MLI.PATHBUF + lda #$2F + sta MLI.PATHBUF+1 + jsr MLI + .DA #MLI.C.SETPREFIX + .DA LDR.GETSETPFX2.P + bne L218B + +L216F jsr MLI + .DA #MLI.C.GETFILEINFO + .DA LDR.GFINFO.P + bne L218B + + ldx LDR.STARTUP.LEN + stx LDR.STARTUP.LEN1 + +L217D lda LDR.STARTUP.LEN,x + sta IO.LINEBUF,x + dex + bne L217D + + lda #$AD + sta IO.LINEBUF + +L218B lda LDR.PFXLEN + cmp #$03 + bcs L2198 + + jsr MLI + .DA #MLI.C.SETPREFIX + .DA LDR.GETSETPFX1.P + +L2198 lda LDR.STARTUP.LEN1 + bne L21C1 + + jsr LDR.KSW + ldx #$1C + +L21A2 lda LDR.PRODOSBASIC,x + sta $400,x + dex + bpl L21A2 + + ldx #$1F + +L21AD lda LDR.COPYRIGHT,x + sta $480,x + dex + bpl L21AD + + lda #$8D + jsr MON.COUT1 + jsr MON.COUT1 + jsr MON.COUT1 + +L21C1 ldx #$02 +L21C3 lda LDR.JMP.GP.ENTRY,x + sta DOS.WARMSTART,x + sta DOS.COLDSTART,x + sta MON.USRJMP,x + lda LDR.AMPERSANDJMP,x + sta MON.AMPERSANDJMP,x + dex + bpl L21C3 + + lda LDR.BRKVECT + sta MON.BRKVECT + lda LDR.BRKVECT+1 + sta MON.BRKVECT+1 + lda LDR.POWERUP + sta MON.POWERUP + lda LDR.POWERUP+1 + sta MON.POWERUP+1 + eor #$A5 + sta MON.POWERUPBYTE + lda #$A5 + sta AS.TRCFLG + lda BS.IVERSION + sta MLI.IVERSION + +LDR.JMP.GP.ENTRY + jmp GP.ENTRY + +LDR.BRKVECT .DA MON.BREAKV +LDR.POWERUP .DA GP.ENTRY + +LDR.AMPERSANDJMP + jmp GP.DOSCMD + +LDR.KSW lda GP.INVECT0 + sta ZP.KSW + lda GP.INVECT0+1 + sta ZP.KSW+1 + ldx LDR.STARTUP.LEN + inx + lda #$8D + rts + +LDR.CSWVECT .DA LDR.CSW +LDR.KSWVECT .DA LDR.KSW +LDR.GFINFO.P .DA #10 +LDR.GFINFO.P.PATHBUF + .DA LDR.STARTUP.LEN + + .BS 16 + +LDR.GETSETPFX1.P + .DA #1 +LDR.GETSETPFX1.P.BUF + .DA LDR.GETSETPFX1.SLASHLEN +LDR.GETSETPFX1.SLASHLEN + .DA #1 +LDR.GETSETPFX1.SLASH + .AS "/" +LDR.STARTUP.LEN1 + .DA #0 +LDR.ONLINE.P + .DA #2 +LDR.ONLINE.P.DEVNUM + .DA #$70 +LDR.ONLINE.P.BUF + .DA MLI.PATHBUF+1 +LDR.GETSETPFX2.P + .DA #1 +LDR.GETSETPFX2.P.BUF + .DA MLI.PATHBUF +LDR.PFXLEN .DA #0 + +LDR.UNABLE .AS -"*** UNABLE TO EXECUTE BASIC SYSTEM ***" +LDR.PRODOSBASIC .AS -" PRODOS BASIC 1.5 " +LDR.COPYRIGHT .AS -" COPYRIGHT APPLE 1983-92" + .BS $2400-* +*-------------------------------------- +MAN +SAVE usr/src/basic.15/basic.s.ldr +LOAD usr/src/basic.15/basic.s +ASM diff --git a/BASIC.15/BASIC.S.txt b/BASIC.15/BASIC.S.txt new file mode 100644 index 00000000..1062eb07 --- /dev/null +++ b/BASIC.15/BASIC.S.txt @@ -0,0 +1,163 @@ +NEW + AUTO 3,1 + .LIST OFF + .OP 6502 + .OR $2000 + .TF BASIC.15,TSYS +*-------------------------------------- +Ptr1 .EQ 0 +Ptr2 .EQ 2 + +ZP.WNDLFT .EQ $20 +ZP.WNDWDT .EQ $21 +ZP.WNDTOP .EQ $22 +ZP.WNDBOT .EQ $23 +ZP.CH .EQ $24 +ZP.CV .EQ $25 +ZP.BASL .EQ $28 +ZP.BASH .EQ $29 + +ZP.PROMPT .EQ $33 + +ZP.CSW .EQ $36 +ZP.KSW .EQ $38 + +ZP.PCL .EQ $3A +ZP.PCH .EQ $3B +ZP.A1L .EQ $3C +ZP.A1H .EQ $3D +ZP.A2L .EQ $3E +ZP.A2H .EQ $3F + +AS.LINNUM .EQ $50 +AS.PGRMSTART .EQ $67 +AS.VARSTART .EQ $69 +AS.ARRAYSTART .EQ $6B +AS.ARRAYEND .EQ $6D +AS.STRINGSTART .EQ $6F +AS.STRINGPTR .EQ $71 +AS.HIMEM .EQ $73 +AS.CURLINE .EQ $75 +AS.LOWTR .EQ $9B +AS.PGRMEND .EQ $AF +AS.TXTPTR .EQ $B8 +AS.ERRFLG .EQ $D8 +AS.ERRNUM .EQ $DE +AS.TRCFLG .EQ $F2 +AS.REMSTK .EQ $F8 +*-------------------------------------- +IO.LINEBUF .EQ $200 +*-------------------------------------- +DIRENTBUF .EQ $259 +DIRENTBUF.STNL .EQ $25D +DIRENTBUF.TYPE .EQ $269 + +DIRENTBUF.UBLK .EQ $26C +DIRENTBUF.EOF .EQ $26E + +DIRENTBUF.ACCESS .EQ $277 +DIRENTBUF.AUXT .EQ $278 + +MLI.PATHBUF .EQ $280 +*-------------------------------------- +DOS.WARMSTART .EQ $03D0 +DOS.COLDSTART .EQ $03D3 +DOS.FILEMGR .EQ $03D6 +DOS.RWTS .EQ $03D9 +DOS.FILEMGRPARM .EQ $03DC +DOS.RWTSPARM .EQ $03E3 +DOS.RECONNECT .EQ $03DA +DOS.JMPBRKVECT .EQ $03EF + +MON.AMPERSANDJMP .EQ $03F5 +MON.USRJMP .EQ $03F8 +MON.NMIJMP .EQ $03FB +MON.IRQVECT .EQ $03FE +MON.BRKVECT .EQ $03F0 +MON.POWERUP .EQ $03F2 +MON.POWERUPBYTE .EQ $03F4 +*-------------------------------------- +MLI.MAXPATH .EQ 64 +MLI.C.ALLOCIRQ .EQ $40 +MLI.C.DEALLOCIRQ .EQ $41 +MLI.C.ATALK .EQ $42 +MLI.C.QUIT .EQ $65 +MLI.C.READBLOCK .EQ $80 +MLI.C.WRITEBLOCK .EQ $81 +MLI.C.GETTIME .EQ $82 +MLI.C.CREATE .EQ $C0 +MLI.C.DESTROY .EQ $C1 +MLI.C.RENAME .EQ $C2 +MLI.C.SETFILEINFO .EQ $C3 +MLI.C.GETFILEINFO .EQ $C4 +MLI.C.ONLINE .EQ $C5 +MLI.C.SETPREFIX .EQ $C6 +MLI.C.GETPREFIX .EQ $C7 +MLI.C.OPEN .EQ $C8 +MLI.C.NEWLINE .EQ $C9 +MLI.C.READ .EQ $CA +MLI.C.WRITE .EQ $CB +MLI.C.CLOSE .EQ $CC +MLI.C.FLUSH .EQ $CD +MLI.C.SETMARK .EQ $CE +MLI.C.GETMARK .EQ $CF +MLI.C.SETEOF .EQ $D0 +MLI.C.GETEOF .EQ $D1 +MLI.C.SETBUF .EQ $D2 +MLI.C.GETBUF .EQ $D3 +*-------------------------------------- +MLI .EQ $BF00 +MLI.DEVNUM .EQ $BF30 +MLI.DEVCNT .EQ $BF31 +MLI.DEVLST .EQ $BF32 +MLI.MEMTABL .EQ $BF58 +MLI.LEVEL .EQ $BF94 +MLI.MACHID .EQ $BF98 +MLI.SLTBYT .EQ $BF99 +MLI.PFIXPTR .EQ $BF9A +MLI.MLIACTV .EQ $BF9B +MLI.IVERSION .EQ $BFFD +*-------------------------------------- +IO.KBD .EQ $C000 +IO.KSTROBE .EQ $C010 +*-------------------------------------- +AS.RESTART .EQ $D43C +AS.RESTART1 .EQ $D43F +AS.FINDLINE .EQ $D61A +AS.CLEAR1 .EQ $D665 +AS.NEXTSTMT .EQ $D7D2 +AS.EXECSTMT .EQ $D820 +AS.BITERRFLG .EQ $D865 +AS.NORMAL .EQ $F273 +AS.COLDBOOT .EQ $E000 +AS.INTPRINTAX .EQ $ED24 +*-------------------------------------- +MON.BREAKV .EQ $FA59 +MON.INIT .EQ $FB2F +MON.MON .EQ $FC58 +MON.CLREOL .EQ $FC9C +MON.RDKEY .EQ $FD0C +MON.KEYIN0 .EQ $FD10 +MON.KEYIN .EQ $FD1B +MON.GETLN .EQ $FD6A +MON.COUT .EQ $FDED +MON.COUT1 .EQ $FDF0 +MON.IIGSID .EQ $FE1F +MON.SETINV .EQ $FE80 +MON.SETNORM .EQ $FE84 +MON.ENTERMON .EQ $FF69 +*-------------------------------------- + .INB usr/src/basic.15/basic.s.ldr +LDR.9A00.CODE .PH $9A00 + .INB usr/src/basic.15/basic.s.a + .INB usr/src/basic.15/basic.s.b + .INB usr/src/basic.15/basic.s.c + .INB usr/src/basic.15/basic.s.d + .EP +LDR.BE00.CODE .PH $BE00 + .INB usr/src/basic.15/basic.s.gp + .EP +*-------------------------------------- +MAN +SAVE usr/src/basic.15/basic.s +ASM diff --git a/BASIC.FX/BASIC.S.A.txt b/BASIC.FX/BASIC.S.A.txt new file mode 100644 index 00000000..993d598f --- /dev/null +++ b/BASIC.FX/BASIC.S.A.txt @@ -0,0 +1,1300 @@ +NEW + AUTO 3,1 +*-------------------------------------- +BS.ResetCSWKSW pha + lda GP.VECTOUT + sta ZP.CSW + lda GP.VECTOUT+1 + sta ZP.CSW+1 + lda GP.VECTIN + sta ZP.KSW + lda GP.VECTIN+1 + sta ZP.KSW+1 + pla + rts + +BS.SetState0 ldx #$00 + jsr BS.SetState + lda ZP.KSW+1 + cmp GP.VDOSI+1 + bne L9A26 + + jmp BS.SetCSWKSW2VDOS + +L9A26 lda ZP.CSW+1 + cmp GP.VDOSO+1 + beq BS.SetCSWKSW2VDOS + + bne BS.SaveCSWKSW + +BS.IO.OUT cmp X9F65 + bne L9A54 + + stx GP.PREGX + tsx + lda $103,x + cmp #$12 + bne L9A6E + + lda $104,x + cmp #$D8 + bne L9A6E + + ldx #$04 + jsr BS.SetState + lda X9F65 + ldx GP.PREGX + jmp BS.JMP.GP.VSYSO + +L9A54 cmp GP.CHRLAST + sta GP.CHRLAST + bne L9A74 + + cmp #$8D + bne L9A74 + + lda ZP.CH + bne L9A69 + + lda BS.CMDBUF + cmp #$3F + +L9A69 lda #$8D + bcs L9A74 + + rts + +L9A6E ldx GP.PREGX + lda X9F65 + +L9A74 jsr BS.ResetCSWKSW + jsr MON.COUT + cmp #$8D + bne BS.SaveCSWKSW + + lda AS.TRCFLG + cmp #$A5 + beq L9A8B + + sta GP.DTRACE + lda #$A5 + sta AS.TRCFLG + +L9A8B lda #$8D +BS.SaveCSWKSW pha + lda ZP.KSW+1 + sta GP.VECTIN+1 + lda ZP.KSW + sta GP.VECTIN + lda ZP.CSW+1 + sta GP.VECTOUT+1 + lda ZP.CSW + sta GP.VECTOUT + pla + +BS.SetCSWKSW2VDOS + pha + lda GP.VDOSO + sta ZP.CSW + lda GP.VDOSO+1 + sta ZP.CSW+1 + lda GP.VDOSI + sta ZP.KSW + lda GP.VDOSI+1 + sta ZP.KSW+1 + pla + rts + +BS.IO.IN bit GP.EXECACTV + bpl L9AC5 + + jsr BS.SaveAXY + jmp BS.IO.IN.EXEC + +L9AC5 jsr BS.ResetCSWKSW + jsr MON.KEYIN0 + cmp #$8D + bne L9AEB + + jsr BS.SaveAXY + sta IO.LINEBUF,x + +BS.CheckDOSCMD jsr BS.DOSCMD + bit GP.XCNUM + bmi L9AE8 + + bcs BS.ERROUT + + ldy GP.PREGY + lda #$88 + ldx #$00 + beq L9AEB + +L9AE8 jsr BS.RestoreAXY +L9AEB jmp BS.SaveCSWKSW + +BS.NODEVERR lda #$03 + +BS.ERROUT sta GP.ERRCODE + sta AS.ERRNUM + lda GP.STATE + cmp #$01 + php + lda #$0F + sta MLI.LEVEL + lda #$00 + sta GP.IFILACTV + sta GP.OFILACTV + sta GP.PFXACTV + sta GP.MLICF.REFNUM + lda #MLI.C.CLOSE + jsr GP.GOSYSTEM + bcs L9B27 + + jsr LA004 + bcs L9B27 + + lda #$00 + sta MLI.LEVEL + sta GP.MLICF.REFNUM + lda #MLI.C.FLUSH + jsr GP.GOSYSTEM + +L9B27 plp + ldx #$04 + bit AS.ERRFLG + bcs L9B30 + + ldx #$00 + +L9B30 php + jsr BS.SetState + jsr BS.SetCSWKSW2VDOS + lda GP.ERRCODE + plp + bmi L9B4D + + php + jsr GP.PRINTERR + jsr LB36B + plp + bcs L9B53 + + jsr BS.CROUT + jmp AS.RESTART1 + +L9B4D ldx AS.REMSTK + dex + dex + txs + tax + +L9B53 lda #$03 + jmp AS.BITERRFLG + +L9B58 lda #$00 + sta AS.ERRNUM + lda #$A3 + sta X9F65 + jsr AS.NORMAL + jsr BS.ResetCSWKSW + jsr BS.WriteTBUF + jsr BS.SetState0 + jsr BS.RestoreAXY + jmp BS.IO.IN + +BS.IO.IN0 jsr BS.SaveAXY + bit GP.PFXACTV + bpl L9B7E + jmp BS.IO.IN.CAT + +L9B7E bit GP.IFILACTV + bpl L9B86 + jmp BS.IO.IN.FILE + +L9B86 bit GP.EXECACTV + bmi BS.IO.IN.EXEC + + lda ZP.PROMPT + cmp #$DD + beq L9B58 + + jsr BS.ResetCSWKSW + +L9B94 lda GP.PREGA + ldy GP.PREGY + jsr MON.KEYIN0 + cmp #$88 + bne L9BAC + + lda ZP.PROMPT + cmp #$BE + beq L9BAA + + txa + beq L9B94 + +L9BAA lda #$88 +L9BAC jmp BS.SaveCSWKSW + +BS.IO.IN.EXEC sta (ZP.BASL),y + lda ZP.PROMPT + cmp #$BE + beq L9BF2 + + lda IO.KBD + bpl L9BCD + + cmp #$83 + bne L9BCD + + jsr LB36B + lda GP.STATE + bne L9C01 + + sta IO.KSTROBE + beq L9C01 + +L9BCD jsr BS.Setup4readEFBytesAt200 + jsr L9C6C + bcs L9BFA + + jsr BS.SaveAXY + bcc L9BDE + +L9BDA dex + lda IO.LINEBUF,x + +L9BDE ora #$80 + sta IO.LINEBUF,x + txa + bne L9BDA + + jsr BS.ResetCSWKSW + jsr BS.CheckDOSCMD + bit GP.XCNUM + bpl L9BCD + +L9BF1 rts + +L9BF2 jsr BS.Setup4readEFBytesAt200 + jsr BS.ReadOneByte + bcc L9BF1 + +L9BFA jsr LB2B5 + cmp #$05 + bne L9C13 + +L9C01 ldx #$00 + ldy ZP.CH + bne L9C0E + + lda #$DD + sta ZP.PROMPT + lda #$88 + rts + +L9C0E lda (ZP.BASL),y + jmp (ZP.KSW) +L9C13 jmp BS.ERROUT + +BS.IO.IN.FILE lda ZP.PROMPT + cmp #$DD + bne L9C1F + jmp L9B58 + +L9C1F lda GP.PREGA + sta (ZP.BASL),y + lda IO.KBD + bpl L9C31 + + cmp #$83 + bne L9C31 + + bit IO.KSTROBE + rts + +L9C31 lda ZP.PROMPT + bit GP.DIRFLG + bmi L9C95 + + cmp #$BE + beq L9C42 + + jsr L9C67 + bcs L9C13 + + rts + +L9C42 jsr BS.ReadOneByte + bcs L9C13 + + rts + +BS.ReadOneByte lda GP.MLIRW.COUNT + sta GP.ParamL + lda #$01 + sta GP.MLIRW.COUNT + lda #MLI.C.READ + jsr GP.GOSYSTEM + bcs L9C66 + + lda GP.ParamL + sta GP.MLIRW.COUNT + ldx GP.MLIRW.DATAPTR + lda IO.LINEBUF,x + +L9C66 rts + +L9C67 lda GP.PREGA + sta (ZP.BASL),y + +L9C6C lda #MLI.C.READ + jsr GP.GOSYSTEM + bcs L9C66 + + lda GP.MLIRW.TRANS + beq L9C8E + + clc + adc GP.MLIRW.DATAPTR + tax + lda IO.LINEBUF-1,x + and #$7F + cmp #$0D + bne L9C8E + + lda GP.FoundBITS+1 + and #$10 + bne L9C8E + + dex + +L9C8E lda #$8D + ldy GP.PREGY + clc + rts + +L9C95 cmp #$BE + beq L9C8E + + lda GP.PREGA + sta (ZP.BASL),y + lda #$4F + sta BS.CATWIDTH + lda #MLI.C.GETMARK + jsr GP.GOSYSTEM + bcs L9D1F + + lda GP.SBUFADR + ora GP.SBUFADR+1 + bne L9CDF + + lda #$02 + sta GP.CATFLAG + jsr BS.ReadDirEnt + bcs L9D1F + + lda GP.MLIRW.REFNUM + lsr + ror + ror + ror + tax + lda XBC12 + sta XBC5A,x + lda XBC13 + sta XBC5B,x + jsr LB128 + +L9CD3 lda #$A2 + sta IO.LINEBUF + lda #$8D + sta IO.LINEBUF,x + clc + rts + +L9CDF lda GP.CATFLAG + beq L9D22 + bmi L9CF9 + ldx #$00 + dec GP.CATFLAG + beq L9CD3 + jsr BS.LINEBUFCLR80 + ldx #$10 + jsr BS.PRINTERRMSGX + +L9CF5 ldx #$50 + bne L9CD3 + +L9CF9 cmp #$FF + bne L9D1C + + dec GP.CATFLAG + lda #$00 + sta GP.MLIRW.COUNT + sta GP.MLIRW.COUNT+1 + lda #MLI.C.READ + jsr GP.GOSYSTEM + jsr LB157 + pha + lda GP.MLIRW.REFNUM + sta GP.MLIMRKEOFBUF.REFNUM + pla + bcc L9CF5 + + bcs L9D1F + +L9D1C lda #$05 + sec + +L9D1F jmp BS.ERROUT + +L9D22 lda #$FF + sta XBC16 + lda GP.MLIRW.REFNUM + lsr + ror + ror + ror + tax + lda XBC5A,x + sta XBC12 + lda XBC5B,x + sta XBC13 + lda GP.SBUFADR+1 + and #$01 + tax + lda GP.SBUFADR + sec + +L9D45 inc XBC16 + sbc XBC12 + bcs L9D45 + + dex + beq L9D45 + + jsr LB241 + bcc L9D65 + + cmp #$02 + beq L9D5D + + cmp #$05 + bne L9D1F + +L9D5D dec GP.CATFLAG + ldx #$00 + jmp L9CD3 + +L9D65 jsr LA4D2 + jmp L9CF5 + +BS.IO.IN.CAT cmp #$DD + bne L9D72 + + jmp L9B58 + +L9D72 lda GP.PREGA + sta (ZP.BASL),y + lda #$00 + sta GP.PFXACTV + ldx BS.CMDBUF.LEN + +L9D7F lda BS.CMDBUF.LEN,x + sta IO.LINEBUF-1,x + dex + bne L9D7F + + ldx BS.CMDBUF.LEN + lda #$8D + rts + +BS.Setup4readEFBytesAt200 + lda XBBFE + sta GP.MLIRW.REFNUM + lda #$02 + sta GP.MLIRW.DATAPTR+1 + lda #$EF + sta GP.MLIRW.COUNT + lda #$00 + sta GP.MLIRW.COUNT+1 + sta GP.MLIRW.DATAPTR + rts + +BS.VSYSO jsr BS.SaveAXY + cmp #$84 + bne L9DC5 + + jsr BS.WriteTBUF + sta GP.INPTR + sta GP.IFILACTV + sta GP.OFILACTV + sta GP.PFXACTV + ldx #$08 + jsr BS.SetState + jmp BS.RestoreAXY + +L9DC5 ldx #$04 + jsr BS.SetState + jsr BS.RestoreAXY + jmp BS.JMP.GP.VSYSO + +BS.IO.OUT.CAT jsr BS.SaveAXY + ldx GP.INPTR + sta IO.LINEBUF,x + cmp #$8D + beq L9DEB + + inc GP.INPTR + bne L9DE7 + + lda #$10 + +L9DE4 jmp BS.ERROUT + +L9DE7 ldx GP.PREGX + rts + +L9DEB inx + dex + beq L9DFA + + jsr BS.ResetCSWKSW + jsr BS.DOSCMD + bcs L9DE4 + + jsr BS.SaveCSWKSW + +L9DFA ldx #$04 + jsr BS.SetState + jmp BS.RestoreAXY + +L9E02 sty GP.PREGY + ldy ZP.PROMPT + beq L9E15 + + dey + beq L9E15 + + dey + beq L9E15 + + ldy GP.PREGY + jmp L9A74 + +L9E15 ldy GP.TBUFPTR + and #$7F + sta (AS.HIMEM),y + ldy GP.PREGY + inc GP.TBUFPTR + bne L9E2F + + jsr BS.SaveAXY + jsr BS.WriteTBUF256 + bcs L9DE4 + + jsr BS.RestoreAXY + +L9E2F rts + +BS.IO.OUT.TRACE pha + stx GP.PREGX + tsx + lda $104,x + cmp #$12 + bne L9E46 + + lda $105,x + cmp #$D8 + bne L9E46 + + pla + bcs L9EBA + +L9E46 pla + nop + nop + nop + ldx GP.PREGX + bit GP.OFILACTV + bpl L9E70 + + cmp #$DD + bne L9E5A + + cmp ZP.PROMPT + beq L9E8A + +L9E5A cmp #$8D + bne L9E02 + + lda ZP.PROMPT + cmp #$FF + lda #$8D + bcc L9E02 + + jsr BS.WriteTBUF + sta GP.OFILACTV + lda #$8D + bne L9EA3 + +L9E70 pha + lda GP.IFILACTV + ora GP.PFXACTV + bpl L9E81 + + lda ZP.PROMPT + ora #$04 + cmp #$84 + beq L9EA6 + +L9E81 pla + cmp #$DD + bne L9EA3 + + cmp ZP.PROMPT + bne L9EA3 + +L9E8A jsr BS.SaveAXY + lda GP.OPENCNT + beq L9EA0 + + jsr BS.WriteTBUF + sta GP.OFILACTV + jsr BS.ResetCSWKSW + lda #$15 + jsr GP.PRINTERR + +L9EA0 jsr BS.RestoreAXY +L9EA3 jmp L9A74 + +L9EA6 pla + cmp #$8D + bne L9EAE + + cmp GP.CHRLAST + +L9EAE sta GP.CHRLAST + bne L9EB5 + + sta ZP.PROMPT + +L9EB5 rts + +L9EB6 inc AS.TXTPTR+1 + bne L9EBE + +L9EBA inc AS.TXTPTR + beq L9EB6 + +L9EBE ldx #$FF + stx ZP.PROMPT + ldx AS.REMSTK + txs + bit GP.DTRACE + bmi L9F3D + +L9ECA ldy #$00 + lda (AS.TXTPTR),y + bmi L9EF5 + + beq L9EF2 + +L9ED2 dec GP.STRINGS + bne L9EF0 + + lda AS.STRINGSTART+1 + sbc AS.ARRAYEND+1 + cmp #$03 + bcs L9EE9 + + jsr BS.WriteTBUF + jsr BS.KW.01 + lda AS.STRINGSTART+1 + sbc AS.ARRAYEND+1 + +L9EE9 sta GP.STRINGS + ldy #$00 + lda (AS.TXTPTR),y + +L9EF0 cmp #$3A +L9EF2 jmp AS.EXECSTMT + +L9EF5 sta ZP.PROMPT + tay + lda BS.BYTES-$80,y + bmi L9EF2 + + sta X9F00+1 + +X9F00 bne L9F02 SELF MODIFIED + +L9F02 sta ZP.PROMPT + sta GP.CHRLAST + lda BS.VSYSO.LO + sta GP.VSYSO + lda BS.VSYSO.HI + sta GP.VSYSO+1 + bne L9F32 + + lda #$01 + sta ZP.PROMPT + bne L9F32 + + lda #$02 + sta ZP.PROMPT + bne L9F32 + + tya + jmp L9ED2 + + sty GP.DTRACE + bne L9F2E + + sta GP.DTRACE + dey + +L9F2E lda #$4A + sta AS.TRCFLG + +L9F32 tya + jmp AS.EXECSTMT + + lda #$00 + sta AS.ERRNUM + tya + bne L9EF0 + +L9F3D jsr BS.ResetCSWKSW + lda #$A3 + jsr MON.COUT + ldx AS.CURLINE + lda AS.CURLINE+1 + jsr AS.INTPRINTAX + lda #$A0 + jsr MON.COUT + jsr BS.SaveCSWKSW + sec + jmp L9ECA + + lda #$E3 + bne L9F5E + + lda #$A3 + +L9F5E sta X9F65 + tya + bne L9EF0 + + brk + +X9F65 .DA #$A3 + +BS.SaveAXY sta GP.PREGA + stx GP.PREGX + sty GP.PREGY + rts + +BS.RestoreAXY lda GP.PREGA + ldx GP.PREGX + ldy GP.PREGY + rts + +BS.SetState stx GP.STATE + ldy #$00 + +L9F7F lda BS.SYSIOVECTS,x + sta GP.VSYSO,y + inx + iny + cpy #$04 + bne L9F7F + + rts + +BS.PRINTERR tay + ldx BS.ERRCODES-1,y + +BS.PRINTERRX jsr BS.PRINTERRMSGX + ldx GP.INPTR + stx BS.CATWIDTH + jsr BS.CROUT + lda #$87 + jsr BS.COUT + +BS.LINEBUFOUT ldx #$00 + +L9FA3 lda IO.LINEBUF+1,x + jsr BS.COUT + inx + cpx BS.CATWIDTH + bcc L9FA3 + +BS.CROUT lda #$8D +BS.COUT jmp MON.COUT + +BS.PRINTERRMSGX ldy #$00 + clc + sty GP.INPTR + +L9FBA jsr L9FD6 + bne L9FC4 + + jsr L9FD6 + ora #$10 + +L9FC4 tay + lda BS.TBL6,y + beq L9FD5 + + ldy GP.INPTR + sta IO.LINEBUF+1,y + inc GP.INPTR + bne L9FBA + +L9FD5 rts + +L9FD6 lda BS.TBL7,x + bcs L9FED + + beq L9FE3 + + lsr + lsr + lsr + lsr + sec + rts + +L9FE3 inx + lda BS.TBL7,x + sta GP.INPTR + inx + bne L9FD6 + +L9FED inx + and #$0F + clc + rts + +BS.WriteTBUF256 lda #$00 + ldy #$01 + bne LA00B + +BS.WriteTBUF jsr LA004 + bcc LA020 + + tay + pla + pla + tya + jmp BS.ERROUT + +LA004 ldy #$00 + lda GP.TBUFPTR + beq LA01F + +LA00B sta GP.MLIRW.COUNT + sty GP.MLIRW.COUNT+1 + lda #MLI.C.WRITE + jsr GP.GOSYSTEM + pha + lda #$00 + sta GP.TBUFPTR + pla + bcs LA020 + +LA01F clc +LA020 rts + +LA021 jsr BS.KW.01 + bcs LA047 + + lda AS.PGRMSTART+1 + sta BS.TXTTAB+1 + lda AS.PGRMSTART + sta BS.TXTTAB + lda AS.HIMEM+1 + sta XBBD8 + lda #$03 + sta XBBD9 + lda AS.STRINGSTART+1 + sta BS.MEMSIZE+1 + lda #$00 + sta BS.MEMSIZE + jsr LA089 + +LA047 rts + +BS.KW.01 lda #$00 + sta BS.TXTTAB + lda #$03 + sta XBBD9 + lda AS.HIMEM+1 + sta XBBD8 + lda AS.STRINGSTART+1 + sta BS.TXTTAB+1 + sec + sbc AS.ARRAYEND+1 + cmp #$07 + bcc LA07D + + sbc #$03 + sta XBBD9 + lda AS.ARRAYEND+1 + adc #$00 + sta XBBD8 + lda AS.HIMEM+1 + sbc AS.STRINGSTART+1 + adc #$01 + cmp XBBD9 + bcs LA07D + + sta XBBD9 + +LA07D lda AS.HIMEM+1 + sta BS.MEMSIZE+1 + lda AS.HIMEM + sta BS.MEMSIZE + sta AS.STRINGSTART + +LA089 clc + beq LA08D + + sec + +LA08D lda BS.MEMSIZE+1 + sta AS.STRINGSTART+1 + sbc #$00 + sta XBBDA + adc #$00 + sta XBBDB + lda AS.ARRAYEND+1 + adc #$01 + sta XBBDD + +LA0A3 lda AS.VARSTART + sbc #$06 + sta ZP.A2L + lda AS.VARSTART+1 + sbc #$00 + sta ZP.A2H + lda AS.ARRAYSTART + sta XBBDC + lda XBBDA + cmp BS.TXTTAB+1 + bcc LA0FA + + sbc XBBD9 + sta XBBD7 + lda AS.STRINGSTART+1 + sbc XBBDA + sbc XBBD7 + eor #$FF + adc #$02 + cmp XBBD7 + bcc LA0D6 + + lda XBBD7 + +LA0D6 cmp BS.TXTTAB+1 + bcs LA0E0 + + lda BS.TXTTAB+1 + sbc #$00 + +LA0E0 sta XBBDA + jsr LA199 + ldx AS.ARRAYSTART+1 + jsr LA0FB + bcs LA0F8 + + jsr LA131 + lda XBBDA + sta XBBDB + bcc LA0A3 + +LA0F8 lda #$0C +LA0FA rts + +LA0FB clc + +LA0FC lda ZP.A2L + adc #$07 + sta ZP.A2L + bcc LA106 + + inc ZP.A2H + +LA106 eor AS.ARRAYSTART + bne LA10E + + cpx ZP.A2H + beq LA12F + +LA10E ldy #$00 + lda (ZP.A2L),y + iny + eor (ZP.A2L),y + bpl LA0FB + + lda (ZP.A2L),y + bpl LA0FB + + ldy #$04 + lda (ZP.A2L),y + cmp XBBDA + bcc LA0FC + + cmp XBBDB + bcs LA0FB + + jsr LA1BC + bcc LA0FC + + rts + +LA12F clc + rts + +LA131 jsr LA160 + bcs LA12F + +LA136 ldy #$02 + lda (ZP.A2L),y + cmp XBBDA + bcc LA14A + + cmp XBBDB + bcs LA14A + + jsr LA1BC + bcc LA14B + + rts + +LA14A clc +LA14B lda #$03 + adc ZP.A2L + sta ZP.A2L + bcc LA155 + + inc ZP.A2H + +LA155 cmp XBBDC + bne LA136 + + cpx ZP.A2H + bne LA136 + + beq LA131 + +LA160 clc + lda XBBDC + sta ZP.A2L + stx ZP.A2H + eor AS.ARRAYEND + bne LA170 + + cpx AS.ARRAYEND+1 + beq LA198 + +LA170 ldy #$02 + lda (ZP.A2L),y + adc ZP.A2L + sta XBBDC + iny + lda (ZP.A2L),y + adc ZP.A2H + tax + ldy #$00 + lda (ZP.A2L),y + iny + eor (ZP.A2L),y + bpl LA160 + + ldy #$04 + lda (ZP.A2L),y + asl + adc #$05 + adc ZP.A2L + sta ZP.A2L + bcc LA198 + + inc ZP.A2H + + clc +LA198 rts + +LA199 lda XBBD7 + sta ZP.PCH + lda XBBD8 + sta ZP.A1H + ldy #$00 + sty ZP.PCL + sty ZP.A1L + ldx XBBD9 + inx + +LA1AD lda (ZP.PCL),y + sta (ZP.A1L),y + iny + bne LA1AD + + inc ZP.A1H + inc ZP.PCH + dex + bne LA1AD + + rts + +LA1BC cmp XBBD7 + bcc LA1C8 + + sbc XBBD7 + clc + adc XBBD8 + +LA1C8 sta ZP.PCH + dey + lda (ZP.A2L),y + sta ZP.PCL + dey + sec + lda AS.STRINGSTART + sbc (ZP.A2L),y + sta AS.STRINGSTART + iny + sta (ZP.A2L),y + lda AS.STRINGSTART+1 + sbc #$00 + sta AS.STRINGSTART+1 + iny + sta (ZP.A2L),y + dey + dey + lda (ZP.A2L),y + beq LA1F2 + + tay + +LA1EA dey + lda (ZP.PCL),y + sta (AS.STRINGSTART),y + tya + bne LA1EA + +LA1F2 clc + lda XBBDD + sbc AS.STRINGSTART+1 + rts + +LA1F9 lda #$04 +LA1FB sta XBBB5 + jsr BS.KW.01 + bcs LA24E + + lda AS.STRINGSTART+1 + sbc AS.ARRAYEND+1 + cmp XBBB5 + lda #$0C + bcc LA24E + + lda AS.STRINGSTART+1 + sta ZP.PCH + sbc XBBB5 + sta ZP.A1H + sta AS.STRINGSTART+1 + lda AS.STRINGSTART + sta ZP.PCL + sta ZP.A1L + lda AS.HIMEM + sbc ZP.PCL + sta XBBED + lda AS.HIMEM+1 + sbc ZP.PCH + sta XBBEE + jsr LA35F + lda #$00 + sec + sbc XBBB5 + sta XBBE2 + jsr LA3A3 + lda AS.HIMEM+1 + sta XBBB7 + sec + sbc XBBB5 + sta AS.HIMEM+1 + clc + adc #$04 + sta XBBE3 + rts + +LA24E sec + rts + +LA250 jsr BS.KW.01 + bcs LA29D + + lda AS.HIMEM+1 + sbc #$00 + sta ZP.PCH + adc #$03 + sta ZP.A1H + lda AS.STRINGSTART + sta ZP.PCL + sta ZP.A1L + lda AS.HIMEM + sec + sbc AS.STRINGSTART + sta XBBED + lda AS.HIMEM+1 + sbc AS.STRINGSTART+1 + sta XBBEE + jsr LA383 + lda #$04 + sta XBBE2 + clc + adc AS.HIMEM+1 + sta AS.HIMEM+1 + jsr LA3A3 + lda XBBE3 + cmp AS.HIMEM+1 + beq LA2B7 + + pha + ldx GP.OPENCNT + beq LA29B + + lda AS.HIMEM+1 + +LA293 cmp XBBEE,x + beq LA29E + + dex + bne LA293 + +LA29B pla + sec +LA29D rts + +LA29E pla +LA29F sta GP.SBUFADR+1 + sta XBBEE,x + lda #$00 + sta GP.SBUFADR + lda XBBF6,x + sta GP.MLIMRKEOFBUF.REFNUM + lda #MLI.C.SETBUF + jsr GP.GOSYSTEM + bcs LA29D + +LA2B7 clc + rts +*-------------------------------------- +MAN +SAVE usr/src/basic.fx/basic.s.a +LOAD usr/src/basic.fx/basic.s +ASM diff --git a/BASIC.FX/BASIC.S.B.txt b/BASIC.FX/BASIC.S.B.txt new file mode 100644 index 00000000..bac792a3 --- /dev/null +++ b/BASIC.FX/BASIC.S.B.txt @@ -0,0 +1,1687 @@ +NEW + AUTO 3,1 +*-------------------------------------- +BS.GETBUFR jsr LA1FB + bcs LA304 + pha + sbc #$03 + sta XBBB8 + pla + +LA2C5 sta GP.SBUFADR+1 + ldx GP.OPENCNT + beq LA2EE + + lda XBBB7 + clc + adc #$04 + sta XBBB7 + +LA2D6 cmp XBBEE,x + bne LA2EB + + lda GP.SBUFADR+1 + jsr LA356 + jsr LA29F + lda GP.SBUFADR+1 + adc #$04 + bcc LA2C5 + +LA2EB dex + bne LA2D6 + +LA2EE lda GP.SBUFADR+1 + bit GP.EXECACTV + bpl LA303 + +LA2F6 ldx #$08 + jsr LA356 + jsr LA29F + lda GP.SBUFADR+1 + adc #$04 + +LA303 clc +LA304 rts + +BS.FREEBUFR lda GP.OPENCNT + asl + asl + adc AS.HIMEM+1 + sta XBBB7 + lda AS.HIMEM+1 + sta XBBB8 + lda GP.RSHIMEM + cmp AS.HIMEM+1 + beq LA354 + + sta AS.HIMEM+1 + bit GP.EXECACTV + bpl LA327 + + jsr LA2F6 + bcc LA345 + +LA327 lda XBBB7 + ldx GP.OPENCNT + beq LA351 + +LA32F cmp XBBEE,x + bne LA34E + + lda AS.HIMEM+1 + jsr LA356 + jsr LA29F + sec + lda XBBB7 + sbc #$04 + sta XBBB7 + +LA345 lda AS.HIMEM+1 + sec + sbc #$04 + sta AS.HIMEM+1 + bcs LA327 + +LA34E dex + bne LA32F + +LA351 jsr BS.KW.01 +LA354 clc + rts + +LA356 pha + lda XBBB8 + jsr LA29F + pla + rts + +LA35F ldy #$00 + cpy XBBEE + beq LA376 + +LA366 lda (ZP.PCL),y + sta (ZP.A1L),y + iny + bne LA366 + + inc ZP.PCH + inc ZP.A1H + dec XBBEE + bne LA366 + +LA376 cpy XBBED + beq LA382 + + lda (ZP.PCL),y + sta (ZP.A1L),y + iny + bne LA376 + +LA382 rts + +LA383 ldy XBBED +XA386 beq LA38F SELF MODIFIED + +LA388 jsr LA39A + dec ZP.A1H + dec ZP.PCH + +LA38F cpy XBBEE + beq LA3A2 + + dec XBBEE + jmp LA388 + +LA39A dey + lda (ZP.PCL),y + sta (ZP.A1L),y + tya + bne LA39A + +LA3A2 rts + +LA3A3 lda AS.VARSTART+1 + sta ZP.A2H + lda AS.VARSTART + ldx AS.ARRAYSTART+1 + clc + bcc LA3B3 + +LA3AE clc + lda ZP.A2L + adc #$07 + +LA3B3 sta ZP.A2L + bcc LA3B9 + + inc ZP.A2H + +LA3B9 eor AS.ARRAYSTART + bne LA3BF + + cpx ZP.A2H + +LA3BF clc + beq LA3D6 + + ldy #$00 + lda (ZP.A2L),y + iny + eor (ZP.A2L),y + bpl LA3AE + + lda (ZP.A2L),y + bpl LA3AE + + iny + jsr LA3FD + jmp LA3AE + +LA3D6 lda ZP.A2L + sta XBBDC + +LA3DB clc + jsr LA160 + bcs LA410 + +LA3E1 ldy #$00 + clc + jsr LA3FD + clc + lda #$03 + adc ZP.A2L + sta ZP.A2L + bcc LA3F2 + + inc ZP.A2H + +LA3F2 cmp XBBDC + bne LA3E1 + + cpx ZP.A2H + bne LA3E1 + + beq LA3DB + +LA3FD lda (ZP.A2L),y + beq LA410 + + iny + iny + lda AS.VARSTART+1 + cmp (ZP.A2L),y + bcs LA410 + + lda (ZP.A2L),y + adc XBBE2 + sta (ZP.A2L),y + +LA410 rts + +LA411 jsr LA021 + bcs LA47F + + lda AS.ARRAYEND + sec + sbc AS.VARSTART + sta BS.BAS.HDR + sta XBBED + lda AS.ARRAYEND+1 + sbc AS.VARSTART+1 + sta BS.BAS.HDR+1 + sta XBBEE + lda AS.ARRAYSTART + sbc AS.VARSTART + sta BS.BAS.HDR+2 + lda AS.ARRAYSTART+1 + sbc AS.VARSTART+1 + sta BS.BAS.HDR+3 + lda AS.STRINGSTART + sbc XBBED + sta ZP.A1L + lda AS.STRINGSTART+1 + sbc #$00 + sta ZP.A1H + lda AS.ARRAYEND + sbc XBBED + sta ZP.PCL + lda AS.ARRAYEND+1 + sbc #$00 + sta ZP.PCH + lda #$03 + sta XA386+1 + jsr LA383 + lda #$07 + sta XA386+1 + lda ZP.A1L + sta XBBE9 + inc ZP.A1H + lda ZP.A1H + sta XBBEA + lda AS.HIMEM + sec + sbc ZP.A1L + sta XBBEB + lda AS.HIMEM+1 + sta BS.BAS.HDR+4 + sbc ZP.A1H + sta XBBEC + clc +LA47F rts + +LA480 lda BS.BAS.HDR + sta XBBED + clc + adc AS.VARSTART + sta AS.ARRAYEND + lda BS.BAS.HDR+1 + sta XBBEE + adc AS.VARSTART+1 + sta AS.ARRAYEND+1 + lda AS.VARSTART + sta ZP.A1L + adc BS.BAS.HDR+2 + sta AS.ARRAYSTART + lda AS.VARSTART+1 + sta ZP.A1H + adc BS.BAS.HDR+3 + sta AS.ARRAYSTART+1 + lda XBBE9 + sta ZP.PCL + lda XBBEA + sta ZP.PCH + jsr LA35F + lda XBBED + clc + adc ZP.PCL + sta AS.STRINGSTART + lda ZP.PCH + adc #$00 + sta AS.STRINGSTART+1 + sec + lda AS.HIMEM+1 + sbc BS.BAS.HDR+4 + beq LA4D0 + + sta XBBE2 + jsr LA3A3 + +LA4D0 clc + rts + +LA4D2 jsr BS.LINEBUFCLR80 + lda #$A2 + sta IO.LINEBUF + lda DIRENTBUF + and #$0F + tay + +LA4E0 lda DIRENTBUF,y + ora #$80 + sta IO.LINEBUF+1,y + dey + bne LA4E0 + + sty BS.TMPBUF4+2 + lda DIRENTBUF.TYPE + ldx #$0E + +LA4F3 iny + iny + cmp BS.PRODOSTYPES.H,x + beq LA505 + + iny + dex + bpl LA4F3 + + ldy #$13 + jsr BS.AHEX2LINEBUFY + bne LA549 + +LA505 ldx #$02 + pha + +LA508 lda BS.PRODOSTYPES.ASC,y + sta $212,x + dey + dex + bpl LA508 + pla + bit BS.CATWIDTH + bvc LA561 + + ldy #$4E + cmp #$06 + beq LA533 + + cmp #$04 + bne LA549 + + lda #$D2 + sta $249 + lda DIRENTBUF.AUXT + ldx DIRENTBUF.AUXT+1 + jsr BS.AXDEC2LINEBUFY + jmp LA544 + +LA533 lda #$C1 + sta $249 + lda DIRENTBUF.AUXT + jsr BS.AHEX2LINEBUFY + lda DIRENTBUF.AUXT+1 + jsr BS.AHEX2LINEBUFY + +LA544 lda #$BD + sta $24A + +LA549 lda DIRENTBUF.EOF+2 + sta BS.TMPBUF4+2 + lda DIRENTBUF.EOF + ldx DIRENTBUF.EOF+1 + ldy #$46 + jsr BS.AXDEC2LINEBUFY + ldx #$18 + ldy #$3D + jsr LA57E + +LA561 ldy #$1B + lda DIRENTBUF.UBLK + ldx DIRENTBUF.UBLK+1 + jsr BS.AXDEC2LINEBUFY + lda DIRENTBUF.ACCESS + and #$C2 + cmp #$C2 + beq LA57A + + lda #$AA + sta IO.LINEBUF+1 + +LA57A ldx #$21 + ldy #$2C + +LA57E lda $25A,x + lsr + sta XBC10 + lda DIRENTBUF,x + pha + and #$1F + sta XBC0F + pla + rol + rol + rol + rol + and #$0F + beq LA5B1 + + cmp #$0D + bcs LA5B1 + + sta XBC0E + asl + adc XBC0E + sta XBC0E + lda XBC0F + beq LA5B1 + + lda XBC10 + cmp #$64 + bcc LA5C3 + +LA5B1 tya + sec + sbc #$06 + tay + ldx #$08 + +LA5B8 lda BS.NODATE,x + sta IO.LINEBUF+1,y + dey + dex + bpl LA5B8 + + rts + +LA5C3 lda $25C,x + pha + lda $25B,x + ldx #$00 + cmp #$3C + bcc LA5D1 + + txa + +LA5D1 jsr LA618 + lda #$BA + sta IO.LINEBUF+1,y + dey + pla + ldx #$00 + cmp #$18 + bcc LA5E2 + + txa + +LA5E2 cmp #$0A + php + jsr BS.AXDEC2LINEBUFY + plp + bcs LA5EC + + dey + +LA5EC dey + lda XBC10 + jsr LA618 + dey + ldx XBC0E + inx + inx + inx + +LA5FA lda BS.MONTHS-4,x + sta IO.LINEBUF+1,y + dey + dex + cpx XBC0E + bne LA5FA + + lda #$AD + sta IO.LINEBUF+1,y + sta $205,y + dey + lda XBC0F + ldx #$00 + jmp BS.AXDEC2LINEBUFY + +LA618 clc + adc #$64 + jsr BS.AXDEC2LINEBUFY + iny + rts + +BS.AHEX2LINEBUFY + pha + and #$0F + jsr LA62B + pla + lsr + lsr + lsr + lsr + +LA62B ora #$B0 + cmp #$BA + bcc LA633 + + adc #$06 + +LA633 sta IO.LINEBUF+1,y + dey + lda #$A4 + sta IO.LINEBUF+1,y + rts + +BS.AXDEC2LINEBUFY + stx BS.TMPBUF4+1 + sta BS.TMPBUF4 + +LA643 jsr LA65B + lda BS.TMPBUF4+3 + ora #$B0 + sta IO.LINEBUF+1,y + dey + lda BS.TMPBUF4 + ora BS.TMPBUF4+1 + ora BS.TMPBUF4+2 + bne LA643 + + rts + +LA65B ldx #$18 + lda #$00 + sta BS.TMPBUF4+3 + +LA662 jsr BS.TMPBUF3x2 + rol BS.TMPBUF4+3 + sec + lda BS.TMPBUF4+3 + sbc #$0A + bcc LA676 + + sta BS.TMPBUF4+3 + inc BS.TMPBUF4 + +LA676 dex + bne LA662 + + rts + +BS.LINEBUFCLR80 lda #$A0 + ldx #$4F + +LA67E sta IO.LINEBUF+1,x + dex + bpl LA67E + + rts + +BS.DOSCMD lda #$FF + sta GP.XCNUM + lda #$20 + sta BS.GetCharSep + lda #$08 + sta BS.GetCharMax + jsr BS.GetKWInCmdBuf + lda BS.CMDBUF + cmp #$41 + bcs LA6A5 + + eor #$2D + beq LA6A5 + +LA6A2 jmp BS.ERR10 + +LA6A5 jsr BS.IsIntCmdMTR + bcs LA6A2 + + lda GP.STATE + bne LA6BA + + lda GP.EXECACTV + bne LA6BA + + jsr MON.CLREOL + jsr BS.CROUT + +LA6BA lda #$00 + sta GP.FoundBITS + sta GP.FoundBITS+1 + sta BS.CMDBUF + sta MLI.PATHBUF + lda GP.VDEFSLT + sta GP.ParamS + lda GP.VDEFDRV + sta GP.ParamD + lda AS.HIMEM+1 + sta XBBE3 + ldx GP.XLEN + inx + inx + stx BS.GetCharMax + lda GP.AllowedBITS + beq LA744 + + asl + bmi LA747 + + jsr BS.GetKWInCmdBuf + php + pha + lda GP.AllowedBITS + bpl LA6F8 + + lda #MLI.C.GETPREFIX + jsr GP.GOSYSTEM + +LA6F8 pla + plp + beq LA744 + + cmp #$2C + bne LA703 + jmp LA795 + +LA703 cmp #$2F + beq LA70B + + cmp #$41 + bcc LA73D + +LA70B dex + lda #$82 + sta BS.GetCharSep + lsr + sta BS.GetCharMax + ldy #$00 + jsr LAA2D + dey + sty BS.CMDBUF.LEN + lda #$01 + sta GP.FoundBITS + +LA723 lda BS.CMDBUF.LEN,y + sta MLI.PATHBUF,y + dey + bpl LA723 + + dex + jsr BS.GetCharSpaceSep + bne LA73A + + bcc LA7A6 + + lda GP.AllowedBITS + lsr + bcs LA770 + +LA73A jmp BS.ERR10 + +LA73D lda GP.XCNUM + cmp #$06 + bne LA73A + +LA744 jmp LA7A6 + +LA747 jsr BS.GetKWInCmdBuf + beq LA73A + + cmp #$41 + beq LA79A + + jsr BS.TMPBUF3Reset + sty XBC08 + ldy #$13 + sty XBC09 + ldy #$40 + sty GP.FoundBITS + jsr LA96E + bcs LA76F + + lda GP.ParamINPR + cmp #$08 + bcc LA79F + +LA76C lda #$02 + sec +LA76F rts + +LA770 lsr + bcc LA795 + + jsr BS.GetCharSpaceSep + beq LA73A + + dex + lda #$82 + sta BS.GetCharSep + ldy #$01 + jsr BS.GetPathInPathBuf + dey + dey + sty MLI.PATHBUF + lda #$03 + sta GP.FoundBITS + dex + jsr BS.GetCharSpaceSep + bne LA73A + + bcc LA7A6 + +LA795 jsr BS.GetCharSpaceSep + beq LA73A + +LA79A jsr LA8F6 + bcs LA76F + +LA79F jsr BS.GetCharSpaceSep + bne LA73A + + bcs LA795 + +LA7A6 lda GP.ParamS + beq LA76C + + cmp #$08 + bcs LA76C + + lda GP.ParamD + beq LA76C + + cmp #$03 + bcs LA76C + + lda GP.AllowedBITS + and #$21 + lsr + beq LA7C9 + + lda GP.STATE + bne LA7C9 + + lda #$0F + sec + rts + +LA7C9 bcc LA80B + + lda GP.AllowedBITS+1 + and #$04 + beq LA80B + + lda GP.FoundBITS + lsr + bcs LA7E1 + + lda GP.AllowedBITS + and #$90 + beq BS.ERR10 + + bpl LA80B + +LA7E1 lda BS.CMDBUF + eor #$2F + beq LA7ED + + lda MLI.PFIXPTR + beq LA806 + +LA7ED lda GP.FoundBITS+1 + and #$04 + beq LA80B + + bcs LA806 + + lda #$00 + sta BS.CMDBUF.LEN + sta BS.CMDBUF + lda #$01 + ora GP.FoundBITS + sta GP.FoundBITS + +LA806 jsr BS.GetVolAtSxDy + bcs LA849 + +LA80B lda GP.XCNUM + asl + tax + lda BS.KW.JMP,x + sta BS.KW.JMPADDR + lda BS.KW.JMP+1,x + sta BS.KW.JMPADDR+1 + clc + txa + beq LA844 + + eor #$32 + beq LA844 + + lda GP.AllowedBITS+1 + and #$04 + + beq LA844 + lda GP.FoundBITS + lsr + bcc LA844 + + jsr BS.GetFileInfo + bcc LA844 + + cmp #$07 + bne LA849 + + lda GP.AllowedBITS + and #$08 + bne LA844 + + lda #$06 + rts + +LA844 jmp (BS.KW.JMPADDR) + +BS.ERR10 lda #$10 +LA849 sec + rts + +BS.GetVolAtSxDy lda GP.ParamS + asl + asl + asl + asl + asl + pha + lda GP.ParamD + eor #$01 + lsr + pla + ror + sta GP.MLIMRKEOFBUF.REFNUM + lda #$01 + sta GP.SBUFADR + lda #$02 + sta GP.SBUFADR+1 + lda #MLI.C.ONLINE + jsr GP.GOSYSTEM + bcs LA849 + + lda GP.ParamD + sta GP.VDEFDRV + lda GP.ParamS + sta GP.VDEFSLT + lda BS.CMDBUF + eor #$2F + beq LA8F4 + + lda IO.LINEBUF+1 + and #$0F + adc #$02 + sta IO.LINEBUF+1 + adc BS.CMDBUF.LEN + cmp #$40 + tax + lda #$10 + bcs LA8F5 + + ldy BS.CMDBUF.LEN + stx BS.CMDBUF.LEN + +LA89D dex + dey + bmi LA8AA + + lda BS.CMDBUF,y + sta BS.CMDBUF,x + jmp LA89D + +LA8AA lda #$2F + sta BS.CMDBUF + +LA8AF sta BS.CMDBUF,x + lda IO.LINEBUF,x + dex + bne LA8AF + + lda GP.XCNUM + cmp #$0B + beq LA8F4 + + cmp #$16 + beq LA8F4 + + cmp #$08 + beq LA8F4 + + lda MLI.PATHBUF + tay + clc + adc IO.LINEBUF+1 + cmp #$40 + tax + lda #$10 + bcs LA8F5 + + stx MLI.PATHBUF + +LA8D9 dex + dey + bmi LA8E6 + + lda MLI.PATHBUF+1,y + sta MLI.PATHBUF+1,x + jmp LA8D9 + +LA8E6 lda #$2F + sta MLI.PATHBUF+1 + +LA8EB sta MLI.PATHBUF+1,x + lda IO.LINEBUF,x + dex + bne LA8EB + +LA8F4 clc + +LA8F5 rts + +LA8F6 jsr BS.TMPBUF3Reset + ldy #$09 + +LA8FB cmp BS.KW.OPT,y + beq LA935 + + dey + bpl LA8FB + + cmp #$54 + beq LA90A + +LA907 jmp BS.ERR10 + +LA90A lda #$04 + and GP.AllowedBITS + beq LA931 + + ora GP.FoundBITS + sta GP.FoundBITS + lda #$00 + sta XBC08 + lda #$12 + sta XBC09 + jsr BS.GetCharSpaceSep + beq LA907 + + cmp #$24 + beq LA984 + + cmp #$41 + bcc LA96E + + jmp BS.GetFTypeASC + +LA931 sec + lda #$0B + rts + +LA935 lda BS.KW.OPT.PBITSLO,y + beq LA955 + + and GP.AllowedBITS+1 + beq LA931 + + cmp #$04 + bne LA94F + + and GP.FoundBITS+1 + bne LA955 + + lda #$01 + sta GP.ParamD + lda #$04 + +LA94F ora GP.FoundBITS+1 + sta GP.FoundBITS+1 + +LA955 lda BS.KW.OPT.PBITSHI,y + and #$03 + sta XBC08 + lda BS.KW.OPT.PBITSHI,y + lsr + lsr + sta XBC09 + jsr BS.GetCharSpaceSep + beq LA9BE + + cmp #$24 + beq LA984 + +LA96E stx GP.INPTR + jsr LAA6A + bcc LA97A + + bmi LA9C1 + + bcs LA9BE + +LA97A ldx GP.INPTR + jsr BS.GetCharSpaceSep + bne LA96E + + beq LA99D + +LA984 jsr BS.GetCharSpaceSep + beq LA9BE + +LA989 stx GP.INPTR + jsr LAABC + bcc LA995 + + bmi LA9C1 + + bcs LA9BE + +LA995 ldx GP.INPTR + jsr BS.GetCharSpaceSep + bne LA989 + +LA99D ldx #$02 +LA99F cpx XBC08 + beq LA9AC + + lda BS.TMPBUF4,x + bne LA9C1 + + dex + bne LA99F + +LA9AC ldy XBC09 +LA9AF lda BS.TMPBUF4,x + sta GP.ParamA,y + dey + dex + bpl LA9AF + + ldx GP.INPTR + clc + rts + +LA9BE jmp BS.ERR10 +LA9C1 jmp LA76C + +BS.GetFTypeASC ldy #$00 + +LA9C6 sta BS.TMPBUF4,y + iny + cpy #$03 + beq LA9D5 + + jsr BS.GetCharSpaceSep + bne LA9C6 + + beq LA9BE + +LA9D5 stx GP.INPTR +LA9D8 ldx #$00 + lda XBC08 + cmp #$0F + beq LA9BE + + asl + adc XBC08 + tay + +LA9E6 lda BS.TMPBUF4,x + eor BS.PRODOSTYPES.ASC,y + asl + bne LA9F7 + + iny + inx + cpx #$03 + bne LA9E6 + + beq LA9FC + +LA9F7 inc XBC08 + bne LA9D8 + +LA9FC lda #$0E + sec + sbc XBC08 + tay + lda BS.PRODOSTYPES.H,y + sta GP.ParamT + ldx GP.INPTR + clc + rts + +BS.GetPathInPathBuf + jsr BS.GetCharUC + sta MLI.PATHBUF,y + iny + cmp #$2C + beq LAA45 + + cmp #$20 + beq LAA45 + + cmp #$0D + beq LAA56 + + cpy BS.GetCharMax + bcc BS.GetPathInPathBuf + + ora #$00 + rts + +BS.GetKWInCmdBuf + ldx #$00 + ldy #$00 + +LAA2D jsr BS.GetCharUC + sta BS.CMDBUF,y + iny + cmp #$2C + beq LAA45 + + cmp #$20 + beq LAA45 + + cmp #$0D + beq LAA56 + + cpy BS.GetCharMax + bcc LAA2D + +LAA45 ora #$00 + rts + +BS.GetCharSpaceSep + lda #$20 + sta BS.GetCharSep + jsr BS.GetCharUC + cmp #$2C + beq LAA57 + + cmp #$0D + +LAA56 clc +LAA57 rts + +BS.GetCharUC lda IO.LINEBUF,x + and #$7F + cmp #$61 + bcc LAA63 + + and #$5F + +LAA63 inx + cmp BS.GetCharSep + beq BS.GetCharUC + + rts + +LAA6A cmp #$30 + bcc LAA72 + + cmp #$3A + bcc LAA76 + +LAA72 sec + ora #$00 + rts + +LAA76 and #$0F + pha + lda BS.TMPBUF4+2 + cmp #$1A + bcs LAAA2 + + ldx #$02 + +LAA82 lda BS.TMPBUF4,x + pha + dex + bpl LAA82 + + jsr BS.TMPBUF3x2 + jsr BS.TMPBUF3x2 + ldx #$00 + clc + +LAA92 pla + adc BS.TMPBUF4,x + sta BS.TMPBUF4,x + inx + txa + eor #$03 + bne LAA92 + + jsr BS.TMPBUF3x2 + +LAAA2 pla + bcs LAAB8 + + adc BS.TMPBUF4 + sta BS.TMPBUF4 + bcc LAABB + + clc + inc BS.TMPBUF4+1 + bne LAABB + + inc BS.TMPBUF4+2 + bne LAABB + +LAAB8 lda #$FF + sec +LAABB rts + +LAABC cmp #$30 + bcc LAACC + + cmp #$3A + bcc LAAD2 + + cmp #$41 + bcc LAACC + + cmp #$47 + bcc LAAD0 + +LAACC sec + ora #$00 + rts + +LAAD0 sbc #$06 +LAAD2 and #$0F + ldx #$03 + +LAAD6 jsr BS.TMPBUF3x2 + bcs LAAB8 + + dex + bpl LAAD6 + + ora BS.TMPBUF4 + sta BS.TMPBUF4 + rts + +BS.TMPBUF3x2 asl BS.TMPBUF4 + rol BS.TMPBUF4+1 + rol BS.TMPBUF4+2 + rts + +BS.IsIntCmd ldx #$1F + stx GP.XCNUM + lda BS.CMDBUF + eor #$2D + bne LAB03 + + inc GP.XCNUM + sta GP.XLEN + bne LAB20 + +LAB03 ldy #$08 + sty GP.XLEN + +LAB08 lda BS.KW.LEN,x + bpl LAB13 + + and #$7F + dey + dec GP.XLEN + +LAB13 tax +LAB14 lda BS.CMDBUF,y + cmp BS.KW.TABLE,x + bne LAB33 + + dex + dey + bpl LAB14 + +LAB20 lda GP.XCNUM + asl + tax + lda BS.KW.PBITS-1,x + sta GP.AllowedBITS+1 + lda BS.KW.PBITS-2,x + sta GP.AllowedBITS + clc + rts + +LAB33 ldy GP.XLEN + dec GP.XCNUM + ldx GP.XCNUM + bne LAB08 + + dec GP.XCNUM + sec + jmp GP.EXTRNCMD + +BS.TMPBUF3Reset ldy #$00 + sty BS.TMPBUF4 + sty BS.TMPBUF4+1 + sty BS.TMPBUF4+2 + rts + +BS.KW.APPEND lda GP.FITYPE + cmp #$FC + beq BS.KW.02 + + cmp #$06 + beq LABA3 + + cmp #$04 + bne LAB63 + + jmp BS.KW.EXEC + +LAB63 cmp #$FF + beq LAB6F + cmp #$B3 + beq LAB6F + lda #$0D + sec + rts + +LAB6F pha + jsr LB562 + jsr LB36B + lda #$00 + sta GP.ParamA + sta MLI.MEMTABL+19 + sta MLI.MEMTABL+20 + sta MLI.MEMTABL+21 + sta MLI.MEMTABL+22 + lda #$01 + sta MLI.MEMTABL+23 + lda #$20 + sta GP.ParamA+1 + pla + cmp #$FF + bne LABA6 + + sta GP.ParamT + lda #$80 + sta GP.FoundBITS+1 + lda #$05 + sta GP.FoundBITS +LABA3 jmp BS.KW.BRUN + +LABA6 sec + jsr MON.IIGSID + bcs LABA3 + + jmp LB099 + +BS.KW.X05 jsr LA411 + lda AS.HIMEM+1 + sta BS.AS.HIMEMSave + ldx XBBEA + dex + stx AS.HIMEM+1 + jsr LAC22 + ldx BS.AS.HIMEMSave + stx AS.HIMEM+1 + bcs LAC33 + + jsr AS.CLEAR1 + jsr LA480 + lda #$00 + beq LABE6 + +BS.KW.02 lda #$00 + sta GP.IFILACTV + sta AS.ERRNUM + lda GP.FoundBITS + lsr + bcc LABF4 + + jsr LAC1D + bcs LAC33 + + jsr AS.CLEAR1 + +LABE6 sta AS.ERRFLG + jsr LACB6 + jsr BS.SaveCSWKSW + jsr LABF4 + jmp AS.NEXTSTMT + +LABF4 jsr AS.NORMAL + lda #$A3 + sta X9F65 + lda #$FF + sta GP.XCNUM + sta ZP.PROMPT + ldx #$04 + jsr BS.SetState + jmp BS.ERR10 + +BS.KW.RESTORE jsr LAC1D + bcs LAC33 + +BS.ENTRY jsr AS.CLEAR1 + jsr BS.SetState0 + lda #$00 + sta ZP.CH + jmp AS.RESTART1 + +LAC1D jsr LB562 + bcs LAC33 + +LAC22 jsr LAC34 + bcs LAC33 + + sty AS.ARRAYSTART + sty AS.VARSTART + sty AS.ARRAYEND + stx AS.ARRAYSTART+1 + stx AS.VARSTART+1 + stx AS.ARRAYEND+1 + +LAC33 rts + +LAC34 lda #$01 + ldx #$FC + jsr BS.CheckFTypeXAccessA + bcs LAC33 + + lda #MLI.C.GETEOF + jsr GP.GOSYSTEM + bcs LAC33 + + lda AS.PGRMSTART + sta GP.MLIRW.DATAPTR + adc GP.SBUFADR + sta GP.ParamA + lda AS.PGRMSTART+1 + sta GP.MLIRW.DATAPTR+1 + adc GP.SBUFADR+1 + sta GP.ParamA+1 + bcs LAC5E + + cmp AS.HIMEM+1 + +LAC5E lda #$0E + bcs LAC33 + + ldx GP.SBUFADR + ldy GP.SBUFADR+1 + jsr BS.ReadXYBytes + bcs LAC33 + + jsr BS.FileClose + bcs LAC33 + + jsr LAC80 + ldx GP.ParamA+1 + ldy GP.ParamA + stx AS.PGRMEND+1 + sty AS.PGRMEND + rts + +LAC80 sec + lda AS.PGRMSTART + sbc GP.FIAUXTYPE + sta ZP.A1L + lda AS.PGRMSTART+1 + sbc GP.FIAUXTYPE+1 + sta ZP.A1H + ora ZP.A1L + clc + beq LACD9 + + ldx AS.PGRMSTART + lda AS.PGRMSTART+1 + +LAC98 stx ZP.PCL + sta ZP.PCH + ldy #$01 + lda (ZP.PCL),y + dey + ora (ZP.PCL),y + beq LACD9 + + lda (ZP.PCL),y + adc ZP.A1L + tax + sta (ZP.PCL),y + iny + lda (ZP.PCL),y + adc ZP.A1H + sta (ZP.PCL),y + clc + bcc LAC98 + +LACB6 lda GP.FoundBITS+1 + and #$08 + clc + beq LACD9 + + lda GP.ParamAT + sta AS.LINNUM + lda GP.ParamAT+1 + sta AS.LINNUM+1 + jsr AS.FINDLINE + clc + lda AS.LOWTR + adc #$FF + sta AS.TXTPTR + lda AS.LOWTR+1 + adc #$FF + sta AS.TXTPTR+1 + clc +LACD9 rts + +BS.KW.STORE bcc LACFE + + lda #$FC + sta GP.ParamT + sta GP.FITYPE + lda #$C3 + sta GP.FIACCESS + lda AS.PGRMSTART + sta GP.CRAUXTYPE + sta GP.FIAUXTYPE + lda AS.PGRMSTART+1 + sta GP.CRAUXTYPE+1 + sta GP.FIAUXTYPE+1 + jsr BS.CreateFileOrDir + bcs LAD47 + +LACFE lda #$02 + ldx #$FC + jsr BS.CheckFTypeXAccessA + bcs LAD47 + + lda AS.PGRMEND + sec + sbc AS.PGRMSTART + tax + sta GP.SBUFADR + lda AS.PGRMEND+1 + sbc AS.PGRMSTART+1 + tay + sta GP.SBUFADR+1 + lda #$00 + sta GP.SBUFADR+2 + lda AS.PGRMSTART + sta GP.MLIRW.DATAPTR + lda AS.PGRMSTART+1 + sta GP.MLIRW.DATAPTR+1 + jsr BS.WriteXYBytes + bcs LAD47 + + lda #MLI.C.SETEOF + jsr GP.GOSYSTEM + bcs LAD47 + + jsr BS.FileClose + bcs LAD47 + + lda AS.PGRMSTART+1 + ldx AS.PGRMSTART + cmp GP.FIAUXTYPE+1 + bne LAD48 + + cpx GP.FIAUXTYPE + clc + bne LAD48 + +LAD47 rts + +LAD48 stx GP.FIAUXTYPE + sta GP.FIAUXTYPE+1 + jmp BS.SetFileInfoNoDate + +BS.KW.CREATE lda #$00 + sta GP.CRAUXTYPE + sta GP.CRAUXTYPE+1 + lda GP.FoundBITS + and #$04 + bne BS.CreateFileOrDir + + lda #$0F + sta GP.ParamT +BS.CreateFileOrDir + lda GP.EXECACTV + asl + lda #$00 + adc GP.OPENCNT + cmp #$08 + bcs LAD8D + + lda GP.ParamT + sta GP.CRTYPE + ldx #$C3 + ldy #$01 + cmp #$0F + bne LAD82 + + ldy #$0D + +LAD82 stx GP.CRACCESS + sty GP.CRSTTYPE + lda #MLI.C.CREATE + jmp GP.GOSYSTEM + +LAD8D lda #$0C + rts + +BS.KW.RENAME lda GP.FoundBITS + lsr + lsr + lda #MLI.C.RENAME + bcs LAD9E + + jmp BS.ERR10 + +BS.KW.DELETE lda #MLI.C.DESTROY + +LAD9E jmp GP.GOSYSTEM + +BS.KW.LOCK jsr BS.GetFileInfo + lda GP.FIACCESS + and #$3C + ora #$01 + sta GP.FIACCESS + jmp BS.SetFileInfo + +BS.KW.UNLOCK jsr BS.GetFileInfo + lda #$C3 + ora GP.FIACCESS + sta GP.FIACCESS + jmp BS.SetFileInfo + +BS.KW.PREFIX lda GP.FoundBITS+1 + and #$04 + sec + bne LADCB + + lda GP.FoundBITS + lsr + +LADCB lda #$C6 + bcs LAD9E + + lda ZP.PROMPT + beq LADF0 + + jsr BS.CROUT + ldx #$00 + +LADD8 cpx BS.CMDBUF.LEN + beq LADE8 + + lda BS.CMDBUF,x + ora #$80 + jsr BS.COUT + inx + bne LADD8 + +LADE8 jsr BS.CROUT + jsr BS.CROUT + clc + rts + +LADF0 lda #$FF + sta GP.PFXACTV + clc + rts +*-------------------------------------- +MAN +SAVE usr/src/basic.fx/basic.s.b +LOAD usr/src/basic.fx/basic.s +ASM diff --git a/BASIC.FX/BASIC.S.C.txt b/BASIC.FX/BASIC.S.C.txt new file mode 100644 index 00000000..31d9b463 --- /dev/null +++ b/BASIC.FX/BASIC.S.C.txt @@ -0,0 +1,1506 @@ +NEW + AUTO 3,1 +*-------------------------------------- +BS.KW.BSAVE bcc LAE2D + + lda GP.FoundBITS+1 + and #$B0 + cmp #$90 + +XAE00 bcc LAE31 + + lda GP.ParamA + sta GP.CRAUXTYPE + sta GP.FIAUXTYPE + lda GP.ParamA+1 + sta GP.CRAUXTYPE+1 + sta GP.FIAUXTYPE+1 + lda #$06 + sta GP.ParamT + sta GP.FITYPE + lda GP.FoundBITS + and #$04 + bne LAE31 + + jsr BS.CreateFileOrDir + bcs LAE33 + + jsr BS.GetFileInfo + bcs LAE33 + +LAE2D lda #$02 + bne LAE44 + +LAE31 lda #$06 + +LAE33 sec + rts + +BS.KW.BRUN jsr BS.KW.BLOAD + bcs LAE33 + + jsr LAE3F + clc + rts + +LAE3F jmp (GP.MLIRW.DATAPTR) + +BS.KW.BLOAD lda #$01 +LAE44 ldx #$06 + jsr BS.CheckFTypeXAccessA + bcs LAE33 + + ldx GP.ParamA + ldy GP.ParamA+1 + lda GP.FoundBITS+1 + bmi LAE66 + + ldx GP.FIAUXTYPE + ldy GP.FIAUXTYPE+1 + lda GP.FoundBITS + and #$04 + bne LAEAB + + lda GP.FoundBITS+1 + +LAE66 stx GP.MLIRW.DATAPTR + sty GP.MLIRW.DATAPTR+1 + bit GP.FoundBITS+1 + bvs LAE80 + + pha + lda GP.FITYPE + cmp #$06 + bne LAE7F + + stx GP.FIAUXTYPE + sty GP.FIAUXTYPE+1 + +LAE7F pla +LAE80 ldx GP.ParamL + ldy GP.ParamL+1 + and #$30 + beq LAEAF + + eor #$30 + beq LAEAB + + and #$10 + beq LAEC5 + + lda GP.ParamE + sec + sbc GP.ParamA + tax + lda GP.ParamE+1 + sbc GP.ParamA+1 + tay + inx + bne LAEA5 + + iny + +LAEA5 bcs LAEC5 + + lda #$02 + sec + rts + +LAEAB lda #$0B + sec + rts + +LAEAF lda #MLI.C.GETEOF + jsr GP.GOSYSTEM + bcs LAEC3 + + ldx GP.SBUFADR + ldy GP.SBUFADR+1 + lda GP.SBUFADR+2 + beq LAEC5 + + lda #$0E +LAEC3 sec + rts + +LAEC5 stx GP.MLIRW.COUNT + sty GP.MLIRW.COUNT+1 + lda GP.FoundBITS+1 + and #$40 + beq LAEF7 + + ldx #$02 +LAED4 lda GP.ParamB,x + sta GP.SBUFADR,x + dex + bpl LAED4 + +LAEDD lda #MLI.C.SETMARK + jsr GP.GOSYSTEM + ldx GP.XCNUM + bcc LAEF7 + + cmp #$02 + bne LAEC3 + + cpx #$0F + bne LAEC3 + + lda #MLI.C.SETEOF + jsr GP.GOSYSTEM + bcc LAEDD + rts + +LAEF7 ldx GP.XCNUM + lda #$CA + cpx #$0F + bne LAF24 + + bit GP.FoundBITS+1 + bvs LAF22 + + lda GP.FoundBITS+1 + and #$30 + beq LAF22 + + lda GP.MLIRW.COUNT + sta GP.SBUFADR + lda GP.MLIRW.COUNT+1 + sta GP.SBUFADR+1 + lda #$00 + sta GP.SBUFADR+2 + lda #MLI.C.SETEOF + jsr GP.GOSYSTEM + +LAF22 lda #MLI.C.WRITE + +LAF24 jsr GP.GOSYSTEM + bcs LAF38 + bit GP.FoundBITS+1 + bvs LAF35 + + cpx #$0F + bne LAF35 + + jsr BS.SetFileInfoNoDate + +LAF35 jmp BS.FileClose + +LAF38 sec + rts + +BS.KW.SAVE bcc LAF4E + + lda #$FD + sta GP.ParamT + sta GP.FITYPE + lda #$C3 + sta GP.FIACCESS + jsr BS.CreateFileOrDir + bcs LAF9C + +LAF4E jsr LA411 + bcs LAF9C + + ldx #$FD + lda #$02 + jsr BS.CheckFTypeXAccessA + bcs LAF95 + + jsr BS.SetupRW5AtBBE4 + jsr BS.WriteXYBytes + bcs LAF95 + + lda XBBE9 + sta GP.MLIRW.DATAPTR + sta GP.FIAUXTYPE + lda XBBEA + sta GP.MLIRW.DATAPTR+1 + sta GP.FIAUXTYPE+1 + ldy XBBEC + ldx XBBEB + jsr BS.WriteXYBytes + bcs LAF95 + + lda #MLI.C.GETMARK + jsr GP.GOSYSTEM + lda #MLI.C.SETEOF + jsr GP.GOSYSTEM + bcs LAF95 + + jsr BS.SetFileInfoNoDate + bcs LAF95 + + jsr BS.FileClose + +LAF95 php + pha + jsr LA480 + pla + plp +LAF9C rts + +BS.SetupRW5AtBBE4 + lda #$E4 + sta GP.MLIRW.DATAPTR + lda #$BB + sta GP.MLIRW.DATAPTR+1 + ldy #$00 + ldx #$05 + rts + +BS.KW.LOAD ldx #$FD + lda #$01 + jsr BS.CheckFTypeXAccessA + bcs LAF9C + + jsr BS.SetupRW5AtBBE4 + jsr BS.ReadXYBytes + bcs LAF9C + + lda GP.FIAUXTYPE + sta XBBE9 + sta GP.MLIRW.DATAPTR + lda AS.HIMEM+1 + sec + sbc BS.BAS.HDR+4 + clc + adc GP.FIAUXTYPE+1 + sta GP.MLIRW.DATAPTR+1 + sta XBBEA + cmp AS.PGRMEND+1 + bcc LAFF3 + + beq LAFF3 + + lda #$00 + sbc XBBE9 + tax + lda AS.HIMEM+1 + sbc XBBEA + tay + jsr BS.ReadXYBytes + bcs LAF9C + + jsr BS.FileClose + jmp LAF95 + +LAFF3 lda #$0E + sec + rts + +BS.FileClose lda #MLI.C.CLOSE + bne LB007 + +BS.ReadXYBytes lda #MLI.C.READ + bne LB001 + +BS.WriteXYBytes lda #MLI.C.WRITE +LB001 sty GP.MLIRW.COUNT+1 + stx GP.MLIRW.COUNT + +LB007 jmp GP.GOSYSTEM + +BS.KW.IN lda #$00 + sta BS.GetCharSep + beq LB018 + +BS.KW.PR lda #$02 + sta BS.GetCharSep + lda #$08 +LB018 ora GP.ParamINPR + asl + tax + lda GP.FoundBITS + and #$40 + beq LB035 + + lda GP.FoundBITS+1 + bmi LB04A + + lda GP.OUTVECT0,x + sta GP.ParamA + lda GP.OUTVECT0+1,x + sta GP.ParamA+1 + +LB035 jsr LB05C + bcs LB049 + + ldy BS.GetCharSep + lda GP.ParamA + sta ZP.CSW,y + lda GP.ParamA+1 + sta ZP.CSW+1,y +LB049 rts + +LB04A jsr LB05C + bcs LB05B + + lda GP.ParamA+1 + sta GP.OUTVECT0+1,x + lda GP.ParamA + sta GP.OUTVECT0,x +LB05B rts + +LB05C lda GP.ParamA + sta ZP.PCL + lda GP.ParamA+1 + sta ZP.PCH + ldy #$00 + cmp #$C0 + bcc LB081 + + lda $CFFF + sty ZP.A1L + lda (ZP.PCL),y + cmp #$FF + beq LB087 + +LB077 cmp (ZP.PCL),y + bne LB087 + + dec ZP.A1L + bne LB077 + +LB07F clc + rts + +LB081 lda (ZP.PCL),y + cmp #$D8 + beq LB07F + +LB087 lda #$03 + sec + rts + +BS.KW.BYE jsr LB562 + jsr LB36B + lda #$65 + jsr MLI + .DA #MLI.C.QUIT + .DA GP.MLIRW + +LB099 jsr MLI + .DA #MLI.C.QUIT + .DA BS.MLIQUIT2.Param +BS.MLIQUIT2.Param + .DA #4 + .DA #$EE + .DA MLI.PATHBUF + .DA #0 + .DA 0 + +BS.KW.CAT lda #$27 + bne LB0AC + +BS.KW.CATALOG lda #$4F + +LB0AC sta BS.CATWIDTH + lda GP.FoundBITS + and #$05 + lsr + bne LB0BA + + sta GP.ParamT + +LB0BA bcs LB0C1 + + jsr BS.GetFileInfo + bcs LB127 + +LB0C1 jsr LB1BA + bcs LB127 + + jsr BS.CROUT + jsr LB128 + jsr BS.LINEBUFOUT + jsr BS.CROUT + jsr BS.LINEBUFCLR80 + ldx #$10 + jsr BS.PRINTERRMSGX + jsr BS.LINEBUFOUT + jsr BS.CROUT + lda XBC14 + ora XBC15 + nop + nop + +LB0E8 jsr LB241 + bcs LB113 + + lda GP.ParamT + beq LB0F7 + + cmp DIRENTBUF.TYPE + bne LB0FD + +LB0F7 jsr LA4D2 + jsr BS.LINEBUFOUT + +LB0FD lda IO.KBD + cmp #$83 + bne LB10E + + lda GP.STATE + bne LB113 + + bit IO.KSTROBE + bcs LB113 + +LB10E nop + lda #$FF + bne LB0E8 + +LB113 jsr BS.FileClose + bcs LB127 + + jsr BS.CROUT + jsr LB157 + bcs LB127 + + jsr BS.LINEBUFOUT + jsr BS.CROUT + + clc +LB127 rts + +LB128 jsr BS.LINEBUFCLR80 + ldx #$01 + ldy DIRENTBUF.STNL + lda #$AF + cpy #$F0 + bcc LB13A + + sta IO.LINEBUF,x + inx + +LB13A tya + and #$0F + sta IO.LINEBUF + ldy #$05 + +LB142 lda DIRENTBUF,y + ora #$80 + sta IO.LINEBUF,x + iny + inx + dec IO.LINEBUF + bne LB142 + + lda #$A2 + sta IO.LINEBUF + rts + +LB157 lda #$18 + sta GP.SBUFADR + lda #$BC + sta GP.SBUFADR+1 + lda MLI.DEVNUM + sta GP.MLIMRKEOFBUF.REFNUM + lda #MLI.C.ONLINE + jsr GP.GOSYSTEM + bcs LB127 + + lda BS.CMDBUF + and #$0F + tax + inx + stx BS.CMDBUF.LEN + lda #$AF + sta BS.CMDBUF + jsr BS.GetFileInfo + bcs LB127 + + jsr BS.LINEBUFCLR80 + ldx #$36 + jsr BS.PRINTERRMSGX + jsr BS.TMPBUF3Reset + lda GP.FIAUXTYPE + ldx GP.FIAUXTYPE+1 + ldy #$3D + jsr BS.AXDEC2LINEBUFY + lda GP.FIBLOKS + ldx GP.FIBLOKS+1 + ldy #$26 + jsr BS.AXDEC2LINEBUFY + lda GP.FIAUXTYPE + sec + sbc GP.FIBLOKS + pha + lda GP.FIAUXTYPE+1 + sbc GP.FIBLOKS+1 + tax + pla + ldy #$10 + jsr BS.AXDEC2LINEBUFY + clc + rts + +LB1BA lda #$01 + ldx #$0F + ldy GP.STTYPE + cpy #$0F + bne LB1C8 + + stx GP.FITYPE + +LB1C8 jsr LB210 + bcs LB203 + +BS.ReadDirEnt lda #$59 + sta GP.MLIRW.DATAPTR + lda #$02 + sta GP.MLIRW.DATAPTR+1 + lda #$2B + sta GP.MLIRW.COUNT + lda #$00 + sta GP.MLIRW.COUNT+1 + lda #MLI.C.READ + jsr GP.GOSYSTEM + bcs LB203 + + ldx #$03 + +LB1EA lda $27C,x + sta XBC12,x + dex + bpl LB1EA + + sta GP.MLIRW.COUNT + lda #$01 + sta XBC16 + lda #$00 + sta GP.SBUFADR+1 + sta GP.SBUFADR+2 +LB203 rts + +BS.CheckFTypeXAccessA + pha + lda GP.FoundBITS + and #$04 + beq LB20F + + ldx GP.ParamT + +LB20F pla + +LB210 cpx GP.FITYPE + bne LB239 + + and GP.FIACCESS + beq LB23D + + lda XBBE3 + sta GP.OSYSBUF+1 + lda #$0F + sta MLI.LEVEL + lda #MLI.C.OPEN + jsr GP.GOSYSTEM + bcs LB238 + + lda GP.OREFNUM + sta GP.MLIRW.REFNUM + sta GP.MLICF.REFNUM + sta GP.MLIMRKEOFBUF.REFNUM + +LB238 rts + +LB239 lda #$0D + sec + rts + +LB23D lda #$0A + sec + rts + +LB241 lda GP.SBUFADR+1 + and #$FE + sta GP.SBUFADR+1 + ldy XBC16 + lda #$00 + cpy XBC13 + bcc LB25D + + tay + sty XBC16 + inc GP.SBUFADR+1 + +LB25A inc GP.SBUFADR+1 + +LB25D dey + clc + bmi LB268 + + adc XBC12 + bcc LB25D + + bcs LB25A + +LB268 adc #$04 + sta GP.SBUFADR + lda #MLI.C.SETMARK + jsr GP.GOSYSTEM + bcs LB28D + + lda #MLI.C.READ + jsr GP.GOSYSTEM + bcs LB28D + + inc XBC16 + lda DIRENTBUF + and #$F0 + beq LB241 + + dec XBC14 + bne LB28D + + dec XBC15 + +LB28D rts +BS.JMP.XTRNADDR jmp (GP.XTRNADDR) + +BS.KW.EXEC jsr BS.CheckFilename + bcs LB2C0 + + bit GP.EXECFILE + bpl LB2BC + + sta GP.MLIMRKEOFBUF.REFNUM + lda #$00 + sta GP.SBUFADR + sta GP.SBUFADR+1 + sta GP.SBUFADR+2 + lda #MLI.C.SETMARK + jsr GP.GOSYSTEM + bcs LB2B5 + + lda GP.MLIMRKEOFBUF.REFNUM + bne LB333 + +LB2B5 pha + jsr LB36B + pla + sec + rts + +LB2BC lda #$14 + sec + rts + +LB2C0 bit GP.EXECACTV + bpl LB2CA + + jsr LB36B + bcs LB2D3 + +LB2CA lda GP.FITYPE + cmp #$04 + beq LB2D5 + + lda #$0D +LB2D3 sec + rts + +LB2D5 jsr LA1F9 + bcs LB2D3 + + lda #$00 + sta GP.SBUFADR + lda XBBE3 + sta GP.SBUFADR+1 + ldx GP.OPENCNT + beq LB30E + + tay + txa + asl + asl + adc XBBE3 + pha +LB2F2 cmp XBBEE,x + beq LB2FB + + dex + bne LB2F2 + + brk + +LB2FB tya + sta XBBEE,x + lda XBBF6,x + sta GP.MLIMRKEOFBUF.REFNUM + lda #MLI.C.SETBUF + jsr GP.GOSYSTEM + bcc LB30D + + brk + +LB30D pla +LB30E sta XBBE3 + sta GP.OSYSBUF+1 + lda #$00 + sta MLI.LEVEL + lda #MLI.C.OPEN + jsr GP.GOSYSTEM + bcc LB327 + + pha + jsr LA250 + pla + sec + rts + +LB327 ldx GP.OSYSBUF+1 + stx XBBF6 + lda GP.OREFNUM + sta XBBFE +LB333 sta GP.MLIRW.REFNUM + sta GP.MLIMRKEOFBUF.REFNUM + sta GP.NEWLREF + ldx GP.FIAUXTYPE + stx GP.ParamL + ldx GP.FIAUXTYPE+1 + stx GP.ParamL+1 + jsr LB45B + lda #$7F + sta GP.NLINEMASK + lda #MLI.C.NEWLINE + jsr GP.GOSYSTEM + lda GP.FoundBITS+1 + and #$03 + beq LB364 + + jsr LB592 + bcc LB364 + + jmp LB2B5 + +LB364 lda #$FF + sta GP.EXECACTV + clc + rts + +LB36B lda GP.EXECACTV + bpl LB37B + + sta GP.EXECFILE + ldx #$08 + lda XBBF6,x + jsr LB515 + +LB37B rts + +BS.KW.X10 bcs LB3B7 + + lda GP.FoundBITS + and #$01 + bne LB38D + + ldx #$00 + jsr BS.PRINTERRX + jsr BS.CROUT + +LB38D clc + rts + + lda #$00 + beq LB39F + +BS.KW.FLUSH lda GP.FoundBITS + and #$01 + beq LB39F + + jsr BS.CheckFilename + bcs LB3A7 + +LB39F sta GP.MLICF.REFNUM + lda #MLI.C.FLUSH + jsr GP.GOSYSTEM + +LB3A7 rts + +BS.KW.03 php + jsr BS.CheckFilename + bcs LB3BB + + plp + lda #$14 + sec + rts + +LB3B3 lda #$0D + sec + rts + +LB3B7 lda #$06 +LB3B9 sec + rts + +LB3BB plp + ldx #$00 + ldy #$00 + lda GP.FoundBITS+1 + and #$10 + bne LB3CD + + stx GP.ParamL+1 + sty GP.ParamL + +LB3CD lda GP.FoundBITS + and #$04 + eor #$04 + beq LB3DB + + lda #$04 + sta GP.ParamT + +LB3DB bcc LB3FE + + beq LB3B7 + + sta GP.FITYPE + lda #$C3 + sta GP.FIACCESS + ldx GP.ParamL+1 + ldy GP.ParamL + stx GP.CRAUXTYPE+1 + stx GP.FIAUXTYPE+1 + sty GP.CRAUXTYPE + sty GP.FIAUXTYPE + jsr BS.CreateFileOrDir + bcs LB3B9 + +LB3FE lda GP.FITYPE + cmp GP.ParamT + bne LB3B3 + + cmp #$04 + bne LB41D + + ldx GP.FIAUXTYPE+1 + ldy GP.FIAUXTYPE + lda GP.FoundBITS+1 + and #$10 + bne LB41D + + stx GP.ParamL+1 + sty GP.ParamL + +LB41D jsr LA1F9 + bcs LB3B9 + + lda XBBE3 + sta GP.OSYSBUF+1 + lda #$07 + sta MLI.LEVEL + lda #MLI.C.OPEN + jsr GP.GOSYSTEM + bcc LB43B + + pha + jsr LA250 + pla + sec + rts + +LB43B lda GP.FITYPE + cmp #$0F + beq LB443 + + clc + +LB443 lda #$00 + ror + sta GP.DIRFLG + ldx GP.OPENCNT + lda XBBE3 + sta XBBEF,x + lda GP.OREFNUM + sta XBBF7,x + inc GP.OPENCNT +LB45B asl + asl + asl + asl + asl + tax + lda MLI.PATHBUF + ora GP.DIRFLG + sta XBC59,x + and #$7F + tay + cmp #$1E + bcc LB473 + + lda #$1D + +LB473 sta ZP.PCL + lda GP.ParamL + sta XBC5A,x + lda GP.ParamL+1 + sta XBC5B,x + +LB481 inx + lda MLI.PATHBUF,y + sta XBC5B,x + dey + dec ZP.PCL + bne LB481 + +BS.KW.X07 clc + rts + +BS.CheckFilename + lda GP.FoundBITS + and #$01 + bne LB49A + + lda #$10 + sec + rts + +LB49A ldx GP.OPENCNT + beq LB4B8 + + stx GP.EXECFILE + +LB4A2 stx ZP.PCH + lda XBBF6,x + jsr LB4D2 + bne LB4B3 + + ldx ZP.PCH + +LB4AE lda XBBF6,x +LB4B1 clc + rts + +LB4B3 ldx ZP.PCH + dex + bne LB4A2 + +LB4B8 lda GP.EXECACTV + bpl LB4CE + + lda XBBFE + jsr LB4D2 + bne LB4CE + + lda #$FF + sta GP.EXECFILE + ldx #$08 + bne LB4AE + +LB4CE lda #$12 + sec + rts + +LB4D2 asl + asl + asl + asl + asl + tax + lda XBC59,x + sta GP.DIRFLG + and #$7F + cmp MLI.PATHBUF + bne LB508 + + tay + cmp #$1E + bcc LB4EC + + lda #$1D + +LB4EC sta ZP.PCL + lda XBC5A,x + sta XBBFF + lda XBC5B,x + sta XBC00 + +LB4FA inx + lda MLI.PATHBUF,y + cmp XBC5B,x + bne LB508 + + dey + dec ZP.PCL + bne LB4FA + +LB508 rts + +BS.KW.X06 lda GP.FoundBITS + and #$01 + beq LB562 + + jsr BS.CheckFilename + bcs LB4B1 + +LB515 sta GP.MLICF.REFNUM + lda XBBEE,x + sta XBBE3 + bit GP.EXECFILE + bmi LB53F + + ldy GP.OPENCNT + pha + lda XBBEE,y + sta XBBEE,x + pla + sta XBBEE,y + lda XBBF6,x + pha + lda XBBF6,y + sta XBBF6,x + pla + sta XBBF6,y + +LB53F lda #$00 + sta MLI.LEVEL + lda #MLI.C.CLOSE + jsr GP.GOSYSTEM + bcs LB572 + + jsr LA250 + bit GP.EXECFILE + bpl LB55E + + pha + lda #$00 + sta GP.EXECACTV + sta GP.EXECFILE + pla + rts + +LB55E dec GP.OPENCNT + rts + +LB562 ldx GP.OPENCNT + beq LB573 + + stx GP.EXECFILE + lda XBBF6,x + jsr LB515 + bcc LB562 + +LB572 rts + +LB573 lda #$00 + sta GP.MLICF.REFNUM + lda #$07 + sta MLI.LEVEL + lda #MLI.C.CLOSE + jmp GP.GOSYSTEM + +BS.KW.CLOSE jsr BS.CheckFilename + bcs LB5EF + + sta GP.MLIRW.REFNUM + sta GP.NEWLREF + bit GP.DIRFLG + bmi LB5F0 + +LB592 lda GP.FoundBITS+1 + and #$03 + beq LB5ED + + cmp #$03 + beq LB5ED + + and #$01 + beq LB5AD + + lda GP.ParamR + sta GP.ParamF + lda GP.ParamR+1 + sta GP.ParamF+1 + +LB5AD lda #$EF + sta GP.MLIRW.COUNT + lda #$00 + sta GP.MLIRW.COUNT+1 + sta GP.MLIRW.DATAPTR + lda #$02 + sta GP.MLIRW.DATAPTR+1 + lda #$7F + sta GP.NLINEMASK + lda #MLI.C.NEWLINE + jsr GP.GOSYSTEM + bcs LB5EF + +LB5CB lda GP.ParamF + ora GP.ParamF+1 + clc + beq LB5F0 + + lda #MLI.C.READ + jsr GP.GOSYSTEM + bcs LB5EF + + lda GP.ParamF + sbc #$00 + sta GP.ParamF + lda GP.ParamF+1 + sbc #$00 + sta GP.ParamF+1 + bcs LB5CB + +LB5ED lda #$0B +LB5EF sec +LB5F0 rts + +LB5F1 lda XBBFF + sta BS.TMPBUF4 + lda XBC00 + sta BS.TMPBUF4+1 + lda #$00 + sta BS.TMPBUF4+2 + sta BS.TMPBUF4+3 + sta GP.SBUFADR + sta GP.SBUFADR+1 + sta GP.SBUFADR+2 +LB60E lsr GP.ParamR+1 + ror GP.ParamR + ldx #$00 + bcc LB62F + + clc + +LB619 lda BS.TMPBUF4,x + adc GP.SBUFADR,x + sta GP.SBUFADR,x + inx + txa + eor #$03 + bne LB619 + + bcs LB642 + + ldx BS.TMPBUF4+3 + bne LB642 + +LB62F rol BS.TMPBUF4,x + inx + txa + eor #$04 + bne LB62F + + lda GP.ParamR + ora GP.ParamR+1 + bne LB60E + + clc + rts + +LB642 lda #$02 + sec + rts + +BS.KW.X04 jsr BS.CheckFilename + bcs LB69B + + sta GP.MLIRW.REFNUM + sta GP.MLIMRKEOFBUF.REFNUM + sta GP.NEWLREF + bit GP.DIRFLG + bmi LB69C + + jsr LB6D0 + bcs LB69B + + ldx #$7F + ldy #$EF + lda GP.FoundBITS+1 + and #$10 + beq LB67C + + ldy GP.ParamL + ldx GP.ParamL+1 + bne LB6CB + + cpy #$EF + bcs LB6CB + + lda #$22 + sta IO.LINEBUF + + lda #$01 + +LB67C sta GP.MLIRW.DATAPTR + sty GP.MLIRW.COUNT + stx GP.NLINEMASK + lda #$02 + sta GP.MLIRW.DATAPTR+1 + lda #$00 + sta GP.MLIRW.COUNT+1 + lda #MLI.C.NEWLINE + jsr GP.GOSYSTEM + bcs LB69B + +LB696 lda #$FF + sta GP.IFILACTV +LB69B rts + +LB69C lda #$59 + sta GP.MLIRW.DATAPTR + lda #$02 + sta GP.MLIRW.DATAPTR+1 + lda #$01 + sta GP.CATFLAG + lda GP.FoundBITS+1 + and #$01 + clc + beq LB696 + + lda #$00 + sta GP.SBUFADR + sta GP.SBUFADR+1 + sta GP.SBUFADR+2 + lda #MLI.C.SETMARK + jsr GP.GOSYSTEM + bcs LB6CA + + lda #$FF + sta GP.IFILACTV + +LB6CA rts + +LB6CB lda #$02 + tax + sec + rts + +LB6D0 lda GP.FoundBITS+1 + and #$43 + beq LB719 + + and #$01 + beq LB6E5 + + jsr LB5F1 + bcs LB6CB + +LB6E0 jsr LB712 + bcs LB71A +LB6E5 + lda GP.FoundBITS+1 + and #$02 + beq LB6F1 + + jsr LB5AD + bcs LB71A + +LB6F1 lda GP.FoundBITS+1 + and #$40 + beq LB719 + + lda #MLI.C.GETMARK + jsr GP.GOSYSTEM + bcs LB71A + + ldx #$00 + ldy #$02 + +LB703 lda GP.ParamB,x + adc GP.SBUFADR,x + sta GP.SBUFADR,x + inx + dey + bpl LB703 + + bcs LB6CB + +LB712 lda #MLI.C.SETMARK + jsr GP.GOSYSTEM + bcs LB71A + +LB719 clc +LB71A ldx #$00 + rts + +BS.KW.X08 jsr BS.CheckFilename + bcs LB732 + + sta GP.MLIRW.REFNUM + sta GP.MLIMRKEOFBUF.REFNUM + sta GP.NEWLREF + bit GP.DIRFLG + bpl LB734 + + lda #$0A + +LB732 sec + rts + +LB734 lda #$00 + sta GP.MLIRW.DATAPTR + lda #$02 + sta GP.MLIRW.DATAPTR+1 + jsr LB6D0 + bcc LB757 + + cmp #$02 + bne LB732 + + cpx #$02 + beq LB732 + +LB74B lda #MLI.C.SETEOF + jsr GP.GOSYSTEM + bcs LB732 + + jsr LB6E0 + bcs LB732 + +LB757 lda AS.HIMEM + sta GP.MLIRW.DATAPTR + lda AS.HIMEM+1 + sta GP.MLIRW.DATAPTR+1 + lda #$FF + sta GP.OFILACTV + clc + rts + +BS.KW.X09 php + jsr BS.CheckFilename + bcc LB77A + + plp + jsr BS.KW.03 + bcs LB788 + + lda GP.OREFNUM + bne LB77B + + brk + +LB77A plp + +LB77B sta GP.MLIRW.REFNUM + sta GP.MLIMRKEOFBUF.REFNUM + bit GP.DIRFLG + bpl LB78A + + lda #$0A + +LB788 sec + rts + +LB78A ldx GP.ParamL + ldy GP.ParamL+1 + lda GP.FoundBITS+1 + and #$10 + bne LB79D + + ldx GP.FIAUXTYPE + ldy GP.FIAUXTYPE+1 +LB79D txa + pha + lda GP.MLIRW.REFNUM + lsr + ror + ror + ror + tax + pla + sta XBC5A,x + sta XBBFF + tya + sta XBC5B,x + sta XBC00 + lda #MLI.C.GETEOF + jsr GP.GOSYSTEM + bcs LB788 + + lda XBC00 + bne LB7C8 + + lda XBBFF + cmp #$02 + bcc LB7CD + +LB7C8 jsr LB7D0 + bcs LB788 + +LB7CD jmp LB74B + +LB7D0 ldx #$03 +LB7D2 lda GP.MLIMRKEOFBUF.REFNUM,x + sta XBC09,x + dex + bne LB7D2 + + stx BS.TMPBUF4+3 + stx XBC0E + ldy #$18 + +LB7E3 jsr BS.TMPBUF3x2 + rol BS.TMPBUF4+3 + rol XBC0E + sec + lda BS.TMPBUF4+3 + sbc XBBFF + tax + lda XBC0E + sbc XBC00 + bcc LB805 + + stx BS.TMPBUF4+3 + sta XBC0E + inc BS.TMPBUF4 + +LB805 dey + bne LB7E3 + + lda BS.TMPBUF4+3 + ora XBC0E + clc + beq LB839 + + lda XBBFF + sec + sbc BS.TMPBUF4+3 + tax + lda XBC00 + sbc XBC0E + tay + txa + clc + adc GP.SBUFADR + sta GP.SBUFADR + tya + adc GP.SBUFADR+1 + sta GP.SBUFADR+1 + lda GP.SBUFADR+2 + adc #$00 + sta GP.SBUFADR+2 + lda #$02 + +LB839 rts + +BS.GetFileInfo lda #$0A + sta GP.SSGINFO + lda #MLI.C.GETFILEINFO + bne LB858 + +BS.SetFileInfoNoDate + lda #$00 + sta GP.FIMDATE + sta GP.FIMDATE+1 + sta GP.FICDATE + sta GP.FICDATE+1 + +BS.SetFileInfo lda #$07 + sta GP.SSGINFO + lda #MLI.C.SETFILEINFO + +LB858 jmp GP.GOSYSTEM + +BS.JMP.GP.VSYSO jmp (GP.VSYSO) +BS.JMP.GP.VSYSI jmp (GP.VSYSI) +*-------------------------------------- +MAN +SAVE usr/src/basic.fx/basic.s.c +LOAD usr/src/basic.fx/basic.s +ASM diff --git a/BASIC.FX/BASIC.S.D.txt b/BASIC.FX/BASIC.S.D.txt new file mode 100644 index 00000000..6d242a48 --- /dev/null +++ b/BASIC.FX/BASIC.S.D.txt @@ -0,0 +1,659 @@ +NEW + AUTO 3,1 +*-------------------------------------- +BS.SYSIOVECTS .DA BS.IO.OUT + .DA BS.IO.IN + .DA BS.IO.OUT.TRACE + .DA BS.IO.IN0 + .DA BS.IO.OUT.CAT + .DA BS.IO.IN0 +BS.VSYSO.LO .DA #$A7 +BS.VSYSO.HI .DA #$9D +BS.ParamLByte .DA #$A0 + .DA #$AC + .DA #$AF + .DA #$B4 + .DA #$B4 + .DA #$C6 + .DA #$AC + .DA #$AC + .DA #$CB + .DA #$D1 + .DA #$D5 + .DA #$D5 + .DA #$DD + .DA #$DD + .DA #$C6 + .DA #$C6 + .DA #$C6 + .DA #$C6 + .DA #$C6 + .DA #$C6 +BS.BYTES .DA #$80 + .DA #$81 + .DA #$82 + .DA #$83 + .DA #$84 + .DA #$85 + .DA #$86 + .DA #$87 + .DA #$88 + .DA #$89 + .DA #$8A + .DA #$8B + .DA #$19 + .DA #$8D + .DA #$8E + .DA #$8F + .DA #$90 + .DA #$91 + .DA #$92 + .DA #$93 + .DA #$94 + .DA #$95 + .DA #$96 + .DA #$97 + .DA #$98 + .DA #$99 + .DA #$9A + .DA #$23 + .DA #$28 + .DA #$5A + .DA #$5A + .DA #$56 + .DA #$A0 + .DA #$A1 + .DA #$A2 + .DA #$A3 + .DA #$A4 + .DA #$A5 + .DA #$34 + .DA #$A7 + .DA #$A8 + .DA #$A9 + .DA #$1F + .DA #$AB + .DA #$AC + .DA #$00 + .DA #$AE + .DA #$AF + .DA #$B0 + .DA #$B1 + .DA #$B2 + .DA #$B3 + .DA #$B4 + .DA #$B5 + .DA #$B6 + .DA #$B7 + .DA #$B8 + .DA #$B9 + .DA #$00 + .DA #$BB + .DA #$13 + .DA #$BD + .DA #$BE +BS.KW.LEN .DA #$BF + .DA #$47 + .DA #$5F + .DA #$18 + .DA #$30 + .DA #$15 + .DA #$BD + .DA #$3D + .DA #$28 + .DA #$0D + .DA #$41 + .DA #$20 + .DA #$50 + .DA #$84 + .DA #$0D + .DA #$04 + .DA #$46 + .DA #$6A + .DA #$4C + .DA #$5C + .DA #$35 + .DA #$A5 + .DA #$70 + .DA #$2D + .DA #$12 + .DA #$65 + .DA #$39 + .DA #$41 + .DA #$88 + .DA #$1C + .DA #$B5 + .DA #$D8 +BS.KW.TABLE .AS "BSAVERIFYBLOADELETEBYECATALOGOPENWRITEXECREATEFRESTORENAMEBRUNLOCKCHAIN#FLUSHREADPOSITIONOMONPR#PREFIXCLOSEAPPEND" +BS.KW.JMP .DA BS.JMP.XTRNADDR + .DA BS.KW.PR + .DA BS.KW.IN + .DA BS.KW.CAT + .DA BS.KW.01 + .DA BS.KW.BYE + .DA BS.KW.02 + .DA BS.KW.BRUN + .DA BS.KW.EXEC + .DA BS.KW.RESTORE + .DA BS.KW.LOCK + .DA BS.KW.03 + .DA BS.KW.X04 + .DA BS.KW.STORE + .DA BS.KW.BLOAD + .DA BS.KW.BSAVE + .DA BS.KW.X05 + .DA BS.KW.X06 + .DA BS.KW.FLUSH + .DA BS.KW.X07 + .DA BS.KW.SAVE + .DA BS.KW.X08 + .DA BS.KW.X09 + .DA BS.KW.CREATE + .DA BS.KW.DELETE + .DA BS.KW.PREFIX + .DA BS.KW.RENAME + .DA BS.KW.UNLOCK + .DA BS.KW.X10 + .DA BS.KW.CATALOG + .DA BS.KW.LOAD + .DA BS.KW.CLOSE + .DA BS.KW.APPEND +BS.KW.PBITS .DA $8040 + .DA $8040 + .DA $0495 + .DA $0000 + .DA $0000 + .DA $0C11 + .DA $F401 + .DA $0701 + .DA $0401 + .DA $0401 + .DA $142D + .DA $5321 + .DA $0409 + .DA $F405 + .DA $F40D + .DA $0C01 + .DA $0001 + .DA $0001 + .DA $0000 + .DA $0409 + .DA $4321 + .DA $142D + .DA $040D + .DA $0401 + .DA $0491 + .DA $0403 + .DA $0401 + .DA $0411 + .DA $0495 + .DA $0401 + .DA $0321 + .DA $0401 +BS.KW.OPT .AS "ABELSDFRV@" +BS.KW.OPT.PBITSLO + .DA #$80 + .DA #$40 + .DA #$20 + .DA #$10 + .DA #$04 + .DA #$04 + .DA #$02 + .DA #$01 + .DA #$00 + .DA #$08 +BS.KW.OPT.PBITSHI + .DA #$05 + .DA #$12 + .DA #$19 + .DA #$21 + .DA #$24 + .DA #$28 + .DA #$31 + .DA #$39 + .DA #$40 + .DA #$45 +BS.PRODOSTYPES.H + .DA #$FF + .DA #$FE + .DA #$FD + .DA #$FC + .DA #$FB + .DA #$FA + .DA #$F0 + .DA #$0F + .DA #$06 + .DA #$04 + .DA #$EF + .DA #$1A + .DA #$1B + .DA #$19 + .DA #$B3 +BS.PRODOSTYPES.ASC + .AS -"S16ADBASPAWPPASTXTBINDIRCMDINTIVRBASVARRELSYS" +BS.MONTHS .AS -"JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC" +BS.NODATE .AS -"" +BS.MLIERTBL .DA #$28 + .DA #$2B + .DA #$40 + .DA #$41 + .DA #$42 + .DA #$43 + .DA #$44 + .DA #$45 + .DA #$46 + .DA #$47 + .DA #$48 + .DA #$49 + .DA #$4B + .DA #$4C + .DA #$4D + .DA #$4E + .DA #$50 + .DA #$53 + .DA #$56 +BS.BIERRTBL .DA #$03 + .DA #$04 + .DA #$10 + .DA #$0C + .DA #$0C + .DA #$12 + .DA #$06 + .DA #$06 + .DA #$07 + .DA #$13 + .DA #$09 + .DA #$11 + .DA #$0D + .DA #$05 + .DA #$02 + .DA #$0A + .DA #$14 + .DA #$0B + .DA #$0C +BS.ERRCODES .DA #$08 + .DA #$54 + .DA #$5B + .DA #$66 + .DA #$6F + .DA #$75 + .DA #$75 + .DA #$7E + .DA #$84 + .DA #$8A + .DA #$91 + .DA #$9B + .DA #$A8 + .DA #$B4 + .DA #$BF + .DA #$C9 + .DA #$D1 + .DA #$D9 + .DA #$E1 + .DA #$EC +BS.TBL6 .DA #$F3 + .DA #$C1 + .DA #$C3 + .DA #$C4 + .DA #$C5 + .DA #$C6 + .DA #$C9 + .DA #$CC + .DA #$CD + .DA #$CE + .DA #$CF + .DA #$D2 + .DA #$D4 + .DA #$D5 + .DA #$A0 + .DA #$00 + .DA #$00 + .DA #$C2 + .DA #$C7 + .DA #$C8 + .DA #$CB + .DA #$D0 + .DA #$D3 + .DA #$D6 + .DA #$D7 + .DA #$D8 + .DA #$D9 + .DA #$AF + .DA #$A8 + .DA #$A9 + .DA #$AE + .DA #$BA +BS.TBL7 .DA #$2A + .DA #$05 + .DA #$0A + .DA #$B6 + .DA #$02 + .DA #$03 + .DA #$CE + .DA #$10 + .DA #$50 + .DA #$57 + .DA #$4E + .DA #$2A + .DA #$80 + .DA #$5D + .DA #$C4 + .DA #$BF + .DA #$E9 + .DA #$18 + .DA #$4E + .DA #$00 + .DA #$10 + .DA #$C0 + .DA #$A0 + .DA #$54 + .DA #$EE + .DA #$01 + .DA #$7A + .DA #$20 + .DA #$40 + .DA #$6E + .DA #$00 + .DA #$1E + .DA #$8A + .DA #$36 + .DA #$56 + .DA #$43 + .DA #$00 + .DA #$2F + .DA #$2B + .DA #$41 + .DA #$C4 + .DA #$3E + .DA #$00 + .DA #$40 + .DA #$49 + .DA #$35 + .DA #$67 + .DA #$4E + .DA #$06 + .DA #$D0 + .DA #$1C + .DA #$0A + .DA #$05 + .DA #$4F + .DA #$01 + .DA #$7A + .DA #$20 + .DA #$40 + .DA #$6E + .DA #$5B + .DA #$44 + .DA #$0F + .DA #$00 + .DA #$16 + .DA #$01 + .DA #$7A + .DA #$20 + .DA #$40 + .DA #$6E + .DA #$D0 + .DA #$64 + .DA #$30 + .DA #$FE + .DA #$00 + .DA #$2C + .DA #$CA + .DA #$C1 + .DA #$7E + .DA #$01 + .DA #$7A + .DA #$20 + .DA #$40 + .DA #$60 + .DA #$FF + .DA #$B1 + .DA #$90 + .DA #$24 + .DA #$E4 + .DA #$BB + .DA #$AB + .DA #$F0 + .DA #$9A + .DA #$E3 + .DA #$40 + .DA #$76 + .DA #$24 + .DA #$E2 + .DA #$A9 + .DA #$94 + .DA #$2C + .DA #$43 + .DA #$F0 + .DA #$08 + .DA #$B6 + .DA #$C4 + .DA #$E0 + .DA #$5B + .DA #$AC + .DA #$42 + .DA #$C4 + .DA #$3F + .DA #$49 + .DA #$3E + .DA #$A5 + .DA #$E3 + .DA #$1C + .DA #$1F + .DA #$05 + .DA #$1C + .DA #$03 + .DA #$E9 + .DA #$AC + .DA #$E5 + .DA #$AD + .DA #$93 + .DA #$F0 + .DA #$60 + .DA #$BA + .DA #$E4 + .DA #$BB + .DA #$AB + .DA #$F0 + .DA #$36 + .DA #$06 + .DA #$04 + .DA #$E5 + .DA #$D7 + .DA #$7F + .DA #$56 + .DA #$74 + .DA #$E7 + .DA #$A2 + .DA #$04 + .DA #$43 + .DA #$F0 + .DA #$69 + .DA #$07 + .DA #$17 + .DA #$63 + .DA #$E0 + .DA #$51 + .DA #$B1 + .DA #$84 + .DA #$C4 + .DA #$BF + .DA #$9A + .DA #$E0 + .DA #$1D + .DA #$55 + .DA #$4B + .DA #$06 + .DA #$E1 + .DA #$07 + .DA #$16 + .DA #$71 + .DA #$01 + .DA #$74 + .DA #$F0 + .DA #$56 + .DA #$74 + .DA #$EC + .DA #$0A + .DA #$05 + .DA #$4E + .DA #$86 + .DA #$06 + .DA #$81 + .DA #$C2 + .DA #$03 + .DA #$F0 + .DA #$05 + .DA #$BA + .DA #$02 + .DA #$B1 + .DA #$8E + .DA #$CA + .DA #$AE + .DA #$71 + .DA #$B0 + .DA #$24 + .DA #$F0 + .DA #$9A + .DA #$CE + .DA #$36 + .DA #$B4 + .DA #$2C + .DA #$E2 + .DA #$A8 + .DA #$81 + .DA #$93 + .DA #$F0 + .DA #$06 + .DA #$0A + .DA #$9C + .DA #$10 + .DA #$9E + .DA #$4B + .DA #$BA + .DA #$BF + .DA #$36 + .DA #$B4 + .DA #$2C + .DA #$AB + .DA #$0A + .DA #$E5 + .DA #$D7 + .DA #$7F + .DA #$56 + .DA #$74 + .DA #$E9 + .DA #$AC + .DA #$EA + .DA #$05 + .DA #$49 + .DA #$F0 + .DA #$3D + .DA #$05 + .DA #$76 + .DA #$21 + .DA #$C4 + .DA #$E5 + .DA #$67 + .DA #$4E + .DA #$91 + .DA #$84 + .DA #$F0 + .DA #$56 + .DA #$74 + .DA #$E0 + .DA #$1D + .DA #$06 + .DA #$0A + .DA #$F0 + .DA #$56 + .DA #$74 + .DA #$0C + .DA #$06 + .DA #$0D + .DA #$E0 + .DA #$6C + .DA #$67 + .DA #$7E + .DA #$A0 + .DA #$54 + .DA #$9F + +XBBB5 .BS 2 +XBBB7 .BS 1 +XBBB8 .BS 1 +BS.IsIntCmdMTR ldy #$02 +LBBBB lda BS.CMDBUF,y + cmp BS.MTR,y + bne LBBCF + dey + bpl LBBBB + jsr BS.SetState0 + jsr MON.CLREOL + jmp MON.ENTERMON +LBBCF jmp BS.IsIntCmd + +BS.MTR .AS "MTR" +BS.IVERSION .DA #5 + +BS.AS.HIMEMSave .BS 1 +XBBD7 .BS 1 +XBBD8 .BS 1 + +XBBD9 .DA #4 +XBBDA .BS 1 +XBBDB .BS 1 +XBBDC .BS 1 +XBBDD .BS 1 + +BS.TXTTAB .DA $0800 +BS.MEMSIZE .DA $9600 + +XBBE2 .BS 1 +XBBE3 .BS 1 + +BS.BAS.HDR .BS 5 +XBBE9 .BS 1 +XBBEA .BS 1 +XBBEB .BS 1 +XBBEC .BS 1 +XBBED .BS 1 +XBBEE .BS 1 +XBBEF .BS 7 +XBBF6 .BS 1 +XBBF7 .BS 7 +XBBFE .BS 1 +XBBFF .BS 1 +XBC00 .BS 3 +BS.CALLX .BS 1 +BS.GetCharSep .BS 1 +BS.GetCharMax .BS 1 +BS.KW.JMPADDR .BS 2 +XBC08 .BS 1 +XBC09 .BS 1 + +BS.TMPBUF4 .BS 4 + +XBC0E .BS 1 +XBC0F .BS 1 +XBC10 .BS 1 + +BS.CATWIDTH .BS 1 + +XBC12 .BS 1 +XBC13 .BS 1 +XBC14 .BS 1 +XBC15 .BS 1 +XBC16 .BS 1 + +BS.CMDBUF.LEN .BS 1 +BS.CMDBUF .BS 65 + +XBC59 .BS 1 +XBC5A .BS 1 +XBC5B .BS 165 +*-------------------------------------- +MAN +SAVE usr/src/basic.fx/basic.s.d +LOAD usr/src/basic.fx/basic.s +ASM diff --git a/BASIC.FX/BASIC.S.GP..txt b/BASIC.FX/BASIC.S.GP..txt new file mode 100644 index 00000000..37fe2087 --- /dev/null +++ b/BASIC.FX/BASIC.S.GP..txt @@ -0,0 +1,155 @@ +NEW + AUTO 3,1 +*-------------------------------------- +GP.ENTRY jmp BS.ENTRY +GP.DOSCMD jmp BS.DOSCMD +GP.EXTRNCMD jmp GP.RTS +GP.ERROUT jmp BS.ERROUT +GP.PRINTERR jmp BS.PRINTERR +GP.ERRCODE .BS 1 +*-------------------------------------- +GP.OUTVECT0 .DA MON.COUT1 +GP.OUTVECT1 .DA BS.NODEVERR +GP.OUTVECT2 .DA BS.NODEVERR +GP.OUTVECT3 .DA BS.NODEVERR +GP.OUTVECT4 .DA BS.NODEVERR +GP.OUTVECT5 .DA BS.NODEVERR +GP.OUTVECT6 .DA BS.NODEVERR +GP.OUTVECT7 .DA BS.NODEVERR +GP.INVECT0 .DA MON.KEYIN +GP.INVECT1 .DA BS.NODEVERR +GP.INVECT2 .DA BS.NODEVERR +GP.INVECT3 .DA BS.NODEVERR +GP.INVECT4 .DA BS.NODEVERR +GP.INVECT5 .DA BS.NODEVERR +GP.INVECT6 .DA BS.NODEVERR +GP.INVECT7 .DA BS.NODEVERR +GP.VECTOUT .DA MON.COUT1 +GP.VECTIN .DA MON.KEYIN +GP.VDOSO .DA BS.JMP.GP.VSYSO +GP.VDOSI .DA BS.JMP.GP.VSYSI +GP.VSYSO .BS 2 +GP.VSYSI .BS 2 +GP.VDEFSLT .DA #6 +GP.VDEFDRV .DA #1 +GP.PREGA .BS 1 +GP.PREGX .BS 1 +GP.PREGY .BS 1 +GP.DTRACE .BS 1 +GP.STATE .BS 1 +GP.EXECACTV .BS 1 +GP.IFILACTV .BS 1 +GP.OFILACTV .BS 1 +GP.PFXACTV .BS 1 +GP.DIRFLG .BS 1 +GP.EDIRFLG .BS 1 +GP.STRINGS .BS 1 +GP.TBUFPTR .BS 1 +GP.INPTR .BS 1 +GP.CHRLAST .BS 1 +GP.OPENCNT .BS 1 +GP.EXECFILE .BS 1 +GP.CATFLAG .BS 1 +GP.XTRNADDR .BS 2 +GP.XLEN .BS 1 +GP.XCNUM .BS 1 +GP.AllowedBITS .BS 2 +GP.FoundBITS .BS 2 +GP.ParamA .BS 2 +GP.ParamB .BS 3 +GP.ParamE .BS 2 +GP.ParamL .BS 2 +GP.ParamS .BS 1 +GP.ParamD .BS 1 +GP.ParamF .BS 2 +GP.ParamR .BS 2 +GP.ParamV .BS 1 +GP.ParamAT .BS 2 +GP.ParamT .BS 1 +GP.ParamINPR .BS 1 +GP.VPATH1 .DA BS.CMDBUF.LEN +GP.VPATH2 .DA MLI.PATHBUF +*-------------------------------------- +GP.GOSYSTEM sta GP.GOSYSTEM.C + stx BS.CALLX + and #$1F + tax + lda BS.ParamLByte,x + sta GP.GOSYSTEM.P + ldx BS.CALLX + jsr MLI +GP.GOSYSTEM.C .BS 1 +GP.GOSYSTEM.P .DA GP.GOSYSTEM.P + bcs GP.BADCALL + rts +*-------------------------------------- +GP.BADCALL ldx #$12 + +LBE8D cmp BS.MLIERTBL,x + beq LBE97 + + dex + bpl LBE8D + + ldx #$13 + +LBE97 lda BS.BIERRTBL,x + ldx BS.CALLX + sec + +GP.RTS rts +*-------------------------------------- +GP.CISPARE1 .BS 1 +GP.SCREATE .DA #7 +GP.SCREATEPATH .DA BS.CMDBUF.LEN +GP.CRACCESS .DA #$C3 +GP.CRTYPE .BS 1 +GP.CRAUXTYPE .BS 2 +GP.CRSTTYPE .BS 1 +GP.DATETIME .BS 4 +GP.SDSTROY .DA #1 +GP.SDSTROYPATH .DA BS.CMDBUF.LEN +GP.SRECNAME .DA #2 +GP.SRECNAMEOLD .DA BS.CMDBUF.LEN +GP.SRECNAMENEW .DA MLI.PATHBUF +GP.SSGINFO .BS 1 +GP.SSGINFOPATH .DA BS.CMDBUF.LEN +GP.FIACCESS .BS 1 +GP.FITYPE .BS 1 +GP.FIAUXTYPE .BS 2 +GP.STTYPE .BS 1 +GP.FIBLOKS .BS 2 +GP.FIMDATE .BS 2 +GP.FICDATE .BS 2 + + .BS 4 + +GP.MLIMRKEOFBUF .DA #2 +GP.MLIMRKEOFBUF.REFNUM + .BS 1 +GP.SBUFADR .BS 3 +GP.SOPEN .DA #3 +GP.TXTBUF .DA BS.CMDBUF.LEN +GP.OSYSBUF .BS 2 +GP.OREFNUM .BS 1 +GP.SNEWLIN .DA #3 +GP.NEWLREF .BS 1 +GP.NLINEMASK .DA #$7F +GP.NLINECHAR .DA #13 +GP.MLIRW .DA #4 +GP.MLIRW.REFNUM .BS 1 +GP.MLIRW.DATAPTR .BS 2 +GP.MLIRW.COUNT .BS 2 +GP.MLIRW.TRANS .BS 2 +GP.MLICF .DA #1 +GP.MLICF.REFNUM .BS 1 +GP.CCCSPARE .BS 1 +GP.COPYRIGHT .AS -"COPYRIGHT APPLE, 1983" +GP.GETBUFR jmp BS.GETBUFR +GP.FREEBUFR jmp BS.FREEBUFR +GP.RSHIMEM .BS 5 +*-------------------------------------- +MAN +SAVE usr/src/basic.fx/basic.s.gp +LOAD usr/src/basic.fx/basic.s +ASM diff --git a/BASIC.FX/BASIC.S.LDR.txt b/BASIC.FX/BASIC.S.LDR.txt new file mode 100644 index 00000000..c3a2a70c --- /dev/null +++ b/BASIC.FX/BASIC.S.LDR.txt @@ -0,0 +1,310 @@ +NEW + AUTO 3,1 +*-------------------------------------- +LDR.START jmp LDR.START1 +LDR.SIG .DA $EEEE + .DA #MLI.MAXPATH+1 +LDR.STARTUP.LEN .DA #7 +LDR.STARTUP .AS "STARTUP" + .BS MLI.MAXPATH-7 +LDR.START1 lda #$9A + sta Ptr2+1 + lda #$24 + sta Ptr1+1 + lda #$00 + sta Ptr1 + sta Ptr2 + ldx #$23 + tay + jsr LDR.MoveXpages + ldx #$01 + lda #$BE + sta Ptr2+1 + jsr LDR.MoveXpages + lda #$15 + jsr MON.COUT + jsr MON.SETNORM + jsr MON.INIT + jsr MON.MON + ldx #$17 + lda #$00 + +L2076 sta MLI.MEMTABL,x + dex + bne L2076 + + lda #$CF + sta MLI.MEMTABL + lda #$3F + sta MLI.MEMTABL+19 + lda #$FF + sta MLI.MEMTABL+20 + sta MLI.MEMTABL+21 + sta MLI.MEMTABL+22 + lda #$C3 + sta MLI.MEMTABL+23 + lda AS.COLDBOOT + cmp #$4C + bne L20B1 + + lda MLI.MACHID + and #$20 + beq L20B1 + + ldx #$03 + +L20A6 lda LDR.CSWVECT,x + sta ZP.CSW,x + dex + bpl L20A6 + + jmp AS.COLDBOOT + +L20B1 ldx #$27 + +L20B3 lda LDR.UNABLE,x + sta $628,x + dex + bpl L20B3 + + sta MON.POWERUPBYTE + sta MON.POWERUP+1 + +L20C2 bmi L20C2 + +LDR.MoveXpages dey + lda (Ptr1),y + sta (Ptr2),y + tya + bne LDR.MoveXpages + + inc Ptr1+1 + inc Ptr2+1 + dex + bne LDR.MoveXpages + +L20D3 rts + +LDR.CSW cmp #$DD + bne L20D3 + + lda GP.OUTVECT0 + sta ZP.CSW + lda GP.OUTVECT0+1 + sta ZP.CSW+1 + lda MLI.DEVNUM + sta LDR.ONLINE.P.DEVNUM + ldx #$01 + asl + bcc L20EE + + inx + +L20EE stx GP.VDEFDRV + asl + rol + rol + rol + and #$07 + sta GP.VDEFSLT + ldx #$C1 + ldy #$02 + lda MLI.SLTBYT + lsr + +L2102 lsr + pha + bcc L2115 + + lda #$00 + sta GP.OUTVECT0,y + sta GP.INVECT0,y + txa + sta GP.OUTVECT0+1,y + sta GP.INVECT0+1,y + +L2115 iny + iny + inx + pla + bne L2102 + + lda #$96 + sta AS.HIMEM+1 + sta AS.STRINGSTART+1 + sta GP.RSHIMEM + lda MLI.PFIXPTR + beq L214E + + jsr MLI + .DA #MLI.C.GETPREFIX + .DA LDR.GETSETPFX2.P + bne L218B + + ldx MLI.PATHBUF + lda #$2F + +L2136 cmp MLI.PATHBUF,x + bne L213E + + inc LDR.PFXLEN + +L213E dex + bne L2136 + + lda LDR.PFXLEN + cmp #$03 + bcs L216F + + jsr MLI + .DA #MLI.C.SETPREFIX + .DA LDR.GETSETPFX1.P + +L214E jsr MLI + .DA #MLI.C.ONLINE + .DA LDR.ONLINE.P + bne L218B + + lda MLI.PATHBUF+1 + and #$0F + beq L218B + + tax + inx + stx MLI.PATHBUF + lda #$2F + sta MLI.PATHBUF+1 + jsr MLI + .DA #MLI.C.SETPREFIX + .DA LDR.GETSETPFX2.P + bne L218B + +L216F jsr MLI + .DA #MLI.C.GETFILEINFO + .DA LDR.GFINFO.P + bne L218B + + ldx LDR.STARTUP.LEN + stx LDR.STARTUP.LEN1 + +L217D lda LDR.STARTUP.LEN,x + sta IO.LINEBUF,x + dex + bne L217D + + lda #$AD + sta IO.LINEBUF + +L218B lda LDR.PFXLEN + cmp #$03 + bcs L2198 + + jsr MLI + .DA #MLI.C.SETPREFIX + .DA LDR.GETSETPFX1.P + +L2198 lda LDR.STARTUP.LEN1 + bne L21C1 + + jsr LDR.KSW + ldx #$1C + +L21A2 lda LDR.PRODOSBASIC,x + sta $400,x + dex + bpl L21A2 + + ldx #$1F + +L21AD lda LDR.COPYRIGHT,x + sta $480,x + dex + bpl L21AD + + lda #$8D + jsr MON.COUT1 + jsr MON.COUT1 + jsr MON.COUT1 + +L21C1 ldx #$02 +L21C3 lda LDR.JMP.GP.ENTRY,x + sta DOS.WARMSTART,x + sta DOS.COLDSTART,x + sta MON.USRJMP,x + lda LDR.AMPERSANDJMP,x + sta MON.AMPERSANDJMP,x + dex + bpl L21C3 + + lda LDR.BRKVECT + sta MON.BRKVECT + lda LDR.BRKVECT+1 + sta MON.BRKVECT+1 + lda LDR.POWERUP + sta MON.POWERUP + lda LDR.POWERUP+1 + sta MON.POWERUP+1 + eor #$A5 + sta MON.POWERUPBYTE + lda #$A5 + sta AS.TRCFLG + lda BS.IVERSION + sta MLI.IVERSION + +LDR.JMP.GP.ENTRY + jmp GP.ENTRY + +LDR.BRKVECT .DA MON.BREAKV +LDR.POWERUP .DA GP.ENTRY + +LDR.AMPERSANDJMP + jmp GP.DOSCMD + +LDR.KSW lda GP.INVECT0 + sta ZP.KSW + lda GP.INVECT0+1 + sta ZP.KSW+1 + ldx LDR.STARTUP.LEN + inx + lda #$8D + rts + +LDR.CSWVECT .DA LDR.CSW +LDR.KSWVECT .DA LDR.KSW +LDR.GFINFO.P .DA #10 +LDR.GFINFO.P.PATHBUF + .DA LDR.STARTUP.LEN + + .BS 16 + +LDR.GETSETPFX1.P + .DA #1 +LDR.GETSETPFX1.P.BUF + .DA LDR.GETSETPFX1.SLASHLEN +LDR.GETSETPFX1.SLASHLEN + .DA #1 +LDR.GETSETPFX1.SLASH + .AS "/" +LDR.STARTUP.LEN1 + .DA #0 +LDR.ONLINE.P + .DA #2 +LDR.ONLINE.P.DEVNUM + .DA #$70 +LDR.ONLINE.P.BUF + .DA MLI.PATHBUF+1 +LDR.GETSETPFX2.P + .DA #1 +LDR.GETSETPFX2.P.BUF + .DA MLI.PATHBUF +LDR.PFXLEN .DA #0 + +LDR.UNABLE .AS -"*** UNABLE TO EXECUTE BASIC SYSTEM ***" +LDR.PRODOSBASIC .AS -" PRODOS BASIC 1.5 " +LDR.COPYRIGHT .AS -" COPYRIGHT APPLE 1983-92" + .BS $2400-* +*-------------------------------------- +MAN +SAVE usr/src/basic.fx/basic.s.ldr +LOAD usr/src/basic.fx/basic.s +ASM diff --git a/BASIC.FX/BASIC.S.txt b/BASIC.FX/BASIC.S.txt new file mode 100644 index 00000000..4154900a --- /dev/null +++ b/BASIC.FX/BASIC.S.txt @@ -0,0 +1,163 @@ +NEW + AUTO 3,1 + .LIST OFF + .OP 6502 + .OR $2000 + .TF BASIC.FX,TSYS +*-------------------------------------- +Ptr1 .EQ 0 +Ptr2 .EQ 2 + +ZP.WNDLFT .EQ $20 +ZP.WNDWDT .EQ $21 +ZP.WNDTOP .EQ $22 +ZP.WNDBOT .EQ $23 +ZP.CH .EQ $24 +ZP.CV .EQ $25 +ZP.BASL .EQ $28 +ZP.BASH .EQ $29 + +ZP.PROMPT .EQ $33 + +ZP.CSW .EQ $36 +ZP.KSW .EQ $38 + +ZP.PCL .EQ $3A +ZP.PCH .EQ $3B +ZP.A1L .EQ $3C +ZP.A1H .EQ $3D +ZP.A2L .EQ $3E +ZP.A2H .EQ $3F + +AS.LINNUM .EQ $50 +AS.PGRMSTART .EQ $67 +AS.VARSTART .EQ $69 +AS.ARRAYSTART .EQ $6B +AS.ARRAYEND .EQ $6D +AS.STRINGSTART .EQ $6F +AS.STRINGPTR .EQ $71 +AS.HIMEM .EQ $73 +AS.CURLINE .EQ $75 +AS.LOWTR .EQ $9B +AS.PGRMEND .EQ $AF +AS.TXTPTR .EQ $B8 +AS.ERRFLG .EQ $D8 +AS.ERRNUM .EQ $DE +AS.TRCFLG .EQ $F2 +AS.REMSTK .EQ $F8 +*-------------------------------------- +IO.LINEBUF .EQ $200 +*-------------------------------------- +DIRENTBUF .EQ $259 +DIRENTBUF.STNL .EQ $25D +DIRENTBUF.TYPE .EQ $269 + +DIRENTBUF.UBLK .EQ $26C +DIRENTBUF.EOF .EQ $26E + +DIRENTBUF.ACCESS .EQ $277 +DIRENTBUF.AUXT .EQ $278 + +MLI.PATHBUF .EQ $280 +*-------------------------------------- +DOS.WARMSTART .EQ $03D0 +DOS.COLDSTART .EQ $03D3 +DOS.FILEMGR .EQ $03D6 +DOS.RWTS .EQ $03D9 +DOS.FILEMGRPARM .EQ $03DC +DOS.RWTSPARM .EQ $03E3 +DOS.RECONNECT .EQ $03DA +DOS.JMPBRKVECT .EQ $03EF + +MON.AMPERSANDJMP .EQ $03F5 +MON.USRJMP .EQ $03F8 +MON.NMIJMP .EQ $03FB +MON.IRQVECT .EQ $03FE +MON.BRKVECT .EQ $03F0 +MON.POWERUP .EQ $03F2 +MON.POWERUPBYTE .EQ $03F4 +*-------------------------------------- +MLI.MAXPATH .EQ 64 +MLI.C.ALLOCIRQ .EQ $40 +MLI.C.DEALLOCIRQ .EQ $41 +MLI.C.ATALK .EQ $42 +MLI.C.QUIT .EQ $65 +MLI.C.READBLOCK .EQ $80 +MLI.C.WRITEBLOCK .EQ $81 +MLI.C.GETTIME .EQ $82 +MLI.C.CREATE .EQ $C0 +MLI.C.DESTROY .EQ $C1 +MLI.C.RENAME .EQ $C2 +MLI.C.SETFILEINFO .EQ $C3 +MLI.C.GETFILEINFO .EQ $C4 +MLI.C.ONLINE .EQ $C5 +MLI.C.SETPREFIX .EQ $C6 +MLI.C.GETPREFIX .EQ $C7 +MLI.C.OPEN .EQ $C8 +MLI.C.NEWLINE .EQ $C9 +MLI.C.READ .EQ $CA +MLI.C.WRITE .EQ $CB +MLI.C.CLOSE .EQ $CC +MLI.C.FLUSH .EQ $CD +MLI.C.SETMARK .EQ $CE +MLI.C.GETMARK .EQ $CF +MLI.C.SETEOF .EQ $D0 +MLI.C.GETEOF .EQ $D1 +MLI.C.SETBUF .EQ $D2 +MLI.C.GETBUF .EQ $D3 +*-------------------------------------- +MLI .EQ $BF00 +MLI.DEVNUM .EQ $BF30 +MLI.DEVCNT .EQ $BF31 +MLI.DEVLST .EQ $BF32 +MLI.MEMTABL .EQ $BF58 +MLI.LEVEL .EQ $BF94 +MLI.MACHID .EQ $BF98 +MLI.SLTBYT .EQ $BF99 +MLI.PFIXPTR .EQ $BF9A +MLI.MLIACTV .EQ $BF9B +MLI.IVERSION .EQ $BFFD +*-------------------------------------- +IO.KBD .EQ $C000 +IO.KSTROBE .EQ $C010 +*-------------------------------------- +AS.RESTART .EQ $D43C +AS.RESTART1 .EQ $D43F +AS.FINDLINE .EQ $D61A +AS.CLEAR1 .EQ $D665 +AS.NEXTSTMT .EQ $D7D2 +AS.EXECSTMT .EQ $D820 +AS.BITERRFLG .EQ $D865 +AS.NORMAL .EQ $F273 +AS.COLDBOOT .EQ $E000 +AS.INTPRINTAX .EQ $ED24 +*-------------------------------------- +MON.BREAKV .EQ $FA59 +MON.INIT .EQ $FB2F +MON.MON .EQ $FC58 +MON.CLREOL .EQ $FC9C +MON.RDKEY .EQ $FD0C +MON.KEYIN0 .EQ $FD10 +MON.KEYIN .EQ $FD1B +MON.GETLN .EQ $FD6A +MON.COUT .EQ $FDED +MON.COUT1 .EQ $FDF0 +MON.IIGSID .EQ $FE1F +MON.SETINV .EQ $FE80 +MON.SETNORM .EQ $FE84 +MON.ENTERMON .EQ $FF69 +*-------------------------------------- + .INB usr/src/basic.fx/basic.s.ldr +LDR.9A00.CODE .PH $9A00 + .INB usr/src/basic.fx/basic.s.a + .INB usr/src/basic.fx/basic.s.b + .INB usr/src/basic.fx/basic.s.c + .INB usr/src/basic.fx/basic.s.d + .EP +LDR.BE00.CODE .PH $BE00 + .INB usr/src/basic.fx/basic.s.gp + .EP +*-------------------------------------- +MAN +SAVE usr/src/basic.fx/basic.s +ASM diff --git a/BIN/CC.S.F.txt b/BIN/CC.S.F.txt index 57540cc3..ab2dce82 100644 --- a/BIN/CC.S.F.txt +++ b/BIN/CC.S.F.txt @@ -232,7 +232,9 @@ CC.F.CallRetV sec lda #0 Expected T/Q = 0 if VARIADIC tay -.4 jsr CC.EXP.Eval +.4 and #$F0 CONST+VOLATILE+FUNC+FASTCALL + + jsr CC.EXP.Eval bcs .93 jsr CC.SYM.GetYASizeOfInAXC diff --git a/BIN/CHAUX.S.txt b/BIN/CHAUX.S.txt new file mode 100644 index 00000000..69deebae --- /dev/null +++ b/BIN/CHAUX.S.txt @@ -0,0 +1,361 @@ +NEW + AUTO 3,1 + .LIST OFF + .OP 65C02 + .OR $2000 + .TF bin/chaux +*-------------------------------------- + .INB inc/macros.i + .INB inc/a2osx.i + .INB inc/mli.i + .INB inc/mli.e.i +*-------------------------------------- +X.ENTER.SUBDIR .EQ 0 +X.COPY.TO.DEST .EQ 0 +X.DELETE.SOURCE .EQ 0 +*-------------------------------------- +* Zero Page Segment, up to 32 bytes +*-------------------------------------- + .DUMMY + .OR ZPBIN +ZS.START + +ZPPtr1 .BS 2 +ZPPtr2 .BS 2 +ZPFileName .BS 2 +ZPFileStat .BS 2 + +ZPFullPath .BS 2 + +ArgIndex .BS 1 +bAuxFileType .BS 1 +AuxFileType .BS 2 + +hSrcFullPath .BS 1 +bPause .BS 1 + +bContinue .BS 1 +bRecurse .BS 1 + +ZS.END .ED +*-------------------------------------- +* File Header (16 Bytes) +*-------------------------------------- +CS.START cld + jmp (.1,x) + .DA #$61 6502,Level 1 (65c02) + .DA #1 BIN Layout Version 1 + .DA #0 S.PS.F.EVENT + .DA #0 + .DA CS.END-CS.START Code Size (without Constants) + .DA DS.END-DS.START Data SegmentSize + .DA #16 Stack Size + .DA #ZS.END-ZS.START Zero Page Size + .DA 0 +*-------------------------------------- +* Relocation Table +*-------------------------------------- +.1 .DA CS.INIT + .DA CS.RUN + .DA CS.DOEVENT + .DA CS.QUIT +*-------------------------------------- +L.MSG.USAGE .DA MSG.USAGE +L.MSG.FILE .DA MSG.FILE +L.MSG.OK .DA MSG.OK +L.MSG.ERR .DA MSG.ERR +L.SSCANF.D .DA SSCANF.D +L.SSCANF.H .DA SSCANF.H + .DA 0 +*-------------------------------------- +CS.INIT clc + rts +*-------------------------------------- +CS.RUN inc ArgIndex + lda ArgIndex + >SYSCALL ArgV + bcs .7 + + >STYA ZPPtr1 + lda (ZPPtr1) + cmp #'-' + bne .4 + + ldy #1 + lda (ZPPtr1),y + + ldx #OptionVars-OptionList-1 +.2 cmp OptionList,x + beq .3 + + dex + bne .2 + +.99 >PUSHW L.MSG.USAGE + >PUSHBI 0 + >SYSCALL PrintF + lda #E.SYN + sec + rts + +.3 ldy OptionVars,x + lda #$80 + sta $0,y + bra CS.RUN +*-------------------------------------- +.4 bit bAuxFileType + bmi .5 + + jsr GetAuxType + bcs .99 + bra CS.RUN + +.5 >LDA.G hSrcBasePath + bne .99 + + >LDYA ZPPtr1 + jsr InitSrcDirYA + bcs .99 + bra CS.RUN +*-------------------------------------- +.7 >LDA.G hSrcBasePath + beq .99 no src ? ERROR + + bit bAuxFileType + bpl .99 we also have a TYPE + + >LDYAI 256 + >SYSCALL GetMem + bcs .99 + + >STYA ZPFullPath + stx hSrcFullPath +*-------------------------------------- +CS.RUN.LOOP ldy #S.PS.hStdIn + lda (pPS),y + >SYSCALL FEOF + bcs .99 + + tay + bne .1 + + >SYSCALL GetChar + bcs .99 + + cmp #$03 Ctrl-C + beq .99 Abort.... + + cmp #$13 Ctrl-S + bne .1 + + lda bPause + eor #$ff + sta bPause + bne CS.RUN.LOOP + +.1 bit bPause + bmi CS.RUN.LOOP Pause... +*-------------------------------------- + jsr GetEntry + bcs CS.RUN.LEAVE + + jsr FilterMatch + bcs CS.RUN.NEXT no match, skip.... + + ldy #S.STAT.MODE+1 + lda (ZPFileStat),y + and #$70 + bne .5 REG file ? + + jsr CS.RUN.FILE + bcc CS.RUN.NEXT + rts + +.5 cmp /S.STAT.MODE.DIR DIR ? + bne .6 + + jsr CS.RUN.DIR + bcc CS.RUN.NEXT + rts + +.6 lda #MLI.E.UNSUPST + sec +.99 rts +*-------------------------------------- +CS.RUN.NEXT jsr GetNextEntry + bcc CS.RUN.LOOP + +CS.RUN.LEAVE jsr LeaveSubDir + bcs .90 + + jsr BasePath.. + + jmp CS.RUN.NEXT + +.90 lda #0 + sec +.99 rts +*-------------------------------------- +CS.RUN.DIR bit bRecurse + bpl .8 + + lda (ZPFileName) + cmp #'.' + bne .1 + + ldy #1 + lda (ZPFileName),y + beq .8 + + cmp #'.' + bne .1 + + iny + lda (ZPFileName),y + beq .8 + +.1 jsr CS.RUN.GetFilePath + + >LDYA ZPFileName + jmp EnterSubDirYA + +.8 clc + rts +*-------------------------------------- +CS.RUN.FILE jsr FilterMatch + bcs .8 no match, skip.... + + jsr CS.RUN.GetFilePath + + >PUSHW L.MSG.FILE + >PUSHW ZPFullPath + >PUSHBI 2 + >SYSCALL PrintF + bcs .9 + + >PUSHW ZPFullPath + + >PUSHW AuxFileType + + >SYSCALL ChAux + jsr CS.RUN.CheckErr + +.8 clc +.9 rts +*-------------------------------------- +CS.RUN.CheckErr bcs .1 + + >LDYA L.MSG.OK + >SYSCALL PutS + rts + +.1 pha + >PUSHW L.MSG.ERR + pla + pha + >PUSHA + >PUSHBI 1 + >SYSCALL PrintF + + lda bContinue + eor #$80 + asl + pla + rts +*-------------------------------------- +CS.RUN.GetFilePath + >PUSHW ZPFullPath + >LDA.G hSrcBasePath + >SYSCALL GetMemPtr + >PUSHYA + >SYSCALL StrCpy + + >PUSHW ZPFullPath + >PUSHW ZPFileName + >SYSCALL StrCat + rts +*-------------------------------------- +CS.DOEVENT sec + rts +*-------------------------------------- +CS.QUIT jsr LeaveSubDir + bcc CS.QUIT + + >LDA.G hFilter + beq .1 + + >SYSCALL FreeMem + +.1 lda hSrcFullPath + beq .8 + + >SYSCALL FreeMem + +.8 clc + rts +*-------------------------------------- +GetAuxType lda (ZPPtr1) + cmp #'0' + bcc .1 + + cmp #'9'+1 + bcs .1 + + ldx #0 + bra .7 + +.1 cmp #'x' + beq .2 + + cmp #'X' + bne .9 + + inc ZPPtr1 + bne .2 + + inc ZPPtr1+1 + +.2 ldx #2 + +.7 >PUSHW ZPPtr1 + >PUSHW L.SSCANF.D,x + >PUSHWI AuxFileType + >PUSHBI 2 + >SYSCALL SScanF + bcs .9 + + cpy #1 + bne .9 + + dec bAuxFileType + clc + rts + +.9 sec + rts +*-------------------------------------- + .INB usr/src/shared/x.fileenum.s +*-------------------------------------- +CS.END +*-------------------------------------- +OptionList .AS "CRcr" +OptionVars .DA #bContinue,#bRecurse,#bContinue,#bRecurse +*-------------------------------------- +MSG.USAGE .AS "Usage : CHTYP auxtype [File *,? wildcards allowed]\r\n" + .AS " auxtype : 12345 (Decimal word) ,xABCD (Hexadecimal word)\r\n" + .AS " -C : Continue on error\r\n" + .AZ " -R : Recurse subdirectories\r\n" +MSG.OK .AZ "[OK]" +MSG.ERR .AZ "[%h]\r\n" +MSG.FILE .AZ "CHAUX File:%S..." +SSCANF.D .AZ "%D" +SSCANF.H .AZ "%H" +*-------------------------------------- + .DUMMY + .OR 0 +DS.START .INB usr/src/shared/x.fileenum.g +DS.END .ED +*-------------------------------------- +MAN +SAVE usr/src/bin/chaux.s +ASM diff --git a/BIN/IRC.S.txt b/BIN/IRC.S.txt index 1c0f7fa4..1e24b475 100644 --- a/BIN/IRC.S.txt +++ b/BIN/IRC.S.txt @@ -4,12 +4,17 @@ NEW .OP 65C02 .OR $2000 .TF bin/irc +*-------------------------------------- +TLS .EQ 0 *-------------------------------------- .INB inc/macros.i .INB inc/a2osx.i .INB inc/mli.i .INB inc/eth.i .INB inc/libtcpip.i + .DO TLS=1 + .INB inc/net.tls.i + .FIN *-------------------------------------- TIMEOUT.MAX .EQ 250 25 sec. MSGSIZE .EQ 4096 @@ -21,12 +26,11 @@ TEXTMAX .EQ 240 .OR ZPBIN ZS.START ZPPtr1 .BS 2 +ZPPtr2 .BS 2 bEscMode .BS 1 bJoin .BS 1 TimeOut .BS 1 hSocket .BS 1 -TextPtr .BS 1 -TextLen .BS 1 ZPRespPtr .BS 2 ZPMsg .BS 2 @@ -42,6 +46,9 @@ BufPtr .BS 1 BufLen .BS 1 ZPBufPtr .BS 2 +TextPtr .BS 1 +TextLen .BS 1 + bPendingMsg .BS 1 ZS.END .ED @@ -111,6 +118,12 @@ J.ESC .DA CS.RUN.CHARIN.LEFT .DA CS.RUN.CHARIN.DOWN .DA CS.RUN.CHARIN.UP .DA CS.RUN.CHARIN.RIGHT + .DO TLS=1 +L.MSG.TLS .DA MSG.TLS +L.MSG.TLS.1 .DA MSG.TLS.1 +L.TLS.CHELLO .DA TLS.CHELLO +L.TLS.CHELLO.UT .DA TLS.CHELLO.UT + .FIN .DA 0 *-------------------------------------- CS.INIT >LDYA L.LIBTCPIP @@ -128,11 +141,16 @@ CS.RUN jsr CS.RUN.CheckTCPIP jsr CS.RUN.CheckArgs bcs CS.INIT.RTS + jsr CS.RUN.GetBuffers + bcs CS.INIT.RTS + jsr CS.RUN.Connect bcs CS.INIT.RTS - jsr CS.RUN.GetBuffers + .DO TLS=1 + jsr CS.RUN.TLS bcs CS.INIT.RTS + .FIN jsr CS.RUN.SCRSETUP bcs CS.INIT.RTS @@ -263,6 +281,41 @@ CS.RUN.CheckArgs >SYSCALL PrintF rts *-------------------------------------- +CS.RUN.GetBuffers + >LDYAI 2048 + >SYSCALL GetMem + bcs .9 + + >STYA ZPBufPtr + txa + >STA.G hBufBuf + + >LDYAI MSGSIZE + >SYSCALL GetMem + bcs .9 + + >STYA ZPMsg + txa + >STA.G hMsgBuf + + >LDYAI 384 + >SYSCALL GetMem + bcs .9 + + >STYA ZPRespPtr + txa + >STA.G hRespBuf + + >LDYAI 256 + >SYSCALL GetMem + bcs .9 + + >STYA ZPOutputBufPtr + txa + >STA.G hOutputBuf + +.9 rts +*-------------------------------------- CS.RUN.Connect >PUSHBI S.SOCKET.T.STREAM >PUSHBI 0 no protocol >LIBCALL hLIBTCPIP,LIBTCPIP.Socket @@ -300,41 +353,64 @@ CS.RUN.Connect >PUSHBI S.SOCKET.T.STREAM >SYSCALL PrintF rts *-------------------------------------- -CS.RUN.GetBuffers - >LDYAI 256 - >SYSCALL GetMem + .DO TLS=1 +CS.RUN.TLS jsr CS.RUN.TLS.init + + >PUSHB hSocket + >PUSHW L.TLS.CHELLO + >PUSHWI TLS.CHELLO.L + >LIBCALL hLIBTCPIP,LIBTCPIP.Write bcs .9 - >STYA ZPBufPtr - txa - >STA.G hBufBuf +.1 >SLEEP - >LDYAI MSGSIZE - >SYSCALL GetMem + lda TimeOut + bne .1 + + >PUSHB hSocket + >PUSHW ZPBufPtr + >PUSHWI 2048 + >LIBCALL hLIBTCPIP,LIBTCPIP.Read bcs .9 - >STYA ZPMsg - txa - >STA.G hMsgBuf - - >LDYAI 384 - >SYSCALL GetMem - bcs .9 - - >STYA ZPRespPtr - txa - >STA.G hRespBuf - - >LDYAI 256 - >SYSCALL GetMem - bcs .9 - - >STYA ZPOutputBufPtr - txa - >STA.G hOutputBuf - + >STYA ZPPtr2 RCVD len + >PUSHW L.MSG.TLS.1 + >PUSHW ZPPtr2 + >PUSHBI 2 + >SYSCALL PrintF + + sec + rts + +.8 clc .9 rts *-------------------------------------- +CS.RUN.TLS.init >LDYA L.MSG.TLS + >SYSCALL PutS + + lda A2osX.RANDOM16 + sta ZPPtr1 + lda A2osX.RANDOM16+1 + and #$7F + sta ZPPtr1+1 + + >LDYA L.TLS.CHELLO.UT + >STYA ZPPtr2 + + ldy #31 + +.10 lda (ZPPtr1),y + sta (ZPPtr2),y + dey + bpl .10 + + lda #50 + sta TimeOut + + rts + + .FIN +*-------------------------------------- CS.RUN.Register >LDYA L.MSG.REGISTER jsr CS.RUN.STATUSMSG @@ -363,7 +439,7 @@ CS.RUN.Register >LDYA L.MSG.REGISTER *-------------------------------------- CS.RUN.GetMsg bit bPendingMsg bmi .10 - + >LDYA ZPMsg >STYA ZPMsgPtr @@ -391,7 +467,7 @@ CS.RUN.GetMsg bit bPendingMsg sta (ZPMsgPtr) inc ZPMsgPtr bne .3 - + inc ZPMsgPtr+1 .3 inc BufPtr @@ -593,7 +669,7 @@ CS.RUN.CMD.PING >PUSHW ZPRespPtr *-------------------------------------- CS.RUN.CMD.JOIN sec ror bJoin - + >LDYA L.MSG.NULL jsr CS.RUN.STATUSPDATE *-------------------------------------- @@ -732,8 +808,7 @@ CS.RUN.TXTCLR.RTS CS.RUN.TOPUPDATE >PUSHW ZPOutputBufPtr >PUSHW L.MSG.TOPBAR - >PUSHB #K.VER - >PUSHB /K.VER + >PUSHW A2osX.KVER lda #1 >SYSCALL ArgV @@ -978,10 +1053,10 @@ CS.DOEVENT lda (pEvent) *-------------------------------------- CS.QUIT ldy #hOutputBuf jsr .7 - + ldy #hRespBuf jsr .7 - + ldy #hMsgBuf jsr .7 @@ -1003,9 +1078,9 @@ CS.QUIT ldy #hOutputBuf .7 lda (pData),y beq .8 - + >SYSCALL FreeMem -.8 rts +.8 rts *-------------------------------------- CS.END LIBTCPIP .AZ "libtcpip" @@ -1017,6 +1092,10 @@ MSG.HOSTOK .AZ "Connecting to %d.%d.%d.%d:%D (%s)..." MSG.SKTKO .AZ "Failed to Open Socket." MSG.SKTOK .AZ "Connected\r\n(Exit key is Ctrl-T)\r\n" MSG.SKTERR .AZ "Socket Error : $%h\r\n" + .DO TLS=1 +MSG.TLS .AZ "TLS:Negociation..." +MSG.TLS.1 .AZ "TLS:Received %D bytes.\r\n" + .FIN MSG.REGISTER .AZ "Registering User..." MSG.JOIN .AZ "Joining Channel..." MSG.TOPBAR .AZ "A2osX IRC %d.%d Server:%s:%s Nick:%s" @@ -1071,6 +1150,30 @@ SA.REMOTE .DA #AF.INET S.SOCKADDR.AF .BS 1 .BS 4 S.SOCKADDR.ADDR .DA 6667 +*-------------------------------------- + .DO TLS=1 +TLS.CHELLO .DA #TLS.CT.HS + .DA TLS.LV.TLS10 + .DA /TLS.CHELLO.L1,#TLS.CHELLO.L1 +TLS.CHELLO.1 .DA #TLS.HS.MT.CH + .DA #0,/TLS.CHELLO.L2,#TLS.CHELLO.L2 +TLS.CHELLO.2 .DA TLS.LV.TLS12 +TLS.CHELLO.UT .BS 4 +TLS.CHELLO.R .BS 28 + .DA #0 SID + .DA #0,#2 CSL + .DA #0,#TLS.HS.CH.CS.RSAAES128GCMSHA256 + .DA TLS.HS.CH.CM.NONE + .DA /TLS.CHELLO.LE,#TLS.CHELLO.LE +TLS.CHELLO.E .HS 000D T=sig alg + .HS 0004 sig alg Len + .HS 0002 sig hash alg len + .HS 0401 RSA PKCS1 SHA256 +TLS.CHELLO.L .EQ *-TLS.CHELLO +TLS.CHELLO.L1 .EQ *-TLS.CHELLO.1 +TLS.CHELLO.L2 .EQ *-TLS.CHELLO.2 +TLS.CHELLO.LE .EQ *-TLS.CHELLO.E + .FIN *-------------------------------------- .DUMMY .OR 0 diff --git a/DRV/LANCEGS.DRV.S.txt b/DRV/LANCEGS.DRV.S.txt index 6e270fa3..3fdb8cbe 100644 --- a/DRV/LANCEGS.DRV.S.txt +++ b/DRV/LANCEGS.DRV.S.txt @@ -55,7 +55,7 @@ Dev.Detect >STYA ARGS bne .2 lda L91C96.BSR+1,x - cmp #DEVID + cmp #L91C96.DEVID beq .3 .2 dec FD.DEV.NAME+3 diff --git a/DRV/UTHER2.AI.DRV.S.txt b/DRV/UTHER2.AI.DRV.S.txt index 5dba29a4..f59e5197 100644 --- a/DRV/UTHER2.AI.DRV.S.txt +++ b/DRV/UTHER2.AI.DRV.S.txt @@ -1,16 +1,18 @@ NEW AUTO 3,1 - .LIST OFF + .LIST OFF .OP 65C02 .OR $2000 .TF drv/uther2.ai.drv *-------------------------------------- .INB inc/macros.i .INB inc/a2osx.i + .INB inc/kernel.i .INB inc/mli.e.i .INB inc/nic.i .INB inc/nic.w5100.i .INB inc/eth.i + .INB inc/net.tcpip.i .INB inc/libtcpip.i *-------------------------------------- ZPArgPtr .EQ ZPBIN @@ -79,7 +81,7 @@ Dev.Detect >STYA ARGS cmp /2000 bne .2 - lda W5100.DR,x Get RTR LO + lda W5100.DR,x Get RTR LO cmp #2000 beq .3 @@ -146,7 +148,7 @@ Dev.ParseArgs >LDYA ARGS .1 >PUSHW ZPArgPtr >PUSHW L.SSCANF.MAC - + ldx #0 .2 >PUSHW L.MAC0,x @@ -154,9 +156,9 @@ Dev.ParseArgs >LDYA ARGS inx cpx #12 bne .2 - + >PUSHBI 12 6 x byte PTRs - + >SYSCALL SScanF bcc .8 @@ -248,7 +250,7 @@ STATUS.9 lda #MLI.E.BADCTL rts *-------------------------------------- CONTROL jsr GET.IOCTLBUFPTR - + ldy #S.IOCTL.C lda (ZPIOCTL),y cmp #S.IOCTL.C.SETDCB @@ -260,7 +262,7 @@ CONTROL jsr GET.IOCTLBUFPTR sta DCB,y dey bpl .2 - + bra OPEN.I *-------------------------------------- OPEN lda #S.DIB.S.OPENED @@ -278,6 +280,15 @@ OPEN.I jsr CLOSE lda #W5100.MR.PB+W5100.MR.AI+W5100.MR.IND sta W5100.MR,x + >AR.SELECT SHAR + ldy #0 + +.1 lda DCB+S.DCB.NIC.MAC,y + sta W5100.DR,x + iny + cpy #6 + bne .1 + >AR.SELECT GAR ldy #0 @@ -298,16 +309,7 @@ OPEN.I jsr CLOSE cpy #4 bne .3 -* >AR.SELECT SHAR - ldy #0 - -.1 lda DCB+S.DCB.NIC.MAC,y - sta W5100.DR,x - iny - cpy #6 - bne .1 - -* >AR.SELECT SIPR + >AR.SELECT SIPR ldy #0 @@ -316,7 +318,7 @@ OPEN.I jsr CLOSE iny cpy #4 bne .4 - + >AR.SELECT RMSR lda #%01010101 RAW=2k,ICMP=2k,UDP=2k,TCP=2k sta W5100.DR,x ...for Socket RX Buffers @@ -329,26 +331,26 @@ OPEN.I jsr CLOSE >AR.SELECT S0.CR lda #W5100.AR.Sn.CR.OPEN sta W5100.DR,x - +*-------------------------------------- lda /W5100.AR.S1.MR sta Sn.IO - + ldy #S.IP.PROTOCOL.ICMP jsr OPEN.SnY - + inc Sn.IO - + ldy #S.IP.PROTOCOL.UDP jsr OPEN.SnY - + inc Sn.IO - + ldy #S.IP.PROTOCOL.TCP jsr OPEN.SnY - + lda #S.DIB.S.OPENED tsb DIB+S.DIB.S - + clc rts *-------------------------------------- @@ -361,11 +363,11 @@ OPEN.SnY >AR.Sn.SELECT S0.MR sta W5100.DR,x * >AR.Sn.SELECT Sn.TOS - stz W5100.DR,x +* stz W5100.DR,x * >AR.Sn.SELECT Sn.TTL - lda #K.IP.TTL - sta W5100.DR,x +* lda #K.IP.TTL +* sta W5100.DR,x >AR.Sn.SELECT S0.CR lda #W5100.AR.Sn.CR.OPEN @@ -386,10 +388,10 @@ CLOSE ldx DEVSLOTx0 .2 eor $C019 bpl .2 - + lda #S.DIB.S.OPENED trb DIB+S.DIB.S - + clc rts *-------------------------------------- @@ -400,179 +402,33 @@ READ php ldx DEVSLOTx0 - lda /W5100.AR.S1.MR + ldy #Sn.Cnt-1 + +.1 lda Sn.IO.BASE,y sta Sn.IO sta W5100.AR,x lda #W5100.AR.S0.RX.RSR sta W5100.AR+1,x - + lda W5100.DR,x get the received size HI ora W5100.DR,x LO - bne READ.ICMP - + beq .2 + + jmp READ.IPRAW + +.2 dey + bne .1 + lda /W5100.AR.S0.RX.RSR - sta Sn.IO sta W5100.AR,x lda #W5100.AR.S0.RX.RSR sta W5100.AR+1,x - + lda W5100.DR,x get the received size HI ora W5100.DR,x LO - beq .9 - - jmp READ.RAW - + bne READ.RAW + .9 jmp READWRITE.NODATA - -READ.ICMP lda #S.IP.PROTOCOL.ICMP - sta FRM.HDR.PROTO - lda Sn.RX.BASE+1 - sta Sn.BASE - lda Sn.RXTX.MASK+1 - sta Sn.MASK - - >AR.Sn.SELECT S0.RX.RD - lda W5100.DR,x get the received ptr HI - sta Offset+1 - ldy W5100.DR,x get the received ptr LO - sty Offset - - and Sn.MASK - ora Sn.BASE - sta W5100.AR,x - tya - sta W5100.AR+1,x - - ldy #0 - -.10 lda W5100.DR,x IPRAW:Get Source IP - sta RX.IP,y - iny - cpy #4 - bne .10 - - lda W5100.DR,x get RX.Size HI (not including 6 bytes Header) - sta RXTX.Size+1 - eor #$ff - sta Counter+1 - - lda W5100.DR,x get RX.Size LO - sta RXTX.Size - eor #$ff - sta Counter - - eor #$ff - - clc - adc #S.IP - sta BUF.Size - ldy #S.IOCTL.BYTECNT - sta (ZPIOCTL),y - - iny - - lda RXTX.Size+1 - adc /S.IP - sta BUF.Size+1 - - lda RXTX.Size - clc - adc #6 IPRAW: Add 6 bytes to Total Size - sta RXTX.Size - bcc .11 - inc RXTX.Size+1 - -.11 lda RXTX.Size - clc - adc #S.IP-S.ETH.EII - sta FRM.HDR.IPLEN+1 - - lda RXTX.Size+1 - adc /S.IP-S.ETH.EII - sta FRM.HDR.IPLEN - - >LDYA BUF.Size - >SYSCALL2 GetMem - bcc .14 - - jmp READWRITE.9 - -.14 >STYA ZPBufPtr - phx - - phy - ldy #S.IOCTL.BUFPTR+1 - sta (ZPIOCTL),y - dey - pla - sta (ZPIOCTL),y - - ldy #S.ETH.EII.TYPE - -.15 lda FRM.HDR-S.ETH.EII.TYPE,y - sta (ZPBufPtr),y - iny - cpy #S.ETH.EII.TYPE+FRM.HDR.LEN - bne .15 - - ldx #3 - ldy #S.IP.SRC+3 - -.12 lda RX.IP,x - sta (ZPBufPtr),y - dey - dex - bpl .12 - - ldx #3 - ldy #S.IP.DST+3 - -.13 lda DCB+S.DCB.NIC.IP,x - sta (ZPBufPtr),y - dey - dex - bpl .13 - - ldy #S.IP - - ldx DEVSLOTx0 - -.2 inc Counter - bne .3 - - inc Counter+1 - beq .4 - -.3 lda W5100.DR,x - sta (ZPBufPtr),y - iny - bne .2 - - inc ZPBufPtr+1 - bra .2 - -.4 >AR.Sn.SELECT S0.RX.RD - - lda Offset - clc - adc RXTX.Size - pha save LO - - lda Offset+1 - adc RXTX.Size+1 - sta W5100.DR,x write HI - pla - sta W5100.DR,x write LO - - >AR.Sn.SELECT S0.CR - lda #W5100.AR.Sn.CR.RCVD - sta W5100.DR,x - - pla hMem - - plp - clc - rts *-------------------------------------- READ.RAW >AR.SELECT S0.RX.RD lda W5100.DR,x get the received ptr HI @@ -593,15 +449,15 @@ READ.RAW >AR.SELECT S0.RX.RD ldy #S.IOCTL.BYTECNT sec - sbc #2 MACRAW:strip 2 bytes Header from Size + sbc #2 MACRAW:strip 2 bytes Header from Size sta (ZPIOCTL),y sta BUF.Size eor #$ff sta Counter - iny lda RXTX.Size+1 sbc #0 + iny sta (ZPIOCTL),y sta BUF.Size+1 eor #$ff @@ -626,7 +482,7 @@ READ.RAW >AR.SELECT S0.RX.RD ldy #0 ldx DEVSLOTx0 - + .2 inc Counter bne .3 @@ -662,7 +518,158 @@ READ.RAW >AR.SELECT S0.RX.RD plp clc - rts + rts +*-------------------------------------- +READ.IPRAW lda Sn.IP.PROTOCOL,y + sta FRM.HDR.PROTO + + lda Sn.RX.BASE+1,y + sta Sn.BASE + lda Sn.RXTX.MASK+1,y + sta Sn.MASK + >DEBUG + >AR.Sn.SELECT S0.RX.RD + lda W5100.DR,x get the received ptr HI + sta Offset+1 + ldy W5100.DR,x get the received ptr LO + sty Offset + + and Sn.MASK + ora Sn.BASE + sta W5100.AR,x + tya + sta W5100.AR+1,x + + ldy #0 + +.10 lda W5100.DR,x IPRAW:Get Source IP + sta RX.IP,y + iny + cpy #4 + bne .10 + + lda W5100.DR,x get RX.Size HI (not including 6 bytes Header) + sta RXTX.Size+1 + eor #$ff + sta Counter+1 + + lda W5100.DR,x get RX.Size LO + sta RXTX.Size + eor #$ff + sta Counter + + eor #$ff + + clc + adc #S.IP + sta BUF.Size + ldy #S.IOCTL.BYTECNT + sta (ZPIOCTL),y + + lda RXTX.Size+1 + adc /S.IP + sta BUF.Size+1 + iny + sta (ZPIOCTL),y + + lda RXTX.Size + clc + adc #6 IPRAW: Add 6 bytes to Total Size + sta RXTX.Size + bcc .11 + inc RXTX.Size+1 + +.11 lda RXTX.Size + clc + adc #S.IP-S.ETH.EII + sta FRM.HDR.IPLEN+1 + + lda RXTX.Size+1 + adc /S.IP-S.ETH.EII + sta FRM.HDR.IPLEN + + >LDYA BUF.Size + >SYSCALL2 GetMem + bcc .14 + + jmp READWRITE.9 + +.14 >STYA ZPBufPtr + phx + + phy + ldy #S.IOCTL.BUFPTR+1 + sta (ZPIOCTL),y + dey + pla + sta (ZPIOCTL),y + + ldy #S.ETH.EII.TYPE + +.15 lda FRM.HDR-S.ETH.EII.TYPE,y + sta (ZPBufPtr),y + iny + cpy #S.ETH.EII.TYPE+FRM.HDR.LEN + bne .15 + + ldx #3 + ldy #S.IP.SRC+3 + +.12 lda RX.IP,x + sta (ZPBufPtr),y + dey + dex + bpl .12 + + ldx #3 + ldy #S.IP.DST+3 + +.13 lda DCB+S.DCB.NIC.IP,x + sta (ZPBufPtr),y + dey + dex + bpl .13 + + ldy #S.IP + + ldx DEVSLOTx0 + +.2 inc Counter + bne .3 + + inc Counter+1 + beq .4 + +.3 lda W5100.DR,x + sta (ZPBufPtr),y + iny + bne .2 + + inc ZPBufPtr+1 + bra .2 + +.4 >AR.Sn.SELECT S0.RX.RD + + lda Offset + clc + adc RXTX.Size + pha save LO + + lda Offset+1 + adc RXTX.Size+1 + sta W5100.DR,x write HI + pla + sta W5100.DR,x write LO + + >AR.Sn.SELECT S0.CR + lda #W5100.AR.Sn.CR.RCVD + sta W5100.DR,x + + pla hMem + + plp + clc + rts *-------------------------------------- READWRITE.NODATA lda #E.NODATA @@ -697,24 +704,25 @@ WRITE php ldy #S.IP.PROTOCOL lda (ZPBufPtr),y - - ldx #Sn.cnt-1 - -.10 cmp Sn.IP.PROTOCOL,x + + ldy #Sn.cnt-1 + +.10 cmp Sn.IP.PROTOCOL,y beq .11 - dex + + dey bne .10 - + plp lda #MLI.E.IO sec rts -.11 lda Sn.IO.BASE,x +.11 lda Sn.IO.BASE,y sta Sn.IO - lda Sn.TX.BASE,x + lda Sn.TX.BASE,y sta Sn.BASE - lda Sn.RXTX.MASK,x + lda Sn.RXTX.MASK,y sta Sn.MASK ldx DEVSLOTx0 diff --git a/DRV/UTHERNET.DRV.S.txt b/DRV/UTHERNET.DRV.S.txt index ddb163c8..d566d54e 100644 --- a/DRV/UTHERNET.DRV.S.txt +++ b/DRV/UTHERNET.DRV.S.txt @@ -58,17 +58,20 @@ Dev.Detect >STYA ZPArgPtr .1 lda A2osX.S,y IO based detection, avoid scanning in Disk Controller IO!!!! bne .2 + lda /PP.ID sta PacketPagePTR+1,x lda #PP.ID sta PacketPagePTR,x lda PacketPageDATA+1,x - cmp /DEVID + cmp /CS8900A.DEVID bne .2 + lda PacketPageDATA,x - cmp #DEVID + cmp #CS8900A.DEVID beq .3 + .2 dec FD.DEV.NAME+3 txa sec @@ -76,6 +79,7 @@ Dev.Detect >STYA ZPArgPtr tax dey bne .1 + >LDYA L.MSG.DETECT.KO >SYSCALL PutS @@ -261,6 +265,7 @@ STATUS.9 lda #MLI.E.BADCTL OPEN lda #S.DIB.S.OPENED bit DIB+S.DIB.S bne .9 + jsr CLOSE * ldx DEVSLOTx0 Done by CLOSE @@ -279,16 +284,31 @@ OPEN lda #S.DIB.S.OPENED lda #PP.MAC sta PacketPagePTR,x - >LDYA DCB+S.DCB.NIC.MAC - >STYA PacketPageDATA,x - >LDYAI PP.MAC+2 - >STYA PacketPagePTR,x - >LDYA DCB+S.DCB.NIC.MAC+2 - >STYA PacketPageDATA,x - >LDYAI PP.MAC+4 - >STYA PacketPagePTR,x - >LDYA DCB+S.DCB.NIC.MAC+4 - >STYA PacketPageDATA,x + lda DCB+S.DCB.NIC.MAC+1 + sta PacketPageDATA+1,x + lda DCB+S.DCB.NIC.MAC+0 + sta PacketPageDATA,x + + lda /PP.MAC+2 + sta PacketPagePTR+1,x + lda #PP.MAC+2 + sta PacketPagePTR,x + + lda DCB+S.DCB.NIC.MAC+3 + sta PacketPageDATA+1,x + lda DCB+S.DCB.NIC.MAC+2 + sta PacketPageDATA,x + + lda /PP.MAC+4 + sta PacketPagePTR+1,x + lda #PP.MAC+4 + sta PacketPagePTR,x + + lda DCB+S.DCB.NIC.MAC+5 + sta PacketPageDATA+1,x + lda DCB+S.DCB.NIC.MAC+4 + sta PacketPageDATA,x + lda /PP.LineCTL sta PacketPagePTR+1,x lda #PP.LineCTL @@ -302,6 +322,7 @@ OPEN lda #S.DIB.S.OPENED tsb DIB+S.DIB.S clc rts + .9 lda #MLI.E.OPEN sec rts @@ -320,13 +341,17 @@ CLOSE ldx DEVSLOTx0 sta PacketPagePTR+1,x lda #PP.SelfST sta PacketPagePTR,x + ldy #0 + .1 lda PacketPageDATA+1,x lda PacketPageDATA,x and #PP.SelfST.InitDone bne .8 + iny bne .1 + .8 lda #S.DIB.S.OPENED trb DIB+S.DIB.S clc @@ -374,6 +399,7 @@ READ php pla >SYSCALL2 GetMem bcs READWRITE.99 + >STYA ZPBufPtr phx phy @@ -388,8 +414,10 @@ READ php .2 inc Counter bne .3 + inc Counter+1 beq .8 + .3 lda RTDATA,x sta (ZPBufPtr),y iny @@ -397,8 +425,10 @@ READ php sta (ZPBufPtr),y iny bne .2 + inc ZPBufPtr+1 bra .2 + .8 pla hMem plp @@ -449,14 +479,17 @@ WRITE php ldy PacketPageDATA,x bit /PP.BusST.Rdy4TxNOW beq READWRITE.9 + ldy #S.IOCTL.BUFPTR lda (ZPIOCTL),y sta ZPBufPtr iny lda (ZPIOCTL),y sta ZPBufPtr+1 + ldx #5 ldy #S.ETH.SRCMAC+5 + .10 lda DCB+S.DCB.NIC.MAC,x sta (ZPBufPtr),y dey @@ -469,19 +502,25 @@ WRITE php .1 inc Counter bne .2 + inc Counter+1 beq .8 + .2 lda (ZPBufPtr),y sta RTDATA,x iny bne .3 + inc ZPBufPtr+1 + .3 lda (ZPBufPtr),y sta RTDATA+1,x iny bne .1 + inc ZPBufPtr+1 bne .1 + .8 plp clc rts diff --git a/DRV/UTHERNET2.DRV.S.txt b/DRV/UTHERNET2.DRV.S.txt index 7a9cc4d1..3ad1d21b 100644 --- a/DRV/UTHERNET2.DRV.S.txt +++ b/DRV/UTHERNET2.DRV.S.txt @@ -7,6 +7,7 @@ NEW *-------------------------------------- .INB inc/macros.i .INB inc/a2osx.i + .INB inc/kernel.i .INB inc/mli.e.i .INB inc/nic.i .INB inc/nic.w5100.i diff --git a/INC/A2osX.I.txt b/INC/A2osX.I.txt index 4f384788..6fbdb5ac 100644 --- a/INC/A2osX.I.txt +++ b/INC/A2osX.I.txt @@ -171,7 +171,7 @@ SEEK.END .EQ $02 * A2osX.SYSCALL Functions Indexes *--------------------------------------D1 * STAT -SYS.ChTyp .EQ $00 +* .EQ $00 SYS.ChMod .EQ $02 SYS.FStat .EQ $04 SYS.Stat .EQ $06 @@ -222,15 +222,15 @@ SYS.SScanF .EQ $4E * .EQ $54 * .EQ $56 -* .EQ $58 -* .EQ $5A -* .EQ $5C +SYS.Online .EQ $58 +SYS.ChTyp .EQ $5A +SYS.ChAux .EQ $5C SYS.SetAttr .EQ $5E *--------------------------------------D2 * MOUNT SYS.Mount .EQ $60 SYS.UMount .EQ $62 -SYS.Online .EQ $64 +* .EQ $64 SYS.GetStkObj .EQ $66 * ARG SYS.Shift .EQ $68 diff --git a/INC/LIBTCPIP.I.txt b/INC/LIBTCPIP.I.txt index dfe99256..886d7cdd 100644 --- a/INC/LIBTCPIP.I.txt +++ b/INC/LIBTCPIP.I.txt @@ -69,7 +69,6 @@ ERR.DNS.ERROR .EQ $B8 ERR.ARP.PENDING .EQ $B5 *-------------------------------------- -UDP.PORT.DNS .EQ 53 UDP.PORT.PMAP .EQ 111 UDP.PORT.NTP .EQ 123 *-------------------------------------- @@ -198,103 +197,6 @@ S.SOCKET.TCP.OUTUSED .EQ S.SOCKET+32 * S.SOCKET.TCP .EQ S.SOCKET+34 *-------------------------------------- -S.ARP.HTYPE .EQ S.ETH.EII+0 $0001 -S.ARP.PTYPE .EQ S.ETH.EII+2 $0800 -S.ARP.HLEN .EQ S.ETH.EII+4 $06 -S.ARP.PLEN .EQ S.ETH.EII+5 $04 -S.ARP.OPERATION .EQ S.ETH.EII+6 REQ=$0001,REPLY=$0002 -S.ARP.OPERATION.REQ .EQ 1 -S.ARP.OPERATION.REP .EQ 2 -S.ARP.SHA .EQ S.ETH.EII+8 Sender MAC -S.ARP.SPA .EQ S.ETH.EII+14 Sender IP -S.ARP.THA .EQ S.ETH.EII+18 Target MAC -S.ARP.TPA .EQ S.ETH.EII+24 Target IP -* -S.ARP .EQ S.ETH.EII+28 -*-------------------------------------- -S.IP.V.IHL .EQ S.ETH.EII+0 $45, IPV4,HDR=5DWORDs -S.IP.DSCP.ECN .EQ S.ETH.EII+1 -S.IP.TOTAL.LENGTH .EQ S.ETH.EII+2 -S.IP.IDENTIFICATION .EQ S.ETH.EII+4 -S.IP.FRAGMENT.FLAGS .EQ S.ETH.EII+6 -S.IP.TTL .EQ S.ETH.EII+8 -S.IP.PROTOCOL .EQ S.ETH.EII+9 -S.IP.PROTOCOL.ICMP .EQ 1 -S.IP.PROTOCOL.TCP .EQ 6 -S.IP.PROTOCOL.UDP .EQ 17 -S.IP.HDR.CHECKSUM .EQ S.ETH.EII+10 -S.IP.SRC .EQ S.ETH.EII+12 -S.IP.DST .EQ S.ETH.EII+16 -* -S.IP .EQ S.ETH.EII+20 -*-------------------------------------- -S.ICMP.TYPE .EQ S.IP+0 -S.ICMP.TYPE.ECHOREP .EQ 0 -S.ICMP.TYPE.UNREACH .EQ 3 -S.ICMP.TYPE.ECHOREQ .EQ 8 -S.ICMP.CODE .EQ S.IP+1 -S.ICMP.CHECKSUM .EQ S.IP+2 -S.ICMP.IDENTIFIER .EQ S.IP+4 -S.ICMP.SEQUENCE .EQ S.IP+6 -* -S.ICMP .EQ S.IP+8 -*-------------------------------------- -S.TCPUDP.SRCPORT .EQ S.IP+0 -S.TCPUDP.DSTPORT .EQ S.IP+2 -*-------------------------------------- -S.UDP.LENGTH .EQ S.IP+4 -S.UDP.CHECKSUM .EQ S.IP+6 $0000 = DISABLE -* -S.UDP .EQ S.IP+8 -*-------------------------------------- -S.TCP.SEQNUM .EQ S.IP+4 -S.TCP.ACKNUM .EQ S.IP+8 -S.TCP.DATAOFFSET .EQ S.IP+12 -S.TCP.OPTIONS .EQ S.IP+13 -S.TCP.OPTIONS.URG .EQ %00100000 -S.TCP.OPTIONS.ACK .EQ %00010000 -S.TCP.OPTIONS.PSH .EQ %00001000 -S.TCP.OPTIONS.RST .EQ %00000100 -S.TCP.OPTIONS.SYN .EQ %00000010 -S.TCP.OPTIONS.FIN .EQ %00000001 -S.TCP.WINDOW .EQ S.IP+14 -S.TCP.CHECKSUM .EQ S.IP+16 -S.TCP.URGPTR .EQ S.IP+18 -* -S.TCP .EQ S.IP+20 -*-------------------------------------- -S.DNS.ID .EQ S.UDP+0 -S.DNS.F .EQ S.UDP+2 -S.DNS.F.QR .EQ %10000000.00000000 -S.DNS.F.OPCODE.I .EQ %01000000.00000000 -S.DNS.F.OPCODE.S .EQ %00100000.00000000 -S.DNS.F.AA .EQ %00000100.00000000 -S.DNS.F.TC .EQ %00000010.00000000 -S.DNS.F.RD .EQ %00000001.00000000 -S.DNS.F.RA .EQ %00000000.10000000 -S.DNS.F.RCODE.FRMT .EQ %00000000.00000001 -S.DNS.F.RCODE.SRVR .EQ %00000000.00000010 -S.DNS.F.RCODE.UKWN .EQ %00000000.00000011 -S.DNS.F.RCODE.NIMP .EQ %00000000.00000100 -S.DNS.F.RCODE.DENY .EQ %00000000.00000101 -S.DNS.QDCOUNT .EQ S.UDP+4 -S.DNS.ANCOUNT .EQ S.UDP+6 -S.DNS.NSCOUNT .EQ S.UDP+8 -S.DNS.ARCOUNT .EQ S.UDP+10 -* -S.DNS .EQ S.UDP+12 -*-------------------------------------- -S.DNS.QTYPE.A .EQ 1 -S.DNS.QTYPE.NS .EQ 2 -S.DNS.QTYPE.CNAME .EQ 5 -S.DNS.QTYPE.SOA .EQ 6 -S.DNS.QTYPE.WKS .EQ 11 -S.DNS.QTYPE.PTR .EQ 12 -S.DNS.QTYPE.MX .EQ 15 -S.DNS.QTYPE.SRV .EQ 33 -S.DNS.QTYPE.ANY .EQ 255 -S.DNS.QCLASS.IN .EQ 1 -*-------------------------------------- MAN SAVE inc/libtcpip.i LOAD usr/src/lib/libtcpip.s diff --git a/INC/NET.DNS.I.txt b/INC/NET.DNS.I.txt new file mode 100644 index 00000000..0fa2bf07 --- /dev/null +++ b/INC/NET.DNS.I.txt @@ -0,0 +1,42 @@ +NEW + AUTO 3,1 + .LIST OFF +*-------------------------------------- +UDP.PORT.DNS .EQ 53 +*-------------------------------------- +S.DNS.ID .EQ S.UDP+0 +S.DNS.F .EQ S.UDP+2 +S.DNS.F.QR .EQ %10000000.00000000 +S.DNS.F.OPCODE.I .EQ %01000000.00000000 +S.DNS.F.OPCODE.S .EQ %00100000.00000000 +S.DNS.F.AA .EQ %00000100.00000000 +S.DNS.F.TC .EQ %00000010.00000000 +S.DNS.F.RD .EQ %00000001.00000000 +S.DNS.F.RA .EQ %00000000.10000000 +S.DNS.F.RCODE.FRMT .EQ %00000000.00000001 +S.DNS.F.RCODE.SRVR .EQ %00000000.00000010 +S.DNS.F.RCODE.UKWN .EQ %00000000.00000011 +S.DNS.F.RCODE.NIMP .EQ %00000000.00000100 +S.DNS.F.RCODE.DENY .EQ %00000000.00000101 +S.DNS.QDCOUNT .EQ S.UDP+4 +S.DNS.ANCOUNT .EQ S.UDP+6 +S.DNS.NSCOUNT .EQ S.UDP+8 +S.DNS.ARCOUNT .EQ S.UDP+10 +* +S.DNS .EQ S.UDP+12 +*-------------------------------------- +S.DNS.QTYPE.A .EQ 1 +S.DNS.QTYPE.NS .EQ 2 +S.DNS.QTYPE.CNAME .EQ 5 +S.DNS.QTYPE.SOA .EQ 6 +S.DNS.QTYPE.WKS .EQ 11 +S.DNS.QTYPE.PTR .EQ 12 +S.DNS.QTYPE.MX .EQ 15 +S.DNS.QTYPE.SRV .EQ 33 +S.DNS.QTYPE.ANY .EQ 255 +S.DNS.QCLASS.IN .EQ 1 +*-------------------------------------- +MAN +SAVE inc/net.dns.i +LOAD usr/src/lib/libtcpip.s +ASM diff --git a/INC/NET.TCPIP.I.txt b/INC/NET.TCPIP.I.txt new file mode 100644 index 00000000..89716dde --- /dev/null +++ b/INC/NET.TCPIP.I.txt @@ -0,0 +1,73 @@ +NEW + AUTO 3,1 + .LIST OFF +*-------------------------------------- +S.ARP.HTYPE .EQ S.ETH.EII+0 $0001 +S.ARP.PTYPE .EQ S.ETH.EII+2 $0800 +S.ARP.HLEN .EQ S.ETH.EII+4 $06 +S.ARP.PLEN .EQ S.ETH.EII+5 $04 +S.ARP.OPERATION .EQ S.ETH.EII+6 REQ=$0001,REPLY=$0002 +S.ARP.OPERATION.REQ .EQ 1 +S.ARP.OPERATION.REP .EQ 2 +S.ARP.SHA .EQ S.ETH.EII+8 Sender MAC +S.ARP.SPA .EQ S.ETH.EII+14 Sender IP +S.ARP.THA .EQ S.ETH.EII+18 Target MAC +S.ARP.TPA .EQ S.ETH.EII+24 Target IP +* +S.ARP .EQ S.ETH.EII+28 +*-------------------------------------- +S.IP.V.IHL .EQ S.ETH.EII+0 $45, IPV4,HDR=5DWORDs +S.IP.DSCP.ECN .EQ S.ETH.EII+1 +S.IP.TOTAL.LENGTH .EQ S.ETH.EII+2 +S.IP.IDENTIFICATION .EQ S.ETH.EII+4 +S.IP.FRAGMENT.FLAGS .EQ S.ETH.EII+6 +S.IP.TTL .EQ S.ETH.EII+8 +S.IP.PROTOCOL .EQ S.ETH.EII+9 +S.IP.PROTOCOL.ICMP .EQ 1 +S.IP.PROTOCOL.TCP .EQ 6 +S.IP.PROTOCOL.UDP .EQ 17 +S.IP.HDR.CHECKSUM .EQ S.ETH.EII+10 +S.IP.SRC .EQ S.ETH.EII+12 +S.IP.DST .EQ S.ETH.EII+16 +* +S.IP .EQ S.ETH.EII+20 +*-------------------------------------- +S.ICMP.TYPE .EQ S.IP+0 +S.ICMP.TYPE.ECHOREP .EQ 0 +S.ICMP.TYPE.UNREACH .EQ 3 +S.ICMP.TYPE.ECHOREQ .EQ 8 +S.ICMP.CODE .EQ S.IP+1 +S.ICMP.CHECKSUM .EQ S.IP+2 +S.ICMP.IDENTIFIER .EQ S.IP+4 +S.ICMP.SEQUENCE .EQ S.IP+6 +* +S.ICMP .EQ S.IP+8 +*-------------------------------------- +S.TCPUDP.SRCPORT .EQ S.IP+0 +S.TCPUDP.DSTPORT .EQ S.IP+2 +*-------------------------------------- +S.UDP.LENGTH .EQ S.IP+4 +S.UDP.CHECKSUM .EQ S.IP+6 $0000 = DISABLE +* +S.UDP .EQ S.IP+8 +*-------------------------------------- +S.TCP.SEQNUM .EQ S.IP+4 +S.TCP.ACKNUM .EQ S.IP+8 +S.TCP.DATAOFFSET .EQ S.IP+12 +S.TCP.OPTIONS .EQ S.IP+13 +S.TCP.OPTIONS.URG .EQ %00100000 +S.TCP.OPTIONS.ACK .EQ %00010000 +S.TCP.OPTIONS.PSH .EQ %00001000 +S.TCP.OPTIONS.RST .EQ %00000100 +S.TCP.OPTIONS.SYN .EQ %00000010 +S.TCP.OPTIONS.FIN .EQ %00000001 +S.TCP.WINDOW .EQ S.IP+14 +S.TCP.CHECKSUM .EQ S.IP+16 +S.TCP.URGPTR .EQ S.IP+18 +* +S.TCP .EQ S.IP+20 +*-------------------------------------- +MAN +SAVE inc/net.tcpip.i +LOAD usr/src/lib/libtcpip.s +ASM diff --git a/INC/NET.TLS.I.txt b/INC/NET.TLS.I.txt new file mode 100644 index 00000000..9d8d6a4d --- /dev/null +++ b/INC/NET.TLS.I.txt @@ -0,0 +1,46 @@ +NEW + AUTO 3,1 +*-------------------------------------- +TLS.CT .EQ 0 +TLS.CT.CCS .EQ 20 +TLS.CT.ALERT .EQ 21 +TLS.CT.HS .EQ 22 +TLS.CT.APP .EQ 23 +TLS.CT.HEATBEAT .EQ 24 +TLS.LV .EQ 1 +TLS.LV.SSL30 .EQ $0003 +TLS.LV.TLS10 .EQ $0103 +TLS.LV.TLS11 .EQ $0203 +TLS.LV.TLS12 .EQ $0303 +TLS.LV.TLS13 .EQ $0403 +TLS.LENGTH .EQ 3 + +TLS.HS.MT .EQ 5 +TLS.HS.MT.HR .EQ 0 +TLS.HS.MT.CH .EQ 1 +TLS.HS.MT.SH .EQ 2 +TLS.HS.MT.NST .EQ 4 +TLS.HS.MT.EXT .EQ 8 +TLS.HS.MT.CERT .EQ 11 +TLS.HS.MT.SKX .EQ 12 +TLS.HS.MT.CR .EQ 13 +TLS.HS.MT.SHD .EQ 14 +TLS.HS.MT.CV .EQ 15 +TLS.HS.MT.CKX .EQ 16 +TLS.HS.MT.FIN .EQ 20 +TLS.HS.LENGTH .EQ 6 +TLS.HS.CH.V .EQ 8 + +TLS.HS.CH.UTIME .EQ 10 +TLS.HS.CH.RND .EQ 14 +TLS.HS.CH.SID .EQ 36 +TLS.HS.CH.CSL .EQ 37 +TLS.HS.CH.CS .EQ 39 +TLS.HS.CH.CS.RSAAES128CBCSHA .EQ $2F +TLS.HS.CH.CS.RSAAES128GCMSHA256 .EQ $9C +TLS.HS.CH.CM .EQ 41 +TLS.HS.CH.CM.NONE .EQ 1 Len=1, value=0 +TLS.HS.CH.EXTL .EQ 43 +*-------------------------------------- +MAN +SAVE inc/net.tls.i diff --git a/INC/NIC.8900A.I.txt b/INC/NIC.8900A.I.txt index 01514515..238f637f 100644 --- a/INC/NIC.8900A.I.txt +++ b/INC/NIC.8900A.I.txt @@ -5,7 +5,7 @@ AUTO 4,1 *-------------------------------------- * CS8900A IO Registers *-------------------------------------- -DEVID .EQ $630E +CS8900A.DEVID .EQ $630E *-------------------------------------- RTDATA .EQ $C080 Receive/Transmit Data (DWORD) TxCMD .EQ $C084 Transmit Command diff --git a/INC/NIC.91C96.I.txt b/INC/NIC.91C96.I.txt index 7a0def3a..47451148 100644 --- a/INC/NIC.91C96.I.txt +++ b/INC/NIC.91C96.I.txt @@ -5,7 +5,7 @@ AUTO 4,1 *-------------------------------------- * SMSC L91C96 IO Registers *-------------------------------------- -DEVID .EQ $33 +L91C96.DEVID .EQ $33 *-------------------------------------- L91C96.0.TCR .EQ $C080 L91C96.0.TCR.FDSE .EQ %10000000.00000000 diff --git a/INC/NIC.W5100.I.txt b/INC/NIC.W5100.I.txt index add39b32..d0e4c691 100644 --- a/INC/NIC.W5100.I.txt +++ b/INC/NIC.W5100.I.txt @@ -58,10 +58,10 @@ W5100.AR.Sn.CR.OPEN .EQ $01 *W5100.AR.Sn.CR.CONNECT .EQ $04 *W5100.AR.Sn.CR.DISCON .EQ $08 *W5100.AR.Sn.CR.CLOSE .EQ $10 -W5100.AR.Sn.CR.SEND .EQ $20 +W5100.AR.Sn.CR.SEND .EQ $20 *W5100.AR.Sn.CR.SENDMAC .EQ $21 *W5100.AR.Sn.CR.SENDKEEP .EQ $22 -W5100.AR.Sn.CR.RCVD .EQ $40 +W5100.AR.Sn.CR.RCVD .EQ $40 W5100.AR.S0.IR .EQ $0402 W5100.AR.S0.SR .EQ $0403 W5100.AR.S0.PORT .EQ $0404 diff --git a/LIB/LIBTCPIP.S.SKT.txt b/LIB/LIBTCPIP.S.SKT.txt index b452a6d5..77581d5b 100644 --- a/LIB/LIBTCPIP.S.SKT.txt +++ b/LIB/LIBTCPIP.S.SKT.txt @@ -499,7 +499,10 @@ SKT.GetDataFromSktIn jsr SKT.SubDataInLenAtSktX jsr SKT.StoreTCB - jsr TCP.SetSocketTCPO.ACK ACK=1 -> send WSIZE +* jsr TCP.SetSocketTCPO.ACK ACK=1 -> send WSIZE + + lda #S.TCP.OPTIONS.ACK + jsr TCP.OUT.SendOptA >LDYA ZPDataInLen clc @@ -569,12 +572,14 @@ SKT.AddDataToSktIn lda SKT.Cache+S.SOCKET.TCP.INHEAD+1 cmp /K.TCP.WSIZE bne .1 + stz SKT.Cache+S.SOCKET.TCP.INHEAD+1 lda ZPTmpPtr1+1 * sec sbc /K.TCP.WSIZE sta ZPTmpPtr1+1 bra .1 + .9 sec rts diff --git a/LIB/LIBTCPIP.S.TCP.txt b/LIB/LIBTCPIP.S.TCP.txt index 6d43def0..d3bf47f6 100644 --- a/LIB/LIBTCPIP.S.TCP.txt +++ b/LIB/LIBTCPIP.S.TCP.txt @@ -227,7 +227,8 @@ TCP.IN.JMP.ESTBLSH jsr TCP.AddAYToSktCacheAtX jsr SKT.StoreTCB update socket - + bra .7 + .70 jsr TCP.SetSocketTCPO.ACK ...and ack data .7 ldy #S.TCP.OPTIONS diff --git a/LIB/LIBTCPIP.S.txt b/LIB/LIBTCPIP.S.txt index 7940a4a2..0a688e6c 100644 --- a/LIB/LIBTCPIP.S.txt +++ b/LIB/LIBTCPIP.S.txt @@ -35,6 +35,8 @@ AUXPIPE .EQ 1 .INB inc/mli.e.i .INB inc/nic.i .INB inc/eth.i + .INB inc/net.tcpip.i + .INB inc/net.dns.i .INB inc/lib.net.i .INB inc/libtcpip.i *-------------------------------------- diff --git a/SBIN/NETWORKD.S.txt b/SBIN/NETWORKD.S.txt index a3de9962..bdfc806b 100644 --- a/SBIN/NETWORKD.S.txt +++ b/SBIN/NETWORKD.S.txt @@ -306,15 +306,12 @@ CS.RUN ldx #IOCTL.READ *-------------------------------------- .DO DBG=1 CS.RUN.FILTER lda (pBuf) - cmp #$ff - beq .9 +* cmp #$ff +* beq .9 - dec - beq .9 - - ldy #S.ETH.EII.TYPE+1 - lda (pBuf),y - bne .9 +* ldy #S.ETH.EII.TYPE+1 +* lda (pBuf),y +* bne .9 clc rts diff --git a/SBIN/VEDD.S.txt b/SBIN/VEDD.S.txt new file mode 100644 index 00000000..8c6d5862 --- /dev/null +++ b/SBIN/VEDD.S.txt @@ -0,0 +1,337 @@ +NEW + AUTO 3,1 Enable MASM3 auto line num + .LIST OFF + .OP 65C02 Target CPU, must match CPU level in header + .OR $2000 usualy $2000, but any value > $100 allowed + .TF sbin/vedd +*-------------------------------------- + .INB inc/macros.i + .INB inc/a2osx.i + .INB inc/mli.e.i + .INB inc/eth.i + .INB inc/libtcpip.i +*-------------------------------------- +ADT.CMD.VSD .EQ $C5 "E": Virtual Drive Command Envelope +TIMEOUT.MAX .EQ 250 25 sec. +*-------------------------------------- +* Zero Page Segment, up to 32 bytes +*-------------------------------------- + .DUMMY + .OR ZPBIN +ZS.START +ZPIPCfgPtr .BS 2 +ZPFrameBase .BS 2 +hSocket .BS 1 +TimeOut .BS 1 +hFrame .BS 1 +ZS.END .ED +*-------------------------------------- +* File Header (16 Bytes) +*-------------------------------------- +CS.START cld + jmp (.1,x) + .DA #$61 6502,Level 1 (65c02) + .DA #1 BIN Layout Version 1 + .DA #S.PS.F.EVENT + .DA #0 + .DA CS.END-CS.START Code Size (without Constants) + .DA DS.END-DS.START Data SegmentSize + .DA #64 Stack Size + .DA #ZS.END-ZS.START Zero Page Size + .DA 0 +*-------------------------------------- +* Relocation Table +*-------------------------------------- +.1 .DA CS.INIT + .DA CS.RUN + .DA CS.DOEVENT + .DA CS.QUIT +L.LIBTCPIP .DA LIBTCPIP +L.MSG.USAGE .DA MSG.USAGE +L.MSG.TCPIPERR .DA MSG.TCPIPERR +L.MSG.UNKNOWN .DA MSG.UNKNOWN +L.MSG.CONNECTED .DA MSG.CONNECTED +L.MSG.NOCONN .DA MSG.NOCONN +L.MSG.NOPING .DA MSG.NOPING +L.MSG.MOUNTED .DA MSG.MOUNTED +L.ADT.REQ .DA ADT.REQ + .DA 0 +*-------------------------------------- +* Called once at process creation +* Put code for loading LIB here +*-------------------------------------- +CS.INIT >LDYA L.LIBTCPIP + >SYSCALL LoadLib + bcs .9 + + sta hLIBTCPIP + +* clc +.9 +CS.INIT.RTS rts +*-------------------------------------- +* Called until exit with CS +* if RUN exits with CC, RUN entered again +*-------------------------------------- +CS.RUN lda hSocket + beq .1 + + lda #0 + clc + rts + +.1 jsr CS.RUN.CheckTCPIP + bcs CS.INIT.RTS + + jsr CS.RUN.CheckArgs + bcs CS.INIT.RTS + + jsr CS.RUN.Connect + bcs CS.INIT.RTS + + >PUSHB hSocket + >PUSHW L.ADT.REQ + >PUSHWI ADT.REQ.LEN + >LIBCALL hLIBTCPIP,LIBTCPIP.Send + bcs .9 + + jsr CS.RUN.RECV + bcc .8 + + >PUSHW L.MSG.NOPING + lda #1 + >SYSCALL ArgV + >PUSHYA + >PUSHBI 2 + >SYSCALL PrintF + +.8 + + lda #0 + sec +.9 rts +*-------------------------------------- +CS.RUN.CheckTCPIP + >LIBCALL hLIBTCPIP,LIBTCPIP.GETCFG is TCPIP loaded ? + bcs .9 + + >STYA ZPIPCfgPtr + lda (ZPIPCfgPtr) Configured ? + bmi .1 + + >LDYA L.MSG.TCPIPERR + >SYSCALL PutS + + lda #E.SYN + sec +.9 rts + +.1 lda #AF.INET + >STA.G SA.LOCAL + >STA.G SA.REMOTE + + ldy #S.IPCFG.IP+3 + +.3 lda (ZPIPCfgPtr),y + pha + dey + cpy #S.IPCFG.IP-1 + bne .3 + + ldy #SA.LOCAL+S.SOCKADDR.ADDR + +.4 pla + sta (pData),y + iny + cpy #SA.LOCAL+S.SOCKADDR.ADDR+4 + bne .4 + + lda #6502 + >STA.G SA.REMOTE+S.SOCKADDR.PORT + iny + lda /6502 + sta (pData),y + + clc + rts +*-------------------------------------- +CS.RUN.CheckArgs + ldy #S.PS.ARGC + lda (pPS),y + bne .1 + + >LDYA L.MSG.USAGE + >SYSCALL PutS + lda #E.SYN + sec + rts + +.1 lda #TIMEOUT.MAX + sta TimeOut + +.2 >PUSHEA.G SA.REMOTE+S.SOCKADDR.ADDR + lda #1 + >SYSCALL ArgV + >PUSHYA + >LIBCALL hLIBTCPIP,LIBTCPIP.HST.GetByName + bcc .3 + + >SLEEP + lda TimeOut + bne .2 + + >PUSHW L.MSG.UNKNOWN + lda #1 + >SYSCALL ArgV + >PUSHYA + >PUSHBI 2 + >SYSCALL PrintF + lda #ERR.SKT.NOCONN + sec + rts + +.3 lda #2 + >SYSCALL ArgV + bcc .4 + + + +.4 + +.8 clc +CS.RUN.CheckArgs.RTS + rts +*-------------------------------------- +CS.RUN.Connect >PUSHBI S.SOCKET.T.DGRAM + >PUSHBI 0 no protocol + >LIBCALL hLIBTCPIP,LIBTCPIP.Socket + bcs .9 + + sta hSocket + + >PUSHA + >PUSHEA.G SA.LOCAL + >LIBCALL hLIBTCPIP,LIBTCPIP.Bind + bcs .9 + + lda #TIMEOUT.MAX + sta TimeOut + +.1 >SLEEP + + >PUSHB hSocket + >PUSHEA.G SA.REMOTE + >LIBCALL hLIBTCPIP,LIBTCPIP.Connect + bcc .8 + + ldx TimeOut + bne .1 + +.9 pha + + >PUSHW L.MSG.NOCONN + lda #1 + >SYSCALL ArgV + >PUSHYA + >PUSHBI 2 + + pla + sec + rts + +.8 >PUSHW L.MSG.CONNECTED + lda #1 + >SYSCALL ArgV + >PUSHYA + >PUSHBI 2 + >SYSCALL PrintF + rts +*-------------------------------------- +CS.RUN.RECV lda #TIMEOUT.MAX + sta TimeOut + +.1 >SLEEP + + lda hSocket + >LIBCALL hLIBTCPIP,LIBTCPIP.Recv + bcc .8 + + cmp #E.NODATA + bne .9 + + lda TimeOut + bne .1 + +.9 sec + rts + +.8 sta hFrame + + >SYSCALL GetMemPtr + >STYA ZPFrameBase + rts +*-------------------------------------- +CS.DOEVENT lda (pEvent) + bpl .9 is it a TIMER event? + + lda TimeOut + beq .9 + + dec TimeOut + +.9 sec do not discard TIMER event + rts +*-------------------------------------- +CS.QUIT + +.1 lda hSocket + beq .2 + + >LIBCALL hLIBTCPIP,LIBTCPIP.Shutdown + +.2 + + lda hLIBTCPIP +.7 beq .8 + + >SYSCALL UnloadLib + +.8 clc + rts +*-------------------------------------- +CS.END +*-------------------------------------- +* Initialized DATA +*-------------------------------------- +LIBTCPIP .AZ "libtcpip" +hLIBTCPIP .BS 1 +*-------------------------------------- +MSG.USAGE .AZ "Usage : VEDD [port]" +MSG.TCPIPERR .AZ "VEDD:TCP/IP Not initialized properly." +MSG.UNKNOWN .AZ "VEDD:%s: Unknown host\r\n" +MSG.NOCONN .AZ "VEDD:No Connection To %s\r\n" +MSG.CONNECTED .AZ "VEDD:Connected To %s\r\n" +MSG.NOPING .AZ "VEDD:No response from %s\r\n" +MSG.MOUNTED .AZ "VEDD:%s Mounted As %s\r\n" +*-------------------------------------- +ADT.REQ .DA #ADT.CMD.VSD + .HS 030000C6 READ D1, BLK 0 +ADT.REQ.LEN .EQ *-ADT.REQ +*-------------------------------------- + .DUMMY + .OR 0 +DS.START +SA.LOCAL .BS 1 S.SOCKADDR.AF + .BS 1 + .BS 4 S.SOCKADDR.ADDR + .BS 2 S.SOCKADDR.PORT +SA.REMOTE .BS 1 S.SOCKADDR.AF + .BS 1 + .BS 4 S.SOCKADDR.ADDR + .BS 2 S.SOCKADDR.PORT +DS.END + .ED +*-------------------------------------- +MAN +SAVE usr/src/sbin/vedd.s +ASM diff --git a/SCMASM.30/ASM65816.S..txt b/SCMASM.30/ASM65816.S..txt new file mode 100644 index 00000000..a5a2d2d1 --- /dev/null +++ b/SCMASM.30/ASM65816.S..txt @@ -0,0 +1,991 @@ +NEW + AUTO 3,1 +*-------------------------------------- + .DUMMY + .OR $A700 +ASM65816.SEARCH.TABLE .BS 3 +ASM65816.GNC .BS 3 +ASM65816.GNC.UC .BS 3 +ASM65816.GNNB .BS 3 +ASM65816.EXPR .BS 10 +ASM65816.EXP1 .BS 10 +ASM65816.ASM.ERROR .BS 3 +ASM65816.EMIT .BS 10 +*-------------------------------- + .OR $F0 F0-FF is ASM private ZeroPage +LEVEL.MASK .BS 1 +OPBASE .BS 1 +MODE.BYTE .BS 1 +FORCE.ADDR.SIZE .BS 1 + .ED +*-------------------------------- +ERR.BAD.OPCODE .EQ 0 +ERR.BAD.ADDRESS .EQ 1 +ERR.RANGE .EQ 2 +ERR.UNDEFINED .EQ 3 +*-------------------------------- + JMP ASM65816.ASM.INIT + JMP ASM65816.ASM.LINE + JMP ASM65816.EMIT.VALUE + JMP DIR.OP +*-------------------------------- + .AS -/FOR THE 6502, 65C02, 65R02, 65816/ + .HS 00 +*-------------------------------- +ASM65816.ASM.INIT + LDA #0 MASK FOR 6502 + STA LEVEL.MASK + LDA #15 MARGIN FOR 6502 + STA EMIT.MARGIN + RTS +*-------------------------------- +ASM65816.ASM.LINE + LDA SEARCH.KEY 1ST LETTER + CMP #'A' + BCC .5 ...NOT A LETTER, SO BADOP + CMP #'Z'+1 + BCS .5 ...NOT A LETTER, SO BADOP + AND #$1F MAKE 01...1A + TAX + LDA FIRST.LETTER.TABLE-1,X + BNE .8 ...UNUSED LETTER +.5 JMP BADOPERR +*---BUILD OPTBL.PNTR INTO TABLE-------- +.8 ADC #OPCODE.TABLE CARRY CLEAR ALREADY + STA OPTBL.PNTR + LDY /OPCODE.TABLE + BCC .1 + INY +.1 CPX #'R'-$40 WHICH HALF OF TABLE? + BCC .2 ...FIRST HALF + INY ...SECOND HALF +.2 CLC INITIAL SEARCH +.3 JSR ASM65816.SEARCH.TABLE + BCC .5 ...NOT FOUND +*---FOUND IT!-------------------- + LDA (OPTBL.PNTR),Y + STA OPBASE + INY + LDA (OPTBL.PNTR),Y + AND #$E1 ISOLATE LEVEL BITS + BEQ .7 ...PLAIN 6502 LEVEL + AND LEVEL.MASK + BNE .7 ...ALLOWS 'STP' FOR BOTH 65816 & SWEET-16 + SEC CONTINUE SEARCH + BCS .3 ...ALWAYS +*---BRANCH TO PROCESS OPCODE----- +.7 LDA (OPTBL.PNTR),Y + AND #$1E + TAY + LDA OP.MODE+1,Y + PHA + LDA OP.MODE,Y + PHA + RTS +*-------------------------------- + .MA MODE +O..]1 .EQ *-OP.MODE + .DA OP.]1-1 + .EM +*-------------------------------- +OP.MODE + >MODE SNGL 0 -- SINGLE BYTE OPCODES + >MODE COPS 2 -- LDA GROUP + >MODE SHIFTS 4 -- ASL GROUP + >MODE REL16 6 -- BRL & PER + >MODE REL8 8 -- RELATIVE BRANCHES + >MODE BITS A -- BIT GROUP + >MODE MOVES C -- MVP & MVN + >MODE JUMPS E -- JUMP GROUP + >MODE ROCKB 10 -- ROCKWELL BIT OPS + >MODE ROCKC 12 -- ROCKWELL BIT OPS + >MODE XN 14 -- SWEET 16 REGISTER OPS + >MODE POP 16 -- SWEET 16 POP & POPD + >MODE SET 18 -- SWEET 16 SET + >MODE CRS 1A -- COP, REP, SEP +*-------------------------------- +OP.SNGL +EMIT.OPBASE + LDA OPBASE + JMP ASM65816.EMIT +*-------------------------------- +OP.CRS JSR ASM65816.GNNB + CMP #'#' + BNE ERBA.E2 + JSR ASM65816.EXP1 + JMP EMIT.OP.AND.EXP.BYTE +ERBA.E2 + JMP ERBA.EMIT.TWO +*-------------------------------- +OP.COPS + JSR GENERAL.OPERAND + JSR SEE.IF.MODE.LEGAL.AT.LEVEL + LDA MODE.BYTE ALL INDIRECT MODES <<<12-16-85>>> + AND #$04 REQUIRE ZP VALUE <<<12-16-85>>> + BEQ .1 ...NOT INDIRECT <<<12-16-85>>> + CPY #14 + BCC .4 ...MODES 0...13 + DEC ADDR.LENGTH SHORTEN >(ZP) AND >(ZP),Y +.4 JSR ASM65816.TEST.EXP.VALUE.ZP + BNE ERBA.E2 ...MUST BE DIRECT VALUE +.1 LDA ADDR.MODE.BITS.CLASS.1,Y + BPL .2 VALID MODE + INC ADDR.LENGTH ...DIRECT,Y NOT VALID + LDA ADDR.MODE.BITS.CLASS.1+1,Y +.2 EOR OPBASE + CMP #$89 STA IMMED? + BEQ ERBA.E2 ...YES, NO SUCH ANIMAL +* FALL INTO EMIT.OP.AND.VALUE *** +*-------------------------------- +EMIT.OP.AND.VALUE + JSR ASM65816.EMIT +ASM65816.EMIT.VALUE + JSR EMIT.EXP.BYTE + DEC ADDR.LENGTH + BEQ .2 + LDA EXP.VALUE+1 + JSR ASM65816.EMIT + DEC ADDR.LENGTH + BEQ .2 + LDA EXP.VALUE+2 + JSR ASM65816.EMIT + DEC ADDR.LENGTH + BEQ .2 + LDA EXP.VALUE+3 + JSR ASM65816.EMIT +.2 RTS +*-------------------------------- +OP.BITS + JSR GENERAL.OPERAND + JSR SEE.IF.MODE.LEGAL.AT.LEVEL + CPY #7 ONLY MODES 0...6 LEGAL + BCS .2 ...NOT VALID MODE + LDX OPBASE + BNE .0 ...NOT BIT OPCODE + LDA LEVEL.MASK + AND #$20 + BNE .0 ...AT LEAST 65C02 + LDA #$60 ONLY ZP AND ABS LEGAL + BNE .7 ...ALWAYS +.0 LDA CLASS.5.LEGAL.MODES,X +.7 AND CLASS.5.MODE.MASKS,Y + BNE .4 ...LEGAL + LDA PASS + BEQ .1 ...IN PASS 1 + JSR ASM65816.TEST.EXP.VALUE.ZP + BNE .2 ...TOO BIG FOR ZP +.1 DEY CHANGE ABS TO ZP MODE + BMI .2 ...WASN'T ABS + TYA + LSR + BCC .2 ...WASN'T ABS + LDA CLASS.5.LEGAL.MODES,X + AND CLASS.5.MODE.MASKS,Y + BNE .3 ...LEGAL AFTERALL +.2 JMP ERBA.EMIT.TWO INVALID ADDRESS MODE +.3 DEC ADDR.LENGTH +*---FORM OPCODE------------------ +.4 LDA ADDR.MODE.BITS.CLASS.5,Y + EOR CLASS.5.OPS,X + LDY #$89 + CMP #$20 + BEQ .5 + LDY #$9C + CMP #$6C + BEQ .5 + LDY #$9E + CMP #$7C + BNE .6 +.5 TYA +.6 JMP EMIT.OP.AND.VALUE +*-------------------------------- +OP.SHIFTS + JSR ASM65816.GNC CHECK FOR ACCUMULATOR MODE + BNE .2 NOT ACCUM MODE + JSR ASM65816.GNC + BNE .2 NOT ACCUM MODE +*---ACCUMULATOR MODE------------- + LDA OPBASE + EOR #$08 MAKE ACCUM MODE OPCODE + BPL .1 NOT INC OR DEC + PHA + LDA LEVEL.MASK + AND #$20 ONLY IN 65C02 AND ABOVE + BEQ .5 + PLA + EOR #$F0 CHANGE EA-->1A, CA-->3A +.1 JMP ASM65816.EMIT +*---MODES WITH OPERAND FIELD----- +.2 DEC CHAR.PNTR + JSR GENERAL.OPERAND + JSR SEE.IF.MODE.LEGAL.AT.LEVEL + CPY #5 ONLY MODES 1...4 LEGAL + BCS .5 + TYA + BEQ .5 ...NO IMMEDIATE MODE ALLOWED + LDA ADDR.MODE.BITS.CLASS.1,Y + EOR OPBASE + JMP EMIT.OP.AND.VALUE +.5 JMP ERBA.EMIT.TWO INVALID ADDRESS MODE +*-------------------------------- +OP.REL8 + .DO SWEET.16 + LDA OPBASE CHECK FOR 'BNM1' SWEET-16 OP + CMP #$09 + BNE .1 ...NOT 'BNM1' + JSR ASM65816.GNC CHECK FOR '1' + CMP #'1' + BNE BADOPERR ...NO, SO BAD OP + .FIN +.1 JSR ASM65816.EXPR + LDA OPBASE +OP.REL8.A + JSR ASM65816.EMIT EMIT OPCODE + LDA EXP.UNDEF + BMI GOEMIT ...UNDEFINED + LDY EXP.VALUE+1 + CLC COMPUTE RELATIVE OFFSET + LDA EXP.VALUE + SBC ORGN + STA EXP.VALUE + BPL .2 + INY +.2 TYA + SBC ORGN+1 + BNE ERR.RANGE.EMIT.ONE +EMIT.EXP.BYTE + LDA EXP.VALUE +GOEMIT JMP ASM65816.EMIT +*-------------------------------- +BADOPERR + LDA #ERR.BAD.OPCODE + JMP ASM65816.ASM.ERROR +*-------------------------------- +* BRL & PER, 16-bit relative +*-------------------------------- +OP.REL16 + JSR ASM65816.EXPR Get value of expression + JSR EMIT.OPBASE Emit the opcode, bumping origin once + LDA EXP.UNDEF If undefined, say so + BMI .3 (If we didn't, might be RANGE ERR) + CLC ADD 2 MORE TO ORIGIN + LDY ORGN+2 + LDA ORGN + ADC #2 + STA EXP.VALUE+3 (TEMP) + LDA ORGN+1 + ADC #0 + BCC .2 + INY BANK BYTE +.2 CPY EXP.VALUE+2 IN SAME BANK AS TARGET? + BNE ERR.RANGE.EMIT.TWO ...NO, ERR RANGE + STA EXP.VALUE+2 YES, SAVE IN ANOTHER TEMP + LDA EXP.VALUE TARGET-ORGN+3 + SBC EXP.VALUE+3 + STA EXP.VALUE + LDA EXP.VALUE+1 + SBC EXP.VALUE+2 + STA EXP.VALUE+1 +.3 LDA #2 + STA ADDR.LENGTH + JMP ASM65816.EMIT.VALUE +*-------------------------------- +ERR.RANGE.EMIT.TWO + JSR ASM65816.EMIT.ZERO +ERR.RANGE.EMIT.ONE + JSR ASM65816.EMIT.ZERO +ASM65816.RAER + LDA #ERR.RANGE + JMP ASM65816.ASM.ERROR +*-------------------------------- +OP.MOVES + JSR EMIT.OPBASE + JSR ASM65816.EXPR GET SOURCE BANK + LDA EXP.VALUE+2 + PHA + JSR ASM65816.GNC + CMP #',' MUST HAVE COMMA HERE + BNE .1 ...ILLEGAL + JSR ASM65816.EXP1 GET DESTINATION BANK + LDA EXP.VALUE+2 + JSR ASM65816.EMIT + PLA + JMP ASM65816.EMIT +.1 JMP ERBA.EMIT.TWO +*-------------------------------- +OP.JUMPS + JSR GENERAL.OPERAND + LDA LEGAL.JUMP.MODES,Y + BMI .4 ...ILLEGAL + ORA OPBASE + TAY + LDA LEVEL.MASK + BMI .1 65816, ALLOW ALL MODES + CPY #5 DISALLOW JML, JSL, AND PEA + BCS .4 ...ONE OF THOSE + CPY #1 DISALLOW JMP LONG + BEQ .4 + AND #$20 SEE IF 65C02 + BNE .1 ...YES + CPY #3 ...NO, DISALLOW JMP (ABS,X) + BEQ .4 ...THAT'S WHAT IT IS... +.1 LDA JUMP.OPCODES,Y + BEQ .4 ...ILLEGAL + LDY #2 ASSUME TWO BYTE ADDRESS + CMP #$5C CHECK FOR "JMP LONG" + BEQ .2 ...YES, 3 BYTES OF ADDRESS + CMP #$22 CHECK FOR "JSL" + BNE .3 ...NO, ONLY 2 BYTES OF ADDRESS +.2 INY 3 BYTE ADDRESS +.3 STY ADDR.LENGTH + JMP EMIT.OP.AND.VALUE +.4 JMP ERBA.EMIT.TWO +*-------------------------------- +ASM65816.TEST.EXP.VALUE.ZP + LDA EXP.VALUE+1 + ORA EXP.VALUE+2 + ORA EXP.VALUE+3 + RTS +*-------------------------------- +LONG.INDIRECT + JSR ASM65816.EXP1 + JSR ASM65816.GNC + CMP #']' + BNE ERBA.EMIT.TWO + JSR ASM65816.GNC + BEQ .1 ...[EXP] + CMP #',' + BNE ERBA.EMIT.TWO + JSR ASM65816.GNC.UC + CMP #'Y' + BNE ERBA.EMIT.TWO + LDA #$47 ...[EXP],Y + .HS 2C +.1 LDA #$44 ...[EXP],Y + STA MODE.BYTE + LDA #2 + STA ADDR.LENGTH + JMP CHECK.IF.SUFFIX.LEGAL +*-------------------------------- +IMMEDIATE + JSR ASM65816.GNC.UC + CMP DLIM 16-BIT IMMEDIATE? + BNE .1 ...NO, BACKUP + LDA LEVEL.MASK 16-BIT IMMEDIATE OKAY? + BPL ERBA.EMIT.TWO ...NOT AT 65816 LEVEL + INC ADDR.LENGTH ...YES, INCREASE LENGTH + BNE .2 ...ALWAYS +.1 DEC CHAR.PNTR +.2 JSR ASM65816.EXP1 + JSR ASM65816.GNC + BNE ERBA.EMIT.TWO ILLEGAL + LDA DLIM + CMP #'/' #=23, /=2F, ^=5E + BCC .4 ...# + BEQ .3 .../ + JSR ASM65816.EXP.OVER.256 ...^ +.3 JSR ASM65816.EXP.OVER.256 +.4 LDY #0 SIGNAL IMMEDIATE MODE + STY MODE.BYTE COPS NEEDS THIS <<<12-16-85>>> + RTS +*-------------------------------- +ERBA.EMIT.THREE + JSR ASM65816.EMIT.ZERO +ERBA.EMIT.TWO + JSR ASM65816.EMIT.ZERO + JSR ASM65816.EMIT.ZERO +ASM65816.ERBA + LDA #ERR.BAD.ADDRESS + JMP ASM65816.ASM.ERROR +ASM65816.EMIT.ZERO LDA #0 + JMP ASM65816.EMIT +*-------------------------------- +* RETURN: +* # BYTES IN ADDRESS IN ADDR.LENGTH +* (Y) = INDEX TO ADDR.MODE.BITS +*-------------------------------- +GENERAL.OPERAND + JSR ASM65816.GNNB GET NEXT NON-BLANK + BCS ERBA.EMIT.TWO ...NO OPERAND +*---PARSE PREFIX----------------- + LDY #1 + STY ADDR.LENGTH + STA DLIM + CMP #'(' + BEQ .3 ...indirect, must be ZP + CMP #'[' + BEQ LONG.INDIRECT + CMP #'#' + BEQ IMMEDIATE + CMP #'/' + BEQ IMMEDIATE + CMP #'^' + BEQ IMMEDIATE + CMP #'<' + BEQ .3 MAKE FORCE SIZE = 1 + DEY Y=0 + CMP #'>' + BNE .2 ...SIZE NOT FORCED + JSR ASM65816.GNC + LDY #3 Y=3 + CMP DLIM IS IT ">>"? + BEQ .3 ...YES + DEY Y=2 + STA DLIM CHANGE DLIM TO NEW VALUE + CMP #'(' IS IT (? + BEQ .3 ...YES, >( +.2 DEC CHAR.PNTR ...NO, SO BACKUP +.3 STY FORCE.ADDR.SIZE +*---PARSE THE EXPRESSION--------- + JSR ASM65816.EXP1 +*---FIGURE # OF BYTES------------ + LDX FORCE.ADDR.SIZE + BNE .6 ...FORCED WITH <, >, OR >> + LDX #2 ASSUME 2-BYTE ADDRESS + LDA EXP.UNDEF + BMI .6 + LDA PASS IGNORE FWD REF FLAG IN PASS 1 + BEQ .4 ...PASS 1 + LDA EXP.FWDREF ...PASS 2, DEFINED + BNE .4 ...BUT NOT FWD REF + LDA EXP.VALUE+3 ...FWD REF MUST BE ONLY + ORA EXP.VALUE+2 16 BITS + BEQ .6 ...IT FITS! + BNE ERBA.1 ...ALWAYS, ERBA +.4 LDA EXP.VALUE+3 DO NOT ALLOW 32-BITS + BNE ERBA.1 ...BAD ADDR + LDA EXP.VALUE+2 + BNE .5 ...3-BYTE ADDRESS + DEX X=1 + LDA EXP.VALUE+1 + BEQ .6 ...ZP +.5 INX +.6 STX ADDR.LENGTH +*---PARSE SUFFIX----------------- + DEX MAKE 0, 1, OR 2 + STX MODE.BYTE + LDX #6 +.7 JSR ASM65816.GNC.UC +.8 CMP MODE.CHARS,X + BEQ .9 + CLC + ROL MODE.BYTE + DEX + BPL .8 + BMI ERBA.1 +.9 CMP #' ' BLANK? + BEQ CHECK.IF.SUFFIX.LEGAL ...YES, END OF OPERAND + CMP #')' RIGHT PAREN? + BNE .10 ...NO + LDA DLIM WAS THERE A LEFT PAREN? + CMP #'(' + BNE ERBA.1 ...NO +.10 SEC + ROL MODE.BYTE + DEX + BPL .7 +ERBA.1 JMP ERBA.EMIT.TWO ILLEGAL +*-------------------------------- +CHECK.IF.SUFFIX.LEGAL + LDY #0 SEARCH FORWARD FOR VARIOUS REASONS + LDA MODE.BYTE +.13 INY + CPY #MODE.TABLE.SIZE+1 + BCS ERBA.1 ...END OF TABLE + CMP MODE.TABLE-1,Y + BNE .13 ...KEEP LOOKING + RTS +*-------------------------------- +SEE.IF.MODE.LEGAL.AT.LEVEL + LDA LEVEL.MASK + BMI .15 ...65816 LEVEL, ALL LEGAL + CPY #9 + BCC .15 ...6502 MODES + BEQ .14 ...65C02 MODE + CPY #16 + BNE ERBA.1 +.14 AND #$20 AT C02 LEVEL? + BEQ ERBA.1 ...NO +.15 RTS +*-------------------------------- +ASM65816.EXP.OVER.256 + LDA EXP.VALUE+1 + STA EXP.VALUE + LDA EXP.VALUE+2 + STA EXP.VALUE+1 + LDA EXP.VALUE+3 + STA EXP.VALUE+2 + LDA #0 + STA EXP.VALUE+3 + RTS + .DO ROCKWELL +*-------------------------------- +* ROCKWELL 65C02 EXCLUSIVES +* +* RMB bit#,zp +* SMB bit#,zp +* BBR bit#,zp,reladdr +* BBS bit#,zp,reladdr +*-------------------------------- +OP.ROCKB + JSR OP.ROCKWELL + JSR ASM65816.GNC REQUIRE A COMMA + CMP #',' + BNE .1 ...NO COMMA + LDA EXP.VALUE + PHA SAVE ZP VALUE + JSR ASM65816.EXP1 GET BRANCH EXPRESSION + JSR EMIT.OPBASE <<<12-16-85>>> + PLA + JMP OP.REL8.A +.1 JMP ERBA.EMIT.THREE +*-------------------------------- +OP.ROCKC + JSR OP.ROCKWELL + .FIN +EMIT.OP.AND.EXP.BYTE + JSR EMIT.OPBASE <<<12-16-85>>> + JMP EMIT.EXP.BYTE <<<12-16-85>>> +*-------------------------------- + .DO ROCKWELL +OP.ROCKWELL + JSR ASM65816.EXPR GET BIT # + JSR ASM65816.TEST.EXP.VALUE.ZP + BNE .1 ...MUST BE SMALL NUMBER! + LDA EXP.VALUE + CMP #8 MUST BE 0...7 + BCS .1 ...TOO LARGE + ASL + ASL + ASL + ASL + ORA OPBASE MERGE INTO OPCODE + STA OPBASE + JSR ASM65816.GNC NEED A COMMA NOW + CMP #',' + BNE .1 + JSR ASM65816.EXP1 GET ZP VALUE + JSR ASM65816.TEST.EXP.VALUE.ZP + BNE .1 MUST BE ZERO PAGE + RTS +.1 JMP ERBA.EMIT.TWO +*-------------------------------- + .ELSE +OP.ROCKB +OP.ROCKC + JMP BADOPERR + .FIN + + .DO SWEET.16 +*-------------------------------- +* SWEET-16 OPCODES +*-------------------------------- +OP.POP + JSR ASM65816.GNC.UC SEE WHICH: POP OR POPD + BEQ OP.XN ...POP + CMP #'D' + BEQ .1 + JMP BADOPERR +.1 LDA #$A2 ...POP + STA OPBASE +*-------------------------------- +OP.XN + JSR ASM65816.GNNB + BCS SWEET.ERBA + CMP #'@' + BNE .1 ...NOT '@N' + LDA OPBASE ...'@N', SEE IF LEGAL + AND #2 + BEQ SWEET.ERBA ...NOT LEGAL WITH THIS OP + LDA OPBASE ...LEGAL, ADD $20 + ADC #$1F .CS., SO 1F IS 20 + BNE .2 ...ALWAYS +.1 DEC CHAR.PNTR Backup character pointer + LDA OPBASE + LSR + BCC SWEET.ERBA 'N' NOT LEGAL FOR THIS OP + LDA OPBASE +.2 AND #$F0 CLEAR AWAY LEGALITY FLAGS + STA OPBASE + JSR ASM65816.EXP1 GET REGISTER NUMBER + JSR ASM65816.TEST.EXP.VALUE.ZP + BNE SWEET.RAER + LDA EXP.VALUE + CMP #$10 + BCS SWEET.RAER + ORA OPBASE + JMP ASM65816.EMIT +*-------------------------------- +SWEET.ERBA JMP ASM65816.ERBA +SWEET.RAER JMP ASM65816.RAER +*-------------------------------- +OP.SET + JSR OP.XN + JSR ASM65816.GNC + CMP #',' + BNE SWEET.ERBA + JSR ASM65816.EXP1 + LDA #2 + STA ADDR.LENGTH + JMP ASM65816.EMIT.VALUE +*-------------------------------- + .ELSE +OP.POP +OP.XN +OP.SET + JMP BADOPERR + .FIN +*-------------------------------- +LEGAL.JUMP.MODES + .HS FF.00.00.FF.FF.FF + .HS FF.FF.03.02.FF.FF + .HS 01.FF.02.FF.03 +*-------------------------------- +JUMP.OPCODES + .HS 4C.5C.6C.7C JMP + .HS 20.22.00.FC JSR + .HS 00.00.DC.00 JML + .HS 22.22.00.00 JSL + .HS F4.00.00.00 PEA +*-------------------------------- +MODE.CHARS + .AS / Y,)SX,/ +*-------------------------------- +MODE.TABLE + .HS 00 1 -- DIRECT + .HS 40 2 -- ABSOLUTE + .HS 30 3 -- DIRECT,X + .HS 70 4 -- ABSOLUTE,X + .HS 21 5 -- DIRECT,Y + .HS 61 6 -- ABSOLUTE,Y + .HS 07 7 -- (DIRECT),Y + .HS 34 8 -- (DIRECT,X) +*---IN 65C02, 802, 816----------- + .HS 04 9 -- (DIRECT) +*---IN 65802, 816---------------- + .HS 28 A -- ...,S + .HS 2F B -- (...,S),Y +*---ONLY IN 65816---------------- + .HS 80 C -- LONG + .HS B0 D -- LONG,X + .HS 44 E -- >(DIRECT) + .HS 47 F -- >(DIRECT),Y +*---SPECIAL FOR JMP,JSR (A,X)---- + .HS 74 10 -- (ABSOLUTE,X) +MODE.TABLE.SIZE .EQ *-MODE.TABLE +*-------------------------------- +ADDR.MODE.BITS.CLASS.1 + .HS 08 0 -- IMMEDIATE + .HS 04 1 -- DIRECT + .HS 0C 2 -- ABSOLUTE + .HS 14 3 -- DIRECT,X + .HS 1C 4 -- ABSOLUTE,X + .HS FF 5 -- DIRECT,Y <<>> + .HS 18 6 -- ABSOLUTE,Y + .HS 10 7 -- (DIRECT),Y + .HS 00 8 -- (DIRECT,X) +*---IN 65C02, 802, 816----------- + .HS 13 9 -- (DIRECT) +*---IN 65802, 816---------------- + .HS 02 A -- ...,S + .HS 12 B -- (...,S),Y +*---ONLY IN 65816---------------- + .HS 0E C -- LONG + .HS 1E D -- LONG,X + .HS 06 E -- >(DIRECT) + .HS 16 F -- >(DIRECT),Y +*-------------------------------- +ADDR.MODE.BITS.CLASS.5 + .HS 00 0 -- IMMEDIATE + .HS 04 1 -- DIRECT + .HS 0C 2 -- ABSOLUTE + .HS 14 3 -- DIRECT,X + .HS 1C 4 -- ABSOLUTE,X + .HS 14 5 -- DIRECT,Y + .HS 1C 6 -- ABSOLUTE,Y +*-------------------------------- +CLASS.5.MODE.MASKS + .HS 80.40.20.10.08.04.02 +*-------------------------------- +FIRST.LETTER.TABLE + .DA #LTR.A-OPCODE.TABLE + .DA #LTR.B-OPCODE.TABLE + .DA #LTR.C-OPCODE.TABLE + .DA #LTR.D-OPCODE.TABLE + .DA #LTR.E-OPCODE.TABLE + .DA #LTR.F-OPCODE.TABLE + .DA #LTR.G-OPCODE.TABLE + .DA #LTR.H-OPCODE.TABLE + .DA #LTR.I-OPCODE.TABLE + .DA #LTR.J-OPCODE.TABLE + .DA #LTR.K-OPCODE.TABLE + .DA #LTR.L-OPCODE.TABLE + .DA #LTR.M-OPCODE.TABLE + .DA #LTR.N-OPCODE.TABLE + .DA #LTR.O-OPCODE.TABLE + .DA #LTR.P-OPCODE.TABLE + .DA #LTR.Q-OPCODE.TABLE + .DA #LTR.R-OPCODE.TABLE + .DA #LTR.S-OPCODE.TABLE + .DA #LTR.T-OPCODE.TABLE + .DA #LTR.U-OPCODE.TABLE + .DA #LTR.V-OPCODE.TABLE + .DA #LTR.W-OPCODE.TABLE + .DA #LTR.X-OPCODE.TABLE + .DA #LTR.Y-OPCODE.TABLE + .DA #LTR.Z-OPCODE.TABLE +*-------------------------------- +* TWO KINDS OF ENTRIES, DISTINGUISHED BY FIRST BIT: +* 8-BIT ENTRIES: FIRST BIT = 0 +* 24-BIT ENTRIES: FIRST BIT = 1 +* +* FIRST ENTRY AT EACH LETTER IS AN 8-BIT ENTRY. +* EACH 8-BIT ENTRY IS FOLLOWED BY ONE OR MORE +* 24-BIT ENTRIES. +* THE SUB-LIST OF 24-BIT ENTRIES IS TERMINATED +* BY THE NEXT 8-BIT ENTRY. +* THE LIST OF 8-BIT ENTRIES IS TERMINATED BY +* AN 8-BIT ENTRY WITH BIT 6 = 1. +* +* THE VALUE OF BITS 5-0 IN AN 8-BIT ENTRY +* IS THE DIMINISHED ASCII CODE FOR THE +* SECOND LETTER OF AN OPCODE. +* THE VALUE OF BITS 5-0 OF A 24-BIT ENTRY +* IS THE DIMINISHED ASCII CODE FOR THE +* THIRD LETTER OF AN OPCODE. +* A...Z = $81...9A +* BLANK = $E0 +* '1' = $F1 +* THE VALUE OF THE SECOND BYTE OF A 24-BIT +* ENTRY IS AN OPCODE BASE. +* THE THIRD BYTE OF A 24-BIT ENTRY HAS TWO PARTS: +* BITS 4-1 ARE AN INDEX TO THE OP.MODE +* JUMP TABLE IN ASM.65816 +* BITS 7-5 AND 0 ARE LEVEL MASK BITS. +* 000XXXX0 = 6502 OPCODE +* 000XXXX1 = SWEET-16 +* 001XXXX0 = 65C02 +* 010XXXX0 = ROCKWELL SPECIALS +* 100XXXX0 = 65816 +* +* LEVEL.MASK = $00 FOR 6502 +* = $20 FOR 65C02 +* = $60 FOR ROCKWELL C02 +* = $A0 FOR 65816 +*-------------------------------- +OP..1 .SE 0 +OP..2 .SE 0 + .MA OP + .DO "]1"=OP..1=0 +LTR.]1 .DA #"]2"-$80 bits 76 = 01 +OP..1 .SE "]1" +OP..2 .SE "]2" + .ELSE + .DO "]2"=OP..2=0 + .DA #"]2"-$C0 bits 76 = 00 +OP..2 .SE "]2" + .FIN + .FIN + .DA #"]3"^$40,#$]4,#O..]5!O..]6 bits 76 = 10 or 11 + .EM +*-------------------------------- +O..65816 .EQ $80 +O..65R02 .EQ $40 +O..65C02 .EQ $20 +O..SWEET .EQ $01 +O.. .EQ $00 +*-------------------------------- +OPCODE.TABLE +LTR.F +LTR.G +LTR.H +LTR.K +LTR.Q +LTR.U +LTR.V +LTR.Y +LTR.Z .HS 00 +*-------------------------------- + >OP A,D,C,61,COPS + >OP A,D,D,A1,XN,SWEET + >OP A,N,D,21,COPS + >OP A,S,L,02,SHIFTS + >OP B,C,C,90,REL8 + >OP B,C,S,B0,REL8 + >OP B,C," ",03,REL8,SWEET + >OP B,E,Q,F0,REL8 + >OP B,G,E,B0,REL8 + >OP B,I,T,00,BITS + >OP B,L,T,90,REL8 + >OP B,M,I,30,REL8 + >OP B,M," ",05,REL8,SWEET + >OP B,M,1,08,REL8,SWEET + >OP B,N,E,D0,REL8 + >OP B,N,C,02,REL8,SWEET + >OP B,N,M,09,REL8,SWEET (BNM1) + >OP B,N,Z,07,REL8,SWEET + >OP B,P,L,10,REL8 + >OP B,P," ",04,REL8,SWEET + >OP B,R,A,80,REL8,65C02 + >OP B,R,K,00,SNGL + >OP B,R,L,82,REL16,65816 + >OP B,R," ",01,REL8,SWEET + >OP B,V,C,50,REL8 + >OP B,V,S,70,REL8 + >OP B,B,R,0F,ROCKB,65R02 + >OP B,B,S,8F,ROCKB,65R02 + >OP B,K," ",0A,SNGL,SWEET + >OP B,S," ",0C,REL8,SWEET + >OP B,Z," ",06,REL8,SWEET + >OP C,L,C,18,SNGL + >OP C,L,D,D8,SNGL + >OP C,L,I,58,SNGL + >OP C,L,V,B8,SNGL + >OP C,M,P,C1,COPS + >OP C,O,P,02,CRS,65816 + >OP C,P,X,04,BITS + >OP C,P,Y,03,BITS + >OP C,P,R,D1,XN,SWEET + >OP D,E,C,C2,SHIFTS + >OP D,E,X,CA,SNGL + >OP D,E,Y,88,SNGL + >OP D,C,R,F1,XN,SWEET + >OP E,O,R,41,COPS + >OP I,N,C,E2,SHIFTS + >OP I,N,X,E8,SNGL + >OP I,N,Y,C8,SNGL + >OP I,N,R,E1,XN,SWEET + >OP J,M,L,08,JUMPS,65816 + >OP J,M,P,00,JUMPS + >OP J,S,L,0C,JUMPS,65816 + >OP J,S,R,04,JUMPS + >OP L,D,A,A1,COPS + >OP L,D,X,02,BITS + >OP L,D,Y,01,BITS + >OP L,D," ",23,XN,SWEET + >OP L,D,D,42,XN,SWEET + >OP L,S,R,42,SHIFTS + >OP M,V,N,54,MOVES,65816 + >OP M,V,P,44,MOVES,65816 + >OP N,O,P,EA,SNGL + >OP O,R,A,01,COPS + >OP P,E,A,10,JUMPS,65816 + >OP P,E,I,0A,BITS,65816 + >OP P,E,R,62,REL16,65816 + >OP P,H,A,48,SNGL + >OP P,H,B,8B,SNGL,65816 + >OP P,H,D,0B,SNGL,65816 + >OP P,H,K,4B,SNGL,65816 + >OP P,H,P,08,SNGL + >OP P,H,X,DA,SNGL,65C02 + >OP P,H,Y,5A,SNGL,65C02 + >OP P,L,A,68,SNGL + >OP P,L,B,AB,SNGL,65816 + >OP P,L,D,2B,SNGL,65816 + >OP P,L,P,28,SNGL + >OP P,L,X,FA,SNGL,65C02 + >OP P,L,Y,7A,SNGL,65C02 + >OP P,O,P,62,POP,SWEET (POP,POPD) + >OP R,E,P,C2,CRS,65816 + >OP R,O,L,22,SHIFTS + >OP R,O,R,62,SHIFTS + >OP R,T,I,40,SNGL + >OP R,T,L,6B,SNGL,65816 + >OP R,T,S,60,SNGL + >OP R,T,N,00,SNGL,SWEET + >OP R,M,B,07,ROCKC,65R02 + >OP R,S," ",0B,SNGL,SWEET + >OP S,B,C,E1,COPS + >OP S,E,C,38,SNGL + >OP S,E,D,F8,SNGL + >OP S,E,I,78,SNGL + >OP S,E,P,E2,CRS,65816 + >OP S,E,T,11,SET,SWEET + >OP S,T,A,81,COPS + >OP S,T,P,DB,SNGL,65816 + >OP S,T,P,72,XN,SWEET + >OP S,T,X,06,BITS + >OP S,T,Y,05,BITS + >OP S,T,Z,07,BITS,65C02 + >OP S,T," ",33,XN,SWEET + >OP S,T,D,52,XN,SWEET + >OP S,U,B,B1,XN,SWEET + >OP S,M,B,87,ROCKC,65R02 + >OP T,A,X,AA,SNGL + >OP T,A,Y,A8,SNGL + >OP T,C,D,5B,SNGL,65816 + >OP T,C,S,1B,SNGL,65816 + >OP T,D,C,7B,SNGL,65816 + >OP T,R,B,09,BITS,65C02 + >OP T,S,B,08,BITS,65C02 + >OP T,S,C,3B,SNGL,65816 + >OP T,S,X,BA,SNGL + >OP T,X,A,8A,SNGL + >OP T,X,S,9A,SNGL + >OP T,X,Y,9B,SNGL,65816 + >OP T,Y,A,98,SNGL + >OP T,Y,X,BB,SNGL,65816 + >OP W,A,I,CB,SNGL,65816 + >OP W,D,M,42,SNGL,65816 + >OP X,B,A,EB,SNGL,65816 + >OP X,C,E,FB,SNGL,65816 + .HS 40 <<>> +*-------------------------------- +CLASS.5.OPS +* BIT LDY LDX CPY CPX STY STX STZ + .HS 20..A0..A2..C0..E0..80..82..60 +* +* TSB TRB PEI + .HS 00..10..D0 +* +CLASS.5.LEGAL.MODES + .HS F8..F8..E6..E0..E0..70..64..78 + .HS 60..60..40 +* +* 80 -- IMMEDIATE +* 40 -- DIRECT +* 20 -- ABSOLUTE +* 10 -- DIRECT,X +* 08 -- ABSOLUTE,X +* 04 -- DIRECT,Y +* 02 -- ABSOLUTE,Y +* 01 -- <<>> +*-------------------------------- +* OPCODE TABLE SELECTION +* .OP 6502/65C02/R65C02/65816/SWEET16,... +*-------------------------------- +DIR.OP LDA #0 + STA LEVEL.MASK + LDA #15 + STA EMIT.MARGIN +.1 JSR ASM65816.GNC.UC GET NEXT CHARACTER + BCS .5 END + LDY #-2 +.2 INY + INY + LDA PSOP.TABLE,Y + BEQ .1 ...END OF TABLE, TRY NEXT CHARACTER + CMP CURRENT.CHAR + BNE .2 ...NOT THIS ONE +.3 LDA PSOP.TABLE+1,Y + STA LEVEL.MASK + BPL .5 + LDA #18 + STA EMIT.MARGIN +.5 RTS RETURN TO ASSEMBLER +*-------------------------------- +PSOP.TABLE + .DA #'8',#$A0 65816 = $A0 + .DA #'C',#$20 65C02 = $20 + .DO ROCKWELL + .DA #'R',#$60 ROCKWELL= $60 + .FIN + .DO SWEET.16 + .DA #'S',#$01 SWEET-16= $01 + .FIN + .DA #0 +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/asm65816.s +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/IO.S.IIE..txt b/SCMASM.30/IO.S.IIE..txt new file mode 100644 index 00000000..7b6a29fa --- /dev/null +++ b/SCMASM.30/IO.S.IIE..txt @@ -0,0 +1,137 @@ +NEW + AUTO 3,1 +*-------------------------------------- + .PH $A800 +*-------------------------------- +* I/O VECTORS -- 3 BYTES EACH +*-------------------------------- + JMP IIE.INIT + JMP IIE.WARM + JMP IIE.RDKEY + JMP S.GET.HORIZ.POSN + JMP MON.HOME + JMP MON.CLREOL + JMP MON.CLREOP + JMP MON.UP + JMP MON.LF + JMP IIE.LEFT + JMP IIE.RIGHT + JMP IIE.COUT + JMP IIE.PICK.SCREEN + JMP IIE.HTABX + JMP IIE.HTAB + JMP IIE.VTAB +*---Case Toggle MUST go here----- + RTS +*-------------------------------- +* VARIABLE LENGTH ROUTINES +*-------------------------------- +IIE.INIT + LDA $BF98 + AND #2 + BEQ IO.HOME + LDA #$99 CTRL-Y + JMP $C300 +*-------------------------------- +IIE.HTABX + PHA + TXA + JSR IIE.HTAB + PLA + RTS +*-------------------------------- +IIE.HTAB + BIT $C01F + BPL .1 + STA $57B + RTS +.1 STA CH + RTS +*-------------------------------- +S.GET.HORIZ.POSN + LDA $57B + BIT $C01F + BMI .1 + LDA CH +.1 RTS +*-------------------------------- +IIE.WARM + CLD + LDX CV SAVE CV + JSR MON.INIT + TXA GET CV, FALL INTO VTAB +IIE.VTAB + STA CV + JMP MON.VTAB +*-------------------------------- +IIE.RDKEY + LDA #40 + BIT $C01F + BPL .1 + ASL +.1 STA SCREEN.WIDTH + JSR MON.RDKEY + CMP #$FF + BNE .2 + LDA #$88 +.2 ASL $C061 SET CARRY IF "OPEN APPLE" PRESSED + ORA #$80 + RTS +*-------------------------------- +IIE.COUT + CMP #$80 NORMAL OR INVERSE? + BCS .2 ...NORMAL + BIT $C01F ...INVERSE; 40- OR 80-COLUMNS? + BPL .2 ...40-COLUMN + PHA ...80-COLUMN + LDA #$8F SELECT INVERSE DISPLAY + JSR MON.COUT + PLA + CMP #$20 CONTROL CHAR? + BCS .1 ...NO + ORA #$40 MAKE PRINTABLE CHARACTER +.1 ORA #$80 + JSR MON.COUT + LDA #$8E SELECT NORMAL DISPLAY +.2 JMP MON.COUT +*-------------------------------- +IIE.PICK.SCREEN + BIT $C01F + BMI .1 + LDA (BASL),Y + RTS +.1 TYA + LSR + TAY + PHP + SEI + LDA $C055 + BCC .2 + LDA $C054 +.2 LDA (BASL),Y + BIT $C054 + PLP + PHA SAVE CHAR FROM SCREEN + TYA RESTORE Y-REG + ROL + TAY + PLA + RTS +*-------------------------------- +IIE.RIGHT + BIT $C01F IN 80-COLUMN MODE? + BMI .1 ...YES + JMP MON.ADVANC +.1 LDA #$9C FORWARD SPACE + .HS 2C SKIP TWO BYTES +*-------------------------------- +IIE.LEFT + LDA #$88 BACKSPACE + JMP MON.COUT +*-------------------------------------- + .EP +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/io.s.iie +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/IO.S.IIE.ULTRA.txt b/SCMASM.30/IO.S.IIE.ULTRA.txt new file mode 100644 index 00000000..a4fbb248 --- /dev/null +++ b/SCMASM.30/IO.S.IIE.ULTRA.txt @@ -0,0 +1,270 @@ +NEW + AUTO 3,1 +*-------------------------------------- + .PH $A800 +*-------------------------------- +* VIDEX ULTRATERM DRIVER -- ASSUME SLOT 3 +ULTRA.SLOT .EQ 3 +SKMOD .EQ 1 SHIFT KEY MOD (=0 FOR //E VERSION) +*-------------------------------- +* TO MAKE THE EDIT COMMAND USE MORE THAN 24 LINES, +* CHANGE $17 TO $1F OR $2F AT $803A +*-------------------------------- +ULTRA.SCREEN.WIDTH .EQ $A5 +*-------------------------------- +ULTRA.CARD .EQ ULTRA.SLOT*256+$C000 +ULTRA.COUT1 .EQ ULTRA.SLOT*256+$C007 +*-------------------------------- +ULTRA.REG .EQ ULTRA.SLOT*16+$C080 +ULTRA.DATA .EQ ULTRA.SLOT*16+$C081 +*-------------------------------- +ULTRA.HORIZ .EQ $0578+ULTRA.SLOT +ULTRA.START .EQ $06F8+ULTRA.SLOT TOP-OF-SCREEN ADDRESS / 16 +ULTRA.CHPG .EQ $0678 +ULTRA.TEMPX .EQ $0778 +ULTRA.TEMPY .EQ $07F8 +ULTRA.FLAGS .EQ $07F8+ULTRA.SLOT +*-------------------------------- +* I/O VECTORS -- 3 BYTES EACH +*-------------------------------- + JMP ULTRA.INIT + JMP ULTRA.WARM + JMP ULTRA.READ.KEY.WITH.CASE + JMP ULTRA.GET.HORIZ.POSN + LDA #$8C ^L--HOME + .HS 2C + LDA #$9D ^]--CLREOL + .HS 2C + LDA #$8B ^K--CLREOP + .HS 2C + LDA #$9F ^_--UP + .HS 2C + LDA #$8A ^J--DOWN + .HS 2C + LDA #$88 ^H--LEFT + .HS 2C + LDA #$9C ^\--RIGHT + NOP + JMP MON.COUT + JMP ULTRA.PICK.SCREEN + JMP ULTRA.HTABX + JMP ULTRA.HTAB + JMP ULTRA.VTAB +*---Case Toggle MUST go here----- + LDA ULTRA.FLAGS + EOR #$40 + STA ULTRA.FLAGS + RTS +*-------------------------------- +* VARIABLE LENGTH ROUTINES +*-------------------------------- +ULTRA.HTABX + PHA + TXA + JSR ULTRA.HTAB + PLA + RTS +*-------------------------------- +ULTRA.GET.HORIZ.POSN + LDA ULTRA.HORIZ + RTS +*-------------------------------- +ULTRA.VTAB + STA CV + LDA ULTRA.HORIZ +ULTRA.HTAB + PHA SAVE HORIZ POSN + LDA #$9E + JSR ULTRA.COUT1 + PLA GET HORIZ POSN + JSR .1 + LDA CV + +.1 CLC ADD $A0 OFFSET + ADC #$A0 + JMP ULTRA.COUT1 +*-------------------------------- +ULTRA.INIT + LDA #80 + STA ULTRA.SCREEN.WIDTH + LDA #$8C CLEAR SCREEN AND START VIDEX-80 + STA $C00B SWITCH OFF //E C3 ROM + STA $C006 SWITCH OFF //E C100-C7FF ROM + JSR ULTRA.CARD +ULTRA.INSTALL.VECTORS + LDX #1 +.1 LDA ULTRA.VECTORS,X + STA $36,X + STA ULTRA.SLOT*2+$BE10,X + LDA ULTRA.VECTORS+2,X + BIT F.EXEC + BMI .2 + STA $38,X +.2 STA ULTRA.SLOT*2+$BE20,X + DEX + BPL .1 + RTS +*-------------------------------- +ULTRA.VECTORS + .DA ULTRA.COUT + .DA ULTRA.RDKEY +*-------------------------------- +ULTRA.WARM + CLD + LDX CV + JSR MON.INIT + STX CV + JMP ULTRA.INSTALL.VECTORS +*-------------------------------- +* READ KEY WITH CASE CONTROL +*-------------------------------- +ULTRA.READ.KEY.WITH.CASE + JSR MON.RDKEY + ORA #$80 REQUIRED FOR EXEC COMMAND + CLC SIGNAL NO OPEN APPLE + RTS +*-------------------------------- +ULTRA.RDKEY + CLD + LDA #$0A SELECT BLINKING DOUBLE UNDERLINE CURSOR + STA ULTRA.REG + LDA #$67 + STA ULTRA.DATA + LDA #$0B + STA ULTRA.REG + LDA #$08 + STA ULTRA.DATA +.1 LDA $C000 + BPL .1 + STA $C010 + PHA + LDA #$06 HIDE THE CURSOR + STA ULTRA.DATA + PLA + CMP #$8D + BNE .2 + JSR IO.CLREOL + LDA #$8D + .DO SKMOD +.2 PHA CHECK SHIFT LOCK FLAG + LDA ULTRA.FLAGS + ASL + ASL + PLA + BCC .5 ...SHIFT LOCK IS ON + CMP #$C0 + BCC .5 NOT IN ALPHA RANGE + BEQ .3 ...@ IS CAPITAL P + ORA #$20 ADJUST TO LOWER CASE + BIT $C063 TEST SHIFT KEY (PB3) + BMI .5 ...NOT PRESSED, LOWER CASE + CMP #$FB + BCC .4 ...NORMAL A-Z +.3 EOR #$10 CHANGE @ to P, [\]^_ to KLMNO +.4 AND #$DF UPPER CASE +.5 RTS + .ELSE +.2 RTS + .FIN +*-------------------------------- +ULTRA.COUT + CLD + PHA + STA MON.INVFLG BIT 7 CONTROLS INV/NORM + CMP #$20 CATCH INV CTRL CHARS + BCS .1 ...NOT ONE + ORA #$40 MAKE CTRL VISIBLE +.1 JSR ULTRA.COUT1 + LDA #$FF + STA MON.INVFLG + PLA + RTS +*-------------------------------- +W16TBL .DA #80/16 + .DA #96/16 + .DA #160/16 + .DA #80/16 + .DA #80/16 + .DA #80/16 + .DA #160/16 + .DA #128/16 +*-------------------------------- +* GET CHARACTER OFF CURRENT SCREEN LINE, COLUMN (Y) +*-------------------------------- +ULTRA.PICK.SCREEN + STY ULTRA.TEMPY + STX ULTRA.TEMPX + BIT $CFFF + BIT ULTRA.CARD TURN ON SCREEN +*-------------------------------- + LDA ULTRA.FLAGS GET MODE (0...7) + AND #$07 + TAY Y = MODE INDEX (0...7) +*-------------------------------- + LDA ULTRA.TEMPY HORIZ. POSN + CPY #$06 132 COL MODE? + BNE .1 ...NOT 132 COLUMNS + ADC #14 ADJUST FOR 132 COLUMN MODE +.1 STA ULTRA.CHPG +*-------------------------------- + LDX W16TBL,Y GET WIDTH/16 + LDA ULTRA.START CV*(WIDTH/16) + START +.2 CLC INCLUDE 'CLC' IN LOOP ON PURPOSE + ADC CV TO FORCE WRAP-AROUND + DEX + BNE .2 +*-------------------------------- + PHA + LSR *16 + LSR + LSR + LSR + TAX SAVE PAGE VALUE IN X-REG + PLA + ASL + ASL + ASL + ASL +*-------------------------------- + CLC + CH (or CH+15 if 132 columns) + ADC ULTRA.CHPG + STA ULTRA.CHPG + BCC .3 + INX ADD CARRY TO PAGE VALUE +*-------------------------------- +.3 TXA GET PAGE VALUE + AND #$0F + ORA MODETBL,Y + STA ULTRA.REG+2 +*-------------------------------- + ASL + AND #$0C + TAY + LDA ULTRA.REG,Y + TXA GET PAGE VALUE AGAIN + LSR SET CARRY IF IN 2ND PAGE +*-------------------------------- + LDY ULTRA.CHPG + LDA $CC00,Y + BCC .4 + LDA $CD00,Y +.4 ORA #$80 MAKE HIGH ASCII + LDY ULTRA.TEMPY RESTORE REGS + LDX ULTRA.TEMPX + RTS ALL DONE +*-------------------------------- +MODETBL .HS 40 80X24 (VIDEOTERM EMULATION) + .HS 50 96X24 + .HS 70 160X24 + .HS 50 80X24 INTERLACE + .HS 50 80X32 INTERLACE + .HS 50 80X48 INTERLACE + .HS 70 132X24 INTERLACE + .HS 70 128X32 INTERLACE +*-------------------------------------- + .EP +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/io.s.ultra +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/IO.S.IIE.VIDEX.txt b/SCMASM.30/IO.S.IIE.VIDEX.txt new file mode 100644 index 00000000..bc141359 --- /dev/null +++ b/SCMASM.30/IO.S.IIE.VIDEX.txt @@ -0,0 +1,219 @@ +NEW + AUTO 3,1 +*-------------------------------------- + .PH $A800 +*-------------------------------- +VIDEX.SCREEN.WIDTH .EQ $A5 +*-------------------------------- +VIDEX.SLOT .EQ 3 ASSUME SLOT 3 +*-------------------------------- +VIDEX.CARD .EQ VIDEX.SLOT*256+$C000 +VIDEX.COUT1 .EQ VIDEX.SLOT*256+$C007 +VIDEX.REG .EQ VIDEX.SLOT*16+$C080 +VIDEX.DATA .EQ VIDEX.SLOT*16+$C081 +*-------------------------------- +VIDEX.BASEL .EQ $0478+VIDEX.SLOT +VIDEX.BASEH .EQ $04F8+VIDEX.SLOT +VIDEX.HORIZ .EQ $0578+VIDEX.SLOT +VIDEX.CHAR .EQ $0678+VIDEX.SLOT +*-------------------------------- +* I/O VECTORS -- 3 BYTES EACH +*-------------------------------- + JMP VIDEX.INIT + JMP VIDEX.WARM + JMP VIDEX.READ.KEY.WITH.CASE + JMP VIDEX.GET.HORIZ.POSN + LDA #$8C ^L--HOME + .HS 2C + LDA #$9D ^]--CLREOL + .HS 2C + LDA #$8B ^K--CLREOP + .HS 2C + LDA #$9F ^_--UP + .HS 2C + LDA #$8A ^J--DOWN + .HS 2C + LDA #$88 ^H--LEFT + .HS 2C + LDA #$9C ^\--RIGHT + NOP + JMP MON.COUT + JMP VIDEX.PICK.SCREEN + JMP VIDEX.HTABX + JMP VIDEX.HTAB + JMP VIDEX.VTAB +*---Case Toggle MUST go here----- + LDA CASEFLG + EOR #$80 + STA CASEFLG + RTS +*-------------------------------- +* VARIABLE LENGTH ROUTINES +*-------------------------------- +VIDEX.HTABX + PHA + TXA + JSR VIDEX.HTAB + PLA + RTS +*-------------------------------- +VIDEX.GET.HORIZ.POSN + LDA VIDEX.HORIZ + RTS +*-------------------------------- +VIDEX.VTAB + STA CV + LDA VIDEX.HORIZ +VIDEX.HTAB + PHA SAVE HORIZ POSN + LDA #$9E + JSR VIDEX.COUT1 + PLA GET HORIZ POSN + CLC + ADC #$A0 + JSR VIDEX.COUT1 + LDA CV + ORA #$A0 + JMP VIDEX.COUT1 +*-------------------------------- +VIDEX.INIT + LDA #80 + STA VIDEX.SCREEN.WIDTH + STA CASEFLG CLEAR CASEFLG (BIT7=0) + LDA #$8C CLEAR SCREEN AND START VIDEX-80 + JSR VIDEX.CARD +VIDEX.INSTALL.VECTORS + LDX #1 +.1 LDA VIDEX.VECTORS,X + STA $36,X + STA VIDEX.SLOT*2+$BE10,X + LDA VIDEX.VECTORS+2,X + BIT F.EXEC + BMI .2 + STA $38,X +.2 STA VIDEX.SLOT*2+$BE20,X + DEX + BPL .1 + RTS +*-------------------------------- +VIDEX.VECTORS + .DA VIDEX.COUT + .DA VIDEX.RDKEY +*-------------------------------- +VIDEX.WARM + CLD + LDX CV + JSR MON.INIT + STX CV + JMP VIDEX.INSTALL.VECTORS +*-------------------------------- +* READ KEY WITH CASE CONTROL +*-------------------------------- +VIDEX.READ.KEY.WITH.CASE + JSR MON.RDKEY + ORA #$80 REQUIRED FOR EXEC COMMAND + CLC SIGNAL NO OPEN APPLE + RTS +*-------------------------------- +VIDEX.RDKEY + CLD + LDA #$0A SELECT BLINKING DOUBLE UNDERLINE CURSOR + STA VIDEX.REG + LDA #$67 + STA VIDEX.DATA + LDA #$0B + STA VIDEX.REG + LDA #$08 + STA VIDEX.DATA +.1 LDA $C000 + BPL .1 + STA $C010 + PHA + LDA #$0A HIDE THE CURSOR + STA VIDEX.REG + LDA #$09 + STA VIDEX.DATA + PLA + CMP #$8D + BNE .2 + JSR IO.CLREOL + LDA #$8D +.2 BIT CASEFLG TEST CASE CONVERSION FLAG + BPL .6 DO NOT CONVERT + CMP #$B0 + BCC .6 DO NOT CONVERT + BIT $C063 TEST PADDLE BUTTON + BMI .5 NO SHIFTKEY PRESSED + CMP #$B0 + BEQ .4 + CMP #$C0 + BNE .3 + LDA #$D0 +.3 CMP #$DB + BCC .6 + AND #$CF + BNE .6 +.4 LDA #$DD +.5 ORA #$20 +.6 AND #$7F + STA VIDEX.CHAR + ORA #$80 + SEC + RTS +*-------------------------------- +VIDEX.COUT + CLD + CMP #$80 NORMAL OR INVERSE? + BCS .1 ...NORMAL + PHA ...80-COLUMN + LDA #$8F SELECT INVERSE DISPLAY + JSR VIDEX.COUT1 + PLA + ORA #$80 MAKE PRINTABLE CHARACTER + CMP #$A0 + BCS .2 + ORA #$40 +.2 JSR VIDEX.COUT1 + LDA #$8E SELECT NORMAL DISPLAY +.1 JMP VIDEX.COUT1 +*-------------------------------- +* GET CHARACTER OFF CURRENT SCREEN LINE, COLUMN (Y) +*-------------------------------- +VIDEX.PICK.SCREEN + STX SAVEX + BIT $CFFF TURN ON $C800 VIDEO SPACE + BIT VIDEX.CARD +*---CALCULATE POSITION----------- + CLC + TYA COLUMN 0-79 + ADC VIDEX.BASEL + PHA + LDA #0 + ADC VIDEX.BASEH + PHA + ASL + AND #$0C USE BIT 0 AND 1 FOR PAGING + TAX + LDA VIDEX.REG,X + PLA + LSR ODD/EVEN PAGE + PLA + TAX +*---GET CHAR FROM WINDOW--------- + LDA $CC00,X + BCC .1 + LDA $CD00,X +.1 ORA #$80 + STA VIDEX.CHAR + LDX SAVEX + RTS +*-------------------------------- +SAVEX .BS 1 +CASEFLG .BS 1 +*-------------------------------------- + .EP +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/io.s.videx +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/IO.S.STB80.txt b/SCMASM.30/IO.S.STB80.txt new file mode 100644 index 00000000..3bbf4ca9 --- /dev/null +++ b/SCMASM.30/IO.S.STB80.txt @@ -0,0 +1,166 @@ +NEW + AUTO 3,1 +*-------------------------------------- + .PH $A800 +*-------------------------------- +STB.SCREEN.WIDTH .EQ $A5 +*-------------------------------- +STB.SLOT .EQ 3 +*-------------------------------- +STB.HORIZ .EQ $05F8+STB.SLOT +STB.ESCBYT .EQ $06F8+STB.SLOT +STB.FLAGS .EQ $0778+STB.SLOT +*-------------------------------- +STB.ENTRY .EQ STB.SLOT*256+$C000 +STB.RDKEY1 .EQ STB.SLOT*256+$C005 +STB.COUT1 .EQ STB.SLOT*256+$C019 +STB.SCREEN .EQ STB.SLOT*256+$C031 +*-------------------------------- +* I/O VECTORS -- 3 BYTES EACH +*-------------------------------- + JMP STB.INIT + JMP STB.WARM + JMP STB.READ.KEY.WITH.CASE + JMP STB.GET.HORIZ.POSN + LDA #$8C ^L--HOME + .HS 2C + LDA #$9D ^]--CLREOL + .HS 2C + LDA #$8B ^K--CLREOP + .HS 2C + LDA #$9F ^_--UP + .HS 2C + LDA #$8A ^J--DOWN + .HS 2C + LDA #$88 ^H--LEFT + .HS 2C + LDA #$9C ^\--RIGHT + NOP + JMP MON.COUT + JMP STB.PICK.SCREEN + JMP STB.HTABX + JMP STB.HTAB + JMP STB.VTAB +*---Case Change MUST go here----- + LDA STB.FLAGS + EOR #$40 + STA STB.FLAGS + RTS +*-------------------------------- +* VARIABLE LENGTH ROUTINES +*-------------------------------- +STB.HTABX + PHA + TXA + JSR STB.HTAB + PLA + RTS +*-------------------------------- +STB.GET.HORIZ.POSN + LDA STB.HORIZ + RTS +*-------------------------------- +STB.VTAB + STA CV + LDA STB.HORIZ +STB.HTAB + PHA SAVE HORIZ POSN + LDA #$9E + JSR STB.COUT1 + PLA GET HORIZ POSN + JSR .1 + LDA CV + +.1 CLC + ADC #$A0 + JMP STB.COUT1 +*-------------------------------- +STB.INIT + LDA #80 + STA STB.SCREEN.WIDTH + LDA #$8C CLEAR SCREEN AND START STB-80 + JSR STB.ENTRY + LDA #0 + STA STB.ESCBYT DISABLE ^A AND ESC-MODE + LDA #2 DISABLE "HOME" SENSING + STA STB.FLAGS +STB.INSTALL.VECTORS + LDX #1 +.1 LDA STB.VECTORS,X + STA $36,X + STA STB.SLOT*2+$BE10,X + LDA STB.VECTORS+2,X + BIT F.EXEC + BMI .2 + STA $38,X +.2 STA STB.SLOT*2+$BE20,X + DEX + BPL .1 + RTS +*-------------------------------- +STB.VECTORS .DA STB.COUT + .DA STB.RDKEY +*-------------------------------- +STB.WARM + CLD + LDX CV + JSR MON.INIT + STX CV + JMP STB.INSTALL.VECTORS +*-------------------------------- +* READ KEY WITH CASE CONTROL +*-------------------------------- +STB.READ.KEY.WITH.CASE + JSR MON.RDKEY + ORA #$80 REQUIRED FOR EXEC FILES + CLC SIGNAL NO OPEN APPLE + RTS +*-------------------------------- +STB.RDKEY + CLD + LDA #$0A + STA STB.SLOT*16+$C080 + LDA #$07 SOLID DBL LINE CURSOR + STA STB.SLOT*16+$C081 + JSR STB.RDKEY1 + ORA #$80 Make sure it looks right + PHA + LDA #$0A + STA STB.SLOT*16+$C080 + LDA #$20 CURSOR OFF + STA STB.SLOT*16+$C081 + PLA + RTS +*-------------------------------- +STB.COUT + CLD + CMP #$80 NORMAL OR INVERSE? + BCS .1 ...NORMAL + PHA ...80-COLUMN + LDA #$8F SELECT INVERSE DISPLAY + JSR STB.COUT1 + PLA + ORA #$80 MAKE PRINTABLE CHARACTER + CMP #$A0 + BCS .2 + ORA #$40 +.2 JSR STB.COUT1 + LDA #$8E SELECT NORMAL DISPLAY +.1 JMP STB.COUT1 +*-------------------------------- +STB.PICK.SCREEN + STX $481 + TYA + STA $482 + JSR STB.HTAB + JSR STB.SCREEN + LDY $482 + LDX $481 + RTS +*-------------------------------------- + .EP +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/io.s.stb80 +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/SCI.S.CAT.txt b/SCMASM.30/SCI.S.CAT.txt new file mode 100644 index 00000000..e5cfd6c6 --- /dev/null +++ b/SCMASM.30/SCI.S.CAT.txt @@ -0,0 +1,457 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* CATALOG COMMAND +*-------------------------------- +CAT + LDA #39 + .HS 2C SKIP OVER TWO BYTES +CATALOG + LDA #79 + STA CAT.WIDTH + LDA #0 CLEAR ACCUMULATED BLOCKS COUNTER + STA BLOCKS + STA BLOCKS+1 + LDA FBITS TEST FOR TYPE AND PATHNAME + AND #$05 + LSR PATHNAME BIT INTO CARRY + BNE .1 ...TYPE STATED + STA VAL.T SET T=0, LIST ALL TYPES +.1 BCS .2 ...PATH GIVEN + JSR GET.FILE.INFO NONE STATED, GET PREFIX + BCS .8 ...ERROR +*---GET DIRECTORY---------------- +.2 JSR OPEN.READ.DIR.HEADER + BCS .8 ...ERROR + LDY #0 Print directory pathname +.15 LDA PATHNAME.ONE.BUFFER+1,Y + ORA #$80 + JSR COUT + INY + CPY PATHNAME.ONE.BUFFER + BCC .15 + JSR CROUT +*---PRINT TITLES----------------- + LDA #Q.DIRHDR + JSR FIND.AND.PUT.MSG.IN.WBUF + JSR PRINT.CATALOG.LINE +*---IF NO MORE FILES, FINISHED--- +.3 LDA FILE.COUNT ANY FILES LEFT? + ORA FILE.COUNT+1 + BEQ .7 ...NO, FINISHED +*---NEXT FILE DESCRIPTION-------- + JSR READ.NEXT.ENTRY + BCS .8 ...ERROR + LDA VAL.T CHECK IF WE LIKE THIS TYPE + BEQ .4 ...WE LIKE THEM ALL + CMP DIRBUF+16 FILE TYPE + BNE .5 ...NO, SKIP OVER IT +.4 JSR FORMAT.CAT.ENTRY + JSR PRINT.CATALOG.LINE PRINT IT +*---CHECK FOR PAUSE/ABORT-------- +.5 JSR CHECK.KEY SEE IF KEYPRESS + BMI .3 ...NO, CONTINUE CATALOG + BEQ .7 ... or , abort +*--- or , so abort------ +.6 JSR CHECK.KEY + BMI .6 WAIT FOR KEY + BNE .3 ...NOT CR OR ESC, CONTINUE +*--- or , abort--------- +.7 LDX CAT.INDEX + LDA FILE.REFNUMS,X + JSR CLOSE.ONE.FILE + BCS .8 ...ERROR + JMP FREE.BLOCKS FORMAT BLOCKS FREE ETC. +.8 RTS +*-------------------------------- +CHECK.KEY + LDA $C000 SEE IF KEYSTROKE + BPL .1 ...NO + STA $C010 ...YES, CLEAR STROBE +.1 EOR #$8D SET .EQ. IF + BEQ .2 ...YES + EOR #$8D^$9B OR IF +.2 RTS .MI. IF NO KEY +*-------------------------------- +* FORMAT BLOCKS FREE/INUSE +*-------------------------------- +FREE.BLOCKS + JSR ZERO.ACCUM + JSR BLANK.WBUF + LDA #Q.BLOCKS.ABOVE + JSR FIND.AND.PUT.MSG.IN.WBUF + LDA BLOCKS + LDX BLOCKS+1 + LDY #24 + JSR CONVERT.TO.DECIMAL + JSR PRINT.MESSAGE +*-------------------------------- + LDA #PATHNAME.ONE.BUFFER+1 set up ONLINE call + STA MISC.PARMS+2 to read volume name + LDA /PATHNAME.ONE.BUFFER+1 + STA MISC.PARMS+3 + LDA UNIT + STA MISC.PARMS+1 + JSR MLI.C5 ONLINE + BCS .1 ...ERROR +*---Setup GET FILE INFO call----- + LDA PATHNAME.ONE.BUFFER+1 + AND #$0F + TAX + INX + STX PATHNAME.ONE.BUFFER + LDA #"/" + STA PATHNAME.ONE.BUFFER+1 + JSR GET.FILE.INFO + BCS .1 ...ERROR +*---Format the bottom line------- + JSR BLANK.WBUF + LDA #Q.BLOCKS + JSR FIND.AND.PUT.MSG.IN.WBUF +*---Total Blocks in Volume------- + LDA GET.SET.PARMS+5 + LDX GET.SET.PARMS+6 + LDY #51 + JSR CONVERT.TO.DECIMAL +*---Blocks Used in Volume-------- + LDA GET.SET.PARMS+8 + LDX GET.SET.PARMS+9 + LDY #24 + JSR CONVERT.TO.DECIMAL +*---Blocks Free in Volume-------- + LDA GET.SET.PARMS+5 + SEC + SBC GET.SET.PARMS+8 + PHA + LDA GET.SET.PARMS+6 + SBC GET.SET.PARMS+9 + TAX + PLA + LDY #37 + JSR CONVERT.TO.DECIMAL + JSR PRINT.CATALOG.LINE + CLC +.1 RTS +*-------------------------------- +* OPEN/READ DIRECTORY HEADER +*-------------------------------- +OPEN.READ.DIR.HEADER + JSR ALLOCATE.UPPER.BUFFER + STX CAT.INDEX + LDX #$0F IS STORAGE TYPE = VOL DIR? + CPX GET.SET.PARMS+7 + BNE .1 ...NO + STX GET.SET.PARMS+4 ...YES, MAKE TYPE = DIR +.1 LDA #$01 FILE MUST BE READABLE + JSR OPEN.DIRECTORY + BCS .3 ...ERROR + + LDX CAT.INDEX + STA FILE.REFNUMS,X + LDA #DIRBUF + STA READ.WRITE.PARMS+2 + LDA /DIRBUF + STA READ.WRITE.PARMS+3 + LDA #$2B + STA READ.WRITE.PARMS+4 + STA MISC.PARMS+2 + LDA #0 + STA READ.WRITE.PARMS+5 + JSR MLI.CA READ + BCS .3 + LDX #3 +.2 LDA DIRBUF+35,X ENTRY LENGTH, ENTRIES/BLOCK, + STA ENTRY.LENGTH,X and FILE COUNT + DEX + BPL .2 + LDA #1 + STA ENTRY.COUNTER +.3 RTS +*-------------------------------- +* READ NEXT DIRECTORY ENTRY +*-------------------------------- +READ.NEXT.ENTRY +.1 LDY ENTRY.COUNTER + CPY ENTRIES.PER.BLOCK + BCC .2 +*---Skip ahead remainder bytes--- + LDA #4 + SBC MISC.PARMS+2 + STA READ.WRITE.PARMS+4 + JSR MLI.CA + BCS .4 ...ERROR + LDY #0 + LDA #4 + STA MISC.PARMS+2 +*---Read a file description------ +.2 INY NEXT ENTRY + STY ENTRY.COUNTER + LDA ENTRY.LENGTH + STA READ.WRITE.PARMS+4 + ADC MISC.PARMS+2 + STA MISC.PARMS+2 + JSR MLI.CA READ + BCS .4 ...ERROR +*---Check if deleted file-------- + LDA DIRBUF + AND #$F0 + BEQ .1 ...deleted +*---Count the file--------------- + LDA FILE.COUNT + BNE .3 + DEC FILE.COUNT+1 +.3 DEC FILE.COUNT +.4 RTS +*-------------------------------- +* FORMAT CATALOG ENTRY LINE +*-------------------------------- +FORMAT.CAT.ENTRY + JSR BLANK.WBUF + LDA DIRBUF LENGTH OF FILENAME + AND #$0F + TAY +.1 LDA DIRBUF,Y + ORA #$80 + STA WBUF+7,Y + DEY + BNE .1 + STY ACCUM+2 +*---GET FILE TYPE---------------- + LDA DIRBUF+16 FILE TYPE + LDX #LAST.FILE.TYPE + LDY #3 POINT INTO WBUF +.2 CMP FILE.TYPES,X + BEQ .3 ...MATCH! + DEX + DEX + DEX + DEX + BPL .2 + JSR CONVERT.TO.HEX + JMP .6 +.3 DEX + LDA FILE.TYPES,X + JSR STUFF.WBUF.AND.BACKUP + BNE .3 +*---SKIP IF 40-COLUMN------------ + BIT CAT.WIDTH + BVC .7 +*---Display AuxType-------------- + LDY #"R" Use "R=" if type TXT + LDA DIRBUF+16 FILE TYPE + CMP #$04 + BEQ .5 ...it is TXT + CMP #$06 Use "A=" if type BIN + BNE .6 ...not BIN, just show $xxxx + LDY #"A" ...BIN +.5 STY WBUF+73 + LDA #"=" + STA WBUF+74 +.6 LDY #78 + LDA DIRBUF+31 AUXTYPE + JSR CONVERT.TO.HEX + LDA DIRBUF+32 " + JSR CONVERT.TO.HEX +*---Show file length------------- + LDA DIRBUF+23 EOF MARK MSB + STA ACCUM+2 + LDA DIRBUF+21 EOF MARK + LDX DIRBUF+22 " " + LDY #70 + JSR CONVERT.TO.DECIMAL +*---CREATION DATE/TIME----------- + LDX #$18 OFFSET IN DIRBUF + LDY #61 OFFSET IN WBUF + JSR FORMAT.DATE.AND.TIME +*---Blocks in the file----------- +.7 LDY #27 + LDA DIRBUF+19 BLOCKS IN USE + LDX DIRBUF+20 " + JSR CONVERT.TO.DECIMAL + CLC + LDA BLOCKS + ADC DIRBUF+19 + STA BLOCKS + LDA BLOCKS+1 + ADC DIRBUF+20 + STA BLOCKS+1 +*---Access code------------------ + LDA DIRBUF+30 ACCESS + AND #$C2 + CMP #$C2 + BEQ .8 + LDA #"*" LOCKED + STA WBUF+1 +*---Modified Date/Time----------- +.8 LDX #$21 OFFSET IN DIRBUF + LDY #44 OFFSET IN WBUF +*-------------------------------- +* FORMAT DATE & TIME +* --MSB--- --LSB--- +* YYYYYYYM MMMDDDDD +*-------------------------------- +FORMAT.DATE.AND.TIME + LDA DIRBUF,X MMMDDDDD + AND #$1F 000DDDDD + BEQ .1 ...DAY=0, NO DATE + STA DAY + LDA DIRBUF+1,X YYYYYYYM + LSR 0YYYYYYY + STA YEAR + CMP #100 + BCS .1 ...YEAR>99, NO DATE + LDA DIRBUF+1,X YYYYYYYM + LSR M INTO CARRY + LDA DIRBUF,X MMMDDDDD + ROL MMDDDDDM M + ROL MDDDDDMM M + ROL DDDDDMMM M + ROL DDDDMMMM + AND #$0F 0000MMMM + BEQ .1 ...MONTH=0, NO DATE + CMP #13 + BCC .3 ...MONTH=1...12, GOOD +*---Format ------------- +.1 TYA + SEC + SBC #6 BACK UP OVER TIME SLOT + TAY + LDX #8 +.2 LDA NO.DATE.MSG,X + JSR STUFF.WBUF.AND.BACKUP + DEX + BPL .2 + RTS +*---Format date, time------------ +.3 STA MONTH + LDA DIRBUF+3,X HOURS + PHA + LDA DIRBUF+2,X MINUTES + LDX #0 HIGH BYTE + CMP #60 IF > 59, USE 0 + BCC .4 0...59 + TXA +.4 JSR CONVERT.DECIMAL.TWO.DIGITS + LDA #":" SEPARATE WITH ":" + STA WBUF+2,Y + PLA HOURS + LDX #0 HIGH BYTE + CMP #24 IF > 24, USE 0 + BCC .5 0...23 + TXA +.5 JSR CONVERT.DECIMAL.TWO.DIGITS + LDA YEAR + JSR CONVERT.DECIMAL.TWO.DIGITS + LDX MONTH + LDA MONTH.NAMES-1+24,X + JSR STUFF.WBUF.AND.BACKUP + LDA MONTH.NAMES-1+12,X + JSR STUFF.WBUF.AND.BACKUP + LDA MONTH.NAMES-1,X + JSR STUFF.WBUF.AND.BACKUP + LDA #"-" + STA WBUF+5,Y + JSR STUFF.WBUF.AND.BACKUP + LDA DAY + LDX #0 HIGH BYTE +* JMP CONVERT.TO.DECIMAL +*-------------------------------- +* CONVERT TO DECIMAL +*-------------------------------- +CONVERT.TO.DECIMAL + STX ACCUM+1 + STA ACCUM +.1 JSR DIVIDE.ACCUM.BY.TEN + ORA #$B0 + JSR STUFF.WBUF.AND.BACKUP + LDA ACCUM + ORA ACCUM+1 + ORA ACCUM+2 + BNE .1 + RTS +*-------------------------------- +* CONVERT 2 DIGIT NUMBER +*-------------------------------- +CONVERT.DECIMAL.TWO.DIGITS + CLC + ADC #100 FORCE TWO DIGITS TO PRINT + JSR CONVERT.TO.DECIMAL + LDA #" " COVER UP THE "1" + INY +*-------------------------------- +STUFF.WBUF.AND.BACKUP + STA WBUF+1,Y + DEY + RTS +*-------------------------------- +* CONVERT TO HEX +*-------------------------------- +CONVERT.TO.HEX + PHA + AND #$0F + JSR .1 + PLA + LSR + LSR + LSR + LSR +.1 ORA #$B0 + CMP #$BA + BCC .2 + ADC #6 +.2 JSR STUFF.WBUF.AND.BACKUP + LDA #"$" + STA WBUF+1,Y + RTS +*-------------------------------- +* DIVIDE ACCUM BY TEN +*-------------------------------- +* DIVIDE 24-BIT VALUE IN ACCUM BY TEN +* RETURN REMAINDER IN A-REG +*-------------------------------- +DIVIDE.ACCUM.BY.TEN + LDX #24 24 BITS IN DIVIDEND + LDA #0 START WITH REM=0 +.1 JSR SHIFT.ACCUM.LEFT + ROL + CMP #10 + BCC .2 ...STILL < 10 + SBC #10 + INC ACCUM QUOTIENT BIT +.2 DEX NEXT BIT + BNE .1 + RTS +*-------------------------------- +BLANK.WBUF + LDA #" " + LDY #79 +.1 JSR STUFF.WBUF.AND.BACKUP + BPL .1 + RTS +*-------------------------------- +NOW JSR GP.MLI + .DA #$82,0000 + JSR BLANK.WBUF + LDX #4 +.1 LDA GP.DATE-1,X + STA DIRBUF-1,X + DEX + BNE .1 + LDY #15 + JSR FORMAT.DATE.AND.TIME + LDA #20 + STA CAT.WIDTH +*** JMP PRINT.CATALOG.LINE +*-------------------------------- +PRINT.CATALOG.LINE + LDX CAT.WIDTH + LDA #$8D + STA WBUF+1,X + JSR PRINT.MESSAGE + CLC because a SEC would indicate ERROR + RTS +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/sci.s.cat +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/SCI.S.CPAR.txt b/SCMASM.30/SCI.S.CPAR.txt new file mode 100644 index 00000000..8fba8a79 --- /dev/null +++ b/SCMASM.30/SCI.S.CPAR.txt @@ -0,0 +1,562 @@ +NEW + AUTO 3,1 +*-------------------------------------- + .DA COMMAND.TABLE needed for HELP command +*-------------------------------- +* PARSE COMMAND LINE +*-------------------------------- +PARSE.COMMAND + JSR SCAN.COMMAND.TABLE + BCS SYNERR2 ...SYNTAX ERROR + LDA #0 + STA FBITS + STA FBITS+1 + STA PATHNAME.TWO.BUFFER + STA PATHNAME.ONE.BUFFER+1 + LDA D.SLOT + STA VAL.S + LDA D.DRIV + STA VAL.D +*---Handle special cases--------- + BIT PBITS Check for PR# or IN# + BVS PARSE.INPR PR# & IN# commands + BPL .1 ...not CAT(ALOG) or PREFIX + JSR MLI.C7 ...CAT, CATALOG, or PREFIX +*---TEST CHAR AFTER COMMAND------ +.1 JSR GET.NEXT.NONBLANK + BNE .2 ...not comma or + BCC .5 ... already + JMP GET.ANOTHER.PARM +*---Get a pathname--------------- +.2 CMP #'/' MUST START WITH "/" OR LETTER + BEQ .3 + CMP #'A' + BCC SYNERR2 ...SYNTAX ERROR +.3 DEX RE-SCAN THE FIRST CHAR OF PATH + LDY #0 +.4 JSR GET.NEXT.CHAR.FROM.WBUF + STA PATHNAME.ONE.BUFFER+1,Y + JSR STORE.PATH.TWO.AND.TEST + BCC .4 + DEY + STY PATHNAME.ONE.BUFFER + STY PATHNAME.TWO.BUFFER + LDA #$01 TELL THE WORLD ABOUT IT + STA FBITS +*-------------------------------- + DEX RE-SCAN CHAR AFTER PATHNAME + JSR GET.NEXT.NONBLANK + BNE SYNERR2 ...NOT COMMA OR + BCS MORE.PARMS ...COMMA +.5 JMP NO.MORE.PARMS ... +SYNERR2 + JMP ERR.SYNTAX +*-------------------------------- +* PR# or IN# commands +*-------------------------------- +PARSE.INPR + JSR GET.NEXT.NONBLANK CHAR AFTER COMMAND + BEQ SYNERR2 ...comma or + DEX ...IN CASE IT IS "Axxx" + CMP #'A' + BEQ GET.ANOTHER.PARM ...HANDLE PR#Axxx or IN#Axxx + INX RESTORE X + JSR ZERO.ACCUM + STY PARM.LENM1 Y=0, 1 BYTE PARM + LDY #VAL.LB-VAL.A PARM OFFSET FROM VAL.A + STY PARM.OFFSET + LDY #$40 + STY FBITS + JSR CONVERT.DECIMAL.NUMBER + BCS RTS4 + LDA VAL.LB + CMP #$08 + BCC TEST.IF.MORE.PARMS +SCI.ERR.RANGE + LDA #$02 + SEC +RTS4 RTS +*-------------------------------- +MORE.PARMS + LDA PBITS + LSR TEST BIT 0 + BCC SYNERR2 ...NO PATHNAME EXPECTED + LSR TEST BIT 1 + BCC GET.ANOTHER.PARM ...NO PATH-TWO EXPECTED +*---Get second pathname---------- + JSR GET.NEXT.NONBLANK + BEQ SYNERR2 ...COMMA OR + DEX RE-SCAN FIRST CHAR OF PATHNAME + LDY #0 +.1 JSR GET.NEXT.CHAR.FROM.WBUF + JSR STORE.PATH.TWO.AND.TEST + BCC .1 + DEY + STY PATHNAME.TWO.BUFFER + LDA #$03 WE GOT TWO PATHNAMES, SO + STA FBITS MARK THE BITS + DEX RE-SCAN TERM. CHAR +*-------------------------------- +TEST.IF.MORE.PARMS + JSR GET.NEXT.NONBLANK + BNE SYNERR2 + BCC NO.MORE.PARMS +GET.ANOTHER.PARM + JSR GET.NEXT.NONBLANK + BEQ SYNERR2 ...NULL PARAMETER + JSR PARSE.PARAMETER + BCC TEST.IF.MORE.PARMS + RTS ...error return +*-------------------------------- +NO.MORE.PARMS + LDA VAL.S CHECK RANGE OF S AND D + BEQ SCI.ERR.RANGE + CMP #$08 + BCS SCI.ERR.RANGE + LDA VAL.D + BEQ SCI.ERR.RANGE + CMP #$03 + BCS SCI.ERR.RANGE +*---CHECK IF DEFERRED COMMAND---- + LDA PBITS (only OPEN and WRITE are deferred) + AND #$21 + LSR + BEQ .1 ...NOT DEFERRED + LDA STATE ...ARE WE IN DIRECT MODE? + BEQ .6 ...YES, DEFERRED IS ILLEGAL +*---CHECK PATHNAME--------------- +.1 BCC .5 ...NO PATH PERMITTED + LDA PBITS+1 + AND #$04 S OR D OK? + BEQ .5 ...NO + LDA FBITS + LSR HAVE WE A PATHNAME? + BCS .2 ...YES + LDA PBITS ...NO, IS PATH NEEDED + AND #$90 + BEQ ERR.SYNTAX ...YES + BPL .5 +*---NEED PREFIX OR S,D----------- +.2 LDA PATHNAME.ONE.BUFFER+1 + EOR #'/' SLASH + BEQ .3 ...EXPLICIT PREFIX + LDA PREFIX.FLAG MLI's flag + BEQ .4 ...NO PREFIX IS SET +.3 LDA FBITS+1 DID WE GET S,D? + AND #$04 + BEQ .5 ...NO + BCS .4 ...YES, AND THERE IS A PATHNAME + LDA #0 ...YES, BUT NO PATHNAME + STA PATHNAME.ONE.BUFFER + STA PATHNAME.ONE.BUFFER+1 + LDA #$01 SIGNAL WE GOT PATHNAME AFTER ALL + ORA FBITS + STA FBITS +.4 JSR INSERT.VOLUME.NAME + BCS .7 +*---BRANCH TO COMMAND------------ +.5 CLC SIGNAL NO ERROR + LDA COMMAND.NUMBER + BEQ EXTERNAL ...USER'S COMMAND + EOR #CN.PREFIX + BEQ INTERNAL ...PREFIX COMMAND + LDA PBITS+1 ARE S/D VALID? + AND #$04 + BEQ INTERNAL ...NO + LDA FBITS ANY PATHNAME SPECIFIED? + LSR + BCC INTERNAL ...NO + JSR GET.FILE.INFO ...YES + BCC INTERNAL ...NO ERROR + ORA #0 ...ERROR, WAS IT "FILE NOT FOUND"? + BPL .7 ...NO, REAL ERROR + LDA PBITS OKAY TO CREATE PATHNAME? + AND #$08 + BNE INTERNAL ...YES + LDA #$06 "PATH NOT FOUND" + .HS 2C +.6 LDA #$0F "NOT DIRECT COMMAND" + SEC +.7 RTS +*-------------------------------- +INTERNAL JMP (COMMAND.ADDR) +EXTERNAL JMP (EXTERNAL.COMMAND.HANDLER) +*-------------------------------- +ERR.SYNTAX + LDA #$10 SYNTAX ERROR +ERRR SEC + RTS +*-------------------------------- +* INSERT PREFIX BEFORE PATHNAME +*-------------------------------- +INSERT.VOLUME.NAME + LDA VAL.S BUILD UNIT # FROM SLOT,DRIVE + TAY SAVE VAL.S + LSR 0000.00SS S + ROR S000.000S S + ROR SS00.0000 S + ROR SSS0.0000 0 + LDX VAL.D + CPX #2 .CS. if 2, .CC. if 1 + ROR DSSS.0000 + STA MISC.PARMS+1 + LDA #WBUF+1 + STA MISC.PARMS+2 + LDA /WBUF+1 + STA MISC.PARMS+3 + JSR MLI.C5 ONLINE -- READ VOLUME NAME + BCS .4 NO SUCH SLOT AND DRIVE + STX D.DRIV UPDATE DEFAULT S AND D + STY D.SLOT +*-------------------------------- + LDA PATHNAME.ONE.BUFFER+1 + EOR #'/' ALREADY HAVE VOLUME NAME? + BEQ .4 ...YES, DON'T NEED ANOTHER +*---ISOLATE VOLNAME LENGTH------- + LDA WBUF+1 DSSSLLLL + AND #$0F 0000LLLL + STA WBUF+1 +*---MOVE PATHNAMES OVER L+2------ + LDY #62 + TYA + SEC + SBC WBUF+1 + TAX +.1 LDA PATHNAME.ONE.BUFFER,X + STA PATHNAME.ONE.BUFFER+2,Y + LDA PATHNAME.TWO.BUFFER,X + STA PATHNAME.TWO.BUFFER+2,Y + DEY + DEX + BNE .1 +*---INSERT VOLUME SLASHES-------- + LDA #'/' + STA PATHNAME.ONE.BUFFER+2,Y + STA PATHNAME.ONE.BUFFER+1 + STA PATHNAME.TWO.BUFFER+2,Y + STA PATHNAME.TWO.BUFFER+1 +*---COPY VOLUME NAME------------- +.2 LDA WBUF+1,Y + STA PATHNAME.ONE.BUFFER+1,Y + STA PATHNAME.TWO.BUFFER+1,Y + DEY + BNE .2 +*---UPDATE PATH LENGTHS---------- + CLC + LDA WBUF+1 + ADC #2 INCLUDE SLASHES + TAY + ADC PATHNAME.ONE.BUFFER + CMP #64 +.3 BCS ERR.SYNTAX + STA PATHNAME.ONE.BUFFER + TYA + ADC PATHNAME.TWO.BUFFER + STA PATHNAME.TWO.BUFFER + CMP #64 + BCS .3 ...BRIDGE TO SYNTAX ERROR +*-------------------------------- +.4 RTS +*-------------------------------- +SCAN.COMMAND.TABLE + LDY #0 PNTR INTO COMMAND TABLE + STY COMMAND.NUMBER + DEY +*---COMPARE COMMAND NAME--------- +.1 INC COMMAND.NUMBER + LDX #0 PNTR INTO WBUF +.2 INY next byte in command table + JSR GET.NEXT.NONBLANK + BEQ .4 ...end of WBUF contents + EOR COMMAND.TABLE,Y + BEQ .2 ...same so far + ASL Might be last char + BNE .4 ...No, try next command +*---We found the command--------- + LDA COMMAND.TABLE+1,Y + STA COMMAND.ADDR + LDA COMMAND.TABLE+2,Y + STA COMMAND.ADDR+1 + LDA COMMAND.TABLE+3,Y + STA PBITS + LDA COMMAND.TABLE+4,Y + STA PBITS+1 + CLC + RTS +*---SKIP TO NEXT COMMAND--------- +.3 INY +.4 LDA COMMAND.TABLE,Y + BPL .3 ...NOT LAST CHAR YET + INY SKIP OVER ADDRESS + INY + INY SKIP OVER PBITS + INY + LDA COMMAND.TABLE+1,Y + BNE .1 ...more commands in table +*---TRY EXTERNAL COMMAND--------- + LDA #$FF + STA COMMAND.NUMBER + SEC + JMP SCI.USER.CMD +*-------------------------------- +SYNERR1 JMP ERR.SYNTAX +*-------------------------------- +PARSE.PARAMETER + JSR ZERO.ACCUM + LDY #NO.PARM.NAMES-1 +.1 CMP PARM.NAMES,Y + BEQ FOUND.PARM + DEY + BPL .1 + CMP #'T' + BNE SYNERR1 ...SYNTAX ERROR +*---PARSE T PARAMETER------------ + LDA #$04 + AND PBITS + BEQ ERR.BADPARM + ORA FBITS + STA FBITS + LDA #0 SINGLE BLYTE + STA PARM.LENM1 + LDA #VAL.T-VAL.A PARM OFFSET FROM VAL.A + STA PARM.OFFSET + JSR GET.NEXT.NONBLANK + BEQ SYNERR1 + CMP #'$' + BEQ CONVERT.HEX.NUMBER + CMP #'A' + BCC CONVERT.DECIMAL.NUMBER + JMP CONVERT.FILE.TYPE +*-------------------------------- +ERR.BADPARM + SEC "INVALID PARAMETER" + LDA #$0B + RTS +*-------------------------------- +FOUND.PARM + LDA PARM.MASKS,Y + BEQ .2 + AND PBITS+1 + BEQ ERR.BADPARM + CMP #$04 IS IT S OR D + BNE .1 ...NO + AND FBITS+1 ...YES, DID WE ALREADY HAVE S OR D + BNE .2 ...YES + LDA #1 ...NO, SET D=1 + STA VAL.D + LDA #$04 +.1 ORA FBITS+1 + STA FBITS+1 +.2 LDA PARM.VARIABLES,Y + AND #$03 + STA PARM.LENM1 + LDA PARM.VARIABLES,Y + LSR + LSR + STA PARM.OFFSET + JSR GET.NEXT.NONBLANK + BEQ GO.ERR.SYNTAX.1 + CMP #'$' + BEQ CONVERT.HEX.NUMBER +*-------------------------------- +CONVERT.DECIMAL.NUMBER + STX COMMAND.LINE.LENGTH + JSR ACCUMULATE.DECIMAL.DIGIT + BCC .1 + BMI GO.ERR.RANGE.1 + BCS GO.ERR.SYNTAX.1 +.1 LDX COMMAND.LINE.LENGTH + JSR GET.NEXT.NONBLANK + BNE CONVERT.DECIMAL.NUMBER + BEQ CHECK.PARAMETER.RANGE +*-------------------------------- +CONVERT.HEX.NUMBER + JSR GET.NEXT.NONBLANK + BEQ GO.ERR.SYNTAX.1 +.1 STX COMMAND.LINE.LENGTH + JSR ACCUMULATE.HEX.DIGIT + BCC .2 + BMI GO.ERR.RANGE.1 + BCS GO.ERR.SYNTAX.1 +.2 LDX COMMAND.LINE.LENGTH + JSR GET.NEXT.NONBLANK + BNE .1 +*-------------------------------- +CHECK.PARAMETER.RANGE + LDX #$02 +.1 CPX PARM.LENM1 + BEQ .2 + LDA ACCUM,X + BNE GO.ERR.RANGE.1 + DEX + BNE .1 +.2 LDY PARM.OFFSET +.3 LDA ACCUM,X + STA VAL.A,Y + DEY + DEX + BPL .3 + LDX COMMAND.LINE.LENGTH + CLC + RTS +*-------------------------------- +GO.ERR.SYNTAX.1 JMP ERR.SYNTAX +*-------------------------------- +GO.ERR.RANGE.1 JMP SCI.ERR.RANGE +*-------------------------------- +CONVERT.FILE.TYPE + STA ACCUM+2 1ST LETTER + LDY #2 GET 2ND AND 3RD +.1 JSR GET.NEXT.NONBLANK + BEQ GO.ERR.SYNTAX.1 + STA ACCUM-1,Y STORE THEM BACKWARDS + DEY + BNE .1 ...UNTIL Y=0 + STX COMMAND.LINE.LENGTH SAVE X-REG +.2 LDX #2 COMPARE NEXT ENTRY +.3 LDA ACCUM,X + EOR FILE.TYPES,Y + INY + ASL IGNORE BIT 7 + BNE .4 ...NOT THE SAME + DEX NEXT CHAR + BPL .3 + LDA FILE.TYPES,Y + STA VAL.T + LDX COMMAND.LINE.LENGTH RESTORE X-REG + CLC + RTS +.4 INY + DEX + BPL .4 + CPY #LAST.FILE.TYPE + BCC .2 + BCS GO.ERR.SYNTAX.1 +*-------------------------------- +* GET NEXT NON-BLANK CHAR FROM WBUF +* CHAR Z C +* YES CLR +* COMMA YES SET +* OTHER NO ? +*-------------------------------- +GET.NEXT.NONBLANK +.1 JSR GET.NEXT.CHAR.FROM.WBUF + CMP #' ' + BEQ .1 IGNORE BLANKS + CMP #',' + BEQ .2 .CS. and .EQ. + CMP #$0D .EQ. if + CLC .CC. +.2 RTS +*-------------------------------- +GET.NEXT.CHAR.FROM.WBUF + LDA WBUF,X + BNE .1 MAKE 00==8D + LDA #$0D +.1 AND #$7F + CMP #$60 CONVERT LOWER CASE TO UPPER + BCC .2 + AND #$5F +.2 INX + RTS +*-------------------------------- +ACCUMULATE.DECIMAL.DIGIT + CMP #$30 + BCC .1 + CMP #$3A + BCC .2 +.1 SEC + ORA #0 + RTS +*-------------------------------- +.2 AND #$0F + PHA + LDA ACCUM+2 + CMP #$1A + BCS .5 + LDX #$02 +.3 LDA ACCUM,X + PHA + DEX + BPL .3 + JSR SHIFT.ACCUM.LEFT + JSR SHIFT.ACCUM.LEFT + LDX #0 + CLC +.4 PLA + ADC ACCUM,X + STA ACCUM,X + INX + TXA + EOR #$03 + BNE .4 + JSR SHIFT.ACCUM.LEFT +.5 PLA + BCS TOOBIG + ADC ACCUM + STA ACCUM + BCC RTS1 + CLC + INC ACCUM+1 + BNE RTS1 + INC ACCUM+2 + BNE RTS1 +TOOBIG LDA #$FF + SEC +RTS1 RTS +*-------------------------------- +ACCUMULATE.HEX.DIGIT + CMP #'0' + BCC .1 + CMP #'9'+1 + BCC .3 + CMP #'A' + BCC .1 + CMP #'F'+1 + BCC .2 +.1 SEC + ORA #0 + RTS +.2 SBC #$06 +.3 AND #$0F + LDX #$03 +.4 JSR SHIFT.ACCUM.LEFT + BCS TOOBIG + DEX + BPL .4 + ORA ACCUM + STA ACCUM + RTS +*-------------------------------- +SHIFT.ACCUM.LEFT + ASL ACCUM + ROL ACCUM+1 + ROL ACCUM+2 + RTS +*-------------------------------- +ZERO.ACCUM + LDY #0 + STY ACCUM + STY ACCUM+1 + STY ACCUM+2 + RTS +*-------------------------------- +* RETURN .CC. IF NOT END OF PATHNAME YET +* ELSE .CS. +*-------------------------------- +STORE.PATH.TWO.AND.TEST + STA PATHNAME.TWO.BUFFER+1,Y + INY + CMP #',' + BEQ .1 + CMP #' ' + BEQ .1 + CMP #$0D + BEQ .1 + CPY #65 +.1 RTS +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/sci.s.cpar +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/SCI.S.EQ.txt b/SCMASM.30/SCI.S.EQ.txt new file mode 100644 index 00000000..a00cd510 --- /dev/null +++ b/SCMASM.30/SCI.S.EQ.txt @@ -0,0 +1,47 @@ +NEW + AUTO 3,1 +*-------------------------------------- +*BASL .EQ $28 +CSWL .EQ $36 +CSWH .EQ $37 +KSWL .EQ $38 +KSWH .EQ $39 +DRIVER.PTR .EQ $3A,3B +RETRY.COUNT .EQ $3C +*-------------------------------- +SC.INFLAG .EQ $51 $Cx if .INBx +SC.LOMEM .EQ $52,53 START OF SYMBOLS +SC.EOT .EQ $54,55 END OF SYMBOL TABLE +SC.PP .EQ $56,57 START OF SOURCE PROGRAM +SC.HIMEM .EQ $58,59 END OF SOURCE PROGRAM +*PASS .EQ $63 PASS ($FF if command, 0 or 1 if assembling) +*-------------------------------- +*WBUF .EQ $0200 +DIRBUF .EQ $0259 +PATHNAME.TWO.BUFFER .EQ $0280 +*-------------------------------- +GP.MLI .EQ $BF00 +UNIT .EQ $BF30 +BITMAP .EQ $BF58 +GP.DATE .EQ $BF90 ... 93 +LEVEL .EQ $BF94 +PREFIX.FLAG .EQ $BF9A +*-------------------------------- +KEYBOARD .EQ $C000 +STROBE .EQ $C010 +IO.OFF .EQ $CFFF +*-------------------------------- +BELL .EQ $FBE2 +ABORT.EXIT .EQ $FD10 +PRBYTE .EQ $FDDA +CROUT .EQ $FD8E +COUT .EQ $FDED +*MON.SETVID .EQ $FE93 +*-------------------------------- +SC.HARD .EQ $8000 +SC.SOFT .EQ $8003 +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/sci.s.eq +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/SCI.S.ERRORS.txt b/SCMASM.30/SCI.S.ERRORS.txt new file mode 100644 index 00000000..d423b0ec --- /dev/null +++ b/SCMASM.30/SCI.S.ERRORS.txt @@ -0,0 +1,107 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* Error Handler +*-------------------------------- +ERROR.HANDLER + AND #$1F TRIM TO SIZE + STA ERROR.CODE + LDA #$0F LEVEL + STA LEVEL + JSR UNHOOK.WRITE ...IF WRITING + LDA #0 + STA CLOSE.FLUSH.PARMS+1 + JSR MLI.CC CLOSE ALL FILES + BCS .1 + LDA #0 + STA LEVEL + STA CLOSE.FLUSH.PARMS+1 + JSR MLI.CD FLUSH +.1 LDA ERROR.CODE + JSR PRINT.ERROR + JSR CLOSE.EXEC.FILE + JSR CROUT + JMP SC.SOFT +*-------------------------------- +ERR.FILE.BUSY + LDA #$14 + SEC + RTS +*-------------------------------- +ERROR.PRINTER + JSR FIND.AND.PUT.MSG.IN.WBUF + JSR BELL +*---PRINT MESSAGE FROM WBUF------ +PRINT.CR.MESSAGE + JSR CROUT +PRINT.MESSAGE + LDX #0 +.1 LDA WBUF+1,X + JSR COUT + INX + CMP #$8D END OF MESSAGE? + BNE .1 ...NO + RTS ...YES +*-------------------------------- +FIND.AND.PUT.MSG.IN.WBUF + LDX #0 + CLC +*---SEARCH FOR MESSAGE #--------- + STA WBUF + TAY + BEQ .5 ...FIRST MESSAGE +.2 JSR SCI.GET.NEXT.NYBBLE + BNE .4 +.3 JSR SCI.GET.NEXT.NYBBLE + BEQ .3 + BNE .2 +.4 EOR #$0F + BNE .2 + DEC WBUF + BNE .2 +*---Put message in WBUF---------- +.5 LDY #0 + STY WBUF+80 SQUEEZED BLANK COUNT +.6 STY WBUF STORAGE INDEX + LDA WBUF+80 BLANK COUNT + BNE .8 ...ANOTHER BLANK +.7 JSR SCI.GET.NEXT.NYBBLE + LDA SCI.FIRST.TABLE,Y + BNE .9 ...FREQUENT CHAR + JSR SCI.GET.NEXT.NYBBLE + LDA SCI.SECOND.TABLE,Y + BNE .9 ...TWO NYBBLE CHAR + JSR SCI.GET.NEXT.NYBBLE + LDA SCI.THIRD.TABLE,Y + BMI .9 ...REAL CHAR + STA WBUF+80 ...BLANK COUNT +.8 LDA #" " + DEC WBUF+80 + BEQ .7 ...NO MORE BLANKS +.9 LDY WBUF STORAGE INDEX + STA WBUF+1,Y + INY NEXT COLUMN + EOR #$8D END OF MESSAGE? + BNE .6 ...NO + RTS ...YES +*-------------------------------- +SCI.GET.NEXT.NYBBLE + LDA SCI.MESSAGES,X + BCS .1 2ND NYBBLE + LSR 1ST NYBBLE + LSR + LSR + LSR + TAY + SEC + RTS +.1 INX + AND #$0F + TAY + CLC + RTS +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/sci.s.errors +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/SCI.S.EXEC.txt b/SCMASM.30/SCI.S.EXEC.txt new file mode 100644 index 00000000..1c742a0e --- /dev/null +++ b/SCMASM.30/SCI.S.EXEC.txt @@ -0,0 +1,125 @@ +NEW + AUTO 3,1 +*-------------------------------------- +EXEC.ERR.FILE.BUSY JMP ERR.FILE.BUSY +EXEC.ERR.MISMATCH JMP TYPERR +*-------------------------------- +EXEC + JSR GET.REFNUM.OF.OPEN.FILE + BCS .1 ...NOT CURRENTLY OPEN +*---File is in use--------------- + BIT EXEC.FILE.CLOSING.FLAG + BPL EXEC.ERR.FILE.BUSY +*---Restarting same EXEC file---- + STA MISC.PARMS+1 REFNUM + LDA #0 "REWIND" THE FILE + STA MISC.PARMS+2 + STA MISC.PARMS+3 + STA MISC.PARMS+4 + JSR MLI.CE SET MARK + BCS CLOSE.EXEC.SAVING.ERROR + BCC .2 ...ALWAYS, RESTART +*-------------------------------- +.1 JSR CLOSE.EXEC.FILE STOP ANY EXEC IN PROGRESS + BCS .3 ...ERROR +*---Check file type-------------- + LDA GET.SET.PARMS+4 FILE TYPE MUST BE TXT + CMP #$04 TXT FILETYPE CODE + BNE EXEC.ERR.MISMATCH +*---Open the file---------------- + LDA #0 + STA LEVEL LEVEL + STA MISC.PARMS+2 BUFFER ADDRESS + LDA EXEC.BUFFER.BASE + STA MISC.PARMS+3 BUFFER ADDRESS HI + STA OPEN.PARMS+4 " + JSR MLI.C8 OPEN + BCS .3 ...ERROR + LDA OPEN.PARMS+5 REFNUM OF FILE + STA EXEC.REFNUM +*---Fill other param blocks------ +.2 LDX GET.SET.PARMS+5 RECORD LENGTH + STX VAL.L + LDX GET.SET.PARMS+6 + STX VAL.L+1 + LDX #2 POINT AT EXEC FILE NAME + JSR SAVE.FILENAME.IN.TABLE +*---Switch EXEC on now----------- + LDA #$FF MARK EXEC ACTIVE + STA F.EXEC + LDA KSWL + STA VDOSIO+2 + LDA KSWH + STA VDOSIO+3 + LDA #READ.EXEC.FILE + STA KSWL + LDA /READ.EXEC.FILE + STA KSWH + CLC +.3 RTS +*-------------------------------- +CLOSE.EXEC.SAVING.ERROR + PHA SAVE ERROR CODE + JSR CLOSE.EXEC.FILE CLOSE THE FILE + PLA GET ERROR CODE + SEC SIGNAL ERROR + RTS +*-------------------------------- +* CLOSE EXEC FILE +*-------------------------------- +CLOSE.EXEC.FILE + CLC + LDA F.EXEC + BPL .1 ...NO EXEC IN PROGRESS + LDA VDOSIO+2 RESTORE INPUT HOOK + STA KSWL + LDA VDOSIO+3 + STA KSWH + LDA #$FF + STA EXEC.FILE.CLOSING.FLAG + LDX #2 + LDA EXEC.REFNUM + JSR CLOSE.ONE.FILE CLOSE THE FILE +.1 RTS +*-------------------------------- +* "EXEC" INPUT HOOK +*-------------------------------- +READ.EXEC.FILE + STA (BASL),Y STOP BLINKING ON SCREEN + JSR SAVE.REGS SAVE A,X,Y +*---Check for CTRL-C Abort------- + LDA KEYBOARD + CMP #$83 CONTROL-C? + BNE .2 ...NO + JSR CLOSE.EXEC.FILE ...YES + STA STROBE +*---End of Data------------------ +.1 JSR RESTORE.REGS + JMP ABORT.EXIT +*---Set up EXEC char input------- +.2 LDA EXEC.REFNUM REFNUM + STA READ.WRITE.PARMS+1 + LDA #EXEC.INPUT.CHAR + STA READ.WRITE.PARMS+2 + LDA /EXEC.INPUT.CHAR + STA READ.WRITE.PARMS+3 + LDA #1 READ JUST ONE BYTE + STA READ.WRITE.PARMS+4 + LDA #0 + STA READ.WRITE.PARMS+5 + JSR MLI.CA READ + BCS .3 ...ERROR OR END OF DATA + JSR RESTORE.REGS + LDA EXEC.INPUT.CHAR + ORA #$80 + RTS +*-------------------------------- +.3 JSR CLOSE.EXEC.SAVING.ERROR CLOSE EXEC FILE + CMP #$05 END OF DATA? + BEQ .1 ...YES + JMP ERROR.HANDLER +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/sci.s.exec +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/SCI.S.GP.txt b/SCMASM.30/SCI.S.GP.txt new file mode 100644 index 00000000..a1880f46 --- /dev/null +++ b/SCMASM.30/SCI.S.GP.txt @@ -0,0 +1,174 @@ +NEW + AUTO 3,1 +*-------------------------------------- + JMP WARM.DOS + JMP PARSE.COMMAND +SCI.USER.CMD JMP GP.RTS USER COMMAND PARSER + JMP ERROR.HANDLER +PRINT.ERROR JMP ERROR.PRINTER +ERROR.CODE .HS 00 +*-------------------------------- +OUTVEC .DA $FDF0,$C100,$C200,$C300,$C400,$C500,$C600,$C700 +INVEC .DA $FD1B,$C100,$C200,$C300,$C400,$C500,$C600,$C700 +*-------------------------------- +VECOUT .HS F0FD +VECIN .HS 1BFD +*-------------------------------- +VDOSIO .DA 0,0 SAVE HARDWARE VECTOR DURING EXEC, WRITE + .DA 0,0 VSYSIO +*-------------------------------- +D.SLOT .HS 06 +D.DRIV .HS 01 +*-------------------------------- +PREGA .BS 1 +PREGX .BS 1 +PREGY .BS 1 +*-------------------------------- +F.TRACE .BS 1 +=TRACE OFF, -=TRACE ON +STATE .BS 1 0=IMMD, >0=DEFERRED +F.EXEC .BS 1 +F.READ .BS 1 +F.WRITE .BS 1 +F.PREFIX .BS 1 +DIR.FILE.READ.FLAG .BS 1 +*-------------------------------- + .HS 00 +*-------------------------------- +STRINGS.SPACE.COUNT .BS 1 +BUFFERED.WRITE.COUNT .BS 1 +COMMAND.LINE.LENGTH .BS 1 +PREVIOUS.CHAR .BS 1 +OPEN.FILE.COUNT .BS 1 +EXEC.FILE.CLOSING.FLAG .BS 1 +CATALOG.LINE.STATE .BS 1 +*-------------------------------- +EXTERNAL.COMMAND.HANDLER .BS 2 +COMMAND.NAME.LENGTH .BS 1 +COMMAND.NUMBER .BS 1 +*-------------------------------- +PBITS .HS 0000 +FBITS .HS 0000 +VAL.A .HS 0000 +VAL.B .HS 000000 +VAL.E .HS 0000 +VAL.L .HS 0000 +VAL.S .HS 00 +VAL.D .HS 00 +VAL.F .HS 0000 +VAL.R .HS 0000 +VAL.V .HS 00 +VAL.AT .HS 0000 +VAL.T .HS 00 +VAL.LB .HS 00 PR# OR IN# VALUE +*-------------------------------- + .DA PATHNAME.ONE.BUFFER + .DA PATHNAME.TWO.BUFFER +*-------------------------------- +MLI.CALLER + STA .2 + STX GP.SAVEX + CMP #$CF + BCC .1 + LDA #$CE +.1 TAX + LDA MLI.PARM.PNTRS-$C0,X + STA .3 + JSR GP.MLI +.2 .HS 00 +.3 .DA * + BCC .6 + LDX #0 +.4 CMP MLI.ERROR.CODES,X + BEQ .5 + INX + CPX #19 + BCC .4 +.5 LDA BI.ERROR.CODES,X +*** SEC (CARRY ALREADY SET) +.6 LDX #*-* +GP.SAVEX .EQ *-1 + ORA #0 +GP.RTS RTS +*-------------------------------- + .HS 00 <<>> +*---CREATE PARMS----------------- +CREATE.PARMS + .HS 07 + .DA PATHNAME.ONE.BUFFER + .HS C3.00.0000.00.0000.0000 +*---GET & SET PREFIX, DESTROY---- +PREFIX.PARMS + .HS 01 + .DA PATHNAME.ONE.BUFFER +*---RENAME----------------------- +RENAME.PARMS + .HS 02 + .DA PATHNAME.ONE.BUFFER + .DA PATHNAME.TWO.BUFFER +*---GET & SET FILE INFO---------- +GET.SET.PARMS + .HS 0A + .DA PATHNAME.ONE.BUFFER + .HS 00.00.0000 + .HS 00.0000.0000.0000.0000.0000 +*---MISC------------------------- +MISC.PARMS + .HS 02.00.0000 + .HS 00 +*---OPEN PARMS------------------- +OPEN.PARMS + .HS 03 + .DA PATHNAME.ONE.BUFFER + .HS 0000.00 +*---SET NEWLINE PARMS------------ +NEWLINE.PARMS + .HS 03.00.7F.0D +*---READ & WRITE PARMS----------- +READ.WRITE.PARMS + .HS 04.00.0000.0000.0000 +*---CLOSE & FLUSH PARMS---------- +CLOSE.FLUSH.PARMS + .HS 01.00 +*-------------------------------- +* ADDRESSES OF MLI PARM LISTS FOR EACH CALL $C0-$D3 +* actual address is $BExx +*-------------------------------- +MLI.PARM.PNTRS + .DA #CREATE.PARMS $C0--CREATE + .DA #PREFIX.PARMS $C1--DESTROY + .DA #RENAME.PARMS $C2--RENAME + .DA #GET.SET.PARMS $C3--SFI + .DA #GET.SET.PARMS $C4--GFI + .DA #MISC.PARMS $C5--ONLINE + .DA #PREFIX.PARMS $C6--SPFX + .DA #PREFIX.PARMS $C7--GPFX + .DA #OPEN.PARMS $C8--OPEN + .DA #NEWLINE.PARMS $C9--NEWLINE + .DA #READ.WRITE.PARMS $CA--READ + .DA #READ.WRITE.PARMS $CB--WRITE + .DA #CLOSE.FLUSH.PARMS $CC--CLOSE + .DA #CLOSE.FLUSH.PARMS $CD--FLUSH + .DA #MISC.PARMS $CE--SMARK +* .DA #MISC.PARMS $CF--GMARK +* .DA #MISC.PARMS $D0--SEOF +* .DA #MISC.PARMS $D1--GEOF +* .DA #MISC.PARMS $D2--SBUF +* .DA #MISC.PARMS $D3--GBUF +*-------------------------------- + .AS -/++++/ +*-------------------------------- +BUFFER.BASES .HS 78.7C LOWER/UPPER BUFFERS +EXEC.BUFFER.BASE .HS 74 +*-------------------------------- + RTS WAS GET BUFFER + NOP + NOP + RTS WAS RETURN BUFFER + NOP + NOP + .HS 74 HIMEM PAGE +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/sci.s.gp +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/SCI.S.LOADSAVE.txt b/SCMASM.30/SCI.S.LOADSAVE.txt new file mode 100644 index 00000000..64028b2f --- /dev/null +++ b/SCMASM.30/SCI.S.LOADSAVE.txt @@ -0,0 +1,381 @@ +NEW + AUTO 3,1 +*-------------------------------------- +DASH + LDA GET.SET.PARMS+4 GET FILE TYPE + CMP #$06 BINARY? + BEQ .3 ...YES, BRUN + CMP #$04 TEXT? + BNE .1 ...NO, TRY SYS + JMP EXEC ...YES, EXEC +*-------------------------------- +.1 CMP #$FF SYS FILE? + BEQ .2 ...YES, BRUN IT + LDA #$0D "FILE TYPE MISMATCH" + SEC + RTS +*---RUN SYS FILE----------------- +.2 JSR CLOSE.ALL.FILES + JSR CLOSE.EXEC.FILE + LDA #0 + STA VAL.A + LDX #6 RELEASE $8000-$B7FF +.4 STA BITMAP+16,X + DEX + BPL .4 + LDA #$01 RELEASE $B800-$BEFF + STA BITMAP+23 B800.BFFF + LDA /$2000 A$2000 + STA VAL.A+1 + LDA #$FF T=SYS + STA VAL.T + LDA #$80 SIGNAL FOUND T,A, AND PATHNAME + STA FBITS+1 + LDA #$05 + STA FBITS +.3 JMP BRUN +*-------------------------------- +WARM.DOS + JSR CLOSE.ALL.FILES + JSR CROUT + JMP SC.SOFT +*-------------------------------- +* LOAD A SOURCE PROGRAM +*-------------------------------- +LOAD + JSR ALLOCATE.UPPER.BUFFER + BCS .5 + LDA #$01 READ + LDX #$FA FILE TYPE + JSR OPEN.A.FILE + BCS .5 ...ERROR +*---GET LENGTH OF FILE----------- + LDA SC.INFLAG + ASL + BPL .1 ...NOT .INBx + AND #$7F + STA MISC.PARMS+3 + LDA #0 + STA MISC.PARMS+2 + BEQ .2 ...ALWAYS +.1 JSR MLI.D1 GET LENGTH OF FILE + BCS .5 ...ERROR +*---FIGURE LOAD ADDRESS---------- +.2 SEC + LDA SC.HIMEM + SBC MISC.PARMS+2 + STA READ.WRITE.PARMS+2 + STA VAL.A + TAX + LDA SC.HIMEM+1 + SBC MISC.PARMS+3 + STA READ.WRITE.PARMS+3 + STA VAL.A+1 + TAY +*---CHECK FOR ROOM IN RAM-------- + BMI .6 ADDRESS>$7FFF MEANS NO ROOM + TXA + CMP SC.LOMEM + TYA + SBC SC.LOMEM+1 + BCC .6 ...BELOW LOMEM +*---READ FILE-------------------- + LDA MISC.PARMS+2 + STA READ.WRITE.PARMS+4 + LDA MISC.PARMS+3 + STA READ.WRITE.PARMS+5 + JSR MLI.CA READ THE FILE + BCS .5 +*---CLOSE UNLESS .INBx----------- + BIT SC.INFLAG + BVS .4 ...IT IS .INBx +.3 JSR MLI.CC CLOSE THE FILE + BCS .5 +*-------------------------------- +.4 LDX VAL.A+1 + LDY VAL.A + STX SC.PP+1 + STY SC.PP +.5 RTS +.6 LDA #$0E "PROGRAM TOO LARGE" + SEC + RTS +*-------------------------------- +* SAVE SOURCE PROGRAM ON DISK +*-------------------------------- +SAVE + BCC .1 ...FILE ALREADY HERE + LDA #$FA FILE TYPE "INT" + STA VAL.T + STA GET.SET.PARMS+4 + LDA #$C3 + STA GET.SET.PARMS+3 + LDA SC.PP START OF PROGRAM + STA CREATE.PARMS+5 + STA GET.SET.PARMS+5 + LDA SC.PP+1 + STA CREATE.PARMS+6 + STA GET.SET.PARMS+6 + JSR MAKE.A.FILE CREATE A NEW FILE + BCS .2 ...ERROR +.1 JSR ALLOCATE.UPPER.BUFFER + BCS .2 + LDA #$02 + LDX #$FA + JSR OPEN.A.FILE + BCS .2 ...ERROR +*---GET LENGTH------------------- + SEC GET LENGTH + LDA SC.HIMEM + SBC SC.PP + TAX + STA MISC.PARMS+2 + LDA SC.HIMEM+1 + SBC SC.PP+1 + TAY + STA MISC.PARMS+3 + LDA #0 + STA MISC.PARMS+4 +*---WRITE THE FILE--------------- + LDA SC.PP + STA READ.WRITE.PARMS+2 + LDA SC.PP+1 + STA READ.WRITE.PARMS+3 + STX READ.WRITE.PARMS+4 + STY READ.WRITE.PARMS+5 + JSR MLI.CB WRITE DATA ON FILE + BCS .2 ...ERROR + JSR MLI.D0 SET EOF (TRUNCATE OLD LONGER FILE) + BCS .2 ...ERROR + JSR MLI.CC CLOSE THE FILE + BCS .2 ...ERROR +*---UPDATE FILE INFO------------- + LDA SC.PP+1 + LDX SC.PP + CMP GET.SET.PARMS+6 + BNE .3 + CPX GET.SET.PARMS+5 + CLC + BNE .3 +.2 RTS +.3 STX GET.SET.PARMS+5 + STA GET.SET.PARMS+6 + LDA #0 + STA GET.SET.PARMS+10 + STA GET.SET.PARMS+11 + STA GET.SET.PARMS+12 + STA GET.SET.PARMS+13 + JMP SET.FILE.INFO +*-------------------------------- +CREATE + LDX #0 + LDY #0 AuxType = 0000 unless specified + LDA FBITS+1 + BPL .1 ...no A-value specified + LDX VAL.A use A-value for AuxType + LDY VAL.A+1 +.1 STX CREATE.PARMS+5 + STY CREATE.PARMS+6 + LDA FBITS + AND #$04 + BNE MAKE.A.FILE + LDA #$0F + STA VAL.T + +MAKE.A.FILE + LDA VAL.T + STA CREATE.PARMS+4 + LDX #$C3 + LDY #$01 SEEDLING + CMP #$0F + BNE .1 + LDY #$0D DIRECTORY +.1 STX CREATE.PARMS+3 + STY CREATE.PARMS+7 + JMP MLI.C0 CREATE +*-------------------------------- +RENAME LDA FBITS + AND #$02 PATH 2? + BEQ .1 ...NO, ERROR + JMP MLI.C2 RENAME +.1 JMP ERR.SYNTAX +*-------------------------------- +LOCK JSR GET.FILE.INFO + BCS RTS3 + LDA GET.SET.PARMS+3 + AND #$3C + ORA #$01 + BNE LKUNLK ...ALWAYS +UNLOCK JSR GET.FILE.INFO + BCS RTS3 + LDA #$C3 + ORA GET.SET.PARMS+3 +LKUNLK STA GET.SET.PARMS+3 + JMP SET.FILE.INFO +*-------------------------------- +PREFIX + LDX #0 + LDA FBITS+1 + AND #$04 + BNE .1 ...SPECIFIED S/D + LDA FBITS SEE IF SPECIFIED PATHNAME + LSR + BCC .3 ...NO, SO PRINT CURRENT PREFIX +.1 JMP MLI.C6 SET PREFIX +*---PRINT CURRENT PREFIX--------- +.2 LDA PATHNAME.ONE.BUFFER+1,X + ORA #$80 + JSR COUT + INX +.3 CPX PATHNAME.ONE.BUFFER + BCC .2 + JSR CROUT + CLC +RTS3 RTS +*-------------------------------- +NOPREFIX + LDA #0 + STA PATHNAME.ONE.BUFFER + JMP MLI.C6 SET PREFIX +*-------------------------------- +BSAVE + BCC .2 ...EXISTING FILE + LDA FBITS+1 + AND #$B0 A-EL + CMP #$90 Require A and either E or L + BCC .3 ...Neither E nor L + LDA VAL.A + STA CREATE.PARMS+5 + STA GET.SET.PARMS+5 + LDA VAL.A+1 + STA CREATE.PARMS+6 + STA GET.SET.PARMS+6 +*---T=BIN unless specified------- + LDA FBITS + AND #$04 + BNE .1 ...TYPE SPECIFIED + LDA #$06 ...NO TYPE, ASSUME BINARY + STA VAL.T +.1 LDA VAL.T + STA GET.SET.PARMS+4 +*-------------------------------- + JSR MAKE.A.FILE + BCS .4 + JSR GET.FILE.INFO + BCS .4 +.2 LDA #$02 + BNE B.COMMON ...ALWAYS + +.3 LDA #$06 "PATH NOT FOUND" + SEC +.4 RTS +*-------------------------------- +BRUN + JSR BLOAD + BCS .1 + JSR .2 + CLC +.1 RTS +.2 JMP (READ.WRITE.PARMS+2) +*-------------------------------- +BLOAD + LDA #$01 +B.COMMON + PHA + JSR ALLOCATE.UPPER.BUFFER + PLA + BCS .3 + LDX #$06 + JSR OPEN.A.FILE + BCS .3 + LDX VAL.A + LDY VAL.A+1 + LDA FBITS+1 + BMI .1 ...ADDRESS SPECIFIED + LDX GET.SET.PARMS+5 + LDY GET.SET.PARMS+6 + LDA FBITS DON'T ALLOW DEFAULT ADDRESS + AND #$04 ON NON-BINARY FILES + BEQ .0 ...T not specified, so it is BIN + LDA VAL.T T specified, better be BIN or SYS + CMP #$06 is it BIN? + BEQ .0 ...yes, use AuxType value + CMP #$FF is it SYS? + BNE .4 ...no, error + LDX #$2000 ...type SYS, assume A$2000 + LDY /$2000 +.0 LDA FBITS+1 +.1 STX READ.WRITE.PARMS+2 + STY READ.WRITE.PARMS+3 + LDX VAL.L + LDY VAL.L+1 + AND #$30 + BEQ .5 + EOR #$30 + BEQ .4 + AND #$10 + BEQ .7 + LDA VAL.E + SEC + SBC VAL.A + TAX + LDA VAL.E+1 + SBC VAL.A+1 + TAY + INX + BNE .2 + INY +.2 BCS .7 + LDA #$02 "RANGE ERROR" + SEC +.3 RTS +*-------------------------------- +.4 LDA #$0B "INVALID PARAMETER" + SEC + RTS +*-------------------------------- +.5 JSR MLI.D1 GET EOF + BCS .6 + LDX MISC.PARMS+2 + LDY MISC.PARMS+3 + LDA MISC.PARMS+4 + BEQ .7 + LDA #$0E "PROGRAM TOO LARGE" +.6 SEC + RTS +*-------------------------------- +.7 STX READ.WRITE.PARMS+4 + STY READ.WRITE.PARMS+5 + LDA FBITS+1 + AND #$40 + BEQ .10 + LDX #$02 +.8 LDA VAL.B,X + STA MISC.PARMS+2,X + DEX + BPL .8 +.9 JSR MLI.CE SET MARK + LDX COMMAND.NUMBER + BCC .10 + CMP #$02 + BNE .6 + CPX #CN.BSAVE + BNE .6 + JSR MLI.D0 SET EOF + BCC .9 + RTS +*-------------------------------- +.10 LDX COMMAND.NUMBER + CPX #CN.BSAVE + BNE .12 ...NOT BSAVE + JSR MLI.CB ...BSAVE + BCS .13 ...ERROR +.11 JMP MLI.CC +.12 JSR MLI.CA READ + BCC .11 ...GOOD, CLOSE +.13 RTS +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/sci.s.loadsave +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/SCI.S.ONLINE.txt b/SCMASM.30/SCI.S.ONLINE.txt new file mode 100644 index 00000000..de4d07f6 --- /dev/null +++ b/SCMASM.30/SCI.S.ONLINE.txt @@ -0,0 +1,75 @@ +NEW + AUTO 3,1 +*-------------------------------------- +ONLINE LDA BUFFER.BASES + STA MISC.PARMS+3 + LDA #0 + STA MISC.PARMS+2 + STA MISC.PARMS+1 + JSR MLI.C5 (Might clobber DRIVER.PTR) +*---Now display the list--------- + LDA BUFFER.BASES + STA DRIVER.PTR+1 + LDA #0 + STA DRIVER.PTR +.1 PHA + TAY + LDA (DRIVER.PTR),Y + BEQ .5 ...END OF LIST + PHA + LDA #"S" + JSR COUT + PLA + PHA + LSR ISOLATE SLOT NUMBER + LSR + LSR + LSR + AND #7 + ORA #"0" + JSR COUT PRINT SLOT NUMBER + LDA #"," + JSR COUT + LDA #"D" + JSR COUT + PLA + PHA + ASL SET CARRY IF DRIVE 2 + LDA #"1" ASSUME DRIVE 1 + ADC #0 CHANGE TO 2 IF TRUE + JSR COUT + LDA #" " PRINT SPACE + JSR COUT + PLA get dsssllll again + AND #$0F isolate length + BEQ .3 no name, show error code + TAX + LDA #"/" +.2 JSR COUT + INY PRINT THE VOLUME OR FILE NAME + LDA (DRIVER.PTR),Y + ORA #$80 + DEX + BPL .2 + LDA #"/" + BNE .4 ...ALWAYS +.3 LDA #"(" + JSR COUT + INY + LDA (DRIVER.PTR),Y GET ERROR CODE + JSR PRBYTE + LDA #")" +.4 JSR COUT + JSR CROUT +*-------------------------------- +.5 CLC POINT TO NEXT VOLUME NAME + PLA + ADC #16 + BCC .1 STILL IN SAME PAGE + CLC NO ERROR! + RTS +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/sci.s.online +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/SCI.S.OPENCLOSE.txt b/SCMASM.30/SCI.S.OPENCLOSE.txt new file mode 100644 index 00000000..1601a74b --- /dev/null +++ b/SCMASM.30/SCI.S.OPENCLOSE.txt @@ -0,0 +1,321 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* FOLLOWING USE "BIT" TO SKIP OVER TWO BYTES, +* SO CANNOT HAVE THE SECOND OF THE TWO =$CX. +*-------------------------------- +MLI.C0 LDA #$00 CREATE + .HS 2C +MLI.C1 LDA #$01 DESTROY + .HS 2C +MLI.C2 LDA #$02 RENAME + .HS 2C +MLI.C3 LDA #$03 SET FILE INFO + .HS 2C +MLI.C4 LDA #$04 GET FILE INFO + .HS 2C +MLI.C5 LDA #$05 ONLINE + .HS 2C +MLI.C6 LDA #$06 SET PREFIX + .HS 2C +MLI.C7 LDA #$07 GET PREFIX + .HS 2C +MLI.C8 LDA #$08 OPEN + .HS 2C +MLI.C9 LDA #$09 NEWLINE + .HS 2C +MLI.CA LDA #$0A READ + .HS 2C +MLI.CB LDA #$0B WRITE + .HS 2C +MLI.CC LDA #$0C CLOSE + .HS 2C +MLI.CD LDA #$0D FLUSH + .HS 2C +MLI.CE LDA #$0E SET MARK + .HS 2C +MLI.CF LDA #$0F GET MARK + .HS 2C +MLI.D0 LDA #$D0 SET EOF + .HS 2C +MLI.D1 LDA #$D1 GET EOF + ORA #$C0 MAKE INTO MLI CALL CODE + JMP MLI.CALLER +*-------------------------------- +GET.FILE.INFO + LDA #10 + STA GET.SET.PARMS + BNE MLI.C4 GET FILE INFO +*-------------------------------- +SET.FILE.INFO + LDA #7 + STA GET.SET.PARMS + BNE MLI.C3 SET FILE INFO +*-------------------------------- +BYE + JSR CLOSE.ALL.FILES + JSR CLOSE.EXEC.FILE + JSR GP.MLI + .DA #$65,READ.WRITE.PARMS +*-------------------------------- +OPEN.A.FILE + PHA + LDA FBITS + AND #$04 + BEQ .1 + LDX VAL.T +.1 PLA + +OPEN.DIRECTORY + CPX GET.SET.PARMS+4 + BNE TYPERR + AND GET.SET.PARMS+3 + BEQ .3 + LDA ALLOCATED.BUFFER.PAGE + STA OPEN.PARMS+4 + LDA #$0F + STA LEVEL + JSR MLI.C8 OPEN + BCS .1 + LDA OPEN.PARMS+5 + STA READ.WRITE.PARMS+1 + STA CLOSE.FLUSH.PARMS+1 + STA MISC.PARMS+1 +.1 RTS +*-------------------------------- +.3 LDA #$0A "FILE LOCKED" + SEC + RTS +*-------------------------------- +VERIFY + LDA #$06 "PATH NOT FOUND" + RTS ALREADY .CS. IF ERROR +*-------------------------------- +TYPERR LDA #$0D + SEC + RTS +*-------------------------------- +* OPEN -- ONLY USED BY SCASM FOR OPENING +* .TF AND "TEXT" FILES +* THE FILES MAY BE TXT OR BIN FILE TYPE +*-------------------------------- +OPEN + PHP + JSR GET.REFNUM.OF.OPEN.FILE + BCC .9 ...ALREADY OPEN, ERROR + PLP ...GET SAVED STATUS + BCC .3 ...FILE ALREADY EXISTS +*---MAKE A NEW FILE-------------- + LDA FBITS WAS T SPECIFIED? + AND #$04 + BEQ .1 ...NO + LDA VAL.T WHAT WAS SPEC? + BCS .2 ...always, use spec'd type +.1 LDA #$06 ...new file, type not spec'd, T=BIN + BIT PASS $FF if command level, 0 or 1 if assembling + BPL .4 ...assembling, make BIN file + LDA #$04 ...command, make TXT file +.4 STA VAL.T +.2 STA GET.SET.PARMS+4 + LDA #$C3 FULL ACCESS PRIVILEGES + STA GET.SET.PARMS+3 + LDA #0 RECORD LENGTH = 0000 + STA CREATE.PARMS+5 + STA CREATE.PARMS+6 + STA GET.SET.PARMS+5 + STA GET.SET.PARMS+6 + JSR MAKE.A.FILE CREATE THE FILE + BCS .8 ...ERROR +*---NOW THE FILE EXISTS---------- +*---OPEN THE FILE---------------- +.3 JSR ALLOCATE.LOWER.BUFFER + STA OPEN.PARMS+4 STARTING PAGE OF BUFFER + LDA #$07 LEVEL # + STA LEVEL + JSR MLI.C8 OPEN + BCS .8 ...ERROR +*---SAVE NAME, ETC OF OPEN FILE-- + LDA OPEN.PARMS+4 MARK THE BUFFER IN USE + STA FILE.BUFFER.PNTRS,X + LDA OPEN.PARMS+5 REFNUM + STA FILE.REFNUMS,X + JSR SAVE.FILENAME.IN.TABLE + CLC +.8 RTS +*-------------------------------- +.9 PLP + JMP ERR.FILE.BUSY +*-------------------------------- +SAVE.FILENAME.IN.TABLE + TXA + ASL INDEX TIMES 32 + ASL + ASL + ASL + ASL + TAX +*---FORM NAME LENGTH BYTE-------- + LDA PATHNAME.TWO.BUFFER + STA OPEN.FILE.NAME.BUFFERS,X + TAY SAVE ACTUAL LENGTH + CMP #30 ONLY ROOM FOR 29 CHARS + BCC .1 ...'TWILL FIT + LDA #29 USE LAST 29 CHARS +.1 STA FNLEN + LDA VAL.L + STA OPEN.FILE.NAME.BUFFERS+1,X + LDA VAL.L+1 + STA OPEN.FILE.NAME.BUFFERS+2,X +.2 INX + LDA PATHNAME.TWO.BUFFER,Y + STA OPEN.FILE.NAME.BUFFERS+2,X + DEY + DEC FNLEN + BNE .2 + CLC + RTS +*-------------------------------- +* SEARCH OPEN FILE NAME TABLE +* RETURN .CS., A=ERRCOD IF NO PATHNAME +* OR IF NOT IN TABLE +* RETURN .CC., A=REFNUM IF FOUND IN TABLE +*-------------------------------- +GET.REFNUM.OF.OPEN.FILE + LDA FBITS WAS PATHNAME GIVEN? + LSR + BCS .1 ...YES + JMP ERR.SYNTAX ...NO, "SYNTAX ERROR" +*---CHECK AMONG NON-EXEC FILES--- +.1 LDX #1 MAX # OF FILES IS 2 + STX EXEC.FILE.CLOSING.FLAG +.2 LDA FILE.BUFFER.PNTRS,X SEE IF IN USE + BEQ .3 NO + JSR COMPARE.TO.FILE.NAME.BUFFER + BCC .5 ...FOUND IT +.3 DEX + BPL .2 +*---CHECK EXEC FILE-------------- + BIT F.EXEC IS EXEC ON? + BPL .4 ...NO, FILE NOT OPEN + LDX #2 ...YES + JSR COMPARE.TO.FILE.NAME.BUFFER + BCS .4 ...NOT THIS ONE EITHER + LDA #$FF + STA EXEC.FILE.CLOSING.FLAG + LDA EXEC.REFNUM + RTS RETURN .CC. +.4 LDA #$12 "FILE NOT OPEN" + SEC + RTS RETURN .CS. +.5 LDA FILE.REFNUMS,X + RTS RETURN .CC. +*-------------------------------- +* COMPARE NAMES +* RETURN .CC. IF SAME, ELSE .CS. +*-------------------------------- +COMPARE.TO.FILE.NAME.BUFFER + TXA + PHA SAVE X-REGISTER + ASL INDEX TIMES 32 + ASL + ASL + ASL + ASL + TAX + LDA OPEN.FILE.NAME.BUFFERS,X + CMP PATHNAME.TWO.BUFFER + BNE .3 ...DIFFERENT LENGTHS + TAY POINT TO END OF PATHNAME + CMP #30 CHOP AT 29 + BCC .1 + LDA #29 +.1 STA FNLEN + LDA OPEN.FILE.NAME.BUFFERS+1,X + STA RECORD.LENGTH + LDA OPEN.FILE.NAME.BUFFERS+2,X + STA RECORD.LENGTH+1 +.2 INX + LDA PATHNAME.TWO.BUFFER,Y + CMP OPEN.FILE.NAME.BUFFERS+2,X + BNE .3 NOT THE SAME NAME + DEY + DEC FNLEN + BNE .2 MORE TO THE NAME + CLC SIGNAL SAME NAMES + .HS B0 "BCS" OPCODE, SKIPS OVER "SEC" +.3 SEC SIGNAL DIFFERENT NAMES + PLA RESTORE X-REG + TAX + RTS +*-------------------------------- +CLOSE + LDA FBITS + LSR ANY PATHNAME GIVEN? + BCC CLOSE.ALL.FILES ...NO + JSR GET.REFNUM.OF.OPEN.FILE + BCC CLOSE.ONE.FILE ...OPEN, SO CLOSE IT + CLC ...NOT OPEN, SO FINISHED + RTS +*-------------------------------- +* CLOSE A FILE ... REFNUM IN A-REG +* INDEX IN X-REG +*-------------------------------- +CLOSE.ONE.FILE + STA CLOSE.FLUSH.PARMS+1 REFNUM + LDA #0 + STA LEVEL LEVEL 0 + JSR MLI.CC CLOSE + BCS RTS2 ...ERROR + LDA #0 + BIT EXEC.FILE.CLOSING.FLAG + BPL .1 + STA F.EXEC + STA EXEC.FILE.CLOSING.FLAG + RTS +.1 STA FILE.BUFFER.PNTRS,X + LDA CLOSE.FLUSH.PARMS+1 + EOR WRITE.REFNUM TEST .EQ., LEAVE CARRY CLEAR + BNE RTS2 ...NOT SAME AS "WRITE" FILE +*-------------------------------- +UNHOOK.WRITE + BIT F.WRITE + BPL RTS2 + LDA VDOSIO + STA CSWL + LDA VDOSIO+1 + STA CSWH + LDA #0 + STA F.WRITE +RTS2 RTS +*-------------------------------- +CLOSE.ALL.FILES + LDX #1 MAX FILES IS 2 +.1 LDA FILE.BUFFER.PNTRS,X + BEQ .2 NOT IN USE + LDA FILE.REFNUMS,X + JSR CLOSE.ONE.FILE + BCS RTS2 +.2 DEX + BPL .1 + INX X=0 + STX CLOSE.FLUSH.PARMS+1 + LDA #$07 + STA LEVEL + JMP MLI.CC CLOSE +*-------------------------------- +* ALLOCATE UPPER/LOWER BUFFER +*-------------------------------- +ALLOCATE.UPPER.BUFFER + LDX #1 + .HS 2C +ALLOCATE.LOWER.BUFFER + LDX #0 +.2 LDA BUFFER.BASES,X + STA ALLOCATED.BUFFER.PAGE + CLC + RTS +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/sci.s.openclose +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/SCI.S.PRIN.txt b/SCMASM.30/SCI.S.PRIN.txt new file mode 100644 index 00000000..a1f05ed7 --- /dev/null +++ b/SCMASM.30/SCI.S.PRIN.txt @@ -0,0 +1,87 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* PR#slot copy address from OUTVEC,slot to CSW +* PR#Aaddr copy Aaddress into CSW +* PR#slot,Aaddr copy Aaddress into OUTVEC,slot +* +* IN#slot copy address from INVEC,slot to KSW +* IN#Aaddr copy Aaddress into KSW +* IN#slot,Aaddr copy Aaddress into INVEC,slot +*-------------------------------- +PR LDA #0 + .HS 2C SKIP NEXT LINE +IN LDA #2 + PHA SAVE 0 OR 2 + ASL + ASL 00 OR 08 + ORA VAL.LB +SLOT + ASL *2 + TAX + BIT FBITS WAS SLOT PARAMETER GIVEN? + BVC .1 ...NO + LDA FBITS+1 ...YES, WAS A$ PARM ALSO? + BMI .2 ...YES, SO UPDATE TABLE + TXA Check for "PR#0" + BEQ .4 ...yes, so call MON.SETVID directly + LDA OUTVEC,X ...NO, ONLY SLOT + STA VAL.A SO GET VALUE FROM TABLE + LDA OUTVEC+1,X + STA VAL.A+1 +.1 JSR CHECK.IO.DRIVER + BCS .3 ...NOT VALID DRIVER + PLA POP SAVED 0 OR 2 + TAX + LDA VAL.A INSTALL HOOK FOR DRIVER + STA CSWL,X + LDA VAL.A+1 + STA CSWH,X + RTS +*---ENTER NEW VALUE IN TABLE----- +.2 JSR CHECK.IO.DRIVER + BCS .3 ...ERROR + PLA POP OFF SAVED 0 OR 2 + LDA VAL.A+1 UPDATE TABLE + STA OUTVEC+1,X + LDA VAL.A + STA OUTVEC,X + RTS +.3 PLA POP OFF SAVED 0 OR 2 + LDA #$03 "NO DEVICE CONNECTED" + RTS +*-------------------------------- +.4 PLA POP OFF SAVED 0 OR 2 + JSR MON.SETVID + CLC + RTS +*-------------------------------- +CHECK.IO.DRIVER + LDA VAL.A GET DRIVER ADDRESS INTO PNTR + STA DRIVER.PTR + LDA VAL.A+1 + STA DRIVER.PTR+1 + LDY #0 + CMP #$C0 IS IT IN ROM AREA? + BCC .3 ...NO + LDA IO.OFF ...YES, TURN OFF $C800 SPACE + STY RETRY.COUNT + LDA (DRIVER.PTR),Y CHECK FOR ROM PRESENT + CMP #$FF + BEQ .4 ...NOT VALID ROM VALUE +.1 CMP (DRIVER.PTR),Y BETTER NOT CHANGE... + BNE .4 ...WOOPS, NOT ROM + DEC RETRY.COUNT TRY IT 256 TIMES + BNE .1 ...AGAIN +.2 CLC ...REALLY A DRIVER + RTS +*---VERIFY RAM-BASED DRIVER------ +.3 LDA (DRIVER.PTR),Y GET FIRST BYTE + CMP #$D8 "CLD" OPCODE? + BEQ .2 ...YES, VALID DRIVER +.4 SEC + RTS +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/sci.s.prin +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/SCI.S.RWPA.txt b/SCMASM.30/SCI.S.RWPA.txt new file mode 100644 index 00000000..271cb588 --- /dev/null +++ b/SCMASM.30/SCI.S.RWPA.txt @@ -0,0 +1,65 @@ +NEW + AUTO 3,1 +*-------------------------------------- +WRITE + JSR GET.REFNUM.OF.OPEN.FILE + BCS .1 ...NOT OPEN + STA WRITE.REFNUM + LDA CSWL + STA VDOSIO + LDA CSWH + STA VDOSIO+1 + LDA #WRITE.TEXT.FILE + STA CSWL + LDA /WRITE.TEXT.FILE + STA CSWH + LDA #$FF + STA F.WRITE +.1 RTS +*-------------------------------- +* OUTPUT HOOK DURING A WRITE OPERATION +*-------------------------------- +WRITE.TEXT.FILE + AND #$7F PRODOS STANDARD IS BIT7=0 + STA WRITE.OUTPUT.CHAR + JSR SAVE.REGS + LDX WRITE.REFNUM + STX READ.WRITE.PARMS+1 + ASL IGNORE BIT 7 + BEQ .2 END OF FILE + LDA #WRITE.OUTPUT.CHAR + STA READ.WRITE.PARMS+2 + LDA /WRITE.OUTPUT.CHAR + STA READ.WRITE.PARMS+3 + LDA #1 + STA READ.WRITE.PARMS+4 + LDA #0 + STA READ.WRITE.PARMS+5 + JSR MLI.CB WRITE + BCC RESTORE.REGS +*-------------------------------- +.1 JMP ERROR.HANDLER +*-------------------------------- +.2 STX MISC.PARMS+1 + JSR MLI.CF READ MARK + BCS .1 + JSR MLI.D0 SET EOF + BCS .1 ...ERROR +*---fall into RESTORE.REGS------- +*-------------------------------- +RESTORE.REGS + LDY PREGY + LDX PREGX + LDA PREGA + RTS +*-------------------------------- +SAVE.REGS + STA PREGA + STX PREGX + STY PREGY + RTS +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/sci.s.rwpa +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/SCI.S.TABLES.txt b/SCMASM.30/SCI.S.TABLES.txt new file mode 100644 index 00000000..89e2a4a9 --- /dev/null +++ b/SCMASM.30/SCI.S.TABLES.txt @@ -0,0 +1,180 @@ +NEW + AUTO 3,1 +*-------------------------------------- +CN. .SE 1 + .MA CMD +CN. .SE CN.+1 +CN.]2 .EQ CN. + .AT /]2]3/ + .DA ]2 + .HS ]1 + .EM +*-------------------------------- +COMMAND.TABLE + .AT /-/ + .DA DASH + .HS 0104 + >CMD 05F4,BLOAD + >CMD 01F4,BRUN + >CMD 0DF4,BSAVE + >CMD 0000,BYE + >CMD 9504,CATALOG + >CMD 9504,CAT + >CMD 0100,CLOSE + >CMD 0D84,CREATE + +* >CMD 0104,DELETE + +CN. .SE CN.+1 +CN.DELETE .EQ CN. + .AT /DELETE/ + .DA MLI.C1 + .HS 0104 + + >CMD 0107,EXEC + >CMD 4080,IN,# + >CMD 0504,LOAD + >CMD 0104,LOCK + >CMD 0000,NOPREFIX + >CMD 0000,NOW + >CMD 0000,ONLINE + >CMD 2D14,OPEN + >CMD 4080,PR,# + >CMD 9104,PREFIX + >CMD 0304,RENAME + >CMD 0D04,SAVE + >CMD 0104,UNLOCK + >CMD 1104,VERIFY + >CMD 2147,WRITE + .HS 00 +*-------------------------------- +* PARAMETER NAME TABLE +*-------------------------------- +PARM.NAMES + .AS /ABELSDFRV/ +NO.PARM.NAMES .EQ *-PARM.NAMES +*-------------------------------- +* BIT MASK FOR PARAMETERS IN PERMISSION BITS +*-------------------------------- +* A B E L S D F R V @ +PARM.MASKS + .HS 80.40.20.10.04.04.02.01.00 +*-------------------------------- +* XXXXXXYY where yy+1= # of bytes +* xxxxxx= offset from VAL.A +* of last byte +*-------------------------------- + .MA PAR + .DA #VAL.]1-VAL.A+]2-1*4+]2-1 + .EM +*-------------------------------- +PARM.VARIABLES + >PAR A,2 + >PAR B,3 + >PAR E,2 + >PAR L,2 + >PAR S,1 + >PAR D,1 + >PAR F,2 + >PAR R,2 + >PAR V,1 +*-------------------------------- +* FILE TYPE CODES +*-------------------------------- + .MA FT + .AS -/]1/ + .HS ]2 + .EM +*-------------------------------- +FILE.TYPES + >FT TXT,04 + >FT BIN,06 + >FT DIR,0F + >FT ADB,19 + >FT AWP,1A + >FT ASP,1B + >FT PAS,EF + >FT CMD,F0 + >FT S-C,FA (NORMALLY "INT") + >FT IVR,FB + >FT BAS,FC + >FT VAR,FD + >FT REL,FE + >FT SYS,FF +LAST.FILE.TYPE .EQ *-FILE.TYPES-1 +*-------------------------------- +* NAMES OF THE MONTHS +*-------------------------------- +MONTH.NAMES + .AS -/JFMAMJJASOND/ + .AS -/AEAPAUUUECOE/ + .AS -/NBRRYNLGPTVC/ +*-------------------------------- +NO.DATE.MSG + .AS -// +*-------------------------------- +* MLI ERROR CODES +*-------------------------------- +MLI.ERROR.CODES + .HS 282B4041424344454647 + .HS 48494B4C4D4E505356 +*-------------------------------- +* EQUIVALENT BI ERROR CODES +*-------------------------------- +BI.ERROR.CODES + .HS 0304100C0C1206068613 (86 IS A TRICK) + .HS 09110D05020A140B0C08 +*-------------------------------- +SCI.MESSAGES + .AC 0 INIT NYBBLE.FLAG + .AC 1"ACDEFILNOPRST %" + .AC 2"BGHKMUVWXY/():." + .AC 3"QZ-4567890123@&" +Q.BLOCKS.ABOVE .EQ 0 + .AC / BLOCKS SHOWN ABOVE:6%/ +*-------------------------------- +Q.DIRHDR .EQ 1 + .AC /TYPE NAME2BLOCKS MODIFIED9CREATED9ENDFILE AUXTYPE%/ +*-------------------------------- + .AC /RANGE ERROR%/ + .AC /NO DEVICE CONNECTED%/ + .AC /WRITE PROTECTED%/ + .AC /END OF DATA%/ + .AC /PATH NOT FOUND%/ +*-------------------------------- +Q.BLOCKS .EQ 7 + .AC / VOLUME BLOCKS USED:8FREE:8TOTAL:5%/ +*-------------------------------- + .AC "I/O ERROR%" + .AC /DISK FULL%/ + .AC /FILE LOCKED%/ + .AC /INVALID PARAMETER%/ + .AC /NO BUFFERS AVAILABLE%/ + .AC /FILE TYPE MISMATCH%/ + .AC /PROGRAM TOO LARGE%/ + .AC /NOT DIRECT COMMAND%/ + .AC /SYNTAX ERROR%/ + .AC /DIRECTORY FULL%/ + .AC /FILE NOT OPEN%/ + .AC /DUPLICATE FILE NAME%/ + .AC /FILE BUSY%/ + .AC /FILE(S) STILL OPEN%/ +*-------------------------------- + .AC "%" +*ZZ.MESSAGES .EQ *-MESSAGES +*-------------------------------- +SCI.FIRST.TABLE .EQ * + .HS 00 + .AS -"ACDEFILNOPRST " + .HS 8D +SCI.SECOND.TABLE .EQ * + .HS 00 + .AS -"BGHKMUVWXY/():." +SCI.THIRD.TABLE .EQ * + .AS -"JQZ-" + .HS 05.06.07.08.09.0A.0B.0C.0D.0E.0F.10 (BLANK COUNTS+1) +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/sci.s.tables +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/SCI.S.VARS.txt b/SCMASM.30/SCI.S.VARS.txt new file mode 100644 index 00000000..336c7f7d --- /dev/null +++ b/SCMASM.30/SCI.S.VARS.txt @@ -0,0 +1,53 @@ +NEW + AUTO 3,1 +*-------------------------------------- +ALLOCATED.BUFFER.PAGE .BS 1 +*-------------------------------- +FNLEN .BS 1 +RECORD.LENGTH .BS 2 +PARM.LENM1 .BS 1 +PARM.OFFSET .BS 1 +ACCUM .BS 3 +OVERFLOW .BS 1 +COMMAND.ADDR .BS 2 +BLOCKS .BS 2 +*-------------------------------- +MONTH .BS 1 +DAY .BS 1 +YEAR .BS 1 +*-------------------------------- +CAT.WIDTH .BS 1 +ENTRY.LENGTH .BS 1 +ENTRIES.PER.BLOCK .BS 1 +FILE.COUNT .BS 2 +ENTRY.COUNTER .BS 1 +*-------------------------------- +CAT.INDEX .BS 1 +*-------------------------------- +FILE.REFNUMS .BS 2 +FILE.BUFFER.PNTRS .BS 2 +*-------------------------------- +EXEC.REFNUM .BS 1 +EXEC.INPUT.CHAR .BS 1 +*-------------------------------- +WRITE.REFNUM .BS 1 +WRITE.OUTPUT.CHAR .BS 1 +*-------------------------------- +PATHNAME.ONE.BUFFER .BS 1 +TXTBUF .BS 65 +*-------------------------------- +* OPEN FILE NAME BUFFERS +* 3 BUFFERS, 32 BYTES EACH +* 0 -- # BYTES IN FILE NAME (bits (6-0) +* Bit 7 = DIR file READ flag +* 1 -- L value lsb +* 2 -- L value msb +* 3-31 -- file name, backwards +*-------------------------------- +OPEN.FILE.NAME.BUFFERS + .BS 32*3 +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/sci.s.vars +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/SCMASM.S.ACDIR.txt b/SCMASM.30/SCMASM.S.ACDIR.txt new file mode 100644 index 00000000..315cdd24 --- /dev/null +++ b/SCMASM.30/SCMASM.S.ACDIR.txt @@ -0,0 +1,103 @@ +NEW + AUTO 3,1 +*-------------------------------------- +TABLE1 .EQ $BE00-48 +TABLE2 .EQ $BE00-32 +TABLE3 .EQ $BE00-16 +*-------------------------------- +DIR.AC + JSR GNNB GET NEXT NON-BLANK FOR DELIMITER + BCS .8 ...ERROR + STA DLIM IN CASE IT IS A DELIMITER + EOR #'0' + BEQ .9 ...INITIAL STRING + CMP #4 + BCC .10 +*---GET NEXT CHAR OF STRING------ +.2 JSR GNC GET NEXT CHAR TO ENCODE + BCS .8 ...ERROR + CMP DLIM + BEQ .7 ...END OF STRING +*---SEARCH TABLE 1--------------- + LDY #15 +.3 CMP TABLE1,Y + BEQ .6 ...FOUND IT + DEY + BNE .3 +*---SEARCH TABLE 2--------------- + JSR OUTPUT.NYBBLE.Y + LDY #15 +.4 CMP TABLE2,Y + BEQ .6 ...FOUND IT + DEY + BNE .4 +*---SEARCH TABLE 3--------------- + JSR OUTPUT.NYBBLE.Y + LDY #15 +.5 CMP TABLE3,Y + BEQ .6 ...FOUND IT + DEY + BNE .5 +*---NOT IN ANY TABLE------------- + JSR OUTPUT.NYBBLE.Y + PHA + LSR + LSR + LSR + LSR + TAY + JSR OUTPUT.NYBBLE.Y + PLA + AND #$0F + TAY +*---OUTPUT TABLE INDEX----------- +.6 JSR OUTPUT.NYBBLE.Y +*---NEXT CHAR-------------------- + JMP .2 +*---END OF STRING---------------- +.9 STA NYBBLE.FLAG +.7 RTS +*---ERROR------------------------ +.8 JMP ERBA +*---READ NEW CODING TABLES------- +.10 SBC #0 CHANGE TO 0,1,2 + ASL *16 + ASL + ASL + ASL + TAX + JSR GNC + BCS .7 ...NO STRING + STA DLIM +.11 JSR GNC ...ALLOW LOWER CASE + BCS .8 ...ERROR + CMP DLIM + BEQ .7 ...END OF STRING + INX + CPX #48 + BCS .8 ...GONE TOO FAR + STA TABLE1,X + BCC .11 ...ALWAYS +*-------------------------------- +OUTPUT.NYBBLE.Y + PHA SAVE A-REG + TYA + LSR NYBBLE.FLAG + BCS .1 ...IT WAS = $01 + ASL ...IT WAS = $00 + ASL + ASL + ASL + STA BYTE + INC NYBBLE.FLAG + PLA + RTS +.1 ORA BYTE + JSR EMIT + PLA + RTS +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/scmasm.s.acdir +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/SCMASM.S.ASMGEN.txt b/SCMASM.30/SCMASM.S.ASMGEN.txt new file mode 100644 index 00000000..af3afc2b --- /dev/null +++ b/SCMASM.30/SCMASM.S.ASMGEN.txt @@ -0,0 +1,369 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* ASSEMBLER MAIN DRIVER +*-------------------------------- +ASM +* LDX #0 X=0 FROM COMMAND DISPATCHER + STX PASS SET TO PASS 1 + STX ERROR.COUNT + STX ERROR.COUNT+1 +* STX MACRO.LEVEL ALREADY DONE IN GNL +* STX PARAM.PNTR ALREADY DONE IN GNL +* STX PAGE.LENGTH ALREADY DONE IN GNL + STX PAGE.NUMBER + STX PAGE.NUMBER+1 + JSR STINIT INITIALIZE SYMBOL TABLE + JSR RESTORE IF IN INCLUDE, RESTORE +*-------------------------------- +* PERFORM NEXT PASS OF ASSEMBLY +*-------------------------------- +ASM1 LDA ERROR.COUNT + ORA ERROR.COUNT+1 + BEQ .1 + JMP ASM.END PRINT # ERRORS AND ABORT ASSEMBLY +.1 LDX #1 INIT 2-BYTE VARIABLES +.2 LDA PP,X POINT TO BEGINNING OF SOURCE PROGRAM + STA SRCP,X + STA MACSTK,X + LDA #0 + STA CALL.CNTR,X TOTAL # MACRO CALLS + STA CALL.NUM,X CURRENT MACRO CALL # + STA ORGN+2,X HIGH 16 OF ORIGIN + DEX + BPL .2 +*---Following = $FF-------------- + STX DO.STACK SET OUTER LEVEL TRUE (=$FF) + STX LF.CONDITIONAL do not list false sets (=$FF) +*---Following = $00-------------- + STA DUMMY.FLAG NOT IN DUMMY SECTION + STA PHASE.FLAG NOT IN PHASE + STA DO.INDEX SET DO.STACK TO EMPTY + STA LF.ALL turn on main listing + STA LF.MACRO list macro expansions too + STA LF.XTRA.BYTES list all bytes, use extra lines + STA TF.FLAG not in ".TF" + STA DO.SKIP.CNT not in ".DO" + STA FLAG.MA not in ".MA" + STA NYBBLE.FLAG .AC odd/even + STA ORGN ORIGIN = $0800 + STA TRGT TARGET = $0800 +*---Following = $08-------------- + LDA #$08 + STA ORGN+1 + STA TRGT+1 + JSR ASM.INIT Initialize for particular assembler +*-------------------------------- +* MOVE NEXT LINE INTO WORKING BUFFER +*-------------------------------- +ASM2 LDA $C000 CHECK FOR ABORT WITHOUT + CMP #CHR.RETURN CLEARING STROBE + BNE .1 + JMP JMP.SOFT YES, STOP RIGHT NOW +.1 LDX #$FF INITIALIZE STACK POINTER + TXS + INX MAKE X=0 + STX EMIT.COLUMN + STX EXP.UNDEF CLEAR UNDEFINED FLAG + JSR SETUP.NEXT.LINE + BCC .2 GOT A LINE + JMP ENDM NO MORE LINES, ACT LIKE .EN FOUND +*---CHECK CURRENT CONDITION------ +.2 LDA DO.STACK CURRENT LEVEL IN SIGN BIT + BMI ASSEMBLE.ONE.LINE TRUE, SO ASSEMBLE +*-------------------------------- +* SKIP TO .FIN OR .ELSE +*-------------------------------- +SKIP.TO.FIN + JSR SCAN.TO.OPCODE + BCS .3 + LDX #DIR.QT.DO + JSR DIR.SCAN.OR.FAIL + BCC .1 NOT .DO + INC DO.SKIP.CNT .DO + BNE .3 ...ALWAYS +.1 LDY DO.SKIP.CNT + BNE .2 INSIDE A NESTED .DO, IGNORE .ELSE'S + JSR DIR.SCAN.OR.FAIL + BCS ASSEMBLE.ONE.LINE FOUND .ELSE +.2 LDX #DIR.QT.FI + JSR DIR.SCAN.OR.FAIL + BCC .3 NOT .FIN + LDY DO.SKIP.CNT .FIN, SEE IF NESTED ONE + BEQ ASSEMBLE.ONE.LINE NO, ASSEMBLE THIS .FIN + DEC DO.SKIP.CNT YES, POP OFF THIS NEST +.3 BIT LF.CONDITIONAL LIST CONDITIONAL LINES? + BMI ASM2 NO, SKIP IT + JSR CRLF.IF.LISTING YES, NEW LINE + JMP CMNT AND LIST IT +*-------------------------------- +* ANALYZE SOURCE LINE +*-------------------------------- +ASSEMBLE.ONE.LINE + JSR CRLF.IF.LISTING + JSR PACK.MACRO.LINE + BCS CMNT ...only list if MACRO definition line + JSR GNC.UC.START not MACRO line, get first char + BCS CMNT ...empty line + BEQ .3 ...blank, so no label + JSR CHECK.COMMENT.CHAR + BEQ CMNT ...comment (* or ;) + JSR LABL PROCESS LABEL DEFINITION +.3 JSR GNNB Scan to opcode field + BCS CMNT ...none, only label on this line + JSR CHECK.COMMENT.CHAR might be a comment with no opcode + BEQ CMNT ...yes, there is a comment + CMP #'> CHECK IF MACRO OPCODE + BEQ .4 ...YES + CMP #'_ CHECK IF MACRO OPCODE + BEQ .4 ...YES + CMP #'=' + BEQ .5 '=' is synonym for .EQ + STA SEARCH.KEY FIRST OPCODE CHAR + JSR GNC.UC + STA SEARCH.KEY+1 2ND OPCODE CHAR + JSR GNC.UC + STA SEARCH.KEY+2 3RD OPCODE CHAR + LDA SEARCH.KEY + CMP #'. IS IT A DIRECTIVE? + BNE .6 NO, TRY NORMAL OPCODES + LDA #OPTBL.DIR + LDY /OPTBL.DIR + CLC INITIAL SEARCH + JSR SEARCH.COMPRESSED.TABLE + BCC OPER ...NOT FOUND IN TABLE + JSR PERFORM.DIRECTIVE + JMP CMNT +.4 JMP MACRO.CALL +.5 JSR PSEQ "=" is synonym for .EQ + JMP CMNT +.6 JSR ASM.PARTICULAR +*-------------------------------- +CMNT LDA EXP.UNDEF + BPL .1 NO UNDEFINED EXPRESSIONS ON THIS LINE + LDA PASS + BEQ .1 IF WE GOT THIS FAR, OKAY IN PASS 1 + JMP UNDF +.1 JSR LIST.SOURCE.IF.LISTING + JMP ASM2 NEXT LINE +*-------------------------------- +*-------------------------------- +PERFORM.DIRECTIVE + INY POINT AT HIGH BYTE OF ADDRESS + LDA (OPTBL.PNTR),Y + PHA + DEY + LDA (OPTBL.PNTR),Y + PHA + RTS +*-------------------------------- +OPER LDY #QER2 ERROR--BAD OPCODE + JMP SOFT.ERROR +*-------------------------------- +* EMIT ONE BYTE OF OBJECT CODE +* +* IF IN PASS TWO THEN +* ! IF LISTING THEN +* ! IF IN ".TF" THEN +* ! ! +* ! ELSE IF NOT IN DUMMY SECTION THEN +* ! ! ! IF IN PROTECTED AREA THEN +* ! ! ! ! +* ! ! ! ELSE +* INCREMENT ORIGIN AND ORIGIN.SAVE +* IF NOT IN DUMMY SECTION THEN INCREMENT TARGET +*-------------------------------- +EMIT.ZERO + LDA #0 +EMIT LDY PASS CHECK WHICH PASS + BEQ .5 PASS 1, JUST INCREMENT LOCATION + STA OBJ.BYTE SAVE OBJECT BYTE +*---LIST THE BYTE---------------- + JSR P.EMITTED.BYTE +*---STORE THE BYTE--------------- + BIT DUMMY.FLAG No output inside dummy section + BMI .6 ...only increment the origin + LDA OBJ.BYTE GET OUTPUT BYTE + BIT TF.FLAG SEE IF IN ".TF" + BMI .4 YES + JSR USER.OBJECT.BYTE + JMP .5 ...ALWAYS +.4 JSR DOUT WRITE ON TARGET FILE +*---INCREMENT LOCATION----------- +.5 LDA DUMMY.FLAG IF IN DUMMY SECTION, + BMI .6 THEN ONLY INCREMENT ORGN + >INCD TRGT BUMP TARGET ADDRESS + >INCD ORIGIN.SAVE AND ORIGIN OUTSIDE .PH +.6 >INCD ORGN BUMP CURRENT ORIGIN + RTS +*-------------------------------- +STORE.OBJECT.BYTE + LDA TRGT+1 TARGET PAGE + BNE .1 NOT PAGE ZERO + LDA TRGT ALLOW $00-$1E + CMP #$1F + BCC .4 SAFE + BCS .3 NOT SAFE +*---ALLOW $300-$3CF-------------- +.1 CMP #$03 IN PAGE 3? + BNE .2 NO + LDA TRGT BELOW $3D0? + CMP #$D0 + BCC .4 YES, SAFE + BCS .3 NO, NOT SAFE + .DO AUXMEM +*---ALLOW $800-MACSTK------------ +.2 CMP #$08 BELOW PAGE 8? + BCC .3 YES, NOT SAFE + LDA TRGT + CMP MACSTK + LDA TRGT+1 + SBC MACSTK+1 + BCC .4 BELOW MACSTK, SAFE + .ELSE +*---ALLOW $800-MACLBL------------ +.2 CMP #$08 BELOW PAGE 8? + BCC .3 YES, NOT SAFE + LDA TRGT NO, COMPARE TO MACLBL + CMP MACLBL + LDA TRGT+1 + SBC MACLBL+1 + BCC .4 BELOW MACLBL, SO SAFE +*---ALLOW EOT-MACSTK------------- + LDA EOT + CMP TRGT + LDA EOT+1 + SBC TRGT+1 + BCS .3 BELOW EOT, NOT SAFE + LDA TRGT + CMP MACSTK + LDA TRGT+1 + SBC MACSTK+1 + BCC .4 BELOW MACSTK, SAFE + .FIN +*---NOT SAFE, CHECK USER RANGE--- +.3 LDA TRGT + CMP USER.MEM.LO + LDA TRGT+1 + SBC USER.MEM.LO+1 + BCC .5 DEFINITELY OUT OF BOUNDS + LDA USER.MEM.HI + CMP TRGT + LDA USER.MEM.HI+1 + SBC TRGT+1 + BCC .5 DEFINITELY OUT OF BOUNDS +.4 LDY #0 + LDA OBJ.BYTE + STA (TRGT),Y + RTS +.5 LDY #QMEMPRO + JMP FIRM.ERROR +*-------------------------------- +* LIST SOURCE LINE +*-------------------------------- +LIST.SOURCE.IF.LISTING + JSR CHECK.IF.LISTING +LIST.SOURCE.REGARDLESS + JSR P.MARGIN PRINT BLANKS TILL MARGIN +LIST.SOURCE.AT.MARGIN + JSR CONVERT.LINE.NUMBER.PRINT + LDY MACRO.LEVEL + BEQ .2 + LDA #'>' +.1 JSR CHO + DEY + BNE .1 ...UNTIL Y=0 +.2 LDA #' ' ...NOW Y=0 +.3 JSR CHO + INY + LDA WBUF-1,Y + BNE .3 + RTS +*-------------------------------- +* PRINT CRLF IF IN PASS 2 AND IF LISTING IS ON +*-------------------------------- +CRLF.CAUSED.FORM.FEED + JSR FORM.FEED +CRLF.IF.LISTING + JSR CHECK.IF.LISTING +CRLF.WITH.PAGING + JSR CRLF + INC LINE.COUNT + LDA PAGE.LENGTH + BEQ .1 ...NOT TITLING + CMP LINE.COUNT + BCC CRLF.CAUSED.FORM.FEED ...END OF PAGE +.1 RTS +*-------------------------------- +* PROCESS LABEL DEFINITION +*-------------------------------- +LABL JSR PACK PACK AND CHECK SYMBOL + BCC ERR.BS BAD SYMBOL + JSR STSRCH SEE IF DEFINED + BCC ERR.DD YES, DOUBLE DEFINITION + JMP STADD ADD TO SYMBOL TABLE +*-------------------------------- +ERR.DD LDY PASS ERROR IN PASS 1 + BEQ ERR.DBLDF OK IN PASS 2 + LDY #6 SET FLAG FOR TESTING FWD REFS + >SYM LDA,STPNTR + ORA #$40 + >SYM STA,STPNTR + LDY WBUF LOOK AT COLUMN 1 + CPY #': IF PRIVATE LABEL... + BEQ .2 ...THEN DON'T UPDATE C.M.LABEL + LDA STPNTR SAVE POINTER TO THIS MAJOR LABEL + STA CURRENT.MAJOR.LABEL + LDA STPNTR+1 + STA CURRENT.MAJOR.LABEL+1 +.2 RTS +ERR.DBLDF + LDY #QER4 DOUBLE DEFN + .HS 2C SKIP 2 BYTES +ERR.BS LDY #QER7 BAD SYMBOL + JMP SOFT.ERROR +*-------------------------------- +* Search Compressed Opcode Table +* If carry clear, (Y,A) = address of table +* If carry set, continue searching same table +* +* Return with carry set if found, else carry clear. +* (OPTBL.PNTR),Y points at 16-bit value +* of entry which matched. +*-------------------------------- +SEARCH.COMPRESSED.TABLE + BCS .6 ...Continue searching same table + STA OPTBL.PNTR + STY OPTBL.PNTR+1 +*---Try matching 2nd letter------ + LDY #0 +.1 LDA (OPTBL.PNTR),Y Possible match + ORA #$40 Make it ASCII + CMP SEARCH.KEY+1 same as 2nd letter? + BEQ .6 ...yes, matched. + BNE .3 ...no +*---Scan to next 8-bit entry----- +.2 INY + INY +.3 INY + LDA (OPTBL.PNTR),Y + BMI .2 ...another 24-bit entry + ASL check if beyond our sub-group + BPL .1 ...no, valid 2nd letter option +.4 CLC ...no match in table, carry clear + RTS +*---Try matching 3rd letter------ +.5 INY +.6 INY + LDA (OPTBL.PNTR),Y + BPL .4 ...no more options, not in table + INY point at data + EOR #$C0 make like ASCII + CMP SEARCH.KEY+2 compare to 3rd letter + BNE .5 ...did not match, try another + RTS ...found it, return carry set +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/scmasm.s.asmgen +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/SCMASM.S.ASMNL.txt b/SCMASM.30/SCMASM.S.ASMNL.txt new file mode 100644 index 00000000..044f416f --- /dev/null +++ b/SCMASM.30/SCMASM.S.ASMNL.txt @@ -0,0 +1,114 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* SET UP NEXT LINE TO ASSEMBLE +*-------------------------------- +SETUP.NEXT.LINE +.1 BIT INFLAG + BVS .5 ...INSIDE .INBx + LDA SRCP CHECK IF AT END + CMP HI.MEM TOP OF SOURCE CODE + LDA SRCP+1 + SBC HI.MEM+1 + BCS .7 RETURN WITH CARRY SET +.5 LDA MACRO.LEVEL IN SKELETON OR BODY? + BEQ .2 BODY + LDY #0 SEE IF END OF SKELETON + >SYM LDA,SRCP + BNE .3 NO, STILL IN SKELETON + LDA (MACSTK),Y POP SKELETON OFF MACRO STACK + STA CALL.NUM+1 + INY + LDA (MACSTK),Y + STA CALL.NUM + INY + LDA (MACSTK),Y + STA LF.ALL Real value of listing option + INY + LDA (MACSTK),Y + STA SRCP+1 + INY + LDA (MACSTK),Y + STA SRCP + INY + LDA (MACSTK),Y (HIGH BYTE) + PHA + INY + LDA (MACSTK),Y (LOW BYTE) + STA MACSTK + PLA + STA MACSTK+1 + DEC MACRO.LEVEL + JMP .1 +*-------------------------------- +.2 JSR GET.LINE.NUMBER BODY +.3 LDX #0 +.4 JSR GET.NEXT.SOURCE.CHAR + BEQ .6 END OF LINE + STA WBUF,X PUT INTO WORKING BUFFER + INX + BNE .4 ...ALWAYS +.6 STA WBUF,X PUT ZERO ON END + CLC RETURN WITH CARRY CLEAR +.7 RTS +*-------------------------------- +* GET NEXT CHARACTER FROM SOURCE LINE +* (IF INSIDE A MACRO SKELETON, EXPAND PARAMETERS) +*-------------------------------- +GET.NEXT.SOURCE.CHAR + STX MACRO.SAVEX MUST PRESERVE X-REGISTER + LDY PARAM.PNTR + BNE .1 PRESENTLY EXPANDING A PARAMETER + LDA MACRO.LEVEL IN A SKELETON? + BNE .2 YES + JMP NTKN NO +*-------------------------------- +.1 INC PARAM.PNTR + LDA (MACSTK),Y + BNE .8 ...NORMAL CHAR + STA PARAM.PNTR ...END OF PARAMETER +.2 JSR NTKN + BEQ .8 END OF LINE + CMP #$7F PARAMETER? + BNE .8 NO, NORMAL CHAR +*---MACRO PARAMETER-------------- + JSR NTKN YES, GET PARAM # + LDY #6 + CMP #'# ]# RETURNS NUMBER OF PARAMETERS (0-9) + BEQ .5 ...FOUND ]# + SEC + SBC #'1' CHANGE "1"..."9" TO 0...8 + BEQ .4 ...]1 + TAX ...]2 THRU ]9 +.3 INY + LDA (MACSTK),Y SKIP OVER A PARAMETER + BNE .3 + DEX + BNE .3 +.4 INY + STY PARAM.PNTR + BNE .1 ...ALWAYS +*---NUMBER OF PARAMETERS--------- +.5 CLC + LDA (MACSTK),Y + SBC MACSTK + TAY + LDX #10 +.6 LDA (MACSTK),Y + BNE .7 + DEX + DEY + CPY #7 + BCS .6 + LDX #0 +.7 TXA + ORA #$30 +*-------------------------------- +.8 LDX MACRO.SAVEX RESTORE X-REG + CMP #0 SET "EQ" STATUS IF END OF LINE + RTS +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/scmasm.s.asmnl +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/SCMASM.S.DATA.txt b/SCMASM.30/SCMASM.S.DATA.txt new file mode 100644 index 00000000..f0738c5d --- /dev/null +++ b/SCMASM.30/SCMASM.S.DATA.txt @@ -0,0 +1,241 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* PAGE ZERO VARIABLES +*-------------------------------- +* $00 THRU $1F RESERVED FOR USER +*---Apple Monitor, mostly-------- +MON.WIDTH .EQ $21 +CH80 .EQ $57B +CH .EQ $24 +CV .EQ $25 +BASL .EQ $28 +YSAVE .EQ $2F +ESCAPE.FLAG .EQ $30 +MON.MODE .EQ $31 +MON.INVFLG .EQ $32 +MON.YSAV .EQ $34 +HOOK.OUT .EQ $36,37 +HOOK.IN .EQ $38,39 +A0L .EQ $3A +A0H .EQ $3B +A1L .EQ $3C +A1H .EQ $3D +A2L .EQ $3E +A2H .EQ $3F +*-------------------------------- +* ProDOS USES $40-4F +*-------------------------------- +A3L .EQ $40 +A3H .EQ $41 +A4L .EQ $42 +A4H .EQ $43 +*-------------------------------- + .DUMMY + .OR $50 +*-------------------------------- +* +* Following needed at all times +* +*-------------------------------- +SCREEN.WIDTH .BS 1 +INFLAG .BS 1 +LO.MEM .BS 2 START OF SYMBOL TABLE +EOT .BS 2 END OF SYMBOL TABLE +PP .BS 2 START OF SOURCE PROGRAM +HI.MEM .BS 2 END OF SOURCE CODE +*-------------------------------- +PAGE.NUMBER .BS 2 +PAGE.LENGTH .BS 1 =0 means no titles +LINE.COUNT .BS 1 +DGTCNT .BS 1 +INCREMENT.VALUE .BS 2 FOR AUTO-LINE-NUMBERING (INIT=10) +CURLNO .BS 2 NUMBER OF LAST-SUBMITTED LINE (INIT=990) +PASS .BS 1 PASS NUMBER (0=PASS 1, 1=PASS 2) +CHAR.PNTR .BS 1 +CURRENT.CHAR .BS 1 CURRENT CHARACTER FROM 'GNC' +CURRENT.MAJOR.LABEL .BS 2 PNTR TO CURRENT MAJOR LABEL +EXP.NEW .BS 1 NEW EXPRESSION FLAG +STPNTR .BS 2 SYMBOL TABLE WORKING POINTER +TPTR .BS 2 SYMBOL TABLE TEMP POINTER +BASE.INDEX .BS 1 used in EXPR +LC.MODE .BS 1 +EXP.VALUE .BS 4 +EXP.VALUE64 .BS 4 +SYM.VALUE .BS 4 +EXP.UNDEF .BS 1 UNDEFINED TERM FLAG +EMIT.COLUMN .BS 1 KEEPS TRACK OF COLUMN FOR EMIT +ORGN .BS 4 +RPTCHR .BS 1 (NML, NTKN) +RPTCNT .BS 1 (NML, NTKN) +PNTR .BS 2 SEARCH STRING PNTR +INSAVE .BS 8 +*-------------------------------- +CALL.NUM .BS 2 CURRENT MACRO CALL NUMBER +MACLBL .BS 2 +CONV.CTRL .BS 1 CONTROL FLAG INSIDE CONVERT.LINE.NUMBER +MACRO.LEVEL .BS 1 +PARAM.PNTR .BS 1 +PARAM.CNT .BS 1 +*-------------------------------- +PROMPT.FLAG .BS 1 NULL, "H", OR "I" +HIDE.HIMEM .BS 2 SAVES HIMEM DURING "HIDE" +CURRENT.LINE.NUMBER .BS 2 +LF.ALL .BS 1 =0 TO LIST, <0 TO NOT LIST +LF.MACRO .BS 1 =0 TO LIST MACRO EXPANSIONS +FLAG.SPEED .BS 1 +DLIM .BS 1 ".AS" DELIMITER, also ASM +SRCP .BS 2 POINTER TO CURRENT SOURCE LINE +ENDP .BS 2 POINTER TO END OF LINE RANGE +EXP.FWDREF .BS 1 +AUTOLN.FLAG .BS 1 +=MANUAL, -=AUTO LINE NUMBERS +LINE.START .BS 2 +LINE.END .BS 2 +*-------------------------------- +ZP.COMMON .EQ * +*-------------------------------- +* +* Variables used only during SPECIFIC commands +* +*-------------------------------- +BLKSIZ .BS 1 used in MOVE.TEXT.UP and MOVE.TEXT.DOWN +MOVE.DISTANCE .BS 2 used in NML, COPY, and MOVE.TEXT.UP +AUTO.FLAG .BS 1 +=VERIFY, -=AUTO REPLACE +CHANGE.CNT .BS 1 # OF REPLACEMENTS IN THIS LINE +ED.FCOL .BS 1 +ED.FKEY .BS 1 +ED.PNTR .BS 1 +ED.BEGLIN .BS 1 +TEXT.OPTIONS .BS 1 used in TEXT command only +REPLACE.LENGTH .BS 1 +SOURCE.LENGTH .BS 1 +WBUF.LENGTH .BS 1 +KEY.PNTR .BS 2 USED IN FIND, REPLACE +BUF.PNTR .BS 2 USED IN FIND, REPLACE +KEY.ADDR .BS 2 SEARCH KEY ADDRESS +MATCH.END .BS 1 +LC.FLAG .BS 1 +=AS IS, -=ACCEPT BOTH CASES +*-------------------------------- + .OR ZP.COMMON +*-------------------------------- +* +* Variables used only during Assembly +* +*-------------------------------- +SEARCH.KEY .BS 3 USED BY OPCODE SEARCH ROUTINE +OPTBL.PNTR .BS 2 USED BY OPCODE SEARCH ROUTINE +DO.INDEX .BS 1 DO level: =0 if empty, else 1-63 +DO.STACK .BS 8 64 bits, =1 if true +DO.SKIP.CNT .BS 1 COUNTS .DO NESTS WHEN SKIPPING +NYBBLE.FLAG .BS 1 .AC DIRECTIVE +BYTE .BS 1 .AC DIRECTIVE +PHASE.FLAG .BS 1 +=NORMAL, -=IN PHASE +DUMMY.FLAG .BS 1 +=NORMAL, -=IN DUMMY SECTION +TF.FLAG .BS 1 +TRGT .BS 2 TARGET ADDRESS +MACSTK .BS 2 MACRO STACK POINTER +ERROR.COUNT .BS 2 +*-------------------------------- +OBJ.BYTE .BS 1 +ADDR.LENGTH .BS 1 +LF.CONDITIONAL .BS 1 =0 TO LIST FALSE SETS +LF.XTRA.BYTES .BS 1 =0 TO LIST XTRA BYTES ON XTRA LINES +EMIT.MARGIN .BS 1 COLUMN FOR LINE NUMBER TO START IN +MACRO.SAVEX .BS 1 +DUMMY.ORGN .BS 4 +ORIGIN.SAVE .BS 4 +FLAG.MA .BS 1 +CALL.CNTR .BS 2 TOTAL # OF MACRO CALLS +*-------------------------------- +*---ONLY IN .BS DIRECTIVE-------- +BS.COUNT .BS 2 # BYTES TO RESERVE +*---ONLY IN .AS & .AT DIRECTIVES +AS.HIBIT .BS 1 BIT 7 VALUE FOR .AS/.AT +AT.HIBIT .BS 1 BIT 7 TOGGLE FOR LAST BYTE BIT 7 +*-------------------------------- +* +*---$EB reserved for ECHO TEXTALKER software--- +* +*---$F0-FF reserved for ASM.PARTICULAR--- +* +*-------------------------------- + .ED +*-------------------------------- +* CHARACTER CODES +*-------------------------------- +CHR.CTRL.I .EQ $89 +CHR.RETURN .EQ $8D +CHR.BLANK .EQ $A0 +CHR.DOLLAR .EQ $A4 +CHR.STAR .EQ $AA +CHR.DASH .EQ $AD +CHR.PERIOD .EQ $2E +CHR.BSLASH .EQ $DC +*-------------------------------- +* MISCELLANEOUS SYMBOLS +*-------------------------------- +SYMBOL .EQ $0100 SYMBOL PACK AREA +HSHTBL .EQ $0130 HASH POINTER TABLE +KBUF .EQ $0170 - $01BF KEY STRING +WBUF .EQ $0200 WORKING BUFFER +WBUF.MAX .EQ 248 AND ITS LENGTH +PATHNAME .EQ $2CE (LAST 50 BYTES) +*-------------------------------- +* ROM-BASED ROUTINES +*-------------------------------- +MON.PRNTAX .EQ $F941 +MON.PRBL2 .EQ $F94A PRINT (X) BLANKS +MON.INIT .EQ $FB2F TEXT MODE, FULL WINDOW +MON.ADVANC .EQ $FBF4 +MON.BS .EQ $FC10 +MON.UP .EQ $FC1A +MON.VTAB .EQ $FC22 +MON.CLREOP .EQ $FC42 +MON.HOME .EQ $FC58 +MON.LF .EQ $FC66 +MON.CLREOL .EQ $FC9C +MON.DELAY .EQ $FCA8 +MON.RDKEY .EQ $FD0C READ NEXT CHAR +MON.READCH .EQ $FD18 +MON.PHEX .EQ $FDDA PRINT BYTE IN HEX +MON.COUT .EQ $FDED +MON.BL1 .EQ $FE00 +MON.SETKBD .EQ $FE89 +MON.SETVID .EQ $FE93 +MON.OUTPORT .EQ $FE95 SET NEW PR#N OUTPUT +MON.BELL .EQ $FF3A RING THE BELL +MON.RTS .EQ $FF58 ONLY AN "RTS" +MNTR .EQ $FF69 CALL-151 ENTRY INTO MONITOR +MON.GETNUM .EQ $FFA7 +MON.TOSUB .EQ $FFBE +MON.CHRTBL .EQ $FFCC MONITOR COMMAND CHAR TABLE +*-------------------------------- +MON.RESET .EQ $3F2 THRU 3F4 +*-------------------------------- + .MA INCD + INC ]1 + BNE :1 + INC ]1+1 +:1 + .EM +*-------------------------------- +RDMAIN .EQ $C002 +RDAUX .EQ $C003 +RDROM .EQ $C082 +RDRAM .EQ $C083 +WRMAIN .EQ $C004 +WRAUX .EQ $C005 +AUX.CODE .EQ $DF00 +*-------------------------------- + .MA SYM + .DO AUXMEM + JSR ]1.]2 + .ELSE + ]1 (]2),Y + .FIN + .EM +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/scmasm.s.data +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/SCMASM.S.DIR1.txt b/SCMASM.30/SCMASM.S.DIR1.txt new file mode 100644 index 00000000..685034a0 --- /dev/null +++ b/SCMASM.30/SCMASM.S.DIR1.txt @@ -0,0 +1,308 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* DIRECTIVES +*-------------------------------- +* .DUMMY -- START DUMMY SECTION +*-------------------------------- +D.DUMMY + LDA DUMMY.FLAG DO NOTHING IF ALREADY IN DUMMY + BMI .2 + LDX #3 +.1 LDA ORGN,X + STA DUMMY.ORGN,X + DEX + BPL .1 + STX DUMMY.FLAG SET FLAG NEGATIVE +.2 RTS +*-------------------------------- +* .ED -- END DUMMY SECTION +*-------------------------------- +D.END.DUMMY + LDA DUMMY.FLAG + BPL .2 DO NOTHING IF NOT IN .DUMMY + LDX #3 + STX DUMMY.FLAG SET FLAG POSITIVE +.1 LDA DUMMY.ORGN,X + STA ORGN,X + DEX + BPL .1 +.2 RTS RETURN TO MAIN LEVEL OF ASM +*--------------------------------- +* .PH -- START PHASE +*-------------------------------- +D.PHASE + JSR D.END.PHASE + JSR EXPR.DEFINED GET PHASE ORIGIN + LDX #3 +.1 LDA ORGN,X SAVE ORIGIN + STA ORIGIN.SAVE,X + LDA EXP.VALUE,X + STA ORGN,X SET PHASE ORIGIN + DEX + BPL .1 + SEC SET FLAG TO $80 + ROR PHASE.FLAG + RTS RETURN TO MAIN LEVEL OF ASM +*-------------------------------- +* .EP -- END PHASE +*-------------------------------- +D.END.PHASE + ASL PHASE.FLAG TEST AND CLEAR FLAG + BCC .2 IT WAS ALREADY CLEAR + LDX #3 +.1 LDA ORIGIN.SAVE,X + STA ORGN,X + DEX + BPL .1 +.2 RTS +*--------------------------------- +* .OR -- SET ORIGIN +*--------------------------------- +PSOR JSR EXPR.DEFINED GET ORIGIN VALUE + LDX #3 +.1 LDA EXP.VALUE,X STORE IT IN + STA ORGN,X LOCATION + DEX COUNTER + BPL .1 + LDA DUMMY.FLAG IF IN DUMMY SECTION, DON'T + BMI RTS.1 ...IN DUMMY +NEW.TARGET + JSR TFEND END .TF IF DOING ONE + LDA EXP.VALUE STORE VALUE IN + STA TRGT TARGET ADDRESS + LDA EXP.VALUE+1 + STA TRGT+1 +RTS.1 RTS +*--------------------------------- +* .TA -- SET TARGET ADDRESS +*--------------------------------- +PSTA JSR EXPR.DEFINED GET EXPR VALUE + LDA EXP.VALUE+2 + ORA EXP.VALUE+3 + BEQ NEW.TARGET + JMP RAER +*-------------------------------- +* .AT -- ASCII STRING WITH LAST BYTE FLAGGED +* .AS -- ASCII STRING WITH ALL BYTES SAME +* .AZ -- Same as .AS, but with 00 terminator byte. +*-------------------------------- +PSAZ JSR PSAS + JMP EMIT.ZERO +PSAT LDA #$80 LAST BYTE HAS OPPOSITE BIT 7 + .HS 2C ...SKIP OVER 2 BYTES +PSAS LDA #0 ALL BYTES GET SAME BIT 7 + STA AT.HIBIT + JSR GNNB Scan to next non-blank + BCS ERBA2 END OF LINE + DEC CHAR.PNTR BACK UP +.1 JSR TRY.HEX.STRING + BEQ .5 ...END OF LINE + LDY #0 + STY AS.HIBIT ...assume hibit is 0 + CMP #'-' 1ST NON-BLANK A MINUS? + BNE .15 ...no, hibit is 0 + ROR AS.HIBIT ...yes, hibit is 1 + JSR GNC.UC +.15 STA DLIM SAVE DELIMITER + JSR GNC.UC GET NEXT CHAR + BCS ERBA2 END OF LINE IS BAD NEWS + CMP DLIM CHK IF DELIMITER + BEQ .4 YES, NO STRING IN BETWEEN +.2 JSR GNC.UC GET NEXT CHAR + BCS ERBA2 END OF LINE IS BAD NEWS + CMP DLIM CHK IF DELIMITER + BEQ .3 YES, FINISH UP AND RETURN + LDA WBUF-2,Y ...NO, GET PREVIOUS CHAR + ORA AS.HIBIT MERGE WITH TOP BIT + JSR EMIT + JMP .2 GO FOR ANOTHER ONE +.3 LDA WBUF-2,Y GET PREVIOUS CHAR + ORA AS.HIBIT MERGE WITH SELECTED BIT 7 + EOR AT.HIBIT TOGGLE BIT 7 IF IN .AT + JSR EMIT EMIT THE BYTE +.4 JSR GNC CHECK IF MORE IN LIST + BEQ .5 + CMP #',' + BEQ .1 +.5 RTS +*--------------------------------- +* .HS -- HEX STRING +*--------------------------------- +PSHS JSR GNNB GET NEXT NON-BLANK CHAR + BCS ERBA2 END OF LINE + JSR BACKUP.CHAR.PNTR + JSR TRY.HEX.STRING + BNE ERBA2 ...ERROR, BAD ADDRESS + RTS +*-------------------------------- +THX1 JSR HEX.DIGIT GET NEXT HEX DIGIT + BCC ERBA2 ERROR, ODD DIGITS + LDA SYM.VALUE GET CONVERTED VALUE + JSR EMIT +TRY.HEX.STRING +.1 JSR HEX.DIGIT + BCS THX1 + LDA CURRENT.CHAR + BEQ .2 ...END OF LINE + CMP #',' IF COMMA, GO GET MORE BYTES + BEQ .1 ...OKAY + CMP #' ' IF BLANK, VALID END OF STRING +.2 RTS +*-------------------------------- +ERBA2 JMP ERBA ERROR: BAD ADDRESS +GT255ERR LDY #QER8 VALUE > 255 ERROR + .HS 2C LONG "BIT" TO SKIP NEXT TWO BYTES +NOLBLERR LDY #QER1 "NO LABEL" + .HS 2C LONG "BIT" TO SKIP NEXT TWO BYTES +UNDF LDY #QER6 "UNDEF" + JMP SOFT.ERROR +*--------------------------------- +* .EQ -- EQUATE +*--------------------------------- +PSEQ LDY WBUF SEE IF ANY LABEL + CPY #$20 + BEQ NOLBLERR NO LABEL ON LINE + LDA STPNTR SAVE STPNTR WHILE CALLING EXPR + PHA + LDA STPNTR+1 + PHA + JSR EXPR.DEFINED GET VALUE + PLA RESTORE STPNTR + STA STPNTR+1 + PLA + STA STPNTR + LDA PASS WHICH PASS + BNE .5 PASS 2, PRINT VALUE +*---PASS 1: DEFINE VALUE-------- + LDY WBUF COLUMN 1 AGAIN + CPY #': PRIVATE LABEL? + BCC .4 ...LOCAL LABEL + BEQ .2 ...PRIVATE LABEL +*---NORMAL LABEL----------------- + LDY #2 +.1 LDA EXP.VALUE-2,Y REDEFINE SYMBOL + >SYM STA,PNTR + INY + CPY #6 + BCC .1 + RTS +*---PRIVATE LABEL---------------- +.2 LDY #0 +.3 LDA EXP.VALUE,Y + >SYM STA,STPNTR + INY + CPY #4 + BCC .3 + RTS +*---LOCAL LABEL------------------ +.4 LDY #2 COMPUTE LOCAL OFFSET + SEC + LDA EXP.VALUE + >SYM SBC,STPNTR + DEY + >SYM STA,PNTR + LDY #3 + LDA EXP.VALUE+1 + >SYM SBC,STPNTR + BNE GT255ERR VALUE > 255 + RTS RETURN TO MAIN LEVEL OF ASM +*---PASS 2: PRINT VALUE--------- +.5 JMP P.EXP.VALUE.DASH +*--------------------------------- +* .DA -- DATA VALUE (8- OR 16-BITS) +*--------------------------------- +PSDA LDA #0 UNDEF FLAG FOR LINE + PHA +.1 JSR GNNB GET NEXT NON-BLANK CHAR + BCS ERBA2 END OF LINE + STA DLIM +*---Could be $$dstringd---------- + CMP #'$' $$dstringd value? + BNE .2 ...NO + LDA WBUF,Y Look for second $ + CMP #'$' + BNE .25 ...NO, MUST BE SIMPLE HEX WORD + JSR GNC SKIP OVER SECOND '$' + JSR PSAS GET dstringd + JMP .5 +*---Look for size char----------- +.2 LDY #1 ASSUME 1-BYTE DATA + CMP #'#' + BEQ .3 + CMP #'/' + BEQ .3 + LDY #3 ASSUME 3-BYTE DATA + CMP #'<' 24-BIT SIGNAL + BEQ .3 ...3-BYTE DATA + INY ASSUME 4-BYTE DATA + CMP #'>' 32-BIT SIGNAL + BEQ .3 +*---Size is two bytes------------ +.25 JSR BACKUP.CHAR.PNTR + LDY #2 2-BYTE DATA +*---Get expression, emit value--- +.3 STY ADDR.LENGTH + JSR EXPR CRACK EXPRESSION + LDY DLIM If preceded by /, shift over + CPY #'/' + BNE .4 ...NOT / + JSR EXP.OVER.256 +.4 JSR EMIT.VALUE ACCORDING TO ADDR.LENGTH +*---Update UNDEF flag------------ + PLA .DA'S UNDEF FLAG + ORA EXP.UNDEF + PHA +*---Next item in list------------ +.5 JSR GNC.UC LOOK FOR ANOTHER ITEM + CMP #', COMMA? + BEQ .1 YES, GET ANOTHER ONE + PLA GET .DA'S UNDEF FLAG + STA EXP.UNDEF MERGED VALUE + RTS LIST LINE OR REPORT UNDEF ERROR +*-------------------------------- +* DO/ELSE/FIN +*-------------------------------- +PSDO JSR EXPR.DEFINED GET VALUE + LDX DO.INDEX 0 IF EMPTY, ELSE 1-63 + INX + CPX #64 + BCC .2 + LDY #QERDO2 ".DO NEST TOO DEEP" + JMP SOFT.ERROR +.2 LDA EXP.VALUE + ORA EXP.VALUE+1 TEST FOR ZERO + ORA EXP.VALUE+2 + ORA EXP.VALUE+3 + BEQ .3 ZERO, FALSE + SEC NONZERO, TRUE +.3 STX DO.INDEX + LDX #-8 +.4 ROR DO.STACK+8,X + INX + BNE .4 + RTS LIST THE LINE +*-------------------------------- +PSEL LDX DO.INDEX + BEQ ERR.DO ERROR, NOT BTWN .DO AND .FIN + LDA DO.STACK + EOR #$80 TOGGLE CURRENT LOGIC LEVEL + STA DO.STACK + RTS RETURN TO MAIN LEVEL OF ASM +*-------------------------------- +ERR.DO LDY #QERDO "MISSING .DO" + JMP SOFT.ERROR +*-------------------------------- +PSFI LDX DO.INDEX + BEQ ERR.DO ERROR, NOT AFTER .DO + DEC DO.INDEX POP THIS DO + LDX #7 +.1 ROL DO.STACK,X + DEX + BPL .1 + RTS RETURN TO MAIN LEVEL OF ASM +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/scmasm.s.dir1 +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/SCMASM.S.DIR2.txt b/SCMASM.30/SCMASM.S.DIR2.txt new file mode 100644 index 00000000..07a98189 --- /dev/null +++ b/SCMASM.30/SCMASM.S.DIR2.txt @@ -0,0 +1,279 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* .IN -- INCLUDE A SOURCE FILE +*-------------------------------- +PSIN LDA INFLAG SEE IF NESTED .IN + BNE .4 ...YES, ERROR + SEC + ROR INFLAG TURN ON FLAG (=$80) + LDA #'I PUT "I" IN PROMPT MESSAGE + STA PROMPT.FLAG + JSR LIST.LINE.BOTH.PASSES +*---SAVE CURRENT, SET UP NEW----- + LDX #1 +.1 LDA HI.MEM,X SAVE CURRENT SOURCE POINTERS + STA INSAVE,X + LDA SRCP,X + STA INSAVE+2,X + LDA PP,X + STA HI.MEM,X + .DO AUXMEM + .ELSE + LDA LO.MEM,X MAKE DOS PROTECT THE SYMBOL TABLE + STA INSAVE+6,X DURING THE LOAD + LDA EOT,X + STA LO.MEM,X + .FIN + DEX + BPL .1 +*---CHECK FOR .INBx-------------- + JSR GNC.UC + CMP #'B' + BNE .2 ...NOT .INBx + JSR GNC.UC GET # OF BLOCKS + EOR #'0' + BEQ .12 ...NOT 1-9, USE 1 + CMP #10 + BCC .14 ...1-9 +.12 LDA #1 USE 1 BLOCK +.14 ORA #$C0 + STA INFLAG +*---LOAD THE FILE---------------- +.2 JSR SAVE.PATHNAME + LDY #PQ.LOD LOAD COMMAND + JSR ISSUE.DOS.COMMAND +*---ASSEMBLE INCLUDED STUFF------ + LDX #1 +.3 LDA PP,X MOVE SRCP TO BEGINNING OF INCLUDED FILE + STA SRCP,X + STA MACSTK,X + .DO AUXMEM + .ELSE + LDA INSAVE+6,X RESTORE LO.MEM + STA LO.MEM,X + .FIN + LDA SCI.IOB.RW+6,X # BYTES ACTUALLY RECEIVED + STA INSAVE+4,X + DEX + BPL .3 + LDA SCI.IOB.RW+1 REFNUM OF INB FILE + STA INSAVE+6 + JMP ASM2 CONTINUE ASSEMBLY +*---NO NESTING ALLOWED----------- +.4 LDY #QNIN "NEST .IN" + JMP FIRM.ERROR +*-------------------------------- +* .EN -- END OF SOURCE PROGRAM +*-------------------------------- +PSEN JSR LIST.SOURCE.IF.LISTING +ENDM + BIT INFLAG IN A ".IN"? + BPL .1 NO + BVC .3 ...NOT IN .INBx + LDA INSAVE+6 .INBx REFNUM + STA SCI.IOB.CLOSE+1 + LDA #$CC Close the .INclude file + JSR SCI.MLI +.3 JSR RESTORE YES, BACK TO ROOT + JMP ASM2 CONTINUE ASSEMBLY +*---END OF ROOT FILE------------- +.1 JSR TFEND END .TF IF DOING ONE + LDA PASS WHICH PASS? + BNE .2 ...END OF PASS 2 + INC PASS END OF PASS 1 + JMP ASM1 +.2 BIT LF.ALL Are we listing? + BMI ASM.END ...no, we are finished + JSR CRLF.WITH.PAGING + JSR CRLF.WITH.PAGING + JSR CRLF.WITH.PAGING + LDY #QST "SYMBOL TABLE" + JSR QT.OUT + JSR CRLF.WITH.PAGING + JSR CRLF.WITH.PAGING + JSR STPRNT PRINT THE SYMBOLS +*-------------------------------- +ASM.END + JSR CRLF.WITH.PAGING + LDA ERROR.COUNT + STA CURRENT.LINE.NUMBER + LDA ERROR.COUNT+1 + STA CURRENT.LINE.NUMBER+1 + JSR CONVERT.LINE.NUMBER.PRINT + LDY #QERRCNT + JSR QT.OUT + JMP SOFT END OF ASSEMBLY +*-------------------------------- +* RESTORE IF INSIDE AN INCLUDE +*-------------------------------- +RESTORE + LDA INFLAG + BEQ .1 RETURN + LDX #0 CLEAR PROMPT.FLAG + STX PROMPT.FLAG + STX INFLAG CLEAR INFLAG + INX X=1 +.2 LDA HI.MEM,X + STA PP,X + STA MACSTK,X + LDA INSAVE,X + STA HI.MEM,X + LDA INSAVE+2,X + STA SRCP,X + DEX + BPL .2 +.1 RTS +*-------------------------------- +* SET UP TITLE LINE +*-------------------------------- +PSTI LDA PASS + BEQ PGXIT DO NOTHING IN PASS ONE + JSR EXPR.DEFINED GET PAGE LENGTH + LDA EXP.VALUE USE MOD 256 + STA PAGE.LENGTH NON-ZERO PAGE LENGTH MEANS TITLING IS ON + LDX #0 POINT AT TITLE BUFFER + JSR GNC + CMP #', + BNE .2 NO TITLE +.1 JSR GNC + BCS .2 END OF TITLE + STA KBUF,X + INX + CPX #70 MAX TITLE SIZE + BCC .1 +.2 LDA #0 TERMINATE TITLE + STA KBUF,X +*---FALL INTO PSPG CODE---------- +*-------------------------------- +* PAGE EJECT +*-------------------------------- +PSPG JSR FORM.FEED +PGXIT JMP ASM2 +*-------------------------------- +FORM.FEED + JSR CHECK.IF.LISTING + LDA #$0C FORM FEED CHAR + JSR CHO + >INCD PAGE.NUMBER + LDA PAGE.LENGTH + CMP #3 PAGE LENGTHS LESS THAN 3 CANNOT BE TITLED + BCC .1 EXIT, NOT TITLING NOW + LDX #0 + STX LINE.COUNT +.3 LDA KBUF,X PRINT TITLE + BEQ .4 END OF TITLE + JSR CHO + INX + BNE .3 ...ALWAYS +.4 LDY #PAGEQT " PAGE " + JSR QT.OUT + LDA CURRENT.LINE.NUMBER SAVE LINE # + PHA + LDA CURRENT.LINE.NUMBER+1 + PHA + LDA PAGE.NUMBER PRINT PAGE # + STA CURRENT.LINE.NUMBER + LDA PAGE.NUMBER+1 + STA CURRENT.LINE.NUMBER+1 + JSR CONVERT.LINE.NUMBER.PRINT + JSR CRLF.WITH.PAGING + PLA RESTORE LINE # + STA CURRENT.LINE.NUMBER+1 + PLA + STA CURRENT.LINE.NUMBER +.1 RTS RETURN +*-------------------------------- +* .BS -- BLOCK STORAGE +*-------------------------------- +PSBS JSR EXPR.DEFINED GET # OF BYTES + LDA EXP.VALUE+3 + ORA EXP.VALUE+2 + BNE RAER VALUE >32767 + LDA EXP.VALUE+1 + BMI RAER VALUE >32767 + STA BS.COUNT+1 + LDA EXP.VALUE + STA BS.COUNT SAVE COUNT + JSR P.ORIGIN PRINT ADDRESS + JSR GNC GET NEXT CHAR + CMP #', COMMA? + BNE .1 NO, NO VALUE PRESENT + JSR EXPR GET FILL VALUE + BPL .2 BRANCH IF GOOD EXPRESSION +.1 JSR ZERO.EXP.VALUE USE ZERO FOR FILL VALUE +.2 SEC + ROR LF.ALL TURN OFF LISTING +.3 LDA BS.COUNT GET COUNT + BNE .4 STILL MORE BYTES + DEC BS.COUNT+1 + BMI .5 ...ALL THRU +.4 DEC BS.COUNT COUNT DOWN + LDA EXP.VALUE GET FILL VALUE + JSR EMIT AND EMIT IT + JMP .3 + +.5 ASL LF.ALL RESTORE LISTING + RTS + +*-------------------------------- +RAER LDY #QER3 ERROR -- OUT OF RANGE + JMP SOFT.ERROR + +*-------------------------------- +* LISTING CONTROL +* .LIST ON/OFF/MON/MOFF/CON/COFF,... +*-------------------------------- +PSLI LDY #LI.INDEX-2 + JSR SET.FLAGS + JMP ASM2 DON'T LIST LINE +*-------------------------------- +* SWITCH FLAGS ON OR OFF +*-------------------------------- +SET.FLAGS + STY YSAVE +.1 LDY YSAVE +.2 INY Find letter in table + INY + LDA FLAG.TABLE,Y + BEQ .7 ...end of table, get next letter + CMP CURRENT.CHAR + BNE .2 ...try next entry in table +*---Found letter in table-------- + LDX FLAG.TABLE+1,Y +.3 EOR #'N 'N' means ON + BEQ .5 ...set flag to $00 + EOR #'F^'N 'F' means OFF + BEQ .4 ...set flag to $FF + EOR #',^'F comma here is an error + BEQ .9 ...oops! + JSR GNC.UC get next char from user + BNE .3 ...might be N, F, or comma + RTS ...blank or end of line +*---Turn flag ON or OFF---------- +.4 LDA #$FF signal OFF with $FF +.5 STA 0,X store $00 or $FF in flag +*---Scan to a comma or eol------- +.6 JSR GNC GET NEXT CHAR + BEQ .8 ...blank or end of line + CMP #',' + BNE .6 ...not comma yet +*---Get next char from user------ +.7 JSR GNC.UC + BCC .1 ...not end of line yet +.8 RTS RETURN TO CALLER +.9 JMP ERBA +*-------------------------------- +FLAG.TABLE +LI.INDEX .EQ *-FLAG.TABLE + .DA #'N',#LF.ALL + .DA #'F',#LF.ALL + .DA #'M',#LF.MACRO + .DA #'C',#LF.CONDITIONAL + .DA #'X',#LF.XTRA.BYTES + .HS 00 +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/scmasm.s.dir2 +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/SCMASM.S.DISK.txt b/SCMASM.30/SCMASM.S.DISK.txt new file mode 100644 index 00000000..816f3687 --- /dev/null +++ b/SCMASM.30/SCMASM.S.DISK.txt @@ -0,0 +1,231 @@ +NEW + AUTO 3,1 +*-------------------------------------- +SCI.TBLADR .EQ $AA00 Address of Command Table +SCI.LINBUF .EQ $BC80 +SCI.STARTUP .EQ $BE00 +SCI.COMMAND .EQ $BE03 +SCI.ERROR .EQ $BE09 +SCI.SLOT .EQ $BE3C +SCI.DRIVE .EQ $BE3D +SCI.STATE .EQ $BE42 0=immediate, else deferred +SCI.MLI .EQ $BE70 Call MLI, (A)=operation +SCI.RTS .EQ $BE9E +SCI.IOB.GETSET .EQ $BEB4 Get/Set File Info IOB +SCI.IOB.MISC .EQ $BEC6 Misc functions IOB +SCI.IOB.OPEN .EQ $BECB Open IOB +SCI.IOB.RW .EQ $BED5 Read/Write IOB +SCI.IOB.CLOSE .EQ $BEDD Close IOB +SCI.BUFFER.PAGES .EQ $BEF2,3,4 Buf1, Buf2, Exec +SCI.HIMEM.PAGE .EQ $BEFB +*-------------------------------- +* LIST SOURCE CODE ON TEXT FILE +*-------------------------------- +* TEXT.OPTIONS: +* TEXT NO LINE NUMBERS +* TEXT# WITH LINE NUMBERS +* TEXT% WITH TAB.CHAR +*-------------------------------- +TEXT LDX #0 00=NO LINE NUMBERS + STX TEXT.OPTIONS + JSR GNNB GET NEXT NON-BLANK CHAR + CMP #'# TEXT # MEANS WRITE LINE NUMBERS + BEQ .5 USE LINE NUMBERS + CMP #'% TEXT % MEANS WRITE CONTROL-I + BNE .6 NEITHER, WRITE TEXT ONLY + LDA TAB.CHAR + STA TEXT.OPTIONS + BNE .7 ...ALWAYS +.5 INC TEXT.OPTIONS + BNE .7 ...ALWAYS +.6 JSR BACKUP.CHAR.PNTR +.7 LDA #1 INTO "DEFERRED" STATE + STA SCI.STATE + JSR SAVE.PATHNAME + LDY #PQ.OPN + JSR ISSUE.DOS.COMMAND + LDY #PQ.WRT + JSR ISSUE.DOS.COMMAND + JSR SETUP.TEXT.POINTERS (PP --> SRCP, HIMEM --> ENDP) +.1 JSR CMP.SRCP.ENDP END OF RANGE YET? + BCS .4 ...YES + JSR GET.LINE.NUMBER + LDA TEXT.OPTIONS + BEQ .3 NO LINE # + BMI .2 TAB.CHAR + JSR CONVERT.LINE.NUMBER.PRINT + LDA #$20 SPACE AFTER LINE # +.2 JSR CHO +.3 JSR NTKN + BNE .2 + JSR CRLF + JMP .1 +.4 LDA #0 TRUNCATE REST OF FILE + JSR CHO + JMP SOFT +*-------------------------------- +* .TF DIRECTIVE +*-------------------------------- +* END EXISTING .TF IF ANY +* SET .TF FLAG ON +* +* PASS 1: THAT'S ALL +* +* PASS 2: OPEN THE FILE, WITH T=BIN +* SET MARK=EOF=0 +* SET STARTING ADDRESS IN FILE-INFO +* WRITE START ADDRESS AND LENGTH +*-------------------------------- +PSTF JSR TFEND CLOSE EXISTING TF IF ANY + SEC + ROR TF.FLAG SET FLAG ON + JSR LIST.LINE.BOTH.PASSES + LDA PASS WHICH PASS? + BEQ .9 ...PASS 1, EXIT NOW + JSR SAVE.PATHNAME + LDY #PQ.OPN + JSR ISSUE.DOS.COMMAND +*---Empty the file now----------- + LDA #0 + STA SCI.IOB.MISC+2 + STA SCI.IOB.MISC+3 + STA SCI.IOB.MISC+4 + LDA SCI.IOB.OPEN+5 REFNUM FOR TARGET FILE + STA TF.PRM TARGET FILE REF. NUM. + STA SCI.IOB.MISC+1 + LDA #$CE SET MARK + JSR SCI.MLI + BCS JMP.PRODOS.ERR ...ERROR + LDA #$D0 SET EOF + JSR SCI.MLI + BCS JMP.PRODOS.ERR ...ERROR +*---Get current file info-------- + LDA #10 + STA SCI.IOB.GETSET + LDA #$C4 GET FILE INFO + JSR SCI.MLI + BCS JMP.PRODOS.ERR ...ERROR +*---Set proper file info--------- + LDA #7 change IOB for set.file.info + STA SCI.IOB.GETSET + LDA SCI.IOB.GETSET+4 current file type + CMP #$04 is it type TXT? + BEQ .9 ...yes, make no changes + LDX #$2000 if type is SYS ($FF), force A=$2000 + LDY /$2000 + CMP #$FF is it type SYS? + BEQ .3 ...yes + LDX ORGN all other types, A=origin + LDY ORGN+1 +.3 STX SCI.IOB.GETSET+5 new AuxType + STY SCI.IOB.GETSET+6 + LDA #$C3 SET FILE INFO + JSR SCI.MLI + BCS JMP.PRODOS.ERR ...ERROR +.9 JMP ASM2 ...CONTINUE ASSEMBLY +*-------------------------------- +JMP.PRODOS.ERR JMP PRODOS.ERROR +*-------------------------------- +* OUTPUT (A) TO ALREADY OPENED DISK FILE +*-------------------------------- +DOUT BIT DUMMY.FLAG + BMI .3 No output inside DUMMY section + STA TF.BUF Save in buffer outside zero-page + STX TF.SVX + LDX #4 copy parms to SCI parmblock +.1 LDA TF.PRM,X + STA SCI.IOB.RW+1,X + DEX + BPL .1 ...until all copied + LDA #$CB Write command code + JSR SCI.MLI + BCS JMP.PRODOS.ERR + LDX TF.SVX + LDA OBJ.BYTE +.3 RTS +* +TF.SVX .BS 1 +TF.BUF .BS 1 +TF.PRM .DA #*-*,TF.BUF,1 +*-------------------------------- +* TFEND - FINISH OFF A .TF SECTION +* CALLED FROM: .TF, .TA, .OR, .EN PROCESSORS +* +* IF NOT IN .TF NOW, RETURN IMMEDIATELY +* CLEAR .TF FLAG +* PASS 1 - THAT'S ALL TO DO +* PASS 2 - CLOSE FILE +*-------------------------------- +TFEND ASL TF.FLAG TEST AND CLEAR FLAG SIMULTANEOUSLY + BCC .1 ...TF NOT ACTIVE, DO NOTHING + LDA PASS + BNE CLOSE.FILES ...PASS 2 +.1 RTS +*-------------------------------- +CLOSE.FILES + LDY #PQ.CLS + .HS 2C +FP LDY #PQ.FP + LDA #0 + STA PATHNAME +*-------------------------------- +* ISSUE DOS COMMAND WITH FILE NAME +* (Y)=QUOTE OFFSET FOR COMMAND +* +* SAVES AND RESTORES CHARACTER POINTER +* SO THAT FILE NAME CAN BE USED AGAIN. +*-------------------------------- +ISSUE.DOS.COMMAND + LDX #$7F SAVE WBUF (0-127) +.1 LDA WBUF,X + STA SCI.LINBUF,X + DEX + BPL .1 +.2 INX COPY PATHNAME INTO WBUF (5...) + LDA PATHNAME,X + STA WBUF+5,X + BNE .2 + TAX X=0 +.3 INX COPY COMMAND INTO WBUF (0...) + INY + LDA PQTS-1,Y + STA WBUF-1,X + BPL .3 + STX SCI.STATE ALLOW DEFERRED COMMANDS + JSR PASS.CMD.TO.PRODOS + LDX #$7F RESTORE WBUF (0-127) +.4 LDA SCI.LINBUF,X + STA WBUF,X + DEX + BPL .4 + RTS +*-------------------------------- +SAVE.PATHNAME + LDX #0 +.1 CPX #49 + BCS .2 + JSR GNNB + BCC .3 +.2 LDA #0 +.3 STA PATHNAME,X + INX + BCC .1 + RTS +*-------------------------------- +PQTS .EQ * +PQ.CLS .EQ *-PQTS + .AT /CLOSE/ +PQ.OPN .EQ *-PQTS + .AT /OPEN / +PQ.WRT .EQ *-PQTS + .AT /WRITE/ +PQ.LOD .EQ *-PQTS + .AT /LOAD / +PQ.FP .EQ *-PQTS + .AS /-BASIC.SYSTEM/ + .HS 00FF +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/scmasm.s.disk +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/SCMASM.S.EDIT..txt b/SCMASM.30/SCMASM.S.EDIT..txt new file mode 100644 index 00000000..51bdc240 --- /dev/null +++ b/SCMASM.30/SCMASM.S.EDIT..txt @@ -0,0 +1,509 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* SOFT INITIALIZATION +*-------------------------------- +SOFT LDA /$1000 START SYMBOL TABLE AT $1000 +SYMBOL.BASE .EQ *-1 + STA LO.MEM+1 + LDA #0 + STA LO.MEM + STA AUTOLN.FLAG TURN OFF AUTOMATIC LINE NUMBERS + JSR IO.WARM INIT SCREEN, CONNECT DOS + JSR CLOSE.FILES +*-------------------------------- +FAST CLC SET TO FAST LISTING SPEED + .HS 24 (SKIP OVER SEC) +SLOW SEC SET TO SLOW LISTING SPEED + ROR FLAG.SPEED SET/CLEAR SIGN BIT +*-------------------------------- +* GET NEXT LINE +*-------------------------------- +GNL + LDX #$FF INIT STACK + TXS + STX PASS PASS=-1 IF NOT ASSEMBLING + INX MAKE X=0 + STX SCI.STATE GET INTO "IMMEDIATE" STATE + STX RPTCNT CLEAR REPEAT COUNT + STX MACRO.LEVEL + STX PARAM.PNTR + STX CHAR.PNTR + STX PAGE.LENGTH TURN OFF TITLING + JSR READ.LINE + JSR GNC.UC.START GET FIRST CHAR OF LINE + BEQ GNL EMPTY LINE OR 1ST CHAR IS BLANK + JSR CHECK.LETTER + BCC .1 NOT A LETTER + JSR SEARCH.COMMAND.TABLE + JMP GNL +*---Test for single char cmds---- +.1 LDY #CHARS.FOR.COMMANDS + JSR SEARCH.CHAR.TABLES + JMP GNL +*---" LINE, ECHO ALL CHARS------- +ECHO1 JSR CHO SEND CHARACTER +ECHO.LINE + JSR GNC GET NEXT CHAR + BCC ECHO1 NOT END YET + RTS +*-------------------------------- +* SYNTAX ERROR +*-------------------------------- +SYNX LDY #QSYNX + JMP HARD.ERROR +*-------------------------------- +* NUMBERED LINE +*-------------------------------- +NML JSR GNC.START GET FIRST CHAR + JSR DECN CONVERT LINE NUMBER + LDA DGTCNT MUST BE 1 TO 5 DIGITS + BEQ SYNX + LDA SYM.VALUE+2 + ORA SYM.VALUE+3 + BNE SYNX > 65535 +*---Compact the numbered line---- + DEY Backup to previous character + JSR COMPACT.LINE +*-------------------------------- + LDX #1 COPY IN BINARY LINE # +.51 LDA SYM.VALUE,X + STA CURLNO,X SAVE HERE TOO, FOR AUTO-NUMBER + STA WBUF+1,X + DEX + BPL .51 +*-------------------------------- +* FIND LINE, OR PLACE WHERE IT SHOULD GO +* LINE.START --> BEGINNING OF THIS LINE +* LINE.END --> BEGINNING OF NEXT LINE +*-------------------------------- + LDX #SYM.VALUE POINT AT LINE NUMBER + JSR SERTXT FIND IT IF THERE + SEC GET LENGTH OF HOLE + LDA LINE.END WILL ALWAYS BE LESS THAN 256 + SBC LINE.START + SEC SUBTRACT LENGTH OF NEW LINE + SBC WBUF LINE SIZE + BEQ .11 SAME SIZE EXACTLY + STA MOVE.DISTANCE + LDA #0 + SBC #0 + STA MOVE.DISTANCE+1 + BCC .6 NEW LINE LONGER THAN HOLE +*-------------------------------- +* NEW LINE SHORTER THAN HOLE +*-------------------------------- + CLC COMPUTE TARGET TO MOVE UP TO + LDA LINE.START + ADC MOVE.DISTANCE + STA A4L + LDA LINE.START+1 + ADC MOVE.DISTANCE+1 + STA A4H + JSR MOVE.TEXT.UP + JMP .10 NOW HOLE IS RIGHT SIZE +*-------------------------------- +* ENLARGE HOLE TO MAKE ROOM +*-------------------------------- +.6 CLC (MOVE.DISTANCE) = -<#BYTES TO EXPAND> + LDA PP COMPUTE TARGET ADDRESS + ADC MOVE.DISTANCE + STA A4L + LDA PP+1 + ADC MOVE.DISTANCE+1 + STA A4H + LDA A4L BE SURE THERE IS ROOM + CMP LO.MEM + LDA A4H + SBC LO.MEM+1 + BCC MFER NO ROOM! + JSR MOVE.TEXT.DOWN +*---Adjust SRCP if needed-------- +.10 LDA SRCP If hole is above (SRCP), + CMP LINE.END then need to add MOVE.DISTANCE + LDA SRCP+1 + SBC LINE.END+1 + BCS .11 + LDA SRCP + ADC MOVE.DISTANCE + STA SRCP + LDA SRCP+1 + ADC MOVE.DISTANCE+1 + STA SRCP+1 +*-------------------------------- +* COPY NEW LINE INTO THE HOLE +*-------------------------------- +.11 LDX WBUF LINE SIZE + BEQ .14 NO NEW LINE TO COPY + LDY #0 +.12 LDA LINE.END BACK UP POINTER TO END OF HOLE + BNE .13 + DEC LINE.END+1 +.13 DEC LINE.END + DEX + LDA WBUF,X + STA (LINE.END),Y + TXA + BNE .12 +.14 RTS +*-------------------------------- +MFER LDY #QMEMFL MEM FULL ERROR + JMP HARD.ERROR +*-------------------------------- +COMPACT.LINE + LDX #4 Start storing at WBUF+3 + LDA #-1 Prime RPT pump + STA RPTCNT +.1 STA RPTCHR +.2 INY advance input pointer + INC RPTCNT (first time makes it = 0) + LDA WBUF,Y get next char + AND #$7F be sure its low ascii + CMP RPTCHR save as previous char? + BEQ .2 ...yes, just count it + PHA save new character +*-------------------------------- + LDA RPTCNT + BEQ .3 + JSR PROCESS.REPEAT.COUNT +*-------------------------------- +.3 PLA get new character + BNE .1 ...not 00 terminator + STA WBUF-1,X store terminator + CPX #5 If only line number, make length 00 + BCS .4 + LDX #0 +.4 STX WBUF + RTS +*-------------------------------- +PROCESS.REPEAT.COUNT + LDA RPTCHR + CMP #' ' + BEQ .5 ...compress blanks in special way + LDA RPTCNT + CMP COMPRESSION.LIMIT + BCS .2 ...enough to compress to 3 bytes +.1 LDA RPTCHR spit out uncompressed chars + STA WBUF-1,X + INX + DEC RPTCNT + BNE .1 + RTS +*---Compress $C0 cnt char-------- +.2 STA WBUF,X store count + LDA #$C0 Compression token + STA WBUF-1,X + INX + INX + LDA RPTCHR repeated char +.3 STA WBUF-1,X + INX + LDA #0 + STA RPTCNT + RTS +*---Compress blanks-------------- +.4 SBC #$3F Maximum blanks in one token + STA RPTCNT + LDA #$BF $3F blanks + STA WBUF-1,X + INX +.5 LDA RPTCNT Number of blanks left + CMP #$40 + BCS .4 ...too many for one token + ORA #$80 make into blank token + count + BNE .3 ...always +*-------------------------------- +SCAN.3.DECIMAL.NUMBERS + LDX #6 FIRST CLEAR TO ZERO + LDA #0 +.1 STA A0L-1,X + DEX + BNE .1 + JSR SCAN.1.DECIMAL.NUMBER + JSR SCAN.1.DECIMAL.NUMBER +*** JMP SCAN.1.DECIMAL.NUMBER +*-------------------------------- +SCAN.1.DECIMAL.NUMBER +.1 JSR GNC + BCS .2 END OF LINE + EOR #$30 IS THIS A DIGIT? + CMP #10 + BCS .1 NO + TXA SAVE X-REG + PHA + JSR DECN CONVERT NUMBER + PLA RESTORE X-REG + TAX + LDA SYM.VALUE STACK NUMBER + STA A0L,X + INX + LDA SYM.VALUE+1 + STA A0L,X + INX +.2 RTS +*-------------------------------- +* DECIMAL NUMBER INPUT +*-------------------------------- +DECN JSR BACKUP.CHAR.PNTR + JSR ZERO.SYM.VALUE CLEAR ACCUMULATOR + STA DGTCNT +.1 JSR GNC GET NEXT CHAR + EOR #$30 CHECK IF DIGIT + CMP #10 + BCS .5 NOT A DIGIT + PHA SAVE THE DIGIT +*---ACCUMULATOR * TEN------------ + JSR ASL.SYM.VALUE + BCS .6 OVERFLOW ERROR + LDX #3 +.2 LDA SYM.VALUE,X HI- TO LO- + PHA + DEX + BPL .2 +.3 JSR ASL.SYM.VALUE + BCS .6 OVERFLOW ERROR + INX + BEQ .3 DO IT TWICE + PLA + ADC SYM.VALUE + STA SYM.VALUE + PLA + ADC SYM.VALUE+1 + STA SYM.VALUE+1 + PLA + ADC SYM.VALUE+2 + STA SYM.VALUE+2 + PLA + ADC SYM.VALUE+3 + STA SYM.VALUE+3 + BCS .6 OVERFLOW ERROR +*---ADD CURRENT DIGIT------------ + PLA + ADC SYM.VALUE + STA SYM.VALUE + BCC .4 + INC SYM.VALUE+1 + BNE .4 + INC SYM.VALUE+2 + BNE .4 + INC SYM.VALUE+3 + BEQ .6 OVERFLOW ERROR +.4 INC DGTCNT COUNT THE DIGIT + BNE .1 ...ALWAYS +.5 RTS +.6 LDY #QER3 RANGE ERROR + JMP SOFT.ERROR +*-------------------------------- +* GET NEXT NON-BLANK CHAR +*-------------------------------- +GNNB JSR GNC.UC GET NEXT CHAR IN UPPER CASE + BCS .1 END OF LINE + BEQ GNNB BLANK +.1 RTS RETURN +*-------------------------------- +* GET NEXT CHAR IN UPPER CASE +*-------------------------------- +GNC.UC.START + LDY #0 + STY CHAR.PNTR +GNC.UC JSR GNC GET NEXT CHAR ANY CASE + BEQ .1 SPACE OR + JSR ELIMINATE.CASE MAP LOWER CASE TO UPPER CASE + STA CURRENT.CHAR + CMP #$FF CLEAR CARRY, SET .NE. +.1 RTS +*-------------------------------- +* GET NEXT CHAR +*-------------------------------- +GNC.START + LDY #0 BEGINNING OF LINE + .HS 2C SKIP NEXT TWO BYTES +GNC LDY CHAR.PNTR +GNC2 LDA WBUF,Y GET CHAR + AND #$7F + STA CURRENT.CHAR + BEQ .1 END OF LINE + INY BUMP POINTER + STY CHAR.PNTR + CMP #$20 SEE IF BLANK + CLC CARRY CLEAR SINCE NOT AT END + RTS +.1 LDA #$20 RETURN BLANK + CMP #$20 SET CARRY AND EQUAL STATUS + RTS +*-------------------------------- +* BACK UP CHARACTER POINTER +*-------------------------------- +BACKUP.CHAR.PNTR + PHA SAVE A-REG + LDA CURRENT.CHAR + BEQ .1 DO NOT BACK OFF THE END + LDA CHAR.PNTR + BEQ .1 DO NOT BACK BEYOND THE BEGINNING + DEC CHAR.PNTR +.1 PLA + RTS +*-------------------------------- +* GET NEXT TOKEN FROM SOURCE LINE +*-------------------------------- +NTKN + LDA RPTCNT + BNE .3 IN A REPEATED CHAR LOOP + JSR GNB GET NEXT CHAR FROM SOURCE + ASL ...WEIRD WAY TO TEST SIGN BIT + ROR ...AND AS WELL AS 00 + BPL .4 ...NORMAL CHARACTER + CMP #$C0 SEE IF BLANKS + BCC .1 ...YES + JSR GNBI REPEAT TOKEN $C0 XX YY, GET XX + STA RPTCNT + JSR GNBI GET YY (CHAR TO BE REPEATED) + JMP .2 ...ALWAYS +.1 AND #$3F BLANK COUNT + STA RPTCNT + LDA #$20 BLANK +.2 STA RPTCHR +.3 DEC RPTCNT + LDA RPTCHR +.4 RTS +*-------------------------------- +* GET NEXT BYTE FROM SOURCE +*-------------------------------- +GNB LDY #0 +GNBI + .DO AUXMEM + LDA MACRO.LEVEL + BEQ .0 ...NOT IN A SKELETON + >SYM LDA,SRCP + .HS 2C SKIP OVER LDA (SRCP),Y + .FIN +.0 LDA (SRCP),Y + >INCD SRCP + BIT INFLAG INSIDE BLOCKED .IN? + BVC .3 ...NO + PHA + LDA MACRO.LEVEL + BNE .25 INSIDE A SKELETON + LDA INSAVE+4 REMAINING BYTES IN THIS BLOCK + BNE .2 ...THERE ARE MORE + ORA INSAVE+5 + BEQ .4 ...NO MORE IN THIS BLOCK + DEC INSAVE+5 +.2 DEC INSAVE+4 +.25 PLA +.3 RTS +*---TRY TO READ ANOTHER BLOCK---- +.4 PLA + LDA INSAVE+6 REFNUM OF INB FILE + STA SCI.IOB.RW+1 + LDA PP STARTING ADDRESS + STA SRCP + STA SCI.IOB.RW+2 + LDA PP+1 + STA SRCP+1 + STA SCI.IOB.RW+3 + SEC + LDA HI.MEM+1 NUMBER OF PAGES + SBC PP+1 + STA SCI.IOB.RW+5 + LDA #0 + STA SCI.IOB.RW+4 + LDA #$CA READ + JSR SCI.MLI + BCC .5 ...NO ERRORS + CMP #5 END OF DATA? + BNE PRODOS.ERROR ...ERROR +.5 LDA SCI.IOB.RW+6 + STA INSAVE+4 # BYTES ACTUALLY READ + LDA SCI.IOB.RW+7 + STA INSAVE+5 + BCC GNB ...NOT END OF DATA + LDA INSAVE+6 REFNUM + STA SCI.IOB.CLOSE+1 FOR CLOSE CALL + LDA #$CC + JSR SCI.MLI + BCS PRODOS.ERROR + JSR RESTORE END OF THE INBx FILE + JMP ASM2 +*-------------------------------- +PRODOS.ERROR + PHA + JSR RESTORE.IF.IN.INBX + PLA + JMP SCI.ERROR +*-------------------------------- +* RETURN .CS. IF VALID CHAR +* .CC. IF INVALID CHAR +*-------------------------------- +CHECK.DOT.DIGIT.OR.LETTER + CMP #'. + BEQ CHECKS.OK + CMP #'_' allow underline in symbols too + BEQ CHECKS.OK +CHECK.DIGIT.OR.LETTER + JSR CHECK.DIGIT + BCS CHECKS.OK +CHECK.LETTER + CMP #'A + BCC CHECKS.NOT.OK + CMP #'Z+1 + BCC CHECKS.OK +CHECKS.NOT.OK + CLC + RTS +CHECK.DIGIT + CMP #'0 + BCC CHECKS.NOT.OK + CMP #'9+1 + BCS CHECKS.NOT.OK +CHECKS.OK + SEC + RTS +*-------------------------------- +CHECK.COMMENT.CHAR + CMP #'* STAR? + BEQ .1 YES + CMP #'; SEMI-COLON? +.1 RTS +*-------------------------------- +* INITIALIZE FOR HARD ENTRY +*-------------------------------- +HARD.INIT + CLD +*---Establish LO.MEM & HI.MEM------ + LDA SYMBOL.BASE SET UP LO.MEM + STA LO.MEM+1 + LDA SCI.HIMEM.PAGE + STA HI.MEM+1 + LDA #0 + STA LO.MEM + STA HI.MEM +*---Init other parameters-------- + STA INCREMENT.VALUE+1 + STA PROMPT.FLAG + STA INFLAG + JSR STINIT INITIALIZE SYMBOL TABLE + LDA #10 SET AUTO-LINE-NUMBERING INCREMENT + STA INCREMENT.VALUE + LDA #990 SET AUTO-LINE-NUMBERING + STA CURLNO INITIAL VALUE + LDA /990 + STA CURLNO+1 +*---Print Heading---------------- + JSR IO.INIT INIT TEXT, FULL WINDOW, ETC. + JSR VERSION Print Version Number +*-------------------------------- +EMPTY.SOURCE.AREA + LDA HI.MEM + STA PP EMPTY SOURCE AREA + LDA HI.MEM+1 + STA PP+1 + RTS +*-------------------------------- +Q.VERSION + .DA #VERSION.LO+"0",#".",#VERSION.HI+"0" +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/scmasm.s.edit +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/SCMASM.S.ELINES.txt b/SCMASM.30/SCMASM.S.ELINES.txt new file mode 100644 index 00000000..af8b212a --- /dev/null +++ b/SCMASM.30/SCMASM.S.ELINES.txt @@ -0,0 +1,321 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* EDIT ONE LINE +* TEXT OF LINE ALREADY IN WBUF +* (A1L,A1H) POINT AT LINE IN SOURCE AREA +*-------------------------------- +EDIT.ONE.LINE + LDA BOTTOM.OF.SCREEN + STA ED.BEGLIN + JSR IO.VTAB + JSR E.BEG Start edit 2 columns after line # +.1 STX ED.PNTR + JSR E.DISPLAY.LINE Put line on screen + LDX ED.PNTR Restore PNTR in X + JSR E.PROCESS.CHAR + BCC .1 Not control-L, -M, or -Q + JSR E.DISPLAY.LINE ...One last time + JSR CRLF + JMP NML Submit line and return +*-------------------------------- +* DISPLAY LINE FROM WBUF +*-------------------------------- +E.DISPLAY.LINE + LDA ED.BEGLIN + JSR IO.VTAB + LDA #0 + JSR IO.HTAB + JSR SPC One space + LDX #0 +.1 LDA WBUF,X + BEQ .4 End of line + ORA #$80 + CMP #$A0 Control char? + BCS .2 No + AND #$3F ...YES, MAKE IT INVERSE +.2 PHA + JSR GET.HORIZ.POSN + TAY + PLA + INY + CPY SCREEN.WIDTH + BCC .3 No + LDY CV Last line on screen? + CPY BOTTOM.OF.SCREEN + BCC .3 No + DEC ED.BEGLIN Yes, it will scroll +.3 JSR IO.COUT + INX + BNE .1 ...Always +.4 JMP IO.CLREOP +*-------------------------------- +* PROCESS EDITING CHARACTER +*-------------------------------- +E.PROCESS.CHAR +EPC.1 JSR E.INPUT Get char from keyboard +EPC.2 CMP #$A0 Control char? + BCC E.PROCESS.CNTRL +*-------------------------------- +* PUT CHARACTER INTO LINE +*-------------------------------- +E.PUT.CHARACTER + LDA WBUF,X At end of line? + BNE .1 No + CPX #WBUF.MAX Line too long? + BCS .2 Yes + STA WBUF+1,X Put new +.1 LDA CURRENT.CHAR + STA WBUF,X + INX +.2 CLC + RTS +*-------------------------------- +* PROCESS CONTROL CHAR +*-------------------------------- +E.PROCESS.CNTRL + LDY #CHARS.FOR.EDIT + JMP SEARCH.CHAR.TABLES +*-------------------------------- +E.ILLCHAR + JSR MON.BELL + LDX ED.PNTR Restore X-reg + JMP EPC.1 +*-------------------------------- +* CONTROL-R: RESTORE ORIGINAL LINE +*-------------------------------- +E.RESTORE + LDA A1L Set line pointer back + STA SRCP + LDA A1H + STA SRCP+1 + JSR GET.LINE.TO.WBUF +*-------------------------------- +* CONTROL-B: BEGINNING OF LINE +*-------------------------------- +FIND.START.OF.LINE.IN.WBUF +E.BEG LDY #0 Find 1st column after line number +.1 JSR GNC2 + BCS .2 End of line + JSR CHECK.DIGIT + BCS .1 Yes + INY +.2 TYA Get column # into X + TAX + DEX + CLC + RTS +*-------------------------------- +* CONTROL-D: DELETE CHARACTER +*-------------------------------- +E.DEL LDX ED.PNTR +.1 LDA WBUF,X Are we at the end? + BEQ .3 Yes +.2 INX ADVANCE PNTR + LDA WBUF,X SLIDE REST OF LINE LEFT + STA WBUF-1,X ...to delete char + BNE .2 ...UNTIL END OF LINE +.3 LDX ED.PNTR + CLC + RTS Return with Carry clear +*-------------------------------- +* CONTROL-N: END OF LINE +*-------------------------------- +E.END LDX ED.PNTR + DEX +.1 INX + LDA WBUF,X End of buffer? + BNE .1 ...KEEP LOOKING + CLC + RTS Carry clear +*-------------------------------- +* CONTROL-F: FIND NEXT OCCURRENCE +*-------------------------------- +E.FIND LDX ED.PNTR + LDA WBUF,X End of buffer? + BEQ .3 Yes + JSR E.INPUT Get 1 char + STX ED.FCOL Save beg col + STA ED.FKEY Save key to locate +.1 INX + LDA WBUF,X Text buffer + BEQ .2 End of buffer + ORA #$80 + CMP ED.FKEY No, see if key + BNE .1 No, go forward + STX ED.FCOL Save this col + JSR E.INPUT Try another key + CMP ED.FKEY Same char + BEQ .1 Yes, search again + STX ED.PNTR No, exit pointing here + JMP EPC.2 +.2 LDX ED.FCOL Restore col +.3 JSR MON.BELL Beep + CLC + RTS +*-------------------------------- +* CONTROL-H: BACKSPACE +*-------------------------------- +E.BKSP LDX ED.PNTR + TXA At beginning already? + BEQ .1 Yes, stay there + DEX Backup +.1 CLC + RTS +*-------------------------------- +* CONTROL-O: ALLOW INSERTION OF CONTROL CHAR +*-------------------------------- +E.OVR LDX ED.PNTR + JSR E.INPUT Read char + JMP E.INS1 Skip control check +*-------------------------------- +* CONTROL-I: INSERT CHARACTERS +*-------------------------------- +E.INS LDX ED.PNTR + JSR E.INPUT Read char + CMP #$A0 Control char pops user out + BCS E.INS1 + JMP E.PROCESS.CNTRL +E.INS1 CPX #WBUF.MAX End of block + BEQ .1 Yes, stay there + INC ED.PNTR +.1 PHA Char to insert + LDA WBUF,X Save char to move + TAY + PLA + STA WBUF,X Put over saved char + INX + TYA Insert saved char + BNE .1 If not buffer end + CPX #WBUF.MAX At end? + BCC .2 Not yet + LDX #WBUF.MAX Yes +.2 STA WBUF,X Store end char + JSR E.DISPLAY.LINE + LDX ED.PNTR + BNE E.INS ...Always +*-------------------------------- +* CONTROL-Q: QUIT, DROPPING REST OF LINE +*-------------------------------- +E.RETQ JSR E.ZAP Clear rest of line +*-------------------------------- +* CONTROL-M: QUIT, SUBMITTING WHOLE LINE +*-------------------------------- +E.RET SEC + RTS +*-------------------------------- +* CONTROL-L: SUBMIT THIS LINE, EDIT NEXT LINE +*-------------------------------- +E.DOWN LDA ENDP See if at HI.MEM already + CMP HI.MEM + LDA ENDP+1 + SBC HI.MEM+1 + BCS .1 Yes, no need to move ENDP + JSR CMP.SRCP.ENDP End of range yet? + BCC .1 ...NO + CLC Move ENDP one line + LDY #0 + LDA (SRCP),Y Line length of next line + ADC ENDP + STA ENDP + BCC .1 + INC ENDP+1 +.1 SEC Signal submit line + RTS +*-------------------------------- +* CONTROL-T: SKIP TO NEXT TAB STOP +*-------------------------------- +E.TAB LDX ED.PNTR +.1 JSR E.CHECK.TAB + BCS E.RIT1 MOVE ONE MORE COLUMN + JSR E.RIT1 Move one column right + BCC .1 ...ALWAYS +*-------------------------------- +* CONTROL-U: RIGHT ARROW +*-------------------------------- +E.RIT LDX ED.PNTR +E.RIT1 LDA WBUF,X End of buffer? + BNE .1 No + CPX #WBUF.MAX + BCS .2 + STA WBUF+1,X + LDA #$A0 Put a blank + STA WBUF,X To extend line +.1 INX Move ahead +.2 CLC Return + RTS +*-------------------------------- +* CONTROL-X: ABORT EDIT COMMAND +*-------------------------------- +E.ABORT + JSR E.DISPLAY.LINE + LDA #$DC Backslash + JSR MY.COUT + JMP GNL Get next command +*-------------------------------- +* CONTROL-@: CLEAR TO EOL +*-------------------------------- +E.ZAP LDA #0 EOL mark + LDX ED.PNTR + STA WBUF,X + CLC + RTS Carry clear +*-------------------------------- +* INPUT CHAR WHERE CURSOR SHOULD BE +*-------------------------------- +E.INPUT + LDY ED.BEGLIN + INX + TXA + DEX + DEY + SEC +.1 INY + SBC SCREEN.WIDTH + BCS .1 + ADC SCREEN.WIDTH + JSR IO.HTAB HTAB (A) + TYA + JSR IO.VTAB + JSR READ.KEY.WITH.CASE + STA CURRENT.CHAR + RTS +*-------------------------------- +* DETERMINE IF AT TAB STOP YET +* RETURN .EQ. IF AT A TAB STOP +* .CS. IF PAST LAST TAB STOP +* .CC. IF BEFORE A TAB STOP +*-------------------------------- +E.CHECK.TAB + TXA Column position + CLC + ADC #3 + LDY #0 +.1 CMP TAB.SETTINGS,Y + BCC .2 + BEQ .2 + INY + CPY #5 + BCC .1 +.2 RTS +*-------------------------------- +* CONTROL-I -- CLEAR TO TAB STOP +*-------------------------------- +E.TABI LDX ED.PNTR + LDA #" " + STA CURRENT.CHAR +.1 JSR E.CHECK.TAB + BCS .2 ...REACHED TAB STOP + JSR E.PUT.CHARACTER + BCC .1 ...ALWAYS +.2 JMP E.PUT.CHARACTER One more space +*-------------------------------- +E.TOGGLE + JSR IO.CASE.TOGGLE + CLC + RTS +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/scmasm.s.elines +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/SCMASM.S.EXP.txt b/SCMASM.30/SCMASM.S.EXP.txt new file mode 100644 index 00000000..241d1d49 --- /dev/null +++ b/SCMASM.30/SCMASM.S.EXP.txt @@ -0,0 +1,414 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* EXPRESSION CRACKER +*------------------------------- +EXPR.DEFINED + JSR EXPR + BMI .1 + RTS +.1 JMP UNDF +*-------------------------------- +OPERATOR.CHARS + .AS "^!|&<=>/*)], " +OPERATOR.CHARS.SIZE .EQ *-OPERATOR.CHARS +*-------------------------------- +OPERATOR.INDEX + .HS 0C.0A.0A.08.0E.10.12.06.04.FF.FF.FF.FF +* ^ ! | & < = > / * ) ] , SPC +*-------------------------------- +OPERATOR.TABLE + .DA EXP.SUBTRACT-1 0 FOR -<=> + .DA EXP.ADD-1 2 FOR + + .DA EXP.MULTIPLY-1 4 FOR * + .DA EXP.DIVIDE-1 6 FOR / + .DA EXP.AND-1 8 FOR & + .DA EXP.ORA-1 A FOR !| + .DA EXP.EOR-1 C FOR ^ + .DA EXP.LESS-1 E FOR < + .DA EXP.EQUAL-1 10 FOR = + .DA EXP.GREATER-1 12 FOR > +*-------------------------------- +ERBA3 JMP ERBA +*-------------------------------- +EXPR JSR GNNB GET NEXT NON-BLANK + BCS ERBA3 NO EXPRESSION ON LINE + JSR BACKUP.CHAR.PNTR +*-------------------------------- +EXP1 JSR ZERO.EXP.VALUE + STA EXP.NEW NEW EXPRESSION FLAG = 0 + STA EXP.UNDEF ZERO UNDEF FLAG + LDX #$40 INIT FWD REF FLAG + STX EXP.FWDREF +*-------------------------------- +EXP2 LDX #0 SET OPERATOR=0 FOR + + JSR GNC.UC + BCS .3 END OF LINE + CMP #'- MINUS + BEQ .6 X=0 FOR MINUS OR RELOPS + LDX #2 X=2 FOR ADDITION + CMP #'+ ADD + BEQ .6 + LDY EXP.NEW NOT + OR - + BEQ .7 BUT IT IS NEW EXPR + LDX #OPERATOR.CHARS.SIZE-1 +.1 LDA OPERATOR.CHARS,X + CMP CURRENT.CHAR + BEQ .2 + DEX + BPL .1 + JMP ERBA +*---FOUND OP OR TERM CHAR-------- +.2 LDA OPERATOR.INDEX,X + BPL .5 ...OPERATOR +*---END OF EXPRESSION----------- + JSR BACKUP.CHAR.PNTR +.3 LDY EXP.UNDEF UNDEF FLAG + BPL .4 + JSR ZERO.EXP.VALUE + TYA RECOVER UNDEF STATUS +.4 RTS +*-------------------------------- +.5 TAX +.6 JSR GNC.UC +.7 INC EXP.NEW NOT A NEW EXPRESSION ANYMORE + LDA OPERATOR.TABLE+1,X + PHA + LDA OPERATOR.TABLE,X + PHA +*------------------------------- +* GET OPERAND +*------------------------------- +GET.OPERAND + JSR ZERO.SYM.VALUE + LDA CURRENT.CHAR + CMP #$30 FIRST CHAR OF OPERAND + BCC .3 PUNCTUATION + CMP #$3A + BCS .2 MIGHT BE LETTER, TRY LABEL + JSR DECN CONVERT DECIMAL NUMBER +.15 JMP BACKUP.CHAR.PNTR +*---TRY A LABEL------------------ +.2 JSR PACK TRY LABEL + BCC .4 NO GOOD + JSR STSRCH LOOK UP THE VALUE + LDY #6 UPDATE FWD REF FLAG + >SYM LDA,STPNTR + AND EXP.FWDREF + STA EXP.FWDREF + BCC .1 DEFINED LABEL + ROR EXP.UNDEF UNDEFINED, MAKE FLAG NEGATIVE +.1 RTS +*---TRY LOCAL LABEL-------------- +.3 CMP #'. + BEQ .2 LOCAL LABEL +*---TRY CONSTANTS---------------- + LDX #3 3-->HEX CONSTANT + CMP #'$ + BEQ .5 HEX CONSTANT + DEX 2-->OCT CONSTANT + CMP #'&' + BEQ .5 ...OCTAL + LDX #0 0-->BIN CONSTANT + CMP #'% BINARY CONSTANT + BEQ .5 ...BINARY +*---TRY LITERALS----------------- + CMP #'' (X = 0) + BEQ .6 LITERAL + CMP #'" LITERAL WITH HIGH BIT SET + BEQ .9 +*---TRY STAR--------------------- + CMP #'* + BNE .4 ...NONE OF THE ABOVE, ERROR + LDX #3 VALUE IS CURRENT LOCATION +.7 LDA ORGN,X + STA SYM.VALUE,X + DEX + BPL .7 + RTS +*---INVALID OPERAND-------------- +.4 JMP ERBA BAD ADDRESS ERROR +*---HEX/OCT/BIN CONSTANT-------- +.5 JSR HEX.OCT.BIN.DGT $ABCD, &777, %1010 + BCC .4 NO, ERROR BAD ADDRESS +.8 JSR HEX.OCT.BIN.DGT.1 GET ANOTHER DIGIT + BCS .8 + BCC .15 ...ALWAYS +*---TICK & QUOTE LITERALS------- +.9 LDX #$80 HIBIT=1 +.6 STX SYM.VALUE + STA DGTCNT SAVE ' OR " FOR OPTIONAL TERMCHAR + JSR GNC GET FOLLOWING CHAR + BCS .4 END OF LINE + ORA SYM.VALUE SET HIGH BIT + STA SYM.VALUE + JSR GNC SEE IF CLOSING QUOTE + CMP DGTCNT (IT IS OPTIONAL) + BNE .15 NO, BACK UP CHAR PNTR + RTS +*------------------------------- +* IF NEXT CHAR IS VALID DIGIT, +* APPEND IT TO CURRENT VALUE +* +* (X) DETERMINES BASE: 0-->2, 2-->8, 3-->16 +*------------------------------- +HEX.DIGIT + LDX #3 +HEX.OCT.BIN.DGT + STX BASE.INDEX +HEX.OCT.BIN.DGT.1 +.1 JSR GNC.UC IGNORE CASE + CMP #'.' ALLOW PERIODS + BEQ .1 ...BUT IGNORE THEM + EOR #$30 + CMP #$0A + BCC .3 ...0-9, TEXT VALIDITY + ADC #$88 ...MIGHT BE A...F +.2 CMP #$FA + BCC .5 NOT A-F EITHER, RETURN CARRY CLEAR + AND #$0F TRIM HEX A...F +.3 LDX BASE.INDEX + CMP BASE.TABLE,X CHECK REAL RANGE + BCS .2 ...NOT VALID, CLR CARRY WITH 'CMP #$FA' + PHA SAVE DIGIT +.4 JSR ASL.SYM.VALUE + DEX MAKE ROOM FOR DIGIT + BPL .4 + PLA GET DIGIT + ORA SYM.VALUE MERGE WITH PREVIOUS + STA SYM.VALUE + SEC FLAG GOT A DIGIT +.5 RTS +*-------------------------------- +BASE.TABLE + .DA #2,#2,#8,#16 +ASL.SYM.VALUE + CLC +ROL.SYM.VALUE + ROL SYM.VALUE + ROL SYM.VALUE+1 + ROL SYM.VALUE+2 + ROL SYM.VALUE+3 + RTS +*-------------------------------- +ZERO.EXP.VALUE + LDA #0 + STA EXP.VALUE + STA EXP.VALUE+1 + STA EXP.VALUE+2 + STA EXP.VALUE+3 + RTS +*-------------------------------- +ZERO.EXP.VALUE64 + LDA #0 + STA EXP.VALUE64 + STA EXP.VALUE64+1 + STA EXP.VALUE64+2 + STA EXP.VALUE64+3 + RTS +*-------------------------------- +ZERO.SYM.VALUE + LDA #0 + STA SYM.VALUE + STA SYM.VALUE+1 + STA SYM.VALUE+2 + STA SYM.VALUE+3 + RTS +*-------------------------------- +EXP.AND + LDX #3 +.1 LDA EXP.VALUE,X + AND SYM.VALUE,X + STA EXP.VALUE,X + DEX + BPL .1 + JMP EXP2 +*-------------------------------- +EXP.ORA + LDX #3 +.1 LDA EXP.VALUE,X + ORA SYM.VALUE,X + STA EXP.VALUE,X + DEX + BPL .1 + JMP EXP2 +*-------------------------------- +EXP.EOR + LDX #3 +.1 LDA EXP.VALUE,X + EOR SYM.VALUE,X + STA EXP.VALUE,X + DEX + BPL .1 + JMP EXP2 +*-------------------------------- +EXP.ADD + CLC PLUS + LDX #-4 +.1 LDA EXP.VALUE+4,X + ADC SYM.VALUE+4,X + STA EXP.VALUE+4,X + INX + BNE .1 + JMP EXP2 +*-------------------------------- +EXP.SUBTRACT + JSR EXP.SUBTRACTION + JMP EXP2 +*-------------------------------- +EXP.SUBTRACTION + SEC + LDX #-4 +.7 LDA EXP.VALUE+4,X + SBC SYM.VALUE+4,X + STA EXP.VALUE+4,X + INX + BNE .7 + RTS +*-------------------------------- +EXP.LESS + JSR EXP.SUBTRACTION + LDA EXP.VALUE+3 + BMI EXP.TRUE +EXP.FALSE + CLC +EXP.TRUE.OR.FALSE + JSR ZERO.EXP.VALUE + ROL EXP.VALUE + JMP EXP2 +*-------------------------------- +EXP.EQUAL + JSR EXP.SUBTRACTION + JSR TEST.EXP.VALUE + BNE EXP.FALSE +EXP.TRUE + SEC + BCS EXP.TRUE.OR.FALSE +*-------------------------------- +TEST.EXP.VALUE.ZP + LDA #0 + .HS 2C +TEST.EXP.VALUE + LDA EXP.VALUE + ORA EXP.VALUE+1 + ORA EXP.VALUE+2 + ORA EXP.VALUE+3 + RTS +*-------------------------------- +EXP.GREATER + JSR EXP.SUBTRACTION + JSR TEST.EXP.VALUE + BEQ EXP.FALSE + LDA EXP.VALUE+3 LOOK AT SIGN BIT + BMI EXP.FALSE + BPL EXP.TRUE +*------------------------------- +EXP.DIVIDE + JSR EXP.DIVISION + JMP EXP2 +*-------------------------------- +EXP.DIVISION + JSR ZERO.EXP.VALUE64 + LDY #32 32 BITS +.1 ASL EXP.VALUE SHIFT DIVIDEND/QUOTIENT LEFT + ROL EXP.VALUE+1 + ROL EXP.VALUE+2 + ROL EXP.VALUE+3 + ROL EXP.VALUE64 SHIFT PARTIAL DIVIDEND LEFT + ROL EXP.VALUE64+1 + ROL EXP.VALUE64+2 + ROL EXP.VALUE64+3 + SEC SUBTRACT DIVISOR FROM PARTIAL DIVIDEND + LDA EXP.VALUE64 + SBC SYM.VALUE + PHA SAVE LO-BYTE OF DIFFERENCE ON STACK + LDA EXP.VALUE64+1 + SBC SYM.VALUE+1 + PHA + LDA EXP.VALUE64+2 + SBC SYM.VALUE+2 + PHA + LDA EXP.VALUE64+3 + SBC SYM.VALUE+3 + BCC .2 REMAINDER TOO SMALL + INC EXP.VALUE SET BIT IN QUOTIENT + STA EXP.VALUE64+3 HI-BYTE OF REMAINDER + PLA RETRIEVE NEXT BYTE OF REMAINDER + STA EXP.VALUE64+2 + PLA + STA EXP.VALUE64+1 + PLA + STA EXP.VALUE64 + BCS .3 +.2 PLA STACK BACK TO NORMAL + PLA + PLA +.3 DEY NEXT BIT + BNE .1 + RTS +*-------------------------------- +EXP.MULTIPLY + JSR ZERO.EXP.VALUE64 + LDY #32 32-BIT MULTIPLY +.1 LDA EXP.VALUE CHECK LSB OF MULTIPLIER + LSR + BCC .2 IF 0, DON'T ADD MULTIPLICAND + CLC ADD MULTIPLICAND + LDA EXP.VALUE64 + ADC SYM.VALUE + STA EXP.VALUE64 + LDA EXP.VALUE64+1 + ADC SYM.VALUE+1 + STA EXP.VALUE64+1 + LDA EXP.VALUE64+2 + ADC SYM.VALUE+2 + STA EXP.VALUE64+2 + LDA EXP.VALUE64+3 + ADC SYM.VALUE+3 + STA EXP.VALUE64+3 +.2 ROR EXP.VALUE64+3 + ROR EXP.VALUE64+2 + ROR EXP.VALUE64+1 + ROR EXP.VALUE64 + ROR EXP.VALUE+3 + ROR EXP.VALUE+2 + ROR EXP.VALUE+1 + ROR EXP.VALUE + DEY + BNE .1 + JMP EXP2 +*------------------------------- +* MGO COMMAND +*------------------------------- +MGO JSR EXPR.DEFINED CRACK EXPRESSION + JMP (EXP.VALUE) ENTER USER'S PROGRAM +*-------------------------------- +* VAL COMMAND +*-------------------------------- +VAL JSR EXPR.DEFINED GET VALUE OF EXPRESSION + LDA #'$' + JSR CHO + JSR P.EXP.VALUE + LDA #'=' + JSR CHO + JSR ZERO.SYM.VALUE + TAX X=0 + LDA #10 + STA SYM.VALUE +.1 JSR EXP.DIVISION + LDA EXP.VALUE64 REMAINDER + PHA + INX + JSR TEST.EXP.VALUE + BNE .1 +.2 PLA + ORA #'0' + JSR CHO + DEX + BNE .2 + JMP CRLF +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/scmasm.s.exp +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/SCMASM.S.FNDREP.txt b/SCMASM.30/SCMASM.S.FNDREP.txt new file mode 100644 index 00000000..f3aeb707 --- /dev/null +++ b/SCMASM.30/SCMASM.S.FNDREP.txt @@ -0,0 +1,407 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* FIND AND LIST COMMANDS +*-------------------------------- +LIST +FIND JSR GET.KEY.STRING + JSR PARSE.LINE.RANGE + JSR HANDLE.REPLACE.OPTIONS +.1 JSR GET.LINE.TO.WBUF + BCC .2 + RTS +.2 JSR FIND.KEY.IN.WBUF + BCC .1 KEY NOT IN WBUF + LDA A1L SET UP POINTER FOR LIST + LDX A1H + JSR LIST.LINE.AX + JMP .1 +*-------------------------------- +* PARSE INTO FREE MEMORY +*-------------------------------- +GET.KEY.STRING + LDA #KBUF + STA KEY.ADDR + LDA /KBUF + STA KEY.ADDR+1 +GET.KEY2 + JSR GNNB GET NEXT NON-BLANK + STA DLIM FOR DELIMITER + BCS .4 EOL + CMP #', + BEQ .4 COMMA + CMP #'. PERIOD + BEQ .4 + EOR #$30 + CMP #10 + BCC .4 DIGIT + LDY #0 +.1 STY PNTR + JSR GNC MOVE STRING + BCS .2 END OF LINE + CMP DLIM + BEQ .2 END OF STRING + LDY PNTR + STA (KEY.ADDR),Y + INY + CPY #39 SEE IF STRING FITS + BCC .1 YES, KEEP GOING + LDY #QSTRLNG NO, STRING TOO LONG + JMP HARD.ERROR +.2 LDY PNTR + LDA #0 + STA (KEY.ADDR),Y + SEC WE FOUND IT + RTS +.4 LDA #0 + STA PNTR + CLC DIDN'T FIND IT + JMP BACKUP.CHAR.PNTR +*-------------------------------- +* GET NEXT LINE INTO WBUF +* RETURN CARRY CLEAR IF SUCCESSFUL +* CARRY SET IF BEYOND +* X = LENGTH OF LINE +*-------------------------------- +GET.LINE.TO.WBUF + LDA SRCP + STA A1L SAVE POINTER FOR LIST + LDA SRCP+1 + STA A1H + JSR CMP.SRCP.ENDP END OF RANGE YET? + BCS .2 ...YES, FINISHED + JSR GET.LINE.NUMBER + LDY #0 START AT BEGINNING OF WBUF + JSR CONVERT.LINE.NUMBER.STORE PUT CONVERTED # AT WBUF,Y + LDA #$A0 APPEND A SPACE AFTER LINE NUMBER + STA WBUF,Y + INY + TYA + TAX +.1 JSR NTKN BYTE FROM PROGRAM + STA WBUF,X + INX + TAY TEST CHAR + BNE .1 END OF LINE + CLC FLAG SUCCESSFUL +.2 RTS +*-------------------------------- +* LIST LINE POINTED TO BY +*-------------------------------- +LIST.LINE.AX + STA SRCP + STX SRCP+1 +*-------------------------------- +LIST.CURRENT.LINE + JSR CRLF PRINT CARRIAGE RETURN + JSR SPC SPACE + LDA PROMPT.FLAG + BEQ .1 ...NO SPACE SINCE NOT "H" + JSR SPC +.1 JSR GET.LINE.NUMBER BODY + JSR CONVERT.LINE.NUMBER.PRINT + LDA #$20 SPACE +.2 JSR CHO PRINT CHAR + JSR GET.NEXT.SOURCE.CHAR + BNE .2 NOT END YET + RTS FINISHED +*-------------------------------- +* FIND KEY IN WBUF +* RETURN WITH CARRY CLEAR IF NO MATCH. +* RETURN WITH CARRY SET IF MATCH, AND WITH +* (PNTR) = INDEX OF START OF MATCH +* (X) = INDEX OF LAST CHAR MATCHED + 1 +*-------------------------------- +FIND.KEY.IN.WBUF + JSR FIND.START.OF.LINE.IN.WBUF + LDA PNTR + BNE .1 NON-NULL KEY STRING + LDA DLIM If delimiter is slash, list + CMP #'/' only major labels + BEQ .3 ...it is + SEC ...no string, so SIGNAL MATCH + RTS +.3 LDA WBUF,X GET FIRST CHAR + JSR ELIMINATE.CASE + JMP CHECK.LETTER +.1 LDY #39 MAP SEARCH KEY INTO UPPER CASE +.2 LDA (KEY.ADDR),Y ...IF LC.FLAG IS ON + JSR ELIMINATE.CASE.MAYBE + STA (KEY.ADDR),Y + DEY + BPL .2 +FIND.KEY.IN.WBUF2 + LDY #0 START AT FIRST CHAR OF KEY +.1 STY KEY.PNTR CURRENT STARTING POINT IN KEY +.2 STX BUF.PNTR CURRENT STARTING POINT IN BUFFER +.3 LDA (KEY.ADDR),Y NEXT CHAR FROM KEY + BEQ .6 END OF KEY, IT MATCHES + CMP WILD.CARD NORMALLY CONTROL-W + BEQ .8 YES + LDA WBUF,X NEXT CHAR FROM BUFFER + BEQ .5 END OF BUFFER, DID NOT MATCH + JSR ELIMINATE.CASE.MAYBE MAP INTO UPPER CASE IS NEEDED + CMP (KEY.ADDR),Y COMPARE WITH KEY CHAR + BNE .4 NO MATCH + INY ADVANCE KEY POINTER + INX ADVANCE BUFFER POINTER + BNE .3 ...ALWAYS +*-------------------------------- +.4 LDY KEY.PNTR TRY AGAIN FURTHER INTO BUFFER + LDX BUF.PNTR + INX + BNE .2 ...ALWAYS +*-------------------------------- +.5 LDA $C000 + CMP #$8D ALLOW 'ABORT' WITH + BEQ .11 + CLC SIGNAL NO MATCH + RTS +*-------------------------------- +.6 LDA KEY.PNTR SEE IF IN FIRST SEGMENT OF KEY + BNE .7 NO + LDA BUF.PNTR YES + STA PNTR +.7 SEC SIGNAL MATCH + RTS +*-------------------------------- +.8 LDA KEY.PNTR SEE IF IN FIRST SEGMENT OF KEY + BNE .9 NO + LDA BUF.PNTR YES + STA PNTR +.9 INY ADVANCE KEY POINTER + LDA (KEY.ADDR),Y PEEK AT NEXT CHAR OF KEY + BNE .1 NOT AT END YET +.10 LDA WBUF,X AT END, SO SCAN TO END OF BUFFER + BEQ .6 FOUND END, AND ALL MATCHES + INX ADVANCE BUFFER POINTER + BNE .10 ...ALWAYS +*-------------------------------- +.11 JMP SOFT HE ABORTED +*-------------------------------- +* REPLACE COMMAND +*-------------------------------- +REPLACE + JSR GET.KEY.STRING + BCC R.ERR1 (SYN ERROR) + LDA PNTR NULL SEARCH FAILS + BEQ R.ERR1 + JSR BACKUP.CHAR.PNTR USE DELIMITER OVER AGAIN + LDA #KBUF+40 + STA KEY.ADDR + LDA /KBUF+40 + STA KEY.ADDR+1 SET UP CALL + JSR GET.KEY2 + BCC R.ERR1 (SYN ERROR) + STY REPLACE.LENGTH + JSR PARSE.LINE.RANGE + JSR HANDLE.REPLACE.OPTIONS + LDA #KBUF FOR SEARCH + STA KEY.ADDR + LDA /KBUF + STA KEY.ADDR+1 + LDA #1 + STA PNTR PNTR MUST BE > 0 FOR SEARCH +.1 JSR GET.LINE.TO.WBUF + BCS .5 FINISHED + STX WBUF.LENGTH + JSR FIND.KEY.IN.WBUF + BCC .1 + LDA #0 + STA CHANGE.CNT (DEF IS EQ) +.2 TXA COMPUTE # CHARS IN TARGET FIELD + SEC + SBC PNTR + STA SOURCE.LENGTH + STX MATCH.END + JSR REPLACE.REPLACE + BCS .5 NEITHER "Y" NOR "N" + BNE .3 THEY HIT 'N' + INC CHANGE.CNT + LDX MATCH.END + BNE .4 ...ALWAYS +.3 LDX PNTR MATCH BEGINNING + INX +1 +.4 JSR FIND.KEY.IN.WBUF2 + BCS .2 LOOP IF ANOTHER + LDA CHANGE.CNT ANY CHANGES? + BEQ .1 NO - TRY NEXT LINE + JSR NML PUT LINE BACK + LDA WBUF If replacement line was null, + BEQ .6 then just lshow line number + LDA LINE.END AND LIST + LDX LINE.END+1 + JSR LIST.LINE.AX + JMP .1 TRY NEXT LINE +.5 RTS FINISHED +.6 LDA WBUF+1 + STA CURRENT.LINE.NUMBER + LDA WBUF+2 + STA CURRENT.LINE.NUMBER+1 + JSR CRLF + JSR CONVERT.LINE.NUMBER.PRINT + JMP .1 +*-------------------------------- +R.ERR1 JMP SYNX MISSING STRING +R.ERR2 LDY #QREPLNG REP STRNG TOO LONG + JMP HARD.ERROR +*-------------------------------- +* A MATCH IS FOUND, MAYBE REPLACE +* RETURNS: CARRY ZERO +* Q CS NE QUIT +* N CC NE NO CHG +* Y CC EQ CHANGE MADE +*-------------------------------- +REPLACE.REPLACE + LDA AUTO.FLAG + BMI .40 - = AUTO MODE, + = VERIFY MODE + JSR PRINT.AND.PROMPT + BNE .99 Q,N EXITS +.40 SEC + LDA REPLACE.LENGTH + SBC SOURCE.LENGTH + BCC .60 (IF SHORTER) + BEQ .50 (IF EQUAL ) +*-------------------------------- +* REPLACE IS LONGER - MAKE SPACE +* ACC IS REP.LEN-SRC.LEN +*-------------------------------- + CLC + ADC WBUF.LENGTH + BCS .45 OVER 256 LEN + CMP #WBUF.MAX + BCC .51 +.45 JMP R.ERR2 TOO LONG ERR +.51 TAX + LDY WBUF.LENGTH + STX WBUF.LENGTH (RESET IT) +.52 LDA WBUF,Y + STA WBUF,X + DEX + DEY + CPY MATCH.END + BCS .52 + INX + STX MATCH.END +*-------------------------------- +* MOVE STRING INTO GAP +*-------------------------------- +.50 LDX PNTR MOVE REPLACEMENT STRING INTO GAP + LDY #0 POINT AT REPLACEMENT STRING +.55 LDA KBUF+40,Y NEXT CHAR FROM REP. STRING + BEQ .57 END OF REP. STRING + STA WBUF,X STORE IN GAP + INX + INY + BNE .55 ...ALWAYS +.57 CLC SIGNAL SUCCESS + LDA #0 (CC,EQ) +.99 RTS +*-------------------------------- +* REPLACE IS SHORTER - REMOVE EXTRA +*-------------------------------- +.60 LDA PNTR + ADC REPLACE.LENGTH + TAX + LDY MATCH.END + STX MATCH.END (RESET IT) +.1 LDA WBUF,Y + STA WBUF,X + INY + INX + CPX WBUF.LENGTH + BCC .1 + STX WBUF.LENGTH (RESET THIS TOO) + BCS .50 ...ALWAYS +*-------------------------------- +* PRINT LINE AND GET Y,N,Q +* RETURNS: CARRY ZERO +* Q CS NE +* N CC NE +* Y CS EQ +*-------------------------------- +PRINT.AND.PROMPT + JSR P.RETURN PRINT + LDX #0 +.1 LDA WBUF,X + BEQ .4 EOL? + ORA #$80 + CMP #$A0 SKIP CONTROL + BCC .3 + CPX PNTR + BCC .2 + CPX MATCH.END + BCS .2 + JSR ELIMINATE.CASE + AND #$3F ...DISPLAY IN INVERSE +.2 JSR IO.COUT +.3 INX + BNE .1 NEXT CHAR +.4 JSR MON.CLREOL + LDY #QREPPRMT PRINT "REPLACE? " +YES.OR.NO + JSR QT.OUT + JSR READ.KEY.WITH.CASE + CMP #$A0 CONTROL CHAR? + BCC .2 ...YES, DO NOT ECHO + JSR MY.COUT + AND #$DF NOW IGNORE CASE +.2 CMP #'N+$80 NO: RETURN CC, NE + BEQ .1 ..."N" + CMP #'Y+$80 YES: RETURN CS, EQ + SEC NEITHER: CS, NE + RTS +.1 LSR WAS = N = $CE, SO CLEAR CARRY, SET NE + RTS +*-------------------------------- +* SET FLAGS FROM CHAR IN ACC +* CHAR FLAG MEANING +* "A" AUTO.FLAG +=VERIFY, -=AUTO +* "U" LC.FLAG +=AS TYPED, -=ACCEPT EITHER CASE +* +* RETURN CS -> VALID OPTION +* CC -> NOT AN OPTION +*-------------------------------- +HANDLE.REPLACE.OPTIONS + LSR AUTO.FLAG +=VERIFY MODE + LSR LC.FLAG +=CASE AS TYPED +.1 JSR GNNB GET NEXT BYTE FROM INPUT LINE + BCS .3 END OF LINE + JSR ELIMINATE.CASE MAP LOWER TO UPPER + CMP #'A AUTO MODE? + BNE .2 NO + ROR AUTO.FLAG YES, SET SIGN BIT FROM CARRY +.2 CMP #'U ACCEPT BOTH CASES? + BNE .1 NO + ROR LC.FLAG YES, SET SIGN BIT FROM CARRY + BNE .1 ...ALWAYS +.3 RTS +*-------------------------------- +* MAP LOWER CASE INTO UPPER CASE +*-------------------------------- +ELIMINATE.CASE.MAYBE + BIT LC.FLAG + BPL LCUC3 DON'T DO IT +ELIMINATE.CASE + PHA SAVE ORIGINAL CHAR + ORA #$80 MAKE CANONICAL FORM + CMP #$E0 IN LOWER CASE REGION? + PLA RESTORE ORIGINAL CHAR + BCC LCUC3 ...NOT LOWER CASE REGION + AND #$DF ...LC, MAP TO UPPER CASE +LCUC3 RTS +*-------------------------------- +* LOAD CURRENT LINE NUMBER FROM SRCP +*-------------------------------- +GET.LINE.NUMBER + JSR GNB SKIP LENGTH + JSR GNB GET LINE NUMBER + STA CURRENT.LINE.NUMBER + JSR GNB + STA CURRENT.LINE.NUMBER+1 + RTS +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/scmasm.s.fndrep +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/SCMASM.S.IOSTD.txt b/SCMASM.30/SCMASM.S.IOSTD.txt new file mode 100644 index 00000000..595e264f --- /dev/null +++ b/SCMASM.30/SCMASM.S.IOSTD.txt @@ -0,0 +1,115 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* I/O VECTORS -- 3 BYTES EACH +*-------------------------------- +IO.INIT JMP S.IO.INIT +IO.WARM JMP S.IO.WARM +READ.KEY.WITH.CASE JMP S.READ.KEY.WITH.CASE +GET.HORIZ.POSN LDA CH + RTS +IO.HOME JMP MON.HOME +IO.CLREOL JMP MON.CLREOL +IO.CLREOP JMP MON.CLREOP +IO.UP JMP MON.UP +IO.DOWN JMP MON.LF +IO.LEFT JMP MON.BS +IO.RIGHT JMP MON.ADVANC +IO.COUT JMP MON.COUT +IO.PICK.SCREEN LDA (BASL),Y + RTS +IO.HTABX STX CH + RTS +IO.HTAB STA CH + RTS +IO.VTAB JMP S.IO.VTAB +IO.CASE.TOGGLE LDA LC.MODE + EOR #$FF + STA LC.MODE + RTS +*-------------------------------- +* VARIABLE LENGTH ROUTINES +* (ENTERED THROUGH VECTORS) +*-------------------------------- +S.IO.VTAB + STA CV + JMP MON.VTAB +*-------------------------------- +S.IO.INIT + LDA #40 + STA SCREEN.WIDTH + JSR MON.SETKBD + JSR MON.SETVID + JSR MON.INIT + JMP MON.HOME +*-------------------------------- +S.IO.WARM + CLD + LDX CV + JSR MON.INIT + STX CV + STX LC.MODE POSITIVE VALUE + JSR MON.VTAB + RTS +*-------------------------------- +* READ KEY WITH CASE CONTROL +*-------------------------------- +S.READ.KEY.WITH.CASE + LDA $BE43 See if "EXEC" in progress + BMI .1 ...Yes, use straight input + LDA LC.MODE + BMI .2 Yes, use fancy translation +.1 JSR MON.RDKEY + ORA #$80 Make sure it looks right + CLC SIGNAL "NO OPEN APPLE PRESSED" + RTS +*-------------------------------- +.2 + LDY CH Set up cursor + LDA (BASL),Y Char from screen + PHA + CMP #$E0 ELIMINATE CASE + BCC .25 + AND #$DF +.25 AND #$3F Make it flash + ORA #$40 + STA (BASL),Y + PLA + JSR MON.READCH + BIT $C063 Shift key down? + BPL .4 Yes + CMP #$C0 No, lower case if letter + BCC .3 + ORA #$20 + CLC SIGNAL "NO OPEN APPLE PRESSED" +.3 RTS +*-------------------------------- +.4 CMP #$C0 Shift key down + BCC .8 Not a letter key + BEQ .7 Shift-P + CMP #$DD Shift-M + BEQ .5 Yes + CMP #$DE Shift-N + BNE .6 No +.5 AND #$EF Make capital-M or -N +.6 CLC SIGNAL "NO OPEN APPLE PRESSED" + RTS +*-------------------------------- +.7 LDA #$D0 Make capital-P + CLC SIGNAL "NO OPEN APPLE PRESSED" + RTS +*-------------------------------- +.8 CMP #$87 Look for control-shift-A thru -F + BCS .10 No + CMP #$81 Control-A + BCC .10 No, control-P + BNE .9 No, control-B thru -F + LDA #$C0-$58-1 Control-shift-A = at-sign (@) +.9 ADC #$58 +.10 CLC SIGNAL "NO OPEN APPLE PRESSED" + RTS +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/scmasm.s.iostd +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/SCMASM.S.LDR.txt b/SCMASM.30/SCMASM.S.LDR.txt new file mode 100644 index 00000000..c58ece58 --- /dev/null +++ b/SCMASM.30/SCMASM.S.LDR.txt @@ -0,0 +1,222 @@ +NEW + AUTO 3,1 +*-------------------------------------- +SPTR .EQ $00 +DPTR .EQ $02 +*-------------------------------- +MLI.UNIT .EQ $BF30 +MLI.BITMAP .EQ $BF58 +MLI.PREFIX.FLAG .EQ $BF9A +*-------------------------------- +MON.CROUT .EQ $FD8E +SETNORM .EQ $FE84 +*-------------------------------- +* sys file execution +* --------- --------- +* 2000-21FF LOADER +* 2200-4AFF 8000-A8FF S-C MACRO ASSEMBLER with 40-col driver +* A900-A9FF additional space for longer drivers +* 4B00-5FFF AA00-BEFF S-C ProDOS Interface +* 6000-60FF A800-A8FF //E 80-COLUMN DRIVER +* 6100-61FF A800-A8FF STB80 DRIVER +* 6200-63FF A800-A9FF VIDEX VIDEOTERM DRIVER +* 6400-65FF A800-A9FF VIDEX ULTRATERM DRIVER +* 6600-71FF D400-DFFF ASM PARTICULAR +*-------------------------------- +* BLOAD SCASM (loader and Macro and 40-col driver) +* BLOAD B.SCI (ProDOS Interpreter) +* BLOAD B.IO.TWO.E (//E 80-COLUMN DRIVER) +* BLOAD B.IO.STB80 +* BLOAD B.IO.VIDEX +* BLOAD B.IO.ULTRA +* BSAVE SCASM.SYS,A$2000,L$4600 +*-------------------------------- + .MA MOVE + LDA /]1 DESTINATION + LDY /]2 SOURCE BEGINNING + LDX /]3-]2+255 # PAGES + JSR MOVE + .EM +*-------------------------------- +STARTUP.SC.MACRO + JMP LOAD.SC +*-------------------------------- +DRIVER.FLAG .HS 00 +*-------------------------------- +LOAD.SC + JSR SELECT.DRIVER + >MOVE $AA00,$4B00,$5FFF + >MOVE $8000,$2200,$4AFF + LDA $C083 + LDA $C083 + >MOVE $D400,$6600,$71FF + LDA $C082 + JSR LOAD.DRIVER +*-------------------------------- +*---GET SCREEN TO NORMAL 40------ +* LDA #$15 CTRL-U, TURNS OFF 80-COLUMN +* JSR MON.COUT +* JSR SETNORM +* JSR MON.INIT +* JSR MON.HOME +*---ESTABLISH RAM BITMAP--------- + LDX #BITMAP.SIZE-1 +.2 LDA MY.BITMAP,X + STA MLI.BITMAP,X + DEX + BPL .2 +*---BUILD $3D0-3FF--------------- + LDX #5 +.3 LDA IMAGE.3D0,X + STA $3D0,X + DEX + BPL .3 + LDX #10 +.4 LDA IMAGE.3F0,X + STA $3F0,X + DEX + BPL .4 +*---Establish HIMEM page--------- + LDA #$74 + STA SCI.HIMEM.PAGE + STA SCI.BUFFER.PAGES+2 EXEC BUFFER + CLC + ADC #4 + STA SCI.BUFFER.PAGES BUF 0 + ADC #4 + STA SCI.BUFFER.PAGES+1 BUF 1 +*---SET A NULL PREFIX------------ + LDA #0 + STA MLI.PREFIX.FLAG +*---SET SLOT/DRIVE DEFAULTS------ + LDA MLI.UNIT + LSR + LSR + LSR + LSR + CMP #$08 + AND #$07 + STA SCI.SLOT + LDA #1 + ADC #0 + STA SCI.DRIVE +*-------------------------------- +IIGS SEC + JSR $FE1F + BCS .2 ...NOT IIGS +*-------------------------------- + LDY #GS.NUM-1 +.1 LDA GS.NEW,Y + STA FAKE.MONITOR,Y + DEY + BPL .1 +*---START UP ProDOS-------------- +.2 JMP $8000 +*-------------------------------- +GS.NEW LDA #" " COVER UP THE DOLLAR SIGN + STA WBUF + LDA WBUF-1,X LOOK FOR "HEXNUM=" COMMAND + CMP #"=" + BEQ .1 ...YES, DON'T APPEND " Q" + LDA #" " + STA WBUF,X APPEND " Q" + LDA #"Q" + STA WBUF+1,X +.1 JMP $FF70 +GS.NUM .EQ *-GS.NEW +*-------------------------------- +IMAGE.3D0 + JMP SCI.STARTUP $3D0 + JMP SCI.STARTUP $3D3 +IMAGE.3F0 + .DA $FA59 'BRK' VECTOR + .DA SCI.STARTUP,#$BE^$A5 RESET VECTOR + JMP SCI.RTS &-VECTOR + JMP SCI.RTS Y-VECTOR +*-------------------------------- +MY.BITMAP + .HS C3.00.00.00.00.00.00.00 0000-3FFF + .HS 00.00.00.00.00.00.00.00 4000-7FFF + .HS FF.FF.FF.FF.FF.FF.FF.F3 8000-BFFF +BITMAP.SIZE .EQ *-MY.BITMAP +*-------------------------------- +SELECT.DRIVER + LDY DRIVER.FLAG + BNE .3 ...LOAD SPECIFIC DRIVER + LDA $FBB3 + CMP #6 + BEQ .3 ...//E OR //C, USE //E DRIVER +*---Display menu----------------- + JSR MON.HOME + LDY #0 +.1 LDA MENU,Y + BEQ .2 + JSR MON.COUT + INY + BNE .1 +*---Get choice------------------- +.2 JSR MON.RDKEY + EOR #$B0 + BEQ .2 + CMP #5 + BCS .2 + TAY + ORA #$B0 + JSR MON.COUT + JSR MON.CROUT +*---(Y) is selected driver------- +.3 STY DRIVER.FLAG + RTS +*-------------------------------- +LOAD.DRIVER + LDY DRIVER.FLAG + LDA DRIVER.ADDRS,Y + BEQ .4 ...40-COLUMN, RETURN NOW + TAY + LDA /$A800 + LDX #2 + JSR MOVE +.4 RTS +*-------------------------------- +* MOVE (X) PAGES FROM YY00 TO AA00 +*-------------------------------- +MOVE + STA DPTR+1 + STY SPTR+1 + LDY #0 + STY DPTR + STY SPTR +.1 LDA (SPTR),Y + STA (DPTR),Y + INY + BNE .1 + INC SPTR+1 + INC DPTR+1 + DEX + BNE .1 + RTS +*-------------------------------- +DRIVER.ADDRS + .HS 60...00...62...64...61 +* //E 40 VID ULT STB +*-------------------------------- +MENU + .AS -/S-C MACRO ASSEMBLER 2.0 (PRODOS)/ + .HS 8D8D + .AS -/1 -- STANDARD 40-COLUMN/ + .HS 8D + .AS -/2 -- VIDEX VIDEOTERM/ + .HS 8D + .AS -/3 -- VIDEX ULTRATERM/ + .HS 8D + .AS -/4 -- STB-80/ + .HS 8D8D + .AS -/WHICH? / + .HS 00 +*-------------------------------- + .AS /<<>>/ +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/scmasm.s.ldr +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/SCMASM.S.MACRO.txt b/SCMASM.30/SCMASM.S.MACRO.txt new file mode 100644 index 00000000..dbf3f6d4 --- /dev/null +++ b/SCMASM.30/SCMASM.S.MACRO.txt @@ -0,0 +1,370 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* .MA DIRECTIVE +*-------------------------------- +PSMA LDA PASS WHICH PASS? + BNE .2 PASS 2, SO SET FLAG AND IGNORE + LDA #'Z+1 RIGHT BRACKET CODE + STA SYMBOL+7 + LDA #0 CLEAR VALUE BYTES + LDX #3 +.1 STA SYMBOL+2,X + DEX + BPL .1 + JSR GNNB GET FIRST CHAR OF MACRO NAME + LDX #1 + JSR PACK.NAME + CPX #2 NEED AT LEAST TWO CHARS, COUNTING BRACKET + BCC .3 NO MACRO NAME + STX SYMBOL+6 LENGTH + JSR STSRCH + BCC .4 DOUBLE DEFN + JSR STADD ENTER INTO SYMBOL TABLE +.2 SEC SET "INSIDE MACRO DEFINITION" FLAG + ROR FLAG.MA + RTS RETURN TO MAIN LEVEL OF ASM +.3 LDY #QNONAM NO MACRO NAME + .HS 2C SKIP NEXT TWO BYTES +.4 LDY #QER4 EXTRA DEF'N + JMP FIRM.ERROR +*-------------------------------- +* PACK MACRO LINE +*-------------------------------- +PACK.MACRO.LINE + JSR SCAN.TO.OPCODE + LDX FLAG.MA IN A MACRO DEF'N? + BPL D.SET ...NO, TRY .SE DIRECTIVE + LDX PASS WHICH PASS? + BNE .10 PASS 2 +*---PASS 1----------------------- + BCS .4 ...OPCODE IS NOT A DIRECTIVE + LDX #DIR.QT.MA + JSR DIR.SCAN.OR.FAIL + BCC .2 NOT .MA +.1 LDY #QER2 "BAD OPCODE" + JMP SOFT.ERROR +.2 JSR DIR.SCAN.OR.FAIL + BCC .3 NOT .EM + LDA #0 TERMINATE THE SKELETON + STA CURRENT.MAJOR.LABEL+1 KILL POSSIBILITY OF LOCAL LABELS +* UNTIL ANOTHER MAJOR LABEL + JSR ADD.CHAR.TO.SKELETON +.11 LSR FLAG.MA +.12 SEC + RTS +*-------------------------------- +.3 JSR DIR.SCAN.OR.FAIL SEE IF .IN + BCS .1 YES, SO ILLEGAL! +* FALL INTO ACCEPTABLE LINE CODE +*-------------------------------- +.4 LDY #0 BACK TO BEGINNING OF LINE + BEQ .5 ...ALWAYS +.55 LDX #$80 COMPRESSED BLANK TOKEN +.6 INX COUNT THE BLANK + CPX #$BF MAX BLANK COUNT? + BCS .7 YES, OUTPUT TOKEN NOW + JSR GNC2 GET NEXT CHARACTER + BCS .7 END OF LINE + BEQ .6 BLANK, SO COMPRESS IT + DEY NON-BLANK, SO BACK UP PNTR +.7 TXA COMPRESSED BLANK TOKEN +.8 JSR ADD.CHAR.TO.SKELETON +.5 JSR GNC2 GET NEXT CHARACTER + BCS .9 END OF LINE + BEQ .55 ...it is a blank + CMP #']' MACRO PARAMETER? + BNE .8 ...NO + TAX save ']' in X + JSR GNC2 GET PARAMETER CODE + BCS .7 ...eol, add ']' and end + CMP #']' + BEQ .8 ...two makes one + CMP #'#' + BEQ .81 ...]# is valid parameter + CMP #'9'+1 HOW ABOUT 1...9 + BCS .82 ...not a parameter + CMP #'1' + BCC .82 ...not a parameter +.81 LDX #$7F valid parameter +.82 DEY back up char pntr + JMP .7 go add $7F or ']' +*-------------------------------- +.9 LDA #0 TERMINATE THE LINE + JSR ADD.CHAR.TO.SKELETON + SEC + RTS +*---PASS 2----------------------- +* IF NOT ".EM", JUST LIST THE LINE +.10 BCS .12 ...OPCODE IS NOT A DIRECTIVE + LDX #DIR.QT.EM + JSR DIR.SCAN.OR.FAIL + BCC .12 NOT .EM + BCS .11 ...ALWAYS +*-------------------------------- +* .SET DIRECTIVE +*-------------------------------- +D.SET + BCS .1 NOT A DIRECTIVE + LDX #DIR.QT.SE + JSR DIR.SCAN.OR.FAIL + BCS .2 FOUND .SE +.1 CLC + RTS +.2 JSR EXPR.DEFINED GET VALUE + JSR GNC.UC.START CHECK FOR VALID LABEL + BEQ .6 ...NO LABEL ERROR + JSR CHECK.LETTER MUST BE NORMAL LABEL + BCC .7 ...DOES NOT START WITH A-Z + JSR PACK + BCC .7 ...BAD SYMBOL + JSR STSRCH + BCC .3 ...IN TABLE ALREADY + LDA SYMBOL+7 + ORA #$80 + STA SYMBOL+7 SET THE .SE FLAG + JSR STADD + JMP .4 +.3 LDY #7 CK .SE FLAG + >SYM LDA,TPTR + BPL .9 DOUBLE DEF IF NOT SET! + LDA TPTR USE SAME PTR AS STADD + STA PNTR + LDA TPTR+1 + STA PNTR+1 + LDA PASS HANDLE FORWARD REFERENCES + BEQ .5 ...IN PASS ONE + DEY POINT AT FLAGS + >SYM LDA,PNTR + ORA #$40 + >SYM STA,PNTR +.4 JSR P.EXP.VALUE.DASH (IF LISTING) +.5 LDY #2 PUT VALUE IN SYMBOL TABLE +.8 LDA EXP.VALUE-2,Y + >SYM STA,PNTR + INY + CPY #6 + BCC .8 + RTS RETURN TO ASM WITH .CS. +.6 JMP NOLBLERR +.7 JMP ERR.BS +.9 JMP ERR.DBLDF +*-------------------------------- +* ADD CHARACTER TO SKELETON +*-------------------------------- +ADD.CHAR.TO.SKELETON + PHA SAVE CHAR + .DO AUXMEM + LDA EOT+1 + CMP /$C000 + BCC .1 + JMP MFER MEM FULL ERROR +.1 STA WRAUX + LDX #0 + PLA + STA (EOT,X) + STA WRMAIN + .ELSE + LDA EOT + CMP PP + LDA EOT+1 + SBC PP+1 + BCC .1 ROOM + JMP MFER MEM FULL ERROR +.1 LDX #0 + PLA + STA (EOT,X) + .FIN + >INCD EOT + RTS +*-------------------------------- +* SCAN TO OPCODE +*-------------------------------- +SCAN.TO.OPCODE + JSR GNC.START GET FIRST CHAR + BEQ .2 ...BLANK OR END + JSR CHECK.COMMENT.CHAR + BEQ .3 ...YES, IT IS A COMMENT +.1 JSR GNC SCAN TO A BLANK + BNE .1 ...NOT BLANK YET +.2 JSR GNNB SCAN TO NON-BLANK + BCS .3 ...END OF LINE + CMP #'.' DIRECTIVE? + BNE .3 ...NO + JSR GNC.UC GET NEXT BYTE + CLC SIGNAL IT IS A DIRECTIVE + RTS +.3 SEC SIGNAL IT IS NOT A DIRECTIVE + RTS +*-------------------------------- +* PROCESS MACRO CALL +*-------------------------------- +MACER1 LDY #QNONAM + .HS 2C +MACER2 LDY #QERR.MACRO + JMP SOFT.ERROR +*-------------------------------- +MACRO.CALL + LDA #'Z+1 MACRO KEY IN SYMBOL TABLE + STA SYMBOL+7 + LDX #1 + JSR GNC.UC GET FIRST CHAR OF MACRO NAME + JSR PACK.NAME + CPX #2 + BCC MACER1 ERROR, NO NAME + STX SYMBOL+6 LENGTH OF NAME + JSR STSRCH + BCS MACER2 ERROR, NO SUCH MACRO + JSR P.ORIGIN + JSR LIST.SOURCE.IF.LISTING + JSR GNNB SCAN TO PARAMETER LIST + JSR BACKUP.CHAR.PNTR + LDA MACSTK+1 SAVE PNTR FOR LATER + PHA + LDA MACSTK + PHA + LDX #0 PROCESS PARAMETER LIST + LDA #9 FIND 9 PARAMETERS + STA PARAM.CNT +.1 JSR GET.ONE.PARAMETER + DEC PARAM.CNT + BNE .1 +.2 LDA WBUF-1,X + JSR PUSH.MACSTK + DEX + BNE .2 + PLA PUT OLD MACSTK PNTR ON MACRO STACK + JSR PUSH.MACSTK (LOW BYTE) + PLA + JSR PUSH.MACSTK (HIGH BYTE) + LDA SRCP + JSR PUSH.MACSTK + LDA SRCP+1 + JSR PUSH.MACSTK + LDA LF.ALL save current list option + JSR PUSH.MACSTK + LDA CALL.NUM STACK CURRENT CALL # + JSR PUSH.MACSTK + LDA CALL.NUM+1 + JSR PUSH.MACSTK + CLC COMPUTE ADDRESS OF SKELETON + LDA #7 + LDY #6 POINT AT LENGTH OF MACRO NAME + >SYM ADC,STPNTR NAME LENGTH+7 + ADC STPNTR + STA SRCP + LDA STPNTR+1 + ADC #0 + STA SRCP+1 + LDA LF.MACRO + ORA LF.ALL DON'T LIST EXPANSION IF NOT LISTING + STA LF.ALL + INC MACRO.LEVEL + >INCD CALL.CNTR COUNT THIS MACRO CALL + LDA CALL.CNTR + STA CALL.NUM + LDA CALL.CNTR+1 + STA CALL.NUM+1 + JMP ASM2 +*-------------------------------- +* PUSH A BYTE ON MACSTK +*-------------------------------- +PUSH.MACSTK + PHA SAVE BYTE TO BE PUSHED + .DO AUXMEM + LDA MACSTK+1 + CMP /$0800 + BCS .1 + .ELSE + LDA EOT + CMP MACSTK + LDA EOT+1 + SBC MACSTK+1 + BCC .1 STILL ROOM + .FIN + JMP MFER NO ROOM +.1 LDA MACSTK + BNE .2 + DEC MACSTK+1 +.2 DEC MACSTK + PLA BYTE TO BE PUSHED + LDY #0 + STA (MACSTK),Y + RTS +*-------------------------------- +* GET ONE PARAMETER FROM MACRO CALL LINE +*-------------------------------- +GET.ONE.PARAMETER + JSR GNC + BEQ .2 SPACE OR EOL, NO MORE PARAMETERS + CMP #', COMMA + BEQ .3 NULL PARAMETER + CMP #'" QUOTE + BEQ .4 QUOTED PARAMETER +.1 STA WBUF,X NORMAL PARAMETER + INX + JSR GNC + BEQ .2 END OF PARAMETER + CMP #', COMMA + BNE .1 MORE TO PARAMETER + BEQ .3 END OF PARAMETER +.2 JSR BACKUP.CHAR.PNTR +.3 LDA #0 + STA WBUF,X + INX + RTS +.4 JSR GNC QUOTED PARAMETER + BCS .3 END OF LINE + CMP #'" + BEQ .5 END OF QUOTED PARAMETER +.6 STA WBUF,X + INX + BNE .4 ...ALWAYS +.5 JSR GNC + BEQ .2 END OF PARAMETER LIST + CMP #', COMMA + BEQ .3 + BNE .6 ...ALWAYS +*-------------------------------- +* DIRECTIVE SCAN OR FAIL +* COMPARE NEXT TWO CHARS WITH TABLE ENTRY +* ENTER: FIRST CHAR SET UP BY GNC.UC +* (X)=OFFSET OF TWO-BYTE ENTRY IN DIR.QTS +*-------------------------------- +DIR.SCAN.OR.FAIL + CMP DIR.QTS,X + BNE .1 FAIL + LDY CHAR.PNTR + LDA WBUF,Y NEXT CHAR + AND #$DF MAP LOWER CASE TO UPPER CASE + CMP DIR.QTS+1,X + BNE .1 FAIL + JSR GNC.UC SCAN OVER SECOND CHAR + SEC SIGNAL SUCCESS + RTS +.1 CLC SIGNAL FAILURE + LDA CURRENT.CHAR RESTORE (A) + INX ADVANCE TO NEXT QUOTE + INX + RTS +*-------------------------------- +DIR.QTS +DIR.QT.DO .EQ *-DIR.QTS + .AS /DO/ +DIR.QT.EL .EQ *-DIR.QTS + .AS /EL/ +DIR.QT.FI .EQ *-DIR.QTS + .AS /FI/ +DIR.QT.MA .EQ *-DIR.QTS + .AS /MA/ +DIR.QT.EM .EQ *-DIR.QTS + .AS /EM/ +DIR.QT.IN .EQ *-DIR.QTS + .AS /IN/ +DIR.QT.SE .EQ *-DIR.QTS + .AS /SE/ +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/scmasm.s.macro +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/SCMASM.S.MCMDS.txt b/SCMASM.30/SCMASM.S.MCMDS.txt new file mode 100644 index 00000000..83952e66 --- /dev/null +++ b/SCMASM.30/SCMASM.S.MCMDS.txt @@ -0,0 +1,266 @@ +NEW + AUTO 3,1 +*-------------------------------------- +HELP + LDA #CMD.TBL + LDX /CMD.TBL + LDY #2 + JSR HELP.1 + JSR CRLF + LDA SCI.TBLADR + LDX SCI.TBLADR+1 + LDY #4 +*-------------------------------- +HELP.1 + STA .92+1 + STX .92+2 + STY .91+1 + LDY #-1 POINT TO BEGINNING + LDX #10 + LDA #$0D +.1 JSR CHO + BPL .2 + JSR MON.PRBL2 + TYA + CLC +.91 ADC #0 + TAY + LDX #10 +.2 INY + DEX +.92 LDA $5555,Y + BNE .1 +.3 RTS +*-------------------------------- +HILO JSR EXPR.DEFINED + LDA EXP.VALUE+3 MUST BE 0000XX00 + ORA EXP.VALUE+2 + ORA EXP.VALUE + BNE HL.RAER + LDX EXP.VALUE+1 + RTS +*-------------------------------- +HIMEM JSR HILO + DEX + CPX SYMBOL.BASE + BCC HL.RAER ...BELOW OR SAME AS LOMEM + CPX SCI.BUFFER.PAGES+2 Start of Exec Buffer + BCS HL.RAER ABOVE EXEC BUFFER + INX + STX SCI.HIMEM.PAGE + JMP NEW +*-------------------------------- +HL.RAER JMP RAER +*-------------------------------- +LOMEM JSR HILO + CPX #8 + BCC HL.RAER ...BELOW $800 + CPX SCI.HIMEM.PAGE + BCS HL.RAER ...ABOVE OR SAME AS HIMEM + STX SYMBOL.BASE + JMP NEW +*-------------------------------- +* SET INCREMENT VALUE FOR AUTO-LINE-NUMBERING +*-------------------------------- +INCREMENT + JSR SCAN.1.DECIMAL.NUMBER + DEX be sure there was a value + BMI SYNX1 ...no, not one +.1 LDA A0L,X GET VALUE + STA INCREMENT.VALUE,X + DEX + BPL .1 + RTS +SYNX1 JMP SYNX +*-------------------------------- +* AUTO & MANUAL COMMANDS +*-------------------------------- +AUTO JSR SCAN.1.DECIMAL.NUMBER GET BASE, IF ANY + JSR SCAN.1.DECIMAL.NUMBER Get increment, if any + DEX Were there any parameters? + BMI .4 ...no, use current values + DEX ...yes, see if two parameters + DEX + BMI .2 ...no, only a starting line number +.1 LDA A1L,X ...yes, copy new increment + STA INCREMENT.VALUE,X + DEX + BPL .1 +*---X=-1, form "previous" line number--- +.2 SEC As written, this loop only works +.3 LDA A0L+1,X if all values are in page zero + SBC INCREMENT.VALUE+1,X because it uses negative + STA CURLNO+1,X indexing. + INX + BEQ .3 +*---Set the AUTO flag------------ +.4 SEC SET FLAG + .HS 90 "BCC", ALWAYS SKIP NEXT BYTE +MANUAL CLC CLEAR FLAG + ROR AUTOLN.FLAG + RTS +*-------------------------------- +* +* EDIT COMMAND +* +*-------------------------------- +EDIT + JSR GET.KEY.STRING + JSR PARSE.LINE.RANGE +.1 JSR GET.LINE.TO.WBUF + BCC .2 + RTS Finished with range +.2 JSR FIND.KEY.IN.WBUF + BCC .1 Not there + JSR EDIT.ONE.LINE + JMP .1 +*-------------------------------- +DATE JSR SCAN.3.DECIMAL.NUMBERS Day, Month, Year + CPX #6 + BCC SYNX1 NEED ALL THREE VALUES + LDA A1L MONTH + ASL + ASL + ASL + ASL + ASL M-MMM00000 + ORA A0L M-MMMDDDDD + STA $BF90 + LDA A2L YEAR + ROL YYYYYYYM + STA $BF91 + RTS +*-------------------------------- +TIME JSR SCAN.3.DECIMAL.NUMBERS Hour, Minute + CPX #4 + BCC SYNX1 NEED BOTH VALUES + LDA A0L HOUR + STA $BF93 + LDA A1L MINUTE + STA $BF92 + RTS +*--------------------------------- +* RENUMBER COMMAND +* +* UP TO THREE PARAMETERS +* 1: BASE NUMBER (DEFAULT = 1000) +* 2: INCREMENT (DEFAULT = 10) +* 3: STARTING LINE (DEFAULT = 0) +*--------------------------------- +RENUMBER + JSR SCAN.3.DECIMAL.NUMBERS Base, Increment, Starting Line +.1 CPX #3 COPY DEFAULTS IF ANY NEEDED + BCS .2 NO MORE DEFAULTS NEEDED + LDA RENDTA,X + STA A0L,X + INX + BNE .1 ...ALWAYS +.2 LDX #A2L FIND STARTING LINE + JSR SERTXT +.3 LDA LINE.START TEST IF THRU YET + CMP HI.MEM + LDA LINE.START+1 + SBC HI.MEM+1 + BCS .4 FINISHED + LDY #0 + LDA (LINE.START),Y GET LINE LENGTH + PHA SAVE FOR LATER + INY + LDA A0L STORE NEW LINE NUMBER IN LINE + STA (LINE.START),Y + ADC A1L ADD INCREMENT AS WE GO + STA A0L + INY + LDA A0H REST OF LINE NUMBER + STA (LINE.START),Y + ADC A1H ADD REST OF INCREMENT + BCS .5 YES, TOO BIG + STA A0H OK, AND CARRY CLEAR + PLA GET LINE SIZE + ADC LINE.START BUMP POINTER TO NEXT LINE + STA LINE.START + BCC .3 + INC LINE.START+1 + BNE .3 ...ALWAYS +.4 RTS FINISHED! +.5 LDY #QER3 RANGE ERROR + JMP HARD.ERROR +RENDTA .DA 1000 DEFAULT BASE + .DA #10 DEFAULT INCREMENT +*** .DA 0 DEFAULT STARTING LINE +*-------------------------------- +* HIDE COMMAND +*-------------------------------- +HIDE JSR MERGE MERGE IF ANY PREVIOUS HIDE + LDA #'H + STA PROMPT.FLAG NO, HIDE IT ALONE + INX NOW X=1 +.1 LDA HI.MEM,X SAVE HI.MEM + STA HIDE.HIMEM,X + LDA PP,X + STA HI.MEM,X + DEX + BPL .1 + RTS +*-------------------------------- +* MERGE COMMAND +*-------------------------------- +MERGE LDA PROMPT.FLAG + EOR #'H + BNE .1 + STA PROMPT.FLAG CLEAR PROMPT CHAR + LDA HIDE.HIMEM RESTORE HI.MEM + STA HI.MEM + LDA HIDE.HIMEM+1 + STA HI.MEM+1 +.1 RTS +*-------------------------------- +* NEW COMMAND +*-------------------------------- +NEW JSR RESTORE RESTORE IF IN AN INCLUDE + JSR MERGE + JSR EMPTY.SOURCE.AREA + JMP HARD +*-------------------------------- +* MEMORY COMMAND +* PRINT OUT BOUNDS ON SOURCE PROGRAM +* AND ON SYMBOL TABLE +*-------------------------------- +MEMORY LDY #QSRCPRG "SOURCE PROGRAM: $" + LDX #PP + LDA #HI.MEM + JSR MEM.LINE + LDY #QSYMTBL " SYMBOL TABLE: $" + LDX #LO.MEM + LDA #EOT +MEM.LINE + PHA SAVE SECOND VALUE PNTR + TXA + PHA SAVE FIRST VALUE PNTR + JSR QT.OUT + PLA GET FIRST VALUE PNTR + JSR MEM.HEXVAL + JSR P.DASH + PLA GET SECOND VALUE PNTR +MEM.HEXVAL + TAX + LDA 1,X + JSR MON.PHEX + LDA 0,X + JMP MON.PHEX +*-------------------------------- +RST JSR EXPR + LDY EXP.VALUE + LDA EXP.VALUE+1 +*-------------------------------- +SET.RESET.VECTOR + STY MON.RESET + STA MON.RESET+1 + EOR #$A5 + STA MON.RESET+2 + RTS +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/scmasm.s.mcmds +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/SCMASM.S.NEWQ.txt b/SCMASM.30/SCMASM.S.NEWQ.txt new file mode 100644 index 00000000..9ac520d6 --- /dev/null +++ b/SCMASM.30/SCMASM.S.NEWQ.txt @@ -0,0 +1,129 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* Y = MESSAGE NUMBER +*-------------------------------- +QT.OUT + TXA + PHA + LDX #0 + CLC +*---Search for message #--------- +.2 JSR GET.NEXT.NYBBLE + BNE .4 +.3 JSR GET.NEXT.NYBBLE + BEQ .3 + BNE .2 +.4 EOR #$0F + BNE .2 + DEY + BNE .2 +*---Print the message------------ +.5 JSR GET.NEXT.NYBBLE + TAY + LDA FIRST.TABLE,Y + BNE .6 ...FREQUENT CHAR + JSR GET.NEXT.NYBBLE + TAY + LDA SECOND.TABLE,Y + BNE .6 ...TWO NYBBLE CHAR + JSR GET.NEXT.NYBBLE + TAY + LDA THIRD.TABLE,Y +.6 BPL .7 ...END OF MESSAGE + PHP + JSR MY.COUT + PLP + BMI .5 ...NEXT CHAR, ALWAYS +.7 PLA ...YES + TAX + RTS +*-------------------------------- +GET.NEXT.NYBBLE + LDA MESSAGES,X + BCS .1 2ND NYBBLE + LSR 1ST NYBBLE + LSR + LSR + LSR + SEC + RTS +.1 INX + AND #$0F + CLC + RTS +*-------------------------------- +FIRST.TABLE .HS 00 + .AS -/ABCDEILMNORST / + .HS 7F +SECOND.TABLE .HS 00 + .AS -/FGPUXY$.*:?52/ + .HS 878D +THIRD.TABLE .AS -/.HJKQVWZ>1-...../ +*-------------------------------- +MESSAGES + .AC 0 + .AC 1/ABCDEILMNORST %/ + .AC 2/FGPUXY$.*:?52!#/ + .AC 3/HJKQVWZ>1-...../ +*-------------------------------- + .MA QT +QN. .SE QN.+1 +]1 .EQ QN. + .AC /]2/ + .EM +QN. .SE 0 +*-------------------------------- + .AC "%" ELIMINATE QT# 0 + >QT QSC,"S-C MACRO ASSEMBLER %" + >QT QST,"SYMBOL TABLE%" + >QT QSTARS,"#***!! %" + >QT QSRCPRG,"#SOURCE PROGRAM: $%" + >QT QSYMTBL,"# SYMBOL TABLE: $%" + >QT QERROR," ERROR#%" + >QT PAGEQT," PAGE %" + >QT QREPPRMT,"#REPLACE? %" + >QT QERRCNT," ERRORS IN ASSEMBLY#%" + >QT QBLOADB," LOAD %" + >QT QDELOR,"DELETE ORIGINAL? %" + >QT QMEMPRO,"MEM PROTECT%" + >QT QMEMFL,"MEM FULL%" + >QT QSYNX,"SYNTAX%" + >QT QER1,"NO LABEL%" + >QT QER2,"BAD OPCODE%" + >QT QER3,"RANGE%" + >QT QER4,"EXTRA DEFINITION%" + >QT QER5,"BAD ADDRESS%" + >QT QER6,"UNDEF LABEL%" + >QT QER7,"BAD SYMBOL%" + >QT QER8,"VALUE > 255%" + >QT QER9,"NO NORMAL LABEL%" + >QT QNIN,"NESTED .IN%" + >QT QERDO,"MISSING .DO%" + >QT QERDO2,".DO NEST TOO DEEP%" + >QT QSTRLNG,"KEY TOO LONG%" + >QT QNONAM,"NO MACRO NAME%" + >QT QREPLNG,"REPLACE TOO LONG%" + >QT QERR.MACRO,"UNDEF MACRO%" + .AC "%" FLUSH LAST BYTE +*-------------------------------- + .DO 0 +T + LDA #1 + STA 0 +.1 LDA 0 + JSR $FDDA + LDY 0 + JSR PRINT.QUOTATION + JSR $FD8E + INC 0 + LDA 0 + CMP #$20 + BCC .1 + RTS + .FIN +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/scmasm.s.newq +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/SCMASM.S.OUTPUT.txt b/SCMASM.30/SCMASM.S.OUTPUT.txt new file mode 100644 index 00000000..2d834e9a --- /dev/null +++ b/SCMASM.30/SCMASM.S.OUTPUT.txt @@ -0,0 +1,250 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* ERROR PRINTER +*--------------------------------- +FIRM.ERROR + SEC SIGNAL FIRM ERROR + .HS 24 SKIP NEXT BYTE +SOFT.ERROR + CLC SIGNAL SOFT ERROR + LDA PASS SEE IF IN ASSEMBLY + BMI HARD.ERROR ...NO + PHP SAVE CLC/SEC STATUS + LDA RDROM + JSR PRINT.ERROR.MESSAGE + >INCD ERROR.COUNT + JSR SPC + JSR LIST.SOURCE.AT.MARGIN + JSR CRLF + PLP GET SOFT/FIRM STATUS + BCS JMP.SOFT ...FIRM, ABORT ASSEMBLY + JMP ASM2 ...SOFT, CONTINUE ASSEMBLY +HARD.ERROR + JSR PRINT.ERROR.MESSAGE +JMP.SOFT + JSR RESTORE.IF.IN.INBX + JMP SOFT +*-------------------------------- +RESTORE.IF.IN.INBX + BIT INFLAG + BVC .1 + JSR RESTORE +.1 RTS +*-------------------------------- +P.EXP.VALUE.DASH + JSR CHECK.IF.LISTING + JSR P.EXP.VALUE +P.DASH LDA #'-' + .HS 2C +P.RETURN + LDA #$0D + .HS 2C +SPC LDA #' ' ONE SPACE +CHO PHA + ORA #$80 CHAR OUT + JSR MY.COUT SEND THE CHARACTER + PLA + RTS +*--------------------------------- +* PRINT A +* IF IN "SLOW" MODE, DELAY FIRST +* CHECK KEYBOARD FOR PAUSE OR ABORT +*-------------------------------- +CRLF BIT FLAG.SPEED CHECK SLOW/FAST SPEED + BPL .1 FAST + LDA #0 SLOW + JSR MON.DELAY +.1 JSR CHECK.KEYBOARD.FOR.ABORT + BCC P.RETURN ...NO KEYPRESS + BEQ JMP.SOFT ...ABORT +.2 JSR CHECK.KEYBOARD.FOR.ABORT + BCC .2 WAIT FOR KEYPRESS + BNE P.RETURN ...CONTINUE + BEQ JMP.SOFT ...ABORT +*-------------------------------- +* RETURN .CC. AND .NE. IF NO KEYPRESS +* RETURN .CS. AND .EQ. IF TYPED +* RETURN .CS. AND .NE. IF ANY OTHER KEY +*-------------------------------- +CHECK.KEYBOARD.FOR.ABORT + CLC + LDA $C000 + BPL .1 + STA $C010 + CMP #$8D + SEC +.1 RTS +*-------------------------------- +* PRINT ERROR MESSAGE +*-------------------------------- +PRINT.ERROR.MESSAGE + TYA SAVE ERROR # + TAX IN X-REG + LDY #QSTARS "*** " + JSR QT.OUT + TXA + TAY + JSR QT.OUT + LDY #QERROR + JMP QT.OUT +*-------------------------------- +* PRINT LOCATION COUNTER AND DASH +*-------------------------------- +P.ORIGIN + JSR CHECK.IF.LISTING +P.ORIGIN.REGARDLESS + LDX #7 assume col. 7 after 6-digit origin + LDY #2 + LDA ORGN+2 If > $FFFF, print 3 bytes + BNE .1 ...orgn > $FFFF, print 3 bytes + DEY ...orgn <$10000, print 2 bytes + LDX #5 will end up in col. 5 +.1 STX EMIT.COLUMN +.2 LDA ORGN,Y HIGH BYTE FIRST + JSR MON.PHEX + DEY + BPL .2 + JMP P.DASH PRINT "-" +*-------------------------------- +P.EMITTED.BYTE + JSR CHECK.IF.LISTING + LDY EMIT.COLUMN + BEQ .2 ...AT BEGINNING OF LINE + LDY EMIT.MARGIN + LDA ORGN+2 + BNE .1 + DEY + DEY +.1 CPY EMIT.COLUMN + BCS .3 ...STILL ROOM ON THIS LINE + BIT LF.XTRA.BYTES + BMI .4 + JSR CRLF.WITH.PAGING +.2 JSR P.ORIGIN +.3 LDY EMIT.COLUMN + INY MAKE ROOM FOR NEXT BYTE + INY + INY + STY EMIT.COLUMN + JSR SPC + LDA OBJ.BYTE + JMP MON.PHEX +.4 RTS +*-------------------------------- +P.MARGIN + SEC + LDA EMIT.MARGIN + SBC EMIT.COLUMN + TAX + LDA ORGN+2 + BEQ .1 + INX + INX +.1 JMP MON.PRBL2 +*-------------------------------- +P.EXP.VALUE + LDY #3 EXP.VALUE IS 4 BYTES +.1 LDA EXP.VALUE,Y TRIM LEADING ZERO BYTES + BNE .2 ...FIRST NON-ZERO BYTE + DEY + BNE .1 ...STILL NOT LAST BYTE +.2 TYA + ASL + ADC #3 + STA EMIT.COLUMN +.3 LDA EXP.VALUE,Y PRINT REST OF EXP.VALUE + JSR MON.PHEX + DEY + BPL .3 + RTS +*-------------------------------- +CHECK.IF.LISTING + LDA PASS + BEQ .1 ...NO LISTING IN PASS 1 + LDA LF.ALL + BPL .2 ...YES, LIST +.1 PLA POP RETURN + PLA +.2 RTS +*-------------------------------- +LIST.LINE.BOTH.PASSES + LDA PASS + BEQ .1 DEFINITE IN PASS 1 + LDA LF.ALL + BPL .2 ...ALREADY DID CRLF +.1 JSR CRLF.WITH.PAGING +.2 JSR P.ORIGIN.REGARDLESS + JMP LIST.SOURCE.REGARDLESS +*--------------------------------- +* CONVERT LINE NUMBER +* (CURRENT.LINE.NUMBER) = NUMBER TO USE +*--------------------------------- +CONVERT.LINE.NUMBER.BOTH + LDA #$C0 PRINT FLAG ON, STORE FLAG ON + .HS 2C SKIP NEXT 2 BYTES +CONVERT.LINE.NUMBER.STORE + LDA #$80 PRINT FLAG OFF, STORE FLAG ON + .HS 2C SKIP NEXT 2 BYTES +CONVERT.LINE.NUMBER.PRINT + LDA #$40 PRINT FLAG ON, STORE FLAG OFF + PHA + LDX #3 CONVERT 4 DIGITS + LDA CURRENT.LINE.NUMBER + CMP #10000 + LDA CURRENT.LINE.NUMBER+1 + SBC /10000 + BCC .1 4 DIGITS WILL DO IT + INX 5 DIGITS +.1 PLA +*-------------------------------- +* CONVERT (CURRENT.LINE.NUMBER) +* (X) = ONE LESS THAN NUMBER OF DIGITS +* (A) = FLAGS: BIT 7 = 1 MEANS TO STORE AT WBUF,Y +* BIT 6 = 1 MEANS TO PRINT +*-------------------------------- +CONVERT.LINE.NUMBER + STA CONV.CTRL +.5 LDA #$B0 SET DIGIT TO ASCII ZERO +.1 PHA PUSH DIGIT ON STACK + SEC SUBTRACT CURRENT DIVISOR + LDA CURRENT.LINE.NUMBER + SBC PLNTBL,X + PHA SAVE BYTE ON STACK + LDA CURRENT.LINE.NUMBER+1 + SBC PLNTBH,X + BCC .2 LESS THAN DIVISOR + STA CURRENT.LINE.NUMBER+1 + PLA GET LOW BYTE OFF STACK + STA CURRENT.LINE.NUMBER + PLA GET DIGIT FROM STACK + ADC #0 INCREMENT DIGIT + BNE .1 ...ALWAYS +.2 PLA DISCARD BYTE FROM STACK + PLA GET DIGIT FROM STACK + BIT CONV.CTRL + BVC .3 NO PRINT + JSR MON.COUT PRINT CHARACTER +.3 BIT CONV.CTRL TEST BUFFER STORAGE FLAG + BPL .4 OFF, DO NOT STORE IN BUFFER + STA WBUF,Y + INY +.4 DEX NEXT DIGIT + BPL .5 + RTS RETURN +*--------------------------------- +PLNTBL .DA #1 + .DA #10 + .DA #100 + .DA #1000 + .DA #10000 +PLNTBH .DA /1 + .DA /10 + .DA /100 + .DA /1000 + .DA /10000 +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/scmasm.s.output +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/SCMASM.S.PARAM.txt b/SCMASM.30/SCMASM.S.PARAM.txt new file mode 100644 index 00000000..4de9018f --- /dev/null +++ b/SCMASM.30/SCMASM.S.PARAM.txt @@ -0,0 +1,76 @@ +NEW + AUTO 3,1 +*-------------------------------------- +*-------------------------------- +* ENTRY POINTS AND USER EXITS +*-------------------------------- +* HARD ENTRY +HARD JSR HARD.INIT +*-------------------------------- +* SOFT ENTRY + JMP SOFT +*-------------------------------- +* USER DEFINED COMMAND +USR JMP SOFT +*-------------------------------- +* USER PRINT ROUTINE +PRT JMP SOFT +*-------------------------------- +* USER ESC-U FUNCTION +USER.ESC.U + JMP RDL.ERR +*-------------------------------- +* USER "." COMMAND +USER.CMD JMP SOFT +*-------------------------------- +* USER OBJECT CODE STORAGE +USER.OBJECT.BYTE + JMP STORE.OBJECT.BYTE +*-------------------------------- +* USER ASSEMBLER DIRECTIVE +PSUSER JMP CMNT +*-------------------------------- +* TAB CONTROL CHARACTER AND TAB STOPS +TAB.CHAR .DA #CHR.CTRL.I +TAB.SETTINGS .DA #14,#18,#27,#32,#0 +*-------------------------------- +* USER COMMENT CHARACTER +* (IN ESC-L FROM COLUMN 6) +*-------------------------------- +USER.COM.DELIM .DA #CHR.DASH +*-------------------------------- +* COMPRESSION LOWER LIMIT +* =4 IF DESIRE COMPRESSION +* =255 IF DO NOT DESIRE COMPRESSION +*-------------------------------- +COMPRESSION.LIMIT .HS 04 +*-------------------------------- +* WILD CARD CHARACTER FOR SEARCH STRING +*-------------------------------- +WILD.CARD .HS 17 CONTROL-W +*-------------------------------- +* OUTPUT A SINGLE CHARACTER TO SCREEN +*-------------------------------- +MY.COUT JMP MON.COUT +*-------------------------------- +USER.MEM.LO .DA $0000 +USER.MEM.HI .DA $0000 +*-------------------------------- +* LINKAGE TO FULL SCREEN EDITOR +*-------------------------------- +LINK.FSE + JMP GNL <<>> +*-------------------------------- + JMP GNC.UC + JMP GNNB + JMP CMNT + JMP ERBA + JMP EMIT +*-------------------------------- +BOTTOM.OF.SCREEN + .DA #23 CHANGE TO 31 OR 47 FOR LONGER SCREENS +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/scmasm.s.param +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/SCMASM.S.PLINE.txt b/SCMASM.30/SCMASM.S.PLINE.txt new file mode 100644 index 00000000..57b90657 --- /dev/null +++ b/SCMASM.30/SCMASM.S.PLINE.txt @@ -0,0 +1,102 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* PARSE LINE RANGE +* START END CARRY +* (PP) (HI.MEM) SET +* # # # CLEAR +* #1,#2 #1 #2 CLEAR +* #, # (HI.MEM) CLEAR +* ,# (PP) # CLEAR +*--------------------------------- +PARSE.LINE.RANGE + JSR SETUP.TEXT.POINTERS + JSR GNNB.AUC GET NEXT NON-BLANK CHAR + BCS .4 EOL, RETURN WITH CARRY SET + BEQ .1 COMMA, SO START AT PP + JSR SCAN.LINE.NUMBER + BCS .5 + LDA LINE.START + STA SRCP + LDA LINE.START+1 + STA SRCP+1 + JSR GNNB.AUC GET NEXT NON-BLANK AFTER LINE NUMBER + BCS .2 EOL, SO ONLY THIS ONE LINE + BNE .5 NOT COMMA, SO ERROR +.1 JSR GNNB.AUC GET NEXT NON-BLANK AFTER COMMA + BCS .3 EOL, SO GO THRU HI.MEM + BEQ .3 COMMA, SAME AS EOL + JSR SCAN.LINE.NUMBER + BCS .5 +.2 LDA LINE.END + STA ENDP + LDA LINE.END+1 + STA ENDP+1 +.3 CLC FLAG WE GOT AT LEAST ONE NUMBER +.4 RTS +.5 JMP SYNX +*--------------------------------- +* SCAN INPUT LINE FOR DIGIT OR PERIOD +* IF FIND DIGIT, CONVERT LINE NUMBER +* AND SEARCH FOR IT +* IF FIND PERIOD, SEARCH FOR +* IF NEITHER, RETURN WITH CARRY SET +*--------------------------------- +SCAN.LINE.NUMBER + CMP #'. DOT: USE (CURLNO) + BEQ .1 + EOR #$30 + CMP #10 + BCS .2 NOT DOT NOR DIGIT, EXIT CARRY SET + JSR DECN CONVERT THE NUMBER + JSR BACKUP.CHAR.PNTR + LDX #SYM.VALUE + .HS 2C SKIP OVER NEXT 2 BYTES +.1 LDX #CURLNO + JSR SERTXT FIND LINE + CLC SIGNAL GOOD NUMBER +.2 RTS +*-------------------------------- +* LOAD PP --> SRCP, HI.MEM --> ENDP +*-------------------------------- +SETUP.TEXT.POINTERS + LDA PP ASSUME PP THRU HI.MEM + STA SRCP + LDA PP+1 + STA SRCP+1 + LDA HI.MEM + STA ENDP + LDA HI.MEM+1 + STA ENDP+1 + RTS +*-------------------------------- +CMP.SRCP.ENDP + LDA SRCP + CMP ENDP + LDA SRCP+1 + SBC ENDP+1 + RTS +*-------------------------------- +* GET NEXT NON-BLANK CHARACTER +* AND CHECK FOR A, U, OR COMMA +* SET CARRY IF A, U, OR EOL +* SET EQ IF A, U, EOL, OR COMMA +*-------------------------------- +GNNB.AUC + JSR GNNB NEXT NON-BLANK, CONV LOWER TO UPPER + BCS .1 EOL + CMP #'A + BEQ .1 + CMP #'U + BEQ .1 + CMP #', + CLC + RTS +.1 JSR BACKUP.CHAR.PNTR + SEC + RTS +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/scmasm.s.pline +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/SCMASM.S.PSYM.txt b/SCMASM.30/SCMASM.S.PSYM.txt new file mode 100644 index 00000000..f76c3df2 --- /dev/null +++ b/SCMASM.30/SCMASM.S.PSYM.txt @@ -0,0 +1,126 @@ +NEW + AUTO 3,1 +*-------------------------------------- +*-------------------------------- +* PRINT SYMBOL TABLE IN ALPHABETICAL ORDER +*-------------------------------- +SYMBOLS +STPRNT LDY #2 SKIP OVER .TF PSEUDO-SYMBOLS +.1 STY PNTR + LDA HSHTBL,Y + STA STPNTR + LDA HSHTBL+1,Y + BEQ .5 + STA STPNTR+1 +*---PRINT VALUE AND DASH--------- +.2 LDY #2 POINT AT VALUE +.25 >SYM LDA,STPNTR + STA SYM.VALUE-2,Y SAVE FOR LOCAL OFFSETS + INY + CPY #6 + BCC .25 + LDY #3 +.26 LDA SYM.VALUE,Y + BNE .27 ...NON-ZERO BYTE + JSR SPC + JSR SPC + DEY + BNE .26 ...UNTIL LAST BYTE +.27 LDA SYM.VALUE,Y + JSR MON.PHEX + DEY + BPL .27 ...INCLUDE LAST BYTE + JSR P.DASH + JSR SPC +*---PRINT NAME------------------- + LDY #6 + >SYM LDA,STPNTR GET NAME LENGTH + PHA SAVE AGAIN FOR LOCAL LABELS FLAG + AND #$3F ISOLATE LENGTH + TAX +.3 INY + >SYM LDA,STPNTR + JSR CHO + DEX + BNE .3 +*---CHECK FOR LOCAL LABELS------- + PLA GET LENGTH AND FLAGS + BMI .6 LOCAL LABELS +*---NEXT LABEL------------------- +.4 JSR CRLF.WITH.PAGING + LDY #1 POINT AT POINTER + >SYM LDA,STPNTR + PHA + DEY + >SYM LDA,STPNTR + STA STPNTR + PLA + STA STPNTR+1 + BNE .2 NEXT SYMBOL IN THIS CHAIN, IF ANY +.5 LDY PNTR + INY + INY + CPY #54 # BYTES IN HASH POINTER TABLE + BNE .1 + RTS +*---PRINT LOCAL LABELS----------- +.6 AND #$3F POINT AT FIRST LOCAL LABEL + CLC + ADC #7 + TAY + LDA #1 FORCE CRLF BEFORE 1ST LABEL + STA EMIT.COLUMN +.7 >SYM LDA,STPNTR + BEQ .4 END OF LOCALS + AND #$7F ISOLATE NAME + PHA SAVE NAME OF SYMBOL + STY YSAVE SAVE POINTER + DEC EMIT.COLUMN + BNE .9 ...UNLESS NEED A NEW LINE + JSR CRLF.WITH.PAGING CLOBBERS Y-REG IF FORMFEED + LDY #8 +.81 JSR SPC + DEY + BNE .81 + LDY #7 ...SEVEN PER LINE + LDA SYM.VALUE+2 + BEQ .82 + LDY #5 ...FIVE PER LINE +.82 STY EMIT.COLUMN +.9 JSR SPC + JSR SPC + LDA #CHR.PERIOD + JSR CHO + PLA GET NAME + STA CURRENT.LINE.NUMBER + LDA #0 + STA CURRENT.LINE.NUMBER+1 + LDX #1 ONLY TWO DIGITS + LDA #$40 PRINT ONLY, DO NOT STORE IN WBUF + JSR CONVERT.LINE.NUMBER + LDA #'=' EQUAL SIGN + JSR CHO + LDY YSAVE GET VALUE OF SYMBOL + INY + >SYM LDA,STPNTR + CLC + ADC SYM.VALUE + PHA + LDA SYM.VALUE+1 + ADC #0 + PHA + LDA SYM.VALUE+2 + ADC #0 + BEQ .10 PRINT ONLY TWO BYTES + JSR MON.PHEX +.10 PLA + JSR MON.PHEX + PLA + JSR MON.PHEX + INY + BNE .7 ...ALWAYS +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/scmasm.s.psym +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/SCMASM.S.RLINE.txt b/SCMASM.30/SCMASM.S.RLINE.txt new file mode 100644 index 00000000..718bbe95 --- /dev/null +++ b/SCMASM.30/SCMASM.S.RLINE.txt @@ -0,0 +1,411 @@ +NEW + AUTO 3,1 +*-------------------------------------- + .MA JTBL + .DA #$]1,]2-1 + .EM +*-------------------------------- +CHAR.TABLES +CHARS.FOR.COMMANDS .EQ *-CHAR.TABLES + >JTBL 22,ECHO.LINE "--ECHO REST OF LINE + >JTBL 2D,PASS.CMD.TO.PRODOS DASH COMMAND + >JTBL 2E,USER.CMD .--USER DOT COMMAND + >JTBL 2F,LINK.FSE /--LINK TO F.S.E. + >JTBL 3F,HELP ?--list commands + >JTBL 00,NML other, try numbered line +*-------------------------------- +CHARS.FOR.READ.LINE.1 .EQ *-CHAR.TABLES + >JTBL 83,RDL.CATALOG ^C--MACRO FOR "CATALOG" + >JTBL 85,RDL.EDIT ^E--MACRO FOR "EDIT " + >JTBL 86,RDL.FIND ^F--MACRO FOR "FIND " + >JTBL 8C,RDL.LIST ^L--MACRO FOR "LIST " + >JTBL 90,RDL.PREFIX ^P--MACRO FOR "PREFIX" +CHARS.FOR.READ.LINE.2 .EQ *-CHAR.TABLES + >JTBL 88,RDL.BACKSPACE ^H--BACKSPACE + >JTBL 8A,RDL.DOWN ^J--DOWN ARROW KEY + >JTBL 8B,RDL.UP ^K--UP ARROW KEY + >JTBL 8D,RDL.EOL ^M--CARRIAGE RETURN + >JTBL 8F,RDL.OVERRIDE ^O--OVERRIDE + >JTBL 93,RDL.TOGGLE ^S--TOGGLE CASE FLAG + >JTBL 95,RDL.RITARR ^U--RIGHT ARROW + >JTBL 98,RDL.RUBOUT ^X--RUBOUT LINE + >JTBL 9B,RDL.ESCAPE ESC--ESCAPE MODE + >JTBL 00,RDL.ERR +*-------------------------------- +CHARS.FOR.ESCAPE .EQ *-CHAR.TABLES + >JTBL C0,IO.HOME @--CLEAR SCREEN AND HOME + >JTBL C1,IO.RIGHT A--MOVE CURSOR RIGHT + >JTBL C2,IO.LEFT B--MOVE CURSOR LEFT + >JTBL C3,IO.DOWN C--MOVE CURSOR DOWN + >JTBL C4,IO.UP D--MOVE CURSOR UP + >JTBL C5,IO.CLREOL E--CLEAR TO END OF LINE + >JTBL C6,IO.CLREOP F--CLEAR TO END OF SCREEN + >JTBL C9,IO.UP I--MOVE CURSOR UP + >JTBL CA,IO.LEFT J--MOVE CURSOR LEFT + >JTBL CB,IO.RIGHT K--MOVE CURSOR RIGHT + >JTBL CC,ESCAPE.L L--"LOAD ..." OR "*---..." + >JTBL CD,IO.DOWN M--MOVE CURSOR DOWN + >JTBL D3,ESCAPE.S S--AUTO-SAVE LINE + >JTBL D5,USER.ESC.U U--USER COMMAND + >JTBL AE,ESCAPE.DOT .--LIS., COMMAND + >JTBL 88,IO.LEFT ^H--LEFT ARROW KEY + >JTBL 95,IO.RIGHT ^U--RIGHT ARROW KEY + >JTBL 8A,IO.DOWN ^J--DOWN ARROW KEY + >JTBL 8B,IO.UP ^K--UP ARROW KEY + >JTBL 00,RDL.ESC.END END ESCAPE MODE +*-------------------------------- +CHARS.FOR.EDIT .EQ *-CHAR.TABLES + >JTBL 80,E.ZAP ^@ -- Clear to EOL + >JTBL 81,E.INS ^A -- Add (Insert) + >JTBL 82,E.BEG ^B + >JTBL 84,E.DEL ^D + >JTBL 86,E.FIND ^F + >JTBL 88,E.BKSP ^H + >JTBL 89,E.TABI ^I -- Clear to tab + >JTBL 8C,E.DOWN ^L + >JTBL 8D,E.RET ^M + >JTBL 8E,E.END ^N + >JTBL 8F,E.OVR ^O + >JTBL 91,E.RETQ ^Q -- Clear to EOL, Quit + >JTBL 92,E.RESTORE ^R -- Restore original line + >JTBL 93,E.TOGGLE ^S -- TOGGLE CASE FLAG + >JTBL 94,E.TAB ^T + >JTBL 95,E.RIT ^U + >JTBL 98,E.ABORT ^X + >JTBL 00,E.ILLCHAR +*-------------------------------- +RDL.TOGGLE + JSR IO.CASE.TOGGLE + JMP RDL3 +*-------------------------------- +RDL.UP + JSR IO.UP + JMP RDL3 +*-------------------------------- +RDL.DOWN + JSR IO.DOWN + JMP RDL3 +*-------------------------------- +* HANDLE TABULATION +*-------------------------------- +TAB TXA SEE IF IN COLUMN 1 + BEQ .4 YES, AUTO-LINE-NUMBER +.3 JSR E.CHECK.TAB + BCS .5 ONE MORE SPACE + LDA #CHR.BLANK + JSR INSTALL.CHAR + BCC .3 MORE TO GO + JMP RDL.RUBOUT +*-------------------------------- +.4 CLC ADD INCREMENT TO CURRENT LINE # + LDA CURLNO + ADC INCREMENT.VALUE + STA CURRENT.LINE.NUMBER + LDA CURLNO+1 + ADC INCREMENT.VALUE+1 + STA CURRENT.LINE.NUMBER+1 + LDY #0 + JSR CONVERT.LINE.NUMBER.BOTH STORE AND PRINT NUMBER + TYA + TAX +*-------------------------------- +.5 LDA #CHR.BLANK + JMP RDL.ADD.CHAR +*-------------------------------- +* READ LINE SUBROUTINE +*-------------------------------- +READ.LINE + JSR GET.HORIZ.POSN + TAX TEST FOR POSITION=0 + BEQ RDL1 DON'T OUTPUT CRLF +RDL0 JSR CRLF +RDL1 LDA PROMPT.FLAG + JSR CHO NULL, "I", OR "H" + LDA #':' COLON PROMPT + JSR CHO + LDX #0 START NEW LINE + STX WBUF CLEAR OUT "$" FROM COL. 1 (JUST IN CASE) + BIT AUTOLN.FLAG SEE IF IN "AUTO" MODE + BMI TAB ...YES +RDL3 JSR READ.KEY.WITH.CASE + BCS RDL.ESCAPE.2E + LDY WBUF SEE IF IN $ OR " MODE + CPY #$A2 "? + BEQ .2 + CPY #$A4 $? + BEQ .2 + CMP TAB.CHAR < 1) + DEY + BMI FMN3 ...NOT VALID COMMAND + CPY #$13 + BCS FMN2 +.1 JSR MON.TOSUB + LDY MON.YSAV +FAKE.MONITOR + JSR FMN5 INDIRECT TO MON.GETNUM + STY MON.YSAV + CMP #$C6 $8D EOR $B0 PLUS $89 + BEQ FMN4 ... + LDY #22 # CMDS - 1 +FMN2 CMP MON.CHRTBL,Y + BEQ FMN1 ...FOUND CMD IN TABLE + DEY ...NEXT ENTRY + BPL FMN2 ...NEXT ENTRY +FMN3 JSR MON.BELL ...NOT IN TABLE + JMP READ.LINE +FMN4 LDA MON.MODE COMMAND + LDY #0 + DEC MON.YSAV + JSR MON.BL1 + JMP READ.LINE +FMN5 JMP ($FF74) MON.GETNUM CALL +*-------------------------------- +* ESCAPE-L +* COLUMN 0: LOAD A FILE +* COL. 1-N: MAKE "*------" LINE +*-------------------------------- +ESCAPE.L + TXA + BEQ .3 "LOAD ...." +*---GENERATE STAR-DASH LINE------ + LDA #CHR.STAR +.1 JSR INSTALL.CHAR + LDA USER.COM.DELIM + CPX #38 + BCC .1 +.2 RTS +*---GENERATE LOAD COMMAND-------- +.3 JSR IO.HTABX HTAB TO FIRST COLUMN + LDY #QBLOADB " LOAD " + JSR QT.OUT + LDX #22 + JSR IO.HTABX + JSR GET.DOS.CMD.OFF.SCRN + PLA POP RETURN ADDRESS + PLA + JMP RDL.EOL SUBMIT COMMAND +*-------------------------------- +* ESC-S AUTO SAVE LINE +*-------------------------------- +ESCAPE.S + TXA + BNE .4 ...NOT IN COLUMN 1 + JSR SETUP.TEXT.POINTERS + LDX #10 MUST APPEAR IN FIRST 10 LINES +.1 LDY #3 POINT TO FIRST TEXT CHAR OF LINE + LDA (SRCP),Y + JSR CHECK.COMMENT.CHAR + BEQ .5 +.2 DEX PAST 10TH LINE? + BMI .4 ...YES, LOOK NO FURTHER + LDY #0 POINT TO LENGTH + LDA (SRCP),Y + CLC + ADC SRCP + STA SRCP + BCC .3 + INC SRCP+1 +.3 JSR CMP.SRCP.ENDP PAST END OF PROGRAM? + BCC .1 ...NO, KEEP LOOKING +.4 RTS +.5 INY + LDA (SRCP),Y + BEQ .2 ...END OF LINE + CMP #'S' + BNE .5 + JSR LIST.CURRENT.LINE +*-------------------------------- +GET.DOS.CMD.OFF.SCRN + JSR IO.CLREOL + LDY #0 NOW PICK 0...39 OFF SCREEN + LDX #0 BUT NO BLANKS +.1 JSR IO.PICK.SCREEN + STA WBUF,X STORE IN BUFFER + INY + CMP #" " ELIMINATE BLANKS + BEQ .2 ...BLANK + INX +.2 CPY #39 + BCC .1 +.3 DEY + JSR IO.PICK.SCREEN + CMP #" " + BEQ .3 + INY + TYA + JMP IO.HTAB POSITION AFTER LAST NON-BLANK +*-------------------------------- +* INSTALL CHARACTER IN INPUT BUFFER +*-------------------------------- +INSTALL.CHAR + ORA #$80 ASSURE SIGN BIT ON + STA WBUF,X STORE IN INPUT BUFFER + CMP #$A0 CONTROL CHAR? + BCS .1 ...NO + AND #$3F ...YES, DISPLAY AS INVERSE +.1 JSR IO.COUT ECHO ON SCREEN + CPX #WBUF.MAX SEE IF END OF BUFFER + BCS .2 ...YES + INX + RTS +.2 JSR MON.BELL + SEC + RTS +*-------------------------------- +* STRIP SIGN BITS OFF ALL BYTES +* AND CHANGE TO +*-------------------------------- +RDL.STRIP.LINE + LDY #$FF LOOP TO CLEAR HIGH BITS +.1 INY + LDA WBUF,Y + AND #$7F STRIP OFF BIT + CMP #$0D WAS IT THE END? + BNE .2 NOT YET + LDA #0 YES, SUBSTITUTE FOR +.2 STA WBUF,Y + BNE .1 UNTIL + TAX CLEAR X-REG + RTS +*-------------------------------- +ESCAPE.DOT + TXA + BNE .5 NOT IN COLUMN 1, IGNORE IT + JSR GET.HORIZ.POSN FIND CURSOR POSITION + TAY +.1 JSR IO.PICK.SCREEN + AND #$7F + JSR CHECK.DIGIT + BCC .2 NOT A DIGIT + STA WBUF+4,X + INX + INY + BNE .1 ...ALWAYS +.2 TXA + BEQ .3 ...NO DIGITS + LDA #4 + STA CHAR.PNTR + STA WBUF+4,X + LDX #CURLNO-A0L + JSR SCAN.1.DECIMAL.NUMBER +.3 LDY #4 + LDX #0 +.4 LDA LDC,Y + JSR INSTALL.CHAR + DEY + BPL .4 + STA CURRENT.CHAR at end, current.char = comma + JSR IO.CLREOP +.5 RTS +*-------------------------------- +LDC .AS /,.SIL/ +*-------------------------------- +QM. +QM.EDIT .AT /EDIT / +QM.CATALOG .AT /CATALOG/ +QM.PREFIX .AT /PREFIX/ +QM.LIST .AT /LIST / +QM.FIND .AT /FIND / +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/scmasm.s.rline +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/SCMASM.S.SCMD.txt b/SCMASM.30/SCMASM.S.SCMD.txt new file mode 100644 index 00000000..6a2a685d --- /dev/null +++ b/SCMASM.30/SCMASM.S.SCMD.txt @@ -0,0 +1,118 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* SEARCH COMMAND TABLE +*-------------------------------- +SEARCH.COMMAND.TABLE + LDX #-1 COMMAND STRING INDEX +.1 LDY #0 BUFFER INDEX + STY CHAR.PNTR +.2 INX NEXT POSITION IN CMD.TBL + JSR GNC.UC NEXT CHARACTER OF COMMAND + BCS .7 ...END OF LINE + JSR CHECK.LETTER + BCC .6 ...NOT A LETTER + LDA CMD.TBL,X NEXT CHAR OF COMMAND NAME + BEQ PASS.CMD.TO.PRODOS ...END OF TABLE + EOR CURRENT.CHAR + BEQ .2 ...CORRECT CHARACTER + ASL SHIFT OUT END.OF.NAME FLAG + BNE .5 ...REALLY DIFFERENT +*---GO TO PROCESS COMMAND-------- +.3 LDA CMD.TBL+2,X + PHA + LDA CMD.TBL+1,X + PHA + LDX #0 + RTS +*---SCAN TO NEXT TABLE ENTRY----- +.5 INX + LDA CMD.TBL-1,X + BPL .5 + INX SKIP OVER ADDRESS + BNE .1 ...ALWAYS +*---ALL LETTERS MATCH------------- +.6 DEY BACK OFF + STY CHAR.PNTR +.7 CPY #3 AT LEAST THREE LETTERS? + BCC PASS.CMD.TO.PRODOS ...NO, SPELLED WRONG +.9 LDA CMD.TBL,X + BMI .3 ...AT END OF COMMAND NAME + INX + BNE .9 ...ALWAYS +*---NOT FOUND IN TABLE------------ +PASS.CMD.TO.PRODOS + .DO 0 NO LONGER NECESSARY, BECAUSE 00=8D IN SCI + LDX #-1 APPEND A FOR PRODOS +.1 INX + LDA WBUF,X LOOK FOR TERMINATING 00 + BNE .1 ...NOT YET + LDA #$8D + STA WBUF,X + .FIN EFFECTIVE 10-23-86 + JSR SCI.COMMAND GIVE ProDOS A SHOT AT IT + BCC .2 ProDOS liked it! + JMP PRODOS.ERROR ...not acceptable, explain why +.2 RTS +*-------------------------------- +* COMMAND STRINGS +*-------------------------------- + .MA CTBL + .AT /]1/ + .DA ]1-1 + .EM +*-------------------------------- +CMD.TBL + >CTBL ASM + >CTBL AUTO + >CTBL COPY + >CTBL DATE + >CTBL DELETE + >CTBL EDIT + >CTBL FAST + >CTBL FIND + >CTBL FP + >CTBL HELP + >CTBL HIDE + >CTBL HIMEM + >CTBL INCREMENT + >CTBL LIST + >CTBL LOMEM + >CTBL MANUAL + >CTBL MEMORY + >CTBL MERGE + >CTBL MGO + >CTBL MNTR + >CTBL NEW + >CTBL PRT + >CTBL RENUMBER + >CTBL REPLACE + >CTBL RESTORE + >CTBL RST + >CTBL SLOW + >CTBL SYMBOLS + >CTBL TEXT + >CTBL TIME + >CTBL USR + >CTBL VAL + >CTBL VERSION + .HS 00 END OF TABLE +*-------------------------------- +SCT.1 INY + INY + INY +SEARCH.CHAR.TABLES + LDA CHAR.TABLES,Y + BEQ .1 ...NOT IN TABLE + CMP CURRENT.CHAR + BNE SCT.1 +.1 LDA CHAR.TABLES+2,Y + PHA + LDA CHAR.TABLES+1,Y + PHA + RTS +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/scmasm.s.scmd +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/SCMASM.S.SYMT.txt b/SCMASM.30/SCMASM.S.SYMT.txt new file mode 100644 index 00000000..85cf95ad --- /dev/null +++ b/SCMASM.30/SCMASM.S.SYMT.txt @@ -0,0 +1,495 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* INITIALIZE SYMBOL TABLE +* 1. SET EOT TO BOT +* 2. CLEAR HASH POINTER TABLE +*-------------------------------- +STINIT LDA LO.MEM START OF SYMBOL TABLE + STA EOT + LDA LO.MEM+1 + STA EOT+1 + STA MACLBL+1 PRIVATE LABELS GO DOWN FROM THERE + LDX #56 # BYTES IN HASH POINTER TABLE + LDA #0 + STA MACLBL + STA CURRENT.MAJOR.LABEL+1 +.1 STA HSHTBL-1,X + DEX + BNE .1 + .DO AUXMEM + LDA RDRAM + LDA RDRAM + LDX #AUX.IMAGE.LEN-1 +.2 LDA AUX.IMAGE,X + STA AUX.CODE,X + DEX + BPL .2 +BACK.TO.ROM + PHA + LDA RDROM + PLA + .FIN + RTS RETURN WITH X=0 +*-------------------------------- + .DO AUXMEM +LDA.STPNTR + BIT RDRAM + JSR LDA.STPNTR.AUX + JMP BACK.TO.ROM +* +ADC.STPNTR + BIT RDRAM + JSR ADC.STPNTR.AUX + JMP BACK.TO.ROM +* +SBC.STPNTR + BIT RDRAM + JSR SBC.STPNTR.AUX + JMP BACK.TO.ROM +* +LDA.PNTR + BIT RDRAM + JSR LDA.PNTR.AUX + JMP BACK.TO.ROM +* +LDA.TPTR + BIT RDRAM + JSR LDA.TPTR.AUX + JMP BACK.TO.ROM +* +LDA.SRCP + BIT RDRAM + JSR LDA.SRCP.AUX + JMP BACK.TO.ROM +* +STA.PNTR + STA WRAUX + STA (PNTR),Y + STA WRMAIN + RTS +STA.STPNTR + STA WRAUX + STA (STPNTR),Y + STA WRMAIN + RTS +*-------------------------------- +AUX.IMAGE +LDA.STPNTR.AUX .EQ *-AUX.IMAGE+AUX.CODE + STA RDAUX + LDA (STPNTR),Y + STA RDMAIN + RTS +ADC.STPNTR.AUX .EQ *-AUX.IMAGE+AUX.CODE + STA RDAUX + ADC (STPNTR),Y + STA RDMAIN + RTS +SBC.STPNTR.AUX .EQ *-AUX.IMAGE+AUX.CODE + STA RDAUX + SBC (STPNTR),Y + STA RDMAIN + RTS +LDA.PNTR.AUX .EQ *-AUX.IMAGE+AUX.CODE + STA RDAUX + LDA (PNTR),Y + STA RDMAIN + RTS +LDA.TPTR.AUX .EQ *-AUX.IMAGE+AUX.CODE + STA RDAUX + LDA (TPTR),Y + STA RDMAIN + RTS +LDA.SRCP.AUX .EQ *-AUX.IMAGE+AUX.CODE + STA RDAUX + LDA (SRCP),Y + STA RDMAIN + RTS +AUX.IMAGE.LEN .EQ *-AUX.IMAGE + .FIN +*-------------------------------- +* A table of 28 pointers begins at $130, called HSHTBL. +* Each pointer points to the beginning of a chain of +* symbol entries. The entries on a chain are kept +* in alphabetical order. If a chain is empty, the +* pointer = $0000. +* +* HSHTBL+$00: Chain for target file entries +* HSHTBL+$02: Chain for labels starting with "A" +* HSHTBL+$04: Chain for labels starting with "B" +* - - - +* HSHTBL+$34: Chain for labels starting with "Z" +* HSHTBL+$36: Chain for Macro Names and Skeletons +* +* Format of Target File Entry: +* 0,1 -- Forward chain pointer (0=end of chain) +* 2,3 -- Length of target file in bytes +* 4 -- Length of code name = $02 +* 5,6 -- Target file code name: +* 5: "@" = $40 +* 6: $40 + target file number ($00-$1F) +* +* Format of Label Entry: +* 0,1 -- Forward chain pointer (0=end of chain) +* 2-5 -- Value of label +* 6 -- Flags and length of label name: +* Bits 5-0: length of label name ($01-$20) +* Bit 6: =1 if forward reference +* Bit 7: =1 if has local labels +* 7 -- First character of label name, and flag. +* Bit 7 = 1 if label is .SEt label. +* thru 6+n -- The rest of the label name, with bit 7 = 0 +* +* If the label has local labels, they follow. +* Each local label occupies two bytes: +* 1 -- Label number (0-99) +128 +* 2 -- Label value (distance from value of +* named label) +* The local label list is terminated with a $00 +* in the label number position. +* +* Format of Macro Definition Entry: +* 0,1 -- Chain to next macro name +* 2,3 -- $0000 +* 4 -- Length of macro name +* 5 -- "[" + $5B +* 6-n -- Rest of Macro name +* etc.-- The packed skeleton lines, each +* terminated by $00. A final $00 +* terminates the skeleton. +* +* Private Labels are kept in a separate table. +* Each label takes 7 bytes. Bytes 0-3 are the +* value, byte 4 is the colon number + $80, +* and bytes 5 and 6 are the macro call number. +* The Private Label table grows downward from +* MACLBL toward $0800. +* +*-------------------------------- +* PACK SYMBOL FROM INPUT LINE +* UP TO 32 CHARACTERS PACKED AT SYMBOL+7 +* AND FOLLOWING. +* # CHARS STORED IN SYMBOL+6 +* RETURN CARRY CLEAR IF NO SYMBOL +* RETURN CARRY SET IF GOOD SYMBOL +*-------------------------------- +PACK LDX #0 POINT AT 1ST CHAR IN NAME + CMP #CHR.PERIOD LOCAL SYMBOL? + BEQ .1 YES + CMP #': COLON MEANS MACRO PRIVATE LABEL + BNE .3 NO, NORMAL SYMBOL +.1 STA SYMBOL+7 SAVE PERIOD OR COLON + JSR GNC.UC GET NEXT CHAR + JSR CHECK.DIGIT + BCC .4 NO, BAD SYMBOL + JSR DECN CONVERT TO BINARY + LDX #0 IN CASE BAD SYMBOL... + LDA DGTCNT VALUE MUST BE < 100 + CMP #3 SO MUST BE 1 OR 2 DIGITS + BCS .4 ...TOO MANY DIGITS, BAD SYMBOL + LDA SYM.VALUE + ORA #$80 BE SURE NOT 00 + STA SYMBOL+8 SAVE VALUE + LDA CALL.NUM JUST IN CASE IT'S A + STA SYMBOL+9 MACRO PRIVATE LABEL + LDA CALL.NUM+1 + STA SYMBOL+10 + INX SIGNAL GOOD SYMBOL + BNE .4 ...ALWAYS +*-------------------------------- +.3 JSR PACK.NAME +.4 JSR BACKUP.CHAR.PNTR + STX SYMBOL+6 SAVE LENGTH + CPX #1 CARRY SET IF AT LEAST ONE CHAR + LDX #0 CLEAR X AGAIN + RTS +*-------------------------------- +* PACK A NAME INTO SYMBOL +*-------------------------------- +PACK.NAME + JSR CHECK.LETTER + BCC .4 NOT A LETTER +.1 CPX #32 SEE IF ALREADY 32 CHARACTERS + BEQ .2 YES, IGNORE + STA SYMBOL+7,X PUT CHAR IN ENTRY + INX POINT AT NEXT SLOT +.2 JSR GNC.UC GET NEXT CHAR FROM LINE + JSR CHECK.DOT.DIGIT.OR.LETTER + BCS .1 VALID CHAR +.4 RTS END OF NAME +*-------------------------------- +* SEARCH SYMBOL TABLE +* # OF CHARS STORED AT SYMBOL+6 +* SYMBOL ITSELF AT SYMBOL+7 AND FOLLOWING +* JSR STSRCH +* IF FOUND: CARRY CLEAR +* (STPNTR)=ADDRESS OF ENTRY +* IF NOT FOUND: CARRY SET +* (STPNTR)=ADDRESS OF +* POINTER CELL WHICH +* SHOULD POINT AT ENTRY +*-------------------------------- +STSRCH SEC CONVERT FIRST CHARACTER + LDA SYMBOL+7 OF SYMBOL TO HASH TABLE INDEX + CMP #CHR.PERIOD SEE IF LOCAL SYMBOL + BEQ .8 YES + CMP #': COLON, THEN PRIVATE LABEL + BNE .12 NO, NORMAL LABEL + JMP SEARCH.PRIVATE.LABELS +.12 SBC #$40 AT-SIGN + ASL DOUBLE INDEX, CLEAR CARRY + ADC #HSHTBL + STA STPNTR + LDA /HSHTBL + ADC #0 + STA STPNTR+1 +.1 LDY #0 + >SYM LDA,STPNTR GET POINTER FROM ENTRY + STA TPTR + INY + >SYM LDA,STPNTR + BEQ .4 END OF CHAIN, NOT IN TABLE + STA TPTR+1 + LDX SYMBOL+6 # CHARS IN SYMBOL + LDY #6 POINT AT LENGTH + >SYM LDA,TPTR USE MINIMUM LENGTH + AND #$3F ISOLATE LENGTH + CMP SYMBOL,Y + INY + BCS .2 + TAX +.2 >SYM LDA,TPTR COMPARE BYTES FROM BOTH + AND #$7F ALLOW FLAG BITS IN SYMBOL + CMP SYMBOL,Y + BCC .3 NOT THIS ONE, BUT KEEP LOOKING + BNE .4 NOT IN THIS CHAIN + DEX + BEQ .5 THE NAME IS THE SAME OR A SUBSET + INY NEXT BYTE PAIR + BNE .2 ...ALWAYS +.3 JSR .7 UPDATE POINTER, CLEAR CARRY + BCC .1 ...ALWAYS +.4 SEC DID NOT FIND + LDX #0 RESTORE X=0 + RTS +.5 LDY #6 TEST LENGTHS + >SYM LDA,TPTR + AND #$3F ISOLATE LENGTH + CMP SYMBOL+6 # CHARS IN SYMBOL IN TABLE + BEQ .6 SAME EXACTLY + BCS .4 NEW SYMBOL IS SHORTER + BCC .3 NEW SYMBOL IS LONGER +.6 LDY #2 POINT AT VALUE +.65 >SYM LDA,TPTR SET UP VALUE FOR EXPR SCAN + STA SYM.VALUE-2,Y + INY + CPY #6 + BCC .65 +.7 LDA TPTR + STA STPNTR + LDA TPTR+1 + STA STPNTR+1 + CLC SIGNAL DID FIND IT + RTS +*-------------------------------- +.8 LDA CURRENT.MAJOR.LABEL + STA STPNTR + LDA CURRENT.MAJOR.LABEL+1 + BEQ .11 + STA STPNTR+1 + CLC + LDY #6 POINT AT LENGTH + >SYM LDA,STPNTR GET LENGTH OF MAJOR SYMBOL + BPL .4 NO LOCAL SYMBOLS YET + AND #$3F MASK TO REAL LENGTH + ADC #7 POINT AT LOCALS + TAY +.9 >SYM LDA,STPNTR + BEQ .4 END OF LOCALS, NOT FOUND + CMP SYMBOL+8 COMPARE TO NAME OF LOCAL + BEQ .10 FOUND IT! + INY SKIP TO NEXT LOCAL + INY + BNE .9 ...ALWAYS +.10 INY POINT AT VALUE OFFSET + >SYM LDA,STPNTR + CLC + LDY #2 POINT AT MAJOR VALUE + >SYM ADC,STPNTR + STA SYM.VALUE + INY + >SYM LDA,STPNTR + ADC #0 + STA SYM.VALUE+1 + INY + >SYM LDA,STPNTR + ADC #0 + STA SYM.VALUE+2 + INY + >SYM LDA,STPNTR + ADC #0 + STA SYM.VALUE+3 + CLC + RTS +.11 LDY #QER9 NO NORMAL LABEL YET + JMP SOFT.ERROR +*-------------------------------- +* SEARCH PRIVATE LABEL TABLE +*-------------------------------- +SEARCH.PRIVATE.LABELS + LDA MACLBL + STA STPNTR + LDA MACLBL+1 +.1 STA STPNTR+1 + CMP LO.MEM+1 END OF TABLE YET? + BCS .3 ...YES, NO MORE LABELS + LDY #6 + >SYM LDA,STPNTR + AND #$3F ISOLATE FROM FLAG BITS + CMP SYMBOL+10 + BNE .2 NO + DEY + >SYM LDA,STPNTR + CMP SYMBOL+9 + BNE .2 NO + DEY + >SYM LDA,STPNTR + CMP SYMBOL+8 + BEQ .4 YES, FOUND IT! +.2 CLC BUMP PNTR TO NEXT LABEL + LDA STPNTR + ADC #7 + STA STPNTR + LDA STPNTR+1 + ADC #0 + BNE .1 ...ALWAYS +*-------------------------------- +.3 SEC SIGNAL NOT FOUND + RTS +*-------------------------------- +.4 DEY +.5 >SYM LDA,STPNTR + STA SYM.VALUE,Y + DEY + BPL .5 + CLC + RTS +*-------------------------------- +* ADD SYMBOL TO TABLE +*-------------------------------- +STADD LDA SYMBOL+7 SEE IF LOCAL SYMBOL + CMP #CHR.PERIOD + BEQ .5 YES + CMP #': COLON, PRIVATE LABEL + BNE .11 NO, NORMAL LABEL + JMP ADD.PRIVATE.LABEL +.11 LDY #1 POINT AT POINTER +.1 >SYM LDA,STPNTR GET CURRENT POINTER + STA SYMBOL,Y + LDA EOT,Y + >SYM STA,STPNTR + STA PNTR,Y + STA CURRENT.MAJOR.LABEL,Y + LDA ORGN,Y VALUE + STA SYMBOL+2,Y + LDA ORGN+2,Y + STA SYMBOL+4,Y + DEY + BPL .1 + CLC COMPUTE ENTRY SIZE + LDA SYMBOL+6 FROM SYMBOL SIZE + ADC #7 +.2 PHA SAVE SIZE + LDY EOT+1 + CLC + ADC EOT SEE IF ROOM FOR NEW ENTRY + BCC .10 + INY + .DO AUXMEM +.10 CPY /$C000 + BCS .4 MEM FULL ERR + STA EOT + .ELSE +.10 CMP MACSTK + TAX SAVE LOW BYTE + TYA GET HIGH BYTE + SBC MACSTK+1 + BCS .4 MEM FULL ERR + STX EOT + .FIN + STY EOT+1 + PLA GET SIZE + TAY + DEY CORRECT FOR INDEXING +.3 LDA SYMBOL,Y + >SYM STA,PNTR + DEY + BPL .3 + RTS +.4 JMP MFER MEM FULL ERR +*-------------------------------- +.5 LDY #6 LENGTH BYTE + >SYM LDA,STPNTR + BMI .6 ALREADY HAVE SOME LOCAL LABELS + ORA #$80 SET LOCAL FLAG + >SYM STA,STPNTR + BNE .8 ...ALWAYS +.6 LDA EOT BACK UP EOT + BNE .7 OVER 00 TERMINATOR + DEC EOT+1 OF LOCALS +.7 DEC EOT +.8 LDA SYMBOL+8 NAME OF LOCAL + STA SYMBOL SET UP TO ADD TO SYMBOL TABLE + SEC + LDY #1 + JSR CALC.OFFSET.BYTE + JSR CALC.OFFSET.BYTE + BNE .9 ERROR > 255 + JSR CALC.OFFSET.BYTE + BNE .9 ERROR > 255 + JSR CALC.OFFSET.BYTE + BNE .9 ERROR > 255 + LDA EOT + STA PNTR + LDA EOT+1 + STA PNTR+1 + LDA #3 SIZE IS 3 BYTES + BNE .2 ...ALWAYS +.9 JMP GT255ERR VALUE > 255 +*-------------------------------- +CALC.OFFSET.BYTE + INY + LDA ORGN-2,Y + >SYM SBC,STPNTR + STA SYMBOL-1,Y + RTS +*-------------------------------- +* ADD A PRIVATE LABEL +*-------------------------------- +ADD.PRIVATE.LABEL + SEC + LDA MACLBL + SBC #7 + STA MACLBL + STA STPNTR + LDA MACLBL+1 + SBC #0 + STA MACLBL+1 + STA STPNTR+1 + CMP #8 BELOW $0800? + BCC .3 YES, NO MORE ROOM + LDY #6 POINT AT LAST BYTE +.1 LDA SYMBOL+4,Y + CPY #4 + BCS .2 + LDA ORGN,Y +.2 >SYM STA,STPNTR + DEY + BPL .1 + RTS +.3 JMP MFER +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/scmasm.s.symt +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/SCMASM.S.TSRCH.txt b/SCMASM.30/SCMASM.S.TSRCH.txt new file mode 100644 index 00000000..62d26ded --- /dev/null +++ b/SCMASM.30/SCMASM.S.TSRCH.txt @@ -0,0 +1,291 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* SEARCH TEXT BUFFER FOR LINE +* +* LINE NUMBER TO BE FOUND IS AT 0,X AND 1,X +* +* IF FOUND, RETURN CARRY SET +* (LINE.START) = ADDRESS OF LINE +* (LINE.END ) = ADDRESS OF NEXT LINE +* +* IF NOT FOUND, RETURN CARRY CLEAR +* (LINE.START) = ADDRESS OF NEXT LINE +* (LINE.END ) = ADDRESS OF NEXT LINE +* +*-------------------------------- +SERTXT LDA PP START AT BEGINNING OF TEXT BUFFER + STA LINE.END + LDA PP+1 + STA LINE.END+1 +SERNXT LDA LINE.END+1 CONTINUE SEARCH WITH NEXT LINE + STA LINE.START+1 + LDA LINE.END + STA LINE.START + CMP HI.MEM + LDA LINE.START+1 SEE IF AT END YET + SBC HI.MEM+1 + BCS .3 YES, DID NOT FIND + LDY #0 POINT AT LINE LENGTH + LDA (LINE.START),Y GET LINE LENGTH + ADC LINE.END POINT TO NEXT LINE + STA LINE.END + BCC .1 + INC LINE.END+1 +.1 INY POINT AT LINE NUMBER + LDA (LINE.START),Y COMPARE TO DESRIRED LINE NUMBER + CMP 0,X + INY + LDA (LINE.START),Y + SBC 1,X + BCC SERNXT NOT THERE YET + BNE .2 PASSED IT UP + DEY CHECK LOW BYTE AGAIN + LDA (LINE.START),Y + CMP 0,X + BEQ .4 FOUND IT! +.2 LDA LINE.START PASSED IT UP + STA LINE.END MAKE BOTH POINT AT SAME LINE + LDA LINE.START+1 + STA LINE.END+1 +.3 CLC RETURN CARRY CLEAR +.4 RTS +*-------------------------------- +* DELETE LINES +*-------------------------------- +DELETE + JSR GNNB GET NEXT NON-BLANK CHAR + CMP #'/' + BEQ .1 ...PATHNAME + + JSR CHECK.LETTER + BCC .2 ...NOT LETTER, PROBABLY LINES + +.1 JMP PASS.CMD.TO.PRODOS + +.2 JSR BACKUP.CHAR.PNTR + JSR PARSE.LINE.RANGE + BCS SYNX.3 ...NO NUMBERS, SYNTAX ERROR + +DELETE.LINES + LDX #-1 + SEC +.2 LDA SRCP+1,X SEE IF RANGE EMPTY OR CROSSED + STA LINE.START+1,X + LDA ENDP+1,X + STA A4L+1,X + SBC LINE.START+1,X + STA MOVE.DISTANCE+1,X + INX + BEQ .2 + TAX TEST HI-BYTE OF MOVE.DISTANCE + BPL MOVE.TEXT.UP ...POSITIVE, RANGE GOOD +SYNX.3 JMP SYNX +*-------------------------------- +* MOVE TEXT FROM THRU +* UP BYTES TO +*-------------------------------- +MOVE.TEXT.UP + JSR COMPUTE.BLOCK.SIZE + CLC + LDA PP + ADC MOVE.DISTANCE + STA PP + LDA PP+1 + ADC MOVE.DISTANCE+1 + STA PP+1 + LDY #0 + BEQ .3 ...ALWAYS +*---MOVE A WHOLE BLOCK----------- +.1 LDA (LINE.START),Y MOVE BYTES 255 THRU 1 IN BLOCK + STA (A4L),Y +.2 DEY + BNE .1 + LDA (LINE.START),Y MOVE LOWEST BYTE IN BLOCK + STA (A4L),Y +.3 DEC LINE.START+1 PRIOR BLOCK + DEC A4H + DEX ANY MORE BLOCKS? + BNE .2 YES +*---MOVE SHORT BLOCK IF ANY------ + LDX BLKSIZ PARTIAL BLOCK SIZE + BEQ .5 NONE LEFT +.4 DEY + LDA (LINE.START),Y + STA (A4L),Y + DEX + BNE .4 +.5 RTS +*-------------------------------- +* COPY L1,L2,L3 +* L1 = FIRST LINE OF RANGE TO COPY +* L2 = LAST LINE OF RANGE TO COPY +* L3 = LINE NUMBER BEFORE WHICH TO INSERT +* THE COPIED LINES +*-------------------------------- +ERR1 JMP SYNX +ERR2 .EQ ERR1 +ERR3 JMP MFER +ERR4 .EQ ERR1 +*-------------------------------- +COPY + JSR PARSE.LINE.RANGE + JSR GNNB look for a comma + CMP #',' + BNE ERR1 ...no comma + SEC SAVE POINTER AND COMPUTE LENGTH + LDA SRCP REALLY -(LENGTH) + SBC ENDP + STA MOVE.DISTANCE + LDA SRCP+1 + SBC ENDP+1 + STA MOVE.DISTANCE+1 + BPL ERR2 RANGE BACKWARD OR EMPTY +*-------------------------------- + CLC + LDA PP COMPUTE NEW PP POINTER + ADC MOVE.DISTANCE + STA A4L + LDA PP+1 + ADC MOVE.DISTANCE+1 + STA A4H +*-------------------------------- + LDA A4L SEE IF ROOM FOR THIS + CMP LO.MEM + LDA A4L+1 + SBC LO.MEM+1 + BCC ERR3 MEM FULL ERR +*---Get Target Line Number------- + JSR GNNB pick up first digit of target line number + JSR SCAN.LINE.NUMBER (or it might be ".") + BCS ERR1 ...not a line number of "." + LDA 0,X copy line number to A0L,H + STA A0L + LDA 1,X + STA A0H +*---Verify valid target line----- + LDA SRCP BE SURE NOT INSIDE SOURCE BLOCK + CMP LINE.START + LDA SRCP+1 + SBC LINE.START+1 + BCS .1 BELOW SOURCE BLOCK + LDA LINE.START + CMP ENDP + LDA LINE.START+1 + SBC ENDP+1 + BCC ERR4 INSIDE SOURCE BLOCK +*-------------------------------- +* TARGET IS ABOVE SOURCE BLOCK, SO WE HAVE TO +* ADJUST SOURCE BLOCK POINTERS. +*-------------------------------- + CLC + LDA SRCP + ADC MOVE.DISTANCE + STA SRCP + LDA SRCP+1 + ADC MOVE.DISTANCE+1 + STA SRCP+1 + CLC + LDA ENDP + ADC MOVE.DISTANCE + STA ENDP + LDA ENDP+1 + ADC MOVE.DISTANCE+1 + STA ENDP+1 +*-------------------------------- +.1 JSR MOVE.TEXT.DOWN MAKE THE HOLE +*-------------------------------- + LDA SRCP SAVE SRCP AT A1 + STA A1L (POINTS TO BLOCK TO BE COPIED) + LDA SRCP+1 + STA A1H +.2 CLC ADD (Y) TO A4 + TYA + ADC A4L POINTS TO BEGINNING OF NEXT + STA A4L LINE IN HOLE + BCC .3 + INC A4H +.3 LDY #0 + LDA (A1L),Y COPY LINE LENGTH + STA (A4L),Y + INY INSERT LINE # + LDA A0L OF TARGET LINE + STA (A4L),Y + INY INSERT LINE # + LDA A0H OF TARGET LINE + STA (A4L),Y +.4 INY COPY REST OF LINE + LDA (A1L),Y + STA (A4L),Y + BNE .4 UNTIL TOKEN + INY + CLC + TYA + ADC A1L POINT TO NEXT SOURCE LINE + STA A1L + BCC .5 + INC A1H +.5 CMP ENDP + LDA A1H + SBC ENDP+1 + BCC .2 + LDY #QDELOR + JSR YES.OR.NO + BNE .6 + JSR DELETE.LINES +.6 RTS +*-------------------------------- +* MOVE TEXT FROM THRU +* DOWN - BYTES TO +*-------------------------------- +MOVE.TEXT.DOWN + JSR COMPUTE.BLOCK.SIZE + LDA PP + STA A2L + LDA PP+1 + STA A2H + LDA A4L + STA PP + LDA A4H + STA PP+1 + LDY #0 + BEQ .2 ...ALWAYS +.1 LDA (A2L),Y YES, MOVE 256 BYTES + STA (A4L),Y + INY + BNE .1 + INC A2H POINT AT NEXT BLOCK + INC A4H +.2 DEX ANY WHOLE BLOCKS LEFT? + BNE .1 YES +*---MOVE PARTIAL BLOCK----------- + LDX BLKSIZ SIZE OF PARTIAL BLOCK + BEQ .4 EMPTY +.3 LDA (A2L),Y + STA (A4L),Y + INY + DEX + BNE .3 +.4 RTS +*-------------------------------- +* COMPUTE SIZE OF TEXT BLOCK +* FROM TO +* +* RETURN # WHOLE BLOCKS OF 256 BYTES +1 IN X +* RETURN # BYTES IN PARTIAL BLOCK IN +*-------------------------------- +COMPUTE.BLOCK.SIZE + SEC COMPUTE # OF BYTES TO BE MOVED + LDA LINE.START CURRENT TOP POINTER + SBC PP CURRENT BOTTOM POINTER + STA BLKSIZ SAVE PARTIAL PAGE AMOUNT + LDA LINE.START+1 + SBC PP+1 + TAX # OF WHOLE PAGES IN X + INX + RTS +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/scmasm.s.tsrch +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/SCMASM.S.VECT.txt b/SCMASM.30/SCMASM.S.VECT.txt new file mode 100644 index 00000000..f119ac25 --- /dev/null +++ b/SCMASM.30/SCMASM.S.VECT.txt @@ -0,0 +1,96 @@ +NEW + AUTO 3,1 +*-------------------------------------- + .MA VEC + BIT RDROM + JSR ]1 + BIT RDRAM + RTS + .EM +*-------------------------------- + JMP SEARCH.COMPRESSED.TABLE + JMP GNC + JMP GNC.UC + JMP GNNB + >VEC EXPR + >VEC EXP1 + JMP ASM.ERROR + >VEC EMIT +*-------------------------------- +ERBA LDY #QER5 + JMP SOFT.ERROR +*-------------------------------- + .DUMMY + .OR $D400 +D4.ASM.INIT .BS 3 +D4.ASM.LINE .BS 3 +D4.EMIT.VALUE .BS 3 +D4.DIR.OP .BS 3 +D4.VERSION + .ED +*-------------------------------- +ASM.INIT LDA RDRAM + JSR D4.ASM.INIT + LDA RDROM + RTS +*-------------------------------- +ASM.PARTICULAR LDA RDRAM + JSR D4.ASM.LINE + LDA RDROM + RTS +*-------------------------------- +EMIT.VALUE LDA RDRAM + JSR D4.EMIT.VALUE + LDA RDROM + RTS +*-------------------------------- +PSOP LDA RDRAM + JSR D4.DIR.OP + LDA RDROM + RTS +*-------------------------------- +EXP.OVER.256 + LDA EXP.VALUE+1 + STA EXP.VALUE + LDA EXP.VALUE+2 + STA EXP.VALUE+1 + LDA EXP.VALUE+3 + STA EXP.VALUE+2 + LDA #0 + STA EXP.VALUE+3 + RTS +*-------------------------------- +ASM.ERROR + BIT RDROM + TAX USE ERROR # FOR INDEX + LDY ASM.ERROR.TABLE,X + JMP SOFT.ERROR +*-------------------------------- +ASM.ERROR.TABLE + .DA #QER2 "BAD OPCODE" + .DA #QER5 "BAD ADDRESS" + .DA #QER3 "RANGE" + .DA #QER6 "UNDEF LABEL" +*-------------------------------- +VERSION + LDY #QSC + JSR QT.OUT + LDY #2 +.1 LDA Q.VERSION,Y + JSR MY.COUT + DEY + BPL .1 + LDA #$8D +.2 JSR MY.COUT + INY + LDA RDRAM + LDX D4.VERSION,Y + LDA RDROM + TXA + BNE .2 + RTS +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/scmasm.s.vect +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/SCMASM.S.XTDIR.txt b/SCMASM.30/SCMASM.S.XTDIR.txt new file mode 100644 index 00000000..af189726 --- /dev/null +++ b/SCMASM.30/SCMASM.S.XTDIR.txt @@ -0,0 +1,85 @@ +NEW + AUTO 3,1 +*-------------------------------------- + .DO 1 +*-------------------------------- +DIR. .SE 0 + .MA DIR + .DO "]1"=DIR.=0 + .DA #"]1"-$C0 +DIR. .SE "]1" + .FIN + .DA #"]2"-$40,]3-1 .]1]2 + .EM +*-------------------------------- +OPTBL.DIR + >DIR A,C,DIR.AC ASCII STRING COMPRESSED + >DIR A,S,PSAS ASCII STRING + >DIR A,T,PSAT ASCII STRING WITH LAST BYTE + >DIR A,Z,PSAZ ASCII STRING WITH ZERO END + >DIR B,S,PSBS BLOCK STORAGE + >DIR D,A,PSDA DATA + >DIR D,O,PSDO DO + >DIR D,U,D.DUMMY DUMMY + >DIR E,D,D.END.DUMMY + >DIR E,L,PSEL ELSE + >DIR E,N,PSEN END OF SOURCE + >DIR E,P,D.END.PHASE + >DIR E,Q,PSEQ EQUATE + >DIR F,I,PSFI FIN + >DIR H,S,PSHS HEX STRING + >DIR I,N,PSIN INCLUDE + >DIR L,I,PSLI LIST ON,/ OFF + >DIR M,A,PSMA MACRO + >DIR O,P,PSOP OPCODE TABLE SELECT + >DIR O,R,PSOR ORIGIN + >DIR P,G,PSPG PAGE EJECT + >DIR P,H,D.PHASE PHASE + >DIR T,A,PSTA TARGET ADDRESS + >DIR T,F,PSTF TARGET FILE + >DIR T,I,PSTI TITLE + >DIR U,S,PSUSER USER DIRECTIVE + .HS 41 <<>> +*-------------------------------- + .ELSE +*-------------------------------- +* DIRECTIVE TABLE +*-------------------------------- + .MA DIR + .AS /]1/ + .DA ]2-1 + .EM +*--------------------------------- +OPTBL.DIR + .HS 0402 ITEM SIZE, KEY SIZE + >DIR AS,PSAS ASCII STRING + >DIR AT,PSAT ASCII STRING WITH LAST BYTE + >DIR BS,PSBS BLOCK STORAGE + >DIR DA,PSDA DATA + >DIR DO,PSDO DO + >DIR DU,D.DUMMY DUMMY + >DIR ED,D.END.DUMMY + >DIR EL,PSEL ELSE + >DIR EN,PSEN END OF SOURCE + >DIR EP,D.END.PHASE + >DIR EQ,PSEQ EQUATE + >DIR FI,PSFI FIN + >DIR HS,PSHS HEX STRING + >DIR IN,PSIN INCLUDE + >DIR LI,PSLI LIST ON,/ OFF + >DIR MA,PSMA MACRO + >DIR OP,PSOP OPCODE TABLE SELECT + >DIR OR,PSOR ORIGIN + >DIR PG,PSPG PAGE EJECT + >DIR PH,D.PHASE PHASE + >DIR TA,PSTA TARGET ADDRESS + >DIR TF,PSTF TARGET FILE + >DIR TI,PSTI TITLE + >DIR US,PSUSER USER DIRECTIVE + .HS 00 MARK END OF TABLE + .FIN +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/scmasm.s.xtdir +LOAD usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.30/SCMASM.S.txt b/SCMASM.30/SCMASM.S.txt new file mode 100644 index 00000000..1b063cb3 --- /dev/null +++ b/SCMASM.30/SCMASM.S.txt @@ -0,0 +1,83 @@ +NEW + AUTO 3,1 + .LIST OFF + .OR $2000 + .TF SCMASM.30,TSYS +*-------------------------------------- +VERSION.HI .EQ 3 VERSION 3.0 +VERSION.LO .EQ 0 +*-------------------------------- +AUXMEM .EQ 1 ...USE AUXMEM FOR SYMBOL TABLE +ROCKWELL .EQ 1 0 = LEAVE OUT ROCKWELL OPTION +SWEET.16 .EQ 1 0 = LEAVE OUT SWEET-16 OPTION +*-------------------------------- + .INB usr/src/scmasm.30/scmasm.s.ldr + .BS $2200-* +*-------------------------------- + .PH $8000 + .INB usr/src/scmasm.30/scmasm.s.data + .INB usr/src/scmasm.30/scmasm.s.param + .INB usr/src/scmasm.30/scmasm.s.edit + .INB usr/src/scmasm.30/scmasm.s.mcmds + .INB usr/src/scmasm.30/scmasm.s.scmd + .INB usr/src/scmasm.30/scmasm.s.tsrch + .INB usr/src/scmasm.30/scmasm.s.fndrep + .INB usr/src/scmasm.30/scmasm.s.rline + .INB usr/src/scmasm.30/scmasm.s.elines + .INB usr/src/scmasm.30/scmasm.s.output + .INB usr/src/scmasm.30/scmasm.s.disk + .INB usr/src/scmasm.30/scmasm.s.pline + .INB usr/src/scmasm.30/scmasm.s.asmgen + .INB usr/src/scmasm.30/scmasm.s.asmnl + .INB usr/src/scmasm.30/scmasm.s.exp + .INB usr/src/scmasm.30/scmasm.s.symt + .INB usr/src/scmasm.30/scmasm.s.psym + .INB usr/src/scmasm.30/scmasm.s.macro + .INB usr/src/scmasm.30/scmasm.s.dir1 + .INB usr/src/scmasm.30/scmasm.s.dir2 + .INB usr/src/scmasm.30/scmasm.s.acdir + .INB usr/src/scmasm.30/scmasm.s.newq + .INB usr/src/scmasm.30/scmasm.s.xtdir + .BS $A700-* + .INB usr/src/scmasm.30/scmasm.s.vect + .BS $A800-* + .INB usr/src/scmasm.30/scmasm.s.iostd + .BS $A900-* + .EP +*-------------------------------------- + .PH $AA00 + .INB usr/src/scmasm.30/sci.s.eq + .INB usr/src/scmasm.30/sci.s.cpar + .INB usr/src/scmasm.30/sci.s.cat + .INB usr/src/scmasm.30/sci.s.exec + .INB usr/src/scmasm.30/sci.s.online + .INB usr/src/scmasm.30/sci.s.prin + .INB usr/src/scmasm.30/sci.s.errors + .INB usr/src/scmasm.30/sci.s.loadsave + .INB usr/src/scmasm.30/sci.s.openclose + .INB usr/src/scmasm.30/sci.s.rwpa + .INB usr/src/scmasm.30/sci.s.tables + .BS $BD00-* + .INB usr/src/scmasm.30/sci.s.vars + .BS $BE00-* + .INB usr/src/scmasm.30/sci.s.gp + .BS $BF00-* + .EP +*-------------------------------------- + .INB usr/src/scmasm.30/io.s.iie + .BS $6100-* + .INB usr/src/scmasm.30/io.s.stb80 + .BS $6200-* + .INB usr/src/scmasm.30/io.s.videx + .BS $6400-* + .INB usr/src/scmasm.30/io.s.ultra + .BS $6600-* +*-------------------------------------- + .PH $D400 + .INB usr/src/scmasm.30/asm65816.s + .BS $E000-* + .EP +*-------------------------------------- +MAN +SAVE usr/src/scmasm.30/scmasm.s +ASM diff --git a/SCMASM.31/ASM65816.S..txt b/SCMASM.31/ASM65816.S..txt new file mode 100644 index 00000000..7f5bb1f9 --- /dev/null +++ b/SCMASM.31/ASM65816.S..txt @@ -0,0 +1,991 @@ +NEW + AUTO 3,1 +*-------------------------------------- + .DUMMY + .OR $A700 +ASM65816.SEARCH.TABLE .BS 3 +ASM65816.GNC .BS 3 +ASM65816.GNC.UC .BS 3 +ASM65816.GNNB .BS 3 +ASM65816.EXPR .BS 10 +ASM65816.EXP1 .BS 10 +ASM65816.ASM.ERROR .BS 3 +ASM65816.EMIT .BS 10 +*-------------------------------- + .OR $F0 F0-FF is ASM private ZeroPage +LEVEL.MASK .BS 1 +OPBASE .BS 1 +MODE.BYTE .BS 1 +FORCE.ADDR.SIZE .BS 1 + .ED +*-------------------------------- +ERR.BAD.OPCODE .EQ 0 +ERR.BAD.ADDRESS .EQ 1 +ERR.RANGE .EQ 2 +ERR.UNDEFINED .EQ 3 +*-------------------------------- + JMP ASM65816.ASM.INIT + JMP ASM65816.ASM.LINE + JMP ASM65816.EMIT.VALUE + JMP DIR.OP +*-------------------------------- + .AS -/FOR THE 6502, 65C02, 65R02, 65816/ + .HS 00 +*-------------------------------- +ASM65816.ASM.INIT + LDA #0 MASK FOR 6502 + STA LEVEL.MASK + LDA #15 MARGIN FOR 6502 + STA EMIT.MARGIN + RTS +*-------------------------------- +ASM65816.ASM.LINE + LDA SEARCH.KEY 1ST LETTER + CMP #'A' + BCC .5 ...NOT A LETTER, SO BADOP + CMP #'Z'+1 + BCS .5 ...NOT A LETTER, SO BADOP + AND #$1F MAKE 01...1A + TAX + LDA FIRST.LETTER.TABLE-1,X + BNE .8 ...UNUSED LETTER +.5 JMP BADOPERR +*---BUILD OPTBL.PNTR INTO TABLE-------- +.8 ADC #OPCODE.TABLE CARRY CLEAR ALREADY + STA OPTBL.PNTR + LDY /OPCODE.TABLE + BCC .1 + INY +.1 CPX #'R'-$40 WHICH HALF OF TABLE? + BCC .2 ...FIRST HALF + INY ...SECOND HALF +.2 CLC INITIAL SEARCH +.3 JSR ASM65816.SEARCH.TABLE + BCC .5 ...NOT FOUND +*---FOUND IT!-------------------- + LDA (OPTBL.PNTR),Y + STA OPBASE + INY + LDA (OPTBL.PNTR),Y + AND #$E1 ISOLATE LEVEL BITS + BEQ .7 ...PLAIN 6502 LEVEL + AND LEVEL.MASK + BNE .7 ...ALLOWS 'STP' FOR BOTH 65816 & SWEET-16 + SEC CONTINUE SEARCH + BCS .3 ...ALWAYS +*---BRANCH TO PROCESS OPCODE----- +.7 LDA (OPTBL.PNTR),Y + AND #$1E + TAY + LDA OP.MODE+1,Y + PHA + LDA OP.MODE,Y + PHA + RTS +*-------------------------------- + .MA MODE +O..]1 .EQ *-OP.MODE + .DA OP.]1-1 + .EM +*-------------------------------- +OP.MODE + >MODE SNGL 0 -- SINGLE BYTE OPCODES + >MODE COPS 2 -- LDA GROUP + >MODE SHIFTS 4 -- ASL GROUP + >MODE REL16 6 -- BRL & PER + >MODE REL8 8 -- RELATIVE BRANCHES + >MODE BITS A -- BIT GROUP + >MODE MOVES C -- MVP & MVN + >MODE JUMPS E -- JUMP GROUP + >MODE ROCKB 10 -- ROCKWELL BIT OPS + >MODE ROCKC 12 -- ROCKWELL BIT OPS + >MODE XN 14 -- SWEET 16 REGISTER OPS + >MODE POP 16 -- SWEET 16 POP & POPD + >MODE SET 18 -- SWEET 16 SET + >MODE CRS 1A -- COP, REP, SEP +*-------------------------------- +OP.SNGL +EMIT.OPBASE + LDA OPBASE + JMP ASM65816.EMIT +*-------------------------------- +OP.CRS JSR ASM65816.GNNB + CMP #'#' + BNE ERBA.E2 + JSR ASM65816.EXP1 + JMP EMIT.OP.AND.EXP.BYTE +ERBA.E2 + JMP ERBA.EMIT.TWO +*-------------------------------- +OP.COPS + JSR GENERAL.OPERAND + JSR SEE.IF.MODE.LEGAL.AT.LEVEL + LDA MODE.BYTE ALL INDIRECT MODES <<<12-16-85>>> + AND #$04 REQUIRE ZP VALUE <<<12-16-85>>> + BEQ .1 ...NOT INDIRECT <<<12-16-85>>> + CPY #14 + BCC .4 ...MODES 0...13 + DEC ADDR.LENGTH SHORTEN >(ZP) AND >(ZP),Y +.4 JSR ASM65816.TEST.EXP.VALUE.ZP + BNE ERBA.E2 ...MUST BE DIRECT VALUE +.1 LDA ADDR.MODE.BITS.CLASS.1,Y + BPL .2 VALID MODE + INC ADDR.LENGTH ...DIRECT,Y NOT VALID + LDA ADDR.MODE.BITS.CLASS.1+1,Y +.2 EOR OPBASE + CMP #$89 STA IMMED? + BEQ ERBA.E2 ...YES, NO SUCH ANIMAL +* FALL INTO EMIT.OP.AND.VALUE *** +*-------------------------------- +EMIT.OP.AND.VALUE + JSR ASM65816.EMIT +ASM65816.EMIT.VALUE + JSR EMIT.EXP.BYTE + DEC ADDR.LENGTH + BEQ .2 + LDA EXP.VALUE+1 + JSR ASM65816.EMIT + DEC ADDR.LENGTH + BEQ .2 + LDA EXP.VALUE+2 + JSR ASM65816.EMIT + DEC ADDR.LENGTH + BEQ .2 + LDA EXP.VALUE+3 + JSR ASM65816.EMIT +.2 RTS +*-------------------------------- +OP.BITS + JSR GENERAL.OPERAND + JSR SEE.IF.MODE.LEGAL.AT.LEVEL + CPY #7 ONLY MODES 0...6 LEGAL + BCS .2 ...NOT VALID MODE + LDX OPBASE + BNE .0 ...NOT BIT OPCODE + LDA LEVEL.MASK + AND #$20 + BNE .0 ...AT LEAST 65C02 + LDA #$60 ONLY ZP AND ABS LEGAL + BNE .7 ...ALWAYS +.0 LDA CLASS.5.LEGAL.MODES,X +.7 AND CLASS.5.MODE.MASKS,Y + BNE .4 ...LEGAL + LDA PASS + BEQ .1 ...IN PASS 1 + JSR ASM65816.TEST.EXP.VALUE.ZP + BNE .2 ...TOO BIG FOR ZP +.1 DEY CHANGE ABS TO ZP MODE + BMI .2 ...WASN'T ABS + TYA + LSR + BCC .2 ...WASN'T ABS + LDA CLASS.5.LEGAL.MODES,X + AND CLASS.5.MODE.MASKS,Y + BNE .3 ...LEGAL AFTERALL +.2 JMP ERBA.EMIT.TWO INVALID ADDRESS MODE +.3 DEC ADDR.LENGTH +*---FORM OPCODE------------------ +.4 LDA ADDR.MODE.BITS.CLASS.5,Y + EOR CLASS.5.OPS,X + LDY #$89 + CMP #$20 + BEQ .5 + LDY #$9C + CMP #$6C + BEQ .5 + LDY #$9E + CMP #$7C + BNE .6 +.5 TYA +.6 JMP EMIT.OP.AND.VALUE +*-------------------------------- +OP.SHIFTS + JSR ASM65816.GNC CHECK FOR ACCUMULATOR MODE + BNE .2 NOT ACCUM MODE + JSR ASM65816.GNC + BNE .2 NOT ACCUM MODE +*---ACCUMULATOR MODE------------- + LDA OPBASE + EOR #$08 MAKE ACCUM MODE OPCODE + BPL .1 NOT INC OR DEC + PHA + LDA LEVEL.MASK + AND #$20 ONLY IN 65C02 AND ABOVE + BEQ .5 + PLA + EOR #$F0 CHANGE EA-->1A, CA-->3A +.1 JMP ASM65816.EMIT +*---MODES WITH OPERAND FIELD----- +.2 DEC CHAR.PNTR + JSR GENERAL.OPERAND + JSR SEE.IF.MODE.LEGAL.AT.LEVEL + CPY #5 ONLY MODES 1...4 LEGAL + BCS .5 + TYA + BEQ .5 ...NO IMMEDIATE MODE ALLOWED + LDA ADDR.MODE.BITS.CLASS.1,Y + EOR OPBASE + JMP EMIT.OP.AND.VALUE +.5 JMP ERBA.EMIT.TWO INVALID ADDRESS MODE +*-------------------------------- +OP.REL8 + .DO SWEET.16 + LDA OPBASE CHECK FOR 'BNM1' SWEET-16 OP + CMP #$09 + BNE .1 ...NOT 'BNM1' + JSR ASM65816.GNC CHECK FOR '1' + CMP #'1' + BNE BADOPERR ...NO, SO BAD OP + .FIN +.1 JSR ASM65816.EXPR + LDA OPBASE +OP.REL8.A + JSR ASM65816.EMIT EMIT OPCODE + LDA EXP.UNDEF + BMI GOEMIT ...UNDEFINED + LDY EXP.VALUE+1 + CLC COMPUTE RELATIVE OFFSET + LDA EXP.VALUE + SBC ORGN + STA EXP.VALUE + BPL .2 + INY +.2 TYA + SBC ORGN+1 + BNE ERR.RANGE.EMIT.ONE +EMIT.EXP.BYTE + LDA EXP.VALUE +GOEMIT JMP ASM65816.EMIT +*-------------------------------- +BADOPERR + LDA #ERR.BAD.OPCODE + JMP ASM65816.ASM.ERROR +*-------------------------------- +* BRL & PER, 16-bit relative +*-------------------------------- +OP.REL16 + JSR ASM65816.EXPR Get value of expression + JSR EMIT.OPBASE Emit the opcode, bumping origin once + LDA EXP.UNDEF If undefined, say so + BMI .3 (If we didn't, might be RANGE ERR) + CLC ADD 2 MORE TO ORIGIN + LDY ORGN+2 + LDA ORGN + ADC #2 + STA EXP.VALUE+3 (TEMP) + LDA ORGN+1 + ADC #0 + BCC .2 + INY BANK BYTE +.2 CPY EXP.VALUE+2 IN SAME BANK AS TARGET? + BNE ERR.RANGE.EMIT.TWO ...NO, ERR RANGE + STA EXP.VALUE+2 YES, SAVE IN ANOTHER TEMP + LDA EXP.VALUE TARGET-ORGN+3 + SBC EXP.VALUE+3 + STA EXP.VALUE + LDA EXP.VALUE+1 + SBC EXP.VALUE+2 + STA EXP.VALUE+1 +.3 LDA #2 + STA ADDR.LENGTH + JMP ASM65816.EMIT.VALUE +*-------------------------------- +ERR.RANGE.EMIT.TWO + JSR ASM65816.EMIT.ZERO +ERR.RANGE.EMIT.ONE + JSR ASM65816.EMIT.ZERO +ASM65816.RAER + LDA #ERR.RANGE + JMP ASM65816.ASM.ERROR +*-------------------------------- +OP.MOVES + JSR EMIT.OPBASE + JSR ASM65816.EXPR GET SOURCE BANK + LDA EXP.VALUE+2 + PHA + JSR ASM65816.GNC + CMP #',' MUST HAVE COMMA HERE + BNE .1 ...ILLEGAL + JSR ASM65816.EXP1 GET DESTINATION BANK + LDA EXP.VALUE+2 + JSR ASM65816.EMIT + PLA + JMP ASM65816.EMIT +.1 JMP ERBA.EMIT.TWO +*-------------------------------- +OP.JUMPS + JSR GENERAL.OPERAND + LDA LEGAL.JUMP.MODES,Y + BMI .4 ...ILLEGAL + ORA OPBASE + TAY + LDA LEVEL.MASK + BMI .1 65816, ALLOW ALL MODES + CPY #5 DISALLOW JML, JSL, AND PEA + BCS .4 ...ONE OF THOSE + CPY #1 DISALLOW JMP LONG + BEQ .4 + AND #$20 SEE IF 65C02 + BNE .1 ...YES + CPY #3 ...NO, DISALLOW JMP (ABS,X) + BEQ .4 ...THAT'S WHAT IT IS... +.1 LDA JUMP.OPCODES,Y + BEQ .4 ...ILLEGAL + LDY #2 ASSUME TWO BYTE ADDRESS + CMP #$5C CHECK FOR "JMP LONG" + BEQ .2 ...YES, 3 BYTES OF ADDRESS + CMP #$22 CHECK FOR "JSL" + BNE .3 ...NO, ONLY 2 BYTES OF ADDRESS +.2 INY 3 BYTE ADDRESS +.3 STY ADDR.LENGTH + JMP EMIT.OP.AND.VALUE +.4 JMP ERBA.EMIT.TWO +*-------------------------------- +ASM65816.TEST.EXP.VALUE.ZP + LDA EXP.VALUE+1 + ORA EXP.VALUE+2 + ORA EXP.VALUE+3 + RTS +*-------------------------------- +LONG.INDIRECT + JSR ASM65816.EXP1 + JSR ASM65816.GNC + CMP #']' + BNE ERBA.EMIT.TWO + JSR ASM65816.GNC + BEQ .1 ...[EXP] + CMP #',' + BNE ERBA.EMIT.TWO + JSR ASM65816.GNC.UC + CMP #'Y' + BNE ERBA.EMIT.TWO + LDA #$47 ...[EXP],Y + .HS 2C +.1 LDA #$44 ...[EXP],Y + STA MODE.BYTE + LDA #2 + STA ADDR.LENGTH + JMP CHECK.IF.SUFFIX.LEGAL +*-------------------------------- +IMMEDIATE + JSR ASM65816.GNC.UC + CMP DLIM 16-BIT IMMEDIATE? + BNE .1 ...NO, BACKUP + LDA LEVEL.MASK 16-BIT IMMEDIATE OKAY? + BPL ERBA.EMIT.TWO ...NOT AT 65816 LEVEL + INC ADDR.LENGTH ...YES, INCREASE LENGTH + BNE .2 ...ALWAYS +.1 DEC CHAR.PNTR +.2 JSR ASM65816.EXP1 + JSR ASM65816.GNC + BNE ERBA.EMIT.TWO ILLEGAL + LDA DLIM + CMP #'/' #=23, /=2F, ^=5E + BCC .4 ...# + BEQ .3 .../ + JSR ASM65816.EXP.OVER.256 ...^ +.3 JSR ASM65816.EXP.OVER.256 +.4 LDY #0 SIGNAL IMMEDIATE MODE + STY MODE.BYTE COPS NEEDS THIS <<<12-16-85>>> + RTS +*-------------------------------- +ERBA.EMIT.THREE + JSR ASM65816.EMIT.ZERO +ERBA.EMIT.TWO + JSR ASM65816.EMIT.ZERO + JSR ASM65816.EMIT.ZERO +ASM65816.ERBA + LDA #ERR.BAD.ADDRESS + JMP ASM65816.ASM.ERROR +ASM65816.EMIT.ZERO LDA #0 + JMP ASM65816.EMIT +*-------------------------------- +* RETURN: +* # BYTES IN ADDRESS IN ADDR.LENGTH +* (Y) = INDEX TO ADDR.MODE.BITS +*-------------------------------- +GENERAL.OPERAND + JSR ASM65816.GNNB GET NEXT NON-BLANK + BCS ERBA.EMIT.TWO ...NO OPERAND +*---PARSE PREFIX----------------- + LDY #1 + STY ADDR.LENGTH + STA DLIM + CMP #'(' + BEQ .3 ...indirect, must be ZP + CMP #'[' + BEQ LONG.INDIRECT + CMP #'#' + BEQ IMMEDIATE + CMP #'/' + BEQ IMMEDIATE + CMP #'^' + BEQ IMMEDIATE + CMP #'<' + BEQ .3 MAKE FORCE SIZE = 1 + DEY Y=0 + CMP #'>' + BNE .2 ...SIZE NOT FORCED + JSR ASM65816.GNC + LDY #3 Y=3 + CMP DLIM IS IT ">>"? + BEQ .3 ...YES + DEY Y=2 + STA DLIM CHANGE DLIM TO NEW VALUE + CMP #'(' IS IT (? + BEQ .3 ...YES, >( +.2 DEC CHAR.PNTR ...NO, SO BACKUP +.3 STY FORCE.ADDR.SIZE +*---PARSE THE EXPRESSION--------- + JSR ASM65816.EXP1 +*---FIGURE # OF BYTES------------ + LDX FORCE.ADDR.SIZE + BNE .6 ...FORCED WITH <, >, OR >> + LDX #2 ASSUME 2-BYTE ADDRESS + LDA EXP.UNDEF + BMI .6 + LDA PASS IGNORE FWD REF FLAG IN PASS 1 + BEQ .4 ...PASS 1 + LDA EXP.FWDREF ...PASS 2, DEFINED + BNE .4 ...BUT NOT FWD REF + LDA EXP.VALUE+3 ...FWD REF MUST BE ONLY + ORA EXP.VALUE+2 16 BITS + BEQ .6 ...IT FITS! + BNE ERBA.1 ...ALWAYS, ERBA +.4 LDA EXP.VALUE+3 DO NOT ALLOW 32-BITS + BNE ERBA.1 ...BAD ADDR + LDA EXP.VALUE+2 + BNE .5 ...3-BYTE ADDRESS + DEX X=1 + LDA EXP.VALUE+1 + BEQ .6 ...ZP +.5 INX +.6 STX ADDR.LENGTH +*---PARSE SUFFIX----------------- + DEX MAKE 0, 1, OR 2 + STX MODE.BYTE + LDX #6 +.7 JSR ASM65816.GNC.UC +.8 CMP MODE.CHARS,X + BEQ .9 + CLC + ROL MODE.BYTE + DEX + BPL .8 + BMI ERBA.1 +.9 CMP #' ' BLANK? + BEQ CHECK.IF.SUFFIX.LEGAL ...YES, END OF OPERAND + CMP #')' RIGHT PAREN? + BNE .10 ...NO + LDA DLIM WAS THERE A LEFT PAREN? + CMP #'(' + BNE ERBA.1 ...NO +.10 SEC + ROL MODE.BYTE + DEX + BPL .7 +ERBA.1 JMP ERBA.EMIT.TWO ILLEGAL +*-------------------------------- +CHECK.IF.SUFFIX.LEGAL + LDY #0 SEARCH FORWARD FOR VARIOUS REASONS + LDA MODE.BYTE +.13 INY + CPY #MODE.TABLE.SIZE+1 + BCS ERBA.1 ...END OF TABLE + CMP MODE.TABLE-1,Y + BNE .13 ...KEEP LOOKING + RTS +*-------------------------------- +SEE.IF.MODE.LEGAL.AT.LEVEL + LDA LEVEL.MASK + BMI .15 ...65816 LEVEL, ALL LEGAL + CPY #9 + BCC .15 ...6502 MODES + BEQ .14 ...65C02 MODE + CPY #16 + BNE ERBA.1 +.14 AND #$20 AT C02 LEVEL? + BEQ ERBA.1 ...NO +.15 RTS +*-------------------------------- +ASM65816.EXP.OVER.256 + LDA EXP.VALUE+1 + STA EXP.VALUE + LDA EXP.VALUE+2 + STA EXP.VALUE+1 + LDA EXP.VALUE+3 + STA EXP.VALUE+2 + LDA #0 + STA EXP.VALUE+3 + RTS + .DO ROCKWELL +*-------------------------------- +* ROCKWELL 65C02 EXCLUSIVES +* +* RMB bit#,zp +* SMB bit#,zp +* BBR bit#,zp,reladdr +* BBS bit#,zp,reladdr +*-------------------------------- +OP.ROCKB + JSR OP.ROCKWELL + JSR ASM65816.GNC REQUIRE A COMMA + CMP #',' + BNE .1 ...NO COMMA + LDA EXP.VALUE + PHA SAVE ZP VALUE + JSR ASM65816.EXP1 GET BRANCH EXPRESSION + JSR EMIT.OPBASE <<<12-16-85>>> + PLA + JMP OP.REL8.A +.1 JMP ERBA.EMIT.THREE +*-------------------------------- +OP.ROCKC + JSR OP.ROCKWELL + .FIN +EMIT.OP.AND.EXP.BYTE + JSR EMIT.OPBASE <<<12-16-85>>> + JMP EMIT.EXP.BYTE <<<12-16-85>>> +*-------------------------------- + .DO ROCKWELL +OP.ROCKWELL + JSR ASM65816.EXPR GET BIT # + JSR ASM65816.TEST.EXP.VALUE.ZP + BNE .1 ...MUST BE SMALL NUMBER! + LDA EXP.VALUE + CMP #8 MUST BE 0...7 + BCS .1 ...TOO LARGE + ASL + ASL + ASL + ASL + ORA OPBASE MERGE INTO OPCODE + STA OPBASE + JSR ASM65816.GNC NEED A COMMA NOW + CMP #',' + BNE .1 + JSR ASM65816.EXP1 GET ZP VALUE + JSR ASM65816.TEST.EXP.VALUE.ZP + BNE .1 MUST BE ZERO PAGE + RTS +.1 JMP ERBA.EMIT.TWO +*-------------------------------- + .ELSE +OP.ROCKB +OP.ROCKC + JMP BADOPERR + .FIN + + .DO SWEET.16 +*-------------------------------- +* SWEET-16 OPCODES +*-------------------------------- +OP.POP + JSR ASM65816.GNC.UC SEE WHICH: POP OR POPD + BEQ OP.XN ...POP + CMP #'D' + BEQ .1 + JMP BADOPERR +.1 LDA #$A2 ...POP + STA OPBASE +*-------------------------------- +OP.XN + JSR ASM65816.GNNB + BCS SWEET.ERBA + CMP #'@' + BNE .1 ...NOT '@N' + LDA OPBASE ...'@N', SEE IF LEGAL + AND #2 + BEQ SWEET.ERBA ...NOT LEGAL WITH THIS OP + LDA OPBASE ...LEGAL, ADD $20 + ADC #$1F .CS., SO 1F IS 20 + BNE .2 ...ALWAYS +.1 DEC CHAR.PNTR Backup character pointer + LDA OPBASE + LSR + BCC SWEET.ERBA 'N' NOT LEGAL FOR THIS OP + LDA OPBASE +.2 AND #$F0 CLEAR AWAY LEGALITY FLAGS + STA OPBASE + JSR ASM65816.EXP1 GET REGISTER NUMBER + JSR ASM65816.TEST.EXP.VALUE.ZP + BNE SWEET.RAER + LDA EXP.VALUE + CMP #$10 + BCS SWEET.RAER + ORA OPBASE + JMP ASM65816.EMIT +*-------------------------------- +SWEET.ERBA JMP ASM65816.ERBA +SWEET.RAER JMP ASM65816.RAER +*-------------------------------- +OP.SET + JSR OP.XN + JSR ASM65816.GNC + CMP #',' + BNE SWEET.ERBA + JSR ASM65816.EXP1 + LDA #2 + STA ADDR.LENGTH + JMP ASM65816.EMIT.VALUE +*-------------------------------- + .ELSE +OP.POP +OP.XN +OP.SET + JMP BADOPERR + .FIN +*-------------------------------- +LEGAL.JUMP.MODES + .HS FF.00.00.FF.FF.FF + .HS FF.FF.03.02.FF.FF + .HS 01.FF.02.FF.03 +*-------------------------------- +JUMP.OPCODES + .HS 4C.5C.6C.7C JMP + .HS 20.22.00.FC JSR + .HS 00.00.DC.00 JML + .HS 22.22.00.00 JSL + .HS F4.00.00.00 PEA +*-------------------------------- +MODE.CHARS + .AS / Y,)SX,/ +*-------------------------------- +MODE.TABLE + .HS 00 1 -- DIRECT + .HS 40 2 -- ABSOLUTE + .HS 30 3 -- DIRECT,X + .HS 70 4 -- ABSOLUTE,X + .HS 21 5 -- DIRECT,Y + .HS 61 6 -- ABSOLUTE,Y + .HS 07 7 -- (DIRECT),Y + .HS 34 8 -- (DIRECT,X) +*---IN 65C02, 802, 816----------- + .HS 04 9 -- (DIRECT) +*---IN 65802, 816---------------- + .HS 28 A -- ...,S + .HS 2F B -- (...,S),Y +*---ONLY IN 65816---------------- + .HS 80 C -- LONG + .HS B0 D -- LONG,X + .HS 44 E -- >(DIRECT) + .HS 47 F -- >(DIRECT),Y +*---SPECIAL FOR JMP,JSR (A,X)---- + .HS 74 10 -- (ABSOLUTE,X) +MODE.TABLE.SIZE .EQ *-MODE.TABLE +*-------------------------------- +ADDR.MODE.BITS.CLASS.1 + .HS 08 0 -- IMMEDIATE + .HS 04 1 -- DIRECT + .HS 0C 2 -- ABSOLUTE + .HS 14 3 -- DIRECT,X + .HS 1C 4 -- ABSOLUTE,X + .HS FF 5 -- DIRECT,Y <<>> + .HS 18 6 -- ABSOLUTE,Y + .HS 10 7 -- (DIRECT),Y + .HS 00 8 -- (DIRECT,X) +*---IN 65C02, 802, 816----------- + .HS 13 9 -- (DIRECT) +*---IN 65802, 816---------------- + .HS 02 A -- ...,S + .HS 12 B -- (...,S),Y +*---ONLY IN 65816---------------- + .HS 0E C -- LONG + .HS 1E D -- LONG,X + .HS 06 E -- >(DIRECT) + .HS 16 F -- >(DIRECT),Y +*-------------------------------- +ADDR.MODE.BITS.CLASS.5 + .HS 00 0 -- IMMEDIATE + .HS 04 1 -- DIRECT + .HS 0C 2 -- ABSOLUTE + .HS 14 3 -- DIRECT,X + .HS 1C 4 -- ABSOLUTE,X + .HS 14 5 -- DIRECT,Y + .HS 1C 6 -- ABSOLUTE,Y +*-------------------------------- +CLASS.5.MODE.MASKS + .HS 80.40.20.10.08.04.02 +*-------------------------------- +FIRST.LETTER.TABLE + .DA #LTR.A-OPCODE.TABLE + .DA #LTR.B-OPCODE.TABLE + .DA #LTR.C-OPCODE.TABLE + .DA #LTR.D-OPCODE.TABLE + .DA #LTR.E-OPCODE.TABLE + .DA #LTR.F-OPCODE.TABLE + .DA #LTR.G-OPCODE.TABLE + .DA #LTR.H-OPCODE.TABLE + .DA #LTR.I-OPCODE.TABLE + .DA #LTR.J-OPCODE.TABLE + .DA #LTR.K-OPCODE.TABLE + .DA #LTR.L-OPCODE.TABLE + .DA #LTR.M-OPCODE.TABLE + .DA #LTR.N-OPCODE.TABLE + .DA #LTR.O-OPCODE.TABLE + .DA #LTR.P-OPCODE.TABLE + .DA #LTR.Q-OPCODE.TABLE + .DA #LTR.R-OPCODE.TABLE + .DA #LTR.S-OPCODE.TABLE + .DA #LTR.T-OPCODE.TABLE + .DA #LTR.U-OPCODE.TABLE + .DA #LTR.V-OPCODE.TABLE + .DA #LTR.W-OPCODE.TABLE + .DA #LTR.X-OPCODE.TABLE + .DA #LTR.Y-OPCODE.TABLE + .DA #LTR.Z-OPCODE.TABLE +*-------------------------------- +* TWO KINDS OF ENTRIES, DISTINGUISHED BY FIRST BIT: +* 8-BIT ENTRIES: FIRST BIT = 0 +* 24-BIT ENTRIES: FIRST BIT = 1 +* +* FIRST ENTRY AT EACH LETTER IS AN 8-BIT ENTRY. +* EACH 8-BIT ENTRY IS FOLLOWED BY ONE OR MORE +* 24-BIT ENTRIES. +* THE SUB-LIST OF 24-BIT ENTRIES IS TERMINATED +* BY THE NEXT 8-BIT ENTRY. +* THE LIST OF 8-BIT ENTRIES IS TERMINATED BY +* AN 8-BIT ENTRY WITH BIT 6 = 1. +* +* THE VALUE OF BITS 5-0 IN AN 8-BIT ENTRY +* IS THE DIMINISHED ASCII CODE FOR THE +* SECOND LETTER OF AN OPCODE. +* THE VALUE OF BITS 5-0 OF A 24-BIT ENTRY +* IS THE DIMINISHED ASCII CODE FOR THE +* THIRD LETTER OF AN OPCODE. +* A...Z = $81...9A +* BLANK = $E0 +* '1' = $F1 +* THE VALUE OF THE SECOND BYTE OF A 24-BIT +* ENTRY IS AN OPCODE BASE. +* THE THIRD BYTE OF A 24-BIT ENTRY HAS TWO PARTS: +* BITS 4-1 ARE AN INDEX TO THE OP.MODE +* JUMP TABLE IN ASM.65816 +* BITS 7-5 AND 0 ARE LEVEL MASK BITS. +* 000XXXX0 = 6502 OPCODE +* 000XXXX1 = SWEET-16 +* 001XXXX0 = 65C02 +* 010XXXX0 = ROCKWELL SPECIALS +* 100XXXX0 = 65816 +* +* LEVEL.MASK = $00 FOR 6502 +* = $20 FOR 65C02 +* = $60 FOR ROCKWELL C02 +* = $A0 FOR 65816 +*-------------------------------- +OP..1 .SE 0 +OP..2 .SE 0 + .MA OP + .DO "]1"=OP..1=0 +LTR.]1 .DA #"]2"-$80 bits 76 = 01 +OP..1 .SE "]1" +OP..2 .SE "]2" + .ELSE + .DO "]2"=OP..2=0 + .DA #"]2"-$C0 bits 76 = 00 +OP..2 .SE "]2" + .FIN + .FIN + .DA #"]3"^$40,#$]4,#O..]5!O..]6 bits 76 = 10 or 11 + .EM +*-------------------------------- +O..65816 .EQ $80 +O..65R02 .EQ $40 +O..65C02 .EQ $20 +O..SWEET .EQ $01 +O.. .EQ $00 +*-------------------------------- +OPCODE.TABLE +LTR.F +LTR.G +LTR.H +LTR.K +LTR.Q +LTR.U +LTR.V +LTR.Y +LTR.Z .HS 00 +*-------------------------------- + >OP A,D,C,61,COPS + >OP A,D,D,A1,XN,SWEET + >OP A,N,D,21,COPS + >OP A,S,L,02,SHIFTS + >OP B,C,C,90,REL8 + >OP B,C,S,B0,REL8 + >OP B,C," ",03,REL8,SWEET + >OP B,E,Q,F0,REL8 + >OP B,G,E,B0,REL8 + >OP B,I,T,00,BITS + >OP B,L,T,90,REL8 + >OP B,M,I,30,REL8 + >OP B,M," ",05,REL8,SWEET + >OP B,M,1,08,REL8,SWEET + >OP B,N,E,D0,REL8 + >OP B,N,C,02,REL8,SWEET + >OP B,N,M,09,REL8,SWEET (BNM1) + >OP B,N,Z,07,REL8,SWEET + >OP B,P,L,10,REL8 + >OP B,P," ",04,REL8,SWEET + >OP B,R,A,80,REL8,65C02 + >OP B,R,K,00,SNGL + >OP B,R,L,82,REL16,65816 + >OP B,R," ",01,REL8,SWEET + >OP B,V,C,50,REL8 + >OP B,V,S,70,REL8 + >OP B,B,R,0F,ROCKB,65R02 + >OP B,B,S,8F,ROCKB,65R02 + >OP B,K," ",0A,SNGL,SWEET + >OP B,S," ",0C,REL8,SWEET + >OP B,Z," ",06,REL8,SWEET + >OP C,L,C,18,SNGL + >OP C,L,D,D8,SNGL + >OP C,L,I,58,SNGL + >OP C,L,V,B8,SNGL + >OP C,M,P,C1,COPS + >OP C,O,P,02,CRS,65816 + >OP C,P,X,04,BITS + >OP C,P,Y,03,BITS + >OP C,P,R,D1,XN,SWEET + >OP D,E,C,C2,SHIFTS + >OP D,E,X,CA,SNGL + >OP D,E,Y,88,SNGL + >OP D,C,R,F1,XN,SWEET + >OP E,O,R,41,COPS + >OP I,N,C,E2,SHIFTS + >OP I,N,X,E8,SNGL + >OP I,N,Y,C8,SNGL + >OP I,N,R,E1,XN,SWEET + >OP J,M,L,08,JUMPS,65816 + >OP J,M,P,00,JUMPS + >OP J,S,L,0C,JUMPS,65816 + >OP J,S,R,04,JUMPS + >OP L,D,A,A1,COPS + >OP L,D,X,02,BITS + >OP L,D,Y,01,BITS + >OP L,D," ",23,XN,SWEET + >OP L,D,D,42,XN,SWEET + >OP L,S,R,42,SHIFTS + >OP M,V,N,54,MOVES,65816 + >OP M,V,P,44,MOVES,65816 + >OP N,O,P,EA,SNGL + >OP O,R,A,01,COPS + >OP P,E,A,10,JUMPS,65816 + >OP P,E,I,0A,BITS,65816 + >OP P,E,R,62,REL16,65816 + >OP P,H,A,48,SNGL + >OP P,H,B,8B,SNGL,65816 + >OP P,H,D,0B,SNGL,65816 + >OP P,H,K,4B,SNGL,65816 + >OP P,H,P,08,SNGL + >OP P,H,X,DA,SNGL,65C02 + >OP P,H,Y,5A,SNGL,65C02 + >OP P,L,A,68,SNGL + >OP P,L,B,AB,SNGL,65816 + >OP P,L,D,2B,SNGL,65816 + >OP P,L,P,28,SNGL + >OP P,L,X,FA,SNGL,65C02 + >OP P,L,Y,7A,SNGL,65C02 + >OP P,O,P,62,POP,SWEET (POP,POPD) + >OP R,E,P,C2,CRS,65816 + >OP R,O,L,22,SHIFTS + >OP R,O,R,62,SHIFTS + >OP R,T,I,40,SNGL + >OP R,T,L,6B,SNGL,65816 + >OP R,T,S,60,SNGL + >OP R,T,N,00,SNGL,SWEET + >OP R,M,B,07,ROCKC,65R02 + >OP R,S," ",0B,SNGL,SWEET + >OP S,B,C,E1,COPS + >OP S,E,C,38,SNGL + >OP S,E,D,F8,SNGL + >OP S,E,I,78,SNGL + >OP S,E,P,E2,CRS,65816 + >OP S,E,T,11,SET,SWEET + >OP S,T,A,81,COPS + >OP S,T,P,DB,SNGL,65816 + >OP S,T,P,72,XN,SWEET + >OP S,T,X,06,BITS + >OP S,T,Y,05,BITS + >OP S,T,Z,07,BITS,65C02 + >OP S,T," ",33,XN,SWEET + >OP S,T,D,52,XN,SWEET + >OP S,U,B,B1,XN,SWEET + >OP S,M,B,87,ROCKC,65R02 + >OP T,A,X,AA,SNGL + >OP T,A,Y,A8,SNGL + >OP T,C,D,5B,SNGL,65816 + >OP T,C,S,1B,SNGL,65816 + >OP T,D,C,7B,SNGL,65816 + >OP T,R,B,09,BITS,65C02 + >OP T,S,B,08,BITS,65C02 + >OP T,S,C,3B,SNGL,65816 + >OP T,S,X,BA,SNGL + >OP T,X,A,8A,SNGL + >OP T,X,S,9A,SNGL + >OP T,X,Y,9B,SNGL,65816 + >OP T,Y,A,98,SNGL + >OP T,Y,X,BB,SNGL,65816 + >OP W,A,I,CB,SNGL,65816 + >OP W,D,M,42,SNGL,65816 + >OP X,B,A,EB,SNGL,65816 + >OP X,C,E,FB,SNGL,65816 + .HS 40 <<>> +*-------------------------------- +CLASS.5.OPS +* BIT LDY LDX CPY CPX STY STX STZ + .HS 20..A0..A2..C0..E0..80..82..60 +* +* TSB TRB PEI + .HS 00..10..D0 +* +CLASS.5.LEGAL.MODES + .HS F8..F8..E6..E0..E0..70..64..78 + .HS 60..60..40 +* +* 80 -- IMMEDIATE +* 40 -- DIRECT +* 20 -- ABSOLUTE +* 10 -- DIRECT,X +* 08 -- ABSOLUTE,X +* 04 -- DIRECT,Y +* 02 -- ABSOLUTE,Y +* 01 -- <<>> +*-------------------------------- +* OPCODE TABLE SELECTION +* .OP 6502/65C02/R65C02/65816/SWEET16,... +*-------------------------------- +DIR.OP LDA #0 + STA LEVEL.MASK + LDA #15 + STA EMIT.MARGIN +.1 JSR ASM65816.GNC.UC GET NEXT CHARACTER + BCS .5 END + LDY #-2 +.2 INY + INY + LDA PSOP.TABLE,Y + BEQ .1 ...END OF TABLE, TRY NEXT CHARACTER + CMP CURRENT.CHAR + BNE .2 ...NOT THIS ONE +.3 LDA PSOP.TABLE+1,Y + STA LEVEL.MASK + BPL .5 + LDA #18 + STA EMIT.MARGIN +.5 RTS RETURN TO ASSEMBLER +*-------------------------------- +PSOP.TABLE + .DA #'8',#$A0 65816 = $A0 + .DA #'C',#$20 65C02 = $20 + .DO ROCKWELL + .DA #'R',#$60 ROCKWELL= $60 + .FIN + .DO SWEET.16 + .DA #'S',#$01 SWEET-16= $01 + .FIN + .DA #0 +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/asm65816.s +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/IO.S.IIE..txt b/SCMASM.31/IO.S.IIE..txt new file mode 100644 index 00000000..c6fafd57 --- /dev/null +++ b/SCMASM.31/IO.S.IIE..txt @@ -0,0 +1,137 @@ +NEW + AUTO 3,1 +*-------------------------------------- + .PH $A800 +*-------------------------------- +* I/O VECTORS -- 3 BYTES EACH +*-------------------------------- + JMP IIE.INIT + JMP IIE.WARM + JMP IIE.RDKEY + JMP S.GET.HORIZ.POSN + JMP MON.HOME + JMP MON.CLREOL + JMP MON.CLREOP + JMP MON.UP + JMP MON.LF + JMP IIE.LEFT + JMP IIE.RIGHT + JMP IIE.COUT + JMP IIE.PICK.SCREEN + JMP IIE.HTABX + JMP IIE.HTAB + JMP IIE.VTAB +*---Case Toggle MUST go here----- + RTS +*-------------------------------- +* VARIABLE LENGTH ROUTINES +*-------------------------------- +IIE.INIT + LDA $BF98 + AND #2 + BEQ IO.HOME + LDA #$99 CTRL-Y + JMP $C300 +*-------------------------------- +IIE.HTABX + PHA + TXA + JSR IIE.HTAB + PLA + RTS +*-------------------------------- +IIE.HTAB + BIT $C01F + BPL .1 + STA $57B + RTS +.1 STA CH + RTS +*-------------------------------- +S.GET.HORIZ.POSN + LDA $57B + BIT $C01F + BMI .1 + LDA CH +.1 RTS +*-------------------------------- +IIE.WARM + CLD + LDX CV SAVE CV + JSR MON.INIT + TXA GET CV, FALL INTO VTAB +IIE.VTAB + STA CV + JMP MON.VTAB +*-------------------------------- +IIE.RDKEY + LDA #40 + BIT $C01F + BPL .1 + ASL +.1 STA SCREEN.WIDTH + JSR MON.RDKEY + CMP #$FF + BNE .2 + LDA #$88 +.2 ASL $C061 SET CARRY IF "OPEN APPLE" PRESSED + ORA #$80 + RTS +*-------------------------------- +IIE.COUT + CMP #$80 NORMAL OR INVERSE? + BCS .2 ...NORMAL + BIT $C01F ...INVERSE; 40- OR 80-COLUMNS? + BPL .2 ...40-COLUMN + PHA ...80-COLUMN + LDA #$8F SELECT INVERSE DISPLAY + JSR MON.COUT + PLA + CMP #$20 CONTROL CHAR? + BCS .1 ...NO + ORA #$40 MAKE PRINTABLE CHARACTER +.1 ORA #$80 + JSR MON.COUT + LDA #$8E SELECT NORMAL DISPLAY +.2 JMP MON.COUT +*-------------------------------- +IIE.PICK.SCREEN + BIT $C01F + BMI .1 + LDA (BASL),Y + RTS +.1 TYA + LSR + TAY + PHP + SEI + LDA $C055 + BCC .2 + LDA $C054 +.2 LDA (BASL),Y + BIT $C054 + PLP + PHA SAVE CHAR FROM SCREEN + TYA RESTORE Y-REG + ROL + TAY + PLA + RTS +*-------------------------------- +IIE.RIGHT + BIT $C01F IN 80-COLUMN MODE? + BMI .1 ...YES + JMP MON.ADVANC +.1 LDA #$9C FORWARD SPACE + .HS 2C SKIP TWO BYTES +*-------------------------------- +IIE.LEFT + LDA #$88 BACKSPACE + JMP MON.COUT +*-------------------------------------- + .EP +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/io.s.iie +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/IO.S.IIE.ULTRA.txt b/SCMASM.31/IO.S.IIE.ULTRA.txt new file mode 100644 index 00000000..38a51ad1 --- /dev/null +++ b/SCMASM.31/IO.S.IIE.ULTRA.txt @@ -0,0 +1,270 @@ +NEW + AUTO 3,1 +*-------------------------------------- + .PH $A800 +*-------------------------------- +* VIDEX ULTRATERM DRIVER -- ASSUME SLOT 3 +ULTRA.SLOT .EQ 3 +SKMOD .EQ 1 SHIFT KEY MOD (=0 FOR //E VERSION) +*-------------------------------- +* TO MAKE THE EDIT COMMAND USE MORE THAN 24 LINES, +* CHANGE $17 TO $1F OR $2F AT $803A +*-------------------------------- +ULTRA.SCREEN.WIDTH .EQ $A5 +*-------------------------------- +ULTRA.CARD .EQ ULTRA.SLOT*256+$C000 +ULTRA.COUT1 .EQ ULTRA.SLOT*256+$C007 +*-------------------------------- +ULTRA.REG .EQ ULTRA.SLOT*16+$C080 +ULTRA.DATA .EQ ULTRA.SLOT*16+$C081 +*-------------------------------- +ULTRA.HORIZ .EQ $0578+ULTRA.SLOT +ULTRA.START .EQ $06F8+ULTRA.SLOT TOP-OF-SCREEN ADDRESS / 16 +ULTRA.CHPG .EQ $0678 +ULTRA.TEMPX .EQ $0778 +ULTRA.TEMPY .EQ $07F8 +ULTRA.FLAGS .EQ $07F8+ULTRA.SLOT +*-------------------------------- +* I/O VECTORS -- 3 BYTES EACH +*-------------------------------- + JMP ULTRA.INIT + JMP ULTRA.WARM + JMP ULTRA.READ.KEY.WITH.CASE + JMP ULTRA.GET.HORIZ.POSN + LDA #$8C ^L--HOME + .HS 2C + LDA #$9D ^]--CLREOL + .HS 2C + LDA #$8B ^K--CLREOP + .HS 2C + LDA #$9F ^_--UP + .HS 2C + LDA #$8A ^J--DOWN + .HS 2C + LDA #$88 ^H--LEFT + .HS 2C + LDA #$9C ^\--RIGHT + NOP + JMP MON.COUT + JMP ULTRA.PICK.SCREEN + JMP ULTRA.HTABX + JMP ULTRA.HTAB + JMP ULTRA.VTAB +*---Case Toggle MUST go here----- + LDA ULTRA.FLAGS + EOR #$40 + STA ULTRA.FLAGS + RTS +*-------------------------------- +* VARIABLE LENGTH ROUTINES +*-------------------------------- +ULTRA.HTABX + PHA + TXA + JSR ULTRA.HTAB + PLA + RTS +*-------------------------------- +ULTRA.GET.HORIZ.POSN + LDA ULTRA.HORIZ + RTS +*-------------------------------- +ULTRA.VTAB + STA CV + LDA ULTRA.HORIZ +ULTRA.HTAB + PHA SAVE HORIZ POSN + LDA #$9E + JSR ULTRA.COUT1 + PLA GET HORIZ POSN + JSR .1 + LDA CV + +.1 CLC ADD $A0 OFFSET + ADC #$A0 + JMP ULTRA.COUT1 +*-------------------------------- +ULTRA.INIT + LDA #80 + STA ULTRA.SCREEN.WIDTH + LDA #$8C CLEAR SCREEN AND START VIDEX-80 + STA $C00B SWITCH OFF //E C3 ROM + STA $C006 SWITCH OFF //E C100-C7FF ROM + JSR ULTRA.CARD +ULTRA.INSTALL.VECTORS + LDX #1 +.1 LDA ULTRA.VECTORS,X + STA $36,X + STA ULTRA.SLOT*2+$BE10,X + LDA ULTRA.VECTORS+2,X + BIT F.EXEC + BMI .2 + STA $38,X +.2 STA ULTRA.SLOT*2+$BE20,X + DEX + BPL .1 + RTS +*-------------------------------- +ULTRA.VECTORS + .DA ULTRA.COUT + .DA ULTRA.RDKEY +*-------------------------------- +ULTRA.WARM + CLD + LDX CV + JSR MON.INIT + STX CV + JMP ULTRA.INSTALL.VECTORS +*-------------------------------- +* READ KEY WITH CASE CONTROL +*-------------------------------- +ULTRA.READ.KEY.WITH.CASE + JSR MON.RDKEY + ORA #$80 REQUIRED FOR EXEC COMMAND + CLC SIGNAL NO OPEN APPLE + RTS +*-------------------------------- +ULTRA.RDKEY + CLD + LDA #$0A SELECT BLINKING DOUBLE UNDERLINE CURSOR + STA ULTRA.REG + LDA #$67 + STA ULTRA.DATA + LDA #$0B + STA ULTRA.REG + LDA #$08 + STA ULTRA.DATA +.1 LDA $C000 + BPL .1 + STA $C010 + PHA + LDA #$06 HIDE THE CURSOR + STA ULTRA.DATA + PLA + CMP #$8D + BNE .2 + JSR IO.CLREOL + LDA #$8D + .DO SKMOD +.2 PHA CHECK SHIFT LOCK FLAG + LDA ULTRA.FLAGS + ASL + ASL + PLA + BCC .5 ...SHIFT LOCK IS ON + CMP #$C0 + BCC .5 NOT IN ALPHA RANGE + BEQ .3 ...@ IS CAPITAL P + ORA #$20 ADJUST TO LOWER CASE + BIT $C063 TEST SHIFT KEY (PB3) + BMI .5 ...NOT PRESSED, LOWER CASE + CMP #$FB + BCC .4 ...NORMAL A-Z +.3 EOR #$10 CHANGE @ to P, [\]^_ to KLMNO +.4 AND #$DF UPPER CASE +.5 RTS + .ELSE +.2 RTS + .FIN +*-------------------------------- +ULTRA.COUT + CLD + PHA + STA MON.INVFLG BIT 7 CONTROLS INV/NORM + CMP #$20 CATCH INV CTRL CHARS + BCS .1 ...NOT ONE + ORA #$40 MAKE CTRL VISIBLE +.1 JSR ULTRA.COUT1 + LDA #$FF + STA MON.INVFLG + PLA + RTS +*-------------------------------- +W16TBL .DA #80/16 + .DA #96/16 + .DA #160/16 + .DA #80/16 + .DA #80/16 + .DA #80/16 + .DA #160/16 + .DA #128/16 +*-------------------------------- +* GET CHARACTER OFF CURRENT SCREEN LINE, COLUMN (Y) +*-------------------------------- +ULTRA.PICK.SCREEN + STY ULTRA.TEMPY + STX ULTRA.TEMPX + BIT $CFFF + BIT ULTRA.CARD TURN ON SCREEN +*-------------------------------- + LDA ULTRA.FLAGS GET MODE (0...7) + AND #$07 + TAY Y = MODE INDEX (0...7) +*-------------------------------- + LDA ULTRA.TEMPY HORIZ. POSN + CPY #$06 132 COL MODE? + BNE .1 ...NOT 132 COLUMNS + ADC #14 ADJUST FOR 132 COLUMN MODE +.1 STA ULTRA.CHPG +*-------------------------------- + LDX W16TBL,Y GET WIDTH/16 + LDA ULTRA.START CV*(WIDTH/16) + START +.2 CLC INCLUDE 'CLC' IN LOOP ON PURPOSE + ADC CV TO FORCE WRAP-AROUND + DEX + BNE .2 +*-------------------------------- + PHA + LSR *16 + LSR + LSR + LSR + TAX SAVE PAGE VALUE IN X-REG + PLA + ASL + ASL + ASL + ASL +*-------------------------------- + CLC + CH (or CH+15 if 132 columns) + ADC ULTRA.CHPG + STA ULTRA.CHPG + BCC .3 + INX ADD CARRY TO PAGE VALUE +*-------------------------------- +.3 TXA GET PAGE VALUE + AND #$0F + ORA MODETBL,Y + STA ULTRA.REG+2 +*-------------------------------- + ASL + AND #$0C + TAY + LDA ULTRA.REG,Y + TXA GET PAGE VALUE AGAIN + LSR SET CARRY IF IN 2ND PAGE +*-------------------------------- + LDY ULTRA.CHPG + LDA $CC00,Y + BCC .4 + LDA $CD00,Y +.4 ORA #$80 MAKE HIGH ASCII + LDY ULTRA.TEMPY RESTORE REGS + LDX ULTRA.TEMPX + RTS ALL DONE +*-------------------------------- +MODETBL .HS 40 80X24 (VIDEOTERM EMULATION) + .HS 50 96X24 + .HS 70 160X24 + .HS 50 80X24 INTERLACE + .HS 50 80X32 INTERLACE + .HS 50 80X48 INTERLACE + .HS 70 132X24 INTERLACE + .HS 70 128X32 INTERLACE +*-------------------------------------- + .EP +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/io.s.ultra +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/IO.S.IIE.VIDEX.txt b/SCMASM.31/IO.S.IIE.VIDEX.txt new file mode 100644 index 00000000..cf15d188 --- /dev/null +++ b/SCMASM.31/IO.S.IIE.VIDEX.txt @@ -0,0 +1,219 @@ +NEW + AUTO 3,1 +*-------------------------------------- + .PH $A800 +*-------------------------------- +VIDEX.SCREEN.WIDTH .EQ $A5 +*-------------------------------- +VIDEX.SLOT .EQ 3 ASSUME SLOT 3 +*-------------------------------- +VIDEX.CARD .EQ VIDEX.SLOT*256+$C000 +VIDEX.COUT1 .EQ VIDEX.SLOT*256+$C007 +VIDEX.REG .EQ VIDEX.SLOT*16+$C080 +VIDEX.DATA .EQ VIDEX.SLOT*16+$C081 +*-------------------------------- +VIDEX.BASEL .EQ $0478+VIDEX.SLOT +VIDEX.BASEH .EQ $04F8+VIDEX.SLOT +VIDEX.HORIZ .EQ $0578+VIDEX.SLOT +VIDEX.CHAR .EQ $0678+VIDEX.SLOT +*-------------------------------- +* I/O VECTORS -- 3 BYTES EACH +*-------------------------------- + JMP VIDEX.INIT + JMP VIDEX.WARM + JMP VIDEX.READ.KEY.WITH.CASE + JMP VIDEX.GET.HORIZ.POSN + LDA #$8C ^L--HOME + .HS 2C + LDA #$9D ^]--CLREOL + .HS 2C + LDA #$8B ^K--CLREOP + .HS 2C + LDA #$9F ^_--UP + .HS 2C + LDA #$8A ^J--DOWN + .HS 2C + LDA #$88 ^H--LEFT + .HS 2C + LDA #$9C ^\--RIGHT + NOP + JMP MON.COUT + JMP VIDEX.PICK.SCREEN + JMP VIDEX.HTABX + JMP VIDEX.HTAB + JMP VIDEX.VTAB +*---Case Toggle MUST go here----- + LDA CASEFLG + EOR #$80 + STA CASEFLG + RTS +*-------------------------------- +* VARIABLE LENGTH ROUTINES +*-------------------------------- +VIDEX.HTABX + PHA + TXA + JSR VIDEX.HTAB + PLA + RTS +*-------------------------------- +VIDEX.GET.HORIZ.POSN + LDA VIDEX.HORIZ + RTS +*-------------------------------- +VIDEX.VTAB + STA CV + LDA VIDEX.HORIZ +VIDEX.HTAB + PHA SAVE HORIZ POSN + LDA #$9E + JSR VIDEX.COUT1 + PLA GET HORIZ POSN + CLC + ADC #$A0 + JSR VIDEX.COUT1 + LDA CV + ORA #$A0 + JMP VIDEX.COUT1 +*-------------------------------- +VIDEX.INIT + LDA #80 + STA VIDEX.SCREEN.WIDTH + STA CASEFLG CLEAR CASEFLG (BIT7=0) + LDA #$8C CLEAR SCREEN AND START VIDEX-80 + JSR VIDEX.CARD +VIDEX.INSTALL.VECTORS + LDX #1 +.1 LDA VIDEX.VECTORS,X + STA $36,X + STA VIDEX.SLOT*2+$BE10,X + LDA VIDEX.VECTORS+2,X + BIT F.EXEC + BMI .2 + STA $38,X +.2 STA VIDEX.SLOT*2+$BE20,X + DEX + BPL .1 + RTS +*-------------------------------- +VIDEX.VECTORS + .DA VIDEX.COUT + .DA VIDEX.RDKEY +*-------------------------------- +VIDEX.WARM + CLD + LDX CV + JSR MON.INIT + STX CV + JMP VIDEX.INSTALL.VECTORS +*-------------------------------- +* READ KEY WITH CASE CONTROL +*-------------------------------- +VIDEX.READ.KEY.WITH.CASE + JSR MON.RDKEY + ORA #$80 REQUIRED FOR EXEC COMMAND + CLC SIGNAL NO OPEN APPLE + RTS +*-------------------------------- +VIDEX.RDKEY + CLD + LDA #$0A SELECT BLINKING DOUBLE UNDERLINE CURSOR + STA VIDEX.REG + LDA #$67 + STA VIDEX.DATA + LDA #$0B + STA VIDEX.REG + LDA #$08 + STA VIDEX.DATA +.1 LDA $C000 + BPL .1 + STA $C010 + PHA + LDA #$0A HIDE THE CURSOR + STA VIDEX.REG + LDA #$09 + STA VIDEX.DATA + PLA + CMP #$8D + BNE .2 + JSR IO.CLREOL + LDA #$8D +.2 BIT CASEFLG TEST CASE CONVERSION FLAG + BPL .6 DO NOT CONVERT + CMP #$B0 + BCC .6 DO NOT CONVERT + BIT $C063 TEST PADDLE BUTTON + BMI .5 NO SHIFTKEY PRESSED + CMP #$B0 + BEQ .4 + CMP #$C0 + BNE .3 + LDA #$D0 +.3 CMP #$DB + BCC .6 + AND #$CF + BNE .6 +.4 LDA #$DD +.5 ORA #$20 +.6 AND #$7F + STA VIDEX.CHAR + ORA #$80 + SEC + RTS +*-------------------------------- +VIDEX.COUT + CLD + CMP #$80 NORMAL OR INVERSE? + BCS .1 ...NORMAL + PHA ...80-COLUMN + LDA #$8F SELECT INVERSE DISPLAY + JSR VIDEX.COUT1 + PLA + ORA #$80 MAKE PRINTABLE CHARACTER + CMP #$A0 + BCS .2 + ORA #$40 +.2 JSR VIDEX.COUT1 + LDA #$8E SELECT NORMAL DISPLAY +.1 JMP VIDEX.COUT1 +*-------------------------------- +* GET CHARACTER OFF CURRENT SCREEN LINE, COLUMN (Y) +*-------------------------------- +VIDEX.PICK.SCREEN + STX SAVEX + BIT $CFFF TURN ON $C800 VIDEO SPACE + BIT VIDEX.CARD +*---CALCULATE POSITION----------- + CLC + TYA COLUMN 0-79 + ADC VIDEX.BASEL + PHA + LDA #0 + ADC VIDEX.BASEH + PHA + ASL + AND #$0C USE BIT 0 AND 1 FOR PAGING + TAX + LDA VIDEX.REG,X + PLA + LSR ODD/EVEN PAGE + PLA + TAX +*---GET CHAR FROM WINDOW--------- + LDA $CC00,X + BCC .1 + LDA $CD00,X +.1 ORA #$80 + STA VIDEX.CHAR + LDX SAVEX + RTS +*-------------------------------- +SAVEX .BS 1 +CASEFLG .BS 1 +*-------------------------------------- + .EP +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/io.s.videx +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/IO.S.STB80.txt b/SCMASM.31/IO.S.STB80.txt new file mode 100644 index 00000000..6b85185f --- /dev/null +++ b/SCMASM.31/IO.S.STB80.txt @@ -0,0 +1,166 @@ +NEW + AUTO 3,1 +*-------------------------------------- + .PH $A800 +*-------------------------------- +STB.SCREEN.WIDTH .EQ $A5 +*-------------------------------- +STB.SLOT .EQ 3 +*-------------------------------- +STB.HORIZ .EQ $05F8+STB.SLOT +STB.ESCBYT .EQ $06F8+STB.SLOT +STB.FLAGS .EQ $0778+STB.SLOT +*-------------------------------- +STB.ENTRY .EQ STB.SLOT*256+$C000 +STB.RDKEY1 .EQ STB.SLOT*256+$C005 +STB.COUT1 .EQ STB.SLOT*256+$C019 +STB.SCREEN .EQ STB.SLOT*256+$C031 +*-------------------------------- +* I/O VECTORS -- 3 BYTES EACH +*-------------------------------- + JMP STB.INIT + JMP STB.WARM + JMP STB.READ.KEY.WITH.CASE + JMP STB.GET.HORIZ.POSN + LDA #$8C ^L--HOME + .HS 2C + LDA #$9D ^]--CLREOL + .HS 2C + LDA #$8B ^K--CLREOP + .HS 2C + LDA #$9F ^_--UP + .HS 2C + LDA #$8A ^J--DOWN + .HS 2C + LDA #$88 ^H--LEFT + .HS 2C + LDA #$9C ^\--RIGHT + NOP + JMP MON.COUT + JMP STB.PICK.SCREEN + JMP STB.HTABX + JMP STB.HTAB + JMP STB.VTAB +*---Case Change MUST go here----- + LDA STB.FLAGS + EOR #$40 + STA STB.FLAGS + RTS +*-------------------------------- +* VARIABLE LENGTH ROUTINES +*-------------------------------- +STB.HTABX + PHA + TXA + JSR STB.HTAB + PLA + RTS +*-------------------------------- +STB.GET.HORIZ.POSN + LDA STB.HORIZ + RTS +*-------------------------------- +STB.VTAB + STA CV + LDA STB.HORIZ +STB.HTAB + PHA SAVE HORIZ POSN + LDA #$9E + JSR STB.COUT1 + PLA GET HORIZ POSN + JSR .1 + LDA CV + +.1 CLC + ADC #$A0 + JMP STB.COUT1 +*-------------------------------- +STB.INIT + LDA #80 + STA STB.SCREEN.WIDTH + LDA #$8C CLEAR SCREEN AND START STB-80 + JSR STB.ENTRY + LDA #0 + STA STB.ESCBYT DISABLE ^A AND ESC-MODE + LDA #2 DISABLE "HOME" SENSING + STA STB.FLAGS +STB.INSTALL.VECTORS + LDX #1 +.1 LDA STB.VECTORS,X + STA $36,X + STA STB.SLOT*2+$BE10,X + LDA STB.VECTORS+2,X + BIT F.EXEC + BMI .2 + STA $38,X +.2 STA STB.SLOT*2+$BE20,X + DEX + BPL .1 + RTS +*-------------------------------- +STB.VECTORS .DA STB.COUT + .DA STB.RDKEY +*-------------------------------- +STB.WARM + CLD + LDX CV + JSR MON.INIT + STX CV + JMP STB.INSTALL.VECTORS +*-------------------------------- +* READ KEY WITH CASE CONTROL +*-------------------------------- +STB.READ.KEY.WITH.CASE + JSR MON.RDKEY + ORA #$80 REQUIRED FOR EXEC FILES + CLC SIGNAL NO OPEN APPLE + RTS +*-------------------------------- +STB.RDKEY + CLD + LDA #$0A + STA STB.SLOT*16+$C080 + LDA #$07 SOLID DBL LINE CURSOR + STA STB.SLOT*16+$C081 + JSR STB.RDKEY1 + ORA #$80 Make sure it looks right + PHA + LDA #$0A + STA STB.SLOT*16+$C080 + LDA #$20 CURSOR OFF + STA STB.SLOT*16+$C081 + PLA + RTS +*-------------------------------- +STB.COUT + CLD + CMP #$80 NORMAL OR INVERSE? + BCS .1 ...NORMAL + PHA ...80-COLUMN + LDA #$8F SELECT INVERSE DISPLAY + JSR STB.COUT1 + PLA + ORA #$80 MAKE PRINTABLE CHARACTER + CMP #$A0 + BCS .2 + ORA #$40 +.2 JSR STB.COUT1 + LDA #$8E SELECT NORMAL DISPLAY +.1 JMP STB.COUT1 +*-------------------------------- +STB.PICK.SCREEN + STX $481 + TYA + STA $482 + JSR STB.HTAB + JSR STB.SCREEN + LDY $482 + LDX $481 + RTS +*-------------------------------------- + .EP +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/io.s.stb80 +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/SCI.S.CAT.txt b/SCMASM.31/SCI.S.CAT.txt new file mode 100644 index 00000000..3cfe476f --- /dev/null +++ b/SCMASM.31/SCI.S.CAT.txt @@ -0,0 +1,491 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* CATALOG COMMAND +*-------------------------------- +CAT + LDA #39 + .HS 2C SKIP OVER TWO BYTES +CATALOG + LDA #79 + STA CAT.WIDTH + LDA #0 CLEAR ACCUMULATED BLOCKS COUNTER + STA BLOCKS + STA BLOCKS+1 + LDA FBITS TEST FOR TYPE AND PATHNAME + AND #$05 + LSR PATHNAME BIT INTO CARRY + BNE .1 ...TYPE STATED + STA VAL.T SET T=0, LIST ALL TYPES +.1 BCS .2 ...PATH GIVEN + JSR GET.FILE.INFO NONE STATED, GET PREFIX + BCS .8 ...ERROR +*---GET DIRECTORY---------------- +.2 JSR OPEN.READ.DIR.HEADER + BCS .8 ...ERROR + LDY #0 Print directory pathname +.15 LDA PATHNAME.ONE.BUFFER+1,Y + ORA #$80 + JSR COUT + INY + CPY PATHNAME.ONE.BUFFER + BCC .15 + JSR CROUT +*---PRINT TITLES----------------- + LDA #Q.DIRHDR + JSR FIND.AND.PUT.MSG.IN.WBUF + JSR PRINT.CATALOG.LINE +*---IF NO MORE FILES, FINISHED--- +.3 LDA FILE.COUNT ANY FILES LEFT? + ORA FILE.COUNT+1 + BEQ .7 ...NO, FINISHED +*---NEXT FILE DESCRIPTION-------- + JSR READ.NEXT.ENTRY + BCS .8 ...ERROR + LDA VAL.T CHECK IF WE LIKE THIS TYPE + BEQ .4 ...WE LIKE THEM ALL + CMP DIRBUF+16 FILE TYPE + BNE .5 ...NO, SKIP OVER IT +.4 JSR FORMAT.CAT.ENTRY + JSR PRINT.CATALOG.LINE PRINT IT +*---CHECK FOR PAUSE/ABORT-------- +.5 JSR CHECK.KEY SEE IF KEYPRESS + BMI .3 ...NO, CONTINUE CATALOG + BEQ .7 ... or , abort +*--- or , so abort------ +.6 JSR CHECK.KEY + BMI .6 WAIT FOR KEY + BNE .3 ...NOT CR OR ESC, CONTINUE +*--- or , abort--------- +.7 LDX CAT.INDEX + LDA FILE.REFNUMS,X + JSR CLOSE.ONE.FILE + BCS .8 ...ERROR + JMP FREE.BLOCKS FORMAT BLOCKS FREE ETC. +.8 RTS +*-------------------------------- +CHECK.KEY + LDA $C000 SEE IF KEYSTROKE + BPL .1 ...NO + STA $C010 ...YES, CLEAR STROBE +.1 EOR #$8D SET .EQ. IF + BEQ .2 ...YES + EOR #$8D^$9B OR IF +.2 RTS .MI. IF NO KEY +*-------------------------------- +* FORMAT BLOCKS FREE/INUSE +*-------------------------------- +FREE.BLOCKS + JSR ZERO.ACCUM + JSR BLANK.WBUF + LDA #Q.BLOCKS.ABOVE + JSR FIND.AND.PUT.MSG.IN.WBUF + LDA BLOCKS + LDX BLOCKS+1 + LDY #24 + JSR CONVERT.TO.DECIMAL + JSR PRINT.MESSAGE +*-------------------------------- + LDA #PATHNAME.ONE.BUFFER+1 set up ONLINE call + STA MISC.PARMS+2 to read volume name + LDA /PATHNAME.ONE.BUFFER+1 + STA MISC.PARMS+3 + LDA UNIT + STA MISC.PARMS+1 + JSR MLI.C5 ONLINE + BCS .1 ...ERROR +*---Setup GET FILE INFO call----- + LDA PATHNAME.ONE.BUFFER+1 + AND #$0F + TAX + INX + STX PATHNAME.ONE.BUFFER + LDA #"/" + STA PATHNAME.ONE.BUFFER+1 + JSR GET.FILE.INFO + BCS .1 ...ERROR +*---Format the bottom line------- + JSR BLANK.WBUF + LDA #Q.BLOCKS + JSR FIND.AND.PUT.MSG.IN.WBUF +*---Total Blocks in Volume------- + LDA GET.SET.PARMS+5 + LDX GET.SET.PARMS+6 + LDY #51 + JSR CONVERT.TO.DECIMAL +*---Blocks Used in Volume-------- + LDA GET.SET.PARMS+8 + LDX GET.SET.PARMS+9 + LDY #24 + JSR CONVERT.TO.DECIMAL +*---Blocks Free in Volume-------- + LDA GET.SET.PARMS+5 + SEC + SBC GET.SET.PARMS+8 + PHA + LDA GET.SET.PARMS+6 + SBC GET.SET.PARMS+9 + TAX + PLA + LDY #37 + JSR CONVERT.TO.DECIMAL + JSR PRINT.CATALOG.LINE + CLC +.1 RTS +*-------------------------------- +* OPEN/READ DIRECTORY HEADER +*-------------------------------- +OPEN.READ.DIR.HEADER + JSR ALLOCATE.UPPER.BUFFER + STX CAT.INDEX + LDX #$0F IS STORAGE TYPE = VOL DIR? + CPX GET.SET.PARMS+7 + BNE .1 ...NO + STX GET.SET.PARMS+4 ...YES, MAKE TYPE = DIR +.1 LDA #$01 FILE MUST BE READABLE + JSR OPEN.DIRECTORY + BCS .3 ...ERROR + + LDX CAT.INDEX + STA FILE.REFNUMS,X + LDA #DIRBUF + STA READ.WRITE.PARMS+2 + LDA /DIRBUF + STA READ.WRITE.PARMS+3 + LDA #$2B + STA READ.WRITE.PARMS+4 + STA MISC.PARMS+2 + LDA #0 + STA READ.WRITE.PARMS+5 + JSR MLI.CA READ + BCS .3 + LDX #3 +.2 LDA DIRBUF+35,X ENTRY LENGTH, ENTRIES/BLOCK, + STA ENTRY.LENGTH,X and FILE COUNT + DEX + BPL .2 + LDA #1 + STA ENTRY.COUNTER +.3 RTS +*-------------------------------- +* READ NEXT DIRECTORY ENTRY +*-------------------------------- +READ.NEXT.ENTRY +.1 LDY ENTRY.COUNTER + CPY ENTRIES.PER.BLOCK + BCC .2 +*---Skip ahead remainder bytes--- + LDA #4 + SBC MISC.PARMS+2 + STA READ.WRITE.PARMS+4 + JSR MLI.CA + BCS .4 ...ERROR + LDY #0 + LDA #4 + STA MISC.PARMS+2 +*---Read a file description------ +.2 INY NEXT ENTRY + STY ENTRY.COUNTER + LDA ENTRY.LENGTH + STA READ.WRITE.PARMS+4 + ADC MISC.PARMS+2 + STA MISC.PARMS+2 + JSR MLI.CA READ + BCS .4 ...ERROR +*---Check if deleted file-------- + LDA DIRBUF + AND #$F0 + BEQ .1 ...deleted +*---Count the file--------------- + LDA FILE.COUNT + BNE .3 + DEC FILE.COUNT+1 +.3 DEC FILE.COUNT +.4 RTS +*-------------------------------- +* FORMAT CATALOG ENTRY LINE +*-------------------------------- + .DO LOWERCASE=1 +FORMAT.CAT.BITS .HS 8040201008040201 + .FIN +FORMAT.CAT.ENTRY + JSR BLANK.WBUF + + .DO LOWERCASE=1 + lda DIRBUF+$1D + bpl .18 + + lda DIRBUF + and #$0f + tay + +.10 cpy #8 + bcs .13 + + lda DIRBUF+$1D + and FORMAT.CAT.BITS,y + beq .15 + + bne .14 + +.13 lda DIRBUF+$1C + and FORMAT.CAT.BITS-8,y + beq .15 + +.14 lda DIRBUF,y + eor #$20 + sta DIRBUF,y + +.15 dey + bne .10 + +.18 .FIN + + LDA DIRBUF LENGTH OF FILENAME + AND #$0F + TAY +.1 LDA DIRBUF,Y + ORA #$80 + STA WBUF+7,Y + DEY + BNE .1 + STY ACCUM+2 +*---GET FILE TYPE---------------- + LDA DIRBUF+16 FILE TYPE + LDX #LAST.FILE.TYPE + LDY #3 POINT INTO WBUF +.2 CMP FILE.TYPES,X + BEQ .3 ...MATCH! + DEX + DEX + DEX + DEX + BPL .2 + JSR CONVERT.TO.HEX + JMP .6 +.3 DEX + LDA FILE.TYPES,X + JSR STUFF.WBUF.AND.BACKUP + BNE .3 +*---SKIP IF 40-COLUMN------------ + BIT CAT.WIDTH + BVC .7 +*---Display AuxType-------------- + LDY #"R" Use "R=" if type TXT + LDA DIRBUF+16 FILE TYPE + CMP #$04 + BEQ .5 ...it is TXT + CMP #$06 Use "A=" if type BIN + BNE .6 ...not BIN, just show $xxxx + LDY #"A" ...BIN +.5 STY WBUF+73 + LDA #"=" + STA WBUF+74 +.6 LDY #78 + LDA DIRBUF+31 AUXTYPE + JSR CONVERT.TO.HEX + LDA DIRBUF+32 " + JSR CONVERT.TO.HEX +*---Show file length------------- + LDA DIRBUF+23 EOF MARK MSB + STA ACCUM+2 + LDA DIRBUF+21 EOF MARK + LDX DIRBUF+22 " " + LDY #70 + JSR CONVERT.TO.DECIMAL +*---CREATION DATE/TIME----------- + LDX #$18 OFFSET IN DIRBUF + LDY #61 OFFSET IN WBUF + JSR FORMAT.DATE.AND.TIME +*---Blocks in the file----------- +.7 LDY #27 + LDA DIRBUF+19 BLOCKS IN USE + LDX DIRBUF+20 " + JSR CONVERT.TO.DECIMAL + CLC + LDA BLOCKS + ADC DIRBUF+19 + STA BLOCKS + LDA BLOCKS+1 + ADC DIRBUF+20 + STA BLOCKS+1 +*---Access code------------------ + LDA DIRBUF+30 ACCESS + AND #$C2 + CMP #$C2 + BEQ .8 + LDA #"*" LOCKED + STA WBUF+1 +*---Modified Date/Time----------- +.8 LDX #$21 OFFSET IN DIRBUF + LDY #44 OFFSET IN WBUF +*-------------------------------- +* FORMAT DATE & TIME +* --MSB--- --LSB--- +* YYYYYYYM MMMDDDDD +*-------------------------------- +FORMAT.DATE.AND.TIME + LDA DIRBUF,X MMMDDDDD + AND #$1F 000DDDDD + BEQ .1 ...DAY=0, NO DATE + STA DAY + LDA DIRBUF+1,X YYYYYYYM + LSR 0YYYYYYY + STA YEAR + CMP #100 + BCS .1 ...YEAR>99, NO DATE + LDA DIRBUF+1,X YYYYYYYM + LSR M INTO CARRY + LDA DIRBUF,X MMMDDDDD + ROL MMDDDDDM M + ROL MDDDDDMM M + ROL DDDDDMMM M + ROL DDDDMMMM + AND #$0F 0000MMMM + BEQ .1 ...MONTH=0, NO DATE + CMP #13 + BCC .3 ...MONTH=1...12, GOOD +*---Format ------------- +.1 TYA + SEC + SBC #6 BACK UP OVER TIME SLOT + TAY + LDX #8 +.2 LDA NO.DATE.MSG,X + JSR STUFF.WBUF.AND.BACKUP + DEX + BPL .2 + RTS +*---Format date, time------------ +.3 STA MONTH + LDA DIRBUF+3,X HOURS + PHA + LDA DIRBUF+2,X MINUTES + LDX #0 HIGH BYTE + CMP #60 IF > 59, USE 0 + BCC .4 0...59 + TXA +.4 JSR CONVERT.DECIMAL.TWO.DIGITS + LDA #":" SEPARATE WITH ":" + STA WBUF+2,Y + PLA HOURS + LDX #0 HIGH BYTE + CMP #24 IF > 24, USE 0 + BCC .5 0...23 + TXA +.5 JSR CONVERT.DECIMAL.TWO.DIGITS + LDA YEAR + JSR CONVERT.DECIMAL.TWO.DIGITS + LDX MONTH + LDA MONTH.NAMES-1+24,X + JSR STUFF.WBUF.AND.BACKUP + LDA MONTH.NAMES-1+12,X + JSR STUFF.WBUF.AND.BACKUP + LDA MONTH.NAMES-1,X + JSR STUFF.WBUF.AND.BACKUP + LDA #"-" + STA WBUF+5,Y + JSR STUFF.WBUF.AND.BACKUP + LDA DAY + LDX #0 HIGH BYTE +* JMP CONVERT.TO.DECIMAL +*-------------------------------- +* CONVERT TO DECIMAL +*-------------------------------- +CONVERT.TO.DECIMAL + STX ACCUM+1 + STA ACCUM +.1 JSR DIVIDE.ACCUM.BY.TEN + ORA #$B0 + JSR STUFF.WBUF.AND.BACKUP + LDA ACCUM + ORA ACCUM+1 + ORA ACCUM+2 + BNE .1 + RTS +*-------------------------------- +* CONVERT 2 DIGIT NUMBER +*-------------------------------- +CONVERT.DECIMAL.TWO.DIGITS + CLC + ADC #100 FORCE TWO DIGITS TO PRINT + JSR CONVERT.TO.DECIMAL + LDA #" " COVER UP THE "1" + INY +*-------------------------------- +STUFF.WBUF.AND.BACKUP + STA WBUF+1,Y + DEY + RTS +*-------------------------------- +* CONVERT TO HEX +*-------------------------------- +CONVERT.TO.HEX + PHA + AND #$0F + JSR .1 + PLA + LSR + LSR + LSR + LSR +.1 ORA #$B0 + CMP #$BA + BCC .2 + ADC #6 +.2 JSR STUFF.WBUF.AND.BACKUP + LDA #"$" + STA WBUF+1,Y + RTS +*-------------------------------- +* DIVIDE ACCUM BY TEN +*-------------------------------- +* DIVIDE 24-BIT VALUE IN ACCUM BY TEN +* RETURN REMAINDER IN A-REG +*-------------------------------- +DIVIDE.ACCUM.BY.TEN + LDX #24 24 BITS IN DIVIDEND + LDA #0 START WITH REM=0 +.1 JSR SHIFT.ACCUM.LEFT + ROL + CMP #10 + BCC .2 ...STILL < 10 + SBC #10 + INC ACCUM QUOTIENT BIT +.2 DEX NEXT BIT + BNE .1 + RTS +*-------------------------------- +BLANK.WBUF + LDA #" " + LDY #79 +.1 JSR STUFF.WBUF.AND.BACKUP + BPL .1 + RTS +*-------------------------------- +NOW JSR GP.MLI + .DA #$82,0000 + JSR BLANK.WBUF + LDX #4 +.1 LDA GP.DATE-1,X + STA DIRBUF-1,X + DEX + BNE .1 + LDY #15 + JSR FORMAT.DATE.AND.TIME + LDA #20 + STA CAT.WIDTH +*** JMP PRINT.CATALOG.LINE +*-------------------------------- +PRINT.CATALOG.LINE + LDX CAT.WIDTH + LDA #$8D + STA WBUF+1,X + JSR PRINT.MESSAGE + CLC because a SEC would indicate ERROR + RTS +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/sci.s.cat +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/SCI.S.CPAR.txt b/SCMASM.31/SCI.S.CPAR.txt new file mode 100644 index 00000000..ba1e7695 --- /dev/null +++ b/SCMASM.31/SCI.S.CPAR.txt @@ -0,0 +1,569 @@ +NEW + AUTO 3,1 +*-------------------------------------- + .DA COMMAND.TABLE needed for HELP command +*-------------------------------- +* PARSE COMMAND LINE +*-------------------------------- +PARSE.COMMAND + JSR SCAN.COMMAND.TABLE + BCS SYNERR2 ...SYNTAX ERROR + LDA #0 + STA FBITS + STA FBITS+1 + STA PATHNAME.TWO.BUFFER + STA PATHNAME.ONE.BUFFER+1 + LDA D.SLOT + STA VAL.S + LDA D.DRIV + STA VAL.D +*---Handle special cases--------- + BIT PBITS Check for PR# or IN# + BVS PARSE.INPR PR# & IN# commands + BPL .1 ...not CAT(ALOG) or PREFIX + JSR MLI.C7 ...CAT, CATALOG, or PREFIX +*---TEST CHAR AFTER COMMAND------ +.1 JSR GET.NEXT.NONBLANK + BNE .2 ...not comma or + BCC .5 ... already + JMP GET.ANOTHER.PARM +*---Get a pathname--------------- +.2 CMP #'/' MUST START WITH "/" OR LETTER + BEQ .3 + CMP #'A' + BCC SYNERR2 ...SYNTAX ERROR +.3 DEX RE-SCAN THE FIRST CHAR OF PATH + LDY #0 +.4 JSR GET.NEXT.CHAR.FROM.WBUF + STA PATHNAME.ONE.BUFFER+1,Y + JSR STORE.PATH.TWO.AND.TEST + BCC .4 + DEY + STY PATHNAME.ONE.BUFFER + STY PATHNAME.TWO.BUFFER + LDA #$01 TELL THE WORLD ABOUT IT + STA FBITS +*-------------------------------- + DEX RE-SCAN CHAR AFTER PATHNAME + JSR GET.NEXT.NONBLANK + BNE SYNERR2 ...NOT COMMA OR + BCS MORE.PARMS ...COMMA +.5 JMP NO.MORE.PARMS ... +SYNERR2 + JMP ERR.SYNTAX +*-------------------------------- +* PR# or IN# commands +*-------------------------------- +PARSE.INPR + JSR GET.NEXT.NONBLANK CHAR AFTER COMMAND + BEQ SYNERR2 ...comma or + DEX ...IN CASE IT IS "Axxx" + CMP #'A' + BEQ GET.ANOTHER.PARM ...HANDLE PR#Axxx or IN#Axxx + INX RESTORE X + JSR ZERO.ACCUM + STY PARM.LENM1 Y=0, 1 BYTE PARM + LDY #VAL.LB-VAL.A PARM OFFSET FROM VAL.A + STY PARM.OFFSET + LDY #$40 + STY FBITS + JSR CONVERT.DECIMAL.NUMBER + BCS RTS4 + LDA VAL.LB + CMP #$08 + BCC TEST.IF.MORE.PARMS +SCI.ERR.RANGE + LDA #$02 + SEC +RTS4 RTS +*-------------------------------- +MORE.PARMS + LDA PBITS + LSR TEST BIT 0 + BCC SYNERR2 ...NO PATHNAME EXPECTED + LSR TEST BIT 1 + BCC GET.ANOTHER.PARM ...NO PATH-TWO EXPECTED +*---Get second pathname---------- + JSR GET.NEXT.NONBLANK + BEQ SYNERR2 ...COMMA OR + DEX RE-SCAN FIRST CHAR OF PATHNAME + LDY #0 +.1 JSR GET.NEXT.CHAR.FROM.WBUF + JSR STORE.PATH.TWO.AND.TEST + BCC .1 + DEY + STY PATHNAME.TWO.BUFFER + LDA #$03 WE GOT TWO PATHNAMES, SO + STA FBITS MARK THE BITS + DEX RE-SCAN TERM. CHAR +*-------------------------------- +TEST.IF.MORE.PARMS + JSR GET.NEXT.NONBLANK + BNE SYNERR2 + BCC NO.MORE.PARMS +GET.ANOTHER.PARM + JSR GET.NEXT.NONBLANK + BEQ SYNERR2 ...NULL PARAMETER + JSR PARSE.PARAMETER + BCC TEST.IF.MORE.PARMS + RTS ...error return +*-------------------------------- +NO.MORE.PARMS + LDA VAL.S CHECK RANGE OF S AND D + BEQ SCI.ERR.RANGE + CMP #$08 + BCS SCI.ERR.RANGE + LDA VAL.D + BEQ SCI.ERR.RANGE + CMP #$03 + BCS SCI.ERR.RANGE +*---CHECK IF DEFERRED COMMAND---- + LDA PBITS (only OPEN and WRITE are deferred) + AND #$21 + LSR + BEQ .1 ...NOT DEFERRED + LDA STATE ...ARE WE IN DIRECT MODE? + BEQ .6 ...YES, DEFERRED IS ILLEGAL +*---CHECK PATHNAME--------------- +.1 BCC .5 ...NO PATH PERMITTED + LDA PBITS+1 + AND #$04 S OR D OK? + BEQ .5 ...NO + LDA FBITS + LSR HAVE WE A PATHNAME? + BCS .2 ...YES + LDA PBITS ...NO, IS PATH NEEDED + AND #$90 + BEQ ERR.SYNTAX ...YES + BPL .5 +*---NEED PREFIX OR S,D----------- +.2 LDA PATHNAME.ONE.BUFFER+1 + EOR #'/' SLASH + BEQ .3 ...EXPLICIT PREFIX + LDA PREFIX.FLAG MLI's flag + BEQ .4 ...NO PREFIX IS SET +.3 LDA FBITS+1 DID WE GET S,D? + AND #$04 + BEQ .5 ...NO + BCS .4 ...YES, AND THERE IS A PATHNAME + LDA #0 ...YES, BUT NO PATHNAME + STA PATHNAME.ONE.BUFFER + STA PATHNAME.ONE.BUFFER+1 + LDA #$01 SIGNAL WE GOT PATHNAME AFTER ALL + ORA FBITS + STA FBITS +.4 JSR INSERT.VOLUME.NAME + BCS .7 +*---BRANCH TO COMMAND------------ +.5 CLC SIGNAL NO ERROR + LDA COMMAND.NUMBER + BEQ EXTERNAL ...USER'S COMMAND + EOR #CN.PREFIX + BEQ INTERNAL ...PREFIX COMMAND + LDA PBITS+1 ARE S/D VALID? + AND #$04 + BEQ INTERNAL ...NO + LDA FBITS ANY PATHNAME SPECIFIED? + LSR + BCC INTERNAL ...NO + JSR GET.FILE.INFO ...YES + BCC INTERNAL ...NO ERROR + ORA #0 ...ERROR, WAS IT "FILE NOT FOUND"? + BPL .7 ...NO, REAL ERROR + LDA PBITS OKAY TO CREATE PATHNAME? + AND #$08 + BNE INTERNAL ...YES + LDA #$06 "PATH NOT FOUND" + .HS 2C +.6 LDA #$0F "NOT DIRECT COMMAND" + SEC +.7 RTS +*-------------------------------- +INTERNAL JMP (COMMAND.ADDR) +EXTERNAL JMP (EXTERNAL.COMMAND.HANDLER) +*-------------------------------- +ERR.SYNTAX + LDA #$10 SYNTAX ERROR +ERRR SEC + RTS +*-------------------------------- +* INSERT PREFIX BEFORE PATHNAME +*-------------------------------- +INSERT.VOLUME.NAME + LDA VAL.S BUILD UNIT # FROM SLOT,DRIVE + TAY SAVE VAL.S + LSR 0000.00SS S + ROR S000.000S S + ROR SS00.0000 S + ROR SSS0.0000 0 + LDX VAL.D + CPX #2 .CS. if 2, .CC. if 1 + ROR DSSS.0000 + STA MISC.PARMS+1 + LDA #WBUF+1 + STA MISC.PARMS+2 + LDA /WBUF+1 + STA MISC.PARMS+3 + JSR MLI.C5 ONLINE -- READ VOLUME NAME + BCS .4 NO SUCH SLOT AND DRIVE + STX D.DRIV UPDATE DEFAULT S AND D + STY D.SLOT +*-------------------------------- + LDA PATHNAME.ONE.BUFFER+1 + EOR #'/' ALREADY HAVE VOLUME NAME? + BEQ .4 ...YES, DON'T NEED ANOTHER +*---ISOLATE VOLNAME LENGTH------- + LDA WBUF+1 DSSSLLLL + AND #$0F 0000LLLL + STA WBUF+1 +*---MOVE PATHNAMES OVER L+2------ + LDY #62 + TYA + SEC + SBC WBUF+1 + TAX +.1 LDA PATHNAME.ONE.BUFFER,X + STA PATHNAME.ONE.BUFFER+2,Y + LDA PATHNAME.TWO.BUFFER,X + STA PATHNAME.TWO.BUFFER+2,Y + DEY + DEX + BNE .1 +*---INSERT VOLUME SLASHES-------- + LDA #'/' + STA PATHNAME.ONE.BUFFER+2,Y + STA PATHNAME.ONE.BUFFER+1 + STA PATHNAME.TWO.BUFFER+2,Y + STA PATHNAME.TWO.BUFFER+1 +*---COPY VOLUME NAME------------- +.2 LDA WBUF+1,Y + STA PATHNAME.ONE.BUFFER+1,Y + STA PATHNAME.TWO.BUFFER+1,Y + DEY + BNE .2 +*---UPDATE PATH LENGTHS---------- + CLC + LDA WBUF+1 + ADC #2 INCLUDE SLASHES + TAY + ADC PATHNAME.ONE.BUFFER + CMP #64 +.3 BCS ERR.SYNTAX + STA PATHNAME.ONE.BUFFER + TYA + ADC PATHNAME.TWO.BUFFER + STA PATHNAME.TWO.BUFFER + CMP #64 + BCS .3 ...BRIDGE TO SYNTAX ERROR +*-------------------------------- +.4 RTS +*-------------------------------- +SCAN.COMMAND.TABLE + LDY #0 PNTR INTO COMMAND TABLE + STY COMMAND.NUMBER + DEY +*---COMPARE COMMAND NAME--------- +.1 INC COMMAND.NUMBER + LDX #0 PNTR INTO WBUF +.2 INY next byte in command table + JSR GET.NEXT.NONBLANK + BEQ .4 ...end of WBUF contents + EOR COMMAND.TABLE,Y + BEQ .2 ...same so far + ASL Might be last char + BNE .4 ...No, try next command +*---We found the command--------- + LDA COMMAND.TABLE+1,Y + STA COMMAND.ADDR + LDA COMMAND.TABLE+2,Y + STA COMMAND.ADDR+1 + LDA COMMAND.TABLE+3,Y + STA PBITS + LDA COMMAND.TABLE+4,Y + STA PBITS+1 + CLC + RTS +*---SKIP TO NEXT COMMAND--------- +.3 INY +.4 LDA COMMAND.TABLE,Y + BPL .3 ...NOT LAST CHAR YET + INY SKIP OVER ADDRESS + INY + INY SKIP OVER PBITS + INY + LDA COMMAND.TABLE+1,Y + BNE .1 ...more commands in table +*---TRY EXTERNAL COMMAND--------- + LDA #$FF + STA COMMAND.NUMBER + SEC + JMP SCI.USER.CMD +*-------------------------------- +SYNERR1 JMP ERR.SYNTAX +*-------------------------------- +PARSE.PARAMETER + JSR ZERO.ACCUM + LDY #NO.PARM.NAMES-1 +.1 CMP PARM.NAMES,Y + BEQ FOUND.PARM + DEY + BPL .1 + CMP #'T' + BNE SYNERR1 ...SYNTAX ERROR +*---PARSE T PARAMETER------------ + LDA #$04 + AND PBITS + BEQ ERR.BADPARM + ORA FBITS + STA FBITS + LDA #0 SINGLE BLYTE + STA PARM.LENM1 + LDA #VAL.T-VAL.A PARM OFFSET FROM VAL.A + STA PARM.OFFSET + JSR GET.NEXT.NONBLANK + BEQ SYNERR1 + CMP #'$' + BEQ CONVERT.HEX.NUMBER + CMP #'A' + BCC CONVERT.DECIMAL.NUMBER + JMP CONVERT.FILE.TYPE +*-------------------------------- +ERR.BADPARM + SEC "INVALID PARAMETER" + LDA #$0B + RTS +*-------------------------------- +FOUND.PARM + LDA PARM.MASKS,Y + BEQ .2 + AND PBITS+1 + BEQ ERR.BADPARM + CMP #$04 IS IT S OR D + BNE .1 ...NO + AND FBITS+1 ...YES, DID WE ALREADY HAVE S OR D + BNE .2 ...YES + LDA #1 ...NO, SET D=1 + STA VAL.D + LDA #$04 +.1 ORA FBITS+1 + STA FBITS+1 +.2 LDA PARM.VARIABLES,Y + AND #$03 + STA PARM.LENM1 + LDA PARM.VARIABLES,Y + LSR + LSR + STA PARM.OFFSET + JSR GET.NEXT.NONBLANK + BEQ GO.ERR.SYNTAX.1 + CMP #'$' + BEQ CONVERT.HEX.NUMBER +*-------------------------------- +CONVERT.DECIMAL.NUMBER + STX COMMAND.LINE.LENGTH + JSR ACCUMULATE.DECIMAL.DIGIT + BCC .1 + BMI GO.ERR.RANGE.1 + BCS GO.ERR.SYNTAX.1 +.1 LDX COMMAND.LINE.LENGTH + JSR GET.NEXT.NONBLANK + BNE CONVERT.DECIMAL.NUMBER + BEQ CHECK.PARAMETER.RANGE +*-------------------------------- +CONVERT.HEX.NUMBER + JSR GET.NEXT.NONBLANK + BEQ GO.ERR.SYNTAX.1 +.1 STX COMMAND.LINE.LENGTH + JSR ACCUMULATE.HEX.DIGIT + BCC .2 + BMI GO.ERR.RANGE.1 + BCS GO.ERR.SYNTAX.1 +.2 LDX COMMAND.LINE.LENGTH + JSR GET.NEXT.NONBLANK + BNE .1 +*-------------------------------- +CHECK.PARAMETER.RANGE + LDX #$02 +.1 CPX PARM.LENM1 + BEQ .2 + LDA ACCUM,X + BNE GO.ERR.RANGE.1 + DEX + BNE .1 +.2 LDY PARM.OFFSET +.3 LDA ACCUM,X + STA VAL.A,Y + DEY + DEX + BPL .3 + LDX COMMAND.LINE.LENGTH + CLC + RTS +*-------------------------------- +GO.ERR.SYNTAX.1 JMP ERR.SYNTAX +*-------------------------------- +GO.ERR.RANGE.1 JMP SCI.ERR.RANGE +*-------------------------------- +CONVERT.FILE.TYPE + STA ACCUM+2 1ST LETTER + LDY #2 GET 2ND AND 3RD +.1 JSR GET.NEXT.NONBLANK + BEQ GO.ERR.SYNTAX.1 + STA ACCUM-1,Y STORE THEM BACKWARDS + DEY + BNE .1 ...UNTIL Y=0 + STX COMMAND.LINE.LENGTH SAVE X-REG +.2 LDX #2 COMPARE NEXT ENTRY +.3 LDA ACCUM,X + EOR FILE.TYPES,Y + INY + ASL IGNORE BIT 7 + BNE .4 ...NOT THE SAME + DEX NEXT CHAR + BPL .3 + LDA FILE.TYPES,Y + STA VAL.T + LDX COMMAND.LINE.LENGTH RESTORE X-REG + CLC + RTS +.4 INY + DEX + BPL .4 + CPY #LAST.FILE.TYPE + BCC .2 + BCS GO.ERR.SYNTAX.1 +*-------------------------------- +* GET NEXT NON-BLANK CHAR FROM WBUF +* CHAR Z C +* YES CLR +* COMMA YES SET +* OTHER NO ? +*-------------------------------- +GET.NEXT.NONBLANK +.1 JSR GET.NEXT.CHAR.FROM.WBUF + CMP #' ' + BEQ .1 IGNORE BLANKS + CMP #',' + BEQ .2 .CS. and .EQ. + CMP #$0D .EQ. if + CLC .CC. +.2 RTS +*-------------------------------- +GET.NEXT.CHAR.FROM.WBUF + LDA WBUF,X + BNE .1 MAKE 00==8D + + LDA #$0D + +.1 AND #$7F + + .DO LOWERCASE=1 + .ELSE + CMP #$60 CONVERT LOWER CASE TO UPPER + BCC .2 + + AND #$5F +.2 .FIN + INX + RTS +*-------------------------------- +ACCUMULATE.DECIMAL.DIGIT + CMP #$30 + BCC .1 + CMP #$3A + BCC .2 +.1 SEC + ORA #0 + RTS +*-------------------------------- +.2 AND #$0F + PHA + LDA ACCUM+2 + CMP #$1A + BCS .5 + LDX #$02 +.3 LDA ACCUM,X + PHA + DEX + BPL .3 + JSR SHIFT.ACCUM.LEFT + JSR SHIFT.ACCUM.LEFT + LDX #0 + CLC +.4 PLA + ADC ACCUM,X + STA ACCUM,X + INX + TXA + EOR #$03 + BNE .4 + JSR SHIFT.ACCUM.LEFT +.5 PLA + BCS TOOBIG + ADC ACCUM + STA ACCUM + BCC RTS1 + CLC + INC ACCUM+1 + BNE RTS1 + INC ACCUM+2 + BNE RTS1 +TOOBIG LDA #$FF + SEC +RTS1 RTS +*-------------------------------- +ACCUMULATE.HEX.DIGIT + CMP #'0' + BCC .1 + CMP #'9'+1 + BCC .3 + CMP #'A' + BCC .1 + CMP #'F'+1 + BCC .2 +.1 SEC + ORA #0 + RTS +.2 SBC #$06 +.3 AND #$0F + LDX #$03 +.4 JSR SHIFT.ACCUM.LEFT + BCS TOOBIG + DEX + BPL .4 + ORA ACCUM + STA ACCUM + RTS +*-------------------------------- +SHIFT.ACCUM.LEFT + ASL ACCUM + ROL ACCUM+1 + ROL ACCUM+2 + RTS +*-------------------------------- +ZERO.ACCUM + LDY #0 + STY ACCUM + STY ACCUM+1 + STY ACCUM+2 + RTS +*-------------------------------- +* RETURN .CC. IF NOT END OF PATHNAME YET +* ELSE .CS. +*-------------------------------- +STORE.PATH.TWO.AND.TEST + STA PATHNAME.TWO.BUFFER+1,Y + INY + CMP #',' + BEQ .1 + CMP #' ' + BEQ .1 + CMP #$0D + BEQ .1 + CPY #65 +.1 RTS +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/sci.s.cpar +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/SCI.S.EQ.txt b/SCMASM.31/SCI.S.EQ.txt new file mode 100644 index 00000000..fb610059 --- /dev/null +++ b/SCMASM.31/SCI.S.EQ.txt @@ -0,0 +1,47 @@ +NEW + AUTO 3,1 +*-------------------------------------- +*BASL .EQ $28 +CSWL .EQ $36 +CSWH .EQ $37 +KSWL .EQ $38 +KSWH .EQ $39 +DRIVER.PTR .EQ $3A,3B +RETRY.COUNT .EQ $3C +*-------------------------------- +SC.INFLAG .EQ $51 $Cx if .INBx +SC.LOMEM .EQ $52,53 START OF SYMBOLS +SC.EOT .EQ $54,55 END OF SYMBOL TABLE +SC.PP .EQ $56,57 START OF SOURCE PROGRAM +SC.HIMEM .EQ $58,59 END OF SOURCE PROGRAM +*PASS .EQ $63 PASS ($FF if command, 0 or 1 if assembling) +*-------------------------------- +*WBUF .EQ $0200 +DIRBUF .EQ $0259 +PATHNAME.TWO.BUFFER .EQ $0280 +*-------------------------------- +GP.MLI .EQ $BF00 +UNIT .EQ $BF30 +BITMAP .EQ $BF58 +GP.DATE .EQ $BF90 ... 93 +LEVEL .EQ $BF94 +PREFIX.FLAG .EQ $BF9A +*-------------------------------- +KEYBOARD .EQ $C000 +STROBE .EQ $C010 +IO.OFF .EQ $CFFF +*-------------------------------- +BELL .EQ $FBE2 +ABORT.EXIT .EQ $FD10 +PRBYTE .EQ $FDDA +CROUT .EQ $FD8E +COUT .EQ $FDED +*MON.SETVID .EQ $FE93 +*-------------------------------- +SC.HARD .EQ $8000 +SC.SOFT .EQ $8003 +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/sci.s.eq +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/SCI.S.ERRORS.txt b/SCMASM.31/SCI.S.ERRORS.txt new file mode 100644 index 00000000..6fa63b5f --- /dev/null +++ b/SCMASM.31/SCI.S.ERRORS.txt @@ -0,0 +1,107 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* Error Handler +*-------------------------------- +ERROR.HANDLER + AND #$1F TRIM TO SIZE + STA ERROR.CODE + LDA #$0F LEVEL + STA LEVEL + JSR UNHOOK.WRITE ...IF WRITING + LDA #0 + STA CLOSE.FLUSH.PARMS+1 + JSR MLI.CC CLOSE ALL FILES + BCS .1 + LDA #0 + STA LEVEL + STA CLOSE.FLUSH.PARMS+1 + JSR MLI.CD FLUSH +.1 LDA ERROR.CODE + JSR PRINT.ERROR + JSR CLOSE.EXEC.FILE + JSR CROUT + JMP SC.SOFT +*-------------------------------- +ERR.FILE.BUSY + LDA #$14 + SEC + RTS +*-------------------------------- +ERROR.PRINTER + JSR FIND.AND.PUT.MSG.IN.WBUF + JSR BELL +*---PRINT MESSAGE FROM WBUF------ +PRINT.CR.MESSAGE + JSR CROUT +PRINT.MESSAGE + LDX #0 +.1 LDA WBUF+1,X + JSR COUT + INX + CMP #$8D END OF MESSAGE? + BNE .1 ...NO + RTS ...YES +*-------------------------------- +FIND.AND.PUT.MSG.IN.WBUF + LDX #0 + CLC +*---SEARCH FOR MESSAGE #--------- + STA WBUF + TAY + BEQ .5 ...FIRST MESSAGE +.2 JSR SCI.GET.NEXT.NYBBLE + BNE .4 +.3 JSR SCI.GET.NEXT.NYBBLE + BEQ .3 + BNE .2 +.4 EOR #$0F + BNE .2 + DEC WBUF + BNE .2 +*---Put message in WBUF---------- +.5 LDY #0 + STY WBUF+80 SQUEEZED BLANK COUNT +.6 STY WBUF STORAGE INDEX + LDA WBUF+80 BLANK COUNT + BNE .8 ...ANOTHER BLANK +.7 JSR SCI.GET.NEXT.NYBBLE + LDA SCI.FIRST.TABLE,Y + BNE .9 ...FREQUENT CHAR + JSR SCI.GET.NEXT.NYBBLE + LDA SCI.SECOND.TABLE,Y + BNE .9 ...TWO NYBBLE CHAR + JSR SCI.GET.NEXT.NYBBLE + LDA SCI.THIRD.TABLE,Y + BMI .9 ...REAL CHAR + STA WBUF+80 ...BLANK COUNT +.8 LDA #" " + DEC WBUF+80 + BEQ .7 ...NO MORE BLANKS +.9 LDY WBUF STORAGE INDEX + STA WBUF+1,Y + INY NEXT COLUMN + EOR #$8D END OF MESSAGE? + BNE .6 ...NO + RTS ...YES +*-------------------------------- +SCI.GET.NEXT.NYBBLE + LDA SCI.MESSAGES,X + BCS .1 2ND NYBBLE + LSR 1ST NYBBLE + LSR + LSR + LSR + TAY + SEC + RTS +.1 INX + AND #$0F + TAY + CLC + RTS +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/sci.s.errors +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/SCI.S.EXEC.txt b/SCMASM.31/SCI.S.EXEC.txt new file mode 100644 index 00000000..186dd15b --- /dev/null +++ b/SCMASM.31/SCI.S.EXEC.txt @@ -0,0 +1,125 @@ +NEW + AUTO 3,1 +*-------------------------------------- +EXEC.ERR.FILE.BUSY JMP ERR.FILE.BUSY +EXEC.ERR.MISMATCH JMP TYPERR +*-------------------------------- +EXEC + JSR GET.REFNUM.OF.OPEN.FILE + BCS .1 ...NOT CURRENTLY OPEN +*---File is in use--------------- + BIT EXEC.FILE.CLOSING.FLAG + BPL EXEC.ERR.FILE.BUSY +*---Restarting same EXEC file---- + STA MISC.PARMS+1 REFNUM + LDA #0 "REWIND" THE FILE + STA MISC.PARMS+2 + STA MISC.PARMS+3 + STA MISC.PARMS+4 + JSR MLI.CE SET MARK + BCS CLOSE.EXEC.SAVING.ERROR + BCC .2 ...ALWAYS, RESTART +*-------------------------------- +.1 JSR CLOSE.EXEC.FILE STOP ANY EXEC IN PROGRESS + BCS .3 ...ERROR +*---Check file type-------------- + LDA GET.SET.PARMS+4 FILE TYPE MUST BE TXT + CMP #$04 TXT FILETYPE CODE + BNE EXEC.ERR.MISMATCH +*---Open the file---------------- + LDA #0 + STA LEVEL LEVEL + STA MISC.PARMS+2 BUFFER ADDRESS + LDA EXEC.BUFFER.BASE + STA MISC.PARMS+3 BUFFER ADDRESS HI + STA OPEN.PARMS+4 " + JSR MLI.C8 OPEN + BCS .3 ...ERROR + LDA OPEN.PARMS+5 REFNUM OF FILE + STA EXEC.REFNUM +*---Fill other param blocks------ +.2 LDX GET.SET.PARMS+5 RECORD LENGTH + STX VAL.L + LDX GET.SET.PARMS+6 + STX VAL.L+1 + LDX #2 POINT AT EXEC FILE NAME + JSR SAVE.FILENAME.IN.TABLE +*---Switch EXEC on now----------- + LDA #$FF MARK EXEC ACTIVE + STA F.EXEC + LDA KSWL + STA VDOSIO+2 + LDA KSWH + STA VDOSIO+3 + LDA #READ.EXEC.FILE + STA KSWL + LDA /READ.EXEC.FILE + STA KSWH + CLC +.3 RTS +*-------------------------------- +CLOSE.EXEC.SAVING.ERROR + PHA SAVE ERROR CODE + JSR CLOSE.EXEC.FILE CLOSE THE FILE + PLA GET ERROR CODE + SEC SIGNAL ERROR + RTS +*-------------------------------- +* CLOSE EXEC FILE +*-------------------------------- +CLOSE.EXEC.FILE + CLC + LDA F.EXEC + BPL .1 ...NO EXEC IN PROGRESS + LDA VDOSIO+2 RESTORE INPUT HOOK + STA KSWL + LDA VDOSIO+3 + STA KSWH + LDA #$FF + STA EXEC.FILE.CLOSING.FLAG + LDX #2 + LDA EXEC.REFNUM + JSR CLOSE.ONE.FILE CLOSE THE FILE +.1 RTS +*-------------------------------- +* "EXEC" INPUT HOOK +*-------------------------------- +READ.EXEC.FILE + STA (BASL),Y STOP BLINKING ON SCREEN + JSR SAVE.REGS SAVE A,X,Y +*---Check for CTRL-C Abort------- + LDA KEYBOARD + CMP #$83 CONTROL-C? + BNE .2 ...NO + JSR CLOSE.EXEC.FILE ...YES + STA STROBE +*---End of Data------------------ +.1 JSR RESTORE.REGS + JMP ABORT.EXIT +*---Set up EXEC char input------- +.2 LDA EXEC.REFNUM REFNUM + STA READ.WRITE.PARMS+1 + LDA #EXEC.INPUT.CHAR + STA READ.WRITE.PARMS+2 + LDA /EXEC.INPUT.CHAR + STA READ.WRITE.PARMS+3 + LDA #1 READ JUST ONE BYTE + STA READ.WRITE.PARMS+4 + LDA #0 + STA READ.WRITE.PARMS+5 + JSR MLI.CA READ + BCS .3 ...ERROR OR END OF DATA + JSR RESTORE.REGS + LDA EXEC.INPUT.CHAR + ORA #$80 + RTS +*-------------------------------- +.3 JSR CLOSE.EXEC.SAVING.ERROR CLOSE EXEC FILE + CMP #$05 END OF DATA? + BEQ .1 ...YES + JMP ERROR.HANDLER +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/sci.s.exec +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/SCI.S.GP.txt b/SCMASM.31/SCI.S.GP.txt new file mode 100644 index 00000000..864af053 --- /dev/null +++ b/SCMASM.31/SCI.S.GP.txt @@ -0,0 +1,174 @@ +NEW + AUTO 3,1 +*-------------------------------------- + JMP WARM.DOS + JMP PARSE.COMMAND +SCI.USER.CMD JMP GP.RTS USER COMMAND PARSER + JMP ERROR.HANDLER +PRINT.ERROR JMP ERROR.PRINTER +ERROR.CODE .HS 00 +*-------------------------------- +OUTVEC .DA $FDF0,$C100,$C200,$C300,$C400,$C500,$C600,$C700 +INVEC .DA $FD1B,$C100,$C200,$C300,$C400,$C500,$C600,$C700 +*-------------------------------- +VECOUT .HS F0FD +VECIN .HS 1BFD +*-------------------------------- +VDOSIO .DA 0,0 SAVE HARDWARE VECTOR DURING EXEC, WRITE + .DA 0,0 VSYSIO +*-------------------------------- +D.SLOT .HS 06 +D.DRIV .HS 01 +*-------------------------------- +PREGA .BS 1 +PREGX .BS 1 +PREGY .BS 1 +*-------------------------------- +F.TRACE .BS 1 +=TRACE OFF, -=TRACE ON +STATE .BS 1 0=IMMD, >0=DEFERRED +F.EXEC .BS 1 +F.READ .BS 1 +F.WRITE .BS 1 +F.PREFIX .BS 1 +DIR.FILE.READ.FLAG .BS 1 +*-------------------------------- + .HS 00 +*-------------------------------- +STRINGS.SPACE.COUNT .BS 1 +BUFFERED.WRITE.COUNT .BS 1 +COMMAND.LINE.LENGTH .BS 1 +PREVIOUS.CHAR .BS 1 +OPEN.FILE.COUNT .BS 1 +EXEC.FILE.CLOSING.FLAG .BS 1 +CATALOG.LINE.STATE .BS 1 +*-------------------------------- +EXTERNAL.COMMAND.HANDLER .BS 2 +COMMAND.NAME.LENGTH .BS 1 +COMMAND.NUMBER .BS 1 +*-------------------------------- +PBITS .HS 0000 +FBITS .HS 0000 +VAL.A .HS 0000 +VAL.B .HS 000000 +VAL.E .HS 0000 +VAL.L .HS 0000 +VAL.S .HS 00 +VAL.D .HS 00 +VAL.F .HS 0000 +VAL.R .HS 0000 +VAL.V .HS 00 +VAL.AT .HS 0000 +VAL.T .HS 00 +VAL.LB .HS 00 PR# OR IN# VALUE +*-------------------------------- + .DA PATHNAME.ONE.BUFFER + .DA PATHNAME.TWO.BUFFER +*-------------------------------- +MLI.CALLER + STA .2 + STX GP.SAVEX + CMP #$CF + BCC .1 + LDA #$CE +.1 TAX + LDA MLI.PARM.PNTRS-$C0,X + STA .3 + JSR GP.MLI +.2 .HS 00 +.3 .DA * + BCC .6 + LDX #0 +.4 CMP MLI.ERROR.CODES,X + BEQ .5 + INX + CPX #19 + BCC .4 +.5 LDA BI.ERROR.CODES,X +*** SEC (CARRY ALREADY SET) +.6 LDX #*-* +GP.SAVEX .EQ *-1 + ORA #0 +GP.RTS RTS +*-------------------------------- + .HS 00 <<>> +*---CREATE PARMS----------------- +CREATE.PARMS + .HS 07 + .DA PATHNAME.ONE.BUFFER + .HS C3.00.0000.00.0000.0000 +*---GET & SET PREFIX, DESTROY---- +PREFIX.PARMS + .HS 01 + .DA PATHNAME.ONE.BUFFER +*---RENAME----------------------- +RENAME.PARMS + .HS 02 + .DA PATHNAME.ONE.BUFFER + .DA PATHNAME.TWO.BUFFER +*---GET & SET FILE INFO---------- +GET.SET.PARMS + .HS 0A + .DA PATHNAME.ONE.BUFFER + .HS 00.00.0000 + .HS 00.0000.0000.0000.0000.0000 +*---MISC------------------------- +MISC.PARMS + .HS 02.00.0000 + .HS 00 +*---OPEN PARMS------------------- +OPEN.PARMS + .HS 03 + .DA PATHNAME.ONE.BUFFER + .HS 0000.00 +*---SET NEWLINE PARMS------------ +NEWLINE.PARMS + .HS 03.00.7F.0D +*---READ & WRITE PARMS----------- +READ.WRITE.PARMS + .HS 04.00.0000.0000.0000 +*---CLOSE & FLUSH PARMS---------- +CLOSE.FLUSH.PARMS + .HS 01.00 +*-------------------------------- +* ADDRESSES OF MLI PARM LISTS FOR EACH CALL $C0-$D3 +* actual address is $BExx +*-------------------------------- +MLI.PARM.PNTRS + .DA #CREATE.PARMS $C0--CREATE + .DA #PREFIX.PARMS $C1--DESTROY + .DA #RENAME.PARMS $C2--RENAME + .DA #GET.SET.PARMS $C3--SFI + .DA #GET.SET.PARMS $C4--GFI + .DA #MISC.PARMS $C5--ONLINE + .DA #PREFIX.PARMS $C6--SPFX + .DA #PREFIX.PARMS $C7--GPFX + .DA #OPEN.PARMS $C8--OPEN + .DA #NEWLINE.PARMS $C9--NEWLINE + .DA #READ.WRITE.PARMS $CA--READ + .DA #READ.WRITE.PARMS $CB--WRITE + .DA #CLOSE.FLUSH.PARMS $CC--CLOSE + .DA #CLOSE.FLUSH.PARMS $CD--FLUSH + .DA #MISC.PARMS $CE--SMARK +* .DA #MISC.PARMS $CF--GMARK +* .DA #MISC.PARMS $D0--SEOF +* .DA #MISC.PARMS $D1--GEOF +* .DA #MISC.PARMS $D2--SBUF +* .DA #MISC.PARMS $D3--GBUF +*-------------------------------- + .AS -/++++/ +*-------------------------------- +BUFFER.BASES .HS 78.7C LOWER/UPPER BUFFERS +EXEC.BUFFER.BASE .HS 74 +*-------------------------------- + RTS WAS GET BUFFER + NOP + NOP + RTS WAS RETURN BUFFER + NOP + NOP + .HS 74 HIMEM PAGE +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/sci.s.gp +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/SCI.S.LOADSAVE.txt b/SCMASM.31/SCI.S.LOADSAVE.txt new file mode 100644 index 00000000..a753a4b7 --- /dev/null +++ b/SCMASM.31/SCI.S.LOADSAVE.txt @@ -0,0 +1,381 @@ +NEW + AUTO 3,1 +*-------------------------------------- +DASH + LDA GET.SET.PARMS+4 GET FILE TYPE + CMP #$06 BINARY? + BEQ .3 ...YES, BRUN + CMP #$04 TEXT? + BNE .1 ...NO, TRY SYS + JMP EXEC ...YES, EXEC +*-------------------------------- +.1 CMP #$FF SYS FILE? + BEQ .2 ...YES, BRUN IT + LDA #$0D "FILE TYPE MISMATCH" + SEC + RTS +*---RUN SYS FILE----------------- +.2 JSR CLOSE.ALL.FILES + JSR CLOSE.EXEC.FILE + LDA #0 + STA VAL.A + LDX #6 RELEASE $8000-$B7FF +.4 STA BITMAP+16,X + DEX + BPL .4 + LDA #$01 RELEASE $B800-$BEFF + STA BITMAP+23 B800.BFFF + LDA /$2000 A$2000 + STA VAL.A+1 + LDA #$FF T=SYS + STA VAL.T + LDA #$80 SIGNAL FOUND T,A, AND PATHNAME + STA FBITS+1 + LDA #$05 + STA FBITS +.3 JMP BRUN +*-------------------------------- +WARM.DOS + JSR CLOSE.ALL.FILES + JSR CROUT + JMP SC.SOFT +*-------------------------------- +* LOAD A SOURCE PROGRAM +*-------------------------------- +LOAD + JSR ALLOCATE.UPPER.BUFFER + BCS .5 + LDA #$01 READ + LDX #$FA FILE TYPE + JSR OPEN.A.FILE + BCS .5 ...ERROR +*---GET LENGTH OF FILE----------- + LDA SC.INFLAG + ASL + BPL .1 ...NOT .INBx + AND #$7F + STA MISC.PARMS+3 + LDA #0 + STA MISC.PARMS+2 + BEQ .2 ...ALWAYS +.1 JSR MLI.D1 GET LENGTH OF FILE + BCS .5 ...ERROR +*---FIGURE LOAD ADDRESS---------- +.2 SEC + LDA SC.HIMEM + SBC MISC.PARMS+2 + STA READ.WRITE.PARMS+2 + STA VAL.A + TAX + LDA SC.HIMEM+1 + SBC MISC.PARMS+3 + STA READ.WRITE.PARMS+3 + STA VAL.A+1 + TAY +*---CHECK FOR ROOM IN RAM-------- + BMI .6 ADDRESS>$7FFF MEANS NO ROOM + TXA + CMP SC.LOMEM + TYA + SBC SC.LOMEM+1 + BCC .6 ...BELOW LOMEM +*---READ FILE-------------------- + LDA MISC.PARMS+2 + STA READ.WRITE.PARMS+4 + LDA MISC.PARMS+3 + STA READ.WRITE.PARMS+5 + JSR MLI.CA READ THE FILE + BCS .5 +*---CLOSE UNLESS .INBx----------- + BIT SC.INFLAG + BVS .4 ...IT IS .INBx +.3 JSR MLI.CC CLOSE THE FILE + BCS .5 +*-------------------------------- +.4 LDX VAL.A+1 + LDY VAL.A + STX SC.PP+1 + STY SC.PP +.5 RTS +.6 LDA #$0E "PROGRAM TOO LARGE" + SEC + RTS +*-------------------------------- +* SAVE SOURCE PROGRAM ON DISK +*-------------------------------- +SAVE + BCC .1 ...FILE ALREADY HERE + LDA #$FA FILE TYPE "INT" + STA VAL.T + STA GET.SET.PARMS+4 + LDA #$C3 + STA GET.SET.PARMS+3 + LDA SC.PP START OF PROGRAM + STA CREATE.PARMS+5 + STA GET.SET.PARMS+5 + LDA SC.PP+1 + STA CREATE.PARMS+6 + STA GET.SET.PARMS+6 + JSR MAKE.A.FILE CREATE A NEW FILE + BCS .2 ...ERROR +.1 JSR ALLOCATE.UPPER.BUFFER + BCS .2 + LDA #$02 + LDX #$FA + JSR OPEN.A.FILE + BCS .2 ...ERROR +*---GET LENGTH------------------- + SEC GET LENGTH + LDA SC.HIMEM + SBC SC.PP + TAX + STA MISC.PARMS+2 + LDA SC.HIMEM+1 + SBC SC.PP+1 + TAY + STA MISC.PARMS+3 + LDA #0 + STA MISC.PARMS+4 +*---WRITE THE FILE--------------- + LDA SC.PP + STA READ.WRITE.PARMS+2 + LDA SC.PP+1 + STA READ.WRITE.PARMS+3 + STX READ.WRITE.PARMS+4 + STY READ.WRITE.PARMS+5 + JSR MLI.CB WRITE DATA ON FILE + BCS .2 ...ERROR + JSR MLI.D0 SET EOF (TRUNCATE OLD LONGER FILE) + BCS .2 ...ERROR + JSR MLI.CC CLOSE THE FILE + BCS .2 ...ERROR +*---UPDATE FILE INFO------------- + LDA SC.PP+1 + LDX SC.PP + CMP GET.SET.PARMS+6 + BNE .3 + CPX GET.SET.PARMS+5 + CLC + BNE .3 +.2 RTS +.3 STX GET.SET.PARMS+5 + STA GET.SET.PARMS+6 + LDA #0 + STA GET.SET.PARMS+10 + STA GET.SET.PARMS+11 + STA GET.SET.PARMS+12 + STA GET.SET.PARMS+13 + JMP SET.FILE.INFO +*-------------------------------- +CREATE + LDX #0 + LDY #0 AuxType = 0000 unless specified + LDA FBITS+1 + BPL .1 ...no A-value specified + LDX VAL.A use A-value for AuxType + LDY VAL.A+1 +.1 STX CREATE.PARMS+5 + STY CREATE.PARMS+6 + LDA FBITS + AND #$04 + BNE MAKE.A.FILE + LDA #$0F + STA VAL.T + +MAKE.A.FILE + LDA VAL.T + STA CREATE.PARMS+4 + LDX #$C3 + LDY #$01 SEEDLING + CMP #$0F + BNE .1 + LDY #$0D DIRECTORY +.1 STX CREATE.PARMS+3 + STY CREATE.PARMS+7 + JMP MLI.C0 CREATE +*-------------------------------- +RENAME LDA FBITS + AND #$02 PATH 2? + BEQ .1 ...NO, ERROR + JMP MLI.C2 RENAME +.1 JMP ERR.SYNTAX +*-------------------------------- +LOCK JSR GET.FILE.INFO + BCS RTS3 + LDA GET.SET.PARMS+3 + AND #$3C + ORA #$01 + BNE LKUNLK ...ALWAYS +UNLOCK JSR GET.FILE.INFO + BCS RTS3 + LDA #$C3 + ORA GET.SET.PARMS+3 +LKUNLK STA GET.SET.PARMS+3 + JMP SET.FILE.INFO +*-------------------------------- +PREFIX + LDX #0 + LDA FBITS+1 + AND #$04 + BNE .1 ...SPECIFIED S/D + LDA FBITS SEE IF SPECIFIED PATHNAME + LSR + BCC .3 ...NO, SO PRINT CURRENT PREFIX +.1 JMP MLI.C6 SET PREFIX +*---PRINT CURRENT PREFIX--------- +.2 LDA PATHNAME.ONE.BUFFER+1,X + ORA #$80 + JSR COUT + INX +.3 CPX PATHNAME.ONE.BUFFER + BCC .2 + JSR CROUT + CLC +RTS3 RTS +*-------------------------------- +NOPREFIX + LDA #0 + STA PATHNAME.ONE.BUFFER + JMP MLI.C6 SET PREFIX +*-------------------------------- +BSAVE + BCC .2 ...EXISTING FILE + LDA FBITS+1 + AND #$B0 A-EL + CMP #$90 Require A and either E or L + BCC .3 ...Neither E nor L + LDA VAL.A + STA CREATE.PARMS+5 + STA GET.SET.PARMS+5 + LDA VAL.A+1 + STA CREATE.PARMS+6 + STA GET.SET.PARMS+6 +*---T=BIN unless specified------- + LDA FBITS + AND #$04 + BNE .1 ...TYPE SPECIFIED + LDA #$06 ...NO TYPE, ASSUME BINARY + STA VAL.T +.1 LDA VAL.T + STA GET.SET.PARMS+4 +*-------------------------------- + JSR MAKE.A.FILE + BCS .4 + JSR GET.FILE.INFO + BCS .4 +.2 LDA #$02 + BNE B.COMMON ...ALWAYS + +.3 LDA #$06 "PATH NOT FOUND" + SEC +.4 RTS +*-------------------------------- +BRUN + JSR BLOAD + BCS .1 + JSR .2 + CLC +.1 RTS +.2 JMP (READ.WRITE.PARMS+2) +*-------------------------------- +BLOAD + LDA #$01 +B.COMMON + PHA + JSR ALLOCATE.UPPER.BUFFER + PLA + BCS .3 + LDX #$06 + JSR OPEN.A.FILE + BCS .3 + LDX VAL.A + LDY VAL.A+1 + LDA FBITS+1 + BMI .1 ...ADDRESS SPECIFIED + LDX GET.SET.PARMS+5 + LDY GET.SET.PARMS+6 + LDA FBITS DON'T ALLOW DEFAULT ADDRESS + AND #$04 ON NON-BINARY FILES + BEQ .0 ...T not specified, so it is BIN + LDA VAL.T T specified, better be BIN or SYS + CMP #$06 is it BIN? + BEQ .0 ...yes, use AuxType value + CMP #$FF is it SYS? + BNE .4 ...no, error + LDX #$2000 ...type SYS, assume A$2000 + LDY /$2000 +.0 LDA FBITS+1 +.1 STX READ.WRITE.PARMS+2 + STY READ.WRITE.PARMS+3 + LDX VAL.L + LDY VAL.L+1 + AND #$30 + BEQ .5 + EOR #$30 + BEQ .4 + AND #$10 + BEQ .7 + LDA VAL.E + SEC + SBC VAL.A + TAX + LDA VAL.E+1 + SBC VAL.A+1 + TAY + INX + BNE .2 + INY +.2 BCS .7 + LDA #$02 "RANGE ERROR" + SEC +.3 RTS +*-------------------------------- +.4 LDA #$0B "INVALID PARAMETER" + SEC + RTS +*-------------------------------- +.5 JSR MLI.D1 GET EOF + BCS .6 + LDX MISC.PARMS+2 + LDY MISC.PARMS+3 + LDA MISC.PARMS+4 + BEQ .7 + LDA #$0E "PROGRAM TOO LARGE" +.6 SEC + RTS +*-------------------------------- +.7 STX READ.WRITE.PARMS+4 + STY READ.WRITE.PARMS+5 + LDA FBITS+1 + AND #$40 + BEQ .10 + LDX #$02 +.8 LDA VAL.B,X + STA MISC.PARMS+2,X + DEX + BPL .8 +.9 JSR MLI.CE SET MARK + LDX COMMAND.NUMBER + BCC .10 + CMP #$02 + BNE .6 + CPX #CN.BSAVE + BNE .6 + JSR MLI.D0 SET EOF + BCC .9 + RTS +*-------------------------------- +.10 LDX COMMAND.NUMBER + CPX #CN.BSAVE + BNE .12 ...NOT BSAVE + JSR MLI.CB ...BSAVE + BCS .13 ...ERROR +.11 JMP MLI.CC +.12 JSR MLI.CA READ + BCC .11 ...GOOD, CLOSE +.13 RTS +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/sci.s.loadsave +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/SCI.S.ONLINE.txt b/SCMASM.31/SCI.S.ONLINE.txt new file mode 100644 index 00000000..f8b7d698 --- /dev/null +++ b/SCMASM.31/SCI.S.ONLINE.txt @@ -0,0 +1,75 @@ +NEW + AUTO 3,1 +*-------------------------------------- +ONLINE LDA BUFFER.BASES + STA MISC.PARMS+3 + LDA #0 + STA MISC.PARMS+2 + STA MISC.PARMS+1 + JSR MLI.C5 (Might clobber DRIVER.PTR) +*---Now display the list--------- + LDA BUFFER.BASES + STA DRIVER.PTR+1 + LDA #0 + STA DRIVER.PTR +.1 PHA + TAY + LDA (DRIVER.PTR),Y + BEQ .5 ...END OF LIST + PHA + LDA #"S" + JSR COUT + PLA + PHA + LSR ISOLATE SLOT NUMBER + LSR + LSR + LSR + AND #7 + ORA #"0" + JSR COUT PRINT SLOT NUMBER + LDA #"," + JSR COUT + LDA #"D" + JSR COUT + PLA + PHA + ASL SET CARRY IF DRIVE 2 + LDA #"1" ASSUME DRIVE 1 + ADC #0 CHANGE TO 2 IF TRUE + JSR COUT + LDA #" " PRINT SPACE + JSR COUT + PLA get dsssllll again + AND #$0F isolate length + BEQ .3 no name, show error code + TAX + LDA #"/" +.2 JSR COUT + INY PRINT THE VOLUME OR FILE NAME + LDA (DRIVER.PTR),Y + ORA #$80 + DEX + BPL .2 + LDA #"/" + BNE .4 ...ALWAYS +.3 LDA #"(" + JSR COUT + INY + LDA (DRIVER.PTR),Y GET ERROR CODE + JSR PRBYTE + LDA #")" +.4 JSR COUT + JSR CROUT +*-------------------------------- +.5 CLC POINT TO NEXT VOLUME NAME + PLA + ADC #16 + BCC .1 STILL IN SAME PAGE + CLC NO ERROR! + RTS +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/sci.s.online +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/SCI.S.OPENCLOSE.txt b/SCMASM.31/SCI.S.OPENCLOSE.txt new file mode 100644 index 00000000..5dca5d84 --- /dev/null +++ b/SCMASM.31/SCI.S.OPENCLOSE.txt @@ -0,0 +1,321 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* FOLLOWING USE "BIT" TO SKIP OVER TWO BYTES, +* SO CANNOT HAVE THE SECOND OF THE TWO =$CX. +*-------------------------------- +MLI.C0 LDA #$00 CREATE + .HS 2C +MLI.C1 LDA #$01 DESTROY + .HS 2C +MLI.C2 LDA #$02 RENAME + .HS 2C +MLI.C3 LDA #$03 SET FILE INFO + .HS 2C +MLI.C4 LDA #$04 GET FILE INFO + .HS 2C +MLI.C5 LDA #$05 ONLINE + .HS 2C +MLI.C6 LDA #$06 SET PREFIX + .HS 2C +MLI.C7 LDA #$07 GET PREFIX + .HS 2C +MLI.C8 LDA #$08 OPEN + .HS 2C +MLI.C9 LDA #$09 NEWLINE + .HS 2C +MLI.CA LDA #$0A READ + .HS 2C +MLI.CB LDA #$0B WRITE + .HS 2C +MLI.CC LDA #$0C CLOSE + .HS 2C +MLI.CD LDA #$0D FLUSH + .HS 2C +MLI.CE LDA #$0E SET MARK + .HS 2C +MLI.CF LDA #$0F GET MARK + .HS 2C +MLI.D0 LDA #$D0 SET EOF + .HS 2C +MLI.D1 LDA #$D1 GET EOF + ORA #$C0 MAKE INTO MLI CALL CODE + JMP MLI.CALLER +*-------------------------------- +GET.FILE.INFO + LDA #10 + STA GET.SET.PARMS + BNE MLI.C4 GET FILE INFO +*-------------------------------- +SET.FILE.INFO + LDA #7 + STA GET.SET.PARMS + BNE MLI.C3 SET FILE INFO +*-------------------------------- +BYE + JSR CLOSE.ALL.FILES + JSR CLOSE.EXEC.FILE + JSR GP.MLI + .DA #$65,READ.WRITE.PARMS +*-------------------------------- +OPEN.A.FILE + PHA + LDA FBITS + AND #$04 + BEQ .1 + LDX VAL.T +.1 PLA + +OPEN.DIRECTORY + CPX GET.SET.PARMS+4 + BNE TYPERR + AND GET.SET.PARMS+3 + BEQ .3 + LDA ALLOCATED.BUFFER.PAGE + STA OPEN.PARMS+4 + LDA #$0F + STA LEVEL + JSR MLI.C8 OPEN + BCS .1 + LDA OPEN.PARMS+5 + STA READ.WRITE.PARMS+1 + STA CLOSE.FLUSH.PARMS+1 + STA MISC.PARMS+1 +.1 RTS +*-------------------------------- +.3 LDA #$0A "FILE LOCKED" + SEC + RTS +*-------------------------------- +VERIFY + LDA #$06 "PATH NOT FOUND" + RTS ALREADY .CS. IF ERROR +*-------------------------------- +TYPERR LDA #$0D + SEC + RTS +*-------------------------------- +* OPEN -- ONLY USED BY SCASM FOR OPENING +* .TF AND "TEXT" FILES +* THE FILES MAY BE TXT OR BIN FILE TYPE +*-------------------------------- +OPEN + PHP + JSR GET.REFNUM.OF.OPEN.FILE + BCC .9 ...ALREADY OPEN, ERROR + PLP ...GET SAVED STATUS + BCC .3 ...FILE ALREADY EXISTS +*---MAKE A NEW FILE-------------- + LDA FBITS WAS T SPECIFIED? + AND #$04 + BEQ .1 ...NO + LDA VAL.T WHAT WAS SPEC? + BCS .2 ...always, use spec'd type +.1 LDA #$06 ...new file, type not spec'd, T=BIN + BIT PASS $FF if command level, 0 or 1 if assembling + BPL .4 ...assembling, make BIN file + LDA #$04 ...command, make TXT file +.4 STA VAL.T +.2 STA GET.SET.PARMS+4 + LDA #$C3 FULL ACCESS PRIVILEGES + STA GET.SET.PARMS+3 + LDA #0 RECORD LENGTH = 0000 + STA CREATE.PARMS+5 + STA CREATE.PARMS+6 + STA GET.SET.PARMS+5 + STA GET.SET.PARMS+6 + JSR MAKE.A.FILE CREATE THE FILE + BCS .8 ...ERROR +*---NOW THE FILE EXISTS---------- +*---OPEN THE FILE---------------- +.3 JSR ALLOCATE.LOWER.BUFFER + STA OPEN.PARMS+4 STARTING PAGE OF BUFFER + LDA #$07 LEVEL # + STA LEVEL + JSR MLI.C8 OPEN + BCS .8 ...ERROR +*---SAVE NAME, ETC OF OPEN FILE-- + LDA OPEN.PARMS+4 MARK THE BUFFER IN USE + STA FILE.BUFFER.PNTRS,X + LDA OPEN.PARMS+5 REFNUM + STA FILE.REFNUMS,X + JSR SAVE.FILENAME.IN.TABLE + CLC +.8 RTS +*-------------------------------- +.9 PLP + JMP ERR.FILE.BUSY +*-------------------------------- +SAVE.FILENAME.IN.TABLE + TXA + ASL INDEX TIMES 32 + ASL + ASL + ASL + ASL + TAX +*---FORM NAME LENGTH BYTE-------- + LDA PATHNAME.TWO.BUFFER + STA OPEN.FILE.NAME.BUFFERS,X + TAY SAVE ACTUAL LENGTH + CMP #30 ONLY ROOM FOR 29 CHARS + BCC .1 ...'TWILL FIT + LDA #29 USE LAST 29 CHARS +.1 STA FNLEN + LDA VAL.L + STA OPEN.FILE.NAME.BUFFERS+1,X + LDA VAL.L+1 + STA OPEN.FILE.NAME.BUFFERS+2,X +.2 INX + LDA PATHNAME.TWO.BUFFER,Y + STA OPEN.FILE.NAME.BUFFERS+2,X + DEY + DEC FNLEN + BNE .2 + CLC + RTS +*-------------------------------- +* SEARCH OPEN FILE NAME TABLE +* RETURN .CS., A=ERRCOD IF NO PATHNAME +* OR IF NOT IN TABLE +* RETURN .CC., A=REFNUM IF FOUND IN TABLE +*-------------------------------- +GET.REFNUM.OF.OPEN.FILE + LDA FBITS WAS PATHNAME GIVEN? + LSR + BCS .1 ...YES + JMP ERR.SYNTAX ...NO, "SYNTAX ERROR" +*---CHECK AMONG NON-EXEC FILES--- +.1 LDX #1 MAX # OF FILES IS 2 + STX EXEC.FILE.CLOSING.FLAG +.2 LDA FILE.BUFFER.PNTRS,X SEE IF IN USE + BEQ .3 NO + JSR COMPARE.TO.FILE.NAME.BUFFER + BCC .5 ...FOUND IT +.3 DEX + BPL .2 +*---CHECK EXEC FILE-------------- + BIT F.EXEC IS EXEC ON? + BPL .4 ...NO, FILE NOT OPEN + LDX #2 ...YES + JSR COMPARE.TO.FILE.NAME.BUFFER + BCS .4 ...NOT THIS ONE EITHER + LDA #$FF + STA EXEC.FILE.CLOSING.FLAG + LDA EXEC.REFNUM + RTS RETURN .CC. +.4 LDA #$12 "FILE NOT OPEN" + SEC + RTS RETURN .CS. +.5 LDA FILE.REFNUMS,X + RTS RETURN .CC. +*-------------------------------- +* COMPARE NAMES +* RETURN .CC. IF SAME, ELSE .CS. +*-------------------------------- +COMPARE.TO.FILE.NAME.BUFFER + TXA + PHA SAVE X-REGISTER + ASL INDEX TIMES 32 + ASL + ASL + ASL + ASL + TAX + LDA OPEN.FILE.NAME.BUFFERS,X + CMP PATHNAME.TWO.BUFFER + BNE .3 ...DIFFERENT LENGTHS + TAY POINT TO END OF PATHNAME + CMP #30 CHOP AT 29 + BCC .1 + LDA #29 +.1 STA FNLEN + LDA OPEN.FILE.NAME.BUFFERS+1,X + STA RECORD.LENGTH + LDA OPEN.FILE.NAME.BUFFERS+2,X + STA RECORD.LENGTH+1 +.2 INX + LDA PATHNAME.TWO.BUFFER,Y + CMP OPEN.FILE.NAME.BUFFERS+2,X + BNE .3 NOT THE SAME NAME + DEY + DEC FNLEN + BNE .2 MORE TO THE NAME + CLC SIGNAL SAME NAMES + .HS B0 "BCS" OPCODE, SKIPS OVER "SEC" +.3 SEC SIGNAL DIFFERENT NAMES + PLA RESTORE X-REG + TAX + RTS +*-------------------------------- +CLOSE + LDA FBITS + LSR ANY PATHNAME GIVEN? + BCC CLOSE.ALL.FILES ...NO + JSR GET.REFNUM.OF.OPEN.FILE + BCC CLOSE.ONE.FILE ...OPEN, SO CLOSE IT + CLC ...NOT OPEN, SO FINISHED + RTS +*-------------------------------- +* CLOSE A FILE ... REFNUM IN A-REG +* INDEX IN X-REG +*-------------------------------- +CLOSE.ONE.FILE + STA CLOSE.FLUSH.PARMS+1 REFNUM + LDA #0 + STA LEVEL LEVEL 0 + JSR MLI.CC CLOSE + BCS RTS2 ...ERROR + LDA #0 + BIT EXEC.FILE.CLOSING.FLAG + BPL .1 + STA F.EXEC + STA EXEC.FILE.CLOSING.FLAG + RTS +.1 STA FILE.BUFFER.PNTRS,X + LDA CLOSE.FLUSH.PARMS+1 + EOR WRITE.REFNUM TEST .EQ., LEAVE CARRY CLEAR + BNE RTS2 ...NOT SAME AS "WRITE" FILE +*-------------------------------- +UNHOOK.WRITE + BIT F.WRITE + BPL RTS2 + LDA VDOSIO + STA CSWL + LDA VDOSIO+1 + STA CSWH + LDA #0 + STA F.WRITE +RTS2 RTS +*-------------------------------- +CLOSE.ALL.FILES + LDX #1 MAX FILES IS 2 +.1 LDA FILE.BUFFER.PNTRS,X + BEQ .2 NOT IN USE + LDA FILE.REFNUMS,X + JSR CLOSE.ONE.FILE + BCS RTS2 +.2 DEX + BPL .1 + INX X=0 + STX CLOSE.FLUSH.PARMS+1 + LDA #$07 + STA LEVEL + JMP MLI.CC CLOSE +*-------------------------------- +* ALLOCATE UPPER/LOWER BUFFER +*-------------------------------- +ALLOCATE.UPPER.BUFFER + LDX #1 + .HS 2C +ALLOCATE.LOWER.BUFFER + LDX #0 +.2 LDA BUFFER.BASES,X + STA ALLOCATED.BUFFER.PAGE + CLC + RTS +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/sci.s.openclose +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/SCI.S.PRIN.txt b/SCMASM.31/SCI.S.PRIN.txt new file mode 100644 index 00000000..3000003f --- /dev/null +++ b/SCMASM.31/SCI.S.PRIN.txt @@ -0,0 +1,87 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* PR#slot copy address from OUTVEC,slot to CSW +* PR#Aaddr copy Aaddress into CSW +* PR#slot,Aaddr copy Aaddress into OUTVEC,slot +* +* IN#slot copy address from INVEC,slot to KSW +* IN#Aaddr copy Aaddress into KSW +* IN#slot,Aaddr copy Aaddress into INVEC,slot +*-------------------------------- +PR LDA #0 + .HS 2C SKIP NEXT LINE +IN LDA #2 + PHA SAVE 0 OR 2 + ASL + ASL 00 OR 08 + ORA VAL.LB +SLOT + ASL *2 + TAX + BIT FBITS WAS SLOT PARAMETER GIVEN? + BVC .1 ...NO + LDA FBITS+1 ...YES, WAS A$ PARM ALSO? + BMI .2 ...YES, SO UPDATE TABLE + TXA Check for "PR#0" + BEQ .4 ...yes, so call MON.SETVID directly + LDA OUTVEC,X ...NO, ONLY SLOT + STA VAL.A SO GET VALUE FROM TABLE + LDA OUTVEC+1,X + STA VAL.A+1 +.1 JSR CHECK.IO.DRIVER + BCS .3 ...NOT VALID DRIVER + PLA POP SAVED 0 OR 2 + TAX + LDA VAL.A INSTALL HOOK FOR DRIVER + STA CSWL,X + LDA VAL.A+1 + STA CSWH,X + RTS +*---ENTER NEW VALUE IN TABLE----- +.2 JSR CHECK.IO.DRIVER + BCS .3 ...ERROR + PLA POP OFF SAVED 0 OR 2 + LDA VAL.A+1 UPDATE TABLE + STA OUTVEC+1,X + LDA VAL.A + STA OUTVEC,X + RTS +.3 PLA POP OFF SAVED 0 OR 2 + LDA #$03 "NO DEVICE CONNECTED" + RTS +*-------------------------------- +.4 PLA POP OFF SAVED 0 OR 2 + JSR MON.SETVID + CLC + RTS +*-------------------------------- +CHECK.IO.DRIVER + LDA VAL.A GET DRIVER ADDRESS INTO PNTR + STA DRIVER.PTR + LDA VAL.A+1 + STA DRIVER.PTR+1 + LDY #0 + CMP #$C0 IS IT IN ROM AREA? + BCC .3 ...NO + LDA IO.OFF ...YES, TURN OFF $C800 SPACE + STY RETRY.COUNT + LDA (DRIVER.PTR),Y CHECK FOR ROM PRESENT + CMP #$FF + BEQ .4 ...NOT VALID ROM VALUE +.1 CMP (DRIVER.PTR),Y BETTER NOT CHANGE... + BNE .4 ...WOOPS, NOT ROM + DEC RETRY.COUNT TRY IT 256 TIMES + BNE .1 ...AGAIN +.2 CLC ...REALLY A DRIVER + RTS +*---VERIFY RAM-BASED DRIVER------ +.3 LDA (DRIVER.PTR),Y GET FIRST BYTE + CMP #$D8 "CLD" OPCODE? + BEQ .2 ...YES, VALID DRIVER +.4 SEC + RTS +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/sci.s.prin +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/SCI.S.RWPA.txt b/SCMASM.31/SCI.S.RWPA.txt new file mode 100644 index 00000000..ffb9a320 --- /dev/null +++ b/SCMASM.31/SCI.S.RWPA.txt @@ -0,0 +1,65 @@ +NEW + AUTO 3,1 +*-------------------------------------- +WRITE + JSR GET.REFNUM.OF.OPEN.FILE + BCS .1 ...NOT OPEN + STA WRITE.REFNUM + LDA CSWL + STA VDOSIO + LDA CSWH + STA VDOSIO+1 + LDA #WRITE.TEXT.FILE + STA CSWL + LDA /WRITE.TEXT.FILE + STA CSWH + LDA #$FF + STA F.WRITE +.1 RTS +*-------------------------------- +* OUTPUT HOOK DURING A WRITE OPERATION +*-------------------------------- +WRITE.TEXT.FILE + AND #$7F PRODOS STANDARD IS BIT7=0 + STA WRITE.OUTPUT.CHAR + JSR SAVE.REGS + LDX WRITE.REFNUM + STX READ.WRITE.PARMS+1 + ASL IGNORE BIT 7 + BEQ .2 END OF FILE + LDA #WRITE.OUTPUT.CHAR + STA READ.WRITE.PARMS+2 + LDA /WRITE.OUTPUT.CHAR + STA READ.WRITE.PARMS+3 + LDA #1 + STA READ.WRITE.PARMS+4 + LDA #0 + STA READ.WRITE.PARMS+5 + JSR MLI.CB WRITE + BCC RESTORE.REGS +*-------------------------------- +.1 JMP ERROR.HANDLER +*-------------------------------- +.2 STX MISC.PARMS+1 + JSR MLI.CF READ MARK + BCS .1 + JSR MLI.D0 SET EOF + BCS .1 ...ERROR +*---fall into RESTORE.REGS------- +*-------------------------------- +RESTORE.REGS + LDY PREGY + LDX PREGX + LDA PREGA + RTS +*-------------------------------- +SAVE.REGS + STA PREGA + STX PREGX + STY PREGY + RTS +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/sci.s.rwpa +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/SCI.S.TABLES.txt b/SCMASM.31/SCI.S.TABLES.txt new file mode 100644 index 00000000..f8ce0fd0 --- /dev/null +++ b/SCMASM.31/SCI.S.TABLES.txt @@ -0,0 +1,180 @@ +NEW + AUTO 3,1 +*-------------------------------------- +CN. .SE 1 + .MA CMD +CN. .SE CN.+1 +CN.]2 .EQ CN. + .AT /]2]3/ + .DA ]2 + .HS ]1 + .EM +*-------------------------------- +COMMAND.TABLE + .AT /-/ + .DA DASH + .HS 0104 + >CMD 05F4,BLOAD + >CMD 01F4,BRUN + >CMD 0DF4,BSAVE + >CMD 0000,BYE + >CMD 9504,CATALOG + >CMD 9504,CAT + >CMD 0100,CLOSE + >CMD 0D84,CREATE + +* >CMD 0104,DELETE + +CN. .SE CN.+1 +CN.DELETE .EQ CN. + .AT /DELETE/ + .DA MLI.C1 + .HS 0104 + + >CMD 0107,EXEC + >CMD 4080,IN,# + >CMD 0504,LOAD + >CMD 0104,LOCK + >CMD 0000,NOPREFIX + >CMD 0000,NOW + >CMD 0000,ONLINE + >CMD 2D14,OPEN + >CMD 4080,PR,# + >CMD 9104,PREFIX + >CMD 0304,RENAME + >CMD 0D04,SAVE + >CMD 0104,UNLOCK + >CMD 1104,VERIFY + >CMD 2147,WRITE + .HS 00 +*-------------------------------- +* PARAMETER NAME TABLE +*-------------------------------- +PARM.NAMES + .AS /ABELSDFRV/ +NO.PARM.NAMES .EQ *-PARM.NAMES +*-------------------------------- +* BIT MASK FOR PARAMETERS IN PERMISSION BITS +*-------------------------------- +* A B E L S D F R V @ +PARM.MASKS + .HS 80.40.20.10.04.04.02.01.00 +*-------------------------------- +* XXXXXXYY where yy+1= # of bytes +* xxxxxx= offset from VAL.A +* of last byte +*-------------------------------- + .MA PAR + .DA #VAL.]1-VAL.A+]2-1*4+]2-1 + .EM +*-------------------------------- +PARM.VARIABLES + >PAR A,2 + >PAR B,3 + >PAR E,2 + >PAR L,2 + >PAR S,1 + >PAR D,1 + >PAR F,2 + >PAR R,2 + >PAR V,1 +*-------------------------------- +* FILE TYPE CODES +*-------------------------------- + .MA FT + .AS -/]1/ + .HS ]2 + .EM +*-------------------------------- +FILE.TYPES + >FT TXT,04 + >FT BIN,06 + >FT DIR,0F + >FT ADB,19 + >FT AWP,1A + >FT ASP,1B + >FT PAS,EF + >FT CMD,F0 + >FT S-C,FA (NORMALLY "INT") + >FT IVR,FB + >FT BAS,FC + >FT VAR,FD + >FT REL,FE + >FT SYS,FF +LAST.FILE.TYPE .EQ *-FILE.TYPES-1 +*-------------------------------- +* NAMES OF THE MONTHS +*-------------------------------- +MONTH.NAMES + .AS -/JFMAMJJASOND/ + .AS -/AEAPAUUUECOE/ + .AS -/NBRRYNLGPTVC/ +*-------------------------------- +NO.DATE.MSG + .AS -// +*-------------------------------- +* MLI ERROR CODES +*-------------------------------- +MLI.ERROR.CODES + .HS 282B4041424344454647 + .HS 48494B4C4D4E505356 +*-------------------------------- +* EQUIVALENT BI ERROR CODES +*-------------------------------- +BI.ERROR.CODES + .HS 0304100C0C1206068613 (86 IS A TRICK) + .HS 09110D05020A140B0C08 +*-------------------------------- +SCI.MESSAGES + .AC 0 INIT NYBBLE.FLAG + .AC 1"ACDEFILNOPRST %" + .AC 2"BGHKMUVWXY/():." + .AC 3"QZ-4567890123@&" +Q.BLOCKS.ABOVE .EQ 0 + .AC / BLOCKS SHOWN ABOVE:6%/ +*-------------------------------- +Q.DIRHDR .EQ 1 + .AC /TYPE NAME2BLOCKS MODIFIED9CREATED9ENDFILE AUXTYPE%/ +*-------------------------------- + .AC /RANGE ERROR%/ + .AC /NO DEVICE CONNECTED%/ + .AC /WRITE PROTECTED%/ + .AC /END OF DATA%/ + .AC /PATH NOT FOUND%/ +*-------------------------------- +Q.BLOCKS .EQ 7 + .AC / VOLUME BLOCKS USED:8FREE:8TOTAL:5%/ +*-------------------------------- + .AC "I/O ERROR%" + .AC /DISK FULL%/ + .AC /FILE LOCKED%/ + .AC /INVALID PARAMETER%/ + .AC /NO BUFFERS AVAILABLE%/ + .AC /FILE TYPE MISMATCH%/ + .AC /PROGRAM TOO LARGE%/ + .AC /NOT DIRECT COMMAND%/ + .AC /SYNTAX ERROR%/ + .AC /DIRECTORY FULL%/ + .AC /FILE NOT OPEN%/ + .AC /DUPLICATE FILE NAME%/ + .AC /FILE BUSY%/ + .AC /FILE(S) STILL OPEN%/ +*-------------------------------- + .AC "%" +*ZZ.MESSAGES .EQ *-MESSAGES +*-------------------------------- +SCI.FIRST.TABLE .EQ * + .HS 00 + .AS -"ACDEFILNOPRST " + .HS 8D +SCI.SECOND.TABLE .EQ * + .HS 00 + .AS -"BGHKMUVWXY/():." +SCI.THIRD.TABLE .EQ * + .AS -"JQZ-" + .HS 05.06.07.08.09.0A.0B.0C.0D.0E.0F.10 (BLANK COUNTS+1) +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/sci.s.tables +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/SCI.S.VARS.txt b/SCMASM.31/SCI.S.VARS.txt new file mode 100644 index 00000000..e156de41 --- /dev/null +++ b/SCMASM.31/SCI.S.VARS.txt @@ -0,0 +1,53 @@ +NEW + AUTO 3,1 +*-------------------------------------- +ALLOCATED.BUFFER.PAGE .BS 1 +*-------------------------------- +FNLEN .BS 1 +RECORD.LENGTH .BS 2 +PARM.LENM1 .BS 1 +PARM.OFFSET .BS 1 +ACCUM .BS 3 +OVERFLOW .BS 1 +COMMAND.ADDR .BS 2 +BLOCKS .BS 2 +*-------------------------------- +MONTH .BS 1 +DAY .BS 1 +YEAR .BS 1 +*-------------------------------- +CAT.WIDTH .BS 1 +ENTRY.LENGTH .BS 1 +ENTRIES.PER.BLOCK .BS 1 +FILE.COUNT .BS 2 +ENTRY.COUNTER .BS 1 +*-------------------------------- +CAT.INDEX .BS 1 +*-------------------------------- +FILE.REFNUMS .BS 2 +FILE.BUFFER.PNTRS .BS 2 +*-------------------------------- +EXEC.REFNUM .BS 1 +EXEC.INPUT.CHAR .BS 1 +*-------------------------------- +WRITE.REFNUM .BS 1 +WRITE.OUTPUT.CHAR .BS 1 +*-------------------------------- +PATHNAME.ONE.BUFFER .BS 1 +TXTBUF .BS 65 +*-------------------------------- +* OPEN FILE NAME BUFFERS +* 3 BUFFERS, 32 BYTES EACH +* 0 -- # BYTES IN FILE NAME (bits (6-0) +* Bit 7 = DIR file READ flag +* 1 -- L value lsb +* 2 -- L value msb +* 3-31 -- file name, backwards +*-------------------------------- +OPEN.FILE.NAME.BUFFERS + .BS 32*3 +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/sci.s.vars +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/SCMASM.S.ACDIR.txt b/SCMASM.31/SCMASM.S.ACDIR.txt new file mode 100644 index 00000000..0d575471 --- /dev/null +++ b/SCMASM.31/SCMASM.S.ACDIR.txt @@ -0,0 +1,103 @@ +NEW + AUTO 3,1 +*-------------------------------------- +TABLE1 .EQ $BE00-48 +TABLE2 .EQ $BE00-32 +TABLE3 .EQ $BE00-16 +*-------------------------------- +DIR.AC + JSR GNNB GET NEXT NON-BLANK FOR DELIMITER + BCS .8 ...ERROR + STA DLIM IN CASE IT IS A DELIMITER + EOR #'0' + BEQ .9 ...INITIAL STRING + CMP #4 + BCC .10 +*---GET NEXT CHAR OF STRING------ +.2 JSR GNC GET NEXT CHAR TO ENCODE + BCS .8 ...ERROR + CMP DLIM + BEQ .7 ...END OF STRING +*---SEARCH TABLE 1--------------- + LDY #15 +.3 CMP TABLE1,Y + BEQ .6 ...FOUND IT + DEY + BNE .3 +*---SEARCH TABLE 2--------------- + JSR OUTPUT.NYBBLE.Y + LDY #15 +.4 CMP TABLE2,Y + BEQ .6 ...FOUND IT + DEY + BNE .4 +*---SEARCH TABLE 3--------------- + JSR OUTPUT.NYBBLE.Y + LDY #15 +.5 CMP TABLE3,Y + BEQ .6 ...FOUND IT + DEY + BNE .5 +*---NOT IN ANY TABLE------------- + JSR OUTPUT.NYBBLE.Y + PHA + LSR + LSR + LSR + LSR + TAY + JSR OUTPUT.NYBBLE.Y + PLA + AND #$0F + TAY +*---OUTPUT TABLE INDEX----------- +.6 JSR OUTPUT.NYBBLE.Y +*---NEXT CHAR-------------------- + JMP .2 +*---END OF STRING---------------- +.9 STA NYBBLE.FLAG +.7 RTS +*---ERROR------------------------ +.8 JMP ERBA +*---READ NEW CODING TABLES------- +.10 SBC #0 CHANGE TO 0,1,2 + ASL *16 + ASL + ASL + ASL + TAX + JSR GNC + BCS .7 ...NO STRING + STA DLIM +.11 JSR GNC ...ALLOW LOWER CASE + BCS .8 ...ERROR + CMP DLIM + BEQ .7 ...END OF STRING + INX + CPX #48 + BCS .8 ...GONE TOO FAR + STA TABLE1,X + BCC .11 ...ALWAYS +*-------------------------------- +OUTPUT.NYBBLE.Y + PHA SAVE A-REG + TYA + LSR NYBBLE.FLAG + BCS .1 ...IT WAS = $01 + ASL ...IT WAS = $00 + ASL + ASL + ASL + STA BYTE + INC NYBBLE.FLAG + PLA + RTS +.1 ORA BYTE + JSR EMIT + PLA + RTS +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/scmasm.s.acdir +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/SCMASM.S.ASMGEN.txt b/SCMASM.31/SCMASM.S.ASMGEN.txt new file mode 100644 index 00000000..c522204a --- /dev/null +++ b/SCMASM.31/SCMASM.S.ASMGEN.txt @@ -0,0 +1,369 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* ASSEMBLER MAIN DRIVER +*-------------------------------- +ASM +* LDX #0 X=0 FROM COMMAND DISPATCHER + STX PASS SET TO PASS 1 + STX ERROR.COUNT + STX ERROR.COUNT+1 +* STX MACRO.LEVEL ALREADY DONE IN GNL +* STX PARAM.PNTR ALREADY DONE IN GNL +* STX PAGE.LENGTH ALREADY DONE IN GNL + STX PAGE.NUMBER + STX PAGE.NUMBER+1 + JSR STINIT INITIALIZE SYMBOL TABLE + JSR RESTORE IF IN INCLUDE, RESTORE +*-------------------------------- +* PERFORM NEXT PASS OF ASSEMBLY +*-------------------------------- +ASM1 LDA ERROR.COUNT + ORA ERROR.COUNT+1 + BEQ .1 + JMP ASM.END PRINT # ERRORS AND ABORT ASSEMBLY +.1 LDX #1 INIT 2-BYTE VARIABLES +.2 LDA PP,X POINT TO BEGINNING OF SOURCE PROGRAM + STA SRCP,X + STA MACSTK,X + LDA #0 + STA CALL.CNTR,X TOTAL # MACRO CALLS + STA CALL.NUM,X CURRENT MACRO CALL # + STA ORGN+2,X HIGH 16 OF ORIGIN + DEX + BPL .2 +*---Following = $FF-------------- + STX DO.STACK SET OUTER LEVEL TRUE (=$FF) + STX LF.CONDITIONAL do not list false sets (=$FF) +*---Following = $00-------------- + STA DUMMY.FLAG NOT IN DUMMY SECTION + STA PHASE.FLAG NOT IN PHASE + STA DO.INDEX SET DO.STACK TO EMPTY + STA LF.ALL turn on main listing + STA LF.MACRO list macro expansions too + STA LF.XTRA.BYTES list all bytes, use extra lines + STA TF.FLAG not in ".TF" + STA DO.SKIP.CNT not in ".DO" + STA FLAG.MA not in ".MA" + STA NYBBLE.FLAG .AC odd/even + STA ORGN ORIGIN = $0800 + STA TRGT TARGET = $0800 +*---Following = $08-------------- + LDA #$08 + STA ORGN+1 + STA TRGT+1 + JSR ASM.INIT Initialize for particular assembler +*-------------------------------- +* MOVE NEXT LINE INTO WORKING BUFFER +*-------------------------------- +ASM2 LDA $C000 CHECK FOR ABORT WITHOUT + CMP #CHR.RETURN CLEARING STROBE + BNE .1 + JMP JMP.SOFT YES, STOP RIGHT NOW +.1 LDX #$FF INITIALIZE STACK POINTER + TXS + INX MAKE X=0 + STX EMIT.COLUMN + STX EXP.UNDEF CLEAR UNDEFINED FLAG + JSR SETUP.NEXT.LINE + BCC .2 GOT A LINE + JMP ENDM NO MORE LINES, ACT LIKE .EN FOUND +*---CHECK CURRENT CONDITION------ +.2 LDA DO.STACK CURRENT LEVEL IN SIGN BIT + BMI ASSEMBLE.ONE.LINE TRUE, SO ASSEMBLE +*-------------------------------- +* SKIP TO .FIN OR .ELSE +*-------------------------------- +SKIP.TO.FIN + JSR SCAN.TO.OPCODE + BCS .3 + LDX #DIR.QT.DO + JSR DIR.SCAN.OR.FAIL + BCC .1 NOT .DO + INC DO.SKIP.CNT .DO + BNE .3 ...ALWAYS +.1 LDY DO.SKIP.CNT + BNE .2 INSIDE A NESTED .DO, IGNORE .ELSE'S + JSR DIR.SCAN.OR.FAIL + BCS ASSEMBLE.ONE.LINE FOUND .ELSE +.2 LDX #DIR.QT.FI + JSR DIR.SCAN.OR.FAIL + BCC .3 NOT .FIN + LDY DO.SKIP.CNT .FIN, SEE IF NESTED ONE + BEQ ASSEMBLE.ONE.LINE NO, ASSEMBLE THIS .FIN + DEC DO.SKIP.CNT YES, POP OFF THIS NEST +.3 BIT LF.CONDITIONAL LIST CONDITIONAL LINES? + BMI ASM2 NO, SKIP IT + JSR CRLF.IF.LISTING YES, NEW LINE + JMP CMNT AND LIST IT +*-------------------------------- +* ANALYZE SOURCE LINE +*-------------------------------- +ASSEMBLE.ONE.LINE + JSR CRLF.IF.LISTING + JSR PACK.MACRO.LINE + BCS CMNT ...only list if MACRO definition line + JSR GNC.UC.START not MACRO line, get first char + BCS CMNT ...empty line + BEQ .3 ...blank, so no label + JSR CHECK.COMMENT.CHAR + BEQ CMNT ...comment (* or ;) + JSR LABL PROCESS LABEL DEFINITION +.3 JSR GNNB Scan to opcode field + BCS CMNT ...none, only label on this line + JSR CHECK.COMMENT.CHAR might be a comment with no opcode + BEQ CMNT ...yes, there is a comment + CMP #'> CHECK IF MACRO OPCODE + BEQ .4 ...YES + CMP #'_ CHECK IF MACRO OPCODE + BEQ .4 ...YES + CMP #'=' + BEQ .5 '=' is synonym for .EQ + STA SEARCH.KEY FIRST OPCODE CHAR + JSR GNC.UC + STA SEARCH.KEY+1 2ND OPCODE CHAR + JSR GNC.UC + STA SEARCH.KEY+2 3RD OPCODE CHAR + LDA SEARCH.KEY + CMP #'. IS IT A DIRECTIVE? + BNE .6 NO, TRY NORMAL OPCODES + LDA #OPTBL.DIR + LDY /OPTBL.DIR + CLC INITIAL SEARCH + JSR SEARCH.COMPRESSED.TABLE + BCC OPER ...NOT FOUND IN TABLE + JSR PERFORM.DIRECTIVE + JMP CMNT +.4 JMP MACRO.CALL +.5 JSR PSEQ "=" is synonym for .EQ + JMP CMNT +.6 JSR ASM.PARTICULAR +*-------------------------------- +CMNT LDA EXP.UNDEF + BPL .1 NO UNDEFINED EXPRESSIONS ON THIS LINE + LDA PASS + BEQ .1 IF WE GOT THIS FAR, OKAY IN PASS 1 + JMP UNDF +.1 JSR LIST.SOURCE.IF.LISTING + JMP ASM2 NEXT LINE +*-------------------------------- +*-------------------------------- +PERFORM.DIRECTIVE + INY POINT AT HIGH BYTE OF ADDRESS + LDA (OPTBL.PNTR),Y + PHA + DEY + LDA (OPTBL.PNTR),Y + PHA + RTS +*-------------------------------- +OPER LDY #QER2 ERROR--BAD OPCODE + JMP SOFT.ERROR +*-------------------------------- +* EMIT ONE BYTE OF OBJECT CODE +* +* IF IN PASS TWO THEN +* ! IF LISTING THEN +* ! IF IN ".TF" THEN +* ! ! +* ! ELSE IF NOT IN DUMMY SECTION THEN +* ! ! ! IF IN PROTECTED AREA THEN +* ! ! ! ! +* ! ! ! ELSE +* INCREMENT ORIGIN AND ORIGIN.SAVE +* IF NOT IN DUMMY SECTION THEN INCREMENT TARGET +*-------------------------------- +EMIT.ZERO + LDA #0 +EMIT LDY PASS CHECK WHICH PASS + BEQ .5 PASS 1, JUST INCREMENT LOCATION + STA OBJ.BYTE SAVE OBJECT BYTE +*---LIST THE BYTE---------------- + JSR P.EMITTED.BYTE +*---STORE THE BYTE--------------- + BIT DUMMY.FLAG No output inside dummy section + BMI .6 ...only increment the origin + LDA OBJ.BYTE GET OUTPUT BYTE + BIT TF.FLAG SEE IF IN ".TF" + BMI .4 YES + JSR USER.OBJECT.BYTE + JMP .5 ...ALWAYS +.4 JSR DOUT WRITE ON TARGET FILE +*---INCREMENT LOCATION----------- +.5 LDA DUMMY.FLAG IF IN DUMMY SECTION, + BMI .6 THEN ONLY INCREMENT ORGN + >INCD TRGT BUMP TARGET ADDRESS + >INCD ORIGIN.SAVE AND ORIGIN OUTSIDE .PH +.6 >INCD ORGN BUMP CURRENT ORIGIN + RTS +*-------------------------------- +STORE.OBJECT.BYTE + LDA TRGT+1 TARGET PAGE + BNE .1 NOT PAGE ZERO + LDA TRGT ALLOW $00-$1E + CMP #$1F + BCC .4 SAFE + BCS .3 NOT SAFE +*---ALLOW $300-$3CF-------------- +.1 CMP #$03 IN PAGE 3? + BNE .2 NO + LDA TRGT BELOW $3D0? + CMP #$D0 + BCC .4 YES, SAFE + BCS .3 NO, NOT SAFE + .DO AUXMEM +*---ALLOW $800-MACSTK------------ +.2 CMP #$08 BELOW PAGE 8? + BCC .3 YES, NOT SAFE + LDA TRGT + CMP MACSTK + LDA TRGT+1 + SBC MACSTK+1 + BCC .4 BELOW MACSTK, SAFE + .ELSE +*---ALLOW $800-MACLBL------------ +.2 CMP #$08 BELOW PAGE 8? + BCC .3 YES, NOT SAFE + LDA TRGT NO, COMPARE TO MACLBL + CMP MACLBL + LDA TRGT+1 + SBC MACLBL+1 + BCC .4 BELOW MACLBL, SO SAFE +*---ALLOW EOT-MACSTK------------- + LDA EOT + CMP TRGT + LDA EOT+1 + SBC TRGT+1 + BCS .3 BELOW EOT, NOT SAFE + LDA TRGT + CMP MACSTK + LDA TRGT+1 + SBC MACSTK+1 + BCC .4 BELOW MACSTK, SAFE + .FIN +*---NOT SAFE, CHECK USER RANGE--- +.3 LDA TRGT + CMP USER.MEM.LO + LDA TRGT+1 + SBC USER.MEM.LO+1 + BCC .5 DEFINITELY OUT OF BOUNDS + LDA USER.MEM.HI + CMP TRGT + LDA USER.MEM.HI+1 + SBC TRGT+1 + BCC .5 DEFINITELY OUT OF BOUNDS +.4 LDY #0 + LDA OBJ.BYTE + STA (TRGT),Y + RTS +.5 LDY #QMEMPRO + JMP FIRM.ERROR +*-------------------------------- +* LIST SOURCE LINE +*-------------------------------- +LIST.SOURCE.IF.LISTING + JSR CHECK.IF.LISTING +LIST.SOURCE.REGARDLESS + JSR P.MARGIN PRINT BLANKS TILL MARGIN +LIST.SOURCE.AT.MARGIN + JSR CONVERT.LINE.NUMBER.PRINT + LDY MACRO.LEVEL + BEQ .2 + LDA #'>' +.1 JSR CHO + DEY + BNE .1 ...UNTIL Y=0 +.2 LDA #' ' ...NOW Y=0 +.3 JSR CHO + INY + LDA WBUF-1,Y + BNE .3 + RTS +*-------------------------------- +* PRINT CRLF IF IN PASS 2 AND IF LISTING IS ON +*-------------------------------- +CRLF.CAUSED.FORM.FEED + JSR FORM.FEED +CRLF.IF.LISTING + JSR CHECK.IF.LISTING +CRLF.WITH.PAGING + JSR CRLF + INC LINE.COUNT + LDA PAGE.LENGTH + BEQ .1 ...NOT TITLING + CMP LINE.COUNT + BCC CRLF.CAUSED.FORM.FEED ...END OF PAGE +.1 RTS +*-------------------------------- +* PROCESS LABEL DEFINITION +*-------------------------------- +LABL JSR PACK PACK AND CHECK SYMBOL + BCC ERR.BS BAD SYMBOL + JSR STSRCH SEE IF DEFINED + BCC ERR.DD YES, DOUBLE DEFINITION + JMP STADD ADD TO SYMBOL TABLE +*-------------------------------- +ERR.DD LDY PASS ERROR IN PASS 1 + BEQ ERR.DBLDF OK IN PASS 2 + LDY #6 SET FLAG FOR TESTING FWD REFS + >SYM LDA,STPNTR + ORA #$40 + >SYM STA,STPNTR + LDY WBUF LOOK AT COLUMN 1 + CPY #': IF PRIVATE LABEL... + BEQ .2 ...THEN DON'T UPDATE C.M.LABEL + LDA STPNTR SAVE POINTER TO THIS MAJOR LABEL + STA CURRENT.MAJOR.LABEL + LDA STPNTR+1 + STA CURRENT.MAJOR.LABEL+1 +.2 RTS +ERR.DBLDF + LDY #QER4 DOUBLE DEFN + .HS 2C SKIP 2 BYTES +ERR.BS LDY #QER7 BAD SYMBOL + JMP SOFT.ERROR +*-------------------------------- +* Search Compressed Opcode Table +* If carry clear, (Y,A) = address of table +* If carry set, continue searching same table +* +* Return with carry set if found, else carry clear. +* (OPTBL.PNTR),Y points at 16-bit value +* of entry which matched. +*-------------------------------- +SEARCH.COMPRESSED.TABLE + BCS .6 ...Continue searching same table + STA OPTBL.PNTR + STY OPTBL.PNTR+1 +*---Try matching 2nd letter------ + LDY #0 +.1 LDA (OPTBL.PNTR),Y Possible match + ORA #$40 Make it ASCII + CMP SEARCH.KEY+1 same as 2nd letter? + BEQ .6 ...yes, matched. + BNE .3 ...no +*---Scan to next 8-bit entry----- +.2 INY + INY +.3 INY + LDA (OPTBL.PNTR),Y + BMI .2 ...another 24-bit entry + ASL check if beyond our sub-group + BPL .1 ...no, valid 2nd letter option +.4 CLC ...no match in table, carry clear + RTS +*---Try matching 3rd letter------ +.5 INY +.6 INY + LDA (OPTBL.PNTR),Y + BPL .4 ...no more options, not in table + INY point at data + EOR #$C0 make like ASCII + CMP SEARCH.KEY+2 compare to 3rd letter + BNE .5 ...did not match, try another + RTS ...found it, return carry set +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/scmasm.s.asmgen +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/SCMASM.S.ASMNL.txt b/SCMASM.31/SCMASM.S.ASMNL.txt new file mode 100644 index 00000000..c47cb4c3 --- /dev/null +++ b/SCMASM.31/SCMASM.S.ASMNL.txt @@ -0,0 +1,114 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* SET UP NEXT LINE TO ASSEMBLE +*-------------------------------- +SETUP.NEXT.LINE +.1 BIT INFLAG + BVS .5 ...INSIDE .INBx + LDA SRCP CHECK IF AT END + CMP HI.MEM TOP OF SOURCE CODE + LDA SRCP+1 + SBC HI.MEM+1 + BCS .7 RETURN WITH CARRY SET +.5 LDA MACRO.LEVEL IN SKELETON OR BODY? + BEQ .2 BODY + LDY #0 SEE IF END OF SKELETON + >SYM LDA,SRCP + BNE .3 NO, STILL IN SKELETON + LDA (MACSTK),Y POP SKELETON OFF MACRO STACK + STA CALL.NUM+1 + INY + LDA (MACSTK),Y + STA CALL.NUM + INY + LDA (MACSTK),Y + STA LF.ALL Real value of listing option + INY + LDA (MACSTK),Y + STA SRCP+1 + INY + LDA (MACSTK),Y + STA SRCP + INY + LDA (MACSTK),Y (HIGH BYTE) + PHA + INY + LDA (MACSTK),Y (LOW BYTE) + STA MACSTK + PLA + STA MACSTK+1 + DEC MACRO.LEVEL + JMP .1 +*-------------------------------- +.2 JSR GET.LINE.NUMBER BODY +.3 LDX #0 +.4 JSR GET.NEXT.SOURCE.CHAR + BEQ .6 END OF LINE + STA WBUF,X PUT INTO WORKING BUFFER + INX + BNE .4 ...ALWAYS +.6 STA WBUF,X PUT ZERO ON END + CLC RETURN WITH CARRY CLEAR +.7 RTS +*-------------------------------- +* GET NEXT CHARACTER FROM SOURCE LINE +* (IF INSIDE A MACRO SKELETON, EXPAND PARAMETERS) +*-------------------------------- +GET.NEXT.SOURCE.CHAR + STX MACRO.SAVEX MUST PRESERVE X-REGISTER + LDY PARAM.PNTR + BNE .1 PRESENTLY EXPANDING A PARAMETER + LDA MACRO.LEVEL IN A SKELETON? + BNE .2 YES + JMP NTKN NO +*-------------------------------- +.1 INC PARAM.PNTR + LDA (MACSTK),Y + BNE .8 ...NORMAL CHAR + STA PARAM.PNTR ...END OF PARAMETER +.2 JSR NTKN + BEQ .8 END OF LINE + CMP #$7F PARAMETER? + BNE .8 NO, NORMAL CHAR +*---MACRO PARAMETER-------------- + JSR NTKN YES, GET PARAM # + LDY #6 + CMP #'# ]# RETURNS NUMBER OF PARAMETERS (0-9) + BEQ .5 ...FOUND ]# + SEC + SBC #'1' CHANGE "1"..."9" TO 0...8 + BEQ .4 ...]1 + TAX ...]2 THRU ]9 +.3 INY + LDA (MACSTK),Y SKIP OVER A PARAMETER + BNE .3 + DEX + BNE .3 +.4 INY + STY PARAM.PNTR + BNE .1 ...ALWAYS +*---NUMBER OF PARAMETERS--------- +.5 CLC + LDA (MACSTK),Y + SBC MACSTK + TAY + LDX #10 +.6 LDA (MACSTK),Y + BNE .7 + DEX + DEY + CPY #7 + BCS .6 + LDX #0 +.7 TXA + ORA #$30 +*-------------------------------- +.8 LDX MACRO.SAVEX RESTORE X-REG + CMP #0 SET "EQ" STATUS IF END OF LINE + RTS +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/scmasm.s.asmnl +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/SCMASM.S.DATA.txt b/SCMASM.31/SCMASM.S.DATA.txt new file mode 100644 index 00000000..e18c2fd6 --- /dev/null +++ b/SCMASM.31/SCMASM.S.DATA.txt @@ -0,0 +1,241 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* PAGE ZERO VARIABLES +*-------------------------------- +* $00 THRU $1F RESERVED FOR USER +*---Apple Monitor, mostly-------- +MON.WIDTH .EQ $21 +CH80 .EQ $57B +CH .EQ $24 +CV .EQ $25 +BASL .EQ $28 +YSAVE .EQ $2F +ESCAPE.FLAG .EQ $30 +MON.MODE .EQ $31 +MON.INVFLG .EQ $32 +MON.YSAV .EQ $34 +HOOK.OUT .EQ $36,37 +HOOK.IN .EQ $38,39 +A0L .EQ $3A +A0H .EQ $3B +A1L .EQ $3C +A1H .EQ $3D +A2L .EQ $3E +A2H .EQ $3F +*-------------------------------- +* ProDOS USES $40-4F +*-------------------------------- +A3L .EQ $40 +A3H .EQ $41 +A4L .EQ $42 +A4H .EQ $43 +*-------------------------------- + .DUMMY + .OR $50 +*-------------------------------- +* +* Following needed at all times +* +*-------------------------------- +SCREEN.WIDTH .BS 1 +INFLAG .BS 1 +LO.MEM .BS 2 START OF SYMBOL TABLE +EOT .BS 2 END OF SYMBOL TABLE +PP .BS 2 START OF SOURCE PROGRAM +HI.MEM .BS 2 END OF SOURCE CODE +*-------------------------------- +PAGE.NUMBER .BS 2 +PAGE.LENGTH .BS 1 =0 means no titles +LINE.COUNT .BS 1 +DGTCNT .BS 1 +INCREMENT.VALUE .BS 2 FOR AUTO-LINE-NUMBERING (INIT=10) +CURLNO .BS 2 NUMBER OF LAST-SUBMITTED LINE (INIT=990) +PASS .BS 1 PASS NUMBER (0=PASS 1, 1=PASS 2) +CHAR.PNTR .BS 1 +CURRENT.CHAR .BS 1 CURRENT CHARACTER FROM 'GNC' +CURRENT.MAJOR.LABEL .BS 2 PNTR TO CURRENT MAJOR LABEL +EXP.NEW .BS 1 NEW EXPRESSION FLAG +STPNTR .BS 2 SYMBOL TABLE WORKING POINTER +TPTR .BS 2 SYMBOL TABLE TEMP POINTER +BASE.INDEX .BS 1 used in EXPR +LC.MODE .BS 1 +EXP.VALUE .BS 4 +EXP.VALUE64 .BS 4 +SYM.VALUE .BS 4 +EXP.UNDEF .BS 1 UNDEFINED TERM FLAG +EMIT.COLUMN .BS 1 KEEPS TRACK OF COLUMN FOR EMIT +ORGN .BS 4 +RPTCHR .BS 1 (NML, NTKN) +RPTCNT .BS 1 (NML, NTKN) +PNTR .BS 2 SEARCH STRING PNTR +INSAVE .BS 8 +*-------------------------------- +CALL.NUM .BS 2 CURRENT MACRO CALL NUMBER +MACLBL .BS 2 +CONV.CTRL .BS 1 CONTROL FLAG INSIDE CONVERT.LINE.NUMBER +MACRO.LEVEL .BS 1 +PARAM.PNTR .BS 1 +PARAM.CNT .BS 1 +*-------------------------------- +PROMPT.FLAG .BS 1 NULL, "H", OR "I" +HIDE.HIMEM .BS 2 SAVES HIMEM DURING "HIDE" +CURRENT.LINE.NUMBER .BS 2 +LF.ALL .BS 1 =0 TO LIST, <0 TO NOT LIST +LF.MACRO .BS 1 =0 TO LIST MACRO EXPANSIONS +FLAG.SPEED .BS 1 +DLIM .BS 1 ".AS" DELIMITER, also ASM +SRCP .BS 2 POINTER TO CURRENT SOURCE LINE +ENDP .BS 2 POINTER TO END OF LINE RANGE +EXP.FWDREF .BS 1 +AUTOLN.FLAG .BS 1 +=MANUAL, -=AUTO LINE NUMBERS +LINE.START .BS 2 +LINE.END .BS 2 +*-------------------------------- +ZP.COMMON .EQ * +*-------------------------------- +* +* Variables used only during SPECIFIC commands +* +*-------------------------------- +BLKSIZ .BS 1 used in MOVE.TEXT.UP and MOVE.TEXT.DOWN +MOVE.DISTANCE .BS 2 used in NML, COPY, and MOVE.TEXT.UP +AUTO.FLAG .BS 1 +=VERIFY, -=AUTO REPLACE +CHANGE.CNT .BS 1 # OF REPLACEMENTS IN THIS LINE +ED.FCOL .BS 1 +ED.FKEY .BS 1 +ED.PNTR .BS 1 +ED.BEGLIN .BS 1 +TEXT.OPTIONS .BS 1 used in TEXT command only +REPLACE.LENGTH .BS 1 +SOURCE.LENGTH .BS 1 +WBUF.LENGTH .BS 1 +KEY.PNTR .BS 2 USED IN FIND, REPLACE +BUF.PNTR .BS 2 USED IN FIND, REPLACE +KEY.ADDR .BS 2 SEARCH KEY ADDRESS +MATCH.END .BS 1 +LC.FLAG .BS 1 +=AS IS, -=ACCEPT BOTH CASES +*-------------------------------- + .OR ZP.COMMON +*-------------------------------- +* +* Variables used only during Assembly +* +*-------------------------------- +SEARCH.KEY .BS 3 USED BY OPCODE SEARCH ROUTINE +OPTBL.PNTR .BS 2 USED BY OPCODE SEARCH ROUTINE +DO.INDEX .BS 1 DO level: =0 if empty, else 1-63 +DO.STACK .BS 8 64 bits, =1 if true +DO.SKIP.CNT .BS 1 COUNTS .DO NESTS WHEN SKIPPING +NYBBLE.FLAG .BS 1 .AC DIRECTIVE +BYTE .BS 1 .AC DIRECTIVE +PHASE.FLAG .BS 1 +=NORMAL, -=IN PHASE +DUMMY.FLAG .BS 1 +=NORMAL, -=IN DUMMY SECTION +TF.FLAG .BS 1 +TRGT .BS 2 TARGET ADDRESS +MACSTK .BS 2 MACRO STACK POINTER +ERROR.COUNT .BS 2 +*-------------------------------- +OBJ.BYTE .BS 1 +ADDR.LENGTH .BS 1 +LF.CONDITIONAL .BS 1 =0 TO LIST FALSE SETS +LF.XTRA.BYTES .BS 1 =0 TO LIST XTRA BYTES ON XTRA LINES +EMIT.MARGIN .BS 1 COLUMN FOR LINE NUMBER TO START IN +MACRO.SAVEX .BS 1 +DUMMY.ORGN .BS 4 +ORIGIN.SAVE .BS 4 +FLAG.MA .BS 1 +CALL.CNTR .BS 2 TOTAL # OF MACRO CALLS +*-------------------------------- +*---ONLY IN .BS DIRECTIVE-------- +BS.COUNT .BS 2 # BYTES TO RESERVE +*---ONLY IN .AS & .AT DIRECTIVES +AS.HIBIT .BS 1 BIT 7 VALUE FOR .AS/.AT +AT.HIBIT .BS 1 BIT 7 TOGGLE FOR LAST BYTE BIT 7 +*-------------------------------- +* +*---$EB reserved for ECHO TEXTALKER software--- +* +*---$F0-FF reserved for ASM.PARTICULAR--- +* +*-------------------------------- + .ED +*-------------------------------- +* CHARACTER CODES +*-------------------------------- +CHR.CTRL.I .EQ $89 +CHR.RETURN .EQ $8D +CHR.BLANK .EQ $A0 +CHR.DOLLAR .EQ $A4 +CHR.STAR .EQ $AA +CHR.DASH .EQ $AD +CHR.PERIOD .EQ $2E +CHR.BSLASH .EQ $DC +*-------------------------------- +* MISCELLANEOUS SYMBOLS +*-------------------------------- +SYMBOL .EQ $0100 SYMBOL PACK AREA +HSHTBL .EQ $0130 HASH POINTER TABLE +KBUF .EQ $0170 - $01BF KEY STRING +WBUF .EQ $0200 WORKING BUFFER +WBUF.MAX .EQ 248 AND ITS LENGTH +PATHNAME .EQ $2CE (LAST 50 BYTES) +*-------------------------------- +* ROM-BASED ROUTINES +*-------------------------------- +MON.PRNTAX .EQ $F941 +MON.PRBL2 .EQ $F94A PRINT (X) BLANKS +MON.INIT .EQ $FB2F TEXT MODE, FULL WINDOW +MON.ADVANC .EQ $FBF4 +MON.BS .EQ $FC10 +MON.UP .EQ $FC1A +MON.VTAB .EQ $FC22 +MON.CLREOP .EQ $FC42 +MON.HOME .EQ $FC58 +MON.LF .EQ $FC66 +MON.CLREOL .EQ $FC9C +MON.DELAY .EQ $FCA8 +MON.RDKEY .EQ $FD0C READ NEXT CHAR +MON.READCH .EQ $FD18 +MON.PHEX .EQ $FDDA PRINT BYTE IN HEX +MON.COUT .EQ $FDED +MON.BL1 .EQ $FE00 +MON.SETKBD .EQ $FE89 +MON.SETVID .EQ $FE93 +MON.OUTPORT .EQ $FE95 SET NEW PR#N OUTPUT +MON.BELL .EQ $FF3A RING THE BELL +MON.RTS .EQ $FF58 ONLY AN "RTS" +MNTR .EQ $FF69 CALL-151 ENTRY INTO MONITOR +MON.GETNUM .EQ $FFA7 +MON.TOSUB .EQ $FFBE +MON.CHRTBL .EQ $FFCC MONITOR COMMAND CHAR TABLE +*-------------------------------- +MON.RESET .EQ $3F2 THRU 3F4 +*-------------------------------- + .MA INCD + INC ]1 + BNE :1 + INC ]1+1 +:1 + .EM +*-------------------------------- +RDMAIN .EQ $C002 +RDAUX .EQ $C003 +RDROM .EQ $C082 +RDRAM .EQ $C083 +WRMAIN .EQ $C004 +WRAUX .EQ $C005 +AUX.CODE .EQ $DF00 +*-------------------------------- + .MA SYM + .DO AUXMEM + JSR ]1.]2 + .ELSE + ]1 (]2),Y + .FIN + .EM +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/scmasm.s.data +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/SCMASM.S.DIR1.txt b/SCMASM.31/SCMASM.S.DIR1.txt new file mode 100644 index 00000000..edfdc948 --- /dev/null +++ b/SCMASM.31/SCMASM.S.DIR1.txt @@ -0,0 +1,308 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* DIRECTIVES +*-------------------------------- +* .DUMMY -- START DUMMY SECTION +*-------------------------------- +D.DUMMY + LDA DUMMY.FLAG DO NOTHING IF ALREADY IN DUMMY + BMI .2 + LDX #3 +.1 LDA ORGN,X + STA DUMMY.ORGN,X + DEX + BPL .1 + STX DUMMY.FLAG SET FLAG NEGATIVE +.2 RTS +*-------------------------------- +* .ED -- END DUMMY SECTION +*-------------------------------- +D.END.DUMMY + LDA DUMMY.FLAG + BPL .2 DO NOTHING IF NOT IN .DUMMY + LDX #3 + STX DUMMY.FLAG SET FLAG POSITIVE +.1 LDA DUMMY.ORGN,X + STA ORGN,X + DEX + BPL .1 +.2 RTS RETURN TO MAIN LEVEL OF ASM +*--------------------------------- +* .PH -- START PHASE +*-------------------------------- +D.PHASE + JSR D.END.PHASE + JSR EXPR.DEFINED GET PHASE ORIGIN + LDX #3 +.1 LDA ORGN,X SAVE ORIGIN + STA ORIGIN.SAVE,X + LDA EXP.VALUE,X + STA ORGN,X SET PHASE ORIGIN + DEX + BPL .1 + SEC SET FLAG TO $80 + ROR PHASE.FLAG + RTS RETURN TO MAIN LEVEL OF ASM +*-------------------------------- +* .EP -- END PHASE +*-------------------------------- +D.END.PHASE + ASL PHASE.FLAG TEST AND CLEAR FLAG + BCC .2 IT WAS ALREADY CLEAR + LDX #3 +.1 LDA ORIGIN.SAVE,X + STA ORGN,X + DEX + BPL .1 +.2 RTS +*--------------------------------- +* .OR -- SET ORIGIN +*--------------------------------- +PSOR JSR EXPR.DEFINED GET ORIGIN VALUE + LDX #3 +.1 LDA EXP.VALUE,X STORE IT IN + STA ORGN,X LOCATION + DEX COUNTER + BPL .1 + LDA DUMMY.FLAG IF IN DUMMY SECTION, DON'T + BMI RTS.1 ...IN DUMMY +NEW.TARGET + JSR TFEND END .TF IF DOING ONE + LDA EXP.VALUE STORE VALUE IN + STA TRGT TARGET ADDRESS + LDA EXP.VALUE+1 + STA TRGT+1 +RTS.1 RTS +*--------------------------------- +* .TA -- SET TARGET ADDRESS +*--------------------------------- +PSTA JSR EXPR.DEFINED GET EXPR VALUE + LDA EXP.VALUE+2 + ORA EXP.VALUE+3 + BEQ NEW.TARGET + JMP RAER +*-------------------------------- +* .AT -- ASCII STRING WITH LAST BYTE FLAGGED +* .AS -- ASCII STRING WITH ALL BYTES SAME +* .AZ -- Same as .AS, but with 00 terminator byte. +*-------------------------------- +PSAZ JSR PSAS + JMP EMIT.ZERO +PSAT LDA #$80 LAST BYTE HAS OPPOSITE BIT 7 + .HS 2C ...SKIP OVER 2 BYTES +PSAS LDA #0 ALL BYTES GET SAME BIT 7 + STA AT.HIBIT + JSR GNNB Scan to next non-blank + BCS ERBA2 END OF LINE + DEC CHAR.PNTR BACK UP +.1 JSR TRY.HEX.STRING + BEQ .5 ...END OF LINE + LDY #0 + STY AS.HIBIT ...assume hibit is 0 + CMP #'-' 1ST NON-BLANK A MINUS? + BNE .15 ...no, hibit is 0 + ROR AS.HIBIT ...yes, hibit is 1 + JSR GNC.UC +.15 STA DLIM SAVE DELIMITER + JSR GNC.UC GET NEXT CHAR + BCS ERBA2 END OF LINE IS BAD NEWS + CMP DLIM CHK IF DELIMITER + BEQ .4 YES, NO STRING IN BETWEEN +.2 JSR GNC.UC GET NEXT CHAR + BCS ERBA2 END OF LINE IS BAD NEWS + CMP DLIM CHK IF DELIMITER + BEQ .3 YES, FINISH UP AND RETURN + LDA WBUF-2,Y ...NO, GET PREVIOUS CHAR + ORA AS.HIBIT MERGE WITH TOP BIT + JSR EMIT + JMP .2 GO FOR ANOTHER ONE +.3 LDA WBUF-2,Y GET PREVIOUS CHAR + ORA AS.HIBIT MERGE WITH SELECTED BIT 7 + EOR AT.HIBIT TOGGLE BIT 7 IF IN .AT + JSR EMIT EMIT THE BYTE +.4 JSR GNC CHECK IF MORE IN LIST + BEQ .5 + CMP #',' + BEQ .1 +.5 RTS +*--------------------------------- +* .HS -- HEX STRING +*--------------------------------- +PSHS JSR GNNB GET NEXT NON-BLANK CHAR + BCS ERBA2 END OF LINE + JSR BACKUP.CHAR.PNTR + JSR TRY.HEX.STRING + BNE ERBA2 ...ERROR, BAD ADDRESS + RTS +*-------------------------------- +THX1 JSR HEX.DIGIT GET NEXT HEX DIGIT + BCC ERBA2 ERROR, ODD DIGITS + LDA SYM.VALUE GET CONVERTED VALUE + JSR EMIT +TRY.HEX.STRING +.1 JSR HEX.DIGIT + BCS THX1 + LDA CURRENT.CHAR + BEQ .2 ...END OF LINE + CMP #',' IF COMMA, GO GET MORE BYTES + BEQ .1 ...OKAY + CMP #' ' IF BLANK, VALID END OF STRING +.2 RTS +*-------------------------------- +ERBA2 JMP ERBA ERROR: BAD ADDRESS +GT255ERR LDY #QER8 VALUE > 255 ERROR + .HS 2C LONG "BIT" TO SKIP NEXT TWO BYTES +NOLBLERR LDY #QER1 "NO LABEL" + .HS 2C LONG "BIT" TO SKIP NEXT TWO BYTES +UNDF LDY #QER6 "UNDEF" + JMP SOFT.ERROR +*--------------------------------- +* .EQ -- EQUATE +*--------------------------------- +PSEQ LDY WBUF SEE IF ANY LABEL + CPY #$20 + BEQ NOLBLERR NO LABEL ON LINE + LDA STPNTR SAVE STPNTR WHILE CALLING EXPR + PHA + LDA STPNTR+1 + PHA + JSR EXPR.DEFINED GET VALUE + PLA RESTORE STPNTR + STA STPNTR+1 + PLA + STA STPNTR + LDA PASS WHICH PASS + BNE .5 PASS 2, PRINT VALUE +*---PASS 1: DEFINE VALUE-------- + LDY WBUF COLUMN 1 AGAIN + CPY #': PRIVATE LABEL? + BCC .4 ...LOCAL LABEL + BEQ .2 ...PRIVATE LABEL +*---NORMAL LABEL----------------- + LDY #2 +.1 LDA EXP.VALUE-2,Y REDEFINE SYMBOL + >SYM STA,PNTR + INY + CPY #6 + BCC .1 + RTS +*---PRIVATE LABEL---------------- +.2 LDY #0 +.3 LDA EXP.VALUE,Y + >SYM STA,STPNTR + INY + CPY #4 + BCC .3 + RTS +*---LOCAL LABEL------------------ +.4 LDY #2 COMPUTE LOCAL OFFSET + SEC + LDA EXP.VALUE + >SYM SBC,STPNTR + DEY + >SYM STA,PNTR + LDY #3 + LDA EXP.VALUE+1 + >SYM SBC,STPNTR + BNE GT255ERR VALUE > 255 + RTS RETURN TO MAIN LEVEL OF ASM +*---PASS 2: PRINT VALUE--------- +.5 JMP P.EXP.VALUE.DASH +*--------------------------------- +* .DA -- DATA VALUE (8- OR 16-BITS) +*--------------------------------- +PSDA LDA #0 UNDEF FLAG FOR LINE + PHA +.1 JSR GNNB GET NEXT NON-BLANK CHAR + BCS ERBA2 END OF LINE + STA DLIM +*---Could be $$dstringd---------- + CMP #'$' $$dstringd value? + BNE .2 ...NO + LDA WBUF,Y Look for second $ + CMP #'$' + BNE .25 ...NO, MUST BE SIMPLE HEX WORD + JSR GNC SKIP OVER SECOND '$' + JSR PSAS GET dstringd + JMP .5 +*---Look for size char----------- +.2 LDY #1 ASSUME 1-BYTE DATA + CMP #'#' + BEQ .3 + CMP #'/' + BEQ .3 + LDY #3 ASSUME 3-BYTE DATA + CMP #'<' 24-BIT SIGNAL + BEQ .3 ...3-BYTE DATA + INY ASSUME 4-BYTE DATA + CMP #'>' 32-BIT SIGNAL + BEQ .3 +*---Size is two bytes------------ +.25 JSR BACKUP.CHAR.PNTR + LDY #2 2-BYTE DATA +*---Get expression, emit value--- +.3 STY ADDR.LENGTH + JSR EXPR CRACK EXPRESSION + LDY DLIM If preceded by /, shift over + CPY #'/' + BNE .4 ...NOT / + JSR EXP.OVER.256 +.4 JSR EMIT.VALUE ACCORDING TO ADDR.LENGTH +*---Update UNDEF flag------------ + PLA .DA'S UNDEF FLAG + ORA EXP.UNDEF + PHA +*---Next item in list------------ +.5 JSR GNC.UC LOOK FOR ANOTHER ITEM + CMP #', COMMA? + BEQ .1 YES, GET ANOTHER ONE + PLA GET .DA'S UNDEF FLAG + STA EXP.UNDEF MERGED VALUE + RTS LIST LINE OR REPORT UNDEF ERROR +*-------------------------------- +* DO/ELSE/FIN +*-------------------------------- +PSDO JSR EXPR.DEFINED GET VALUE + LDX DO.INDEX 0 IF EMPTY, ELSE 1-63 + INX + CPX #64 + BCC .2 + LDY #QERDO2 ".DO NEST TOO DEEP" + JMP SOFT.ERROR +.2 LDA EXP.VALUE + ORA EXP.VALUE+1 TEST FOR ZERO + ORA EXP.VALUE+2 + ORA EXP.VALUE+3 + BEQ .3 ZERO, FALSE + SEC NONZERO, TRUE +.3 STX DO.INDEX + LDX #-8 +.4 ROR DO.STACK+8,X + INX + BNE .4 + RTS LIST THE LINE +*-------------------------------- +PSEL LDX DO.INDEX + BEQ ERR.DO ERROR, NOT BTWN .DO AND .FIN + LDA DO.STACK + EOR #$80 TOGGLE CURRENT LOGIC LEVEL + STA DO.STACK + RTS RETURN TO MAIN LEVEL OF ASM +*-------------------------------- +ERR.DO LDY #QERDO "MISSING .DO" + JMP SOFT.ERROR +*-------------------------------- +PSFI LDX DO.INDEX + BEQ ERR.DO ERROR, NOT AFTER .DO + DEC DO.INDEX POP THIS DO + LDX #7 +.1 ROL DO.STACK,X + DEX + BPL .1 + RTS RETURN TO MAIN LEVEL OF ASM +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/scmasm.s.dir1 +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/SCMASM.S.DIR2.txt b/SCMASM.31/SCMASM.S.DIR2.txt new file mode 100644 index 00000000..ecf026b4 --- /dev/null +++ b/SCMASM.31/SCMASM.S.DIR2.txt @@ -0,0 +1,279 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* .IN -- INCLUDE A SOURCE FILE +*-------------------------------- +PSIN LDA INFLAG SEE IF NESTED .IN + BNE .4 ...YES, ERROR + SEC + ROR INFLAG TURN ON FLAG (=$80) + LDA #'I PUT "I" IN PROMPT MESSAGE + STA PROMPT.FLAG + JSR LIST.LINE.BOTH.PASSES +*---SAVE CURRENT, SET UP NEW----- + LDX #1 +.1 LDA HI.MEM,X SAVE CURRENT SOURCE POINTERS + STA INSAVE,X + LDA SRCP,X + STA INSAVE+2,X + LDA PP,X + STA HI.MEM,X + .DO AUXMEM + .ELSE + LDA LO.MEM,X MAKE DOS PROTECT THE SYMBOL TABLE + STA INSAVE+6,X DURING THE LOAD + LDA EOT,X + STA LO.MEM,X + .FIN + DEX + BPL .1 +*---CHECK FOR .INBx-------------- + JSR GNC.UC + CMP #'B' + BNE .2 ...NOT .INBx + JSR GNC.UC GET # OF BLOCKS + EOR #'0' + BEQ .12 ...NOT 1-9, USE 1 + CMP #10 + BCC .14 ...1-9 +.12 LDA #1 USE 1 BLOCK +.14 ORA #$C0 + STA INFLAG +*---LOAD THE FILE---------------- +.2 JSR SAVE.PATHNAME + LDY #PQ.LOD LOAD COMMAND + JSR ISSUE.DOS.COMMAND +*---ASSEMBLE INCLUDED STUFF------ + LDX #1 +.3 LDA PP,X MOVE SRCP TO BEGINNING OF INCLUDED FILE + STA SRCP,X + STA MACSTK,X + .DO AUXMEM + .ELSE + LDA INSAVE+6,X RESTORE LO.MEM + STA LO.MEM,X + .FIN + LDA SCI.IOB.RW+6,X # BYTES ACTUALLY RECEIVED + STA INSAVE+4,X + DEX + BPL .3 + LDA SCI.IOB.RW+1 REFNUM OF INB FILE + STA INSAVE+6 + JMP ASM2 CONTINUE ASSEMBLY +*---NO NESTING ALLOWED----------- +.4 LDY #QNIN "NEST .IN" + JMP FIRM.ERROR +*-------------------------------- +* .EN -- END OF SOURCE PROGRAM +*-------------------------------- +PSEN JSR LIST.SOURCE.IF.LISTING +ENDM + BIT INFLAG IN A ".IN"? + BPL .1 NO + BVC .3 ...NOT IN .INBx + LDA INSAVE+6 .INBx REFNUM + STA SCI.IOB.CLOSE+1 + LDA #$CC Close the .INclude file + JSR SCI.MLI +.3 JSR RESTORE YES, BACK TO ROOT + JMP ASM2 CONTINUE ASSEMBLY +*---END OF ROOT FILE------------- +.1 JSR TFEND END .TF IF DOING ONE + LDA PASS WHICH PASS? + BNE .2 ...END OF PASS 2 + INC PASS END OF PASS 1 + JMP ASM1 +.2 BIT LF.ALL Are we listing? + BMI ASM.END ...no, we are finished + JSR CRLF.WITH.PAGING + JSR CRLF.WITH.PAGING + JSR CRLF.WITH.PAGING + LDY #QST "SYMBOL TABLE" + JSR QT.OUT + JSR CRLF.WITH.PAGING + JSR CRLF.WITH.PAGING + JSR STPRNT PRINT THE SYMBOLS +*-------------------------------- +ASM.END + JSR CRLF.WITH.PAGING + LDA ERROR.COUNT + STA CURRENT.LINE.NUMBER + LDA ERROR.COUNT+1 + STA CURRENT.LINE.NUMBER+1 + JSR CONVERT.LINE.NUMBER.PRINT + LDY #QERRCNT + JSR QT.OUT + JMP SOFT END OF ASSEMBLY +*-------------------------------- +* RESTORE IF INSIDE AN INCLUDE +*-------------------------------- +RESTORE + LDA INFLAG + BEQ .1 RETURN + LDX #0 CLEAR PROMPT.FLAG + STX PROMPT.FLAG + STX INFLAG CLEAR INFLAG + INX X=1 +.2 LDA HI.MEM,X + STA PP,X + STA MACSTK,X + LDA INSAVE,X + STA HI.MEM,X + LDA INSAVE+2,X + STA SRCP,X + DEX + BPL .2 +.1 RTS +*-------------------------------- +* SET UP TITLE LINE +*-------------------------------- +PSTI LDA PASS + BEQ PGXIT DO NOTHING IN PASS ONE + JSR EXPR.DEFINED GET PAGE LENGTH + LDA EXP.VALUE USE MOD 256 + STA PAGE.LENGTH NON-ZERO PAGE LENGTH MEANS TITLING IS ON + LDX #0 POINT AT TITLE BUFFER + JSR GNC + CMP #', + BNE .2 NO TITLE +.1 JSR GNC + BCS .2 END OF TITLE + STA KBUF,X + INX + CPX #70 MAX TITLE SIZE + BCC .1 +.2 LDA #0 TERMINATE TITLE + STA KBUF,X +*---FALL INTO PSPG CODE---------- +*-------------------------------- +* PAGE EJECT +*-------------------------------- +PSPG JSR FORM.FEED +PGXIT JMP ASM2 +*-------------------------------- +FORM.FEED + JSR CHECK.IF.LISTING + LDA #$0C FORM FEED CHAR + JSR CHO + >INCD PAGE.NUMBER + LDA PAGE.LENGTH + CMP #3 PAGE LENGTHS LESS THAN 3 CANNOT BE TITLED + BCC .1 EXIT, NOT TITLING NOW + LDX #0 + STX LINE.COUNT +.3 LDA KBUF,X PRINT TITLE + BEQ .4 END OF TITLE + JSR CHO + INX + BNE .3 ...ALWAYS +.4 LDY #PAGEQT " PAGE " + JSR QT.OUT + LDA CURRENT.LINE.NUMBER SAVE LINE # + PHA + LDA CURRENT.LINE.NUMBER+1 + PHA + LDA PAGE.NUMBER PRINT PAGE # + STA CURRENT.LINE.NUMBER + LDA PAGE.NUMBER+1 + STA CURRENT.LINE.NUMBER+1 + JSR CONVERT.LINE.NUMBER.PRINT + JSR CRLF.WITH.PAGING + PLA RESTORE LINE # + STA CURRENT.LINE.NUMBER+1 + PLA + STA CURRENT.LINE.NUMBER +.1 RTS RETURN +*-------------------------------- +* .BS -- BLOCK STORAGE +*-------------------------------- +PSBS JSR EXPR.DEFINED GET # OF BYTES + LDA EXP.VALUE+3 + ORA EXP.VALUE+2 + BNE RAER VALUE >32767 + LDA EXP.VALUE+1 + BMI RAER VALUE >32767 + STA BS.COUNT+1 + LDA EXP.VALUE + STA BS.COUNT SAVE COUNT + JSR P.ORIGIN PRINT ADDRESS + JSR GNC GET NEXT CHAR + CMP #', COMMA? + BNE .1 NO, NO VALUE PRESENT + JSR EXPR GET FILL VALUE + BPL .2 BRANCH IF GOOD EXPRESSION +.1 JSR ZERO.EXP.VALUE USE ZERO FOR FILL VALUE +.2 SEC + ROR LF.ALL TURN OFF LISTING +.3 LDA BS.COUNT GET COUNT + BNE .4 STILL MORE BYTES + DEC BS.COUNT+1 + BMI .5 ...ALL THRU +.4 DEC BS.COUNT COUNT DOWN + LDA EXP.VALUE GET FILL VALUE + JSR EMIT AND EMIT IT + JMP .3 + +.5 ASL LF.ALL RESTORE LISTING + RTS + +*-------------------------------- +RAER LDY #QER3 ERROR -- OUT OF RANGE + JMP SOFT.ERROR + +*-------------------------------- +* LISTING CONTROL +* .LIST ON/OFF/MON/MOFF/CON/COFF,... +*-------------------------------- +PSLI LDY #LI.INDEX-2 + JSR SET.FLAGS + JMP ASM2 DON'T LIST LINE +*-------------------------------- +* SWITCH FLAGS ON OR OFF +*-------------------------------- +SET.FLAGS + STY YSAVE +.1 LDY YSAVE +.2 INY Find letter in table + INY + LDA FLAG.TABLE,Y + BEQ .7 ...end of table, get next letter + CMP CURRENT.CHAR + BNE .2 ...try next entry in table +*---Found letter in table-------- + LDX FLAG.TABLE+1,Y +.3 EOR #'N 'N' means ON + BEQ .5 ...set flag to $00 + EOR #'F^'N 'F' means OFF + BEQ .4 ...set flag to $FF + EOR #',^'F comma here is an error + BEQ .9 ...oops! + JSR GNC.UC get next char from user + BNE .3 ...might be N, F, or comma + RTS ...blank or end of line +*---Turn flag ON or OFF---------- +.4 LDA #$FF signal OFF with $FF +.5 STA 0,X store $00 or $FF in flag +*---Scan to a comma or eol------- +.6 JSR GNC GET NEXT CHAR + BEQ .8 ...blank or end of line + CMP #',' + BNE .6 ...not comma yet +*---Get next char from user------ +.7 JSR GNC.UC + BCC .1 ...not end of line yet +.8 RTS RETURN TO CALLER +.9 JMP ERBA +*-------------------------------- +FLAG.TABLE +LI.INDEX .EQ *-FLAG.TABLE + .DA #'N',#LF.ALL + .DA #'F',#LF.ALL + .DA #'M',#LF.MACRO + .DA #'C',#LF.CONDITIONAL + .DA #'X',#LF.XTRA.BYTES + .HS 00 +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/scmasm.s.dir2 +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/SCMASM.S.DISK.txt b/SCMASM.31/SCMASM.S.DISK.txt new file mode 100644 index 00000000..3cd60101 --- /dev/null +++ b/SCMASM.31/SCMASM.S.DISK.txt @@ -0,0 +1,262 @@ +NEW + AUTO 3,1 +*-------------------------------------- +SCI.TBLADR .EQ $AA00 Address of Command Table +SCI.LINBUF .EQ $BC80 +SCI.STARTUP .EQ $BE00 +SCI.COMMAND .EQ $BE03 +SCI.ERROR .EQ $BE09 +SCI.SLOT .EQ $BE3C +SCI.DRIVE .EQ $BE3D +SCI.STATE .EQ $BE42 0=immediate, else deferred +SCI.MLI .EQ $BE70 Call MLI, (A)=operation +SCI.RTS .EQ $BE9E +SCI.IOB.GETSET .EQ $BEB4 Get/Set File Info IOB +SCI.IOB.MISC .EQ $BEC6 Misc functions IOB +SCI.IOB.OPEN .EQ $BECB Open IOB +SCI.IOB.RW .EQ $BED5 Read/Write IOB +SCI.IOB.CLOSE .EQ $BEDD Close IOB +SCI.BUFFER.PAGES .EQ $BEF2,3,4 Buf1, Buf2, Exec +SCI.HIMEM.PAGE .EQ $BEFB +*-------------------------------- +* LIST SOURCE CODE ON TEXT FILE +*-------------------------------- +* TEXT.OPTIONS: +* TEXT NO LINE NUMBERS +* TEXT# WITH LINE NUMBERS +* TEXT% WITH TAB.CHAR +*-------------------------------- +TEXT LDX #0 00=NO LINE NUMBERS + STX TEXT.OPTIONS + JSR GNNB GET NEXT NON-BLANK CHAR + CMP #'# TEXT # MEANS WRITE LINE NUMBERS + BEQ .5 USE LINE NUMBERS + CMP #'% TEXT % MEANS WRITE CONTROL-I + BNE .6 NEITHER, WRITE TEXT ONLY + LDA TAB.CHAR + STA TEXT.OPTIONS + BNE .7 ...ALWAYS +.5 INC TEXT.OPTIONS + BNE .7 ...ALWAYS +.6 JSR BACKUP.CHAR.PNTR +.7 LDA #1 INTO "DEFERRED" STATE + STA SCI.STATE + JSR SAVE.PATHNAME + LDY #PQ.OPN + JSR ISSUE.DOS.COMMAND + LDY #PQ.WRT + JSR ISSUE.DOS.COMMAND + JSR SETUP.TEXT.POINTERS (PP --> SRCP, HIMEM --> ENDP) +.1 JSR CMP.SRCP.ENDP END OF RANGE YET? + BCS .4 ...YES + JSR GET.LINE.NUMBER + LDA TEXT.OPTIONS + BEQ .3 NO LINE # + BMI .2 TAB.CHAR + JSR CONVERT.LINE.NUMBER.PRINT + LDA #$20 SPACE AFTER LINE # +.2 JSR CHO +.3 JSR NTKN + BNE .2 + JSR CRLF + JMP .1 +.4 LDA #0 TRUNCATE REST OF FILE + JSR CHO + JMP SOFT +*-------------------------------- +* .TF DIRECTIVE +*-------------------------------- +* END EXISTING .TF IF ANY +* SET .TF FLAG ON +* +* PASS 1: THAT'S ALL +* +* PASS 2: OPEN THE FILE, WITH T=BIN +* SET MARK=EOF=0 +* SET STARTING ADDRESS IN FILE-INFO +* WRITE START ADDRESS AND LENGTH +*-------------------------------- +PSTF JSR TFEND CLOSE EXISTING TF IF ANY + SEC + ROR TF.FLAG SET FLAG ON + JSR LIST.LINE.BOTH.PASSES + LDA PASS WHICH PASS? + BEQ .9 ...PASS 1, EXIT NOW + JSR SAVE.PATHNAME + LDY #PQ.OPN + JSR ISSUE.DOS.COMMAND +*---Empty the file now----------- + LDA #0 + STA SCI.IOB.MISC+2 + STA SCI.IOB.MISC+3 + STA SCI.IOB.MISC+4 + LDA SCI.IOB.OPEN+5 REFNUM FOR TARGET FILE + STA TF.PRM TARGET FILE REF. NUM. + STA SCI.IOB.MISC+1 + LDA #$CE SET MARK + JSR SCI.MLI + BCS JMP.PRODOS.ERR ...ERROR + LDA #$D0 SET EOF + JSR SCI.MLI + BCS JMP.PRODOS.ERR ...ERROR +*---Get current file info-------- + LDA #10 + STA SCI.IOB.GETSET + LDA #$C4 GET FILE INFO + JSR SCI.MLI + BCS JMP.PRODOS.ERR ...ERROR +*---Set proper file info--------- + LDA #7 change IOB for set.file.info + STA SCI.IOB.GETSET + LDA SCI.IOB.GETSET+4 current file type + CMP #$04 is it type TXT? + BEQ .9 ...yes, make no changes + LDX #$2000 if type is SYS ($FF), force A=$2000 + LDY /$2000 + CMP #$FF is it type SYS? + BEQ .3 ...yes + LDX ORGN all other types, A=origin + LDY ORGN+1 +.3 STX SCI.IOB.GETSET+5 new AuxType + STY SCI.IOB.GETSET+6 + LDA #$C3 SET FILE INFO + JSR SCI.MLI + BCS JMP.PRODOS.ERR ...ERROR +.9 JMP ASM2 ...CONTINUE ASSEMBLY +*-------------------------------- +JMP.PRODOS.ERR JMP PRODOS.ERROR +*-------------------------------- +* OUTPUT (A) TO ALREADY OPENED DISK FILE +*-------------------------------- +DOUT BIT DUMMY.FLAG + BMI .3 No output inside DUMMY section + STA TF.BUF Save in buffer outside zero-page + STX TF.SVX + LDX #4 copy parms to SCI parmblock +.1 LDA TF.PRM,X + STA SCI.IOB.RW+1,X + DEX + BPL .1 ...until all copied + LDA #$CB Write command code + JSR SCI.MLI + BCS JMP.PRODOS.ERR + LDX TF.SVX + LDA OBJ.BYTE +.3 RTS +* +TF.SVX .BS 1 +TF.BUF .BS 1 +TF.PRM .DA #*-*,TF.BUF,1 +*-------------------------------- +* TFEND - FINISH OFF A .TF SECTION +* CALLED FROM: .TF, .TA, .OR, .EN PROCESSORS +* +* IF NOT IN .TF NOW, RETURN IMMEDIATELY +* CLEAR .TF FLAG +* PASS 1 - THAT'S ALL TO DO +* PASS 2 - CLOSE FILE +*-------------------------------- +TFEND ASL TF.FLAG TEST AND CLEAR FLAG SIMULTANEOUSLY + BCC .1 ...TF NOT ACTIVE, DO NOTHING + LDA PASS + BNE CLOSE.FILES ...PASS 2 +.1 RTS +*-------------------------------- +CLOSE.FILES + LDY #PQ.CLS + .HS 2C +FP LDY #PQ.FP + LDA #0 + STA PATHNAME +*-------------------------------- +* ISSUE DOS COMMAND WITH FILE NAME +* (Y)=QUOTE OFFSET FOR COMMAND +* +* SAVES AND RESTORES CHARACTER POINTER +* SO THAT FILE NAME CAN BE USED AGAIN. +*-------------------------------- +ISSUE.DOS.COMMAND + LDX #$7F SAVE WBUF (0-127) +.1 LDA WBUF,X + STA SCI.LINBUF,X + DEX + BPL .1 +.2 INX COPY PATHNAME INTO WBUF (5...) + LDA PATHNAME,X + STA WBUF+5,X + BNE .2 + TAX X=0 +.3 INX COPY COMMAND INTO WBUF (0...) + INY + LDA PQTS-1,Y + STA WBUF-1,X + BPL .3 + STX SCI.STATE ALLOW DEFERRED COMMANDS + JSR PASS.CMD.TO.PRODOS + LDX #$7F RESTORE WBUF (0-127) +.4 LDA SCI.LINBUF,X + STA WBUF,X + DEX + BPL .4 + RTS +*-------------------------------- +SAVE.PATHNAME .DO LOWERCASE=1 + ldx #0 + +.1 cpx #49 + bcs .2 + + jsr .8 + bcc .3 + +.2 lda #0 + +.3 sta PATHNAME,x + inx + bcc .1 + + rts + +.8 jsr GNC GET NEXT CHAR ANY CASE + beq .9 SPACE OR + + sta CURRENT.CHAR + cmp #$FF CLEAR CARRY, SET .NE. + +.9 rts + + .ELSE + LDX #0 + +.1 CPX #49 + BCS .2 + + JSR GNNB + BCC .3 + +.2 LDA #0 + +.3 STA PATHNAME,X + INX + BCC .1 + + RTS + .FIN +*-------------------------------- +PQTS .EQ * +PQ.CLS .EQ *-PQTS + .AT /CLOSE/ +PQ.OPN .EQ *-PQTS + .AT /OPEN / +PQ.WRT .EQ *-PQTS + .AT /WRITE/ +PQ.LOD .EQ *-PQTS + .AT /LOAD / +PQ.FP .EQ *-PQTS + .AS /-BASIC.SYSTEM/ + .HS 00FF +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/scmasm.s.disk +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/SCMASM.S.EDIT..txt b/SCMASM.31/SCMASM.S.EDIT..txt new file mode 100644 index 00000000..3346aae0 --- /dev/null +++ b/SCMASM.31/SCMASM.S.EDIT..txt @@ -0,0 +1,509 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* SOFT INITIALIZATION +*-------------------------------- +SOFT LDA /$1000 START SYMBOL TABLE AT $1000 +SYMBOL.BASE .EQ *-1 + STA LO.MEM+1 + LDA #0 + STA LO.MEM + STA AUTOLN.FLAG TURN OFF AUTOMATIC LINE NUMBERS + JSR IO.WARM INIT SCREEN, CONNECT DOS + JSR CLOSE.FILES +*-------------------------------- +FAST CLC SET TO FAST LISTING SPEED + .HS 24 (SKIP OVER SEC) +SLOW SEC SET TO SLOW LISTING SPEED + ROR FLAG.SPEED SET/CLEAR SIGN BIT +*-------------------------------- +* GET NEXT LINE +*-------------------------------- +GNL + LDX #$FF INIT STACK + TXS + STX PASS PASS=-1 IF NOT ASSEMBLING + INX MAKE X=0 + STX SCI.STATE GET INTO "IMMEDIATE" STATE + STX RPTCNT CLEAR REPEAT COUNT + STX MACRO.LEVEL + STX PARAM.PNTR + STX CHAR.PNTR + STX PAGE.LENGTH TURN OFF TITLING + JSR READ.LINE + JSR GNC.UC.START GET FIRST CHAR OF LINE + BEQ GNL EMPTY LINE OR 1ST CHAR IS BLANK + JSR CHECK.LETTER + BCC .1 NOT A LETTER + JSR SEARCH.COMMAND.TABLE + JMP GNL +*---Test for single char cmds---- +.1 LDY #CHARS.FOR.COMMANDS + JSR SEARCH.CHAR.TABLES + JMP GNL +*---" LINE, ECHO ALL CHARS------- +ECHO1 JSR CHO SEND CHARACTER +ECHO.LINE + JSR GNC GET NEXT CHAR + BCC ECHO1 NOT END YET + RTS +*-------------------------------- +* SYNTAX ERROR +*-------------------------------- +SYNX LDY #QSYNX + JMP HARD.ERROR +*-------------------------------- +* NUMBERED LINE +*-------------------------------- +NML JSR GNC.START GET FIRST CHAR + JSR DECN CONVERT LINE NUMBER + LDA DGTCNT MUST BE 1 TO 5 DIGITS + BEQ SYNX + LDA SYM.VALUE+2 + ORA SYM.VALUE+3 + BNE SYNX > 65535 +*---Compact the numbered line---- + DEY Backup to previous character + JSR COMPACT.LINE +*-------------------------------- + LDX #1 COPY IN BINARY LINE # +.51 LDA SYM.VALUE,X + STA CURLNO,X SAVE HERE TOO, FOR AUTO-NUMBER + STA WBUF+1,X + DEX + BPL .51 +*-------------------------------- +* FIND LINE, OR PLACE WHERE IT SHOULD GO +* LINE.START --> BEGINNING OF THIS LINE +* LINE.END --> BEGINNING OF NEXT LINE +*-------------------------------- + LDX #SYM.VALUE POINT AT LINE NUMBER + JSR SERTXT FIND IT IF THERE + SEC GET LENGTH OF HOLE + LDA LINE.END WILL ALWAYS BE LESS THAN 256 + SBC LINE.START + SEC SUBTRACT LENGTH OF NEW LINE + SBC WBUF LINE SIZE + BEQ .11 SAME SIZE EXACTLY + STA MOVE.DISTANCE + LDA #0 + SBC #0 + STA MOVE.DISTANCE+1 + BCC .6 NEW LINE LONGER THAN HOLE +*-------------------------------- +* NEW LINE SHORTER THAN HOLE +*-------------------------------- + CLC COMPUTE TARGET TO MOVE UP TO + LDA LINE.START + ADC MOVE.DISTANCE + STA A4L + LDA LINE.START+1 + ADC MOVE.DISTANCE+1 + STA A4H + JSR MOVE.TEXT.UP + JMP .10 NOW HOLE IS RIGHT SIZE +*-------------------------------- +* ENLARGE HOLE TO MAKE ROOM +*-------------------------------- +.6 CLC (MOVE.DISTANCE) = -<#BYTES TO EXPAND> + LDA PP COMPUTE TARGET ADDRESS + ADC MOVE.DISTANCE + STA A4L + LDA PP+1 + ADC MOVE.DISTANCE+1 + STA A4H + LDA A4L BE SURE THERE IS ROOM + CMP LO.MEM + LDA A4H + SBC LO.MEM+1 + BCC MFER NO ROOM! + JSR MOVE.TEXT.DOWN +*---Adjust SRCP if needed-------- +.10 LDA SRCP If hole is above (SRCP), + CMP LINE.END then need to add MOVE.DISTANCE + LDA SRCP+1 + SBC LINE.END+1 + BCS .11 + LDA SRCP + ADC MOVE.DISTANCE + STA SRCP + LDA SRCP+1 + ADC MOVE.DISTANCE+1 + STA SRCP+1 +*-------------------------------- +* COPY NEW LINE INTO THE HOLE +*-------------------------------- +.11 LDX WBUF LINE SIZE + BEQ .14 NO NEW LINE TO COPY + LDY #0 +.12 LDA LINE.END BACK UP POINTER TO END OF HOLE + BNE .13 + DEC LINE.END+1 +.13 DEC LINE.END + DEX + LDA WBUF,X + STA (LINE.END),Y + TXA + BNE .12 +.14 RTS +*-------------------------------- +MFER LDY #QMEMFL MEM FULL ERROR + JMP HARD.ERROR +*-------------------------------- +COMPACT.LINE + LDX #4 Start storing at WBUF+3 + LDA #-1 Prime RPT pump + STA RPTCNT +.1 STA RPTCHR +.2 INY advance input pointer + INC RPTCNT (first time makes it = 0) + LDA WBUF,Y get next char + AND #$7F be sure its low ascii + CMP RPTCHR save as previous char? + BEQ .2 ...yes, just count it + PHA save new character +*-------------------------------- + LDA RPTCNT + BEQ .3 + JSR PROCESS.REPEAT.COUNT +*-------------------------------- +.3 PLA get new character + BNE .1 ...not 00 terminator + STA WBUF-1,X store terminator + CPX #5 If only line number, make length 00 + BCS .4 + LDX #0 +.4 STX WBUF + RTS +*-------------------------------- +PROCESS.REPEAT.COUNT + LDA RPTCHR + CMP #' ' + BEQ .5 ...compress blanks in special way + LDA RPTCNT + CMP COMPRESSION.LIMIT + BCS .2 ...enough to compress to 3 bytes +.1 LDA RPTCHR spit out uncompressed chars + STA WBUF-1,X + INX + DEC RPTCNT + BNE .1 + RTS +*---Compress $C0 cnt char-------- +.2 STA WBUF,X store count + LDA #$C0 Compression token + STA WBUF-1,X + INX + INX + LDA RPTCHR repeated char +.3 STA WBUF-1,X + INX + LDA #0 + STA RPTCNT + RTS +*---Compress blanks-------------- +.4 SBC #$3F Maximum blanks in one token + STA RPTCNT + LDA #$BF $3F blanks + STA WBUF-1,X + INX +.5 LDA RPTCNT Number of blanks left + CMP #$40 + BCS .4 ...too many for one token + ORA #$80 make into blank token + count + BNE .3 ...always +*-------------------------------- +SCAN.3.DECIMAL.NUMBERS + LDX #6 FIRST CLEAR TO ZERO + LDA #0 +.1 STA A0L-1,X + DEX + BNE .1 + JSR SCAN.1.DECIMAL.NUMBER + JSR SCAN.1.DECIMAL.NUMBER +*** JMP SCAN.1.DECIMAL.NUMBER +*-------------------------------- +SCAN.1.DECIMAL.NUMBER +.1 JSR GNC + BCS .2 END OF LINE + EOR #$30 IS THIS A DIGIT? + CMP #10 + BCS .1 NO + TXA SAVE X-REG + PHA + JSR DECN CONVERT NUMBER + PLA RESTORE X-REG + TAX + LDA SYM.VALUE STACK NUMBER + STA A0L,X + INX + LDA SYM.VALUE+1 + STA A0L,X + INX +.2 RTS +*-------------------------------- +* DECIMAL NUMBER INPUT +*-------------------------------- +DECN JSR BACKUP.CHAR.PNTR + JSR ZERO.SYM.VALUE CLEAR ACCUMULATOR + STA DGTCNT +.1 JSR GNC GET NEXT CHAR + EOR #$30 CHECK IF DIGIT + CMP #10 + BCS .5 NOT A DIGIT + PHA SAVE THE DIGIT +*---ACCUMULATOR * TEN------------ + JSR ASL.SYM.VALUE + BCS .6 OVERFLOW ERROR + LDX #3 +.2 LDA SYM.VALUE,X HI- TO LO- + PHA + DEX + BPL .2 +.3 JSR ASL.SYM.VALUE + BCS .6 OVERFLOW ERROR + INX + BEQ .3 DO IT TWICE + PLA + ADC SYM.VALUE + STA SYM.VALUE + PLA + ADC SYM.VALUE+1 + STA SYM.VALUE+1 + PLA + ADC SYM.VALUE+2 + STA SYM.VALUE+2 + PLA + ADC SYM.VALUE+3 + STA SYM.VALUE+3 + BCS .6 OVERFLOW ERROR +*---ADD CURRENT DIGIT------------ + PLA + ADC SYM.VALUE + STA SYM.VALUE + BCC .4 + INC SYM.VALUE+1 + BNE .4 + INC SYM.VALUE+2 + BNE .4 + INC SYM.VALUE+3 + BEQ .6 OVERFLOW ERROR +.4 INC DGTCNT COUNT THE DIGIT + BNE .1 ...ALWAYS +.5 RTS +.6 LDY #QER3 RANGE ERROR + JMP SOFT.ERROR +*-------------------------------- +* GET NEXT NON-BLANK CHAR +*-------------------------------- +GNNB JSR GNC.UC GET NEXT CHAR IN UPPER CASE + BCS .1 END OF LINE + BEQ GNNB BLANK +.1 RTS RETURN +*-------------------------------- +* GET NEXT CHAR IN UPPER CASE +*-------------------------------- +GNC.UC.START + LDY #0 + STY CHAR.PNTR +GNC.UC JSR GNC GET NEXT CHAR ANY CASE + BEQ .1 SPACE OR + JSR ELIMINATE.CASE MAP LOWER CASE TO UPPER CASE + STA CURRENT.CHAR + CMP #$FF CLEAR CARRY, SET .NE. +.1 RTS +*-------------------------------- +* GET NEXT CHAR +*-------------------------------- +GNC.START + LDY #0 BEGINNING OF LINE + .HS 2C SKIP NEXT TWO BYTES +GNC LDY CHAR.PNTR +GNC2 LDA WBUF,Y GET CHAR + AND #$7F + STA CURRENT.CHAR + BEQ .1 END OF LINE + INY BUMP POINTER + STY CHAR.PNTR + CMP #$20 SEE IF BLANK + CLC CARRY CLEAR SINCE NOT AT END + RTS +.1 LDA #$20 RETURN BLANK + CMP #$20 SET CARRY AND EQUAL STATUS + RTS +*-------------------------------- +* BACK UP CHARACTER POINTER +*-------------------------------- +BACKUP.CHAR.PNTR + PHA SAVE A-REG + LDA CURRENT.CHAR + BEQ .1 DO NOT BACK OFF THE END + LDA CHAR.PNTR + BEQ .1 DO NOT BACK BEYOND THE BEGINNING + DEC CHAR.PNTR +.1 PLA + RTS +*-------------------------------- +* GET NEXT TOKEN FROM SOURCE LINE +*-------------------------------- +NTKN + LDA RPTCNT + BNE .3 IN A REPEATED CHAR LOOP + JSR GNB GET NEXT CHAR FROM SOURCE + ASL ...WEIRD WAY TO TEST SIGN BIT + ROR ...AND AS WELL AS 00 + BPL .4 ...NORMAL CHARACTER + CMP #$C0 SEE IF BLANKS + BCC .1 ...YES + JSR GNBI REPEAT TOKEN $C0 XX YY, GET XX + STA RPTCNT + JSR GNBI GET YY (CHAR TO BE REPEATED) + JMP .2 ...ALWAYS +.1 AND #$3F BLANK COUNT + STA RPTCNT + LDA #$20 BLANK +.2 STA RPTCHR +.3 DEC RPTCNT + LDA RPTCHR +.4 RTS +*-------------------------------- +* GET NEXT BYTE FROM SOURCE +*-------------------------------- +GNB LDY #0 +GNBI + .DO AUXMEM + LDA MACRO.LEVEL + BEQ .0 ...NOT IN A SKELETON + >SYM LDA,SRCP + .HS 2C SKIP OVER LDA (SRCP),Y + .FIN +.0 LDA (SRCP),Y + >INCD SRCP + BIT INFLAG INSIDE BLOCKED .IN? + BVC .3 ...NO + PHA + LDA MACRO.LEVEL + BNE .25 INSIDE A SKELETON + LDA INSAVE+4 REMAINING BYTES IN THIS BLOCK + BNE .2 ...THERE ARE MORE + ORA INSAVE+5 + BEQ .4 ...NO MORE IN THIS BLOCK + DEC INSAVE+5 +.2 DEC INSAVE+4 +.25 PLA +.3 RTS +*---TRY TO READ ANOTHER BLOCK---- +.4 PLA + LDA INSAVE+6 REFNUM OF INB FILE + STA SCI.IOB.RW+1 + LDA PP STARTING ADDRESS + STA SRCP + STA SCI.IOB.RW+2 + LDA PP+1 + STA SRCP+1 + STA SCI.IOB.RW+3 + SEC + LDA HI.MEM+1 NUMBER OF PAGES + SBC PP+1 + STA SCI.IOB.RW+5 + LDA #0 + STA SCI.IOB.RW+4 + LDA #$CA READ + JSR SCI.MLI + BCC .5 ...NO ERRORS + CMP #5 END OF DATA? + BNE PRODOS.ERROR ...ERROR +.5 LDA SCI.IOB.RW+6 + STA INSAVE+4 # BYTES ACTUALLY READ + LDA SCI.IOB.RW+7 + STA INSAVE+5 + BCC GNB ...NOT END OF DATA + LDA INSAVE+6 REFNUM + STA SCI.IOB.CLOSE+1 FOR CLOSE CALL + LDA #$CC + JSR SCI.MLI + BCS PRODOS.ERROR + JSR RESTORE END OF THE INBx FILE + JMP ASM2 +*-------------------------------- +PRODOS.ERROR + PHA + JSR RESTORE.IF.IN.INBX + PLA + JMP SCI.ERROR +*-------------------------------- +* RETURN .CS. IF VALID CHAR +* .CC. IF INVALID CHAR +*-------------------------------- +CHECK.DOT.DIGIT.OR.LETTER + CMP #'. + BEQ CHECKS.OK + CMP #'_' allow underline in symbols too + BEQ CHECKS.OK +CHECK.DIGIT.OR.LETTER + JSR CHECK.DIGIT + BCS CHECKS.OK +CHECK.LETTER + CMP #'A + BCC CHECKS.NOT.OK + CMP #'Z+1 + BCC CHECKS.OK +CHECKS.NOT.OK + CLC + RTS +CHECK.DIGIT + CMP #'0 + BCC CHECKS.NOT.OK + CMP #'9+1 + BCS CHECKS.NOT.OK +CHECKS.OK + SEC + RTS +*-------------------------------- +CHECK.COMMENT.CHAR + CMP #'* STAR? + BEQ .1 YES + CMP #'; SEMI-COLON? +.1 RTS +*-------------------------------- +* INITIALIZE FOR HARD ENTRY +*-------------------------------- +HARD.INIT + CLD +*---Establish LO.MEM & HI.MEM------ + LDA SYMBOL.BASE SET UP LO.MEM + STA LO.MEM+1 + LDA SCI.HIMEM.PAGE + STA HI.MEM+1 + LDA #0 + STA LO.MEM + STA HI.MEM +*---Init other parameters-------- + STA INCREMENT.VALUE+1 + STA PROMPT.FLAG + STA INFLAG + JSR STINIT INITIALIZE SYMBOL TABLE + LDA #10 SET AUTO-LINE-NUMBERING INCREMENT + STA INCREMENT.VALUE + LDA #990 SET AUTO-LINE-NUMBERING + STA CURLNO INITIAL VALUE + LDA /990 + STA CURLNO+1 +*---Print Heading---------------- + JSR IO.INIT INIT TEXT, FULL WINDOW, ETC. + JSR VERSION Print Version Number +*-------------------------------- +EMPTY.SOURCE.AREA + LDA HI.MEM + STA PP EMPTY SOURCE AREA + LDA HI.MEM+1 + STA PP+1 + RTS +*-------------------------------- +Q.VERSION + .DA #VERSION.LO+"0",#".",#VERSION.HI+"0" +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/scmasm.s.edit +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/SCMASM.S.ELINES.txt b/SCMASM.31/SCMASM.S.ELINES.txt new file mode 100644 index 00000000..756d3416 --- /dev/null +++ b/SCMASM.31/SCMASM.S.ELINES.txt @@ -0,0 +1,321 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* EDIT ONE LINE +* TEXT OF LINE ALREADY IN WBUF +* (A1L,A1H) POINT AT LINE IN SOURCE AREA +*-------------------------------- +EDIT.ONE.LINE + LDA BOTTOM.OF.SCREEN + STA ED.BEGLIN + JSR IO.VTAB + JSR E.BEG Start edit 2 columns after line # +.1 STX ED.PNTR + JSR E.DISPLAY.LINE Put line on screen + LDX ED.PNTR Restore PNTR in X + JSR E.PROCESS.CHAR + BCC .1 Not control-L, -M, or -Q + JSR E.DISPLAY.LINE ...One last time + JSR CRLF + JMP NML Submit line and return +*-------------------------------- +* DISPLAY LINE FROM WBUF +*-------------------------------- +E.DISPLAY.LINE + LDA ED.BEGLIN + JSR IO.VTAB + LDA #0 + JSR IO.HTAB + JSR SPC One space + LDX #0 +.1 LDA WBUF,X + BEQ .4 End of line + ORA #$80 + CMP #$A0 Control char? + BCS .2 No + AND #$3F ...YES, MAKE IT INVERSE +.2 PHA + JSR GET.HORIZ.POSN + TAY + PLA + INY + CPY SCREEN.WIDTH + BCC .3 No + LDY CV Last line on screen? + CPY BOTTOM.OF.SCREEN + BCC .3 No + DEC ED.BEGLIN Yes, it will scroll +.3 JSR IO.COUT + INX + BNE .1 ...Always +.4 JMP IO.CLREOP +*-------------------------------- +* PROCESS EDITING CHARACTER +*-------------------------------- +E.PROCESS.CHAR +EPC.1 JSR E.INPUT Get char from keyboard +EPC.2 CMP #$A0 Control char? + BCC E.PROCESS.CNTRL +*-------------------------------- +* PUT CHARACTER INTO LINE +*-------------------------------- +E.PUT.CHARACTER + LDA WBUF,X At end of line? + BNE .1 No + CPX #WBUF.MAX Line too long? + BCS .2 Yes + STA WBUF+1,X Put new +.1 LDA CURRENT.CHAR + STA WBUF,X + INX +.2 CLC + RTS +*-------------------------------- +* PROCESS CONTROL CHAR +*-------------------------------- +E.PROCESS.CNTRL + LDY #CHARS.FOR.EDIT + JMP SEARCH.CHAR.TABLES +*-------------------------------- +E.ILLCHAR + JSR MON.BELL + LDX ED.PNTR Restore X-reg + JMP EPC.1 +*-------------------------------- +* CONTROL-R: RESTORE ORIGINAL LINE +*-------------------------------- +E.RESTORE + LDA A1L Set line pointer back + STA SRCP + LDA A1H + STA SRCP+1 + JSR GET.LINE.TO.WBUF +*-------------------------------- +* CONTROL-B: BEGINNING OF LINE +*-------------------------------- +FIND.START.OF.LINE.IN.WBUF +E.BEG LDY #0 Find 1st column after line number +.1 JSR GNC2 + BCS .2 End of line + JSR CHECK.DIGIT + BCS .1 Yes + INY +.2 TYA Get column # into X + TAX + DEX + CLC + RTS +*-------------------------------- +* CONTROL-D: DELETE CHARACTER +*-------------------------------- +E.DEL LDX ED.PNTR +.1 LDA WBUF,X Are we at the end? + BEQ .3 Yes +.2 INX ADVANCE PNTR + LDA WBUF,X SLIDE REST OF LINE LEFT + STA WBUF-1,X ...to delete char + BNE .2 ...UNTIL END OF LINE +.3 LDX ED.PNTR + CLC + RTS Return with Carry clear +*-------------------------------- +* CONTROL-N: END OF LINE +*-------------------------------- +E.END LDX ED.PNTR + DEX +.1 INX + LDA WBUF,X End of buffer? + BNE .1 ...KEEP LOOKING + CLC + RTS Carry clear +*-------------------------------- +* CONTROL-F: FIND NEXT OCCURRENCE +*-------------------------------- +E.FIND LDX ED.PNTR + LDA WBUF,X End of buffer? + BEQ .3 Yes + JSR E.INPUT Get 1 char + STX ED.FCOL Save beg col + STA ED.FKEY Save key to locate +.1 INX + LDA WBUF,X Text buffer + BEQ .2 End of buffer + ORA #$80 + CMP ED.FKEY No, see if key + BNE .1 No, go forward + STX ED.FCOL Save this col + JSR E.INPUT Try another key + CMP ED.FKEY Same char + BEQ .1 Yes, search again + STX ED.PNTR No, exit pointing here + JMP EPC.2 +.2 LDX ED.FCOL Restore col +.3 JSR MON.BELL Beep + CLC + RTS +*-------------------------------- +* CONTROL-H: BACKSPACE +*-------------------------------- +E.BKSP LDX ED.PNTR + TXA At beginning already? + BEQ .1 Yes, stay there + DEX Backup +.1 CLC + RTS +*-------------------------------- +* CONTROL-O: ALLOW INSERTION OF CONTROL CHAR +*-------------------------------- +E.OVR LDX ED.PNTR + JSR E.INPUT Read char + JMP E.INS1 Skip control check +*-------------------------------- +* CONTROL-I: INSERT CHARACTERS +*-------------------------------- +E.INS LDX ED.PNTR + JSR E.INPUT Read char + CMP #$A0 Control char pops user out + BCS E.INS1 + JMP E.PROCESS.CNTRL +E.INS1 CPX #WBUF.MAX End of block + BEQ .1 Yes, stay there + INC ED.PNTR +.1 PHA Char to insert + LDA WBUF,X Save char to move + TAY + PLA + STA WBUF,X Put over saved char + INX + TYA Insert saved char + BNE .1 If not buffer end + CPX #WBUF.MAX At end? + BCC .2 Not yet + LDX #WBUF.MAX Yes +.2 STA WBUF,X Store end char + JSR E.DISPLAY.LINE + LDX ED.PNTR + BNE E.INS ...Always +*-------------------------------- +* CONTROL-Q: QUIT, DROPPING REST OF LINE +*-------------------------------- +E.RETQ JSR E.ZAP Clear rest of line +*-------------------------------- +* CONTROL-M: QUIT, SUBMITTING WHOLE LINE +*-------------------------------- +E.RET SEC + RTS +*-------------------------------- +* CONTROL-L: SUBMIT THIS LINE, EDIT NEXT LINE +*-------------------------------- +E.DOWN LDA ENDP See if at HI.MEM already + CMP HI.MEM + LDA ENDP+1 + SBC HI.MEM+1 + BCS .1 Yes, no need to move ENDP + JSR CMP.SRCP.ENDP End of range yet? + BCC .1 ...NO + CLC Move ENDP one line + LDY #0 + LDA (SRCP),Y Line length of next line + ADC ENDP + STA ENDP + BCC .1 + INC ENDP+1 +.1 SEC Signal submit line + RTS +*-------------------------------- +* CONTROL-T: SKIP TO NEXT TAB STOP +*-------------------------------- +E.TAB LDX ED.PNTR +.1 JSR E.CHECK.TAB + BCS E.RIT1 MOVE ONE MORE COLUMN + JSR E.RIT1 Move one column right + BCC .1 ...ALWAYS +*-------------------------------- +* CONTROL-U: RIGHT ARROW +*-------------------------------- +E.RIT LDX ED.PNTR +E.RIT1 LDA WBUF,X End of buffer? + BNE .1 No + CPX #WBUF.MAX + BCS .2 + STA WBUF+1,X + LDA #$A0 Put a blank + STA WBUF,X To extend line +.1 INX Move ahead +.2 CLC Return + RTS +*-------------------------------- +* CONTROL-X: ABORT EDIT COMMAND +*-------------------------------- +E.ABORT + JSR E.DISPLAY.LINE + LDA #$DC Backslash + JSR MY.COUT + JMP GNL Get next command +*-------------------------------- +* CONTROL-@: CLEAR TO EOL +*-------------------------------- +E.ZAP LDA #0 EOL mark + LDX ED.PNTR + STA WBUF,X + CLC + RTS Carry clear +*-------------------------------- +* INPUT CHAR WHERE CURSOR SHOULD BE +*-------------------------------- +E.INPUT + LDY ED.BEGLIN + INX + TXA + DEX + DEY + SEC +.1 INY + SBC SCREEN.WIDTH + BCS .1 + ADC SCREEN.WIDTH + JSR IO.HTAB HTAB (A) + TYA + JSR IO.VTAB + JSR READ.KEY.WITH.CASE + STA CURRENT.CHAR + RTS +*-------------------------------- +* DETERMINE IF AT TAB STOP YET +* RETURN .EQ. IF AT A TAB STOP +* .CS. IF PAST LAST TAB STOP +* .CC. IF BEFORE A TAB STOP +*-------------------------------- +E.CHECK.TAB + TXA Column position + CLC + ADC #3 + LDY #0 +.1 CMP TAB.SETTINGS,Y + BCC .2 + BEQ .2 + INY + CPY #5 + BCC .1 +.2 RTS +*-------------------------------- +* CONTROL-I -- CLEAR TO TAB STOP +*-------------------------------- +E.TABI LDX ED.PNTR + LDA #" " + STA CURRENT.CHAR +.1 JSR E.CHECK.TAB + BCS .2 ...REACHED TAB STOP + JSR E.PUT.CHARACTER + BCC .1 ...ALWAYS +.2 JMP E.PUT.CHARACTER One more space +*-------------------------------- +E.TOGGLE + JSR IO.CASE.TOGGLE + CLC + RTS +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/scmasm.s.elines +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/SCMASM.S.EXP.txt b/SCMASM.31/SCMASM.S.EXP.txt new file mode 100644 index 00000000..0cbc6641 --- /dev/null +++ b/SCMASM.31/SCMASM.S.EXP.txt @@ -0,0 +1,414 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* EXPRESSION CRACKER +*------------------------------- +EXPR.DEFINED + JSR EXPR + BMI .1 + RTS +.1 JMP UNDF +*-------------------------------- +OPERATOR.CHARS + .AS "^!|&<=>/*)], " +OPERATOR.CHARS.SIZE .EQ *-OPERATOR.CHARS +*-------------------------------- +OPERATOR.INDEX + .HS 0C.0A.0A.08.0E.10.12.06.04.FF.FF.FF.FF +* ^ ! | & < = > / * ) ] , SPC +*-------------------------------- +OPERATOR.TABLE + .DA EXP.SUBTRACT-1 0 FOR -<=> + .DA EXP.ADD-1 2 FOR + + .DA EXP.MULTIPLY-1 4 FOR * + .DA EXP.DIVIDE-1 6 FOR / + .DA EXP.AND-1 8 FOR & + .DA EXP.ORA-1 A FOR !| + .DA EXP.EOR-1 C FOR ^ + .DA EXP.LESS-1 E FOR < + .DA EXP.EQUAL-1 10 FOR = + .DA EXP.GREATER-1 12 FOR > +*-------------------------------- +ERBA3 JMP ERBA +*-------------------------------- +EXPR JSR GNNB GET NEXT NON-BLANK + BCS ERBA3 NO EXPRESSION ON LINE + JSR BACKUP.CHAR.PNTR +*-------------------------------- +EXP1 JSR ZERO.EXP.VALUE + STA EXP.NEW NEW EXPRESSION FLAG = 0 + STA EXP.UNDEF ZERO UNDEF FLAG + LDX #$40 INIT FWD REF FLAG + STX EXP.FWDREF +*-------------------------------- +EXP2 LDX #0 SET OPERATOR=0 FOR + + JSR GNC.UC + BCS .3 END OF LINE + CMP #'- MINUS + BEQ .6 X=0 FOR MINUS OR RELOPS + LDX #2 X=2 FOR ADDITION + CMP #'+ ADD + BEQ .6 + LDY EXP.NEW NOT + OR - + BEQ .7 BUT IT IS NEW EXPR + LDX #OPERATOR.CHARS.SIZE-1 +.1 LDA OPERATOR.CHARS,X + CMP CURRENT.CHAR + BEQ .2 + DEX + BPL .1 + JMP ERBA +*---FOUND OP OR TERM CHAR-------- +.2 LDA OPERATOR.INDEX,X + BPL .5 ...OPERATOR +*---END OF EXPRESSION----------- + JSR BACKUP.CHAR.PNTR +.3 LDY EXP.UNDEF UNDEF FLAG + BPL .4 + JSR ZERO.EXP.VALUE + TYA RECOVER UNDEF STATUS +.4 RTS +*-------------------------------- +.5 TAX +.6 JSR GNC.UC +.7 INC EXP.NEW NOT A NEW EXPRESSION ANYMORE + LDA OPERATOR.TABLE+1,X + PHA + LDA OPERATOR.TABLE,X + PHA +*------------------------------- +* GET OPERAND +*------------------------------- +GET.OPERAND + JSR ZERO.SYM.VALUE + LDA CURRENT.CHAR + CMP #$30 FIRST CHAR OF OPERAND + BCC .3 PUNCTUATION + CMP #$3A + BCS .2 MIGHT BE LETTER, TRY LABEL + JSR DECN CONVERT DECIMAL NUMBER +.15 JMP BACKUP.CHAR.PNTR +*---TRY A LABEL------------------ +.2 JSR PACK TRY LABEL + BCC .4 NO GOOD + JSR STSRCH LOOK UP THE VALUE + LDY #6 UPDATE FWD REF FLAG + >SYM LDA,STPNTR + AND EXP.FWDREF + STA EXP.FWDREF + BCC .1 DEFINED LABEL + ROR EXP.UNDEF UNDEFINED, MAKE FLAG NEGATIVE +.1 RTS +*---TRY LOCAL LABEL-------------- +.3 CMP #'. + BEQ .2 LOCAL LABEL +*---TRY CONSTANTS---------------- + LDX #3 3-->HEX CONSTANT + CMP #'$ + BEQ .5 HEX CONSTANT + DEX 2-->OCT CONSTANT + CMP #'&' + BEQ .5 ...OCTAL + LDX #0 0-->BIN CONSTANT + CMP #'% BINARY CONSTANT + BEQ .5 ...BINARY +*---TRY LITERALS----------------- + CMP #'' (X = 0) + BEQ .6 LITERAL + CMP #'" LITERAL WITH HIGH BIT SET + BEQ .9 +*---TRY STAR--------------------- + CMP #'* + BNE .4 ...NONE OF THE ABOVE, ERROR + LDX #3 VALUE IS CURRENT LOCATION +.7 LDA ORGN,X + STA SYM.VALUE,X + DEX + BPL .7 + RTS +*---INVALID OPERAND-------------- +.4 JMP ERBA BAD ADDRESS ERROR +*---HEX/OCT/BIN CONSTANT-------- +.5 JSR HEX.OCT.BIN.DGT $ABCD, &777, %1010 + BCC .4 NO, ERROR BAD ADDRESS +.8 JSR HEX.OCT.BIN.DGT.1 GET ANOTHER DIGIT + BCS .8 + BCC .15 ...ALWAYS +*---TICK & QUOTE LITERALS------- +.9 LDX #$80 HIBIT=1 +.6 STX SYM.VALUE + STA DGTCNT SAVE ' OR " FOR OPTIONAL TERMCHAR + JSR GNC GET FOLLOWING CHAR + BCS .4 END OF LINE + ORA SYM.VALUE SET HIGH BIT + STA SYM.VALUE + JSR GNC SEE IF CLOSING QUOTE + CMP DGTCNT (IT IS OPTIONAL) + BNE .15 NO, BACK UP CHAR PNTR + RTS +*------------------------------- +* IF NEXT CHAR IS VALID DIGIT, +* APPEND IT TO CURRENT VALUE +* +* (X) DETERMINES BASE: 0-->2, 2-->8, 3-->16 +*------------------------------- +HEX.DIGIT + LDX #3 +HEX.OCT.BIN.DGT + STX BASE.INDEX +HEX.OCT.BIN.DGT.1 +.1 JSR GNC.UC IGNORE CASE + CMP #'.' ALLOW PERIODS + BEQ .1 ...BUT IGNORE THEM + EOR #$30 + CMP #$0A + BCC .3 ...0-9, TEXT VALIDITY + ADC #$88 ...MIGHT BE A...F +.2 CMP #$FA + BCC .5 NOT A-F EITHER, RETURN CARRY CLEAR + AND #$0F TRIM HEX A...F +.3 LDX BASE.INDEX + CMP BASE.TABLE,X CHECK REAL RANGE + BCS .2 ...NOT VALID, CLR CARRY WITH 'CMP #$FA' + PHA SAVE DIGIT +.4 JSR ASL.SYM.VALUE + DEX MAKE ROOM FOR DIGIT + BPL .4 + PLA GET DIGIT + ORA SYM.VALUE MERGE WITH PREVIOUS + STA SYM.VALUE + SEC FLAG GOT A DIGIT +.5 RTS +*-------------------------------- +BASE.TABLE + .DA #2,#2,#8,#16 +ASL.SYM.VALUE + CLC +ROL.SYM.VALUE + ROL SYM.VALUE + ROL SYM.VALUE+1 + ROL SYM.VALUE+2 + ROL SYM.VALUE+3 + RTS +*-------------------------------- +ZERO.EXP.VALUE + LDA #0 + STA EXP.VALUE + STA EXP.VALUE+1 + STA EXP.VALUE+2 + STA EXP.VALUE+3 + RTS +*-------------------------------- +ZERO.EXP.VALUE64 + LDA #0 + STA EXP.VALUE64 + STA EXP.VALUE64+1 + STA EXP.VALUE64+2 + STA EXP.VALUE64+3 + RTS +*-------------------------------- +ZERO.SYM.VALUE + LDA #0 + STA SYM.VALUE + STA SYM.VALUE+1 + STA SYM.VALUE+2 + STA SYM.VALUE+3 + RTS +*-------------------------------- +EXP.AND + LDX #3 +.1 LDA EXP.VALUE,X + AND SYM.VALUE,X + STA EXP.VALUE,X + DEX + BPL .1 + JMP EXP2 +*-------------------------------- +EXP.ORA + LDX #3 +.1 LDA EXP.VALUE,X + ORA SYM.VALUE,X + STA EXP.VALUE,X + DEX + BPL .1 + JMP EXP2 +*-------------------------------- +EXP.EOR + LDX #3 +.1 LDA EXP.VALUE,X + EOR SYM.VALUE,X + STA EXP.VALUE,X + DEX + BPL .1 + JMP EXP2 +*-------------------------------- +EXP.ADD + CLC PLUS + LDX #-4 +.1 LDA EXP.VALUE+4,X + ADC SYM.VALUE+4,X + STA EXP.VALUE+4,X + INX + BNE .1 + JMP EXP2 +*-------------------------------- +EXP.SUBTRACT + JSR EXP.SUBTRACTION + JMP EXP2 +*-------------------------------- +EXP.SUBTRACTION + SEC + LDX #-4 +.7 LDA EXP.VALUE+4,X + SBC SYM.VALUE+4,X + STA EXP.VALUE+4,X + INX + BNE .7 + RTS +*-------------------------------- +EXP.LESS + JSR EXP.SUBTRACTION + LDA EXP.VALUE+3 + BMI EXP.TRUE +EXP.FALSE + CLC +EXP.TRUE.OR.FALSE + JSR ZERO.EXP.VALUE + ROL EXP.VALUE + JMP EXP2 +*-------------------------------- +EXP.EQUAL + JSR EXP.SUBTRACTION + JSR TEST.EXP.VALUE + BNE EXP.FALSE +EXP.TRUE + SEC + BCS EXP.TRUE.OR.FALSE +*-------------------------------- +TEST.EXP.VALUE.ZP + LDA #0 + .HS 2C +TEST.EXP.VALUE + LDA EXP.VALUE + ORA EXP.VALUE+1 + ORA EXP.VALUE+2 + ORA EXP.VALUE+3 + RTS +*-------------------------------- +EXP.GREATER + JSR EXP.SUBTRACTION + JSR TEST.EXP.VALUE + BEQ EXP.FALSE + LDA EXP.VALUE+3 LOOK AT SIGN BIT + BMI EXP.FALSE + BPL EXP.TRUE +*------------------------------- +EXP.DIVIDE + JSR EXP.DIVISION + JMP EXP2 +*-------------------------------- +EXP.DIVISION + JSR ZERO.EXP.VALUE64 + LDY #32 32 BITS +.1 ASL EXP.VALUE SHIFT DIVIDEND/QUOTIENT LEFT + ROL EXP.VALUE+1 + ROL EXP.VALUE+2 + ROL EXP.VALUE+3 + ROL EXP.VALUE64 SHIFT PARTIAL DIVIDEND LEFT + ROL EXP.VALUE64+1 + ROL EXP.VALUE64+2 + ROL EXP.VALUE64+3 + SEC SUBTRACT DIVISOR FROM PARTIAL DIVIDEND + LDA EXP.VALUE64 + SBC SYM.VALUE + PHA SAVE LO-BYTE OF DIFFERENCE ON STACK + LDA EXP.VALUE64+1 + SBC SYM.VALUE+1 + PHA + LDA EXP.VALUE64+2 + SBC SYM.VALUE+2 + PHA + LDA EXP.VALUE64+3 + SBC SYM.VALUE+3 + BCC .2 REMAINDER TOO SMALL + INC EXP.VALUE SET BIT IN QUOTIENT + STA EXP.VALUE64+3 HI-BYTE OF REMAINDER + PLA RETRIEVE NEXT BYTE OF REMAINDER + STA EXP.VALUE64+2 + PLA + STA EXP.VALUE64+1 + PLA + STA EXP.VALUE64 + BCS .3 +.2 PLA STACK BACK TO NORMAL + PLA + PLA +.3 DEY NEXT BIT + BNE .1 + RTS +*-------------------------------- +EXP.MULTIPLY + JSR ZERO.EXP.VALUE64 + LDY #32 32-BIT MULTIPLY +.1 LDA EXP.VALUE CHECK LSB OF MULTIPLIER + LSR + BCC .2 IF 0, DON'T ADD MULTIPLICAND + CLC ADD MULTIPLICAND + LDA EXP.VALUE64 + ADC SYM.VALUE + STA EXP.VALUE64 + LDA EXP.VALUE64+1 + ADC SYM.VALUE+1 + STA EXP.VALUE64+1 + LDA EXP.VALUE64+2 + ADC SYM.VALUE+2 + STA EXP.VALUE64+2 + LDA EXP.VALUE64+3 + ADC SYM.VALUE+3 + STA EXP.VALUE64+3 +.2 ROR EXP.VALUE64+3 + ROR EXP.VALUE64+2 + ROR EXP.VALUE64+1 + ROR EXP.VALUE64 + ROR EXP.VALUE+3 + ROR EXP.VALUE+2 + ROR EXP.VALUE+1 + ROR EXP.VALUE + DEY + BNE .1 + JMP EXP2 +*------------------------------- +* MGO COMMAND +*------------------------------- +MGO JSR EXPR.DEFINED CRACK EXPRESSION + JMP (EXP.VALUE) ENTER USER'S PROGRAM +*-------------------------------- +* VAL COMMAND +*-------------------------------- +VAL JSR EXPR.DEFINED GET VALUE OF EXPRESSION + LDA #'$' + JSR CHO + JSR P.EXP.VALUE + LDA #'=' + JSR CHO + JSR ZERO.SYM.VALUE + TAX X=0 + LDA #10 + STA SYM.VALUE +.1 JSR EXP.DIVISION + LDA EXP.VALUE64 REMAINDER + PHA + INX + JSR TEST.EXP.VALUE + BNE .1 +.2 PLA + ORA #'0' + JSR CHO + DEX + BNE .2 + JMP CRLF +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/scmasm.s.exp +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/SCMASM.S.FNDREP.txt b/SCMASM.31/SCMASM.S.FNDREP.txt new file mode 100644 index 00000000..44922dcb --- /dev/null +++ b/SCMASM.31/SCMASM.S.FNDREP.txt @@ -0,0 +1,407 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* FIND AND LIST COMMANDS +*-------------------------------- +LIST +FIND JSR GET.KEY.STRING + JSR PARSE.LINE.RANGE + JSR HANDLE.REPLACE.OPTIONS +.1 JSR GET.LINE.TO.WBUF + BCC .2 + RTS +.2 JSR FIND.KEY.IN.WBUF + BCC .1 KEY NOT IN WBUF + LDA A1L SET UP POINTER FOR LIST + LDX A1H + JSR LIST.LINE.AX + JMP .1 +*-------------------------------- +* PARSE INTO FREE MEMORY +*-------------------------------- +GET.KEY.STRING + LDA #KBUF + STA KEY.ADDR + LDA /KBUF + STA KEY.ADDR+1 +GET.KEY2 + JSR GNNB GET NEXT NON-BLANK + STA DLIM FOR DELIMITER + BCS .4 EOL + CMP #', + BEQ .4 COMMA + CMP #'. PERIOD + BEQ .4 + EOR #$30 + CMP #10 + BCC .4 DIGIT + LDY #0 +.1 STY PNTR + JSR GNC MOVE STRING + BCS .2 END OF LINE + CMP DLIM + BEQ .2 END OF STRING + LDY PNTR + STA (KEY.ADDR),Y + INY + CPY #39 SEE IF STRING FITS + BCC .1 YES, KEEP GOING + LDY #QSTRLNG NO, STRING TOO LONG + JMP HARD.ERROR +.2 LDY PNTR + LDA #0 + STA (KEY.ADDR),Y + SEC WE FOUND IT + RTS +.4 LDA #0 + STA PNTR + CLC DIDN'T FIND IT + JMP BACKUP.CHAR.PNTR +*-------------------------------- +* GET NEXT LINE INTO WBUF +* RETURN CARRY CLEAR IF SUCCESSFUL +* CARRY SET IF BEYOND +* X = LENGTH OF LINE +*-------------------------------- +GET.LINE.TO.WBUF + LDA SRCP + STA A1L SAVE POINTER FOR LIST + LDA SRCP+1 + STA A1H + JSR CMP.SRCP.ENDP END OF RANGE YET? + BCS .2 ...YES, FINISHED + JSR GET.LINE.NUMBER + LDY #0 START AT BEGINNING OF WBUF + JSR CONVERT.LINE.NUMBER.STORE PUT CONVERTED # AT WBUF,Y + LDA #$A0 APPEND A SPACE AFTER LINE NUMBER + STA WBUF,Y + INY + TYA + TAX +.1 JSR NTKN BYTE FROM PROGRAM + STA WBUF,X + INX + TAY TEST CHAR + BNE .1 END OF LINE + CLC FLAG SUCCESSFUL +.2 RTS +*-------------------------------- +* LIST LINE POINTED TO BY +*-------------------------------- +LIST.LINE.AX + STA SRCP + STX SRCP+1 +*-------------------------------- +LIST.CURRENT.LINE + JSR CRLF PRINT CARRIAGE RETURN + JSR SPC SPACE + LDA PROMPT.FLAG + BEQ .1 ...NO SPACE SINCE NOT "H" + JSR SPC +.1 JSR GET.LINE.NUMBER BODY + JSR CONVERT.LINE.NUMBER.PRINT + LDA #$20 SPACE +.2 JSR CHO PRINT CHAR + JSR GET.NEXT.SOURCE.CHAR + BNE .2 NOT END YET + RTS FINISHED +*-------------------------------- +* FIND KEY IN WBUF +* RETURN WITH CARRY CLEAR IF NO MATCH. +* RETURN WITH CARRY SET IF MATCH, AND WITH +* (PNTR) = INDEX OF START OF MATCH +* (X) = INDEX OF LAST CHAR MATCHED + 1 +*-------------------------------- +FIND.KEY.IN.WBUF + JSR FIND.START.OF.LINE.IN.WBUF + LDA PNTR + BNE .1 NON-NULL KEY STRING + LDA DLIM If delimiter is slash, list + CMP #'/' only major labels + BEQ .3 ...it is + SEC ...no string, so SIGNAL MATCH + RTS +.3 LDA WBUF,X GET FIRST CHAR + JSR ELIMINATE.CASE + JMP CHECK.LETTER +.1 LDY #39 MAP SEARCH KEY INTO UPPER CASE +.2 LDA (KEY.ADDR),Y ...IF LC.FLAG IS ON + JSR ELIMINATE.CASE.MAYBE + STA (KEY.ADDR),Y + DEY + BPL .2 +FIND.KEY.IN.WBUF2 + LDY #0 START AT FIRST CHAR OF KEY +.1 STY KEY.PNTR CURRENT STARTING POINT IN KEY +.2 STX BUF.PNTR CURRENT STARTING POINT IN BUFFER +.3 LDA (KEY.ADDR),Y NEXT CHAR FROM KEY + BEQ .6 END OF KEY, IT MATCHES + CMP WILD.CARD NORMALLY CONTROL-W + BEQ .8 YES + LDA WBUF,X NEXT CHAR FROM BUFFER + BEQ .5 END OF BUFFER, DID NOT MATCH + JSR ELIMINATE.CASE.MAYBE MAP INTO UPPER CASE IS NEEDED + CMP (KEY.ADDR),Y COMPARE WITH KEY CHAR + BNE .4 NO MATCH + INY ADVANCE KEY POINTER + INX ADVANCE BUFFER POINTER + BNE .3 ...ALWAYS +*-------------------------------- +.4 LDY KEY.PNTR TRY AGAIN FURTHER INTO BUFFER + LDX BUF.PNTR + INX + BNE .2 ...ALWAYS +*-------------------------------- +.5 LDA $C000 + CMP #$8D ALLOW 'ABORT' WITH + BEQ .11 + CLC SIGNAL NO MATCH + RTS +*-------------------------------- +.6 LDA KEY.PNTR SEE IF IN FIRST SEGMENT OF KEY + BNE .7 NO + LDA BUF.PNTR YES + STA PNTR +.7 SEC SIGNAL MATCH + RTS +*-------------------------------- +.8 LDA KEY.PNTR SEE IF IN FIRST SEGMENT OF KEY + BNE .9 NO + LDA BUF.PNTR YES + STA PNTR +.9 INY ADVANCE KEY POINTER + LDA (KEY.ADDR),Y PEEK AT NEXT CHAR OF KEY + BNE .1 NOT AT END YET +.10 LDA WBUF,X AT END, SO SCAN TO END OF BUFFER + BEQ .6 FOUND END, AND ALL MATCHES + INX ADVANCE BUFFER POINTER + BNE .10 ...ALWAYS +*-------------------------------- +.11 JMP SOFT HE ABORTED +*-------------------------------- +* REPLACE COMMAND +*-------------------------------- +REPLACE + JSR GET.KEY.STRING + BCC R.ERR1 (SYN ERROR) + LDA PNTR NULL SEARCH FAILS + BEQ R.ERR1 + JSR BACKUP.CHAR.PNTR USE DELIMITER OVER AGAIN + LDA #KBUF+40 + STA KEY.ADDR + LDA /KBUF+40 + STA KEY.ADDR+1 SET UP CALL + JSR GET.KEY2 + BCC R.ERR1 (SYN ERROR) + STY REPLACE.LENGTH + JSR PARSE.LINE.RANGE + JSR HANDLE.REPLACE.OPTIONS + LDA #KBUF FOR SEARCH + STA KEY.ADDR + LDA /KBUF + STA KEY.ADDR+1 + LDA #1 + STA PNTR PNTR MUST BE > 0 FOR SEARCH +.1 JSR GET.LINE.TO.WBUF + BCS .5 FINISHED + STX WBUF.LENGTH + JSR FIND.KEY.IN.WBUF + BCC .1 + LDA #0 + STA CHANGE.CNT (DEF IS EQ) +.2 TXA COMPUTE # CHARS IN TARGET FIELD + SEC + SBC PNTR + STA SOURCE.LENGTH + STX MATCH.END + JSR REPLACE.REPLACE + BCS .5 NEITHER "Y" NOR "N" + BNE .3 THEY HIT 'N' + INC CHANGE.CNT + LDX MATCH.END + BNE .4 ...ALWAYS +.3 LDX PNTR MATCH BEGINNING + INX +1 +.4 JSR FIND.KEY.IN.WBUF2 + BCS .2 LOOP IF ANOTHER + LDA CHANGE.CNT ANY CHANGES? + BEQ .1 NO - TRY NEXT LINE + JSR NML PUT LINE BACK + LDA WBUF If replacement line was null, + BEQ .6 then just lshow line number + LDA LINE.END AND LIST + LDX LINE.END+1 + JSR LIST.LINE.AX + JMP .1 TRY NEXT LINE +.5 RTS FINISHED +.6 LDA WBUF+1 + STA CURRENT.LINE.NUMBER + LDA WBUF+2 + STA CURRENT.LINE.NUMBER+1 + JSR CRLF + JSR CONVERT.LINE.NUMBER.PRINT + JMP .1 +*-------------------------------- +R.ERR1 JMP SYNX MISSING STRING +R.ERR2 LDY #QREPLNG REP STRNG TOO LONG + JMP HARD.ERROR +*-------------------------------- +* A MATCH IS FOUND, MAYBE REPLACE +* RETURNS: CARRY ZERO +* Q CS NE QUIT +* N CC NE NO CHG +* Y CC EQ CHANGE MADE +*-------------------------------- +REPLACE.REPLACE + LDA AUTO.FLAG + BMI .40 - = AUTO MODE, + = VERIFY MODE + JSR PRINT.AND.PROMPT + BNE .99 Q,N EXITS +.40 SEC + LDA REPLACE.LENGTH + SBC SOURCE.LENGTH + BCC .60 (IF SHORTER) + BEQ .50 (IF EQUAL ) +*-------------------------------- +* REPLACE IS LONGER - MAKE SPACE +* ACC IS REP.LEN-SRC.LEN +*-------------------------------- + CLC + ADC WBUF.LENGTH + BCS .45 OVER 256 LEN + CMP #WBUF.MAX + BCC .51 +.45 JMP R.ERR2 TOO LONG ERR +.51 TAX + LDY WBUF.LENGTH + STX WBUF.LENGTH (RESET IT) +.52 LDA WBUF,Y + STA WBUF,X + DEX + DEY + CPY MATCH.END + BCS .52 + INX + STX MATCH.END +*-------------------------------- +* MOVE STRING INTO GAP +*-------------------------------- +.50 LDX PNTR MOVE REPLACEMENT STRING INTO GAP + LDY #0 POINT AT REPLACEMENT STRING +.55 LDA KBUF+40,Y NEXT CHAR FROM REP. STRING + BEQ .57 END OF REP. STRING + STA WBUF,X STORE IN GAP + INX + INY + BNE .55 ...ALWAYS +.57 CLC SIGNAL SUCCESS + LDA #0 (CC,EQ) +.99 RTS +*-------------------------------- +* REPLACE IS SHORTER - REMOVE EXTRA +*-------------------------------- +.60 LDA PNTR + ADC REPLACE.LENGTH + TAX + LDY MATCH.END + STX MATCH.END (RESET IT) +.1 LDA WBUF,Y + STA WBUF,X + INY + INX + CPX WBUF.LENGTH + BCC .1 + STX WBUF.LENGTH (RESET THIS TOO) + BCS .50 ...ALWAYS +*-------------------------------- +* PRINT LINE AND GET Y,N,Q +* RETURNS: CARRY ZERO +* Q CS NE +* N CC NE +* Y CS EQ +*-------------------------------- +PRINT.AND.PROMPT + JSR P.RETURN PRINT + LDX #0 +.1 LDA WBUF,X + BEQ .4 EOL? + ORA #$80 + CMP #$A0 SKIP CONTROL + BCC .3 + CPX PNTR + BCC .2 + CPX MATCH.END + BCS .2 + JSR ELIMINATE.CASE + AND #$3F ...DISPLAY IN INVERSE +.2 JSR IO.COUT +.3 INX + BNE .1 NEXT CHAR +.4 JSR MON.CLREOL + LDY #QREPPRMT PRINT "REPLACE? " +YES.OR.NO + JSR QT.OUT + JSR READ.KEY.WITH.CASE + CMP #$A0 CONTROL CHAR? + BCC .2 ...YES, DO NOT ECHO + JSR MY.COUT + AND #$DF NOW IGNORE CASE +.2 CMP #'N+$80 NO: RETURN CC, NE + BEQ .1 ..."N" + CMP #'Y+$80 YES: RETURN CS, EQ + SEC NEITHER: CS, NE + RTS +.1 LSR WAS = N = $CE, SO CLEAR CARRY, SET NE + RTS +*-------------------------------- +* SET FLAGS FROM CHAR IN ACC +* CHAR FLAG MEANING +* "A" AUTO.FLAG +=VERIFY, -=AUTO +* "U" LC.FLAG +=AS TYPED, -=ACCEPT EITHER CASE +* +* RETURN CS -> VALID OPTION +* CC -> NOT AN OPTION +*-------------------------------- +HANDLE.REPLACE.OPTIONS + LSR AUTO.FLAG +=VERIFY MODE + LSR LC.FLAG +=CASE AS TYPED +.1 JSR GNNB GET NEXT BYTE FROM INPUT LINE + BCS .3 END OF LINE + JSR ELIMINATE.CASE MAP LOWER TO UPPER + CMP #'A AUTO MODE? + BNE .2 NO + ROR AUTO.FLAG YES, SET SIGN BIT FROM CARRY +.2 CMP #'U ACCEPT BOTH CASES? + BNE .1 NO + ROR LC.FLAG YES, SET SIGN BIT FROM CARRY + BNE .1 ...ALWAYS +.3 RTS +*-------------------------------- +* MAP LOWER CASE INTO UPPER CASE +*-------------------------------- +ELIMINATE.CASE.MAYBE + BIT LC.FLAG + BPL LCUC3 DON'T DO IT +ELIMINATE.CASE + PHA SAVE ORIGINAL CHAR + ORA #$80 MAKE CANONICAL FORM + CMP #$E0 IN LOWER CASE REGION? + PLA RESTORE ORIGINAL CHAR + BCC LCUC3 ...NOT LOWER CASE REGION + AND #$DF ...LC, MAP TO UPPER CASE +LCUC3 RTS +*-------------------------------- +* LOAD CURRENT LINE NUMBER FROM SRCP +*-------------------------------- +GET.LINE.NUMBER + JSR GNB SKIP LENGTH + JSR GNB GET LINE NUMBER + STA CURRENT.LINE.NUMBER + JSR GNB + STA CURRENT.LINE.NUMBER+1 + RTS +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/scmasm.s.fndrep +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/SCMASM.S.IOSTD.txt b/SCMASM.31/SCMASM.S.IOSTD.txt new file mode 100644 index 00000000..60437afc --- /dev/null +++ b/SCMASM.31/SCMASM.S.IOSTD.txt @@ -0,0 +1,115 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* I/O VECTORS -- 3 BYTES EACH +*-------------------------------- +IO.INIT JMP S.IO.INIT +IO.WARM JMP S.IO.WARM +READ.KEY.WITH.CASE JMP S.READ.KEY.WITH.CASE +GET.HORIZ.POSN LDA CH + RTS +IO.HOME JMP MON.HOME +IO.CLREOL JMP MON.CLREOL +IO.CLREOP JMP MON.CLREOP +IO.UP JMP MON.UP +IO.DOWN JMP MON.LF +IO.LEFT JMP MON.BS +IO.RIGHT JMP MON.ADVANC +IO.COUT JMP MON.COUT +IO.PICK.SCREEN LDA (BASL),Y + RTS +IO.HTABX STX CH + RTS +IO.HTAB STA CH + RTS +IO.VTAB JMP S.IO.VTAB +IO.CASE.TOGGLE LDA LC.MODE + EOR #$FF + STA LC.MODE + RTS +*-------------------------------- +* VARIABLE LENGTH ROUTINES +* (ENTERED THROUGH VECTORS) +*-------------------------------- +S.IO.VTAB + STA CV + JMP MON.VTAB +*-------------------------------- +S.IO.INIT + LDA #40 + STA SCREEN.WIDTH + JSR MON.SETKBD + JSR MON.SETVID + JSR MON.INIT + JMP MON.HOME +*-------------------------------- +S.IO.WARM + CLD + LDX CV + JSR MON.INIT + STX CV + STX LC.MODE POSITIVE VALUE + JSR MON.VTAB + RTS +*-------------------------------- +* READ KEY WITH CASE CONTROL +*-------------------------------- +S.READ.KEY.WITH.CASE + LDA $BE43 See if "EXEC" in progress + BMI .1 ...Yes, use straight input + LDA LC.MODE + BMI .2 Yes, use fancy translation +.1 JSR MON.RDKEY + ORA #$80 Make sure it looks right + CLC SIGNAL "NO OPEN APPLE PRESSED" + RTS +*-------------------------------- +.2 + LDY CH Set up cursor + LDA (BASL),Y Char from screen + PHA + CMP #$E0 ELIMINATE CASE + BCC .25 + AND #$DF +.25 AND #$3F Make it flash + ORA #$40 + STA (BASL),Y + PLA + JSR MON.READCH + BIT $C063 Shift key down? + BPL .4 Yes + CMP #$C0 No, lower case if letter + BCC .3 + ORA #$20 + CLC SIGNAL "NO OPEN APPLE PRESSED" +.3 RTS +*-------------------------------- +.4 CMP #$C0 Shift key down + BCC .8 Not a letter key + BEQ .7 Shift-P + CMP #$DD Shift-M + BEQ .5 Yes + CMP #$DE Shift-N + BNE .6 No +.5 AND #$EF Make capital-M or -N +.6 CLC SIGNAL "NO OPEN APPLE PRESSED" + RTS +*-------------------------------- +.7 LDA #$D0 Make capital-P + CLC SIGNAL "NO OPEN APPLE PRESSED" + RTS +*-------------------------------- +.8 CMP #$87 Look for control-shift-A thru -F + BCS .10 No + CMP #$81 Control-A + BCC .10 No, control-P + BNE .9 No, control-B thru -F + LDA #$C0-$58-1 Control-shift-A = at-sign (@) +.9 ADC #$58 +.10 CLC SIGNAL "NO OPEN APPLE PRESSED" + RTS +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/scmasm.s.iostd +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/SCMASM.S.LDR.txt b/SCMASM.31/SCMASM.S.LDR.txt new file mode 100644 index 00000000..d2ecf079 --- /dev/null +++ b/SCMASM.31/SCMASM.S.LDR.txt @@ -0,0 +1,222 @@ +NEW + AUTO 3,1 +*-------------------------------------- +SPTR .EQ $00 +DPTR .EQ $02 +*-------------------------------- +MLI.UNIT .EQ $BF30 +MLI.BITMAP .EQ $BF58 +MLI.PREFIX.FLAG .EQ $BF9A +*-------------------------------- +MON.CROUT .EQ $FD8E +SETNORM .EQ $FE84 +*-------------------------------- +* sys file execution +* --------- --------- +* 2000-21FF LOADER +* 2200-4AFF 8000-A8FF S-C MACRO ASSEMBLER with 40-col driver +* A900-A9FF additional space for longer drivers +* 4B00-5FFF AA00-BEFF S-C ProDOS Interface +* 6000-60FF A800-A8FF //E 80-COLUMN DRIVER +* 6100-61FF A800-A8FF STB80 DRIVER +* 6200-63FF A800-A9FF VIDEX VIDEOTERM DRIVER +* 6400-65FF A800-A9FF VIDEX ULTRATERM DRIVER +* 6600-71FF D400-DFFF ASM PARTICULAR +*-------------------------------- +* BLOAD SCASM (loader and Macro and 40-col driver) +* BLOAD B.SCI (ProDOS Interpreter) +* BLOAD B.IO.TWO.E (//E 80-COLUMN DRIVER) +* BLOAD B.IO.STB80 +* BLOAD B.IO.VIDEX +* BLOAD B.IO.ULTRA +* BSAVE SCASM.SYS,A$2000,L$4600 +*-------------------------------- + .MA MOVE + LDA /]1 DESTINATION + LDY /]2 SOURCE BEGINNING + LDX /]3-]2+255 # PAGES + JSR MOVE + .EM +*-------------------------------- +STARTUP.SC.MACRO + JMP LOAD.SC +*-------------------------------- +DRIVER.FLAG .HS 00 +*-------------------------------- +LOAD.SC + JSR SELECT.DRIVER + >MOVE $AA00,$4B00,$5FFF + >MOVE $8000,$2200,$4AFF + LDA $C083 + LDA $C083 + >MOVE $D400,$6600,$71FF + LDA $C082 + JSR LOAD.DRIVER +*-------------------------------- +*---GET SCREEN TO NORMAL 40------ +* LDA #$15 CTRL-U, TURNS OFF 80-COLUMN +* JSR MON.COUT +* JSR SETNORM +* JSR MON.INIT +* JSR MON.HOME +*---ESTABLISH RAM BITMAP--------- + LDX #BITMAP.SIZE-1 +.2 LDA MY.BITMAP,X + STA MLI.BITMAP,X + DEX + BPL .2 +*---BUILD $3D0-3FF--------------- + LDX #5 +.3 LDA IMAGE.3D0,X + STA $3D0,X + DEX + BPL .3 + LDX #10 +.4 LDA IMAGE.3F0,X + STA $3F0,X + DEX + BPL .4 +*---Establish HIMEM page--------- + LDA #$74 + STA SCI.HIMEM.PAGE + STA SCI.BUFFER.PAGES+2 EXEC BUFFER + CLC + ADC #4 + STA SCI.BUFFER.PAGES BUF 0 + ADC #4 + STA SCI.BUFFER.PAGES+1 BUF 1 +*---SET A NULL PREFIX------------ + LDA #0 + STA MLI.PREFIX.FLAG +*---SET SLOT/DRIVE DEFAULTS------ + LDA MLI.UNIT + LSR + LSR + LSR + LSR + CMP #$08 + AND #$07 + STA SCI.SLOT + LDA #1 + ADC #0 + STA SCI.DRIVE +*-------------------------------- +IIGS SEC + JSR $FE1F + BCS .2 ...NOT IIGS +*-------------------------------- + LDY #GS.NUM-1 +.1 LDA GS.NEW,Y + STA FAKE.MONITOR,Y + DEY + BPL .1 +*---START UP ProDOS-------------- +.2 JMP $8000 +*-------------------------------- +GS.NEW LDA #" " COVER UP THE DOLLAR SIGN + STA WBUF + LDA WBUF-1,X LOOK FOR "HEXNUM=" COMMAND + CMP #"=" + BEQ .1 ...YES, DON'T APPEND " Q" + LDA #" " + STA WBUF,X APPEND " Q" + LDA #"Q" + STA WBUF+1,X +.1 JMP $FF70 +GS.NUM .EQ *-GS.NEW +*-------------------------------- +IMAGE.3D0 + JMP SCI.STARTUP $3D0 + JMP SCI.STARTUP $3D3 +IMAGE.3F0 + .DA $FA59 'BRK' VECTOR + .DA SCI.STARTUP,#$BE^$A5 RESET VECTOR + JMP SCI.RTS &-VECTOR + JMP SCI.RTS Y-VECTOR +*-------------------------------- +MY.BITMAP + .HS C3.00.00.00.00.00.00.00 0000-3FFF + .HS 00.00.00.00.00.00.00.00 4000-7FFF + .HS FF.FF.FF.FF.FF.FF.FF.F3 8000-BFFF +BITMAP.SIZE .EQ *-MY.BITMAP +*-------------------------------- +SELECT.DRIVER + LDY DRIVER.FLAG + BNE .3 ...LOAD SPECIFIC DRIVER + LDA $FBB3 + CMP #6 + BEQ .3 ...//E OR //C, USE //E DRIVER +*---Display menu----------------- + JSR MON.HOME + LDY #0 +.1 LDA MENU,Y + BEQ .2 + JSR MON.COUT + INY + BNE .1 +*---Get choice------------------- +.2 JSR MON.RDKEY + EOR #$B0 + BEQ .2 + CMP #5 + BCS .2 + TAY + ORA #$B0 + JSR MON.COUT + JSR MON.CROUT +*---(Y) is selected driver------- +.3 STY DRIVER.FLAG + RTS +*-------------------------------- +LOAD.DRIVER + LDY DRIVER.FLAG + LDA DRIVER.ADDRS,Y + BEQ .4 ...40-COLUMN, RETURN NOW + TAY + LDA /$A800 + LDX #2 + JSR MOVE +.4 RTS +*-------------------------------- +* MOVE (X) PAGES FROM YY00 TO AA00 +*-------------------------------- +MOVE + STA DPTR+1 + STY SPTR+1 + LDY #0 + STY DPTR + STY SPTR +.1 LDA (SPTR),Y + STA (DPTR),Y + INY + BNE .1 + INC SPTR+1 + INC DPTR+1 + DEX + BNE .1 + RTS +*-------------------------------- +DRIVER.ADDRS + .HS 60...00...62...64...61 +* //E 40 VID ULT STB +*-------------------------------- +MENU + .AS -/S-C MACRO ASSEMBLER 2.0 (PRODOS)/ + .HS 8D8D + .AS -/1 -- STANDARD 40-COLUMN/ + .HS 8D + .AS -/2 -- VIDEX VIDEOTERM/ + .HS 8D + .AS -/3 -- VIDEX ULTRATERM/ + .HS 8D + .AS -/4 -- STB-80/ + .HS 8D8D + .AS -/WHICH? / + .HS 00 +*-------------------------------- + .AS /<<>>/ +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/scmasm.s.ldr +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/SCMASM.S.MACRO.txt b/SCMASM.31/SCMASM.S.MACRO.txt new file mode 100644 index 00000000..ab785fd3 --- /dev/null +++ b/SCMASM.31/SCMASM.S.MACRO.txt @@ -0,0 +1,370 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* .MA DIRECTIVE +*-------------------------------- +PSMA LDA PASS WHICH PASS? + BNE .2 PASS 2, SO SET FLAG AND IGNORE + LDA #'Z+1 RIGHT BRACKET CODE + STA SYMBOL+7 + LDA #0 CLEAR VALUE BYTES + LDX #3 +.1 STA SYMBOL+2,X + DEX + BPL .1 + JSR GNNB GET FIRST CHAR OF MACRO NAME + LDX #1 + JSR PACK.NAME + CPX #2 NEED AT LEAST TWO CHARS, COUNTING BRACKET + BCC .3 NO MACRO NAME + STX SYMBOL+6 LENGTH + JSR STSRCH + BCC .4 DOUBLE DEFN + JSR STADD ENTER INTO SYMBOL TABLE +.2 SEC SET "INSIDE MACRO DEFINITION" FLAG + ROR FLAG.MA + RTS RETURN TO MAIN LEVEL OF ASM +.3 LDY #QNONAM NO MACRO NAME + .HS 2C SKIP NEXT TWO BYTES +.4 LDY #QER4 EXTRA DEF'N + JMP FIRM.ERROR +*-------------------------------- +* PACK MACRO LINE +*-------------------------------- +PACK.MACRO.LINE + JSR SCAN.TO.OPCODE + LDX FLAG.MA IN A MACRO DEF'N? + BPL D.SET ...NO, TRY .SE DIRECTIVE + LDX PASS WHICH PASS? + BNE .10 PASS 2 +*---PASS 1----------------------- + BCS .4 ...OPCODE IS NOT A DIRECTIVE + LDX #DIR.QT.MA + JSR DIR.SCAN.OR.FAIL + BCC .2 NOT .MA +.1 LDY #QER2 "BAD OPCODE" + JMP SOFT.ERROR +.2 JSR DIR.SCAN.OR.FAIL + BCC .3 NOT .EM + LDA #0 TERMINATE THE SKELETON + STA CURRENT.MAJOR.LABEL+1 KILL POSSIBILITY OF LOCAL LABELS +* UNTIL ANOTHER MAJOR LABEL + JSR ADD.CHAR.TO.SKELETON +.11 LSR FLAG.MA +.12 SEC + RTS +*-------------------------------- +.3 JSR DIR.SCAN.OR.FAIL SEE IF .IN + BCS .1 YES, SO ILLEGAL! +* FALL INTO ACCEPTABLE LINE CODE +*-------------------------------- +.4 LDY #0 BACK TO BEGINNING OF LINE + BEQ .5 ...ALWAYS +.55 LDX #$80 COMPRESSED BLANK TOKEN +.6 INX COUNT THE BLANK + CPX #$BF MAX BLANK COUNT? + BCS .7 YES, OUTPUT TOKEN NOW + JSR GNC2 GET NEXT CHARACTER + BCS .7 END OF LINE + BEQ .6 BLANK, SO COMPRESS IT + DEY NON-BLANK, SO BACK UP PNTR +.7 TXA COMPRESSED BLANK TOKEN +.8 JSR ADD.CHAR.TO.SKELETON +.5 JSR GNC2 GET NEXT CHARACTER + BCS .9 END OF LINE + BEQ .55 ...it is a blank + CMP #']' MACRO PARAMETER? + BNE .8 ...NO + TAX save ']' in X + JSR GNC2 GET PARAMETER CODE + BCS .7 ...eol, add ']' and end + CMP #']' + BEQ .8 ...two makes one + CMP #'#' + BEQ .81 ...]# is valid parameter + CMP #'9'+1 HOW ABOUT 1...9 + BCS .82 ...not a parameter + CMP #'1' + BCC .82 ...not a parameter +.81 LDX #$7F valid parameter +.82 DEY back up char pntr + JMP .7 go add $7F or ']' +*-------------------------------- +.9 LDA #0 TERMINATE THE LINE + JSR ADD.CHAR.TO.SKELETON + SEC + RTS +*---PASS 2----------------------- +* IF NOT ".EM", JUST LIST THE LINE +.10 BCS .12 ...OPCODE IS NOT A DIRECTIVE + LDX #DIR.QT.EM + JSR DIR.SCAN.OR.FAIL + BCC .12 NOT .EM + BCS .11 ...ALWAYS +*-------------------------------- +* .SET DIRECTIVE +*-------------------------------- +D.SET + BCS .1 NOT A DIRECTIVE + LDX #DIR.QT.SE + JSR DIR.SCAN.OR.FAIL + BCS .2 FOUND .SE +.1 CLC + RTS +.2 JSR EXPR.DEFINED GET VALUE + JSR GNC.UC.START CHECK FOR VALID LABEL + BEQ .6 ...NO LABEL ERROR + JSR CHECK.LETTER MUST BE NORMAL LABEL + BCC .7 ...DOES NOT START WITH A-Z + JSR PACK + BCC .7 ...BAD SYMBOL + JSR STSRCH + BCC .3 ...IN TABLE ALREADY + LDA SYMBOL+7 + ORA #$80 + STA SYMBOL+7 SET THE .SE FLAG + JSR STADD + JMP .4 +.3 LDY #7 CK .SE FLAG + >SYM LDA,TPTR + BPL .9 DOUBLE DEF IF NOT SET! + LDA TPTR USE SAME PTR AS STADD + STA PNTR + LDA TPTR+1 + STA PNTR+1 + LDA PASS HANDLE FORWARD REFERENCES + BEQ .5 ...IN PASS ONE + DEY POINT AT FLAGS + >SYM LDA,PNTR + ORA #$40 + >SYM STA,PNTR +.4 JSR P.EXP.VALUE.DASH (IF LISTING) +.5 LDY #2 PUT VALUE IN SYMBOL TABLE +.8 LDA EXP.VALUE-2,Y + >SYM STA,PNTR + INY + CPY #6 + BCC .8 + RTS RETURN TO ASM WITH .CS. +.6 JMP NOLBLERR +.7 JMP ERR.BS +.9 JMP ERR.DBLDF +*-------------------------------- +* ADD CHARACTER TO SKELETON +*-------------------------------- +ADD.CHAR.TO.SKELETON + PHA SAVE CHAR + .DO AUXMEM + LDA EOT+1 + CMP /$C000 + BCC .1 + JMP MFER MEM FULL ERROR +.1 STA WRAUX + LDX #0 + PLA + STA (EOT,X) + STA WRMAIN + .ELSE + LDA EOT + CMP PP + LDA EOT+1 + SBC PP+1 + BCC .1 ROOM + JMP MFER MEM FULL ERROR +.1 LDX #0 + PLA + STA (EOT,X) + .FIN + >INCD EOT + RTS +*-------------------------------- +* SCAN TO OPCODE +*-------------------------------- +SCAN.TO.OPCODE + JSR GNC.START GET FIRST CHAR + BEQ .2 ...BLANK OR END + JSR CHECK.COMMENT.CHAR + BEQ .3 ...YES, IT IS A COMMENT +.1 JSR GNC SCAN TO A BLANK + BNE .1 ...NOT BLANK YET +.2 JSR GNNB SCAN TO NON-BLANK + BCS .3 ...END OF LINE + CMP #'.' DIRECTIVE? + BNE .3 ...NO + JSR GNC.UC GET NEXT BYTE + CLC SIGNAL IT IS A DIRECTIVE + RTS +.3 SEC SIGNAL IT IS NOT A DIRECTIVE + RTS +*-------------------------------- +* PROCESS MACRO CALL +*-------------------------------- +MACER1 LDY #QNONAM + .HS 2C +MACER2 LDY #QERR.MACRO + JMP SOFT.ERROR +*-------------------------------- +MACRO.CALL + LDA #'Z+1 MACRO KEY IN SYMBOL TABLE + STA SYMBOL+7 + LDX #1 + JSR GNC.UC GET FIRST CHAR OF MACRO NAME + JSR PACK.NAME + CPX #2 + BCC MACER1 ERROR, NO NAME + STX SYMBOL+6 LENGTH OF NAME + JSR STSRCH + BCS MACER2 ERROR, NO SUCH MACRO + JSR P.ORIGIN + JSR LIST.SOURCE.IF.LISTING + JSR GNNB SCAN TO PARAMETER LIST + JSR BACKUP.CHAR.PNTR + LDA MACSTK+1 SAVE PNTR FOR LATER + PHA + LDA MACSTK + PHA + LDX #0 PROCESS PARAMETER LIST + LDA #9 FIND 9 PARAMETERS + STA PARAM.CNT +.1 JSR GET.ONE.PARAMETER + DEC PARAM.CNT + BNE .1 +.2 LDA WBUF-1,X + JSR PUSH.MACSTK + DEX + BNE .2 + PLA PUT OLD MACSTK PNTR ON MACRO STACK + JSR PUSH.MACSTK (LOW BYTE) + PLA + JSR PUSH.MACSTK (HIGH BYTE) + LDA SRCP + JSR PUSH.MACSTK + LDA SRCP+1 + JSR PUSH.MACSTK + LDA LF.ALL save current list option + JSR PUSH.MACSTK + LDA CALL.NUM STACK CURRENT CALL # + JSR PUSH.MACSTK + LDA CALL.NUM+1 + JSR PUSH.MACSTK + CLC COMPUTE ADDRESS OF SKELETON + LDA #7 + LDY #6 POINT AT LENGTH OF MACRO NAME + >SYM ADC,STPNTR NAME LENGTH+7 + ADC STPNTR + STA SRCP + LDA STPNTR+1 + ADC #0 + STA SRCP+1 + LDA LF.MACRO + ORA LF.ALL DON'T LIST EXPANSION IF NOT LISTING + STA LF.ALL + INC MACRO.LEVEL + >INCD CALL.CNTR COUNT THIS MACRO CALL + LDA CALL.CNTR + STA CALL.NUM + LDA CALL.CNTR+1 + STA CALL.NUM+1 + JMP ASM2 +*-------------------------------- +* PUSH A BYTE ON MACSTK +*-------------------------------- +PUSH.MACSTK + PHA SAVE BYTE TO BE PUSHED + .DO AUXMEM + LDA MACSTK+1 + CMP /$0800 + BCS .1 + .ELSE + LDA EOT + CMP MACSTK + LDA EOT+1 + SBC MACSTK+1 + BCC .1 STILL ROOM + .FIN + JMP MFER NO ROOM +.1 LDA MACSTK + BNE .2 + DEC MACSTK+1 +.2 DEC MACSTK + PLA BYTE TO BE PUSHED + LDY #0 + STA (MACSTK),Y + RTS +*-------------------------------- +* GET ONE PARAMETER FROM MACRO CALL LINE +*-------------------------------- +GET.ONE.PARAMETER + JSR GNC + BEQ .2 SPACE OR EOL, NO MORE PARAMETERS + CMP #', COMMA + BEQ .3 NULL PARAMETER + CMP #'" QUOTE + BEQ .4 QUOTED PARAMETER +.1 STA WBUF,X NORMAL PARAMETER + INX + JSR GNC + BEQ .2 END OF PARAMETER + CMP #', COMMA + BNE .1 MORE TO PARAMETER + BEQ .3 END OF PARAMETER +.2 JSR BACKUP.CHAR.PNTR +.3 LDA #0 + STA WBUF,X + INX + RTS +.4 JSR GNC QUOTED PARAMETER + BCS .3 END OF LINE + CMP #'" + BEQ .5 END OF QUOTED PARAMETER +.6 STA WBUF,X + INX + BNE .4 ...ALWAYS +.5 JSR GNC + BEQ .2 END OF PARAMETER LIST + CMP #', COMMA + BEQ .3 + BNE .6 ...ALWAYS +*-------------------------------- +* DIRECTIVE SCAN OR FAIL +* COMPARE NEXT TWO CHARS WITH TABLE ENTRY +* ENTER: FIRST CHAR SET UP BY GNC.UC +* (X)=OFFSET OF TWO-BYTE ENTRY IN DIR.QTS +*-------------------------------- +DIR.SCAN.OR.FAIL + CMP DIR.QTS,X + BNE .1 FAIL + LDY CHAR.PNTR + LDA WBUF,Y NEXT CHAR + AND #$DF MAP LOWER CASE TO UPPER CASE + CMP DIR.QTS+1,X + BNE .1 FAIL + JSR GNC.UC SCAN OVER SECOND CHAR + SEC SIGNAL SUCCESS + RTS +.1 CLC SIGNAL FAILURE + LDA CURRENT.CHAR RESTORE (A) + INX ADVANCE TO NEXT QUOTE + INX + RTS +*-------------------------------- +DIR.QTS +DIR.QT.DO .EQ *-DIR.QTS + .AS /DO/ +DIR.QT.EL .EQ *-DIR.QTS + .AS /EL/ +DIR.QT.FI .EQ *-DIR.QTS + .AS /FI/ +DIR.QT.MA .EQ *-DIR.QTS + .AS /MA/ +DIR.QT.EM .EQ *-DIR.QTS + .AS /EM/ +DIR.QT.IN .EQ *-DIR.QTS + .AS /IN/ +DIR.QT.SE .EQ *-DIR.QTS + .AS /SE/ +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/scmasm.s.macro +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/SCMASM.S.MCMDS.txt b/SCMASM.31/SCMASM.S.MCMDS.txt new file mode 100644 index 00000000..bcf3002b --- /dev/null +++ b/SCMASM.31/SCMASM.S.MCMDS.txt @@ -0,0 +1,266 @@ +NEW + AUTO 3,1 +*-------------------------------------- +HELP + LDA #CMD.TBL + LDX /CMD.TBL + LDY #2 + JSR HELP.1 + JSR CRLF + LDA SCI.TBLADR + LDX SCI.TBLADR+1 + LDY #4 +*-------------------------------- +HELP.1 + STA .92+1 + STX .92+2 + STY .91+1 + LDY #-1 POINT TO BEGINNING + LDX #10 + LDA #$0D +.1 JSR CHO + BPL .2 + JSR MON.PRBL2 + TYA + CLC +.91 ADC #0 + TAY + LDX #10 +.2 INY + DEX +.92 LDA $5555,Y + BNE .1 +.3 RTS +*-------------------------------- +HILO JSR EXPR.DEFINED + LDA EXP.VALUE+3 MUST BE 0000XX00 + ORA EXP.VALUE+2 + ORA EXP.VALUE + BNE HL.RAER + LDX EXP.VALUE+1 + RTS +*-------------------------------- +HIMEM JSR HILO + DEX + CPX SYMBOL.BASE + BCC HL.RAER ...BELOW OR SAME AS LOMEM + CPX SCI.BUFFER.PAGES+2 Start of Exec Buffer + BCS HL.RAER ABOVE EXEC BUFFER + INX + STX SCI.HIMEM.PAGE + JMP NEW +*-------------------------------- +HL.RAER JMP RAER +*-------------------------------- +LOMEM JSR HILO + CPX #8 + BCC HL.RAER ...BELOW $800 + CPX SCI.HIMEM.PAGE + BCS HL.RAER ...ABOVE OR SAME AS HIMEM + STX SYMBOL.BASE + JMP NEW +*-------------------------------- +* SET INCREMENT VALUE FOR AUTO-LINE-NUMBERING +*-------------------------------- +INCREMENT + JSR SCAN.1.DECIMAL.NUMBER + DEX be sure there was a value + BMI SYNX1 ...no, not one +.1 LDA A0L,X GET VALUE + STA INCREMENT.VALUE,X + DEX + BPL .1 + RTS +SYNX1 JMP SYNX +*-------------------------------- +* AUTO & MANUAL COMMANDS +*-------------------------------- +AUTO JSR SCAN.1.DECIMAL.NUMBER GET BASE, IF ANY + JSR SCAN.1.DECIMAL.NUMBER Get increment, if any + DEX Were there any parameters? + BMI .4 ...no, use current values + DEX ...yes, see if two parameters + DEX + BMI .2 ...no, only a starting line number +.1 LDA A1L,X ...yes, copy new increment + STA INCREMENT.VALUE,X + DEX + BPL .1 +*---X=-1, form "previous" line number--- +.2 SEC As written, this loop only works +.3 LDA A0L+1,X if all values are in page zero + SBC INCREMENT.VALUE+1,X because it uses negative + STA CURLNO+1,X indexing. + INX + BEQ .3 +*---Set the AUTO flag------------ +.4 SEC SET FLAG + .HS 90 "BCC", ALWAYS SKIP NEXT BYTE +MANUAL CLC CLEAR FLAG + ROR AUTOLN.FLAG + RTS +*-------------------------------- +* +* EDIT COMMAND +* +*-------------------------------- +EDIT + JSR GET.KEY.STRING + JSR PARSE.LINE.RANGE +.1 JSR GET.LINE.TO.WBUF + BCC .2 + RTS Finished with range +.2 JSR FIND.KEY.IN.WBUF + BCC .1 Not there + JSR EDIT.ONE.LINE + JMP .1 +*-------------------------------- +DATE JSR SCAN.3.DECIMAL.NUMBERS Day, Month, Year + CPX #6 + BCC SYNX1 NEED ALL THREE VALUES + LDA A1L MONTH + ASL + ASL + ASL + ASL + ASL M-MMM00000 + ORA A0L M-MMMDDDDD + STA $BF90 + LDA A2L YEAR + ROL YYYYYYYM + STA $BF91 + RTS +*-------------------------------- +TIME JSR SCAN.3.DECIMAL.NUMBERS Hour, Minute + CPX #4 + BCC SYNX1 NEED BOTH VALUES + LDA A0L HOUR + STA $BF93 + LDA A1L MINUTE + STA $BF92 + RTS +*--------------------------------- +* RENUMBER COMMAND +* +* UP TO THREE PARAMETERS +* 1: BASE NUMBER (DEFAULT = 1000) +* 2: INCREMENT (DEFAULT = 10) +* 3: STARTING LINE (DEFAULT = 0) +*--------------------------------- +RENUMBER + JSR SCAN.3.DECIMAL.NUMBERS Base, Increment, Starting Line +.1 CPX #3 COPY DEFAULTS IF ANY NEEDED + BCS .2 NO MORE DEFAULTS NEEDED + LDA RENDTA,X + STA A0L,X + INX + BNE .1 ...ALWAYS +.2 LDX #A2L FIND STARTING LINE + JSR SERTXT +.3 LDA LINE.START TEST IF THRU YET + CMP HI.MEM + LDA LINE.START+1 + SBC HI.MEM+1 + BCS .4 FINISHED + LDY #0 + LDA (LINE.START),Y GET LINE LENGTH + PHA SAVE FOR LATER + INY + LDA A0L STORE NEW LINE NUMBER IN LINE + STA (LINE.START),Y + ADC A1L ADD INCREMENT AS WE GO + STA A0L + INY + LDA A0H REST OF LINE NUMBER + STA (LINE.START),Y + ADC A1H ADD REST OF INCREMENT + BCS .5 YES, TOO BIG + STA A0H OK, AND CARRY CLEAR + PLA GET LINE SIZE + ADC LINE.START BUMP POINTER TO NEXT LINE + STA LINE.START + BCC .3 + INC LINE.START+1 + BNE .3 ...ALWAYS +.4 RTS FINISHED! +.5 LDY #QER3 RANGE ERROR + JMP HARD.ERROR +RENDTA .DA 1000 DEFAULT BASE + .DA #10 DEFAULT INCREMENT +*** .DA 0 DEFAULT STARTING LINE +*-------------------------------- +* HIDE COMMAND +*-------------------------------- +HIDE JSR MERGE MERGE IF ANY PREVIOUS HIDE + LDA #'H + STA PROMPT.FLAG NO, HIDE IT ALONE + INX NOW X=1 +.1 LDA HI.MEM,X SAVE HI.MEM + STA HIDE.HIMEM,X + LDA PP,X + STA HI.MEM,X + DEX + BPL .1 + RTS +*-------------------------------- +* MERGE COMMAND +*-------------------------------- +MERGE LDA PROMPT.FLAG + EOR #'H + BNE .1 + STA PROMPT.FLAG CLEAR PROMPT CHAR + LDA HIDE.HIMEM RESTORE HI.MEM + STA HI.MEM + LDA HIDE.HIMEM+1 + STA HI.MEM+1 +.1 RTS +*-------------------------------- +* NEW COMMAND +*-------------------------------- +NEW JSR RESTORE RESTORE IF IN AN INCLUDE + JSR MERGE + JSR EMPTY.SOURCE.AREA + JMP HARD +*-------------------------------- +* MEMORY COMMAND +* PRINT OUT BOUNDS ON SOURCE PROGRAM +* AND ON SYMBOL TABLE +*-------------------------------- +MEMORY LDY #QSRCPRG "SOURCE PROGRAM: $" + LDX #PP + LDA #HI.MEM + JSR MEM.LINE + LDY #QSYMTBL " SYMBOL TABLE: $" + LDX #LO.MEM + LDA #EOT +MEM.LINE + PHA SAVE SECOND VALUE PNTR + TXA + PHA SAVE FIRST VALUE PNTR + JSR QT.OUT + PLA GET FIRST VALUE PNTR + JSR MEM.HEXVAL + JSR P.DASH + PLA GET SECOND VALUE PNTR +MEM.HEXVAL + TAX + LDA 1,X + JSR MON.PHEX + LDA 0,X + JMP MON.PHEX +*-------------------------------- +RST JSR EXPR + LDY EXP.VALUE + LDA EXP.VALUE+1 +*-------------------------------- +SET.RESET.VECTOR + STY MON.RESET + STA MON.RESET+1 + EOR #$A5 + STA MON.RESET+2 + RTS +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/scmasm.s.mcmds +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/SCMASM.S.NEWQ.txt b/SCMASM.31/SCMASM.S.NEWQ.txt new file mode 100644 index 00000000..03adc8c7 --- /dev/null +++ b/SCMASM.31/SCMASM.S.NEWQ.txt @@ -0,0 +1,129 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* Y = MESSAGE NUMBER +*-------------------------------- +QT.OUT + TXA + PHA + LDX #0 + CLC +*---Search for message #--------- +.2 JSR GET.NEXT.NYBBLE + BNE .4 +.3 JSR GET.NEXT.NYBBLE + BEQ .3 + BNE .2 +.4 EOR #$0F + BNE .2 + DEY + BNE .2 +*---Print the message------------ +.5 JSR GET.NEXT.NYBBLE + TAY + LDA FIRST.TABLE,Y + BNE .6 ...FREQUENT CHAR + JSR GET.NEXT.NYBBLE + TAY + LDA SECOND.TABLE,Y + BNE .6 ...TWO NYBBLE CHAR + JSR GET.NEXT.NYBBLE + TAY + LDA THIRD.TABLE,Y +.6 BPL .7 ...END OF MESSAGE + PHP + JSR MY.COUT + PLP + BMI .5 ...NEXT CHAR, ALWAYS +.7 PLA ...YES + TAX + RTS +*-------------------------------- +GET.NEXT.NYBBLE + LDA MESSAGES,X + BCS .1 2ND NYBBLE + LSR 1ST NYBBLE + LSR + LSR + LSR + SEC + RTS +.1 INX + AND #$0F + CLC + RTS +*-------------------------------- +FIRST.TABLE .HS 00 + .AS -/ABCDEILMNORST / + .HS 7F +SECOND.TABLE .HS 00 + .AS -/FGPUXY$.*:?52/ + .HS 878D +THIRD.TABLE .AS -/.HJKQVWZ>1-...../ +*-------------------------------- +MESSAGES + .AC 0 + .AC 1/ABCDEILMNORST %/ + .AC 2/FGPUXY$.*:?52!#/ + .AC 3/HJKQVWZ>1-...../ +*-------------------------------- + .MA QT +QN. .SE QN.+1 +]1 .EQ QN. + .AC /]2/ + .EM +QN. .SE 0 +*-------------------------------- + .AC "%" ELIMINATE QT# 0 + >QT QSC,"S-C MACRO ASSEMBLER %" + >QT QST,"SYMBOL TABLE%" + >QT QSTARS,"#***!! %" + >QT QSRCPRG,"#SOURCE PROGRAM: $%" + >QT QSYMTBL,"# SYMBOL TABLE: $%" + >QT QERROR," ERROR#%" + >QT PAGEQT," PAGE %" + >QT QREPPRMT,"#REPLACE? %" + >QT QERRCNT," ERRORS IN ASSEMBLY#%" + >QT QBLOADB," LOAD %" + >QT QDELOR,"DELETE ORIGINAL? %" + >QT QMEMPRO,"MEM PROTECT%" + >QT QMEMFL,"MEM FULL%" + >QT QSYNX,"SYNTAX%" + >QT QER1,"NO LABEL%" + >QT QER2,"BAD OPCODE%" + >QT QER3,"RANGE%" + >QT QER4,"EXTRA DEFINITION%" + >QT QER5,"BAD ADDRESS%" + >QT QER6,"UNDEF LABEL%" + >QT QER7,"BAD SYMBOL%" + >QT QER8,"VALUE > 255%" + >QT QER9,"NO NORMAL LABEL%" + >QT QNIN,"NESTED .IN%" + >QT QERDO,"MISSING .DO%" + >QT QERDO2,".DO NEST TOO DEEP%" + >QT QSTRLNG,"KEY TOO LONG%" + >QT QNONAM,"NO MACRO NAME%" + >QT QREPLNG,"REPLACE TOO LONG%" + >QT QERR.MACRO,"UNDEF MACRO%" + .AC "%" FLUSH LAST BYTE +*-------------------------------- + .DO 0 +T + LDA #1 + STA 0 +.1 LDA 0 + JSR $FDDA + LDY 0 + JSR PRINT.QUOTATION + JSR $FD8E + INC 0 + LDA 0 + CMP #$20 + BCC .1 + RTS + .FIN +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/scmasm.s.newq +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/SCMASM.S.OUTPUT.txt b/SCMASM.31/SCMASM.S.OUTPUT.txt new file mode 100644 index 00000000..f7ed69be --- /dev/null +++ b/SCMASM.31/SCMASM.S.OUTPUT.txt @@ -0,0 +1,250 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* ERROR PRINTER +*--------------------------------- +FIRM.ERROR + SEC SIGNAL FIRM ERROR + .HS 24 SKIP NEXT BYTE +SOFT.ERROR + CLC SIGNAL SOFT ERROR + LDA PASS SEE IF IN ASSEMBLY + BMI HARD.ERROR ...NO + PHP SAVE CLC/SEC STATUS + LDA RDROM + JSR PRINT.ERROR.MESSAGE + >INCD ERROR.COUNT + JSR SPC + JSR LIST.SOURCE.AT.MARGIN + JSR CRLF + PLP GET SOFT/FIRM STATUS + BCS JMP.SOFT ...FIRM, ABORT ASSEMBLY + JMP ASM2 ...SOFT, CONTINUE ASSEMBLY +HARD.ERROR + JSR PRINT.ERROR.MESSAGE +JMP.SOFT + JSR RESTORE.IF.IN.INBX + JMP SOFT +*-------------------------------- +RESTORE.IF.IN.INBX + BIT INFLAG + BVC .1 + JSR RESTORE +.1 RTS +*-------------------------------- +P.EXP.VALUE.DASH + JSR CHECK.IF.LISTING + JSR P.EXP.VALUE +P.DASH LDA #'-' + .HS 2C +P.RETURN + LDA #$0D + .HS 2C +SPC LDA #' ' ONE SPACE +CHO PHA + ORA #$80 CHAR OUT + JSR MY.COUT SEND THE CHARACTER + PLA + RTS +*--------------------------------- +* PRINT A +* IF IN "SLOW" MODE, DELAY FIRST +* CHECK KEYBOARD FOR PAUSE OR ABORT +*-------------------------------- +CRLF BIT FLAG.SPEED CHECK SLOW/FAST SPEED + BPL .1 FAST + LDA #0 SLOW + JSR MON.DELAY +.1 JSR CHECK.KEYBOARD.FOR.ABORT + BCC P.RETURN ...NO KEYPRESS + BEQ JMP.SOFT ...ABORT +.2 JSR CHECK.KEYBOARD.FOR.ABORT + BCC .2 WAIT FOR KEYPRESS + BNE P.RETURN ...CONTINUE + BEQ JMP.SOFT ...ABORT +*-------------------------------- +* RETURN .CC. AND .NE. IF NO KEYPRESS +* RETURN .CS. AND .EQ. IF TYPED +* RETURN .CS. AND .NE. IF ANY OTHER KEY +*-------------------------------- +CHECK.KEYBOARD.FOR.ABORT + CLC + LDA $C000 + BPL .1 + STA $C010 + CMP #$8D + SEC +.1 RTS +*-------------------------------- +* PRINT ERROR MESSAGE +*-------------------------------- +PRINT.ERROR.MESSAGE + TYA SAVE ERROR # + TAX IN X-REG + LDY #QSTARS "*** " + JSR QT.OUT + TXA + TAY + JSR QT.OUT + LDY #QERROR + JMP QT.OUT +*-------------------------------- +* PRINT LOCATION COUNTER AND DASH +*-------------------------------- +P.ORIGIN + JSR CHECK.IF.LISTING +P.ORIGIN.REGARDLESS + LDX #7 assume col. 7 after 6-digit origin + LDY #2 + LDA ORGN+2 If > $FFFF, print 3 bytes + BNE .1 ...orgn > $FFFF, print 3 bytes + DEY ...orgn <$10000, print 2 bytes + LDX #5 will end up in col. 5 +.1 STX EMIT.COLUMN +.2 LDA ORGN,Y HIGH BYTE FIRST + JSR MON.PHEX + DEY + BPL .2 + JMP P.DASH PRINT "-" +*-------------------------------- +P.EMITTED.BYTE + JSR CHECK.IF.LISTING + LDY EMIT.COLUMN + BEQ .2 ...AT BEGINNING OF LINE + LDY EMIT.MARGIN + LDA ORGN+2 + BNE .1 + DEY + DEY +.1 CPY EMIT.COLUMN + BCS .3 ...STILL ROOM ON THIS LINE + BIT LF.XTRA.BYTES + BMI .4 + JSR CRLF.WITH.PAGING +.2 JSR P.ORIGIN +.3 LDY EMIT.COLUMN + INY MAKE ROOM FOR NEXT BYTE + INY + INY + STY EMIT.COLUMN + JSR SPC + LDA OBJ.BYTE + JMP MON.PHEX +.4 RTS +*-------------------------------- +P.MARGIN + SEC + LDA EMIT.MARGIN + SBC EMIT.COLUMN + TAX + LDA ORGN+2 + BEQ .1 + INX + INX +.1 JMP MON.PRBL2 +*-------------------------------- +P.EXP.VALUE + LDY #3 EXP.VALUE IS 4 BYTES +.1 LDA EXP.VALUE,Y TRIM LEADING ZERO BYTES + BNE .2 ...FIRST NON-ZERO BYTE + DEY + BNE .1 ...STILL NOT LAST BYTE +.2 TYA + ASL + ADC #3 + STA EMIT.COLUMN +.3 LDA EXP.VALUE,Y PRINT REST OF EXP.VALUE + JSR MON.PHEX + DEY + BPL .3 + RTS +*-------------------------------- +CHECK.IF.LISTING + LDA PASS + BEQ .1 ...NO LISTING IN PASS 1 + LDA LF.ALL + BPL .2 ...YES, LIST +.1 PLA POP RETURN + PLA +.2 RTS +*-------------------------------- +LIST.LINE.BOTH.PASSES + LDA PASS + BEQ .1 DEFINITE IN PASS 1 + LDA LF.ALL + BPL .2 ...ALREADY DID CRLF +.1 JSR CRLF.WITH.PAGING +.2 JSR P.ORIGIN.REGARDLESS + JMP LIST.SOURCE.REGARDLESS +*--------------------------------- +* CONVERT LINE NUMBER +* (CURRENT.LINE.NUMBER) = NUMBER TO USE +*--------------------------------- +CONVERT.LINE.NUMBER.BOTH + LDA #$C0 PRINT FLAG ON, STORE FLAG ON + .HS 2C SKIP NEXT 2 BYTES +CONVERT.LINE.NUMBER.STORE + LDA #$80 PRINT FLAG OFF, STORE FLAG ON + .HS 2C SKIP NEXT 2 BYTES +CONVERT.LINE.NUMBER.PRINT + LDA #$40 PRINT FLAG ON, STORE FLAG OFF + PHA + LDX #3 CONVERT 4 DIGITS + LDA CURRENT.LINE.NUMBER + CMP #10000 + LDA CURRENT.LINE.NUMBER+1 + SBC /10000 + BCC .1 4 DIGITS WILL DO IT + INX 5 DIGITS +.1 PLA +*-------------------------------- +* CONVERT (CURRENT.LINE.NUMBER) +* (X) = ONE LESS THAN NUMBER OF DIGITS +* (A) = FLAGS: BIT 7 = 1 MEANS TO STORE AT WBUF,Y +* BIT 6 = 1 MEANS TO PRINT +*-------------------------------- +CONVERT.LINE.NUMBER + STA CONV.CTRL +.5 LDA #$B0 SET DIGIT TO ASCII ZERO +.1 PHA PUSH DIGIT ON STACK + SEC SUBTRACT CURRENT DIVISOR + LDA CURRENT.LINE.NUMBER + SBC PLNTBL,X + PHA SAVE BYTE ON STACK + LDA CURRENT.LINE.NUMBER+1 + SBC PLNTBH,X + BCC .2 LESS THAN DIVISOR + STA CURRENT.LINE.NUMBER+1 + PLA GET LOW BYTE OFF STACK + STA CURRENT.LINE.NUMBER + PLA GET DIGIT FROM STACK + ADC #0 INCREMENT DIGIT + BNE .1 ...ALWAYS +.2 PLA DISCARD BYTE FROM STACK + PLA GET DIGIT FROM STACK + BIT CONV.CTRL + BVC .3 NO PRINT + JSR MON.COUT PRINT CHARACTER +.3 BIT CONV.CTRL TEST BUFFER STORAGE FLAG + BPL .4 OFF, DO NOT STORE IN BUFFER + STA WBUF,Y + INY +.4 DEX NEXT DIGIT + BPL .5 + RTS RETURN +*--------------------------------- +PLNTBL .DA #1 + .DA #10 + .DA #100 + .DA #1000 + .DA #10000 +PLNTBH .DA /1 + .DA /10 + .DA /100 + .DA /1000 + .DA /10000 +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/scmasm.s.output +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/SCMASM.S.PARAM.txt b/SCMASM.31/SCMASM.S.PARAM.txt new file mode 100644 index 00000000..b98ee02b --- /dev/null +++ b/SCMASM.31/SCMASM.S.PARAM.txt @@ -0,0 +1,76 @@ +NEW + AUTO 3,1 +*-------------------------------------- +*-------------------------------- +* ENTRY POINTS AND USER EXITS +*-------------------------------- +* HARD ENTRY +HARD JSR HARD.INIT +*-------------------------------- +* SOFT ENTRY + JMP SOFT +*-------------------------------- +* USER DEFINED COMMAND +USR JMP SOFT +*-------------------------------- +* USER PRINT ROUTINE +PRT JMP SOFT +*-------------------------------- +* USER ESC-U FUNCTION +USER.ESC.U + JMP RDL.ERR +*-------------------------------- +* USER "." COMMAND +USER.CMD JMP SOFT +*-------------------------------- +* USER OBJECT CODE STORAGE +USER.OBJECT.BYTE + JMP STORE.OBJECT.BYTE +*-------------------------------- +* USER ASSEMBLER DIRECTIVE +PSUSER JMP CMNT +*-------------------------------- +* TAB CONTROL CHARACTER AND TAB STOPS +TAB.CHAR .DA #CHR.CTRL.I +TAB.SETTINGS .DA #14,#18,#27,#32,#0 +*-------------------------------- +* USER COMMENT CHARACTER +* (IN ESC-L FROM COLUMN 6) +*-------------------------------- +USER.COM.DELIM .DA #CHR.DASH +*-------------------------------- +* COMPRESSION LOWER LIMIT +* =4 IF DESIRE COMPRESSION +* =255 IF DO NOT DESIRE COMPRESSION +*-------------------------------- +COMPRESSION.LIMIT .HS 04 +*-------------------------------- +* WILD CARD CHARACTER FOR SEARCH STRING +*-------------------------------- +WILD.CARD .HS 17 CONTROL-W +*-------------------------------- +* OUTPUT A SINGLE CHARACTER TO SCREEN +*-------------------------------- +MY.COUT JMP MON.COUT +*-------------------------------- +USER.MEM.LO .DA $0000 +USER.MEM.HI .DA $0000 +*-------------------------------- +* LINKAGE TO FULL SCREEN EDITOR +*-------------------------------- +LINK.FSE + JMP GNL <<>> +*-------------------------------- + JMP GNC.UC + JMP GNNB + JMP CMNT + JMP ERBA + JMP EMIT +*-------------------------------- +BOTTOM.OF.SCREEN + .DA #23 CHANGE TO 31 OR 47 FOR LONGER SCREENS +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/scmasm.s.param +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/SCMASM.S.PLINE.txt b/SCMASM.31/SCMASM.S.PLINE.txt new file mode 100644 index 00000000..02d3d78f --- /dev/null +++ b/SCMASM.31/SCMASM.S.PLINE.txt @@ -0,0 +1,102 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* PARSE LINE RANGE +* START END CARRY +* (PP) (HI.MEM) SET +* # # # CLEAR +* #1,#2 #1 #2 CLEAR +* #, # (HI.MEM) CLEAR +* ,# (PP) # CLEAR +*--------------------------------- +PARSE.LINE.RANGE + JSR SETUP.TEXT.POINTERS + JSR GNNB.AUC GET NEXT NON-BLANK CHAR + BCS .4 EOL, RETURN WITH CARRY SET + BEQ .1 COMMA, SO START AT PP + JSR SCAN.LINE.NUMBER + BCS .5 + LDA LINE.START + STA SRCP + LDA LINE.START+1 + STA SRCP+1 + JSR GNNB.AUC GET NEXT NON-BLANK AFTER LINE NUMBER + BCS .2 EOL, SO ONLY THIS ONE LINE + BNE .5 NOT COMMA, SO ERROR +.1 JSR GNNB.AUC GET NEXT NON-BLANK AFTER COMMA + BCS .3 EOL, SO GO THRU HI.MEM + BEQ .3 COMMA, SAME AS EOL + JSR SCAN.LINE.NUMBER + BCS .5 +.2 LDA LINE.END + STA ENDP + LDA LINE.END+1 + STA ENDP+1 +.3 CLC FLAG WE GOT AT LEAST ONE NUMBER +.4 RTS +.5 JMP SYNX +*--------------------------------- +* SCAN INPUT LINE FOR DIGIT OR PERIOD +* IF FIND DIGIT, CONVERT LINE NUMBER +* AND SEARCH FOR IT +* IF FIND PERIOD, SEARCH FOR +* IF NEITHER, RETURN WITH CARRY SET +*--------------------------------- +SCAN.LINE.NUMBER + CMP #'. DOT: USE (CURLNO) + BEQ .1 + EOR #$30 + CMP #10 + BCS .2 NOT DOT NOR DIGIT, EXIT CARRY SET + JSR DECN CONVERT THE NUMBER + JSR BACKUP.CHAR.PNTR + LDX #SYM.VALUE + .HS 2C SKIP OVER NEXT 2 BYTES +.1 LDX #CURLNO + JSR SERTXT FIND LINE + CLC SIGNAL GOOD NUMBER +.2 RTS +*-------------------------------- +* LOAD PP --> SRCP, HI.MEM --> ENDP +*-------------------------------- +SETUP.TEXT.POINTERS + LDA PP ASSUME PP THRU HI.MEM + STA SRCP + LDA PP+1 + STA SRCP+1 + LDA HI.MEM + STA ENDP + LDA HI.MEM+1 + STA ENDP+1 + RTS +*-------------------------------- +CMP.SRCP.ENDP + LDA SRCP + CMP ENDP + LDA SRCP+1 + SBC ENDP+1 + RTS +*-------------------------------- +* GET NEXT NON-BLANK CHARACTER +* AND CHECK FOR A, U, OR COMMA +* SET CARRY IF A, U, OR EOL +* SET EQ IF A, U, EOL, OR COMMA +*-------------------------------- +GNNB.AUC + JSR GNNB NEXT NON-BLANK, CONV LOWER TO UPPER + BCS .1 EOL + CMP #'A + BEQ .1 + CMP #'U + BEQ .1 + CMP #', + CLC + RTS +.1 JSR BACKUP.CHAR.PNTR + SEC + RTS +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/scmasm.s.pline +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/SCMASM.S.PSYM.txt b/SCMASM.31/SCMASM.S.PSYM.txt new file mode 100644 index 00000000..994e2c54 --- /dev/null +++ b/SCMASM.31/SCMASM.S.PSYM.txt @@ -0,0 +1,126 @@ +NEW + AUTO 3,1 +*-------------------------------------- +*-------------------------------- +* PRINT SYMBOL TABLE IN ALPHABETICAL ORDER +*-------------------------------- +SYMBOLS +STPRNT LDY #2 SKIP OVER .TF PSEUDO-SYMBOLS +.1 STY PNTR + LDA HSHTBL,Y + STA STPNTR + LDA HSHTBL+1,Y + BEQ .5 + STA STPNTR+1 +*---PRINT VALUE AND DASH--------- +.2 LDY #2 POINT AT VALUE +.25 >SYM LDA,STPNTR + STA SYM.VALUE-2,Y SAVE FOR LOCAL OFFSETS + INY + CPY #6 + BCC .25 + LDY #3 +.26 LDA SYM.VALUE,Y + BNE .27 ...NON-ZERO BYTE + JSR SPC + JSR SPC + DEY + BNE .26 ...UNTIL LAST BYTE +.27 LDA SYM.VALUE,Y + JSR MON.PHEX + DEY + BPL .27 ...INCLUDE LAST BYTE + JSR P.DASH + JSR SPC +*---PRINT NAME------------------- + LDY #6 + >SYM LDA,STPNTR GET NAME LENGTH + PHA SAVE AGAIN FOR LOCAL LABELS FLAG + AND #$3F ISOLATE LENGTH + TAX +.3 INY + >SYM LDA,STPNTR + JSR CHO + DEX + BNE .3 +*---CHECK FOR LOCAL LABELS------- + PLA GET LENGTH AND FLAGS + BMI .6 LOCAL LABELS +*---NEXT LABEL------------------- +.4 JSR CRLF.WITH.PAGING + LDY #1 POINT AT POINTER + >SYM LDA,STPNTR + PHA + DEY + >SYM LDA,STPNTR + STA STPNTR + PLA + STA STPNTR+1 + BNE .2 NEXT SYMBOL IN THIS CHAIN, IF ANY +.5 LDY PNTR + INY + INY + CPY #54 # BYTES IN HASH POINTER TABLE + BNE .1 + RTS +*---PRINT LOCAL LABELS----------- +.6 AND #$3F POINT AT FIRST LOCAL LABEL + CLC + ADC #7 + TAY + LDA #1 FORCE CRLF BEFORE 1ST LABEL + STA EMIT.COLUMN +.7 >SYM LDA,STPNTR + BEQ .4 END OF LOCALS + AND #$7F ISOLATE NAME + PHA SAVE NAME OF SYMBOL + STY YSAVE SAVE POINTER + DEC EMIT.COLUMN + BNE .9 ...UNLESS NEED A NEW LINE + JSR CRLF.WITH.PAGING CLOBBERS Y-REG IF FORMFEED + LDY #8 +.81 JSR SPC + DEY + BNE .81 + LDY #7 ...SEVEN PER LINE + LDA SYM.VALUE+2 + BEQ .82 + LDY #5 ...FIVE PER LINE +.82 STY EMIT.COLUMN +.9 JSR SPC + JSR SPC + LDA #CHR.PERIOD + JSR CHO + PLA GET NAME + STA CURRENT.LINE.NUMBER + LDA #0 + STA CURRENT.LINE.NUMBER+1 + LDX #1 ONLY TWO DIGITS + LDA #$40 PRINT ONLY, DO NOT STORE IN WBUF + JSR CONVERT.LINE.NUMBER + LDA #'=' EQUAL SIGN + JSR CHO + LDY YSAVE GET VALUE OF SYMBOL + INY + >SYM LDA,STPNTR + CLC + ADC SYM.VALUE + PHA + LDA SYM.VALUE+1 + ADC #0 + PHA + LDA SYM.VALUE+2 + ADC #0 + BEQ .10 PRINT ONLY TWO BYTES + JSR MON.PHEX +.10 PLA + JSR MON.PHEX + PLA + JSR MON.PHEX + INY + BNE .7 ...ALWAYS +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/scmasm.s.psym +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/SCMASM.S.RLINE.txt b/SCMASM.31/SCMASM.S.RLINE.txt new file mode 100644 index 00000000..56ea542b --- /dev/null +++ b/SCMASM.31/SCMASM.S.RLINE.txt @@ -0,0 +1,411 @@ +NEW + AUTO 3,1 +*-------------------------------------- + .MA JTBL + .DA #$]1,]2-1 + .EM +*-------------------------------- +CHAR.TABLES +CHARS.FOR.COMMANDS .EQ *-CHAR.TABLES + >JTBL 22,ECHO.LINE "--ECHO REST OF LINE + >JTBL 2D,PASS.CMD.TO.PRODOS DASH COMMAND + >JTBL 2E,USER.CMD .--USER DOT COMMAND + >JTBL 2F,LINK.FSE /--LINK TO F.S.E. + >JTBL 3F,HELP ?--list commands + >JTBL 00,NML other, try numbered line +*-------------------------------- +CHARS.FOR.READ.LINE.1 .EQ *-CHAR.TABLES + >JTBL 83,RDL.CATALOG ^C--MACRO FOR "CATALOG" + >JTBL 85,RDL.EDIT ^E--MACRO FOR "EDIT " + >JTBL 86,RDL.FIND ^F--MACRO FOR "FIND " + >JTBL 8C,RDL.LIST ^L--MACRO FOR "LIST " + >JTBL 90,RDL.PREFIX ^P--MACRO FOR "PREFIX" +CHARS.FOR.READ.LINE.2 .EQ *-CHAR.TABLES + >JTBL 88,RDL.BACKSPACE ^H--BACKSPACE + >JTBL 8A,RDL.DOWN ^J--DOWN ARROW KEY + >JTBL 8B,RDL.UP ^K--UP ARROW KEY + >JTBL 8D,RDL.EOL ^M--CARRIAGE RETURN + >JTBL 8F,RDL.OVERRIDE ^O--OVERRIDE + >JTBL 93,RDL.TOGGLE ^S--TOGGLE CASE FLAG + >JTBL 95,RDL.RITARR ^U--RIGHT ARROW + >JTBL 98,RDL.RUBOUT ^X--RUBOUT LINE + >JTBL 9B,RDL.ESCAPE ESC--ESCAPE MODE + >JTBL 00,RDL.ERR +*-------------------------------- +CHARS.FOR.ESCAPE .EQ *-CHAR.TABLES + >JTBL C0,IO.HOME @--CLEAR SCREEN AND HOME + >JTBL C1,IO.RIGHT A--MOVE CURSOR RIGHT + >JTBL C2,IO.LEFT B--MOVE CURSOR LEFT + >JTBL C3,IO.DOWN C--MOVE CURSOR DOWN + >JTBL C4,IO.UP D--MOVE CURSOR UP + >JTBL C5,IO.CLREOL E--CLEAR TO END OF LINE + >JTBL C6,IO.CLREOP F--CLEAR TO END OF SCREEN + >JTBL C9,IO.UP I--MOVE CURSOR UP + >JTBL CA,IO.LEFT J--MOVE CURSOR LEFT + >JTBL CB,IO.RIGHT K--MOVE CURSOR RIGHT + >JTBL CC,ESCAPE.L L--"LOAD ..." OR "*---..." + >JTBL CD,IO.DOWN M--MOVE CURSOR DOWN + >JTBL D3,ESCAPE.S S--AUTO-SAVE LINE + >JTBL D5,USER.ESC.U U--USER COMMAND + >JTBL AE,ESCAPE.DOT .--LIS., COMMAND + >JTBL 88,IO.LEFT ^H--LEFT ARROW KEY + >JTBL 95,IO.RIGHT ^U--RIGHT ARROW KEY + >JTBL 8A,IO.DOWN ^J--DOWN ARROW KEY + >JTBL 8B,IO.UP ^K--UP ARROW KEY + >JTBL 00,RDL.ESC.END END ESCAPE MODE +*-------------------------------- +CHARS.FOR.EDIT .EQ *-CHAR.TABLES + >JTBL 80,E.ZAP ^@ -- Clear to EOL + >JTBL 81,E.INS ^A -- Add (Insert) + >JTBL 82,E.BEG ^B + >JTBL 84,E.DEL ^D + >JTBL 86,E.FIND ^F + >JTBL 88,E.BKSP ^H + >JTBL 89,E.TABI ^I -- Clear to tab + >JTBL 8C,E.DOWN ^L + >JTBL 8D,E.RET ^M + >JTBL 8E,E.END ^N + >JTBL 8F,E.OVR ^O + >JTBL 91,E.RETQ ^Q -- Clear to EOL, Quit + >JTBL 92,E.RESTORE ^R -- Restore original line + >JTBL 93,E.TOGGLE ^S -- TOGGLE CASE FLAG + >JTBL 94,E.TAB ^T + >JTBL 95,E.RIT ^U + >JTBL 98,E.ABORT ^X + >JTBL 00,E.ILLCHAR +*-------------------------------- +RDL.TOGGLE + JSR IO.CASE.TOGGLE + JMP RDL3 +*-------------------------------- +RDL.UP + JSR IO.UP + JMP RDL3 +*-------------------------------- +RDL.DOWN + JSR IO.DOWN + JMP RDL3 +*-------------------------------- +* HANDLE TABULATION +*-------------------------------- +TAB TXA SEE IF IN COLUMN 1 + BEQ .4 YES, AUTO-LINE-NUMBER +.3 JSR E.CHECK.TAB + BCS .5 ONE MORE SPACE + LDA #CHR.BLANK + JSR INSTALL.CHAR + BCC .3 MORE TO GO + JMP RDL.RUBOUT +*-------------------------------- +.4 CLC ADD INCREMENT TO CURRENT LINE # + LDA CURLNO + ADC INCREMENT.VALUE + STA CURRENT.LINE.NUMBER + LDA CURLNO+1 + ADC INCREMENT.VALUE+1 + STA CURRENT.LINE.NUMBER+1 + LDY #0 + JSR CONVERT.LINE.NUMBER.BOTH STORE AND PRINT NUMBER + TYA + TAX +*-------------------------------- +.5 LDA #CHR.BLANK + JMP RDL.ADD.CHAR +*-------------------------------- +* READ LINE SUBROUTINE +*-------------------------------- +READ.LINE + JSR GET.HORIZ.POSN + TAX TEST FOR POSITION=0 + BEQ RDL1 DON'T OUTPUT CRLF +RDL0 JSR CRLF +RDL1 LDA PROMPT.FLAG + JSR CHO NULL, "I", OR "H" + LDA #':' COLON PROMPT + JSR CHO + LDX #0 START NEW LINE + STX WBUF CLEAR OUT "$" FROM COL. 1 (JUST IN CASE) + BIT AUTOLN.FLAG SEE IF IN "AUTO" MODE + BMI TAB ...YES +RDL3 JSR READ.KEY.WITH.CASE + BCS RDL.ESCAPE.2E + LDY WBUF SEE IF IN $ OR " MODE + CPY #$A2 "? + BEQ .2 + CPY #$A4 $? + BEQ .2 + CMP TAB.CHAR < 1) + DEY + BMI FMN3 ...NOT VALID COMMAND + CPY #$13 + BCS FMN2 +.1 JSR MON.TOSUB + LDY MON.YSAV +FAKE.MONITOR + JSR FMN5 INDIRECT TO MON.GETNUM + STY MON.YSAV + CMP #$C6 $8D EOR $B0 PLUS $89 + BEQ FMN4 ... + LDY #22 # CMDS - 1 +FMN2 CMP MON.CHRTBL,Y + BEQ FMN1 ...FOUND CMD IN TABLE + DEY ...NEXT ENTRY + BPL FMN2 ...NEXT ENTRY +FMN3 JSR MON.BELL ...NOT IN TABLE + JMP READ.LINE +FMN4 LDA MON.MODE COMMAND + LDY #0 + DEC MON.YSAV + JSR MON.BL1 + JMP READ.LINE +FMN5 JMP ($FF74) MON.GETNUM CALL +*-------------------------------- +* ESCAPE-L +* COLUMN 0: LOAD A FILE +* COL. 1-N: MAKE "*------" LINE +*-------------------------------- +ESCAPE.L + TXA + BEQ .3 "LOAD ...." +*---GENERATE STAR-DASH LINE------ + LDA #CHR.STAR +.1 JSR INSTALL.CHAR + LDA USER.COM.DELIM + CPX #38 + BCC .1 +.2 RTS +*---GENERATE LOAD COMMAND-------- +.3 JSR IO.HTABX HTAB TO FIRST COLUMN + LDY #QBLOADB " LOAD " + JSR QT.OUT + LDX #22 + JSR IO.HTABX + JSR GET.DOS.CMD.OFF.SCRN + PLA POP RETURN ADDRESS + PLA + JMP RDL.EOL SUBMIT COMMAND +*-------------------------------- +* ESC-S AUTO SAVE LINE +*-------------------------------- +ESCAPE.S + TXA + BNE .4 ...NOT IN COLUMN 1 + JSR SETUP.TEXT.POINTERS + LDX #10 MUST APPEAR IN FIRST 10 LINES +.1 LDY #3 POINT TO FIRST TEXT CHAR OF LINE + LDA (SRCP),Y + JSR CHECK.COMMENT.CHAR + BEQ .5 +.2 DEX PAST 10TH LINE? + BMI .4 ...YES, LOOK NO FURTHER + LDY #0 POINT TO LENGTH + LDA (SRCP),Y + CLC + ADC SRCP + STA SRCP + BCC .3 + INC SRCP+1 +.3 JSR CMP.SRCP.ENDP PAST END OF PROGRAM? + BCC .1 ...NO, KEEP LOOKING +.4 RTS +.5 INY + LDA (SRCP),Y + BEQ .2 ...END OF LINE + CMP #'S' + BNE .5 + JSR LIST.CURRENT.LINE +*-------------------------------- +GET.DOS.CMD.OFF.SCRN + JSR IO.CLREOL + LDY #0 NOW PICK 0...39 OFF SCREEN + LDX #0 BUT NO BLANKS +.1 JSR IO.PICK.SCREEN + STA WBUF,X STORE IN BUFFER + INY + CMP #" " ELIMINATE BLANKS + BEQ .2 ...BLANK + INX +.2 CPY #39 + BCC .1 +.3 DEY + JSR IO.PICK.SCREEN + CMP #" " + BEQ .3 + INY + TYA + JMP IO.HTAB POSITION AFTER LAST NON-BLANK +*-------------------------------- +* INSTALL CHARACTER IN INPUT BUFFER +*-------------------------------- +INSTALL.CHAR + ORA #$80 ASSURE SIGN BIT ON + STA WBUF,X STORE IN INPUT BUFFER + CMP #$A0 CONTROL CHAR? + BCS .1 ...NO + AND #$3F ...YES, DISPLAY AS INVERSE +.1 JSR IO.COUT ECHO ON SCREEN + CPX #WBUF.MAX SEE IF END OF BUFFER + BCS .2 ...YES + INX + RTS +.2 JSR MON.BELL + SEC + RTS +*-------------------------------- +* STRIP SIGN BITS OFF ALL BYTES +* AND CHANGE TO +*-------------------------------- +RDL.STRIP.LINE + LDY #$FF LOOP TO CLEAR HIGH BITS +.1 INY + LDA WBUF,Y + AND #$7F STRIP OFF BIT + CMP #$0D WAS IT THE END? + BNE .2 NOT YET + LDA #0 YES, SUBSTITUTE FOR +.2 STA WBUF,Y + BNE .1 UNTIL + TAX CLEAR X-REG + RTS +*-------------------------------- +ESCAPE.DOT + TXA + BNE .5 NOT IN COLUMN 1, IGNORE IT + JSR GET.HORIZ.POSN FIND CURSOR POSITION + TAY +.1 JSR IO.PICK.SCREEN + AND #$7F + JSR CHECK.DIGIT + BCC .2 NOT A DIGIT + STA WBUF+4,X + INX + INY + BNE .1 ...ALWAYS +.2 TXA + BEQ .3 ...NO DIGITS + LDA #4 + STA CHAR.PNTR + STA WBUF+4,X + LDX #CURLNO-A0L + JSR SCAN.1.DECIMAL.NUMBER +.3 LDY #4 + LDX #0 +.4 LDA LDC,Y + JSR INSTALL.CHAR + DEY + BPL .4 + STA CURRENT.CHAR at end, current.char = comma + JSR IO.CLREOP +.5 RTS +*-------------------------------- +LDC .AS /,.SIL/ +*-------------------------------- +QM. +QM.EDIT .AT /EDIT / +QM.CATALOG .AT /CATALOG/ +QM.PREFIX .AT /PREFIX/ +QM.LIST .AT /LIST / +QM.FIND .AT /FIND / +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/scmasm.s.rline +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/SCMASM.S.SCMD.txt b/SCMASM.31/SCMASM.S.SCMD.txt new file mode 100644 index 00000000..a6f78f31 --- /dev/null +++ b/SCMASM.31/SCMASM.S.SCMD.txt @@ -0,0 +1,118 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* SEARCH COMMAND TABLE +*-------------------------------- +SEARCH.COMMAND.TABLE + LDX #-1 COMMAND STRING INDEX +.1 LDY #0 BUFFER INDEX + STY CHAR.PNTR +.2 INX NEXT POSITION IN CMD.TBL + JSR GNC.UC NEXT CHARACTER OF COMMAND + BCS .7 ...END OF LINE + JSR CHECK.LETTER + BCC .6 ...NOT A LETTER + LDA CMD.TBL,X NEXT CHAR OF COMMAND NAME + BEQ PASS.CMD.TO.PRODOS ...END OF TABLE + EOR CURRENT.CHAR + BEQ .2 ...CORRECT CHARACTER + ASL SHIFT OUT END.OF.NAME FLAG + BNE .5 ...REALLY DIFFERENT +*---GO TO PROCESS COMMAND-------- +.3 LDA CMD.TBL+2,X + PHA + LDA CMD.TBL+1,X + PHA + LDX #0 + RTS +*---SCAN TO NEXT TABLE ENTRY----- +.5 INX + LDA CMD.TBL-1,X + BPL .5 + INX SKIP OVER ADDRESS + BNE .1 ...ALWAYS +*---ALL LETTERS MATCH------------- +.6 DEY BACK OFF + STY CHAR.PNTR +.7 CPY #3 AT LEAST THREE LETTERS? + BCC PASS.CMD.TO.PRODOS ...NO, SPELLED WRONG +.9 LDA CMD.TBL,X + BMI .3 ...AT END OF COMMAND NAME + INX + BNE .9 ...ALWAYS +*---NOT FOUND IN TABLE------------ +PASS.CMD.TO.PRODOS + .DO 0 NO LONGER NECESSARY, BECAUSE 00=8D IN SCI + LDX #-1 APPEND A FOR PRODOS +.1 INX + LDA WBUF,X LOOK FOR TERMINATING 00 + BNE .1 ...NOT YET + LDA #$8D + STA WBUF,X + .FIN EFFECTIVE 10-23-86 + JSR SCI.COMMAND GIVE ProDOS A SHOT AT IT + BCC .2 ProDOS liked it! + JMP PRODOS.ERROR ...not acceptable, explain why +.2 RTS +*-------------------------------- +* COMMAND STRINGS +*-------------------------------- + .MA CTBL + .AT /]1/ + .DA ]1-1 + .EM +*-------------------------------- +CMD.TBL + >CTBL ASM + >CTBL AUTO + >CTBL COPY + >CTBL DATE + >CTBL DELETE + >CTBL EDIT + >CTBL FAST + >CTBL FIND + >CTBL FP + >CTBL HELP + >CTBL HIDE + >CTBL HIMEM + >CTBL INCREMENT + >CTBL LIST + >CTBL LOMEM + >CTBL MANUAL + >CTBL MEMORY + >CTBL MERGE + >CTBL MGO + >CTBL MNTR + >CTBL NEW + >CTBL PRT + >CTBL RENUMBER + >CTBL REPLACE + >CTBL RESTORE + >CTBL RST + >CTBL SLOW + >CTBL SYMBOLS + >CTBL TEXT + >CTBL TIME + >CTBL USR + >CTBL VAL + >CTBL VERSION + .HS 00 END OF TABLE +*-------------------------------- +SCT.1 INY + INY + INY +SEARCH.CHAR.TABLES + LDA CHAR.TABLES,Y + BEQ .1 ...NOT IN TABLE + CMP CURRENT.CHAR + BNE SCT.1 +.1 LDA CHAR.TABLES+2,Y + PHA + LDA CHAR.TABLES+1,Y + PHA + RTS +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/scmasm.s.scmd +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/SCMASM.S.SYMT.txt b/SCMASM.31/SCMASM.S.SYMT.txt new file mode 100644 index 00000000..cbc2e3bf --- /dev/null +++ b/SCMASM.31/SCMASM.S.SYMT.txt @@ -0,0 +1,495 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* INITIALIZE SYMBOL TABLE +* 1. SET EOT TO BOT +* 2. CLEAR HASH POINTER TABLE +*-------------------------------- +STINIT LDA LO.MEM START OF SYMBOL TABLE + STA EOT + LDA LO.MEM+1 + STA EOT+1 + STA MACLBL+1 PRIVATE LABELS GO DOWN FROM THERE + LDX #56 # BYTES IN HASH POINTER TABLE + LDA #0 + STA MACLBL + STA CURRENT.MAJOR.LABEL+1 +.1 STA HSHTBL-1,X + DEX + BNE .1 + .DO AUXMEM + LDA RDRAM + LDA RDRAM + LDX #AUX.IMAGE.LEN-1 +.2 LDA AUX.IMAGE,X + STA AUX.CODE,X + DEX + BPL .2 +BACK.TO.ROM + PHA + LDA RDROM + PLA + .FIN + RTS RETURN WITH X=0 +*-------------------------------- + .DO AUXMEM +LDA.STPNTR + BIT RDRAM + JSR LDA.STPNTR.AUX + JMP BACK.TO.ROM +* +ADC.STPNTR + BIT RDRAM + JSR ADC.STPNTR.AUX + JMP BACK.TO.ROM +* +SBC.STPNTR + BIT RDRAM + JSR SBC.STPNTR.AUX + JMP BACK.TO.ROM +* +LDA.PNTR + BIT RDRAM + JSR LDA.PNTR.AUX + JMP BACK.TO.ROM +* +LDA.TPTR + BIT RDRAM + JSR LDA.TPTR.AUX + JMP BACK.TO.ROM +* +LDA.SRCP + BIT RDRAM + JSR LDA.SRCP.AUX + JMP BACK.TO.ROM +* +STA.PNTR + STA WRAUX + STA (PNTR),Y + STA WRMAIN + RTS +STA.STPNTR + STA WRAUX + STA (STPNTR),Y + STA WRMAIN + RTS +*-------------------------------- +AUX.IMAGE +LDA.STPNTR.AUX .EQ *-AUX.IMAGE+AUX.CODE + STA RDAUX + LDA (STPNTR),Y + STA RDMAIN + RTS +ADC.STPNTR.AUX .EQ *-AUX.IMAGE+AUX.CODE + STA RDAUX + ADC (STPNTR),Y + STA RDMAIN + RTS +SBC.STPNTR.AUX .EQ *-AUX.IMAGE+AUX.CODE + STA RDAUX + SBC (STPNTR),Y + STA RDMAIN + RTS +LDA.PNTR.AUX .EQ *-AUX.IMAGE+AUX.CODE + STA RDAUX + LDA (PNTR),Y + STA RDMAIN + RTS +LDA.TPTR.AUX .EQ *-AUX.IMAGE+AUX.CODE + STA RDAUX + LDA (TPTR),Y + STA RDMAIN + RTS +LDA.SRCP.AUX .EQ *-AUX.IMAGE+AUX.CODE + STA RDAUX + LDA (SRCP),Y + STA RDMAIN + RTS +AUX.IMAGE.LEN .EQ *-AUX.IMAGE + .FIN +*-------------------------------- +* A table of 28 pointers begins at $130, called HSHTBL. +* Each pointer points to the beginning of a chain of +* symbol entries. The entries on a chain are kept +* in alphabetical order. If a chain is empty, the +* pointer = $0000. +* +* HSHTBL+$00: Chain for target file entries +* HSHTBL+$02: Chain for labels starting with "A" +* HSHTBL+$04: Chain for labels starting with "B" +* - - - +* HSHTBL+$34: Chain for labels starting with "Z" +* HSHTBL+$36: Chain for Macro Names and Skeletons +* +* Format of Target File Entry: +* 0,1 -- Forward chain pointer (0=end of chain) +* 2,3 -- Length of target file in bytes +* 4 -- Length of code name = $02 +* 5,6 -- Target file code name: +* 5: "@" = $40 +* 6: $40 + target file number ($00-$1F) +* +* Format of Label Entry: +* 0,1 -- Forward chain pointer (0=end of chain) +* 2-5 -- Value of label +* 6 -- Flags and length of label name: +* Bits 5-0: length of label name ($01-$20) +* Bit 6: =1 if forward reference +* Bit 7: =1 if has local labels +* 7 -- First character of label name, and flag. +* Bit 7 = 1 if label is .SEt label. +* thru 6+n -- The rest of the label name, with bit 7 = 0 +* +* If the label has local labels, they follow. +* Each local label occupies two bytes: +* 1 -- Label number (0-99) +128 +* 2 -- Label value (distance from value of +* named label) +* The local label list is terminated with a $00 +* in the label number position. +* +* Format of Macro Definition Entry: +* 0,1 -- Chain to next macro name +* 2,3 -- $0000 +* 4 -- Length of macro name +* 5 -- "[" + $5B +* 6-n -- Rest of Macro name +* etc.-- The packed skeleton lines, each +* terminated by $00. A final $00 +* terminates the skeleton. +* +* Private Labels are kept in a separate table. +* Each label takes 7 bytes. Bytes 0-3 are the +* value, byte 4 is the colon number + $80, +* and bytes 5 and 6 are the macro call number. +* The Private Label table grows downward from +* MACLBL toward $0800. +* +*-------------------------------- +* PACK SYMBOL FROM INPUT LINE +* UP TO 32 CHARACTERS PACKED AT SYMBOL+7 +* AND FOLLOWING. +* # CHARS STORED IN SYMBOL+6 +* RETURN CARRY CLEAR IF NO SYMBOL +* RETURN CARRY SET IF GOOD SYMBOL +*-------------------------------- +PACK LDX #0 POINT AT 1ST CHAR IN NAME + CMP #CHR.PERIOD LOCAL SYMBOL? + BEQ .1 YES + CMP #': COLON MEANS MACRO PRIVATE LABEL + BNE .3 NO, NORMAL SYMBOL +.1 STA SYMBOL+7 SAVE PERIOD OR COLON + JSR GNC.UC GET NEXT CHAR + JSR CHECK.DIGIT + BCC .4 NO, BAD SYMBOL + JSR DECN CONVERT TO BINARY + LDX #0 IN CASE BAD SYMBOL... + LDA DGTCNT VALUE MUST BE < 100 + CMP #3 SO MUST BE 1 OR 2 DIGITS + BCS .4 ...TOO MANY DIGITS, BAD SYMBOL + LDA SYM.VALUE + ORA #$80 BE SURE NOT 00 + STA SYMBOL+8 SAVE VALUE + LDA CALL.NUM JUST IN CASE IT'S A + STA SYMBOL+9 MACRO PRIVATE LABEL + LDA CALL.NUM+1 + STA SYMBOL+10 + INX SIGNAL GOOD SYMBOL + BNE .4 ...ALWAYS +*-------------------------------- +.3 JSR PACK.NAME +.4 JSR BACKUP.CHAR.PNTR + STX SYMBOL+6 SAVE LENGTH + CPX #1 CARRY SET IF AT LEAST ONE CHAR + LDX #0 CLEAR X AGAIN + RTS +*-------------------------------- +* PACK A NAME INTO SYMBOL +*-------------------------------- +PACK.NAME + JSR CHECK.LETTER + BCC .4 NOT A LETTER +.1 CPX #32 SEE IF ALREADY 32 CHARACTERS + BEQ .2 YES, IGNORE + STA SYMBOL+7,X PUT CHAR IN ENTRY + INX POINT AT NEXT SLOT +.2 JSR GNC.UC GET NEXT CHAR FROM LINE + JSR CHECK.DOT.DIGIT.OR.LETTER + BCS .1 VALID CHAR +.4 RTS END OF NAME +*-------------------------------- +* SEARCH SYMBOL TABLE +* # OF CHARS STORED AT SYMBOL+6 +* SYMBOL ITSELF AT SYMBOL+7 AND FOLLOWING +* JSR STSRCH +* IF FOUND: CARRY CLEAR +* (STPNTR)=ADDRESS OF ENTRY +* IF NOT FOUND: CARRY SET +* (STPNTR)=ADDRESS OF +* POINTER CELL WHICH +* SHOULD POINT AT ENTRY +*-------------------------------- +STSRCH SEC CONVERT FIRST CHARACTER + LDA SYMBOL+7 OF SYMBOL TO HASH TABLE INDEX + CMP #CHR.PERIOD SEE IF LOCAL SYMBOL + BEQ .8 YES + CMP #': COLON, THEN PRIVATE LABEL + BNE .12 NO, NORMAL LABEL + JMP SEARCH.PRIVATE.LABELS +.12 SBC #$40 AT-SIGN + ASL DOUBLE INDEX, CLEAR CARRY + ADC #HSHTBL + STA STPNTR + LDA /HSHTBL + ADC #0 + STA STPNTR+1 +.1 LDY #0 + >SYM LDA,STPNTR GET POINTER FROM ENTRY + STA TPTR + INY + >SYM LDA,STPNTR + BEQ .4 END OF CHAIN, NOT IN TABLE + STA TPTR+1 + LDX SYMBOL+6 # CHARS IN SYMBOL + LDY #6 POINT AT LENGTH + >SYM LDA,TPTR USE MINIMUM LENGTH + AND #$3F ISOLATE LENGTH + CMP SYMBOL,Y + INY + BCS .2 + TAX +.2 >SYM LDA,TPTR COMPARE BYTES FROM BOTH + AND #$7F ALLOW FLAG BITS IN SYMBOL + CMP SYMBOL,Y + BCC .3 NOT THIS ONE, BUT KEEP LOOKING + BNE .4 NOT IN THIS CHAIN + DEX + BEQ .5 THE NAME IS THE SAME OR A SUBSET + INY NEXT BYTE PAIR + BNE .2 ...ALWAYS +.3 JSR .7 UPDATE POINTER, CLEAR CARRY + BCC .1 ...ALWAYS +.4 SEC DID NOT FIND + LDX #0 RESTORE X=0 + RTS +.5 LDY #6 TEST LENGTHS + >SYM LDA,TPTR + AND #$3F ISOLATE LENGTH + CMP SYMBOL+6 # CHARS IN SYMBOL IN TABLE + BEQ .6 SAME EXACTLY + BCS .4 NEW SYMBOL IS SHORTER + BCC .3 NEW SYMBOL IS LONGER +.6 LDY #2 POINT AT VALUE +.65 >SYM LDA,TPTR SET UP VALUE FOR EXPR SCAN + STA SYM.VALUE-2,Y + INY + CPY #6 + BCC .65 +.7 LDA TPTR + STA STPNTR + LDA TPTR+1 + STA STPNTR+1 + CLC SIGNAL DID FIND IT + RTS +*-------------------------------- +.8 LDA CURRENT.MAJOR.LABEL + STA STPNTR + LDA CURRENT.MAJOR.LABEL+1 + BEQ .11 + STA STPNTR+1 + CLC + LDY #6 POINT AT LENGTH + >SYM LDA,STPNTR GET LENGTH OF MAJOR SYMBOL + BPL .4 NO LOCAL SYMBOLS YET + AND #$3F MASK TO REAL LENGTH + ADC #7 POINT AT LOCALS + TAY +.9 >SYM LDA,STPNTR + BEQ .4 END OF LOCALS, NOT FOUND + CMP SYMBOL+8 COMPARE TO NAME OF LOCAL + BEQ .10 FOUND IT! + INY SKIP TO NEXT LOCAL + INY + BNE .9 ...ALWAYS +.10 INY POINT AT VALUE OFFSET + >SYM LDA,STPNTR + CLC + LDY #2 POINT AT MAJOR VALUE + >SYM ADC,STPNTR + STA SYM.VALUE + INY + >SYM LDA,STPNTR + ADC #0 + STA SYM.VALUE+1 + INY + >SYM LDA,STPNTR + ADC #0 + STA SYM.VALUE+2 + INY + >SYM LDA,STPNTR + ADC #0 + STA SYM.VALUE+3 + CLC + RTS +.11 LDY #QER9 NO NORMAL LABEL YET + JMP SOFT.ERROR +*-------------------------------- +* SEARCH PRIVATE LABEL TABLE +*-------------------------------- +SEARCH.PRIVATE.LABELS + LDA MACLBL + STA STPNTR + LDA MACLBL+1 +.1 STA STPNTR+1 + CMP LO.MEM+1 END OF TABLE YET? + BCS .3 ...YES, NO MORE LABELS + LDY #6 + >SYM LDA,STPNTR + AND #$3F ISOLATE FROM FLAG BITS + CMP SYMBOL+10 + BNE .2 NO + DEY + >SYM LDA,STPNTR + CMP SYMBOL+9 + BNE .2 NO + DEY + >SYM LDA,STPNTR + CMP SYMBOL+8 + BEQ .4 YES, FOUND IT! +.2 CLC BUMP PNTR TO NEXT LABEL + LDA STPNTR + ADC #7 + STA STPNTR + LDA STPNTR+1 + ADC #0 + BNE .1 ...ALWAYS +*-------------------------------- +.3 SEC SIGNAL NOT FOUND + RTS +*-------------------------------- +.4 DEY +.5 >SYM LDA,STPNTR + STA SYM.VALUE,Y + DEY + BPL .5 + CLC + RTS +*-------------------------------- +* ADD SYMBOL TO TABLE +*-------------------------------- +STADD LDA SYMBOL+7 SEE IF LOCAL SYMBOL + CMP #CHR.PERIOD + BEQ .5 YES + CMP #': COLON, PRIVATE LABEL + BNE .11 NO, NORMAL LABEL + JMP ADD.PRIVATE.LABEL +.11 LDY #1 POINT AT POINTER +.1 >SYM LDA,STPNTR GET CURRENT POINTER + STA SYMBOL,Y + LDA EOT,Y + >SYM STA,STPNTR + STA PNTR,Y + STA CURRENT.MAJOR.LABEL,Y + LDA ORGN,Y VALUE + STA SYMBOL+2,Y + LDA ORGN+2,Y + STA SYMBOL+4,Y + DEY + BPL .1 + CLC COMPUTE ENTRY SIZE + LDA SYMBOL+6 FROM SYMBOL SIZE + ADC #7 +.2 PHA SAVE SIZE + LDY EOT+1 + CLC + ADC EOT SEE IF ROOM FOR NEW ENTRY + BCC .10 + INY + .DO AUXMEM +.10 CPY /$C000 + BCS .4 MEM FULL ERR + STA EOT + .ELSE +.10 CMP MACSTK + TAX SAVE LOW BYTE + TYA GET HIGH BYTE + SBC MACSTK+1 + BCS .4 MEM FULL ERR + STX EOT + .FIN + STY EOT+1 + PLA GET SIZE + TAY + DEY CORRECT FOR INDEXING +.3 LDA SYMBOL,Y + >SYM STA,PNTR + DEY + BPL .3 + RTS +.4 JMP MFER MEM FULL ERR +*-------------------------------- +.5 LDY #6 LENGTH BYTE + >SYM LDA,STPNTR + BMI .6 ALREADY HAVE SOME LOCAL LABELS + ORA #$80 SET LOCAL FLAG + >SYM STA,STPNTR + BNE .8 ...ALWAYS +.6 LDA EOT BACK UP EOT + BNE .7 OVER 00 TERMINATOR + DEC EOT+1 OF LOCALS +.7 DEC EOT +.8 LDA SYMBOL+8 NAME OF LOCAL + STA SYMBOL SET UP TO ADD TO SYMBOL TABLE + SEC + LDY #1 + JSR CALC.OFFSET.BYTE + JSR CALC.OFFSET.BYTE + BNE .9 ERROR > 255 + JSR CALC.OFFSET.BYTE + BNE .9 ERROR > 255 + JSR CALC.OFFSET.BYTE + BNE .9 ERROR > 255 + LDA EOT + STA PNTR + LDA EOT+1 + STA PNTR+1 + LDA #3 SIZE IS 3 BYTES + BNE .2 ...ALWAYS +.9 JMP GT255ERR VALUE > 255 +*-------------------------------- +CALC.OFFSET.BYTE + INY + LDA ORGN-2,Y + >SYM SBC,STPNTR + STA SYMBOL-1,Y + RTS +*-------------------------------- +* ADD A PRIVATE LABEL +*-------------------------------- +ADD.PRIVATE.LABEL + SEC + LDA MACLBL + SBC #7 + STA MACLBL + STA STPNTR + LDA MACLBL+1 + SBC #0 + STA MACLBL+1 + STA STPNTR+1 + CMP #8 BELOW $0800? + BCC .3 YES, NO MORE ROOM + LDY #6 POINT AT LAST BYTE +.1 LDA SYMBOL+4,Y + CPY #4 + BCS .2 + LDA ORGN,Y +.2 >SYM STA,STPNTR + DEY + BPL .1 + RTS +.3 JMP MFER +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/scmasm.s.symt +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/SCMASM.S.TSRCH.txt b/SCMASM.31/SCMASM.S.TSRCH.txt new file mode 100644 index 00000000..823f7965 --- /dev/null +++ b/SCMASM.31/SCMASM.S.TSRCH.txt @@ -0,0 +1,291 @@ +NEW + AUTO 3,1 +*-------------------------------------- +* SEARCH TEXT BUFFER FOR LINE +* +* LINE NUMBER TO BE FOUND IS AT 0,X AND 1,X +* +* IF FOUND, RETURN CARRY SET +* (LINE.START) = ADDRESS OF LINE +* (LINE.END ) = ADDRESS OF NEXT LINE +* +* IF NOT FOUND, RETURN CARRY CLEAR +* (LINE.START) = ADDRESS OF NEXT LINE +* (LINE.END ) = ADDRESS OF NEXT LINE +* +*-------------------------------- +SERTXT LDA PP START AT BEGINNING OF TEXT BUFFER + STA LINE.END + LDA PP+1 + STA LINE.END+1 +SERNXT LDA LINE.END+1 CONTINUE SEARCH WITH NEXT LINE + STA LINE.START+1 + LDA LINE.END + STA LINE.START + CMP HI.MEM + LDA LINE.START+1 SEE IF AT END YET + SBC HI.MEM+1 + BCS .3 YES, DID NOT FIND + LDY #0 POINT AT LINE LENGTH + LDA (LINE.START),Y GET LINE LENGTH + ADC LINE.END POINT TO NEXT LINE + STA LINE.END + BCC .1 + INC LINE.END+1 +.1 INY POINT AT LINE NUMBER + LDA (LINE.START),Y COMPARE TO DESRIRED LINE NUMBER + CMP 0,X + INY + LDA (LINE.START),Y + SBC 1,X + BCC SERNXT NOT THERE YET + BNE .2 PASSED IT UP + DEY CHECK LOW BYTE AGAIN + LDA (LINE.START),Y + CMP 0,X + BEQ .4 FOUND IT! +.2 LDA LINE.START PASSED IT UP + STA LINE.END MAKE BOTH POINT AT SAME LINE + LDA LINE.START+1 + STA LINE.END+1 +.3 CLC RETURN CARRY CLEAR +.4 RTS +*-------------------------------- +* DELETE LINES +*-------------------------------- +DELETE + JSR GNNB GET NEXT NON-BLANK CHAR + CMP #'/' + BEQ .1 ...PATHNAME + + JSR CHECK.LETTER + BCC .2 ...NOT LETTER, PROBABLY LINES + +.1 JMP PASS.CMD.TO.PRODOS + +.2 JSR BACKUP.CHAR.PNTR + JSR PARSE.LINE.RANGE + BCS SYNX.3 ...NO NUMBERS, SYNTAX ERROR + +DELETE.LINES + LDX #-1 + SEC +.2 LDA SRCP+1,X SEE IF RANGE EMPTY OR CROSSED + STA LINE.START+1,X + LDA ENDP+1,X + STA A4L+1,X + SBC LINE.START+1,X + STA MOVE.DISTANCE+1,X + INX + BEQ .2 + TAX TEST HI-BYTE OF MOVE.DISTANCE + BPL MOVE.TEXT.UP ...POSITIVE, RANGE GOOD +SYNX.3 JMP SYNX +*-------------------------------- +* MOVE TEXT FROM THRU +* UP BYTES TO +*-------------------------------- +MOVE.TEXT.UP + JSR COMPUTE.BLOCK.SIZE + CLC + LDA PP + ADC MOVE.DISTANCE + STA PP + LDA PP+1 + ADC MOVE.DISTANCE+1 + STA PP+1 + LDY #0 + BEQ .3 ...ALWAYS +*---MOVE A WHOLE BLOCK----------- +.1 LDA (LINE.START),Y MOVE BYTES 255 THRU 1 IN BLOCK + STA (A4L),Y +.2 DEY + BNE .1 + LDA (LINE.START),Y MOVE LOWEST BYTE IN BLOCK + STA (A4L),Y +.3 DEC LINE.START+1 PRIOR BLOCK + DEC A4H + DEX ANY MORE BLOCKS? + BNE .2 YES +*---MOVE SHORT BLOCK IF ANY------ + LDX BLKSIZ PARTIAL BLOCK SIZE + BEQ .5 NONE LEFT +.4 DEY + LDA (LINE.START),Y + STA (A4L),Y + DEX + BNE .4 +.5 RTS +*-------------------------------- +* COPY L1,L2,L3 +* L1 = FIRST LINE OF RANGE TO COPY +* L2 = LAST LINE OF RANGE TO COPY +* L3 = LINE NUMBER BEFORE WHICH TO INSERT +* THE COPIED LINES +*-------------------------------- +ERR1 JMP SYNX +ERR2 .EQ ERR1 +ERR3 JMP MFER +ERR4 .EQ ERR1 +*-------------------------------- +COPY + JSR PARSE.LINE.RANGE + JSR GNNB look for a comma + CMP #',' + BNE ERR1 ...no comma + SEC SAVE POINTER AND COMPUTE LENGTH + LDA SRCP REALLY -(LENGTH) + SBC ENDP + STA MOVE.DISTANCE + LDA SRCP+1 + SBC ENDP+1 + STA MOVE.DISTANCE+1 + BPL ERR2 RANGE BACKWARD OR EMPTY +*-------------------------------- + CLC + LDA PP COMPUTE NEW PP POINTER + ADC MOVE.DISTANCE + STA A4L + LDA PP+1 + ADC MOVE.DISTANCE+1 + STA A4H +*-------------------------------- + LDA A4L SEE IF ROOM FOR THIS + CMP LO.MEM + LDA A4L+1 + SBC LO.MEM+1 + BCC ERR3 MEM FULL ERR +*---Get Target Line Number------- + JSR GNNB pick up first digit of target line number + JSR SCAN.LINE.NUMBER (or it might be ".") + BCS ERR1 ...not a line number of "." + LDA 0,X copy line number to A0L,H + STA A0L + LDA 1,X + STA A0H +*---Verify valid target line----- + LDA SRCP BE SURE NOT INSIDE SOURCE BLOCK + CMP LINE.START + LDA SRCP+1 + SBC LINE.START+1 + BCS .1 BELOW SOURCE BLOCK + LDA LINE.START + CMP ENDP + LDA LINE.START+1 + SBC ENDP+1 + BCC ERR4 INSIDE SOURCE BLOCK +*-------------------------------- +* TARGET IS ABOVE SOURCE BLOCK, SO WE HAVE TO +* ADJUST SOURCE BLOCK POINTERS. +*-------------------------------- + CLC + LDA SRCP + ADC MOVE.DISTANCE + STA SRCP + LDA SRCP+1 + ADC MOVE.DISTANCE+1 + STA SRCP+1 + CLC + LDA ENDP + ADC MOVE.DISTANCE + STA ENDP + LDA ENDP+1 + ADC MOVE.DISTANCE+1 + STA ENDP+1 +*-------------------------------- +.1 JSR MOVE.TEXT.DOWN MAKE THE HOLE +*-------------------------------- + LDA SRCP SAVE SRCP AT A1 + STA A1L (POINTS TO BLOCK TO BE COPIED) + LDA SRCP+1 + STA A1H +.2 CLC ADD (Y) TO A4 + TYA + ADC A4L POINTS TO BEGINNING OF NEXT + STA A4L LINE IN HOLE + BCC .3 + INC A4H +.3 LDY #0 + LDA (A1L),Y COPY LINE LENGTH + STA (A4L),Y + INY INSERT LINE # + LDA A0L OF TARGET LINE + STA (A4L),Y + INY INSERT LINE # + LDA A0H OF TARGET LINE + STA (A4L),Y +.4 INY COPY REST OF LINE + LDA (A1L),Y + STA (A4L),Y + BNE .4 UNTIL TOKEN + INY + CLC + TYA + ADC A1L POINT TO NEXT SOURCE LINE + STA A1L + BCC .5 + INC A1H +.5 CMP ENDP + LDA A1H + SBC ENDP+1 + BCC .2 + LDY #QDELOR + JSR YES.OR.NO + BNE .6 + JSR DELETE.LINES +.6 RTS +*-------------------------------- +* MOVE TEXT FROM THRU +* DOWN - BYTES TO +*-------------------------------- +MOVE.TEXT.DOWN + JSR COMPUTE.BLOCK.SIZE + LDA PP + STA A2L + LDA PP+1 + STA A2H + LDA A4L + STA PP + LDA A4H + STA PP+1 + LDY #0 + BEQ .2 ...ALWAYS +.1 LDA (A2L),Y YES, MOVE 256 BYTES + STA (A4L),Y + INY + BNE .1 + INC A2H POINT AT NEXT BLOCK + INC A4H +.2 DEX ANY WHOLE BLOCKS LEFT? + BNE .1 YES +*---MOVE PARTIAL BLOCK----------- + LDX BLKSIZ SIZE OF PARTIAL BLOCK + BEQ .4 EMPTY +.3 LDA (A2L),Y + STA (A4L),Y + INY + DEX + BNE .3 +.4 RTS +*-------------------------------- +* COMPUTE SIZE OF TEXT BLOCK +* FROM TO +* +* RETURN # WHOLE BLOCKS OF 256 BYTES +1 IN X +* RETURN # BYTES IN PARTIAL BLOCK IN +*-------------------------------- +COMPUTE.BLOCK.SIZE + SEC COMPUTE # OF BYTES TO BE MOVED + LDA LINE.START CURRENT TOP POINTER + SBC PP CURRENT BOTTOM POINTER + STA BLKSIZ SAVE PARTIAL PAGE AMOUNT + LDA LINE.START+1 + SBC PP+1 + TAX # OF WHOLE PAGES IN X + INX + RTS +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/scmasm.s.tsrch +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/SCMASM.S.VECT.txt b/SCMASM.31/SCMASM.S.VECT.txt new file mode 100644 index 00000000..aa1f142b --- /dev/null +++ b/SCMASM.31/SCMASM.S.VECT.txt @@ -0,0 +1,96 @@ +NEW + AUTO 3,1 +*-------------------------------------- + .MA VEC + BIT RDROM + JSR ]1 + BIT RDRAM + RTS + .EM +*-------------------------------- + JMP SEARCH.COMPRESSED.TABLE + JMP GNC + JMP GNC.UC + JMP GNNB + >VEC EXPR + >VEC EXP1 + JMP ASM.ERROR + >VEC EMIT +*-------------------------------- +ERBA LDY #QER5 + JMP SOFT.ERROR +*-------------------------------- + .DUMMY + .OR $D400 +D4.ASM.INIT .BS 3 +D4.ASM.LINE .BS 3 +D4.EMIT.VALUE .BS 3 +D4.DIR.OP .BS 3 +D4.VERSION + .ED +*-------------------------------- +ASM.INIT LDA RDRAM + JSR D4.ASM.INIT + LDA RDROM + RTS +*-------------------------------- +ASM.PARTICULAR LDA RDRAM + JSR D4.ASM.LINE + LDA RDROM + RTS +*-------------------------------- +EMIT.VALUE LDA RDRAM + JSR D4.EMIT.VALUE + LDA RDROM + RTS +*-------------------------------- +PSOP LDA RDRAM + JSR D4.DIR.OP + LDA RDROM + RTS +*-------------------------------- +EXP.OVER.256 + LDA EXP.VALUE+1 + STA EXP.VALUE + LDA EXP.VALUE+2 + STA EXP.VALUE+1 + LDA EXP.VALUE+3 + STA EXP.VALUE+2 + LDA #0 + STA EXP.VALUE+3 + RTS +*-------------------------------- +ASM.ERROR + BIT RDROM + TAX USE ERROR # FOR INDEX + LDY ASM.ERROR.TABLE,X + JMP SOFT.ERROR +*-------------------------------- +ASM.ERROR.TABLE + .DA #QER2 "BAD OPCODE" + .DA #QER5 "BAD ADDRESS" + .DA #QER3 "RANGE" + .DA #QER6 "UNDEF LABEL" +*-------------------------------- +VERSION + LDY #QSC + JSR QT.OUT + LDY #2 +.1 LDA Q.VERSION,Y + JSR MY.COUT + DEY + BPL .1 + LDA #$8D +.2 JSR MY.COUT + INY + LDA RDRAM + LDX D4.VERSION,Y + LDA RDROM + TXA + BNE .2 + RTS +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/scmasm.s.vect +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/SCMASM.S.XTDIR.txt b/SCMASM.31/SCMASM.S.XTDIR.txt new file mode 100644 index 00000000..4c657152 --- /dev/null +++ b/SCMASM.31/SCMASM.S.XTDIR.txt @@ -0,0 +1,85 @@ +NEW + AUTO 3,1 +*-------------------------------------- + .DO 1 +*-------------------------------- +DIR. .SE 0 + .MA DIR + .DO "]1"=DIR.=0 + .DA #"]1"-$C0 +DIR. .SE "]1" + .FIN + .DA #"]2"-$40,]3-1 .]1]2 + .EM +*-------------------------------- +OPTBL.DIR + >DIR A,C,DIR.AC ASCII STRING COMPRESSED + >DIR A,S,PSAS ASCII STRING + >DIR A,T,PSAT ASCII STRING WITH LAST BYTE + >DIR A,Z,PSAZ ASCII STRING WITH ZERO END + >DIR B,S,PSBS BLOCK STORAGE + >DIR D,A,PSDA DATA + >DIR D,O,PSDO DO + >DIR D,U,D.DUMMY DUMMY + >DIR E,D,D.END.DUMMY + >DIR E,L,PSEL ELSE + >DIR E,N,PSEN END OF SOURCE + >DIR E,P,D.END.PHASE + >DIR E,Q,PSEQ EQUATE + >DIR F,I,PSFI FIN + >DIR H,S,PSHS HEX STRING + >DIR I,N,PSIN INCLUDE + >DIR L,I,PSLI LIST ON,/ OFF + >DIR M,A,PSMA MACRO + >DIR O,P,PSOP OPCODE TABLE SELECT + >DIR O,R,PSOR ORIGIN + >DIR P,G,PSPG PAGE EJECT + >DIR P,H,D.PHASE PHASE + >DIR T,A,PSTA TARGET ADDRESS + >DIR T,F,PSTF TARGET FILE + >DIR T,I,PSTI TITLE + >DIR U,S,PSUSER USER DIRECTIVE + .HS 41 <<>> +*-------------------------------- + .ELSE +*-------------------------------- +* DIRECTIVE TABLE +*-------------------------------- + .MA DIR + .AS /]1/ + .DA ]2-1 + .EM +*--------------------------------- +OPTBL.DIR + .HS 0402 ITEM SIZE, KEY SIZE + >DIR AS,PSAS ASCII STRING + >DIR AT,PSAT ASCII STRING WITH LAST BYTE + >DIR BS,PSBS BLOCK STORAGE + >DIR DA,PSDA DATA + >DIR DO,PSDO DO + >DIR DU,D.DUMMY DUMMY + >DIR ED,D.END.DUMMY + >DIR EL,PSEL ELSE + >DIR EN,PSEN END OF SOURCE + >DIR EP,D.END.PHASE + >DIR EQ,PSEQ EQUATE + >DIR FI,PSFI FIN + >DIR HS,PSHS HEX STRING + >DIR IN,PSIN INCLUDE + >DIR LI,PSLI LIST ON,/ OFF + >DIR MA,PSMA MACRO + >DIR OP,PSOP OPCODE TABLE SELECT + >DIR OR,PSOR ORIGIN + >DIR PG,PSPG PAGE EJECT + >DIR PH,D.PHASE PHASE + >DIR TA,PSTA TARGET ADDRESS + >DIR TF,PSTF TARGET FILE + >DIR TI,PSTI TITLE + >DIR US,PSUSER USER DIRECTIVE + .HS 00 MARK END OF TABLE + .FIN +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/scmasm.s.xtdir +LOAD usr/src/scmasm.31/scmasm.s +ASM diff --git a/SCMASM.31/SCMASM.S.txt b/SCMASM.31/SCMASM.S.txt new file mode 100644 index 00000000..42ab02a1 --- /dev/null +++ b/SCMASM.31/SCMASM.S.txt @@ -0,0 +1,91 @@ +NEW + AUTO 3,1 + .LIST OFF + .OR $2000 + .TF SCMASM.SYSTEM,TSYS +*-------------------------------------- +VERSION.HI .EQ 3 VERSION 3.0 +VERSION.LO .EQ 1 +*-------------------------------- +AUXMEM .EQ 1 ...USE AUXMEM FOR SYMBOL TABLE +ROCKWELL .EQ 1 0 = LEAVE OUT ROCKWELL OPTION +SWEET.16 .EQ 1 0 = LEAVE OUT SWEET-16 OPTION +*-------------------------------------- + .MA DEBUG +:1 bit $C000 + bpl :1 + sta $C010 + .EM +*-------------------------------------- +LOWERCASE .EQ 1 +*-------------------------------------- + .INB usr/src/scmasm.31/scmasm.s.ldr + .BS $2200-* +*-------------------------------- + .PH $8000 + .INB usr/src/scmasm.31/scmasm.s.data + .INB usr/src/scmasm.31/scmasm.s.param + .INB usr/src/scmasm.31/scmasm.s.edit + .INB usr/src/scmasm.31/scmasm.s.mcmds + .INB usr/src/scmasm.31/scmasm.s.scmd + .INB usr/src/scmasm.31/scmasm.s.tsrch + .INB usr/src/scmasm.31/scmasm.s.fndrep + .INB usr/src/scmasm.31/scmasm.s.rline + .INB usr/src/scmasm.31/scmasm.s.elines + .INB usr/src/scmasm.31/scmasm.s.output + .INB usr/src/scmasm.31/scmasm.s.disk + .INB usr/src/scmasm.31/scmasm.s.pline + .INB usr/src/scmasm.31/scmasm.s.asmgen + .INB usr/src/scmasm.31/scmasm.s.asmnl + .INB usr/src/scmasm.31/scmasm.s.exp + .INB usr/src/scmasm.31/scmasm.s.symt + .INB usr/src/scmasm.31/scmasm.s.psym + .INB usr/src/scmasm.31/scmasm.s.macro + .INB usr/src/scmasm.31/scmasm.s.dir1 + .INB usr/src/scmasm.31/scmasm.s.dir2 + .INB usr/src/scmasm.31/scmasm.s.acdir + .INB usr/src/scmasm.31/scmasm.s.newq + .INB usr/src/scmasm.31/scmasm.s.xtdir + .BS $A700-* + .INB usr/src/scmasm.31/scmasm.s.vect + .BS $A800-* + .INB usr/src/scmasm.31/scmasm.s.iostd + .BS $A900-* + .EP +*-------------------------------------- + .PH $AA00 + .INB usr/src/scmasm.31/sci.s.eq + .INB usr/src/scmasm.31/sci.s.cpar + .INB usr/src/scmasm.31/sci.s.cat + .INB usr/src/scmasm.31/sci.s.exec + .INB usr/src/scmasm.31/sci.s.online + .INB usr/src/scmasm.31/sci.s.prin + .INB usr/src/scmasm.31/sci.s.errors + .INB usr/src/scmasm.31/sci.s.loadsave + .INB usr/src/scmasm.31/sci.s.openclose + .INB usr/src/scmasm.31/sci.s.rwpa + .INB usr/src/scmasm.31/sci.s.tables + .BS $BD00-* + .INB usr/src/scmasm.31/sci.s.vars + .BS $BE00-* + .INB usr/src/scmasm.31/sci.s.gp + .BS $BF00-* + .EP +*-------------------------------------- + .INB usr/src/scmasm.31/io.s.iie + .BS $6100-* + .INB usr/src/scmasm.31/io.s.stb80 + .BS $6200-* + .INB usr/src/scmasm.31/io.s.videx + .BS $6400-* + .INB usr/src/scmasm.31/io.s.ultra + .BS $6600-* +*-------------------------------------- + .PH $D400 + .INB usr/src/scmasm.31/asm65816.s + .BS $E000-* + .EP +*-------------------------------------- +MAN +SAVE usr/src/scmasm.31/scmasm.s +ASM diff --git a/SYS/KERNEL.S.CORE.txt b/SYS/KERNEL.S.CORE.txt index e060fe45..4d0b7a19 100644 --- a/SYS/KERNEL.S.CORE.txt +++ b/SYS/KERNEL.S.CORE.txt @@ -142,11 +142,18 @@ CORE.Quit php >MLICALL MLIDEALLOCIRQ - ldx #5 + bit RDIOUDIS + sta SETIOUDIS + sta CLRDHIRES + bmi .1 -.1 stz K.MLI.PARAMS+1,x + sta CLRIOUDIS + +.1 ldx #5 + +.2 stz K.MLI.PARAMS+1,x dex - bpl .1 + bpl .2 lda #4 ldx #MLIQUIT diff --git a/SYS/KERNEL.S.DEV.txt b/SYS/KERNEL.S.DEV.txt index bf103ad9..c2a153bc 100644 --- a/SYS/KERNEL.S.DEV.txt +++ b/SYS/KERNEL.S.DEV.txt @@ -210,11 +210,6 @@ DEV.OPEN ldx #IOCTL.OPEN .9 rts *-------------------------------------- -DEV.CLOSE ldx #IOCTL.CLOSE - lda IO.hFD - - jmp (pDrv) -*-------------------------------------- DEV.READ ldx #IOCTL.READ .HS 2C BIT ABS *-------------------------------------- @@ -237,9 +232,9 @@ DEV.EOF lda #S.IOCTL.S.EOF DEV.GetStatus sta K.S.IOCTL+S.IOCTL.S ldx #IOCTL.STATUS -* ldy #S.FD.DEV.DEVID -* lda (pFD),y -* sta K.S.IOCTL+S.IOCTL.UNITNUM + .HS 2C BIT ABS +*-------------------------------------- +DEV.CLOSE ldx #IOCTL.CLOSE *-------------------------------------- DEV.pDrvJmp >LDYAI K.S.IOCTL jmp (pDrv) diff --git a/SYS/KERNEL.S.JMP.txt b/SYS/KERNEL.S.JMP.txt index 0b3a66d1..1b72fe0c 100644 --- a/SYS/KERNEL.S.JMP.txt +++ b/SYS/KERNEL.S.JMP.txt @@ -5,7 +5,7 @@ NEW *-------------------------------------- * Bank 1 *-------------------------------------- -K.SYSCALL .DA K.ChTyp $00 : STAT +K.SYSCALL .DA 0 $00 : STAT .DA K.ChMod .DA K.FStat .DA K.Stat @@ -54,16 +54,16 @@ K.SYSCALL .DA K.ChTyp $00 : STAT .DA 0 .DA 0 .DA 0 - .DA 0 - .DA 0 - .DA 0 + .DA K.Online $58 : PRODOS + .DA K.ChTyp + .DA K.ChAux .DA K.SetAttr *-------------------------------------- * Bank 2 *-------------------------------------- .DA K.Mount $60 .DA K.UMount - .DA K.Online + .DA 0 .DA K.GetStkObj .DA K.Shift $68 : ARG .DA K.ArgV diff --git a/SYS/KERNEL.S.MOUNT.txt b/SYS/KERNEL.S.MOUNT.txt index d81198a1..11456f7f 100644 --- a/SYS/KERNEL.S.MOUNT.txt +++ b/SYS/KERNEL.S.MOUNT.txt @@ -54,11 +54,6 @@ K.UMount tax .9 lda #E.INVH sec rts -*-------------------------------------- -K.Online >PULLW K.MLI.PARAMS+2 - >PULLB K.MLI.PARAMS+1 - >MLICALL MLIONLINE - rts */-------------------------------------- * # GetStkObj * ## C diff --git a/SYS/KERNEL.S.PRODOS.txt b/SYS/KERNEL.S.PRODOS.txt new file mode 100644 index 00000000..fb27db00 --- /dev/null +++ b/SYS/KERNEL.S.PRODOS.txt @@ -0,0 +1,78 @@ +NEW + AUTO 3,1 +*-------------------------------------- +K.Online >PULLW K.MLI.PARAMS+2 + >PULLB K.MLI.PARAMS+1 + >MLICALL MLIONLINE + rts +*/-------------------------------------- +* # ChTyp +* Change The type of a ProDOS File +* ## C +* `int chtyp(const char *filepath, short int filetype);` +* ## ASM +* `>PUSHW filepath` +* `>PUSHB filetype` +* `>SYSCALL ChTyp` +* ## RETURN VALUE +*\-------------------------------------- +K.ChTyp jsr PFT.CheckPath1 + bcs PRODOS.RET3 + + >MLICALL MLIGETFILEINFO + bcs PRODOS.RET3 + + >PULLB K.MLI.PARAMS+S.FI.T + bra PRODOS.SFIRET2 +*/-------------------------------------- +* # ChAux +* Change The type of a ProDOS File +* ## C +* `int chaux(const char *filepath, int auxtype);` +* ## ASM +* `>PUSHW filepath` +* `>PUSHB filetype` +* `>SYSCALL ChAux` +* ## RETURN VALUE +*\-------------------------------------- +K.ChAux jsr PFT.CheckPath2 + bcs PRODOS.RET4 + + >MLICALL MLIGETFILEINFO + bcs PRODOS.RET4 + + >PULLW K.MLI.PARAMS+S.FI.AUXTYPE + bra PRODOS.SFIRET2 +*/-------------------------------------- +* # SetAttr +* Change Attributes of a ProDOS File +* ## C +* `int setattr(const char *filepath, short int attributes);` +* ## ASM +* `>PUSHW filepath` +* `>PUSHB attributes` +* `>SYSCALL setattr` +* ## RETURN VALUE +*\-------------------------------------- +K.SetAttr jsr PFT.CheckPath1 + bcs PRODOS.RET3 + + >MLICALL MLIGETFILEINFO + bcs PRODOS.RET3 + + >PULLB K.MLI.PARAMS+S.FI.A + +PRODOS.SFIRET2 >MLICALL MLISETFILEINFO + bra PRODOS.RET2 + +PRODOS.RET4 inc pStack +PRODOS.RET3 inc pStack +PRODOS.RET2 inc pStack + inc pStack + + rts +*-------------------------------------- +MAN +SAVE usr/src/sys/kernel.s.prodos +LOAD usr/src/sys/kernel.s +ASM diff --git a/SYS/KERNEL.S.STAT.txt b/SYS/KERNEL.S.STAT.txt index 168f676a..4ab11f25 100644 --- a/SYS/KERNEL.S.STAT.txt +++ b/SYS/KERNEL.S.STAT.txt @@ -1,48 +1,6 @@ NEW AUTO 3,1 */-------------------------------------- -* # ChTyp -* Change The type of a ProDOS File -* ## C -* `int chtyp(const char *filepath, short int filetype);` -* ## ASM -* `>PUSHW filepath` -* `>PUSHB filetype` -* `>SYSCALL chtyp` -* ## RETURN VALUE -*\-------------------------------------- -K.ChTyp jsr PFT.CheckPath1 - bcs K.ChMod.RET3 - - >MLICALL MLIGETFILEINFO - bcs K.ChMod.RET3 - - lda (pStack) - sta K.MLI.PARAMS+S.FI.T - bra K.SetAttr.I -*/-------------------------------------- -* # SetAttr -* Change Attributes of a ProDOS File -* ## C -* `int setattr(const char *filepath, short int attributes);` -* ## ASM -* `>PUSHW filepath` -* `>PUSHB attributes` -* `>SYSCALL setattr` -* ## RETURN VALUE -*\-------------------------------------- -K.SetAttr jsr PFT.CheckPath1 - bcs K.ChMod.RET3 - - >MLICALL MLIGETFILEINFO - bcs K.ChMod.RET3 - - lda (pStack) - sta K.MLI.PARAMS+S.FI.A - -K.SetAttr.I >MLICALL MLISETFILEINFO - bra K.ChMod.RET3 -*-------------------------------------- * # ChMod * change permissions of a file * ## C @@ -52,9 +10,9 @@ K.SetAttr.I >MLICALL MLISETFILEINFO * `>PUSHW mode` * `>SYSCALL chmod` * ## RETURN VALUE -*-------------------------------------- +*\-------------------------------------- K.ChMod jsr PFT.CheckPath2 - bcs K.ChMod.RET4 + bcs STAT.RET4 jsr STAT.PM @@ -72,13 +30,13 @@ K.ChMod jsr PFT.CheckPath2 >MLICALL MLIACL .9 rts -K.ChMod.RET4 inc pStack +STAT.RET4 inc pStack -K.ChMod.RET3 inc pStack +STAT.RET3 inc pStack inc pStack inc pStack rts -*-------------------------------------- +*/-------------------------------------- * # FStat * Return information about a hFILE * ## C @@ -88,10 +46,10 @@ K.ChMod.RET3 inc pStack * `>PUSHW statbuf` * `>SYSCALL fstat` * ## RETURN VALUE -*-------------------------------------- +*\-------------------------------------- K.FStat ldy #2 jsr PFT.CheckNodeY - bcs K.ChMod.RET3 + bcs STAT.RET3 >PULLW K.Stat.Store.2+1 @@ -139,7 +97,7 @@ STAT.RTS rts * ## RETURN VALUE *\-------------------------------------- K.Stat jsr PFT.CheckPath2 - bcs K.ChMod.RET4 go discard statbuf + bcs STAT.RET4 go discard statbuf >PULLW K.Stat.Store.2+1 @@ -165,7 +123,7 @@ K.Stat jsr PFT.CheckPath2 * A = EC *\------------------------------------- K.MKDir jsr PFT.CheckPath2 - bcs K.ChMod.RET4 + bcs STAT.RET4 jsr STAT.PM @@ -196,7 +154,7 @@ K.MKFIFO jsr STAT.PM ldy #0 -.1 lda STAT.FIFO,y +.1 lda UNISTD.DEVFIFO,y sta (ZPPtr1),y fill pathname buffer iny cpy #9 @@ -220,8 +178,6 @@ K.MKFIFO jsr STAT.PM inc ZPPtr1+1 bra K.MkNod.I -*-------------------------------------- -STAT.FIFO .AS "/dev/fifo" */-------------------------------------- * # MkNod * Create a special or ordinary file. diff --git a/SYS/KERNEL.S.STDIO.txt b/SYS/KERNEL.S.STDIO.txt index b9d1eb3b..3f7a4d75 100644 --- a/SYS/KERNEL.S.STDIO.txt +++ b/SYS/KERNEL.S.STDIO.txt @@ -1130,6 +1130,7 @@ PrintF.PutC phy inc pIOBuf+1 inc PrintF.Cnt+1 + .8 clc rts @@ -1194,7 +1195,7 @@ K.FScanF ldx #2 K.SScanF ldx #3 *-------------------------------------- K.SScanF.1 clc format string->ptr1 - jsr STDIO.GetParams + jsr STDIO.GetParams stz PrintF.Cnt stx ZPPtr2 sta ZPPtr2+1 Output buffer->ZPPtr2 @@ -1270,10 +1271,11 @@ K.SScanF.1 clc format string->ptr1 jsr .5 bcs .9 out of Ptr on stack - inc .8+1 parsed one more arg! - bra .1 + inc PrintF.Cnt parsed one more arg! + bra .1 no chance more than 256 ptrs on stack -.8 lda #$ff SELF MODIFIED Arg processed +.8 ldy PrintF.Cnt Arg processed + lda #0 clc jmp STDIO.Exit *-------------------------------------- @@ -1307,16 +1309,16 @@ K.SScanF.H lda K.SScanFTBL+1,x Get VAR size jsr MATH.Hex2ACC32 -K.SScanF.GetVAL jsr SHARED.AddY2P2 Y=char count parsed +K.SScanF.GetVAL jsr SHARED.AddY2P2 Y=char count parsed -.1 ply get back VAL size + ply get back VAL size -.2 lda ACC32-1,y +.1 lda ACC32-1,y dey sta (ZPPtr3),y - bne .2 + bne .1 -.9 rts + rts *-------------------------------------- K.SScanF.S ldy #$ff diff --git a/SYS/KERNEL.S.UNISTD.txt b/SYS/KERNEL.S.UNISTD.txt index 05a24ae4..6206f35f 100644 --- a/SYS/KERNEL.S.UNISTD.txt +++ b/SYS/KERNEL.S.UNISTD.txt @@ -26,7 +26,7 @@ UNISTD.Open ldx #5 /dev/ bcs .8 .1 lda K.MLI.PATH,x - cmp IO.DEV-1,x + cmp UNISTD.DEVFIFO-1,x bne .8 dex @@ -192,7 +192,7 @@ K.ChOwn jsr PFT.CheckPath2 .9 >RET 4 *-------------------------------------- -IO.DEV .AS "/dev/" +UNISTD.DEVFIFO .AS "/dev/fifo" *-------------------------------------- MAN SAVE usr/src/sys/kernel.s.unistd diff --git a/SYS/KERNEL.S.txt b/SYS/KERNEL.S.txt index 5d31ee32..36d2ff1c 100644 --- a/SYS/KERNEL.S.txt +++ b/SYS/KERNEL.S.txt @@ -80,6 +80,7 @@ D1.B .PH $D000 .INB usr/src/sys/kernel.s.dirent .INB usr/src/sys/kernel.s.unistd .INB usr/src/sys/kernel.s.stdio + .INB usr/src/sys/kernel.s.prodos .INB usr/src/sys/kernel.s.dev .INB usr/src/sys/kernel.s.sock .INB usr/src/sys/kernel.s.pipe diff --git a/SYS/KM.VEDRIVE.S.CF.txt b/SYS/KM.VEDRIVE.S.CF.txt new file mode 100644 index 00000000..682f9850 --- /dev/null +++ b/SYS/KM.VEDRIVE.S.CF.txt @@ -0,0 +1,379 @@ +NEW + AUTO 3,1 +*-------------------------------------- +VEDRIVE.ReadConf + jsr MLI + .DA #MLIGETPREFIX + .DA MLIGETPREFIX.P + bcs .9 + + ldx #0 + ldy CONF.FILEPATH + +.1 lda CONF.FILENAME,x + iny + sta CONF.FILEPATH,y + inx + cpx #CONF.FILENAME.L + bne .1 + + sty CONF.FILEPATH + + lda #CONF.FILEPATH + pha + lda /CONF.FILEPATH + pha + >LDYAI VEDRIVE.CONF + jsr PrintFYA + + jsr MLI + .DA #MLIOPEN + .DA MLIOPEN.P + bcc .10 + + >LDYAI VEDRIVE.CONFKO + jsr PrintFYA + sec + rts + +.10 lda MLIOPEN.P+5 + sta MLINEWLINE.P+1 + sta MLIREAD.P+1 + sta MLICLOSE.P+1 + + jsr MLI + .DA #MLINEWLINE + .DA MLINEWLINE.P + bcs .9 + +.2 jsr MLI + .DA #MLIREAD + .DA MLIREAD.P + bcs .8 + + jsr VEDRIVE.CONF.L + bcc .2 + + >LDYAI VEDRIVE.CONFSYN + jsr PrintFYA + + sec + bra .9 + +.8 cmp #MLI.E.EOF + sec + bne .9 + + lda CONF.NIC + bmi .9 + + lda CONF.SLOT + beq .9 + + lda CONF.SERVER + beq .9 + + clc + +.9 php + pha + jsr MLI + .DA #MLICLOSE + .DA MLICLOSE.P + pla + plp + rts +*-------------------------------------- +VEDRIVE.CONF.L lda CONF.LBUF + + cmp #13 CR + beq .8 + + cmp #'#' comment + beq .8 + + lda #CONF.LBUF + sta ZPPtr1 + lda /CONF.LBUF + sta ZPPtr1+1 + + ldy #CONF.KW + lda /CONF.KW + jsr VEDRIVE.CONF.KW + bcs .9 + + ldx idx + jmp (.5,x) + +.5 .DA VEDRIVE.CONF.KW.NIC + .DA VEDRIVE.CONF.KW.SLOT + .DA VEDRIVE.CONF.KW.ADDRESS + .DA VEDRIVE.CONF.KW.MASK + .DA VEDRIVE.CONF.KW.GATEWAY + .DA VEDRIVE.CONF.KW.SERVER + .DA VEDRIVE.CONF.KW.PORT + +.8 clc + rts + +.9 sec + rts +*-------------------------------------- +VEDRIVE.CONF.KW.NIC + jsr VEDRIVE.CONF.SKIPSP + bcs .9 + + ldy #CONF.KW.NIC + lda /CONF.KW.NIC + + jsr VEDRIVE.CONF.KW + bcs .9 + + lda idx + sta CONF.NIC + + clc +.9 rts +*-------------------------------------- +VEDRIVE.CONF.KW.SLOT + jsr VEDRIVE.CONF.SKIPSP + bcs .9 + + lda (ZPPtr1) + cmp #'1' + bcc .9 + + cmp #'8' + bcs .9 + + and #$0F + sta CONF.SLOT + + clc + rts + +.9 sec + rts +*-------------------------------------- +VEDRIVE.CONF.KW.ADDRESS + ldx #CONF.ADDRESS-CONF.IPCFG + .HS 2C BIT ABS +VEDRIVE.CONF.KW.MASK + ldx #CONF.MASK-CONF.IPCFG + .HS 2C BIT ABS +VEDRIVE.CONF.KW.GATEWAY + ldx #CONF.GATEWAY-CONF.IPCFG + .HS 2C BIT ABS +VEDRIVE.CONF.KW.SERVER + ldx #CONF.SERVER-CONF.IPCFG + + jsr VEDRIVE.CONF.SKIPSP + bcs .9 + + jsr VEDRIVE.CONF.GetIPatX + +.9 rts +*-------------------------------------- +VEDRIVE.CONF.KW.PORT + jsr VEDRIVE.CONF.SKIPSP + bcs .9 + + jsr VEDRIVE.CONF.GetInt + bcs .9 + + lda int + sta CONF.PORT+1 + + lda int+1 + sta CONF.PORT + +.9 rts +*-------------------------------------- +VEDRIVE.CONF.KW sty ZPPtr2 + sta ZPPtr2+1 + + ldy #$ff + +.1 iny + lda (ZPPtr1),y + cmp #13 CR + beq .2 + + cmp #32 SPACE + bne .1 + +.2 sty len + + stz idx + +.3 lda len + cmp (ZPPtr2) + bne .6 + + tay + +.4 lda (ZPPtr2),y + dey + cmp (ZPPtr1),y + bne .6 + + tya + bne .4 + + lda ZPPtr1 + clc + adc len + sta ZPPtr1 + bcc .5 + + inc ZPPtr1+1 + +.5 clc + rts + +.6 lda (ZPPtr2) + sec + adc ZPPtr2 + sta ZPPtr2 + bcc .7 + + inc ZPPtr2+1 + +.7 inc idx + inc idx + lda (ZPPtr2) + bne .3 + + sec + rts +*-------------------------------------- +VEDRIVE.CONF.SKIPSP + lda (ZPPtr1) + cmp #32 + bne .9 + + bra .3 + +.1 lda (ZPPtr1) + cmp #13 + beq .9 + +.2 cmp #32 + bne .8 + +.3 inc ZPPtr1 + bne .1 + + inc ZPPtr1+1 + bra .1 + +.8 clc + +.9 rts +*-------------------------------------- +VEDRIVE.CONF.GetIPatX + jsr VEDRIVE.CONF.GetShort + bcs .9 + + ldy #4 + +.1 sta CONF.IPCFG,x + inx + dey + beq .9 CC + + jsr VEDRIVE.GetCharPtr1 + bcs .9 + + cmp #'.' + sec + bne .9 + + jsr VEDRIVE.CONF.GetShort + bcc .1 + +.9 rts +*-------------------------------------- +VEDRIVE.CONF.GetShort + jsr VEDRIVE.CONF.GetInt + bcs .9 + + lda int+1 + sec + bne .9 + + lda int + clc + +.9 rts +*-------------------------------------- +VEDRIVE.CONF.GetInt + stz int + stz int+1 + +.1 lda (ZPPtr1) + cmp #'0' + bcc .8 + + cmp #'9'+1 + bcs .8 + + inc ZPPtr1 + bne .2 + + inc ZPPtr1+1 + +.2 and #$0F + pha + + lda int+1 + pha + lda int + pha + + asl int + rol int+1 x2 + asl int + rol int+1 x4 + + pla + clc + adc int + sta int + + pla + adc int+1 + sta int+1 x4+1 = x5 + + asl int + rol int+1 x10 + + pla + clc + adc int + sta int + bcc .1 + + inc int+1 + bra .1 + +.8 clc + rts +*-------------------------------------- +VEDRIVE.GetCharPtr1 + lda (ZPPtr1) + cmp #13 + beq .9 + + inc ZPPtr1 + bne .8 + + inc ZPPtr1+1 + +.8 clc +.9 rts +*-------------------------------------- +MAN +SAVE usr/src/sys/km.vedrive.s.cf +LOAD usr/src/sys/km.vedrive.s +ASM diff --git a/SYS/KM.VEDRIVE.S.GS.txt b/SYS/KM.VEDRIVE.S.GS.txt new file mode 100644 index 00000000..7e88e826 --- /dev/null +++ b/SYS/KM.VEDRIVE.S.GS.txt @@ -0,0 +1,17 @@ +NEW + AUTO 3,1 +*-------------------------------------- +GS.Init sec + rts +*-------------------------------------- +DRV.GS .EQ * + .PH $D400 + + +*-------------------------------------- + .EP +*-------------------------------------- +MAN +SAVE usr/src/sys/km.vedrive.s.gs +LOAD usr/src/sys/km.vedrive.s +ASM diff --git a/SYS/KM.VEDRIVE.S.IP.txt b/SYS/KM.VEDRIVE.S.IP.txt new file mode 100644 index 00000000..8eebba1e --- /dev/null +++ b/SYS/KM.VEDRIVE.S.IP.txt @@ -0,0 +1,529 @@ +NEW + AUTO 3,1 +*-------------------------------------- +VEDRIVE.MACInit ldx #5 + +.1 lda CONF.SRCMAC,x + sta DHCP.DISC.SRCMAC,x + sta DHCP.REQ.SRCMAC,x + sta DHCP.DISC.CHADDR,x + sta DHCP.REQ.CHADDR,x + sta ARP.REQ.SRCMAC,x + sta ARP.REQ.SHA,x + sta ARP.REP.SRCMAC,x + sta ARP.REP.SHA,x + sta ADT.REQ.SRCMAC,x + dex + bpl .1 + + rts +*-------------------------------------- +VEDRIVE.IPInit ldx #3 + +.1 lda CONF.ADDRESS,x + sta ARP.REQ.SPA,x + sta ARP.REP.TPA,x + sta ADT.REQ.IP.SRC,x + + lda CONF.SERVER,x + sta ARP.REQ.TPA,x + sta ADT.REQ.IP.DST,x + dex + bpl .1 + + rts +*-------------------------------------- +VEDRIVE.DHCPReq >LDYAI DHCP.DISC + >STYA ZPBufPtr + >LDYAI DHCP.DISC.LEN + >STYA ZPBufCnt + jsr VEDRIVE.SendUDP + bcs .9 + + jsr VEDRIVE.InitTimer + +.2 jsr VEDRIVE.READ + bcc .3 + + jsr VEDRIVE.Wait + bcc .2 + + rts + +.3 jsr VEDRIVE.CheckDHCPOffer + bcs .2 + + >LDYAI DHCP.REQ + >STYA ZPBufPtr + >LDYAI DHCP.REQ.LEN + >STYA ZPBufCnt + jsr VEDRIVE.SendUDP + bcs .9 + + jsr VEDRIVE.InitTimer + +.4 jsr VEDRIVE.READ + bcc .5 + + jsr VEDRIVE.Wait + bcc .4 + + rts + +.5 >LDYAI FRAMEBUF + >STYA ZPBufPtr + + jsr VEDRIVE.CheckDHCPFrame + bcs .4 + + eor #S.DHCP.OPTIONS.DHCPAck + bne .4 + +* clc + rts + +.9 sec + rts +*-------------------------------------- +VEDRIVE.IPChecksum + ldy #S.IP.TOTAL.LENGTH+1 + lda ZPBufCnt + sec + sbc #S.ETH.EII + sta (ZPBufPtr),y + dey + lda ZPBufCnt+1 + sbc /S.ETH.EII + sta (ZPBufPtr),y + lda #0 + ldy #S.IP.HDR.CHECKSUM + sta (ZPBufPtr),y + iny + sta (ZPBufPtr),y + + stz ZPCheckSum RESET IP CHECKSUM + stz ZPCheckSum+1 + + clc + + ldy #S.IP.V.IHL + + ldx #10 10 words for IP Header + +.2 lda (ZPBufPtr),y + adc ZPCheckSum + sta ZPCheckSum + iny + lda (ZPBufPtr),y + adc ZPCheckSum+1 + sta ZPCheckSum+1 + iny + dex + bne .2 + + ldy #S.IP.HDR.CHECKSUM + lda ZPCheckSum + adc #0 + eor #$FF + sta (ZPBufPtr),y + iny + lda ZPCheckSum+1 + adc #0 + eor #$FF + sta (ZPBufPtr),y + rts +*-------------------------------------- +VEDRIVE.UDPChecksum + clc + + ldy #S.UDP.LENGTH+1 + lda (ZPBufPtr),y + adc #S.IP.PROTOCOL.UDP + sta ZPCheckSum+1 + + dey + lda (ZPBufPtr),y + adc /S.IP.PROTOCOL.UDP (all zero) + sta ZPCheckSum + jsr VEDRIVE.AddSrcDstIPToChecksum + + ldy #S.UDP.LENGTH+1 + lda (ZPBufPtr),y + eor #$ff + tax + + dey + lda (ZPBufPtr),y + eor #$ff + ldy #S.UDP.CHECKSUM +*-------------------------------------- +* X,A = !ByteCount, Y = Offset in Frame +*-------------------------------------- +VEDRIVE.ComputeChecksum + phy Save Offset + pha Save !ByteCount.HI + + lda #0 Reset Checksum + sta (ZPBufPtr),y + iny + sta (ZPBufPtr),y + + >LDYA ZPBufPtr + >STYA ZPPtr1 + + ldy #S.IP + +.1 inx + bne .11 + + pla + inc + beq .8 + + pha +.11 lda (ZPPtr1),y + adc ZPCheckSum + sta ZPCheckSum + + iny + bne .20 + + inc ZPPtr1+1 +.20 inx + bne .2 + + pla + inc + beq .7 + + pha + +.2 lda (ZPPtr1),y + + adc ZPCheckSum+1 + sta ZPCheckSum+1 + iny + bne .1 + + inc ZPPtr1+1 + bra .1 + +.7 adc ZPCheckSum+1 A=0 from beq .7 + sta ZPCheckSum+1 + +.8 ply + lda ZPCheckSum + adc #0 Don't forget to add last carry!!! + eor #$FF + sta (ZPBufPtr),y + iny + lda ZPCheckSum+1 + adc #0 Don't forget to add last carry!!! + eor #$FF + sta (ZPBufPtr),y + rts +*-------------------------------------- +VEDRIVE.AddSrcDstIPToChecksum + ldy #S.IP.SRC + ldx #4 4 words for SRC & DST IP + +.1 lda (ZPBufPtr),y + adc ZPCheckSum + sta ZPCheckSum + iny + lda (ZPBufPtr),y + adc ZPCheckSum+1 + sta ZPCheckSum+1 + iny + dex + bne .1 + + rts +*-------------------------------------- +VEDRIVE.CheckDHCPOffer + >LDYAI FRAMEBUF + >STYA ZPBufPtr + + jsr VEDRIVE.CheckDHCPFrame + bcs .9 + + cmp #S.DHCP.OPTIONS.DHCPOffer + bne .9 + + ldy #S.DHCP.YIADDR+3 + ldx #3 + +.2 lda (ZPBufPtr),y + sta DHCP.REQ.OPT.REQIP,x + sta CONF.ADDRESS,x + dey + dex + bpl .2 + + ldy #S.DHCP.SIADDR+3 + lda (ZPBufPtr),y + bne .3 + + ldy #S.IP.SRC+3 + +.3 ldx #3 + +.4 lda (ZPBufPtr),y + sta DHCP.REQ.OPT.SVRIP,x + dey + dex + bpl .4 + +.5 inc ZPPtr1 skip Option 53 (DHCPOffer:530102) + bne .6 + + inc ZPPtr1+1 + +.6 lda (ZPPtr1) + sec + adc ZPPtr1 add option len + 1 + sta ZPPtr1 + bcc .7 + + inc ZPPtr1+1 + +.7 lda (ZPPtr1) + cmp #S.DHCP.OPTIONS.END + beq .8 + + jsr VEDRIVE.GetDHCPOption + bra .5 + +.8 clc + rts + +.9 sec + rts +*-------------------------------------- +VEDRIVE.CheckDHCPFrame + jsr VEDRIVE.CheckUDPFrame + bcs .9 + + ldy #S.DHCP.XID+3 + ldx #3 + +.1 lda (ZPBufPtr),y + cmp DHCP.DISC.XID,x same XID ? + bne .9 + + dey + dex + bpl .1 + + lda ZPBufPtr + clc + adc #S.DHCP.OPTIONS + sta ZPPtr1 + + lda ZPBufPtr+1 + adc /S.DHCP.OPTIONS + sta ZPPtr1+1 + + lda (ZPPtr1) + cmp #S.DHCP.OPTIONS.MSGTYPE + bne .9 + + ldy #2 + lda (ZPPtr1),y + + clc + rts + +.9 sec + rts +*-------------------------------------- +VEDRIVE.GetDHCPOption + cmp #S.DHCP.OPTIONS.MASK + bne .1 + + ldx #CONF.MASK-CONF.IPCFG + bra .5 + +.1 cmp #S.DHCP.OPTIONS.GW + bne .2 + + ldx #CONF.GATEWAY-CONF.IPCFG + bra .5 + +.2 cmp #S.DHCP.OPTIONS.SRVID + bne .9 + + ldy #5 + ldx #3 + +.3 lda (ZPPtr1),y + sta DHCP.REQ.OPT.SVRIP,x + dey + dex + bpl .3 + + rts + +.5 ldy #2 Skip Byte count + lda #4 + +.6 pha + lda (ZPPtr1),y + sta CONF.IPCFG,x + iny + inx + pla + dec + bne .6 + +.9 rts +*-------------------------------------- +VEDRIVE.CheckADTRep + jsr VEDRIVE.CheckUDPFrame + bcs .9 + + ldy #S.TCPUDP.DSTPORT + lda (ZPBufPtr),y + cmp #$C0 + bne .9 + + iny + lda (ZPBufPtr),y + bne .9 + + clc + rts + +.9 sec + rts +*-------------------------------------- +VEDRIVE.CheckUDPFrame + ldy #S.ETH.EII.TYPE + lda (ZPBufPtr),y + cmp /S.ETH.EII.TYPE.IP + bne .9 + + iny + lda (ZPBufPtr),y + cmp #S.ETH.EII.TYPE.IP + bne .9 + + ldy #S.IP.PROTOCOL + lda (ZPBufPtr),y + cmp #S.IP.PROTOCOL.UDP + bne .9 + + clc + rts + +.9 sec + rts +*-------------------------------------- +VEDRIVE.ARPReq >LDYAI ARP.REQ + >STYA ZPBufPtr + >LDYAI S.ARP + >STYA ZPBufCnt + jsr VEDRIVE.SendARP + bcs .9 + + jsr VEDRIVE.InitTimer + + stz bRemoteMac + +.2 jsr VEDRIVE.READ + bcc .3 + + jsr VEDRIVE.Wait + bcc .2 + + rts + +.3 jsr VEDRIVE.CheckARPFrame + + bit bRemoteMac + bpl .2 + + clc +.9 rts +*-------------------------------------- +VEDRIVE.CheckARPFrame + ldy #S.ETH.EII.TYPE + lda (ZPBufPtr),y + cmp /S.ETH.EII.TYPE.ARP + bne .9 + + iny + lda (ZPBufPtr),y + cmp #S.ETH.EII.TYPE.ARP + bne .9 + + ldy #S.ARP.OPERATION+1 + lda (ZPBufPtr),y + + cmp #S.ARP.OPERATION.REP + bne .5 +*-------------------------------------- + ldy #S.ARP.SPA+3 + ldx #3 + +.1 lda (ZPBufPtr),y + cmp CONF.SERVER,x + bne .8 + + dey + dex + bpl .1 + + ldy #S.ARP.SHA+5 + ldx #5 + +.2 lda (ZPBufPtr),y + sta ADT.REQ.DSTMAC,x + dey + dex + bpl .2 + + dec bRemoteMac + + clc + rts +*-------------------------------------- +.5 cmp #S.ARP.OPERATION.REQ + bne .8 + + ldy #S.ARP.TPA+3 + ldx #3 + +.6 lda (ZPBufPtr),y + cmp CONF.ADDRESS,x + bne .8 + + dey + dex + bpl .6 + + ldy #S.ARP.SHA+9 + ldx #9 + +.7 lda (ZPBufPtr),y + sta ARP.REP.THA,x + dey + dex + bpl .7 + + >LDYAI ARP.REP + >STYA ZPBufPtr + >LDYAI S.ARP + >STYA ZPBufCnt + jsr VEDRIVE.SendARP + +.8 clc + rts + +.9 sec + rts +*-------------------------------------- +MAN +SAVE usr/src/sys/km.vedrive.s.ip +LOAD usr/src/sys/km.vedrive.s +ASM diff --git a/SYS/KM.VEDRIVE.S.U1.txt b/SYS/KM.VEDRIVE.S.U1.txt new file mode 100644 index 00000000..045911df --- /dev/null +++ b/SYS/KM.VEDRIVE.S.U1.txt @@ -0,0 +1,248 @@ +NEW + AUTO 3,1 +*-------------------------------------- +U1.Init lda CONF.SLOT + asl + asl + asl + asl + sta DRV.U1+2 set DRV.U1.Slotn0 + + tax + + lda /PP.ID + sta PacketPagePTR+1,x + lda #PP.ID + sta PacketPagePTR,x + + lda PacketPageDATA+1,x + cmp /CS8900A.DEVID + bne .9 + + lda PacketPageDATA,x + cmp #CS8900A.DEVID + beq .1 + +.9 sec + rts + +.1 lda CONF.SLOT + pha + + lda /PP.REVISION Get Revision# of ths chip... + sta PacketPagePTR+1,x + lda #PP.REVISION + sta PacketPagePTR,x + + lda PacketPageDATA+1,x + pha + lda PacketPageDATA,x + pha + + lda #U1.Name + pha + lda /U1.Name + pha + + >LDYAI VEDRIVE.NICOK + jsr PrintFYA + + ldx DRV.U1+2 + + lda /PP.RxCTL + sta PacketPagePTR+1,x + lda #PP.RxCTL + sta PacketPagePTR,x + lda /PP.RxCTL.LID+PP.RxCTL.RxOKA+PP.RxCTL.IA+PP.RxCTL.BroadcastA+PP.RxCTL.RuntA + sta PacketPageDATA+1,x + lda #PP.RxCTL.LID+PP.RxCTL.RxOKA+PP.RxCTL.IA+PP.RxCTL.BroadcastA+PP.RxCTL.RuntA + sta PacketPageDATA,x + + lda /PP.MAC + sta PacketPagePTR+1,x + lda #PP.MAC + sta PacketPagePTR,x + + lda CONF.SRCMAC+1 + sta PacketPageDATA+1,x + lda CONF.SRCMAC+0 + sta PacketPageDATA,x + + lda /PP.MAC+2 + sta PacketPagePTR+1,x + lda #PP.MAC+2 + sta PacketPagePTR,x + + lda CONF.SRCMAC+3 + sta PacketPageDATA+1,x + lda CONF.SRCMAC+2 + sta PacketPageDATA,x + + lda /PP.MAC+4 + sta PacketPagePTR+1,x + lda #PP.MAC+4 + sta PacketPagePTR,x + + lda CONF.SRCMAC+5 + sta PacketPageDATA+1,x + lda CONF.SRCMAC+4 + sta PacketPageDATA,x + + lda /PP.LineCTL + sta PacketPagePTR+1,x + lda #PP.LineCTL + sta PacketPagePTR,x + + lda /PP.LineCTL.LID+PP.LineCTL.SerRxOn+PP.LineCTL.SerTxOn+PP.LineCTL.10BaseT + sta PacketPageDATA+1,x + lda #PP.LineCTL.LID+PP.LineCTL.SerRxOn+PP.LineCTL.SerTxOn+PP.LineCTL.10BaseT + sta PacketPageDATA,x + + clc + rts +*-------------------------------------- +U1.READ php + sei + + ldx DRV.U1+2 + + lda /PP.RxEvent + sta PacketPagePTR+1,x + lda #PP.RxEvent + sta PacketPagePTR,x + + lda PacketPageDATA+1,x + ldy PacketPageDATA,x + and /PP.RxEvent.RxOK+PP.RxEvent.IA+PP.RxEvent.Brdcast+PP.RxEvent.Runt + beq U1.READWRITE.9 + + lda RTDATA+1,x discard RxStatus + lda RTDATA,x + + lda RTDATA+1,x get RxLength + sta ZPBufCnt+1 + eor #$ff + sta ZPnCnt+1 + + lda RTDATA,x + sta ZPBufCnt + eor #$ff + sta ZPnCnt + + ldx DRV.U1+2 + + lda ZPBufPtr+1 + pha + + ldy #0 + +.2 inc ZPnCnt + bne .3 + + inc ZPnCnt+1 + beq .8 + +.3 lda RTDATA,x + sta (ZPBufPtr),y + iny + + inc ZPnCnt + bne .4 + + inc ZPnCnt+1 + beq .8 + +.4 lda RTDATA+1,x + sta (ZPBufPtr),y + iny + bne .2 + + inc ZPBufPtr+1 + bra .2 + +.8 pla + sta ZPBufPtr+1 + + plp + clc + rts +*-------------------------------------- +U1.READWRITE.9 plp + sec + rts +*-------------------------------------- +U1.WRITE php + sei + + ldx DRV.U1+2 + + lda /PP.TxCMD.LID+PP.TxCMD.TxStartFULL + sta TxCMD+1,x + lda #PP.TxCMD.LID+PP.TxCMD.TxStartFULL + sta TxCMD,x + + lda ZPBufCnt+1 + sta TxLength+1,x + eor #$ff + sta ZPnCnt+1 + + lda ZPBufCnt + sta TxLength,x + eor #$ff + sta ZPnCnt + + lda /PP.BusST + sta PacketPagePTR+1,x + lda #PP.BusST + sta PacketPagePTR,x + + lda PacketPageDATA+1,x + ldy PacketPageDATA,x + bit /PP.BusST.Rdy4TxNOW + beq U1.READWRITE.9 + + ldx DRV.U1+2 + + ldy #0 + +.1 inc ZPnCnt + bne .2 + + inc ZPnCnt+1 + beq .8 + +.2 lda (ZPBufPtr),y + sta RTDATA,x + iny + + inc ZPnCnt + bne .3 + + inc ZPnCnt+1 + beq .8 + +.3 lda (ZPBufPtr),y + sta RTDATA+1,x + iny + bne .1 + + inc ZPBufPtr+1 + bne .1 + +.8 plp + clc + rts +*-------------------------------------- +U1.Name >PSTR "Uthernet V1" +*-------------------------------------- +DRV.U1 .EQ * + .PH $D400 + cld + ldx #$ff SELF MODIFIED + + .EP +*-------------------------------------- +MAN +SAVE usr/src/sys/km.vedrive.s.u1 +LOAD usr/src/sys/km.vedrive.s +ASM diff --git a/SYS/KM.VEDRIVE.S.U2.txt b/SYS/KM.VEDRIVE.S.U2.txt new file mode 100644 index 00000000..af58f865 --- /dev/null +++ b/SYS/KM.VEDRIVE.S.U2.txt @@ -0,0 +1,264 @@ +NEW + AUTO 3,1 +*-------------------------------------- +U2.Init lda CONF.SLOT + asl + asl + asl + asl + clc + adc #$88 + sta DRV.U2+2 set DRV.U2.Slotn0 + tax + + lda #W5100.MR.RST + sta W5100.MR,x + + lda #0 + +.1 dec give some time.... + bne .1 + + lda #W5100.MR.PB+W5100.MR.AI+W5100.MR.IND + sta W5100.MR,x + + pha + pla + + lda W5100.MR,x + cmp #W5100.MR.PB+W5100.MR.AI+W5100.MR.IND + bne .9 + + >AR.SELECT RTR + lda W5100.DR,x Get RTR HI + cmp /2000 + bne .9 + + lda W5100.DR,x Get RTR LO + cmp #2000 + beq .3 + +.9 sec + rts + +.3 lda CONF.SLOT + pha + + lda #0 + pha + pha + + lda #U2.Name + pha + lda /U2.Name + pha + + >LDYAI VEDRIVE.NICOK + jsr PrintFYA + + ldx DRV.U2+2 + + lda #W5100.MR.PB+W5100.MR.AI+W5100.MR.IND + sta W5100.MR,x + + >AR.SELECT SHAR + ldy #0 + +.4 lda CONF.SRCMAC,y + sta W5100.DR,x + iny + cpy #6 + bne .4 + + >AR.SELECT RMSR + lda #3 8k,0k,0k,0k + sta W5100.DR,x ...for Socket RX Buffers + sta W5100.DR,x ...for Socket TX Buffers + + >AR.SELECT S0.MR + lda #W5100.AR.Sn.MR.MACRAW+W5100.AR.Sn.MR.MF + sta W5100.DR,x + + >AR.SELECT S0.CR + lda #W5100.AR.Sn.CR.OPEN + sta W5100.DR,x + + + clc + rts +*-------------------------------------- +U2.Read php + sei + + ldx DRV.U2+2 + + >AR.SELECT S0.RX.RSR + lda W5100.DR,x get the received size HI + nop + nop + ora W5100.DR,x LO + bne .1 + + jmp U2.READWRITE.9 + +.1 >AR.SELECT S0.RX.RD + lda W5100.DR,x get the received ptr HI + sta Offset+1 + ldy W5100.DR,x get the received ptr LO + sty Offset + + and /RXTX.MASK + ora /RX.BASE + sta W5100.AR,x + tya + sta W5100.AR+1,x + + lda W5100.DR,x get RX.Size HI (Frame size + 2) + sta TotalSize+1 + lda W5100.DR,x get RX.Size LO + sta TotalSize + + sec + sbc #2 MACRAW:strip 2 bytes Header from Size + sta ZPBufCnt + eor #$ff + sta ZPnCnt + + lda TotalSize+1 + sbc #0 + sta ZPBufCnt + eor #$ff + sta ZPnCnt+1 + + lda ZPBufPtr+1 + pha + + ldy #0 + +.2 inc ZPnCnt + bne .3 + + inc ZPnCnt+1 + beq .8 + +.3 lda W5100.DR,x + sta (ZPBufPtr),y + iny + bne .2 + + inc ZPBufPtr+1 + bra .2 + +.8 >AR.SELECT S0.RX.RD + + lda Offset + clc + adc TotalSize + pha save LO + + lda Offset+1 + adc TotalSize+1 + sta W5100.DR,x write HI + pla + sta W5100.DR,x write LO + + >AR.SELECT S0.CR + lda #W5100.AR.Sn.CR.RCVD + sta W5100.DR,x + + pla + sta ZPBufPtr+1 + + plp + clc + rts +*-------------------------------------- +U2.READWRITE.9 plp + sec + rts +*-------------------------------------- +U2.Write php + sei + + ldx DRV.U2+2 + + lda ZPBufCnt + eor #$ff + sta ZPnCnt + + lda ZPBufCnt+1 + eor #$ff + sta ZPnCnt+1 + + >AR.SELECT S0.TX.FSR + lda W5100.DR,x get send size HI + nop + nop + ldy W5100.DR,x LO + cpy ZPBufCnt + sbc ZPBufCnt+1 + bcc U2.READWRITE.9 + + >AR.SELECT S0.TX.WR + lda W5100.DR,x Get HI + nop + nop + ldy W5100.DR,x Get LO + and /RXTX.MASK + ora /TX.BASE + sta W5100.AR,x Write HI + sta Offset+1 + tya + sta W5100.AR+1,x Write LO + sta Offset + + ldy #0 + +.2 inc ZPnCnt + bne .3 + + inc ZPnCnt+1 + beq .8 + +.3 lda (ZPBufPtr),y + sta W5100.DR,x + iny + bne .2 + + inc ZPBufPtr+1 + bra .2 + +.8 >AR.SELECT S0.TX.WR + lda Offset + clc + adc ZPBufCnt + pha save LO + lda Offset+1 + adc ZPBufCnt+1 + sta W5100.DR,x write HI + pla + sta W5100.DR,x write LO + + >AR.SELECT S0.CR + lda #W5100.AR.Sn.CR.SEND + sta W5100.DR,x + + plp + clc + rts +*-------------------------------------- +U2.Name >PSTR "Uthernet II" +Offset .BS 2 +TotalSize .BS 2 +*-------------------------------------- +DRV.U2 .EQ * + .PH $D400 + cld + ldx #$ff SELF MODIFIED + + .EP +*-------------------------------------- +MAN +SAVE usr/src/sys/km.vedrive.s.u2 +LOAD usr/src/sys/km.vedrive.s +ASM diff --git a/SYS/KM.VEDRIVE.S.txt b/SYS/KM.VEDRIVE.S.txt index 2ef7d66e..90a9cc5b 100644 --- a/SYS/KM.VEDRIVE.S.txt +++ b/SYS/KM.VEDRIVE.S.txt @@ -3,221 +3,258 @@ NEW .LIST OFF .OP 65C02 .OR $2000 - .TF sys/km.vedrive +* .TF sys/km.vedrive + .TF vedrive.pm *-------------------------------------- .INB inc/macros.i .INB inc/io.i .INB inc/monitor.i .INB inc/mli.i .INB inc/mli.e.i + .INB inc/nic.i + .INB inc/nic.8900a.i + .INB inc/nic.w5100.i + .INB inc/nic.91c96.i + .INB inc/eth.i + .INB inc/net.tcpip.i + .INB inc/net.dhcp.i +*-------------------------------------- +ZPPtr1 .EQ $0 +ZPPtr2 .EQ $2 +len .EQ 4 +idx .EQ 5 +int .EQ 6 +ZPBufPtr .EQ 8 +ZPBufCnt .EQ 10 +ZPnCnt .EQ 12 +ZPCheckSum .EQ 14 +timerS .EQ 16 +timerC .EQ 17 +bRemoteMac .EQ 18 *-------------------------------------- -TmpPtr1 .EQ $0 ADT.CMD.VSD .EQ $C5 "E": Virtual Drive Command Envelope ADT.CMD.PING .EQ $D9 "Y": PING DRV.EntryPoint .EQ $BF41 +DRV.ADDR .EQ $D400 *-------------------------------------- -VSDRIVE.Init >LDYAI VSDRIVE.MSG0 +CONF.FBUF .EQ $4000 +CONF.LBUF .EQ $4400 +CONF.FILEPATH .EQ $4500 +FRAMEBUF .EQ $4600 +*-------------------------------------- +VEDRIVE.Init >LDYAI VEDRIVE.MSG0 jsr PrintFYA - jsr VSDRIVE.Check - bcs .90 - -.1 lda #$C1 Self Modified + jsr VEDRIVE.CheckDRV + bcc .1 -.2 jsr SSC.Detect - bcs .99 + >LDYAI VEDRIVE.DRVKO + jsr PrintFYA + rts - stx DRV+2 DRV.Slotn0 +.1 jsr VEDRIVE.ReadConf + bcc .2 - sta .1+1 Slot Cn - and #$0F - pha slot n - >LDYAI VSDRIVE.SSCOK + >LDYAI VEDRIVE.CONFINV + jsr PrintFYA + rts + +.2 jsr VEDRIVE.CheckHW + bcc .3 + + >LDYAI VEDRIVE.NICKO + jsr PrintFYA + rts + +.3 jsr VEDRIVE.MACInit + + lda CONF.ADDRESS + bne .4 + + >LDYAI VEDRIVE.DHCP jsr PrintFYA - jsr VSDRIVE.Ping + jsr VEDRIVE.DHCPReq + bcc .4 - bcs .92 + >LDYAI VEDRIVE.DHCPKO + jsr PrintFYA + rts - >LDYAI VSDRIVE.SRVOK +.4 jsr VEDRIVE.IPInit + + jsr VEDRIVE.ARPReq + bcc .5 + + >LDYAI VEDRIVE.IPKO jsr PrintFYA - jsr VSDRIVE.SetSlot - bcs .91 - pha Push slot + rts + +.5 ldx #11 + +.6 lda CONF.ADDRESS,x + pha + dex + bpl .6 + + >LDYAI VEDRIVE.IPOK + jsr PrintFYA + + jsr VEDRIVE.Ping + bcc .7 + + >LDYAI VEDRIVE.SRVKO + jsr PrintFYA + rts + +.7 >LDYAI VEDRIVE.SRVOK + jsr PrintFYA + + jsr VEDRIVE.SetSlot + bcc .8 + + >LDYAI VEDRIVE.NOSLOT + jsr PrintFYA + rts + +.8 pha Push slot pha 2 times - >LDYAI VSDRIVE.DEVOK + >LDYAI VEDRIVE.DEVOK jsr PrintFYA - jsr VSDRIVE.Install - >LDYAI VSDRIVE.OK - jsr PrintFYA - rts -.90 >LDYAI VSDRIVE.DRVKO - jsr PrintFYA - rts -.91 >LDYAI VSDRIVE.NOSLOT - jsr PrintFYA - rts -.92 pha Push EC - >LDYAI VSDRIVE.SRVKO - jsr PrintFYA - inc .1+1 - lda .1+1 - cmp #$C8 - bne .2 Go try next SSC.... + jsr VEDRIVE.Install + bcc .9 -.99 >LDYAI VSDRIVE.SSCKO + >LDYAI VEDRIVE.DRVIKO + jsr PrintFYA + rts + +.9 >LDYAI VEDRIVE.DRVIOK jsr PrintFYA rts *-------------------------------------- -VSDRIVE.Check bit RRAMWRAMBNK2 +VEDRIVE.CheckDRV + bit RRAMWRAMBNK2 bit RRAMWRAMBNK2 clc - lda $D001 - eor DRV + lda $D400 + eor #$D8 CLD bne .8 - lda $D002 - eor DRV+1 + + lda $D401 + eor #$A2 LDX #imm bne .8 + sec + .8 bit RROMBNK1 rts *-------------------------------------- -SSC.Detect stz TmpPtr1 - sta TmpPtr1+1 -.1 ldx #DEVSIG.Value-DEVSIG.Offset-1 +VEDRIVE.Ping lda CONF.PORT + sta ADT.REQ.UDP.DST -.2 ldy DEVSIG.Offset,x - lda (TmpPtr1),y - cmp DEVSIG.Value,x - bne .3 - dex - bpl .2 - lda TmpPtr1+1 A=SlotCN - asl - asl - asl - asl - tax X=SlotN0 - stz SSC.RESET,x - jsr VSDRIVE.Wait - lda #SSC.CTL.CLKINT+SSC.CTL.B115200+SSC.CTL.8D+SSC.CTL.1S+SSC.CMD.NOP - sta SSC.CTL,x - jsr VSDRIVE.Wait - lda #SSC.CMD.RIRQDIS+SSC.CMD.TE+SSC.CMD.DTR - sta SSC.CMD,x - jsr VSDRIVE.Wait + lda CONF.PORT+1 + sta ADT.REQ.UDP.DST+1 - lda TmpPtr1+1 A=Slot Cn, X=n0 + >LDYAI ADT.REQ + >STYA ZPBufPtr - clc - rts X=SlotN0, A=SlotCN -.3 inc TmpPtr1+1 no match, try next slot.... - lda TmpPtr1+1 - cmp #$C8 - bne .1 -.9 sec + >LDYAI ADT.REQ.LEN + >STYA ZPBufCnt + jsr VEDRIVE.SendUDP + bcs .9 + + jsr VEDRIVE.InitTimer + +.3 jsr VEDRIVE.READ + bcc .4 + + jsr VEDRIVE.Wait + bcc .3 + + rts + +.4 jsr VEDRIVE.CheckADTRep + bcc .8 + + jsr VEDRIVE.CheckARPFrame + bra .3 + +.8 +* clc +.9 rts +*-------------------------------------- +VEDRIVE.CheckHW ldx CONF.NIC + jmp (.1,x) + +.1 .DA GS.Init + .DA U1.Init + .DA U2.Init +*-------------------------------------- +VEDRIVE.SendUDP jsr VEDRIVE.IPChecksum + jsr VEDRIVE.UDPChecksum + +VEDRIVE.SendARP ldx CONF.NIC + jmp (.1,x) + +.1 .DA U1.WRITE + .DA U1.WRITE + .DA U2.WRITE +*-------------------------------------- +VEDRIVE.READ >LDYAI FRAMEBUF + >STYA ZPBufPtr + + ldx CONF.NIC + jmp (.1,x) + +.1 .DA U1.READ + .DA U1.READ + .DA U2.READ +*-------------------------------------- +VEDRIVE.InitTimer + lda VBL + sta timerS + stz timerC rts *-------------------------------------- -VSDRIVE.Ping ldx DRV+2 DRV.Slotn0 - - stz VSDRIVE.Ping.TO - stz VSDRIVE.Ping.TO+1 +VEDRIVE.Wait lda VBL + tax + eor timerS + bpl .8 -.10 jsr VSDRIVE.IncTimer Wait....... - bne .10 - ldy #10 -.1 lda SSC.STATUS,x - and #SSC.STATUS.TDRE Ready for transmit? - bne .20 - - jsr VSDRIVE.IncTimer Wait....... - bne .1 - dey - bne .1 - lda #1 - sec - rts Time Out..... -.20 stz VSDRIVE.Ping.TO - stz VSDRIVE.Ping.TO+1 + stx timerS - ldy #5 5 bytes to send - -.2 lda VSDRIVE.CMDS-1,y - sta SSC.DATA,x -.3 lda SSC.STATUS,x - and #SSC.STATUS.TDRE char transmitted? - bne .4 - - jsr VSDRIVE.IncTimer - bne .3 - lda #2 - sec - rts -.4 dey - bne .2 next byte - lda #521^$ffff 522 bytes to recieve - sta VSDRIVE.Ping.BC - lda /521^$ffff - sta VSDRIVE.Ping.BC+1 - stz VSDRIVE.Ping.TO - stz VSDRIVE.Ping.TO+1 - - ldy #3 EC if no byte recieved -.5 lda SSC.STATUS,x - and #SSC.STATUS.RDRF incoming char? - bne .6 -* jsr VSDRIVE.Wait - jsr VSDRIVE.IncTimer - bne .5 - tya - sec - rts -.6 ldy #4 EC=4 if recieved only partial reply - - lda SSC.DATA,x - inc VSDRIVE.Ping.BC - bne .5 - inc VSDRIVE.Ping.BC+1 - bne .5 - clc - rts -*-------------------------------------- -VSDRIVE.IncTimer - inc VSDRIVE.Ping.TO + dec timerC bne .8 - inc VSDRIVE.Ping.TO+1 -.8 rts -*-------------------------------------- -VSDRIVE.Wait lda #0 -.1 dec - bne .1 + + sec + rts + +.8 clc rts -*-------------------------------------- -VSDRIVE.CMDS .HS C6.00.00.03 - .DA #ADT.CMD.VSD -* C6=C5 eor 03 eor 00 eor 00 -VSDRIVE.Ping.TO .BS 2 -VSDRIVE.Ping.BC .BS 2 *-------------------------------------- * Find 2 free slots in DEVPTRS (D1 & D2) *-------------------------------------- -VSDRIVE.SetSlot ldx #2 Starts at Slot1 +VEDRIVE.SetSlot ldx #2 Starts at Slot1 .1 lda DEVPTRS,x Drive1 cmp DEVPTRS pointing to S0D1 NODEV ? bne .2 + lda DEVPTRS+1,x cmp DEVPTRS+1 bne .2 + lda DEVPTRS+16,x Drive2 cmp DEVPTRS bne .2 + lda DEVPTRS+17,x cmp DEVPTRS+1 bne .2 + lda #DRV.EntryPoint sta DEVPTRS,x sta DEVPTRS+16,x @@ -240,63 +277,56 @@ VSDRIVE.SetSlot ldx #2 Starts at Slot1 lsr exit with A=SLOT clc rts + .2 inx inx cpx #16 bne .1 + rts sec from CPX *-------------------------------------- -VSDRIVE.Install ldx #PATCH.SIZE +VEDRIVE.Install ldx #PATCH.SIZE .1 lda PATCH-1,x sta DRV.EntryPoint-1,x dex bne .1 + bit RRAMWRAMBNK2 bit RRAMWRAMBNK2 - ldx #DRV.SIZE -.2 lda DRV-1,x - sta $D000,x - dex - bne .2 + + + + + + + bit RROMBNK1 clc rts *-------------------------------------- .INB usr/src/shared/x.printf.s *-------------------------------------- -DEVSIG.Offset .HS 05070B0C -DEVSIG.Value .HS 38180131 -VSDRIVE.MSG0 .AZ "VEDRIVE (ADTPro Virtual Ethernet HD) Driver For A2osX\n" -VSDRIVE.DRVKO .AZ "VEDRIVE (Or other custom Driver) Already Installed.\n" -VSDRIVE.SSCKO .AZ "Uthernet2 Not Detected.\n" -VSDRIVE.SSCOK .AZ "Uthernet2 Found At Slot %d.\nContacting ADTPro Server..." -VSDRIVE.SRVKO .AZ "No Response From ADTPro Server (EC=%d).\n" -VSDRIVE.SRVOK .AZ "ADTPro Server Is Online.\n" -VSDRIVE.NOSLOT .AZ "No ProDOS device slot available.\n" -VSDRIVE.DEVOK .AZ "VEDRIVE Installed 2 devices at S%d,D1 & S%d,D2.\n" -VSDRIVE.OK .AZ "VEDRIVE Driver Successfully Installed.\n" -*-------------------------------------- * ProDOS $BE41->$BE4B Patch for switching to BANK2 (10 bytes) *-------------------------------------- PATCH .PH DRV.EntryPoint bit RRAMWRAMBNK2 - jsr $D001 + jsr $D002 bit RRAMWRAMBNK1 rts .EP PATCH.SIZE .EQ *-PATCH *-------------------------------------- -* Driver +* Drivers *-------------------------------------- * OP = 2 : Write drv1 * OP = 3 : Read drv1 * OP = 4 : Write drv2 * OP = 5 : Read drv2 * CMD = $C5+OP+BLKLO+BLKHI+CHKSUM -* DO NOT trash DRV.COMMAND...DRV.BLKNUM as ProDOS +* DO NOT trash DRV.COMMAND...DRV.BLKNUM as ProDOS * reuses them after Block operation -* A1,A2 are used by Disk II Driver, +* A1,A2 are used by Disk II Driver, * so we use it safely as Tmp Ptr *-------------------------------------- DRV.A1L .EQ $3C @@ -305,51 +335,52 @@ DRV.A2L .EQ $3E DRV.A2H .EQ $3F DRV.COMMAND .EQ $42 DRV.UNITNUM .EQ $43 -DRV.BUFF .EQ $44 +DRV.BUFF .EQ $44 DRV.BLKNUM .EQ $46 *-------------------------------------- -DRV .EQ * - .PH $D001 Main LC Bnk 2 $D001->$DFFF - cld -DRV.Slotn0 ldx #$ff Self Modified +DRV.FrmBuf .EQ $DA00 Frame Buffer = 1536 bytes +DRV.FrmBuf.Env .EQ DRV.FrmBuf+S.UDP +DRV.FrmBuf.Cmd .EQ DRV.FrmBuf+S.UDP+1 +DRV.FrmBuf.BlkL .EQ DRV.FrmBuf+S.UDP+2 +DRV.FrmBuf.BlkH .EQ DRV.FrmBuf+S.UDP+3 +DRV.FrmBuf.Sum .EQ DRV.FrmBuf+S.UDP+4 +DRV.FrmBuf.Data .EQ DRV.FrmBuf+S.UDP+5 +*-------------------------------------- +DRV .PH $D001 Main LC Bnk 2 $D001->$DFFF + +DRV.START .BS 1 SELF MODIFIED slot 0n + lda DRV.COMMAND S=0,R=1,W=2,F=3 bne .1 + ldx #$ff return Status ldy #$ff + .8 lda #0 clc rts + .1 cmp #3 beq .8 Format .... + * bcs DRV.DO.CMD.ERR more....IO error ora #2 W=2,R=3 ldy DRV.UNITNUM bpl .2 + adc #2 CC from bcs -.2 sta DRV.CmdBuf.Cmd store cmd + +.2 sta DRV.FrmBuf.Cmd store cmd eor #ADT.CMD.VSD eor DRV.BLKNUM eor DRV.BLKNUM+1 - sta DRV.CmdBuf.Sum Compute & store CheckSum + sta DRV.FrmBuf.Sum Compute & store CheckSum + lda DRV.BLKNUM - sta DRV.CmdBuf.BlkL - + sta DRV.FrmBuf.BlkL lda DRV.BLKNUM+1 - sta DRV.CmdBuf.BlkH -* send CMD+CS - ldy #4 Send 5 bytes including Sum -.3 lda DRV.CmdBuf.Sum,y - jsr DRV.SSCSend - dey - bpl .3 - - ldy #8 - -.5 lda DRV.READWRITE,y - sta $100,y - dey - bpl .5 + sta DRV.FrmBuf.BlkH *-------------------------------------- lda DRV.COMMAND dec 1-1=0 if read @@ -359,18 +390,16 @@ DRV.Slotn0 ldx #$ff Self Modified *-------------------------------------- DRV.DO.CMD.R ldy #3 Read Back and check 4 bytes -.1 jsr DRV.SSCGet - eor DRV.CmdBuf.BlkH,y +.1 eor DRV.FrmBuf.BlkH,y bne DRV.DO.CMD.ERR + dey bpl .1 ldy #4 Read 4 bytes DATE/TIME + 1 Byte Checksum -.2 jsr DRV.SSCGet - - eor DRV.CmdBuf.Sum - sta DRV.CmdBuf.Sum +.2 eor DRV.FrmBuf.Sum + sta DRV.FrmBuf.Sum dey bpl .2 @@ -379,12 +408,12 @@ DRV.DO.CMD.R ldy #3 Read Back and check 4 bytes * Y=0 from TAY - stz DRV.CmdBuf.Sum + stz DRV.FrmBuf.Sum sec -.3 jsr DRV.SSCGet - jsr $100 - eor DRV.CmdBuf.Sum - sta DRV.CmdBuf.Sum + +.3 jsr $100 + eor DRV.FrmBuf.Sum + sta DRV.FrmBuf.Sum iny bne .3 bcc .4 @@ -393,14 +422,16 @@ DRV.DO.CMD.R ldy #3 Read Back and check 4 bytes bcc .3 .4 dec DRV.BUFF+1 - jsr DRV.SSCGet - eor DRV.CmdBuf.Sum + + eor DRV.FrmBuf.Sum bne DRV.DO.CMD.ERR rts A=0,CC from bcc .4 *-------------------------------------- -DRV.DO.CMD.ERR1 pla +DRV.DO.CMD.ERR1 pla -DRV.DO.CMD.ERR lda #MLI.E.IO + pla +DRV.DO.CMD.ERR + lda #MLI.E.IO sec rts *-------------------------------------- @@ -411,13 +442,13 @@ DRV.DO.CMD.W lda #$B1 lda (),y sta $103 ldy #0 - stz DRV.CmdBuf.Sum + stz DRV.FrmBuf.Sum sec -.1 jsr $100 - jsr DRV.SSCSend - eor DRV.CmdBuf.Sum - sta DRV.CmdBuf.Sum + +.1 + eor DRV.FrmBuf.Sum + sta DRV.FrmBuf.Sum iny bne .1 bcc .2 @@ -425,80 +456,23 @@ DRV.DO.CMD.W lda #$B1 lda (),y clc bcc .1 .2 dec DRV.BUFF+1 -* A = DRV.CmdBuf.Sum +* A = DRV.FrmBuf.Sum + - jsr DRV.SSCSend * read back CMD ldy #4 Read 5 bytes (echo from server) -.3 jsr DRV.SSCGet - - eor DRV.CmdBuf.Sum,y Check 5 bytes (including block Sum) +.3 + eor DRV.FrmBuf.Sum,y Check 5 bytes (including block Sum) bne DRV.DO.CMD.ERR dey bpl .3 rts *-------------------------------------- -DRV.SendRCmd - - -DRV.SendWCmd - - ldx DRV.Slotn0 - - >AR.Sn.SELECT S0.TX.FSR - lda W5100.DR,x get send size HI - ldy W5100.DR,x LO - - cpy #5 - sbc /5 - bcc IOERR - - >AR.Sn.SELECT S0.TX.WR - lda W5100.DR,x Get HI - ldy W5100.DR,x Get LO - and /TX.BASE - ora /RXTX.MASK - sta W5100.AR,x Write HI - pha - tya - sta W5100.AR+1,x Write LO - clc - adc #5 - sta .3+1 - pla - adc /0 - sta .2+1 - - ldy #4 - -.1 lda DRV.CmdBuf.Sum,y - sta W5100.DR,x - dey - bpl .1 - - >AR.SELECT S0.TX.WR - -.2 lda #$ff SELF MODIFIED - sta W5100.DR,x write HI -.3 lda #$ff SELF MODIFIED - sta W5100.DR,x write LO - - >AR.Sn.SELECT S0.CR - lda #W5100.AR.Sn.CR.SEND - sta W5100.DR,x - rts -*-------------------------------------- -DRV.READWRITE bit RRAMWRAMBNK1 +DRV.RWBYTE bit RRAMWRAMBNK1 sta (DRV.BUFF),y bit RRAMWRAMBNK2 rts -*-------------------------------------- -DRV.CmdBuf.Sum .BS 1 Reverse order for dey -DRV.CmdBuf.BlkH .BS 1 -DRV.CmdBuf.BlkL .BS 1 -DRV.CmdBuf.Cmd .BS 1 -DRV.CmdBuf.Env .DA #ADT.CMD.VSD *-------------------------------------- .EP *-------------------------------------- @@ -512,6 +486,212 @@ DRV.SIZE .EQ *-DRV * ERROR:DRV.SIZE too big .FIN *-------------------------------------- + + +*-------------------------------------- + .INB usr/src/sys/km.vedrive.s.cf + .INB usr/src/sys/km.vedrive.s.ip + .INB usr/src/sys/km.vedrive.s.u1 + .INB usr/src/sys/km.vedrive.s.u2 + .INB usr/src/sys/km.vedrive.s.gs +*-------------------------------------- +VEDRIVE.MSG0 .AZ "VEDRIVE (ADTPro Virtual Ethernet HD) Driver\n" +VEDRIVE.DRVKO .AZ "VEDRIVE (Or other custom Driver) Already Installed.\n" +VEDRIVE.CONF .AZ "Checking %S...\n" +VEDRIVE.CONFKO .AZ "Error reading VEDRIVE.CONF file.\n" +VEDRIVE.CONFSYN .AZ "Syntax error in VEDRIVE.CONF file.\n" +VEDRIVE.CONFINV .AZ "Invalid VEDRIVE.CONF file.\n" +VEDRIVE.NICKO .AZ "Hardware not detected.\n" +VEDRIVE.NICOK .AZ "%S Rev. %d.%d Found At Slot %d.\n" +VEDRIVE.DHCP .AZ "Querying DHCP...\n" +VEDRIVE.DHCPKO .AZ "No response from DHCP.\n" +VEDRIVE.IPKO .AZ "Unable to setup IP configuration.\n" +VEDRIVE.IPOK .AZ "IP config : %d.%d.%d.%d/%d.%d.%d.%d GW=%d.%d.%d.%d\n" +VEDRIVE.SRV .AZ "Contacting ADTPro Server..." +VEDRIVE.SRVKO .AZ "No Response From ADTPro Server.\n" +VEDRIVE.SRVOK .AZ "ADTPro Server Is Online.\n" +VEDRIVE.NOSLOT .AZ "No ProDOS device slot available.\n" +VEDRIVE.DEVOK .AZ "VEDRIVE Installed 2 devices at S%d,D1 & S%d,D2.\n" +VEDRIVE.DRVIKO .AZ "Unable to install VEDRIVE.\n" +VEDRIVE.DRVIOK .AZ "VEDRIVE Successfully Installed.\n" +*-------------------------------------- +CONF.FILENAME .AS "vedrive.conf" +CONF.FILENAME.L .EQ *-CONF.FILENAME +*-------------------------------------- +CONF.KW >PSTR "nic" + >PSTR "slot" + >PSTR "address" + >PSTR "netmask" + >PSTR "gateway" + >PSTR "server" + >PSTR "port" + .HS 00 +*-------------------------------------- +CONF.KW.NIC >PSTR "lancegs" + >PSTR "uthernet" + >PSTR "uthernet2" + .HS 00 +*-------------------------------------- +CONF.NIC .HS FF +CONF.SLOT .HS 00 +CONF.IPCFG .EQ * +CONF.SRCMAC .HS 000E3A123456 +CONF.ADDRESS .HS 00000000 +CONF.MASK .HS 00000000 +CONF.GATEWAY .HS 00000000 +CONF.SERVER .HS 00000000 +CONF.PORT .DA /1977,#1977 +*-------------------------------------- +MLIGETPREFIX.P .DA #1 + .DA CONF.FILEPATH +*-------------------------------------- +MLIOPEN.P .DA #3 + .DA CONF.FILEPATH + .DA CONF.FBUF + .BS 1 FILE# +*-------------------------------------- +MLINEWLINE.P .DA #3 + .BS 1 + .DA #$7F + .DA #$0D +*-------------------------------------- +MLIREAD.P .DA #4 + .BS 1 + .DA CONF.LBUF + .DA 255 + .BS 2 +*-------------------------------------- +MLICLOSE.P .DA #1 + .BS 1 +*-------------------------------------- +ARP.REQ .HS FFFFFFFFFFFF S.ETH.DSTMAC +ARP.REQ.SRCMAC .BS 6 +ARP.REQ.ETYPE .DA /S.ETH.EII.TYPE.ARP + .DA #S.ETH.EII.TYPE.ARP + .HS 0001.0800.06.04 +ARP.REQ.OP .DA /S.ARP.OPERATION.REQ + .DA #S.ARP.OPERATION.REQ +ARP.REQ.SHA .BS 6 +ARP.REQ.SPA .BS 4 +ARP.REQ.THA .BS 6 +ARP.REQ.TPA .BS 4 +*-------------------------------------- +ARP.REP .EQ * +ARP.REP.DSTMAC .BS 6 +ARP.REP.SRCMAC .BS 6 +ARP.REP.ETYPE .DA /S.ETH.EII.TYPE.ARP + .DA #S.ETH.EII.TYPE.ARP + .HS 0001.0800.06.04 +ARP.REP.OP .DA /S.ARP.OPERATION.REP + .DA #S.ARP.OPERATION.REP +ARP.REP.SHA .BS 6 +ARP.REP.SPA .BS 4 +ARP.REP.THA .BS 6 +ARP.REP.TPA .BS 4 +*-------------------------------------- +DHCP.DISC .HS FFFFFFFFFFFF DST MAC +DHCP.DISC.SRCMAC .BS 6 + .DA /S.ETH.EII.TYPE.IP + .DA #S.ETH.EII.TYPE.IP +DHCP.DISC.IP .HS 4500 + .DA /DHCP.DISC.END-DHCP.DISC.IP,#DHCP.DISC.END-DHCP.DISC.IP + .HS 0000 + .HS 0000 + .DA #64 TTL + .DA #S.IP.PROTOCOL.UDP + .BS 2 IP CHECKSUM + .HS 00000000 + .HS FFFFFFFF +*-------------------------------------- +DHCP.DISC.UDP .DA #0,#UDP.PORT.DHCPC + .DA #0,#UDP.PORT.DHCPS + .DA /DHCP.DISC.END-DHCP.DISC.UDP,#DHCP.DISC.END-DHCP.DISC.UDP + .BS 2 UDP CHECKSUM +*-------------------------------------- + .HS 01010600 OP,HTYPE,HLEN,HOPS +DHCP.DISC.XID .HS 54328574 + .HS 0000 SECS + .DA S.DHCP.FLAGS.BRDCST + .HS 00000000 CIADDR +DHCP.DISC.YIADDR .HS 00000000 + .HS 00000000 SIADDR +DHCP.DISC.GIADDR .HS 00000000 +DHCP.DISC.CHADDR .HS 00000000.00000000.00000000.00000000 + .BS 64 SNAME + .BS 128 FILE + .HS 63825363 COOKIE + .HS 3501 OPT + .DA #S.DHCP.OPTIONS.DHCPDiscover + .HS 37020103FF 37040103060FFF +DHCP.DISC.END .EQ * +DHCP.DISC.LEN .EQ *-DHCP.DISC +*-------------------------------------- +DHCP.REQ .HS FFFFFFFFFFFF DST MAC +DHCP.REQ.SRCMAC .BS 6 + .DA /S.ETH.EII.TYPE.IP + .DA #S.ETH.EII.TYPE.IP +DHCP.REQ.IP .HS 4500 + .DA /DHCP.REQ.END-DHCP.REQ.IP,#DHCP.REQ.END-DHCP.REQ.IP + .HS 0000 + .HS 0000 + .DA #64 TTL + .DA #S.IP.PROTOCOL.UDP + .BS 2 IP CHECKSUM + .HS 00000000 + .HS FFFFFFFF +*-------------------------------------- +DHCP.REQ.UDP .DA #0,#UDP.PORT.DHCPC + .DA #0,#UDP.PORT.DHCPS + .DA /DHCP.REQ.END-DHCP.REQ.UDP,#DHCP.REQ.END-DHCP.REQ.UDP + .BS 2 UDP CHECKSUM +*-------------------------------------- + .HS 01010600 OP,HTYPE,HLEN,HOPS +DHCP.REQ.XID .HS 54328574 + .HS 0000 SECS + .DA S.DHCP.FLAGS.BRDCST + .HS 00000000 CIADDR +DHCP.REQ.YIADDR .HS 00000000 + .HS 00000000 SIADDR + .HS 00000000 GIADDR +DHCP.REQ.CHADDR .HS 00000000.00000000.00000000.00000000 + .BS 64 SNAME + .BS 128 FILE + .HS 63825363 COOKIE + .HS 3501 OPT + .DA #S.DHCP.OPTIONS.DHCPRequest + .HS 3204 +DHCP.REQ.OPT.REQIP .BS 4 + .HS 3604 +DHCP.REQ.OPT.SVRIP .BS 4 + .HS FF +DHCP.REQ.END .EQ * +DHCP.REQ.LEN .EQ *-DHCP.REQ +*-------------------------------------- +ADT.REQ +ADT.REQ.DSTMAC .BS 6 DST MAC +ADT.REQ.SRCMAC .BS 6 + .DA /S.ETH.EII.TYPE.IP + .DA #S.ETH.EII.TYPE.IP +ADT.REQ.IP .HS 4500 + .DA /ADT.REQ.END-ADT.REQ.IP,#ADT.REQ.END-ADT.REQ.IP + .HS 0000 + .HS 0000 + .DA #64 TTL + .DA #S.IP.PROTOCOL.UDP + .BS 2 IP CHECKSUM +ADT.REQ.IP.SRC .BS 4 SRC IP +ADT.REQ.IP.DST .BS 4 DST IP +*-------------------------------------- +ADT.REQ.UDP .DA #$C0,#$00 SRC PORT +ADT.REQ.UDP.DST .BS 2 DST PORT + .DA /ADT.REQ.END-ADT.REQ.UDP,#ADT.REQ.END-ADT.REQ.UDP + .BS 2 UDP CHECKSUM +*-------------------------------------- + .DA #ADT.CMD.VSD + .HS 030000C6 READ D1, BLK 0 +ADT.REQ.END .EQ * +ADT.REQ.LEN .EQ *-ADT.REQ +*-------------------------------------- MAN SAVE usr/src/sys/km.vedrive.s ASM