This commit is contained in:
burniouf 2022-01-30 22:47:08 +01:00
parent 27b04e8e44
commit 2cf7512e99
23 changed files with 3422 additions and 1562 deletions

Binary file not shown.

Binary file not shown.

View File

@ -2,12 +2,95 @@ NEW
AUTO 3,1
.LIST OFF
*--------------------------------------
CODE.PushXFromYA
jsr CODE.LDXYAI
CODE.Debug ldx #PCC.DEBUG.L
ldy #0
.1 lda PCC.DEBUG,y
jsr CODE.EmitByte
iny
dex
bne .1
rts
*--------------------------------------
CODE.Enter ldx #PCC.ENTER.L
ldy #0
.1 lda PCC.ENTER,y
jsr CODE.EmitByte
iny
dex
bne .1
rts
*--------------------------------------
CODE.nAddLocal eor #$FF
inc
CODE.AddLocal pha
lda #$A9 LDA #imm
jsr CODE.EmitByte
pla
jsr CODE.EmitByte
ldx #PCC.ADDLOCAL.L
ldy #0
.1 lda PCC.ADDLOCAL,y
jsr CODE.EmitByte
iny
dex
bne .1
rts
*--------------------------------------
CODE.GetLocal lda #$A9 LDA #imm
jsr CODE.EmitByte
tya
eor #$FF
inc
jsr CODE.EmitByte
ldx #PCC.GETLOCAL.L
ldy #0
.1 lda PCC.GETLOCAL,y
jsr CODE.EmitByte
iny
dex
bne .1
rts
*--------------------------------------
CODE.SetRetValue
jsr CODE.LDXI
ldx #PCC.SETRETVALUE.L
ldy #0
.1 lda PCC.SETRETVALUE,y
jsr CODE.EmitByte
iny
dex
bne .1
rts
*--------------------------------------
CODE.Leave ldx #PCC.LEAVE.L
ldy #0
.1 lda PCC.LEAVE,y
jsr CODE.EmitByte
iny
dex
bne .1
rts
*--------------------------------------
CODE.PushXFromYA
ldx #PCC.PushXFromYA.L
ldy #0
.1 lda PCC.PushXFromYA,y
jsr CODE.EmitByte
iny
@ -16,11 +99,9 @@ CODE.PushXFromYA
rts
*--------------------------------------
CODE.PopXToYA jsr CODE.LDXYAI
ldx #PCC.PopXToYA.L
CODE.PopXToYA ldx #PCC.PopXToYA.L
ldy #0
.1 lda PCC.PopXToYA,y
jsr CODE.EmitByte
iny
@ -29,6 +110,93 @@ CODE.PopXToYA jsr CODE.LDXYAI
rts
*--------------------------------------
CODE.SetXToYA ldx #PCC.SetXToYA.L
ldy #0
.1 lda PCC.SetXToYA,y
jsr CODE.EmitByte
iny
dex
bne .1
rts
*--------------------------------------
CODE.Deref ldx #PCC.Deref.L
ldy #0
.1 lda PCC.Deref,y
jsr CODE.EmitByte
iny
dex
bne .1
rts
*--------------------------------------
CODE.SETpBASEp1 ldx #PCC.SETpBASEp1.L
ldy #0
.1 lda PCC.SETpBASEp1,y
jsr CODE.EmitByte
iny
dex
bne .1
rts
*--------------------------------------
CODE.SETpBASEpA ldx #PCC.SETpBASEpA.L
ldy #0
.1 lda PCC.SETpBASEpA,y
jsr CODE.EmitByte
iny
dex
bne .1
rts
*--------------------------------------
CODE.PUSHpBASEp1
ldx #PCC.PUSHpBASEp1.L
ldy #0
.1 lda PCC.PUSHpBASEp1,y
jsr CODE.EmitByte
iny
dex
bne .1
rts
*--------------------------------------
CODE.PUSHpBASEpA
ldx #PCC.PUSHpBASEpA.L
ldy #0
.1 lda PCC.PUSHpBASEpA,y
jsr CODE.EmitByte
iny
dex
bne .1
rts
*--------------------------------------
CODE.PushFromPtr
pha
lda #$A0 LDY #imm
jsr CODE.EmitByte
pla
dec BPL loop
jsr CODE.EmitByte
ldx #PCC.PushFromPtr.L
ldy #0
.1 lda PCC.PushFromPtr,y
jsr CODE.EmitByte
iny
dex
bne .1
rts
*--------------------------------------
CODE.PUSHI pha
lda #$A9 LDA #imm
jsr CODE.EmitByte
@ -36,12 +204,7 @@ CODE.PUSHI pha
jsr CODE.EmitByte
bra CODE.PUSHA
*--------------------------------------
CODE.LDXYAI pha
lda #$A2 LDX #imm
jsr CODE.EmitByte
txa
jsr CODE.EmitByte
CODE.LDYAI pha
lda #$A0 LDY #imm
jsr CODE.EmitByte
@ -50,8 +213,21 @@ CODE.LDXYAI pha
lda #$A9 LDA #imm
jsr CODE.EmitByte
pla
bra CODE.EmitByte
jmp CODE.EmitByte
*--------------------------------------
CODE.LDXI lda #$A2 LDX #imm
jsr CODE.EmitByte
txa
jmp CODE.EmitByte
*--------------------------------------
CODE.LDAI pha
lda #$A9 LDA #imm
jsr CODE.EmitByte
pla
jmp CODE.EmitByte
*--------------------------------------
CODE.PUSHYA jsr CODE.PUSHA
lda #$AA TYA
@ -61,7 +237,7 @@ CODE.PUSHA lda #$C6 DEC zp
jsr CODE.EmitByte
lda #pStack
jsr CODE.EmitByte
lda #$92 STA (zp)
jsr CODE.EmitByte
lda #pStack
@ -84,15 +260,10 @@ CODE.INCPSTACK lda #$E6 INC zp
lda #pStack
bra CODE.EmitByte
*--------------------------------------
CODE.JMPYX lda #$4C
bra CODE.JSRYX.1
*--------------------------------------
CODE.JSRYX lda #$20 JSR
CODE.JSRYX.1 jsr CODE.EmitByte
tya
jsr CODE.EmitByte
CODE.TOABSYX jsr CODE.EmitByte A=opcode : JMP, JSR .....
txa
jsr CODE.EmitByte
tya
bra CODE.EmitByte
*--------------------------------------
CODE.FPUCALL lda #$A2 LDX #imm

File diff suppressed because it is too large Load Diff

10
BIN/CC.S.DECL.txt Normal file
View File

@ -0,0 +1,10 @@
NEW
AUTO 3,1
.LIST OFF
*--------------------------------------
CC.DECL.
*--------------------------------------
MAN
SAVE usr/src/bin/cc.s.decl
LOAD usr/src/bin/cc.s
ASM

View File

@ -27,7 +27,7 @@ CC.DIR.DEFINE jsr CC.CheckSpace
bcs .90
>LDA.G CC.hDefines
jsr CC.NewKey
jsr CC.SYM.NewKey
bcs .99
>STYA ZPSymID

View File

@ -4,27 +4,30 @@ NEW
*--------------------------------------
CC.BOPS.bMUL
CC.BOPS.cMUL
inc pStack
clc
rts
*--------------------------------------
CC.BOPS.bDIV
CC.BOPS.cDIV
inc pStack
clc
rts
*--------------------------------------
CC.BOPS.bMOD
CC.BOPS.cMOD
inc pStack
clc
rts
*--------------------------------------
CC.BOPS.ADD clc
CC.BOPS.ADD clc
>PULLA
adc (pStack)
sta (pStack)
clc
rts
*--------------------------------------
CC.BOPS.SUB sec
CC.BOPS.SUB sec
ldy #1
lda (pStack),y
sbc (pStack)
@ -33,56 +36,113 @@ CC.BOPS.SUB sec
clc
rts
*--------------------------------------
CC.BOPS.SHL lda (pStack)
CC.BOPS.SHL >PULLA
tax
beq .8
ldy #1
lda (pStack),y
lda (pStack)
.1 asl
dex
bne .1
sta (pStack),y
sta (pStack)
.8 inc pStack
clc
rts
.8 rts
*--------------------------------------
CC.BOPS.SHR lda (pStack)
CC.BOPS.SHR >PULLA
tax
beq .8
ldy #1
lda (pStack),y
lda (pStack)
.1 lsr
dex
bne .1
sta (pStack),y
sta (pStack)
.8 inc pStack
clc
.8 rts
*--------------------------------------
CC.BOPS.L >PULLA
cmp (pStack)
bcc .8
lda #0
sta (pStack)
rts
.8 lda #1
sta (pStack)
rts
*--------------------------------------
CC.BOPS.L
CC.BOPS.G
CC.BOPS.LE
CC.BOPS.GE
CC.BOPS.EQ
CC.BOPS.NE
CC.BOPS.G >PULLA
cmp (pStack)
beq .1
bcs .8
CC.BOPS.AND
CC.BOPS.OR
CC.BOPS.EOR
.1 lda #0
sta (pStack)
rts
.8 lda #1
sta (pStack)
rts
*--------------------------------------
CC.BOPS.LE >PULLA
cmp (pStack)
bcc .8
beq .8
lda #0
sta (pStack)
rts
.8 lda #1
sta (pStack)
rts
*--------------------------------------
CC.BOPS.GE >PULLA
cmp (pStack)
bcs .8
lda #0
sta (pStack)
rts
.8 lda #1
sta (pStack)
rts
*--------------------------------------
CC.BOPS.EQ >PULLA
cmp (pStack)
beq .8
lda #0
sta (pStack)
.8 rts
*--------------------------------------
CC.BOPS.NE >PULLA
eor (pStack)
sta (pStack)
rts
*--------------------------------------
CC.BOPS.LAND
CC.BOPS.AND >PULLA
and (pStack)
sta (pStack)
rts
*--------------------------------------
CC.BOPS.LOR
clc
CC.BOPS.OR >PULLA
ora (pStack)
sta (pStack)
rts
*--------------------------------------
CC.BOPS.EOR >PULLA
eor (pStack)
sta (pStack)
rts
*--------------------------------------
MAN

View File

@ -6,43 +6,46 @@ NEW
* ZPLineBufPtr, Y,A = Expected type/qual
* Output:
* CS, A = EC
* CC, Y,A = type/qual, Value on Stack
* CC, Y,A = type/qual
*--------------------------------------
CC.ExpEval ldx ZPPtr1
phx
ldx ZPPtr1+1 local : used by lookup
phx
CC.EXP.Eval00 lda #0
tay
ldx ZPPtr2 local : expected T/Q
CC.EXP.Eval ldx ZPPtr2 local : expected T/Q
phx
ldx ZPPtr2+1
phx
ldx ZPPtr3 local : BOP
phx
ldx ZPPtr3+1 local : PREOPS
ldx ZPPtr3+1 local : PREOP
phx
>STYA ZPPtr2
>STYA ZPPtr2
lda #$ff no previous OP
pha
*--------------------------------------
.10 jsr CC.GetCharNB
bcs .19
jsr CC.ExpPreops
bcs .19
.11 cmp #'('
cmp #'('
bne .20
jsr CC.GetNextCharNB skip (
bcs .19
>LDYA ZPPtr2 expected T/Q
jsr CC.ExpEval
>LDYA L.CC.TYPEQUAL
jsr CC.LookupID
bcs .12
jsr CC.EXP.Cast
bcs .19
bra .20
*--------------------------------------
.12 >LDYA ZPPtr2 expected T/Q
jsr CC.EXP.Eval
bcs .19
>STYA ZPPtr2 update T/Q
@ -56,32 +59,44 @@ CC.ExpEval ldx ZPPtr1
jsr CC.GetNextCharNB skip )
bcc .31
.19 jmp .90
.19 jmp CC.EXP.Eval.ESYN
*--------------------------------------
.20 jsr CC.IsLetter define, f() or Var ?
.20 jsr CC.ExpPreops
bcs .29
jsr CC.IsLetter define, f() or Var ?
bcs .22
jsr CC.GetDefine
bcc .10
jsr CC.SymLookup
jsr CC.SYM.Lookup
bcs .22
>LDA.G CC.VarDef+1 qual
and #CC.Q.FUNC
ldy #SYM.Q
lda (ZPSymBufPtr),y
and #SYM.Q.FUNC
bne .21
jsr CC.ExpGet Check T/Q & Get value on stack
jsr CC.EXP.CheckGetSymType
bcs .29
jsr CC.EXP.Get Check T/Q & Get value on stack
bcs .29
jsr CC.SYM.FreeBufPop
bra .30
*--------------------------------------
.21 >LDYA ZPPtr2 get expected T/Q
jsr CC.fExecRetV
jsr CC.F.CallRetV
bcs .29
>STYA ZPPtr2 store real T/Q
jsr CC.SYM.FreeBufPop
bra .30
*--------------------------------------
.22 jsr CC.IsDigit10 number ?
@ -90,148 +105,181 @@ CC.ExpEval ldx ZPPtr1
ldy ZPPtr2
bne .23
ldy #CC.T.SINT
ldy #SYM.T.SINT
sty ZPPtr2
stz ZPPtr2+1
.23 jsr CC.GetNumOnStack
.23 jsr CC.EXP.GetNum
bcs .29
bra .30
*--------------------------------------
.24 cmp #'"' String literal
bne .90
bne CC.EXP.Eval.ESYN
jsr CC.AddContCharP
.29 bcs .99
.29 bcs CC.EXP.Eval.Err
*--------------------------------------
.30 jsr CC.GetCharNB
bcs .90
bcs CC.EXP.Eval.ESYN
.31 cmp #';'
beq .80
cmp #','
beq .80
cmp #')'
beq .80
.31 jsr CC.IsEndArg , ; ) ?
bcc CC.EXP.Eval.End
jsr CC.IsOPChar
bcs .90
bcs CC.EXP.Eval.ESYN
>LDYA L.CC.BOPS we are at V1 op1 V2 op2...
>LDYA L.CC.BOPS we are at V1 op1 V2 op2...
jsr CC.LookupOP
bcs .90
bcs CC.EXP.Eval.ESYN
stx ZPPtr3 save OP(n)
.32 plx get OP(n-1)
bmi .33 $ff....
.33 plx get OP(n-1)
bmi .38 $ff....
cpx ZPPtr3
bcc .33 OP(n) has precedence, on stack : V1,V2
bcc .38 OP(n) has precedence, on stack : V1,V2
>LDYA ZPPtr2 OP(n-1) has precedence...
jsr CC.ExpBops compute V(n-1) <OP(n-1)> V(n)
bcc .32
jsr CC.EXP.BOPS compute V(n-1) <OP(n-1)> V(n)
bcc .33
bcs .99
bcs CC.EXP.Eval.Err
.33 phx push back OP(n-1)
.38 phx push back OP(n-1)
lda ZPPtr3 get OP(n)
pha push OP(n) on stack
jmp .10 go check for next token
*--------------------------------------
.80 plx any OP on stack ?
bmi .88
CC.EXP.Eval.End plx any OP on stack ?
bmi CC.EXP.Eval.Exit
>LDYA ZPPtr2 Var Type
jsr CC.ExpBops
bcc .80
jsr CC.EXP.BOPS
bcc CC.EXP.Eval.End
bcs .99
bra CC.EXP.Eval.Err
*--------------------------------------
CC.EXP.Eval.ESYN
lda #E.ESYN
.90 lda #E.ESYN
.99 plx
bpl .99
CC.EXP.Eval.Err
plx
bpl CC.EXP.Eval.Err
sec
bra .89
bra CC.EXP.Eval.ExitErr
*--------------------------------------
CC.EXP.Eval.Exit
>LDYA ZPPtr2 Type/Qual
clc
.88 clc
>LDYA ZPPtr2 Type/Qual
.89 plx
CC.EXP.Eval.ExitErr
plx
stx ZPPtr3+1
plx
stx ZPPtr3
plx
stx ZPPtr2+1
plx
stx ZPPtr2
plx
stx ZPPtr1+1
plx
stx ZPPtr1
rts
*--------------------------------------
CC.EXP.CheckGetSymType
lda ZPPtr2
ora ZPPtr2+1
bne .1
lda (ZPSymBufPtr)
sta ZPPtr2
ldy #SYM.Q
lda (ZPSymBufPtr),y
sta ZPPtr2+1
clc
rts
.1 >LDYA ZPPtr2
jmp CC.SYM.CheckTypeYA
*--------------------------------------
CC.EXP.Cast jsr CC.TYPE.Decl
bcs .99
>STYA ZPPtr2
jsr CC.GetCharNB
bcs .9
cmp #')'
bne .9
jsr CC.GetNextCharNB skip )
clc
rts
.9 lda #E.ESYN
sec
.99 rts
*--------------------------------------
CC.ExpPreops >LDYA L.CC.PREOPS
jsr CC.LookupOP
bcc .8
ldx #$ff
.8 stx ZPPtr3+1
jmp CC.GetCharNB
*--------------------------------------
* Y,A = Type/Qual, X = OP
*--------------------------------------
CC.ExpBops cpy #CC.T.UINT
CC.EXP.BOPS cpy #SYM.T.UINT
bcs .3
cpy #CC.T.UCHAR
cpy #SYM.T.UCHAR
beq .1
cpy #CC.T.SCHAR
cpy #SYM.T.SCHAR
beq .2
lda #E.TMISMATCH
sec
rts
.1 ldy J.CC.bBOPS,x
lda J.CC.bBOPS+1,x
.1 lda J.CC.bBOPS,x
ldy J.CC.bBOPS+1,x
tax
jsr CODE.JSRYX
lda #$20 JSR
jsr CODE.TOABSYX
clc
rts
.2 ldy J.CC.cBOPS,x
lda J.CC.cBOPS+1,x
.2 lda J.CC.cBOPS,x
ldy J.CC.cBOPS+1,x
tax
jsr CODE.JSRYX
lda #$20 JSR
jsr CODE.TOABSYX
clc
rts
.3 txa
clc
adc CC.Type2FPU-CC.T.UINT,y
adc CC.Type2FPU-SYM.T.UINT,y
tax
jsr CODE.FPUCALL
clc
rts
*--------------------------------------
CC.AddContCharP
ldy #0
CC.AddContCharP ldy #0
.1 jsr CC.GetNextChar
bcs .9
@ -270,8 +318,7 @@ CC.AddContCharP
sec
rts
*--------------------------------------
CC.GetNumOnStack
cpy #CC.T.FLOAT
CC.EXP.GetNum cpy #SYM.T.FLOAT
bcc .1
beq .11
@ -310,6 +357,11 @@ CC.GetNumOnStack
.3 bcs .9
ldy #1 anticipate 2 bytes if *
lda ZPPtr2+1
and #SYM.Q.PPPOINTER
bne .5
ldx ZPPtr2
lda CC.TYPESIZE-1,x
@ -325,96 +377,235 @@ CC.GetNumOnStack
* clc
.9 rts
*--------------------------------------
CC.SymLookup >PUSHB.G CC.hSymbols
>PUSHW ZPLineBufPtr
>SYSCALL SListLookup
bcs .9
phy
pha
txa
* clc
adc ZPLineBufPtr
sta ZPLineBufPtr
bcc .1
inc ZPLineBufPtr+1
.1 >PUSHB.G CC.hSymbols
pla
>PUSHA
pla
>PUSHA KeyID
>PUSHEA.G CC.VarDef
>PUSHWI SYMDEFSIZE
>PUSHWZ From Start
>SYSCALL SListGetData
.9 rts
*--------------------------------------
* ZPPtr2 = expected T/Q
* ZPPtr3+1 = PREOPS
*--------------------------------------
CC.ExpGet ldx ZPPtr3+1
bmi CC.ExpGet2
CC.EXP.Get >LDYA L.CC.AOPS
jsr CC.LookupOP
bcs .20
jmp (J.CC.PREOPS,x)
>LDYA ZPPtr2 get expected T/Q
jsr CC.EXP.Eval
bcs .99
jsr CC.SYM.SetValue
bcs .99
clc
rts
*--------------------------------------
.20 >LDYA L.CC.POSTOPS
jsr CC.LookupOP
bcs .1
cpx #4 '['
bne *
jmp CC.EXP.Array
*--------------------------------------
.1 ldx ZPPtr3+1 preop
bpl .8
lda ZPPtr2 target T
beq .3
lda (ZPSymBufPtr) SYM.T
cmp #SYM.T.VOID
beq .2
cmp ZPPtr2 T
bne .9
.2 lda ZPPtr2+1 Q
ldy #SYM.Q
cmp (ZPSymBufPtr),y
bne .9
.3 lda (ZPSymBufPtr) SYM.T
sta ZPPtr2 T
pha
ldy #SYM.Q
lda (ZPSymBufPtr),y
sta ZPPtr2+1 Q
ply Y,A = T/Q
jsr CC.SYM.PushValue
clc
.99 rts
.9 lda #E.TMISMATCH
sec
rts
.8 jmp (J.CC.PREOPS,x)
*--------------------------------------
CC.EXP.Array ldy #SYM.Q
lda (ZPSymBufPtr),y
and #SYM.Q.AAARRAY
beq .9
jsr CC.EXP.PushDeref push base address
ldy #SYM.T.SINT
lda #0
jsr CC.EXP.Eval
bcs .99 int16 on stack
jsr CC.GetCharNB
bcs .9
cmp #']'
bne .9
jsr CC.GetNextCharNB skip ']'
bcs .9
jsr CC.SYM.GetSymSizeOfInAXC
pha
txa
jsr CODE.PUSHI
pla
jsr CODE.PUSHI sizeof on stack
ldx #FPU.iMUL
jsr CODE.FPUCALL sizeof*int16
ldx #FPU.iAdd
jsr CODE.FPUCALL add to base address
lda (ZPSymBufPtr) SYM.T
pha
ldy #SYM.Q
lda (ZPSymBufPtr),y
sec
sbc #SYM.Q.ARRAY
ply
jsr CC.SYM.GetYASizeOfInAXC
jsr CODE.PushFromPtr A = byte count
clc
rts
.9 lda #E.ESYN
sec
.99 rts
*--------------------------------------
CC.EXP.PushAddr ldy #SYM.Addr+1
lda (ZPSymBufPtr),y
bne .7
* LOCAL
jsr CODE.PUSHpBASEp1
ldy #SYM.Addr
lda (ZPSymBufPtr),y
eor #$FF
inc
jsr CODE.LDAI
jsr CODE.PUSHpBASEpA
clc
rts
* DATASEG
.7 jsr CODE.PUSHI
ldy #SYM.Addr
lda (ZPSymBufPtr),y
jsr CODE.PUSHI
clc
rts
*--------------------------------------
CC.EXP.PushDeref
ldy #SYM.Addr+1
lda (ZPSymBufPtr),y
bne .7
* LOCAL
jsr CODE.SETpBASEp1
ldy #SYM.Addr
lda (ZPSymBufPtr),y
eor #$FF
inc
jsr CODE.LDAI
jsr CODE.SETpBASEpA
jsr CODE.Deref
CC.ExpGet.Ref >LDA.G CC.VarDef+5 DataPtr+1
jsr CODE.PUSHI
>LDA.G CC.VarDef+4 DataPtr
jsr CODE.PUSHI
clc
rts
* DATASEG
.7 jsr CODE.LDAI
lda #$85 STA zp
jsr CODE.EmitByte
lda #ZPPtr1+1
jsr CODE.EmitByte
ldy #SYM.Addr
lda (ZPSymBufPtr),y
jsr CODE.LDAI
lda #$85 STA zp
jsr CODE.EmitByte
lda #ZPPtr1+1
jsr CODE.EmitByte
jsr CODE.Deref
clc
rts
*--------------------------------------
CC.EXP.GetRef ldy #SYM.Addr+1
lda (ZPSymBufPtr),y
jsr CODE.PUSHI
CC.ExpGet.Deref
ldy #SYM.Addr
lda (ZPSymBufPtr),y
jsr CODE.PUSHI
lda (ZPSymBufPtr) SYM.T
sta ZPPtr2 T
ldy #SYM.Q
lda (ZPSymBufPtr),y
clc
rts
adc #SYM.Q.POINTER
bcs .9 more than ***
CC.ExpGet2 lda ZPPtr2 target type
beq .1
>LDA.G CC.VarDef Type
cmp #CC.T.VOID
beq .11
cmp ZPPtr2
bne .9
.11 lda ZPPtr2+1 qual
>CMP.G CC.VarDef+1
bne .9
.1 >LDA.G CC.VarDef Type
sta ZPPtr2
pha
iny
lda (pData),y
sta ZPPtr2+1 qual
ply
jsr CC.GetVarSize X = size
>LDA.G CC.VarDef+4 DataPtr
pha
iny
lda (pData),y
ply
.3 jsr CODE.PushXFromYA
clc
sta ZPPtr2+1 Q
* clc
rts
.9 lda #E.TMISMATCH
sec
rts
*--------------------------------------
CC.EXP.GetDeref
clc
rts
*--------------------------------------
CC.EXP.IntConst >PUSHW ZPLineBufPtr
>PUSHWI ZPLineBufPtr
>PUSHBI 10
>SYSCALL StrToUL
>PULLA
tay
>PULLA
inc pStack
inc pStack
rts
*--------------------------------------
MAN
SAVE usr/src/bin/cc.s.exp
LOAD usr/src/bin/cc.s

435
BIN/CC.S.F.txt Normal file
View File

@ -0,0 +1,435 @@
NEW
AUTO 3,1
.LIST OFF
*--------------------------------------
CC.F.Decl stz LocalPtr
jsr CC.PushTQ push T/Q for RETURN
bcs .99
ldy #SYM.Q
lda #SYM.Q.FUNC
ora (ZPSymBufPtr),y
sta (ZPSymBufPtr),y
ldx #$80 CPStmt.fDef state
jsr CC.STMT.CPStmt
bcs .99
jsr CC.SYM.NewScope
bcs .99
jsr CC.GetNextCharNB Skip (
bcs .9
cmp #')' func()
beq .6
*--------------------------------------
.1 jsr CC.F.DeclGetTQ
bcs .99
>STYA ZPPtr2 Save T/Q
jsr CC.F.AddTQ
jsr CC.GetCharNB
bcs .9
jsr CC.IsLetter
bcs .2
jsr CC.SYM.Push
bcs .99
>LDYA ZPPtr2
ldx #SYM.SC.AUTO
jsr CC.SYM.New
bcs .99
jsr CC.SYM.Store Store f() Args in Local scope
bcs .99
jsr CC.SYM.FreeBufPop
bcs .99
jsr CC.GetCharNB
bcs .9
.2 cmp #')'
beq .6
cmp #','
bne .9
jsr CC.GetNextCharNB Skip ,
bcc .1
.9 lda #E.CSYN
sec
.99 rts
*--------------------------------------
.6 ldy #0
lda #0
jsr CC.F.AddTQ
jsr CC.GetNextCharNB Skip )
bcs .9
cmp #';'
bne .7
jsr CC.SYM.FreeScope discard local scope
lda CStackPtr
clc
adc #6
sta CStackPtr discard this CPStmt
stz LocalPtr reset for DEBUG Message
clc
rts
*--------------------------------------
.7 cmp #'{'
bne .9
ldy #SYM.Addr+1
lda (ZPSymBufPtr),y
dey
ora (ZPSymBufPtr),y
bne .90 Already populated by LINK
>LDYA ZPCCCode f() Code starts HERE
jsr CC.SYM.SetAddrYA
lda LocalPtr
jsr CODE.LDAI A = f() ARGS size
jsr CODE.Enter
clc Store f() Declaration / Start Definition
rts
.90 lda #E.REDEF
sec
rts
*--------------------------------------
CC.F.DeclGetTQ lda (ZPLineBufPtr)
cmp #'.'
bne .5
ldx #2
.1 jsr CC.GetNextChar
bcs .9
cmp #'.'
bne .9
dex
bne .1
jsr CC.GetNextCharNB
bcs .9
eor #')'
bne .9
ldy #SYM.T.VARIADIC Type
* lda #0 Qual
* clc
rts
*--------------------------------------
.5 >LDYA L.CC.TYPEQUAL
jsr CC.LookupID
bcs .9
jsr CC.TYPE.Decl
bcs .9
* Y,A = Type/Qual
bra .8
.9 lda #E.CSYN
sec
.8 rts
*--------------------------------------
CC.F.Def.END jsr CODE.Leave
jsr CC.Pop T
jsr CC.Pop Q
jsr CC.SYM.FreeScope
stz LocalPtr back to global
clc
rts
*--------------------------------------
* in : ZPSymPtr
* Y,A = Expected T/Q
*--------------------------------------
CC.F.CallNoRetV clc
.HS B0 BCS
CC.F.CallRetV sec
ldx ZPPtr1 local : variadic size
phx
ldx ZPPtr1+1 local : bRetV
phx
ldx ZPPtr2 local : expected T
phx
ldx ZPPtr2+1 local : expected Q
phx
>STYA ZPPtr2
ror ZPPtr1+1 bRetV
bpl .20 no return value on stack
ldy #SYM.Addr+1
lda (ZPSymBufPtr),y
cmp #2
bcc .20 SYS/FPU call, no ret value space
jsr CC.SYM.GetSymSizeOfInAXC
jsr CODE.nAddLocal
.20 stz ZPPtr1 Reset VARIADIC byte count
jsr CC.GetNextCharNB skip '('
bcs .10
jsr CC.SYM.GetTypeInYA Y,A = f() Return value T/Q
ldx ZPPtr2 expected T
beq .1 no check required
cpy ZPPtr2
bne .91
tax save full Q
and #$fC ignore SYM.Q.FUNC,SYM.Q.FASTCALL
cmp ZPPtr2+1
bne .91
txa
.1 >STYA ZPPtr2 save full T/Q for later
lda #SYM.Def
sta ZPSymSize
jsr CC.F.GetTQ get First Arg T/Q
beq .7 end of list, go check ending ')'
*--------------------------------------
.3 cpy #SYM.T.VARIADIC
bne .4
lda #0 Expected T/Q = 0 if VARIADIC
tay
.4 jsr CC.EXP.Eval
bcs .93
jsr CC.SYM.GetYASizeOfInAXC
tax save Sizeof in X
jsr CC.F.GetTQ
cpy #SYM.T.VARIADIC
bne .50 if VARIADIC, don't advance to next arg
txa
clc make sure pointer only 2 bytes
adc ZPPtr1
sta ZPPtr1 Add to byte count
bra .5
.50 inc ZPSymSize
inc ZPSymSize
.5 jsr CC.GetCharNB
.10 bcs .90
cmp #','
bne .6
jsr CC.GetNextCharNB Skip ','
jsr CC.F.GetTQ
bne .3 Another ARG....
bra .90 extra args....error
.6 cmp #')'
bne .90
jsr CC.F.GetTQ
beq .8 no more arg after ')', exit
cpy #SYM.T.VARIADIC
bne .90 missing arg
lda ZPPtr1 push VARIADIC byte count
jsr CODE.PUSHI
.7 jsr CC.GetCharNB
bcs .90
cmp #')'
bne .90
.8 jsr CC.GetNextCharNB Skip )
jsr CC.F.Call2
bra .93
.90 lda #E.CSYN
bra .92
.91 lda #E.TMISMATCH
.92 sec
.93 plx
stx ZPPtr2+1
plx
stx ZPPtr2
plx
stx ZPPtr1+1
plx
stx ZPPtr1
.99 rts
*--------------------------------------
* X = last var size
*--------------------------------------
CC.F.Call2 lda ZPPtr2+1
bit #SYM.Q.FASTCALL
beq .1
ldy #SYM.Def Get first (only) argument
jsr CC.F.GetTQAtY
jsr CC.TYPE.SizeOf
dex
bne .19
jsr CODE.PULLA
bra .1
.19 jsr CODE.PULLYA
.1 jsr CC.F.Call3
bcs .9
bit ZPPtr1+1 bRetV
bmi .5
* NO Return Value : call & discard stack if not in Y,A
>LDYA ZPPtr2 function T/Q
jsr CC.TYPE.SizeOf
txa
beq .11 void
cpx #3 A or Y,A
bcc .11
.10 jsr CODE.INCPSTACK
dex
bne .10
.11 clc
.9 rts
* Return Value : call & put result on stack if in Y,A
.5 ldy #SYM.Addr+1
lda (ZPSymBufPtr),y
cmp #2
bcs .8 not a SYS/FPU call...Ret value on stack
>LDYA ZPPtr2 function T/Q
jsr CC.TYPE.SizeOf
cpx #3
bcs .8 leave on stack
dex
bne .60
jsr CODE.PUSHA push ONE byte one stack
bra .8
.60 jsr CODE.PUSHYA push TWO bytes one stack
.8 >LDYA ZPPtr2 T/Q
and #$FC ignore SYM.Q.FUNC+SYM.Q.FASTCALL
clc
rts
*--------------------------------------
CC.F.Call3 ldy #SYM.Addr+1
lda (ZPSymBufPtr),y
beq .9
pha
dey
lda (ZPSymBufPtr),y
tax
ply
cpy #1
bne .1
jsr CODE.SYSCALL
clc
rts
.1 cpy #2
bne .2
jsr CODE.FPUCALL
clc
rts
.2 lda #$20 JSR abs
jsr CODE.TOABSYX Y=HI,X=LO
clc
rts
.9 lda #E.FUNDEF
sec
rts
*--------------------------------------
CC.F.AddTQ pha
tya
ldy ZPSymSize
sta (ZPSymBufPtr),y
iny
pla
sta (ZPSymBufPtr),y
iny
sty ZPSymSize
rts
*--------------------------------------
CC.F.GetTQ ldy ZPSymSize
CC.F.GetTQAtY lda (ZPSymBufPtr),y
pha
iny
lda (ZPSymBufPtr),y
ply
rts
*--------------------------------------
MAN
SAVE usr/src/bin/cc.s.f
LOAD usr/src/bin/cc.s
ASM

View File

@ -8,12 +8,10 @@ CC.KW.JMP txa
>STA.G CC.CmdSave
jmp (J.CC.KW,x)
*--------------------------------------
CC.WHILE jsr CC.PushCS push Test location for WHILE loop
bcc CC.IF
rts
CC.KW.WHILE jsr CC.PushCS push cont: for WHILE loop
bcs CC.KW.IF.RTS
*--------------------------------------
CC.IF jsr CC.GetCharNB
CC.KW.IF jsr CC.GetCharNB
bcs .9
cmp #'('
@ -22,12 +20,15 @@ CC.IF jsr CC.GetCharNB
jsr CC.GetNextCharNB
bcs .9
ldy #0 Any var type
lda #0
jsr CC.ExpEval
jsr CC.EXP.Eval00 Any var type
bcs .99
jsr CC.IsValue0
jsr CC.KW.TestZero
jsr CC.PushCS push place to set JMP false
bcs .99
jsr CC.KW.ZPCCCodeAdd2
jsr CC.GetCharNB
bcs .99
@ -35,44 +36,21 @@ CC.IF jsr CC.GetCharNB
cmp #')'
bne .9
jsr CC.GetNextCharNB skip ')'
bcs .9
jmp CC.KW.BEGIN
jsr CC.PushCS push place to set JMP if false
bcs .99
lda ZPCCCode
clc
adc #2
sta ZPCCCode
bcc .5
inc ZPCCCode+1
.5 >LDA.G CC.CmdSave
jsr CC.Push push IF / WHILE
bcs .99
lda #'}' end block expected
jmp CC.Push
.9 lda #E.CSYN
sec
.99 rts
.99
CC.KW.IF.RTS rts
*--------------------------------------
CC.IF.END jsr CC.Pop
bcs .9
sta ZPPtr1
jsr CC.Pop
CC.KW.IF.END jsr CC.PopYA
bcs .9
sta ZPPtr1+1
>STYA ZPPtr1 set JMP false
lda ZPCCCode
sta (ZPPtr1)
ldy #1
lda ZPCCCode+1
sta (ZPPtr1),y
@ -81,36 +59,34 @@ CC.IF.END jsr CC.Pop
.9 rts
*--------------------------------------
CC.ELSE
CC.KW.ELSE
clc
rts
*--------------------------------------
CC.WHILE.END jsr CC.Pop
CC.KW.ELSE.END
clc
rts
*--------------------------------------
CC.KW.WHILE.END jsr CC.PopYA Get JMP false location
bcs .9
>STYA ZPPtr1
jsr CC.PopYA Get cont: address
bcs .9
sta ZPPtr1
jsr CC.Pop
bcs .9
sta ZPPtr1+1
jsr CC.Pop
bcs .9
pha
jsr CC.Pop
bcs .9
tax
ply
jsr CODE.JMPYX
phy
tay HI byte
plx
lda #$4C JMP cont:
jsr CODE.TOABSYX
lda ZPCCCode
sta (ZPPtr1)
ldy #1
lda ZPCCCode+1
sta (ZPPtr1),y
@ -119,25 +95,201 @@ CC.WHILE.END jsr CC.Pop
.9 rts
*--------------------------------------
CC.DO
CC.FOR
CC.SWITCH
CC.CASE
CC.BREAK
CC.CONTINUE
CC.SIZEOF
*--------------------------------------
CC.TYPEDEF lda #E.CSYN
CC.KW.DO
lda #E.CSYN
sec
rts
*--------------------------------------
CC.STRUCT >ENTER 4
CC.KW.DO.END
clc
rts
*--------------------------------------
* for (e1;e2;e3) s;
*
* e1;
* while (e2)
* {
* s;
* cont:
* e3;
* }
* break:
*--------------------------------------
CC.KW.FOR jsr CC.GetCharNB
bcs .19
cmp #'('
bne .19
jsr CC.GetNextCharNB
bcs .19
jsr CC.EXP.Eval00 get e1
bcs .29
jsr CC.KW.StackDiscard
jsr CC.GetCharNB
bcs .19
cmp #';'
bne .19
jsr CC.GetNextCharNB skip ';'
.19 bcs .9
*--------------------------------------
>LDYA ZPCCCode
>STYA ZPPtr2 save LOOP address
jsr CC.EXP.Eval00 get e2
.29 bcs .99
jsr CC.KW.TestZero
jsr CC.PushCS push place to set JMP break:
bcs .99
jsr CC.KW.ZPCCCodeAdd2
lda #$20 emit JSR s;
jsr CODE.EmitByte
>LDYA ZPCCCode
>STYA ZPPtr3 save place to set JSR s
jsr CC.KW.ZPCCCodeAdd2 space for 2-bytes address
jsr CC.GetCharNB
bcs .9
cmp #';'
bne .9
jsr CC.GetNextCharNB skip ';'
bcs .9
*--------------------------------------
jsr CC.PushCS push cont: address
jsr CC.EXP.Eval00 get e3
bcs .99
jsr CC.KW.StackDiscard
jsr CC.GetCharNB
bcs .9
cmp #')'
bne .9
lda #$4C
ldx ZPPtr2
ldy ZPPtr2+1
jsr CODE.TOABSYX JMP e2
lda ZPCCCode setup JSR s;
sta (ZPPtr3)
lda ZPCCCode+1
ldy #1
sta (ZPPtr3),y
jmp CC.KW.BEGIN
.9 lda #E.CSYN
sec
.99 rts
*--------------------------------------
CC.KW.FOR.END lda #$60
jsr CODE.EmitByte set RTS for JSR s;
jsr CC.Pop
bcs .9
jsr CC.Pop discard cont: location
bcs .9
jsr CC.PopYA
bcs .9
>STYA ZPPtr1 get JMP break: location
lda ZPCCCode
sta (ZPPtr1)
ldy #1
lda ZPCCCode+1
sta (ZPPtr1),y
clc
.9 rts
*--------------------------------------
CC.KW.SWITCH
CC.KW.CASE
CC.KW.BREAK
CC.KW.CONTINUE
lda #E.CSYN
sec
rts
*--------------------------------------
CC.KW.RETURN ldy CStackPtr
beq .9
.1 iny skip ; or }
beq .9
lda (ZPCCStack),y
bmi .7 f()
tya
clc
adc #3 skip CPStmt (4 bytes)
tay
bcc .1
.9 lda #E.STACKERROR
sec
.99 rts
.7 iny skip bState
iny skip Locals
iny get SYM.T
lda (ZPCCStack),y
pha
iny get SYM.Q
lda (ZPCCStack),y
ply
jsr CC.EXP.Eval
bcs .99
jsr CC.SYM.GetYASizeOfInAXC Y,A=T/Q
tax X = sizeof
jsr CODE.SetRetValue
jsr CODE.Leave
clc
rts
*--------------------------------------
CC.KW.SIZEOF
*--------------------------------------
CC.KW.TYPEDEF lda #E.CSYN
sec
rts
*--------------------------------------
CC.KW.STRUCT >ENTER 4
jsr CC.GetCharNB
bcs .99
>LDA.G CC.hTags
jsr CC.NewKey
jsr CC.SYM.NewKey
bcs .99
sta (pStack) Y,A = KeyID
@ -163,21 +315,32 @@ CC.STRUCT >ENTER 4
.99 >LEAVE
rts
*--------------------------------------
CC.KW.BEGIN jsr CC.GetNextCharNB
bcs .9
cmp #'{'
bne .7
>LDA.G CC.CmdSave
tax
jmp CC.STMT.CPStmt
.7 >LDA.G CC.CmdSave
jsr CC.Push
bcs .99
lda #';'
jmp CC.Push
.9 lda #E.CSYN
sec
.99 rts
*--------------------------------------
* Input : Value on Stack, Y,A = Type/Qual
* Output : CC = true, CS = false
*--------------------------------------
CC.IsValue0 and #CC.Q.PPPOINTER
beq .2
ldx #2
bra .6
.2 cpy #CC.T.FLOAT
bcc .5 char,int,long
ldx #5
*--------------------------------------
.5 jsr CC.GetVarSize
CC.KW.TestZero jsr CC.SYM.GetYASizeOfInAXC
tax
.6 lda #$A2 LDX #imm
jsr CODE.EmitByte
@ -186,7 +349,7 @@ CC.IsValue0 and #CC.Q.PPPOINTER
ldx #PCC.Test0X.L
ldy #0
.7 lda PCC.Test0X,y
jsr CODE.EmitByte
iny
@ -196,142 +359,29 @@ CC.IsValue0 and #CC.Q.PPPOINTER
clc
rts
*--------------------------------------
* Type Declaration keywords
*--------------------------------------
CC.CONST ldy #1
lda (pStack),y
ora #CC.Q.CONST
sta (pStack),y
jsr CC.CheckSpace
bcs .9
>LDYA L.CC.TMODS2
jsr CC.LookupID
bcs .9
jmp (J.CC.TMODS2,x)
.9 lda #E.CSYN
sec
rts
*--------------------------------------
CC.SIGNED sec
.HS 90 BCC
*--------------------------------------
CC.UNSIGNED clc
php
jsr CC.CheckSpace
bcs .9
>LDYA L.CC.TYPES
jsr CC.LookupID
bcs .9
cpx #CC.T.UCHAR
bcc .9 void
cpx #CC.T.SLONG+1 only char int long allowed
bcs .9
plp
bcs .8
jmp (J.CC.UTYPES-2,x)
.8 jmp (J.CC.STYPES-2,x)
.9 plp
lda #E.CSYN
sec
rts
*--------------------------------------
CC.SHORT jsr CC.CheckSpace
bcs .9
>LDYA L.CC.TYPES
jsr CC.LookupID
bcs CC.UCHAR
cpx #4 only int allowed
beq CC.SCHAR
.9 lda #E.CSYN
sec
rts
*--------------------------------------
CC.VOID lda #CC.T.VOID
bra CC.TYPE
CC.CHAR
CC.UCHAR lda #CC.T.UCHAR
bra CC.TYPE
CC.SCHAR lda #CC.T.SCHAR
bra CC.TYPE
CC.UINT lda #CC.T.UINT
bra CC.TYPE
CC.INT
CC.SINT lda #CC.T.SINT
bra CC.TYPE
CC.ULONG lda #CC.T.ULONG
bra CC.TYPE
CC.LONG
CC.SLONG lda #CC.T.SLONG
bra CC.TYPE
CC.FLOAT lda #CC.T.FLOAT
CC.TYPE sta (pStack)
jsr CC.GetCharNB
bcs .9
ldy #1
.1 cmp #'*'
bne .10
lda (pStack),y
CC.KW.ZPCCCodeAdd2
lda ZPCCCode
clc
adc #CC.Q.POINTER
bcs .9 more than ***
adc #2
sta ZPCCCode
bcc .8
sta (pStack),y
jsr CC.GetNextCharNB
bcc .1
.9 lda #E.CSYN
sec
.99 rts
inc ZPCCCode+1
.10 jsr CC.IsLetter
bcs .8
.8 rts
*--------------------------------------
* Input : Value on Stack, Y,A = Type/Qual
*--------------------------------------
CC.KW.StackDiscard
>LDYA L.CC.FTYPES
jsr CC.LookupID
bcs .8 next char is an identifier
ldy #1
lda (pStack),y
ora #CC.Q.FUNC+CC.Q.FASTCALL
sta (pStack),y
jsr CC.TYPE.SizeOf
txa
beq .8 void
jsr CODE.AddLocal
jsr CC.GetNextCharNB
bcs .9 next char is an identifier, ",", "(",")"
.8 clc
rts
.9 rts
*--------------------------------------
MAN
SAVE usr/src/bin/cc.s.kw

53
BIN/CC.S.STMT.txt Normal file
View File

@ -0,0 +1,53 @@
NEW
AUTO 3,1
.LIST OFF
*--------------------------------------
* X = KW.ID
*--------------------------------------
CC.STMT.CPStmt lda LocalPtr Locals
jsr CC.Push
bcs .99
lda #0 bState
jsr CC.Push
bcs .99
txa
jsr CC.Push
bcs .99
lda #'}'
jmp CC.Push
.99 rts
*--------------------------------------
CC.STMT.CPStmt.END
jsr CC.Pop
bcs .9
cmp #'}' must be '}' on stack....
bne .9
jsr CC.Pop get stacked KW...
tax
jsr CC.Pop bState
jsr CC.Pop Locals
sta LocalPtr
txa
bmi .5
jmp (J.CC.KW.END,x)
.5 jmp CC.F.Def.END
.9 lda #E.CSYN
sec
rts
*--------------------------------------
MAN
SAVE usr/src/bin/cc.s.stmt
LOAD usr/src/bin/cc.s
ASM

556
BIN/CC.S.SYM.txt Normal file
View File

@ -0,0 +1,556 @@
NEW
AUTO 3,1
.LIST OFF
*--------------------------------------
* Input : ZPLineBufPtr, Y,A = T/Q, X = SC
* Output : Y,A = VarID
*--------------------------------------
CC.SYM.New >STYA ZPPtr2 T/Q
stx ZPPtr3 SC
ldy ScopePtr
lda (pData),y
sta hSymScope
jsr CC.SYM.NewKey
bcs .9
>STYA ZPSymID Y,A = KeyID, X = KeyLen
>LDYAI 256
>SYSCALL GetMem
bcs .9
>STYA ZPSymBufPtr
stx hSymBuf
>LDYA ZPPtr2
jsr CC.SYM.SetTypeYA
lda ZPPtr3
ldy #SYM.SC
sta (ZPSymBufPtr),y
lda #SYM.Def
sta ZPSymSize
stz ZPSymSize+1
jsr CC.GetCharNB
bcs CC.SYM.SetAddr
cmp #'('
bne CC.SYM.NewV
jmp CC.F.Decl
.9 rts
*--------------------------------------
CC.SYM.NewV cmp #'['
bne CC.SYM.SetAddr
jsr CC.GetNextCharNB Skip [
bcs .99
cmp #']'
bne .3
.2 ldy #SYM.Q
lda (ZPSymBufPtr),y
bit #SYM.Q.PPPOINTER
beq .99
and #SYM.Q.AAARRAY
cmp #SYM.Q.AAARRAY
bcs .99
* ldy #SYM.Q
lda (ZPSymBufPtr),y
* clc
adc #SYM.Q.ARRAY
sta (ZPSymBufPtr),y
jsr CC.GetNextCharNB Skip ]
bcs CC.SYM.SetAddr
cmp #'['
beq .2
bra CC.SYM.SetAddr
*--------------------------------------
.3 jsr CC.EXP.IntConst
bcs .9
jsr CC.SYM.SetSizeOf
jsr CC.GetCharNB
bcs .99
cmp #']'
bne .99
jsr CC.GetNextCharNB Skip ]
bcs CC.SYM.SetAddr
* cmp #'['
* bne CC.SYM.SetAddr
bra CC.SYM.SetAddr
.99 lda #E.CSYN
sec
.9 rts
*--------------------------------------
CC.SYM.SetAddr ldy #SYM.Q
lda (ZPSymBufPtr),y
and #SYM.Q.FUNC
bne .9
ldy #SYM.SC
lda (ZPSymBufPtr),y
beq CC.SYM.SetAddrG SYM.SC.STATIC
cmp #SYM.SC.AUTO
beq CC.SYM.SetAddrL
.9 lda #E.TMISMATCH
sec
rts
*--------------------------------------
CC.SYM.SetAddrG jsr CC.SYM.GetSymSizeOfInAXC
jsr CC.SYM.SetSizeOf
* clc / sec A,X=Size, CS if pointer
ldy #SYM.Addr
lda ZPCCData
sta (ZPSymBufPtr),y
adc ZPCCData
sta ZPCCData
iny
lda ZPCCData+1
sta (ZPSymBufPtr),y
txa
adc ZPCCData+1
sta ZPCCData+1
clc
rts
*--------------------------------------
CC.SYM.SetAddrL jsr CC.SYM.GetSymSizeOfInAXC
jsr CC.SYM.SetSizeOf
ldy #SYM.SizeOf+1
lda (ZPSymBufPtr),y
bne .9
dey SYM.SizeOf
lda (ZPSymBufPtr),y
* clc / sec A,X=Size, CS if pointer
clc
adc LocalPtr
sta LocalPtr
bcs .9
ldy #SYM.Addr
sta (ZPSymBufPtr),y
jsr CC.SYM.GetSymSizeOfInAXC
jsr CODE.nAddLocal
clc
rts
.9 lda #E.BUF
sec
rts
*--------------------------------------
CC.SYM.NewKey >PUSHA
>PUSHW ZPLineBufPtr
>SYSCALL SListNewKey
bcs .9
phy
pha
lda #0
ldy #SYM.Addr
sta (ZPSymBufPtr),y
iny
sta (ZPSymBufPtr),y
jsr CC.SYM.Link
jsr CC.SkipX
clc
pla Y,A = KeyID, X = KeyLen
ply
.9 rts
*--------------------------------------
* Input : ZPLineBufPtr, X = KeyLen
*--------------------------------------
CC.SYM.Link >LDYA L.CC.LIBC
>STYA ZPLookupPtr
phx
ldx #0
.1 lda (ZPLookupPtr)
beq .9 Ending 0, not found....
pla
pha Get Back Len
cmp (ZPLookupPtr) Same Len ?
bne .4
tay
.2 lda (ZPLookupPtr),y
dey
cmp (ZPLineBufPtr),y
bne .4
tya
bne .2
lda (ZPLookupPtr)
jsr CC.ZPLookupPtrAddAp1 Skip LEN\Symbol
ldy #2 Skip LEN
lda (ZPLookupPtr),y
pha
dey
lda (ZPLookupPtr),y
ply
jsr CC.SYM.SetAddrYA
plx
clc
rts
.4 inx
inx
lda (ZPLookupPtr)
jsr CC.ZPLookupPtrAddAp1 Skip LEN\Symbol
lda (ZPLookupPtr)
jsr CC.ZPLookupPtrAddAp1 Skip LEN\definition
bra .1
.9 plx
sec
rts
*--------------------------------------
CC.SYM.Store >PUSHB hSymScope
>PUSHW ZPSymID
>PUSHW ZPSymBufPtr
>PUSHBI 0
>PUSHB ZPSymSize
>SYSCALL SListAddData
rts
*--------------------------------------
CC.SYM.NewScope ldy ScopePtr
cpy #CC.hSymbols+SCOPE.MAX-1
bcs .9
>SYSCALL SListNew
bcs .99
inc ScopePtr
ldy ScopePtr
sta (pData),y
dec ScopenCnt
clc
rts
.9 lda #E.OOH
sec
.99 rts
*--------------------------------------
CC.SYM.FreeScope
ldy ScopePtr
cpy #CC.hSymbols
beq *
lda (pData),y
>SYSCALL SListFree
dec ScopePtr
inc ScopenCnt
rts
*--------------------------------------
CC.SYM.Lookup jsr CC.SYM.Push
bcs .99
>PUSHB ScopePtr
.1 tay
lda (pData),y
jsr CC.SListLookup
bcc .8
lda (pstack)
cmp #CC.hSymbols
beq .9 CS
dec
sta (pstack)
bra .1
.9 jsr CC.SYM.Pop
inc pStack
lda #E.NOKEY
rts
.8 stx hSymBuf
>PULLA
tay
lda (pData),y
sta hSymScope
txa
>SYSCALL GetMemPtr
>STYA ZPSymBufPtr
.99 rts
*--------------------------------------
CC.SYM.Push ldx #7
.1 lda ZPSymID,x
jsr CC.Push
bcs .9
dex
bpl .1
.9 rts
*--------------------------------------
CC.SYM.FreeBuf lda hSymBuf
stz hSymBuf
>SYSCALL FreeMem
rts
*--------------------------------------
CC.SYM.FreeBufPop
jsr CC.SYM.FreeBuf
*--------------------------------------
CC.SYM.Pop ldx #0
.1 jsr CC.Pop
bcs .9
sta ZPSymID,x
inx
cpx #8
bne .1
clc
.9 rts
*--------------------------------------
* Y,A = value T/Q
*--------------------------------------
CC.SYM.PushValue
jsr CC.SYM.CheckTypeYA
bcs .9
jsr CC.SYM.GetSymSizeOfInAXC
tax
jsr CODE.LDXI
jsr CC.SYM.GetAddrInYA
beq .1
jsr CODE.LDYAI
jsr CODE.PushXFromYA
clc
rts
.1 jsr CODE.GetLocal Y = local address
jsr CODE.PushXFromYA
clc
.9 rts
*--------------------------------------
CC.SYM.PopValue jsr CC.SYM.CheckTypeYA
bcs .9
jsr CC.SYM.GetSymSizeOfInAXC
tax
jsr CODE.LDXI
jsr CC.SYM.GetAddrInYA
beq .1
jsr CODE.LDYAI
jsr CODE.PopXToYA
clc
rts
.1 jsr CODE.GetLocal Y = local address
jsr CODE.PopXToYA
clc
.9 rts
*--------------------------------------
CC.SYM.SetValue jsr CC.SYM.CheckTypeYA
bcs .9
jsr CC.SYM.GetSymSizeOfInAXC
tax
jsr CODE.LDXI
jsr CC.SYM.GetAddrInYA
beq .1
jsr CODE.LDYAI
jsr CODE.SetXToYA
clc
rts
.1 jsr CODE.GetLocal Y = local address
jsr CODE.SetXToYA
clc
.9 rts
*--------------------------------------
* in : Y,A = T/Q
* out : CC
* CS, A = E.TMISMATCH
*--------------------------------------
CC.SYM.CheckTypeYA
pha
tya
cmp (ZPSymBufPtr)
bne .9
pla
phy
ldy #SYM.Q
cmp (ZPSymBufPtr),y
bne .9
ply
clc
rts
.9 pla
lda #E.TMISMATCH
sec
rts
*--------------------------------------
* out : Y,A = T/Q
*--------------------------------------
CC.SYM.GetTypeInYA
ldy #SYM.Q
lda (ZPSymBufPtr),y
pha
lda (ZPSymBufPtr)
tay
pla
rts
*--------------------------------------
* in : Y,A = T/Q
*--------------------------------------
CC.SYM.SetTypeYA
phy
ldy #SYM.Q
sta (ZPSymBufPtr),y
pla
sta (ZPSymBufPtr)
rts
*--------------------------------------
* out : A,X,C = size
*--------------------------------------
CC.SYM.GetSymSizeOfInAXC
ldy #SYM.Q
lda (ZPSymBufPtr),y
pha
lda (ZPSymBufPtr) SYM.T
tay
pla
CC.SYM.GetYASizeOfInAXC
bit #SYM.Q.PPPOINTER
bne .1
lda CC.TYPESIZE-1,y
ldx #0
clc
rts
.1 lda #2 pointer
ldx #0
sec +1 for hMem Storage
rts
*--------------------------------------
* in/out : A,X,C = size
*--------------------------------------
CC.SYM.SetSizeOf
ldy #SYM.SizeOf
sta (ZPSymBufPtr),y
pha
iny
txa
sta (ZPSymBufPtr),y
pla
rts
*--------------------------------------
CC.SYM.GetAddrInYA
ldy #SYM.Addr+1
lda (ZPSymBufPtr),y
pha
dey #SYM.Addr
lda (ZPSymBufPtr),y
tay
pla Z if Local
rts
*--------------------------------------
CC.SYM.SetAddrYA
phy
ldy #SYM.Addr+1
sta (ZPSymBufPtr),y
pla
dey
sta (ZPSymBufPtr),y
rts
*--------------------------------------
MAN
SAVE usr/src/bin/cc.s.sym
LOAD usr/src/bin/cc.s
ASM

187
BIN/CC.S.TYPE.txt Normal file
View File

@ -0,0 +1,187 @@
NEW
AUTO 3,1
.LIST OFF
*--------------------------------------
CC.TYPE.Decl >ENTER 2
lda #0
sta (pStack) Type
ldy #1
sta (pStack),y Qual
jsr .7
bcs .99
ldy #1
lda (pStack),y
pha
lda (pStack)
tay Y = Type
pla A = Qual
clc
.99 >LEAVE
rts
.7 jmp (J.CC.TYPEQUAL,x)
*--------------------------------------
* Type Declaration keywords
*--------------------------------------
CC.TYPE.CONST lda #SYM.Q.CONST
bra CC.TYPE.VOLATILE.1
*--------------------------------------
CC.TYPE.VOLATILE
lda #SYM.Q.VOLATILE
CC.TYPE.VOLATILE.1
ldy #1
ora (pStack),y
sta (pStack),y
jsr CC.CheckSpace
bcs .9
>LDYA L.CC.TYPESPEC
jsr CC.LookupID
bcs .9
jmp (J.CC.TYPESPEC,x)
.9 lda #E.CSYN
sec
rts
*--------------------------------------
CC.TYPE.SIGNED sec
.HS 90 BCC
*--------------------------------------
CC.TYPE.UNSIGNED
clc
php
jsr CC.CheckSpace
bcs .9
>LDYA L.CC.TYPES
jsr CC.LookupID
bcs .9
cpx #SYM.T.UCHAR
bcc .9 void
cpx #SYM.T.SLONG+1 only char int long allowed
bcs .9
plp
bcs .8
jmp (J.CC.UTYPES-2,x)
.8 jmp (J.CC.STYPES-2,x)
.9 plp
lda #E.CSYN
sec
rts
*--------------------------------------
CC.TYPE.SHORT jsr CC.CheckSpace
bcs .9
>LDYA L.CC.TYPES
jsr CC.LookupID
bcs CC.TYPE.UCHAR
cpx #4 only int allowed
beq CC.TYPE.SCHAR
.9 lda #E.CSYN
sec
rts
*--------------------------------------
CC.TYPE.VOID lda #SYM.T.VOID
bra CC.TYPE
CC.TYPE.CHAR
CC.TYPE.UCHAR lda #SYM.T.UCHAR
bra CC.TYPE
CC.TYPE.SCHAR lda #SYM.T.SCHAR
bra CC.TYPE
CC.TYPE.UINT lda #SYM.T.UINT
bra CC.TYPE
CC.TYPE.INT
CC.TYPE.SINT lda #SYM.T.SINT
bra CC.TYPE
CC.TYPE.ULONG lda #SYM.T.ULONG
bra CC.TYPE
CC.TYPE.LONG
CC.TYPE.SLONG lda #SYM.T.SLONG
bra CC.TYPE
CC.TYPE.FLOAT lda #SYM.T.FLOAT
CC.TYPE sta (pStack) T
jsr CC.GetCharNB
bcs .9
.1 cmp #'*'
bne .10
ldy #1 Q
lda (pStack),y
clc
adc #SYM.Q.POINTER
bcs .9 more than ***
sta (pStack),y
jsr CC.GetNextCharNB
bcc .1
.9 lda #E.CSYN
sec
.99 rts
.10 jsr CC.IsLetter
bcs .8
>LDYA L.CC.FTYPES
jsr CC.LookupID
bcs .8 next char is an identifier
ldy #1
lda (pStack),y
ora #SYM.Q.FUNC+SYM.Q.FASTCALL
sta (pStack),y
jsr CC.GetNextCharNB
bcs .9 next char is an identifier, ",", "(",")"
.8 clc
rts
*--------------------------------------
* in : Y,A = type/qual
* out : X = size
*--------------------------------------
CC.TYPE.SizeOf bit #SYM.Q.PPPOINTER
bne .2
ldx CC.TYPESIZE-1,y
clc
rts
.2 ldx #2 pointer
sec +1 for hMem Storage
rts
*--------------------------------------
MAN
SAVE usr/src/bin/cc.s.type
LOAD usr/src/bin/cc.s
ASM

File diff suppressed because it is too large Load Diff

View File

@ -109,7 +109,10 @@ CSH.DIR.INCLUDE >STZ.G PathBuf
sec
.99 rts
.8 jsr CSH.GetNextChar skip " or >
.8 lda #0
sta (pData),y terminate string
jsr CSH.GetNextChar skip " or >
lda hInclude
bne .90

272
BIN/SPDIAG.S.txt Normal file
View File

@ -0,0 +1,272 @@
NEW
AUTO 3,1
.LIST OFF
.OP 65C02
.OR $2000
.TF bin/spdiag
*--------------------------------------
.INB inc/macros.i
.INB inc/mli.i
.INB inc/a2osx.i
.INB inc/kernel.i
*--------------------------------------
.DUMMY
.OR ZPBIN
ZS.START
ZPPtr1 .BS 2
DevId .BS 1
DevCount .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 #64 Stack Size
.DA #ZS.END-ZS.START Zero Page Size
.DA 0
*--------------------------------------
* Relocation Table
*--------------------------------------
.1 .DA CS.INIT
.DA CS.RUN
.DA CS.EVENT
.DA CS.QUIT
L.MSG.SP.FOUND .DA MSG.SP.FOUND
L.MSG.SP.OK .DA MSG.SP.OK
L.MSG.DEV .DA MSG.DEV
L.MSG.DEV.DIB .DA MSG.DEV.DIB
L.MSG.DEV.C .DA MSG.DEV.C
L.MSG.DEV.B .DA MSG.DEV.B
L.MSG.ERR .DA MSG.ERR
.DA 0
*--------------------------------------
CS.INIT clc
rts
*--------------------------------------
CS.RUN lda #$C1
sta ZPPtr1+1
lda #$20 JSR
>STA.G DEV.SPCallCode
>LEA.G DEV.SPCallParam
>STYA.G DEV.SPCallCode+4
lda #$60 RTS
>STA.G DEV.SPCallCode+6
lda #3 ParamCount
>STA.G DEV.SPCallParam
>LEA.G DEV.DIB
>STYA.G DEV.SPCallParam+2
*--------------------------------------
.1 ldx #SmartPort.SIG-SmartPort.OFS-1
.2 ldy SmartPort.OFS,x Check if there is a smartport firmware
lda (ZPPtr1),y
cmp SmartPort.SIG,x
bne .7 not a Disk Controller...
dex
bpl .2
>PUSHW L.MSG.SP.FOUND
lda ZPPtr1+1
and #7
>PUSHA
ldy #$FB
lda (ZPPtr1),y Get device id
>PUSHA
>PUSHBI 2
>SYSCALL Printf
bcs .9
ldy #$ff
lda (ZPPtr1),y
* clc
adc #3
ldy #1
sta (pData),y
lda ZPPtr1+1
iny
sta (pData),y
ldx #0 Unit Number = 0
lda #0 Status Code = Get Controller Status
jsr CS.SPStatusCall
bcs .6
jsr CS.SPEnum
bcs .9
bra .7
.6 jsr CS.SPError
bcs .9
.7 inc ZPPtr1+1
lda ZPPtr1+1
cmp #$C8
bne .1
lda #0
sec
.9 rts
*--------------------------------------
CS.SPEnum >PUSHW L.MSG.SP.OK
>PUSHB.G DEV.DIB Unit Count
sta DevCount
>PUSHBI 1
>SYSCALL PrintF
bcs .9
lda DevCount
beq .8
stz DevId
.1 inc DevId
>PUSHW L.MSG.DEV
>PUSHB DevId
>PUSHBI 1
>SYSCALL PrintF
bcs .9
ldx DevId
lda #3 Status Code = Get DIB
jsr CS.SPStatusCall
bcs .6
jsr CS.DumpDIB
bcs .9
bra .7
.6 jsr CS.SPError
bcs .9
.7 dec DevCount
bne .1
.8 clc
.9 rts
*--------------------------------------
CS.DumpDIB >PUSHW L.MSG.DEV.DIB
>LDA.G DEV.DIB+S.DIB.S
ldy #DEV.SFLAGS+7
ldx #7
.1 lsr
pha
lda #'-'
bcc .2
lda MSG.SFLAGS,x
.2 sta (pData),y
pla
dey
dex
bpl .1
>PUSHEA.G DEV.SFLAGS
>PUSHB.G DEV.DIB+S.DIB.T
>PUSHB.G DEV.DIB+S.DIB.ST
>PUSHEA.G DEV.DIB+S.DIB.IDS
>PUSHB.G DEV.DIB+S.DIB.VERSION
>PUSHB.G DEV.DIB+S.DIB.VERSION+1
>PUSHBI 8
>SYSCALL PrintF
bcs .9
>LDA.G DEV.DIB+S.DIB.S
bpl .4 char device...
>PUSHW L.MSG.DEV.B
>PUSHBI 0
>PUSHB.G DEV.DIB+S.DIB.SIZE+2
>PUSHB.G DEV.DIB+S.DIB.SIZE+1
>PUSHB.G DEV.DIB+S.DIB.SIZE
>PUSHBI 4
bra .8
.4 >PUSHW L.MSG.DEV.C
>PUSHBI 0
.8 >SYSCALL PrintF
.9 rts
*--------------------------------------
CS.SPStatusCall >STA.G DEV.SPCallParam+4 Status Code
txa
>STA.G DEV.SPCallParam+1 Unit Number
jmp (pData)
**--------------------------------------
CS.SPError tax
>PUSHW L.MSG.ERR
txa
>PUSHA
>PUSHBI 1
>SYSCALL PrintF
rts
*--------------------------------------
CS.EVENT sec
rts
*--------------------------------------
CS.QUIT clc
rts
*--------------------------------------
CS.END
MSG.SP.FOUND .AZ "Slot #%2d:DevId = %b, "
MSG.SP.OK .AS "Dev Count = %d\r\n"
.AZ " Status Typ/Sub IDString Version Size (BLK)\r\n"
MSG.DEV .AZ " Dev #%2d:"
MSG.DEV.DIB .AZ "%s $%h/$%h %16S %03d.%03d "
MSG.DEV.B .AZ "%10u\r\n"
MSG.DEV.C .AZ "n/a\r\n"
MSG.ERR .AZ "Error : $%h\r\n"
*--------------------------------------
MSG.SFLAGS .AS "bwrlneio"
*--------------------------------------
SmartPort.OFS .HS 01030507
SmartPort.SIG .HS 20000300
*--------------------------------------
BLANK.DIB .DA #0
.BS 3
>PSTR "(No IDS String!)"
.DA #0
.DA #0
.DA 0
*--------------------------------------
.DUMMY
.OR 0
DS.START
DEV.SPCallCode .BS 7 jsr $ffff, Call#, ParamPtr, RTS
DEV.SPCallParam .BS 8
DEV.DIB .BS S.DIB
DEV.SFLAGS .BS 9
DS.END .ED
*--------------------------------------
MAN
SAVE usr/src/bin/spdiag.s
ASM

188
DRV/SPTAPE.DRV.S.txt Normal file
View File

@ -0,0 +1,188 @@
NEW
AUTO 3,1
.LIST OFF
.OP 65C02
.OR $2000
.TF drv/sptape.drv
*--------------------------------------
.INB inc/macros.i
.INB inc/a2osx.i
.INB inc/mli.e.i
*--------------------------------------
.DUMMY
.OR ZPDRV
ZS.START
ZPTmpPtr1 .BS 2
DevID .BS 1
DevCnt .BS 1
ZS.END .ED
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
CS.START cld
jmp Dev.Detect cld,jmp abs=DRV
.DA #$61 6502,Level 1 (65c02)
.DA #1 DRV Layout Version 1
.DA 0
.DA CS.END-CS.START Code Length
.DA 0
.DA #32 SS
.DA #ZS.END-ZS.START Zero Page Size
.DA 0
*--------------------------------------
* Relocation Table
*--------------------------------------
L.MSG.DETECT .DA MSG.DETECT
L.MSG.DETECT.OK .DA MSG.DETECT.OK
L.MSG.DETECT.KO .DA MSG.DETECT.KO
L.SP.DIB .DA SP.DIB
L.FD.DEV .DA FD.DEV
L.FD.DEV.NAME .DA FD.DEV.NAME
.DA 0 End Of Reloc Table
*--------------------------------------
Dev.Detect >STYA ARGS
>LDYA L.MSG.DETECT
>SYSCALL PutS
jsr SP.ScanSlots
bcc .4
>LDYA L.MSG.DETECT.KO
>SYSCALL PutS
lda #MLI.E.NODEV Not Found in any slot, exiting
sec
rts
.4 lda ZPTmpPtr1+1
and #$F
sta FD.DEV+S.FD.DEV.BUSID
ora #$30
sta FD.DEV.NAME+2
lda DevID
sta FD.DEV+S.FD.DEV.DEVID
ora #$30
sta FD.DEV.NAME+3
>LDYA ZPTmpPtr1
>STYA FD.DEV+S.FD.DEV.BUSPTR
.8 >PUSHW L.MSG.DETECT.OK
>PUSHW L.FD.DEV.NAME
>PUSHBI 2
>SYSCALL PrintF
* >STYA FD.DEV+S.FD.DEV.DRVPTR
* S.FD.DEV.DRVPTR = NULL -> KERNEL will hook to NATIVE SP
>PUSHW L.FD.DEV
>PUSHW L.FD.DEV.NAME
>SYSCALL MKDev
.9 rts
*--------------------------------------
SP.ScanSlots lda #$C1
sta ZPTmpPtr1+1
>LDYA L.SP.DIB
>STYA SP.Params+S.IOCTL.BUFPTR
.1 stz ZPTmpPtr1
ldx #SmartPort.SIG-SmartPort.OFS-1
.2 ldy SmartPort.OFS,x Check if there is a smartport firmware
lda (ZPTmpPtr1),y
cmp SmartPort.SIG,x
bne .7 not a Disk Controller...
dex
bpl .2
ldy #$ff
lda (ZPTmpPtr1),y
clc
adc #3
sta ZPTmpPtr1
ldx #0 Unit Number = 0
lda #S.IOCTL.S.STATUS
jsr SP.Call
bcs .7
lda SP.DIB
beq .7
sta DevCnt
stz DevId
.3 inc DevId
ldx DevId
lda #S.IOCTL.S.GETDIB
jsr SP.Call
bcs .6
lda SP.DIB+S.DIB.T
cmp #S.DIB.T.TAPE
bne .6
clc
rts
.6 dec DevCnt
bne .3
.7 inc ZPTmpPtr1+1
lda ZPTmpPtr1+1
cmp #$C8
bne .1
lda #0
sec
.9 rts
*--------------------------------------
SP.Call stx SP.Params+S.IOCTL.UNITNUM
sta SP.Params+S.IOCTL.S
lda #0 SP STATUS (NO IOCTL values !!!)
sta .1
jsr .2
.1 lda SP.Params
rts
.2 jmp (ZPTmpPtr1)
*--------------------------------------
CS.END
*--------------------------------------
MSG.DETECT .AZ "A2osX SmartPort Tape Driver"
MSG.DETECT.OK .AZ "Tape Installed As Device : %s\r\n"
MSG.DETECT.KO .AZ "No Device Found."
ARGS .BS 2
*--------------------------------------
SmartPort.OFS .HS 01030507
SmartPort.SIG .HS 20000300
SP.Params .DA #3 ParamCount
.BS 1 UnitNum
.BS 2 StatBuf
.BS 1 StatusCode
.BS 5 -> S.IOCTL
SP.DIB .BS S.DIB
*--------------------------------------
FD.DEV .DA #S.FD.T.CDEV
.DA #0 HANDLER
.BS 1 BUSID
.BS 1 DEVID
.DA 0 BUSPTR
.DA 0 DRVPTR
.DA 0 DCBPTR
.DA 0 BUFPTR
FD.DEV.NAME .AZ "st00"
*--------------------------------------
DRV.END
MAN
SAVE usr/src/drv/sptape.drv.s
ASM

View File

@ -103,6 +103,7 @@ E.BADFTYPE .EQ $C7
E.FUNDEF .EQ $C8
E.UNEXPEOF .EQ $C9
E.NODO .EQ $CA
E.REDEF .EQ $CB
*
E.TMISMATCH .EQ $CF
*--------------------------------------

View File

@ -1,6 +1,8 @@
NEW
AUTO 3,1
#define PI 3.14159265
float pwr(float,float);
float log(float);
float sqr(float);

View File

@ -1,7 +1,7 @@
NEW
AUTO 3,1
#define NULL 0
#define NULL ((void *)0)
#define O_RDONLY 1
#define O_WRONLY 2

View File

@ -772,27 +772,27 @@ LDR.AddSPDevs jsr LDR.SetDevID setup the devid byte from attributes
lda LDR.SPStatusBuf Device count
beq LDR.AddExtraDevs.RTS no devices, so done.
* sta LDR.DevCnt
sta LDR.DevCnt
ldx LDR.SlotIdx
inc LDR.SlotDevType-1,x set as smartport
*.3 inc LDR.SPStatus.U
.3 inc LDR.SPStatus.U
* jsr LDR.SPStatusCall.U call to get the device status
* bcs .7
jsr LDR.SPStatusCall.U call to get the device status
bcs .7
* lda LDR.SPStatusBuf
* bpl .7 not a block device
lda LDR.SPStatusBuf
bpl .7 not a block device
* ldx LDR.SlotIdx
* inc LDR.SlotDevCnt-1,x
ldx LDR.SlotIdx
inc LDR.SlotDevCnt-1,x
*.7 dec LDR.DevCnt
* bne .3
.7 dec LDR.DevCnt
bne .3
* ldx LDR.SlotIdx
* lda LDR.SlotDevCnt-1,x
* beq LDR.AddBlkDevs.RTS
ldx LDR.SlotIdx
lda LDR.SlotDevCnt-1,x
beq LDR.AddBlkDevs.RTS
sta LDR.SlotDevCnt-1,x
cmp #2 CC/CS, add 1 or 2 devs
@ -930,7 +930,7 @@ LDR.MountSPDevs ldx #LDR.DEVPTRS.CNT-1
rts
*--------------------------------------
LDR.SPStatusCall
sta LDR.SPStatus.U device = 2 for SCSI
sta LDR.SPStatus.U
LDR.SPStatusCall.U
LDR.SPVect jsr $0000 self modifying
.HS 00

View File

@ -92,7 +92,7 @@ K.MkFD
* ## RETURN VALUE
* A = hDEV
*\--------------------------------------
K.MKDev jsr SHARED.PullP2P1 ptr2=name,tr1=fd
K.MKDev jsr SHARED.PullP2P1 ptr2=name,ptr1=fd
ldy #$ff
ldx #S.FD.DEV
@ -130,7 +130,17 @@ K.MKDev jsr SHARED.PullP2P1 ptr2=name,tr1=fd
>LDYAI K.IOBuf
>STYA K.S.IOCTL+S.IOCTL.BUFPTR
jsr DEV.GetPDrv
ldy #S.FD.DEV.DRVPTR+1
lda (pFD),y
bne .5
lda /DRV.SmartPort
sta (pFD),y
dey
lda #DRV.SmartPort
lda (pFD),y
.5 jsr DEV.GetPDrv
lda #S.IOCTL.S.STATUS
jsr DEV.GetStatus
@ -142,13 +152,13 @@ K.MKDev jsr SHARED.PullP2P1 ptr2=name,tr1=fd
ldx #0
.5 lda IRQ.Vectors+1,x
.6 lda IRQ.Vectors+1,x
beq .7
inx
inx
cpx #K.IRQDEV.MAX*2+1
bne .5
bne .6
* sec

View File

@ -94,6 +94,7 @@ ERRORX.ID .DA #MLI.E.BADCALL
.DA #E.FUNDEF
.DA #E.UNEXPEOF
.DA #E.NODO
.DA #E.REDEF
.DA #E.TMISMATCH
*--------------------------------------
ERRORX.CNT .EQ *-ERRORX.ID
@ -140,9 +141,10 @@ ERRORX.MSG .AT "Bad MLI Call"
.AT "NEXT Without FOR"
.AT "FI/ELSE Without IF"
.AT "Bad File Type"
.AT "Undef. Function"
.AT "Undef. Symbol"
.AT "Unexp. EOF"
.AT "LOOP Without DO"
.AT "Symbol Redef"
.AT "Type Mismatch"
*--------------------------------------
.AT "Unknown Error"