mirror of
https://github.com/A2osX/A2osX.git
synced 2024-06-16 15:29:38 +00:00
Kernel 0.94++
This commit is contained in:
parent
988a14bf42
commit
6959200abf
Binary file not shown.
|
@ -140,59 +140,64 @@ CSH.Run.1 cmp #C.CR empty line....
|
||||||
.10 jsr CSH.IsLetter
|
.10 jsr CSH.IsLetter
|
||||||
bcc .20
|
bcc .20
|
||||||
|
|
||||||
|
* TODO: PREOPS ++ --.....
|
||||||
|
|
||||||
|
bcs .29
|
||||||
bcs .29 error, todo : PREOPS ++ --.....
|
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
.20 >LDYA L.CSH.TMODS
|
.20 >LDYA L.CSH.TMODS
|
||||||
jsr CSH.LookupID
|
jsr CSH.LookupID
|
||||||
bcs .50
|
bcs .50
|
||||||
|
|
||||||
jsr CSH.tDecl.JMP
|
jsr CSH.tDecl
|
||||||
bcs .59
|
bcs .59
|
||||||
|
|
||||||
|
>STYA ZPVarType Type/Qual
|
||||||
|
|
||||||
jsr CSH.AddSymbol add with undef value...
|
jsr CSH.AddSymbol add with undef value...
|
||||||
bcs .99 OOM or DUP
|
bcs .29 OOM or DUP
|
||||||
|
|
||||||
|
lda ZPVarQual
|
||||||
|
bit #CSH.Q.FUNC
|
||||||
|
bne .21
|
||||||
|
|
||||||
jsr CSH.GetCharNB
|
jsr CSH.GetCharNB
|
||||||
bcs .99
|
bcs .99
|
||||||
|
|
||||||
cmp #';'
|
cmp #';'
|
||||||
beq .8
|
beq .69
|
||||||
|
|
||||||
cmp #'='
|
cmp #'='
|
||||||
bne .21
|
bne .99
|
||||||
|
|
||||||
jsr CSH.GetNextCharNB skip '='
|
jsr CSH.GetNextCharNB skip '='
|
||||||
bcs .99
|
bcs .99
|
||||||
|
|
||||||
lda ZPVarType
|
>LDYA ZPVarType T/Q
|
||||||
jsr CSH.ExpEval
|
jsr CSH.ExpEval
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
jsr CSH.SetVarValueFromStack X= Type, Set value to this var
|
jsr CSH.SetVarValue Y,A Type/qual, Set value to this var
|
||||||
.29 bcs .99
|
.29 bcs .9
|
||||||
|
|
||||||
bra .68
|
bra .68
|
||||||
|
|
||||||
.21 cmp #'('
|
.21 jsr CSH.fDecl
|
||||||
bne .99
|
bcs .9
|
||||||
|
|
||||||
jsr CSH.fDecl
|
|
||||||
bcs .99
|
|
||||||
|
|
||||||
bra .68
|
bra .68
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
.50 jsr CSH.SavePtr Save Ptr, in case of while,for....
|
.50 jsr CSH.SavePtr Save Ptr, in case of while,for....
|
||||||
|
|
||||||
>LDYA L.CSH.KW
|
>LDYA L.CSH.KW
|
||||||
jsr CSH.LookupID
|
jsr CSH.LookupID
|
||||||
bcs .6 not an internal CSH keyword....
|
bcs .6 not an internal CSH keyword....
|
||||||
|
|
||||||
jsr CSH.KW.JMP
|
jsr CSH.KW.JMP
|
||||||
.59 bcs .9
|
.59 bcs .9
|
||||||
bra .8
|
|
||||||
|
|
||||||
.6 jsr CSH.GetVar
|
bra .8
|
||||||
|
*--------------------------------------
|
||||||
|
.6 jsr CSH.GetVar I = ?
|
||||||
bcs .7
|
bcs .7
|
||||||
|
|
||||||
>STYA ZPVarID
|
>STYA ZPVarID
|
||||||
|
@ -203,7 +208,12 @@ CSH.Run.1 cmp #C.CR empty line....
|
||||||
bit #CSH.Q.FUNC
|
bit #CSH.Q.FUNC
|
||||||
beq .60
|
beq .60
|
||||||
|
|
||||||
|
ldy #0 func( ?
|
||||||
|
lda #0
|
||||||
|
jsr CSH.fExec
|
||||||
|
bcs .9
|
||||||
|
|
||||||
|
bra .8
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
.60 jsr CSH.GetCharNB
|
.60 jsr CSH.GetCharNB
|
||||||
bcs .9
|
bcs .9
|
||||||
|
@ -214,27 +224,29 @@ CSH.Run.1 cmp #C.CR empty line....
|
||||||
jsr CSH.GetNextChar Skip =
|
jsr CSH.GetNextChar Skip =
|
||||||
bcs .99
|
bcs .99
|
||||||
|
|
||||||
lda ZPVarType
|
>LDYA ZPVarType T/Q
|
||||||
jsr CSH.ExpEval
|
jsr CSH.ExpEval
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
jsr CSH.SetVarValueFromStack X = Exp Type
|
jsr CSH.SetVarValue
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
.68 jsr CSH.GetCharNB
|
.68 jsr CSH.GetCharNB
|
||||||
cmp #';'
|
cmp #';'
|
||||||
beq .8
|
.69 beq .8
|
||||||
|
|
||||||
.99 lda #E.CSYN
|
.99 lda #E.CSYN
|
||||||
sec
|
sec
|
||||||
.9 rts
|
.9 rts
|
||||||
|
*--------------------------------------
|
||||||
|
.7 ldy #0 no return value type check required
|
||||||
|
lda #0
|
||||||
|
|
||||||
.7 lda #0 no return value type check required
|
jsr CSH.fCall Y,A = Type/Qual
|
||||||
jsr CSH.fCall
|
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
jsr CSH.GetVarSize X = returned value type
|
jsr CSH.GetVarSize Y,A = returned value type
|
||||||
clc A = Sizeof CC to ignore Pointer hMem
|
clc A = Sizeof, CC to ignore Pointer hMem
|
||||||
adc pStack
|
adc pStack
|
||||||
sta pStack Discard value on stack
|
sta pStack Discard value on stack
|
||||||
|
|
||||||
|
@ -260,10 +272,12 @@ CSH.COMMENTS jsr CSH.GetNextChar
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CSH.SkipLine jsr CSH.GetNextChar
|
CSH.SkipLine jsr CSH.GetNextChar
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
cmp #C.CR
|
cmp #C.CR
|
||||||
bne CSH.SkipLine
|
bne CSH.SkipLine
|
||||||
|
|
||||||
clc
|
jmp CSH.GetNextChar Skip CR
|
||||||
|
|
||||||
.9 rts
|
.9 rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CSH.SavePtr >LDYA ZPInputBufPtr
|
CSH.SavePtr >LDYA ZPInputBufPtr
|
||||||
|
@ -328,9 +342,10 @@ CSH.Lookup phy Y = len
|
||||||
>LDA.G CSH.LookupOpt
|
>LDA.G CSH.LookupOpt
|
||||||
bpl .1
|
bpl .1
|
||||||
|
|
||||||
ldy #$0 Start at Y=1 for VOID func()
|
ldy #$0 Start at Y=2 for VOID func()
|
||||||
|
|
||||||
.6 iny
|
.6 iny
|
||||||
|
iny
|
||||||
lda (ZPPtr1),y
|
lda (ZPPtr1),y
|
||||||
bne .6
|
bne .6
|
||||||
|
|
||||||
|
@ -342,9 +357,27 @@ CSH.Lookup phy Y = len
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CSH.ZPPtr1Next inc ZPPtr1
|
CSH.ZPPtr1GetNextW
|
||||||
|
jsr CSH.ZPPtr1NextW
|
||||||
|
*--------------------------------------
|
||||||
|
CSH.ZPPtr1GetW lda (ZPPtr1)
|
||||||
|
beq .8
|
||||||
|
|
||||||
|
pha
|
||||||
|
|
||||||
|
ldy #1
|
||||||
|
lda (ZPPtr1),y
|
||||||
|
ply
|
||||||
|
|
||||||
|
.8 rts
|
||||||
|
*--------------------------------------
|
||||||
|
CSH.ZPPtr1NextW jsr .1
|
||||||
|
|
||||||
|
.1 inc ZPPtr1
|
||||||
bne .8
|
bne .8
|
||||||
|
|
||||||
inc ZPPtr1+1
|
inc ZPPtr1+1
|
||||||
|
|
||||||
.8 rts
|
.8 rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CSH.ZPPtr1AddAp1
|
CSH.ZPPtr1AddAp1
|
||||||
|
@ -363,7 +396,8 @@ CSH.AddSymbol >LDA.G CSH.hSymbols
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
>STYA ZPVarID
|
>STYA ZPVarID
|
||||||
ldx ZPVarType
|
|
||||||
|
>LDYA ZPVarType
|
||||||
jsr CSH.GetVarSize CS if pointer
|
jsr CSH.GetVarSize CS if pointer
|
||||||
sta ZPVarSizeOf
|
sta ZPVarSizeOf
|
||||||
|
|
||||||
|
@ -386,10 +420,33 @@ CSH.AddSymbol >LDA.G CSH.hSymbols
|
||||||
|
|
||||||
bcs .99
|
bcs .99
|
||||||
|
|
||||||
>PUSHB.G CSH.hSymbols
|
jsr CSH.GetCharNB
|
||||||
|
bcs .8
|
||||||
|
|
||||||
|
cmp #'('
|
||||||
|
beq .7
|
||||||
|
|
||||||
|
lda ZPVarQual
|
||||||
|
and #CSH.Q.FUNC
|
||||||
|
beq .8
|
||||||
|
|
||||||
|
lda #E.CSYN
|
||||||
|
sec
|
||||||
|
rts
|
||||||
|
|
||||||
|
.7 lda #CSH.Q.FUNC
|
||||||
|
tsb ZPVarQual
|
||||||
|
|
||||||
|
lda ZPCSHfDecl
|
||||||
|
sta ZPVarDefPtr
|
||||||
|
|
||||||
|
lda ZPCSHfDecl+1
|
||||||
|
sta ZPVarDefPtr+1
|
||||||
|
|
||||||
|
.8 >PUSHB.G CSH.hSymbols
|
||||||
>PUSHW ZPVarID
|
>PUSHW ZPVarID
|
||||||
>PUSHWI ZPVarDef
|
>PUSHWI ZPVarDef
|
||||||
>PUSHWI 6
|
>PUSHWI 8
|
||||||
>SYSCALL SListAddData
|
>SYSCALL SListAddData
|
||||||
.9 rts
|
.9 rts
|
||||||
|
|
||||||
|
@ -397,31 +454,180 @@ CSH.AddSymbol >LDA.G CSH.hSymbols
|
||||||
* sec
|
* sec
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CSH.fDecl lda ZPCSHfDecl
|
* ZPVarDataPtr = fDef
|
||||||
sta ZPVarDataPtr
|
*--------------------------------------
|
||||||
|
CSH.fExec ldx ZPPtr1
|
||||||
|
phx
|
||||||
|
ldx ZPPtr1+1 local : fdef Ptr
|
||||||
|
phx
|
||||||
|
ldx ZPPtr2 local : type
|
||||||
|
phx
|
||||||
|
ldx ZPPtr2+1 local : qual
|
||||||
|
phx
|
||||||
|
ldx ZPPtr3 local : variadic size
|
||||||
|
phx
|
||||||
|
ldx ZPPtr3+1 local : f
|
||||||
|
phx
|
||||||
|
|
||||||
lda ZPCSHfDecl+1
|
>STYA ZPPtr2 save Type/qual
|
||||||
sta ZPVarDataPtr+1
|
|
||||||
|
|
||||||
lda ZPVarID
|
>LDYA ZPVarDefPtr
|
||||||
|
>STYA ZPPtr1
|
||||||
|
|
||||||
|
stz ZPPtr3 Reset VARIADIC byte count
|
||||||
|
|
||||||
|
jsr CSH.GetNextCharNB skip '('
|
||||||
|
bcs .10
|
||||||
|
|
||||||
|
jsr CSH.ZPPtr1GetW Y,A = Return value Type/Qual
|
||||||
|
|
||||||
|
ldx ZPPtr2
|
||||||
|
beq .1 no check required
|
||||||
|
|
||||||
|
cpy ZPPtr2
|
||||||
|
bne .91
|
||||||
|
|
||||||
|
cmp ZPPtr2+1
|
||||||
|
bne .91
|
||||||
|
|
||||||
|
.1 eor #CSH.Q.FUNC
|
||||||
|
>STYA ZPPtr2 this will be the returned type/qual
|
||||||
|
|
||||||
|
jsr CSH.ZPPtr1GetNextW advance to arg list type
|
||||||
|
beq .7 end of list, go check ending ')'
|
||||||
|
*--------------------------------------
|
||||||
|
.3 cpy #CSH.T.VARIADIC if VARIADIC, don't advance to next arg and assume type = 0
|
||||||
|
bne .4
|
||||||
|
|
||||||
|
ldy #0
|
||||||
|
lda #0
|
||||||
|
|
||||||
|
.4 jsr CSH.ExpEval Y,A = 0 if VARIADIC
|
||||||
|
bcs .93
|
||||||
|
|
||||||
|
jsr CSH.GetVarSize Y,A = Var Type/Qual
|
||||||
|
|
||||||
|
tax
|
||||||
|
lda (ZPPtr1)
|
||||||
|
eor #CSH.T.VARIADIC
|
||||||
|
bne .5
|
||||||
|
|
||||||
|
txa
|
||||||
|
clc make sure pointer only 2 bytes
|
||||||
|
adc ZPPtr3
|
||||||
|
sta ZPPtr3 Add to byte count
|
||||||
|
bra .51 stay on VARIADIC tag
|
||||||
|
|
||||||
|
.5 jsr CSH.ZPPtr1NextW
|
||||||
|
|
||||||
|
.51 jsr CSH.GetCharNB
|
||||||
|
.10 bcs .90
|
||||||
|
|
||||||
|
cmp #','
|
||||||
|
bne .6
|
||||||
|
|
||||||
|
jsr CSH.GetNextCharNB Skip ','
|
||||||
|
|
||||||
|
jsr CSH.ZPPtr1GetW
|
||||||
|
bne .3 Another ARG....
|
||||||
|
|
||||||
|
.52 bra .90 extra args....error
|
||||||
|
|
||||||
|
.6 cmp #')'
|
||||||
|
bne .90
|
||||||
|
|
||||||
|
jsr CSH.ZPPtr1GetW
|
||||||
|
beq .8 no more arg after ')', exit
|
||||||
|
|
||||||
|
cpy #CSH.T.VARIADIC
|
||||||
|
bne .90 missing arg
|
||||||
|
|
||||||
|
>PUSHB ZPPtr3 push VARIADIC byte count
|
||||||
|
|
||||||
|
.7 jsr CSH.GetCharNB
|
||||||
|
bcs .90
|
||||||
|
|
||||||
|
cmp #')'
|
||||||
|
bne .90
|
||||||
|
|
||||||
|
.8 jsr CSH.GetNextCharNB Skip )
|
||||||
|
|
||||||
|
* ldx ZPPtr3+1
|
||||||
|
* jsr CSH.Exec
|
||||||
|
* bcs .93
|
||||||
|
|
||||||
|
>LDYA ZPPtr2 type/qual
|
||||||
|
bra .93
|
||||||
|
|
||||||
|
.90 lda #E.CSYN
|
||||||
|
bra .92
|
||||||
|
|
||||||
|
.91 lda #E.TMISMATCH
|
||||||
|
|
||||||
|
.92 sec
|
||||||
|
|
||||||
|
.93 plx
|
||||||
|
stx ZPPtr3+1
|
||||||
|
plx
|
||||||
|
stx ZPPtr3
|
||||||
|
|
||||||
|
plx
|
||||||
|
stx ZPPtr2+1
|
||||||
|
plx
|
||||||
|
stx ZPPtr2
|
||||||
|
|
||||||
|
plx
|
||||||
|
stx ZPPtr1+1
|
||||||
|
plx
|
||||||
|
stx ZPPtr1
|
||||||
|
|
||||||
|
.99 rts
|
||||||
|
*--------------------------------------
|
||||||
|
CSH.fDecl >ENTER 2
|
||||||
|
|
||||||
|
lda #0
|
||||||
|
sta (pStack) hLocal
|
||||||
|
|
||||||
|
lda ZPVarType
|
||||||
jsr CSH.fDeclAddA
|
jsr CSH.fDeclAddA
|
||||||
lda ZPVarID+1
|
lda ZPVarQual
|
||||||
jsr CSH.fDeclAddA
|
jsr CSH.fDeclAddA
|
||||||
>DEBUG
|
|
||||||
jsr CSH.GetNextCharNB Skip (
|
jsr CSH.GetNextCharNB Skip (
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
.1 cmp #')'
|
.1 cmp #')'
|
||||||
beq .5
|
beq .6
|
||||||
|
|
||||||
.2 jsr CSH.fDeclGetArg
|
.2 jsr CSH.fDeclGetArg
|
||||||
bcs .99
|
bcs .99
|
||||||
|
|
||||||
|
pha
|
||||||
|
|
||||||
|
tya
|
||||||
|
jsr CSH.fDeclAddA
|
||||||
|
|
||||||
|
pla
|
||||||
|
jsr CSH.fDeclAddA
|
||||||
|
|
||||||
jsr CSH.GetCharNB
|
jsr CSH.GetCharNB
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
cmp #')'
|
jsr CSH.IsLetter
|
||||||
beq .5
|
bcs .5
|
||||||
|
|
||||||
|
* TODO: AddLocal
|
||||||
|
|
||||||
|
.3 jsr CSH.GetNextCharNB
|
||||||
|
bcs .9
|
||||||
|
|
||||||
|
jsr CSH.IsLetterOrDigit
|
||||||
|
bcc .3
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.5 cmp #')'
|
||||||
|
beq .6
|
||||||
|
|
||||||
cmp #','
|
cmp #','
|
||||||
bne .9
|
bne .9
|
||||||
|
@ -431,40 +637,74 @@ CSH.fDecl lda ZPCSHfDecl
|
||||||
|
|
||||||
bra .2
|
bra .2
|
||||||
|
|
||||||
.5 jsr CSH.GetNextCharNB Skip )
|
.6 jsr CSH.GetNextCharNB Skip )
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
cmp #';'
|
cmp #';'
|
||||||
bne .9
|
beq .7
|
||||||
|
|
||||||
jsr CSH.GetNextCharNB Skip ;
|
|
||||||
|
* TODO: f() body
|
||||||
|
|
||||||
|
bra .9
|
||||||
|
*--------------------------------------
|
||||||
|
.7 lda #0
|
||||||
|
* sta ZPVarDataPtr
|
||||||
|
* sta ZPVarDataPtr+1
|
||||||
|
|
||||||
.8 lda #0
|
.8 lda #0
|
||||||
sta (ZPCSHfDecl)
|
jsr CSH.fDeclAddA
|
||||||
|
|
||||||
jmp CSH.SetVarValueFromStack
|
clc
|
||||||
|
bra .99
|
||||||
|
|
||||||
.9 lda #E.CSYN
|
.9 lda #E.CSYN
|
||||||
sec
|
sec
|
||||||
.99 rts
|
|
||||||
*--------------------------------------
|
|
||||||
CSH.fDeclGetArg >ENTER 4
|
|
||||||
|
|
||||||
>LDYA L.CSH.TMODS
|
.99 >LEAVE
|
||||||
|
rts
|
||||||
|
*--------------------------------------
|
||||||
|
CSH.fDeclGetArg lda (ZPInputBufPtr)
|
||||||
|
cmp #'.'
|
||||||
|
bne .5
|
||||||
|
|
||||||
|
ldx #2
|
||||||
|
|
||||||
|
.1 jsr CSH.GetNextChar
|
||||||
|
bcs .9
|
||||||
|
|
||||||
|
cmp #'.'
|
||||||
|
bne .9
|
||||||
|
|
||||||
|
dex
|
||||||
|
bne .1
|
||||||
|
|
||||||
|
jsr CSH.GetNextCharNB
|
||||||
|
bcs .9
|
||||||
|
|
||||||
|
eor #')'
|
||||||
|
bne .9
|
||||||
|
|
||||||
|
ldy #CSH.T.VARIADIC Type
|
||||||
|
* lda #0 Qual
|
||||||
|
* clc
|
||||||
|
rts
|
||||||
|
|
||||||
|
.5 >LDYA L.CSH.TMODS
|
||||||
jsr CSH.LookupID
|
jsr CSH.LookupID
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
jsr CSH.tDecl
|
jsr CSH.tDecl
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
|
* Y,A = Type/Qual
|
||||||
|
|
||||||
bra .8
|
bra .8
|
||||||
|
|
||||||
.9 lda #E.CSYN
|
.9 lda #E.CSYN
|
||||||
sec
|
sec
|
||||||
|
|
||||||
.8 >LEAVE
|
.8 rts
|
||||||
rts
|
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CSH.fDeclAddA sta (ZPCSHfDecl)
|
CSH.fDeclAddA sta (ZPCSHfDecl)
|
||||||
inc ZPCSHfDecl
|
inc ZPCSHfDecl
|
||||||
|
@ -474,14 +714,28 @@ CSH.fDeclAddA sta (ZPCSHfDecl)
|
||||||
|
|
||||||
.8 rts
|
.8 rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CSH.tDecl jsr CSH.tDecl.JMP
|
CSH.tDecl >ENTER 2
|
||||||
bcs .9
|
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
|
||||||
|
|
||||||
.9 rts
|
clc
|
||||||
|
|
||||||
CSH.tDecl.JMP jmp (J.CSH.TMODS,x)
|
.99 >LEAVE
|
||||||
|
rts
|
||||||
|
|
||||||
|
.7 jmp (J.CSH.TMODS,x)
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CSH.NewKey >PUSHA
|
CSH.NewKey >PUSHA
|
||||||
>PUSHW ZPInputBufPtr
|
>PUSHW ZPInputBufPtr
|
||||||
|
@ -489,6 +743,8 @@ CSH.NewKey >PUSHA
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
pha
|
pha
|
||||||
|
phy
|
||||||
|
|
||||||
txa
|
txa
|
||||||
* clc
|
* clc
|
||||||
adc ZPInputBufPtr
|
adc ZPInputBufPtr
|
||||||
|
@ -498,13 +754,16 @@ CSH.NewKey >PUSHA
|
||||||
inc ZPInputBufPtr+1
|
inc ZPInputBufPtr+1
|
||||||
|
|
||||||
.1 clc
|
.1 clc
|
||||||
|
ply
|
||||||
pla
|
pla
|
||||||
.9 rts
|
.9 rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* X=Type
|
* Y,A = Type/Qual
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CSH.SetVarValueFromStack
|
CSH.SetVarValue cpy ZPVarType
|
||||||
cpx ZPVarType X = type
|
bne .99
|
||||||
|
|
||||||
|
cmp ZPVarQual
|
||||||
bne .99
|
bne .99
|
||||||
|
|
||||||
ldy #0
|
ldy #0
|
||||||
|
@ -565,9 +824,12 @@ CSH.Get >PUSHW ZPInputBufPtr
|
||||||
adc ZPInputBufPtr
|
adc ZPInputBufPtr
|
||||||
sta ZPInputBufPtr
|
sta ZPInputBufPtr
|
||||||
bcc .1
|
bcc .1
|
||||||
|
|
||||||
inc ZPInputBufPtr+1
|
inc ZPInputBufPtr+1
|
||||||
clc
|
clc
|
||||||
|
|
||||||
.1 pla Y,A = VarID
|
.1 pla Y,A = VarID
|
||||||
|
|
||||||
.9 rts
|
.9 rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CSH.GetVarDef phy
|
CSH.GetVarDef phy
|
||||||
|
@ -580,85 +842,18 @@ CSH.GetVarDef phy
|
||||||
>PUSHA KeyID
|
>PUSHA KeyID
|
||||||
|
|
||||||
>PUSHWI ZPVarDef
|
>PUSHWI ZPVarDef
|
||||||
>PUSHWI 6 6 bytes
|
>PUSHWI 8 8 bytes
|
||||||
>PUSHWI 0 From Start
|
>PUSHWI 0 From Start
|
||||||
>SYSCALL SListGetData
|
>SYSCALL SListGetData
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* Input :
|
* Input : Value on Stack, Y,A = Type/Qual
|
||||||
* X=Var Type (or 0)
|
|
||||||
* YA=VarID
|
|
||||||
* Output : Stack, X = Var Type
|
|
||||||
*--------------------------------------
|
|
||||||
CSH.GetVarValueOnStack
|
|
||||||
phx
|
|
||||||
phy
|
|
||||||
pha
|
|
||||||
>PUSHB.G CSH.hSymbols
|
|
||||||
|
|
||||||
pla
|
|
||||||
>PUSHA
|
|
||||||
pla
|
|
||||||
>PUSHA KeyID
|
|
||||||
|
|
||||||
>PUSHEA.G CSH.VarDef
|
|
||||||
>PUSHWI 6 6 bytes
|
|
||||||
>PUSHWI 0 From Start
|
|
||||||
>SYSCALL SListGetData
|
|
||||||
plx
|
|
||||||
|
|
||||||
bcs .9
|
|
||||||
|
|
||||||
txa
|
|
||||||
beq .1 any type
|
|
||||||
|
|
||||||
>CMP.G CSH.VarDef Type
|
|
||||||
beq .2
|
|
||||||
|
|
||||||
and #CSH.Q.PPPOINTER
|
|
||||||
beq .99 not pointer....mismatch
|
|
||||||
|
|
||||||
>EOR.G CSH.VarDef
|
|
||||||
and #CSH.Q.PPPOINTER
|
|
||||||
bne .99 compare only pointer depth
|
|
||||||
|
|
||||||
.1 >LDA.G CSH.VarDef
|
|
||||||
beq *
|
|
||||||
|
|
||||||
.2 tax
|
|
||||||
jsr CSH.GetVarSize
|
|
||||||
pha
|
|
||||||
|
|
||||||
>LDA.G CSH.VarDef+4
|
|
||||||
sta ZPPtr3
|
|
||||||
iny
|
|
||||||
lda (pData),y
|
|
||||||
sta ZPPtr3+1
|
|
||||||
|
|
||||||
ply
|
|
||||||
|
|
||||||
.3 dey
|
|
||||||
lda (ZPPtr3),y
|
|
||||||
>PUSHA
|
|
||||||
tya
|
|
||||||
bne .3
|
|
||||||
|
|
||||||
>LDA.G CSH.VarDef
|
|
||||||
tax
|
|
||||||
clc X = Var Type
|
|
||||||
.9 rts
|
|
||||||
|
|
||||||
.99 lda #E.TMISMATCH
|
|
||||||
sec
|
|
||||||
rts
|
|
||||||
*--------------------------------------
|
|
||||||
* Input : Value on Stack, X = Var Type
|
|
||||||
* Output : CC = true, CS = false
|
* Output : CC = true, CS = false
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CSH.IsValue0 cpx #CSH.T.FLOAT
|
CSH.IsValue0 cpy #CSH.T.FLOAT
|
||||||
bcc .1 char,int,long
|
bcc .1 char,int,long
|
||||||
|
|
||||||
ldy CSH.TYPESIZE,x
|
lda CSH.TYPESIZE-1,y
|
||||||
lda (ZPVarDataPtr),y
|
lda (ZPVarDataPtr),y
|
||||||
bne .9
|
bne .9
|
||||||
|
|
||||||
|
@ -763,10 +958,13 @@ CSH.SkipBlock ldy #0 not in "", TOTO:skip comments
|
||||||
|
|
||||||
.1 jsr CSH.GetNextCharNB
|
.1 jsr CSH.GetNextCharNB
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
cmp #'{'
|
cmp #'{'
|
||||||
bne .2
|
bne .2
|
||||||
|
|
||||||
tya
|
tya
|
||||||
bmi .1
|
bmi .1
|
||||||
|
|
||||||
inx
|
inx
|
||||||
bra .1
|
bra .1
|
||||||
|
|
||||||
|
@ -775,55 +973,66 @@ CSH.SkipBlock ldy #0 not in "", TOTO:skip comments
|
||||||
|
|
||||||
tya
|
tya
|
||||||
bmi .1
|
bmi .1
|
||||||
|
|
||||||
dex
|
dex
|
||||||
bne .1
|
bne .1
|
||||||
|
|
||||||
clc
|
clc
|
||||||
rts
|
rts
|
||||||
.3 cmp #'"'
|
.3 cmp #'"'
|
||||||
bne .1
|
bne .1
|
||||||
|
|
||||||
tya
|
tya
|
||||||
eor #$ff
|
eor #$ff
|
||||||
tay
|
tay
|
||||||
bra .1
|
bra .1
|
||||||
jmp CSH.GetNextCharNB skip '}'
|
|
||||||
.9 rts
|
.9 rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CSH.GetCharNB jsr CSH.GetChar
|
CSH.GetCharNB jsr CSH.GetChar
|
||||||
bcs CSH.GetNextCharNB.RTS
|
bcs CSH.GetNextCharNB.RTS
|
||||||
|
|
||||||
jsr CSH.CheckCharNB
|
jsr CSH.CheckCharNB
|
||||||
bcc CSH.GetNextCharNB.RTS
|
bcc CSH.GetNextCharNB.RTS
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CSH.GetNextCharNB
|
CSH.GetNextCharNB
|
||||||
jsr CSH.GetNextChar
|
jsr CSH.GetNextChar
|
||||||
bcs CSH.GetNextCharNB.RTS
|
bcs CSH.GetNextCharNB.RTS
|
||||||
|
|
||||||
jsr CSH.CheckCharNB
|
jsr CSH.CheckCharNB
|
||||||
bcs CSH.GetNextCharNB
|
bcs CSH.GetNextCharNB
|
||||||
|
|
||||||
CSH.GetNextCharNB.RTS
|
CSH.GetNextCharNB.RTS
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CSH.CheckSpace jsr CSH.GetChar
|
CSH.CheckSpace jsr CSH.GetChar
|
||||||
bcs .90
|
bcs .90
|
||||||
|
|
||||||
cmp #C.SPACE
|
cmp #C.SPACE
|
||||||
bne .90
|
bne .90
|
||||||
|
|
||||||
jsr CSH.GetNextCharNB
|
jsr CSH.GetNextCharNB
|
||||||
bcc CSH.GetNextCharNB.RTS
|
bcc .99
|
||||||
|
|
||||||
.90 lda #E.CSYN
|
.90 lda #E.CSYN
|
||||||
sec
|
sec
|
||||||
rts
|
.99 rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CSH.CheckCharNB cmp #C.SPACE
|
CSH.CheckCharNB cmp #C.SPACE
|
||||||
beq .9
|
beq .9
|
||||||
|
|
||||||
cmp #C.LF
|
cmp #C.LF
|
||||||
beq .9
|
beq .9
|
||||||
|
|
||||||
cmp #C.TAB
|
cmp #C.TAB
|
||||||
beq .9
|
beq .9
|
||||||
|
|
||||||
clc
|
clc
|
||||||
.9 rts
|
.9 rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CSH.GetNextChar inc ZPInputBufPtr
|
CSH.GetNextChar inc ZPInputBufPtr
|
||||||
bne CSH.GetChar
|
bne CSH.GetChar
|
||||||
|
|
||||||
inc ZPInputBufPtr+1
|
inc ZPInputBufPtr+1
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CSH.GetChar lda (ZPInputBufPtr)
|
CSH.GetChar lda (ZPInputBufPtr)
|
||||||
|
@ -911,29 +1120,26 @@ CSH.IsLetterRTS rts
|
||||||
*---------------------------------------
|
*---------------------------------------
|
||||||
CSH.IsDigit10 cmp #'0'
|
CSH.IsDigit10 cmp #'0'
|
||||||
bcc .9
|
bcc .9
|
||||||
|
|
||||||
cmp #'9'+1
|
cmp #'9'+1
|
||||||
rts cc if ok, cs if not
|
rts cc if ok, cs if not
|
||||||
|
|
||||||
.9 sec
|
.9 sec
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* in : X = type, out : X = type, A = size
|
* in : Y,A = type/qual
|
||||||
|
* out : A = size
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CSH.GetVarSize txa
|
CSH.GetVarSize and #CSH.Q.PPPOINTER
|
||||||
and #CSH.Q.PPPOINTER
|
|
||||||
bne .2
|
bne .2
|
||||||
|
|
||||||
txa
|
lda CSH.TYPESIZE-1,y
|
||||||
and #$f
|
|
||||||
phx
|
|
||||||
tax
|
|
||||||
lda CSH.TYPESIZE,x
|
|
||||||
plx
|
|
||||||
|
|
||||||
clc
|
clc
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.2 sec +1 for hMem Storage
|
.2 lda #2 pointer
|
||||||
lda #2
|
sec +1 for hMem Storage
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
MAN
|
MAN
|
||||||
|
|
|
@ -2,7 +2,7 @@ NEW
|
||||||
AUTO 3,1
|
AUTO 3,1
|
||||||
.LIST OFF
|
.LIST OFF
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* Y = Type, A = OP
|
* Y,A = Type/Qual, X = OP
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CSH.BOP.EXEC cpy #CSH.T.UINT
|
CSH.BOP.EXEC cpy #CSH.T.UINT
|
||||||
bcs .3
|
bcs .3
|
||||||
|
@ -17,13 +17,12 @@ CSH.BOP.EXEC cpy #CSH.T.UINT
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.1 tax
|
.1 jmp (J.CSH.bBOPS,x)
|
||||||
jmp (J.CSH.bBOPS,x)
|
|
||||||
|
|
||||||
.2 tax
|
.2 jmp (J.CSH.cBOPS,x)
|
||||||
jmp (J.CSH.cBOPS,x)
|
|
||||||
|
|
||||||
.3 clc
|
.3 txa
|
||||||
|
clc
|
||||||
adc CSH.Type2FPU-CSH.T.UINT,y
|
adc CSH.Type2FPU-CSH.T.UINT,y
|
||||||
tax
|
tax
|
||||||
jsr A2osX.FPUCALL
|
jsr A2osX.FPUCALL
|
||||||
|
@ -114,6 +113,8 @@ CSH.BOPS.LOR
|
||||||
clc
|
clc
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
CSH.Exec jmp (J.CSH.EXEC,x)
|
||||||
|
**--------------------------------------
|
||||||
EXEC.pwr >FPU PWR
|
EXEC.pwr >FPU PWR
|
||||||
clc
|
clc
|
||||||
rts
|
rts
|
||||||
|
@ -190,7 +191,8 @@ EXEC.malloc >PULLYA
|
||||||
EXEC.fopen >SYSCALL FOpen
|
EXEC.fopen >SYSCALL FOpen
|
||||||
>PUSHYA
|
>PUSHYA
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
EXEC.fclose >SYSCALL FClose
|
EXEC.fclose >PULLA
|
||||||
|
>SYSCALL FClose
|
||||||
>PUSHYA
|
>PUSHYA
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
EXEC.fread >SYSCALL FRead
|
EXEC.fread >SYSCALL FRead
|
||||||
|
|
|
@ -3,23 +3,27 @@ NEW
|
||||||
.LIST OFF
|
.LIST OFF
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* Input:
|
* Input:
|
||||||
* ZPInputBufPtr, A = Expected type
|
* ZPInputBufPtr, Y,A = Expected type/qual
|
||||||
* Output:
|
* Output:
|
||||||
* CS, A = EC
|
* CS, A = EC
|
||||||
* CC, X = Var Type, Value on Stack
|
* CC, Y,A = type/qual, Value on Stack
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CSH.ExpEval ldx ZPPtr1
|
CSH.ExpEval ldx ZPPtr1
|
||||||
phx
|
phx
|
||||||
ldx ZPPtr1+1 local : used by lookup
|
ldx ZPPtr1+1 local : used by lookup
|
||||||
phx
|
phx
|
||||||
|
|
||||||
ldx ZPPtr2 local : VarType
|
ldx ZPPtr2 local : VarType
|
||||||
phx
|
phx
|
||||||
ldx ZPPtr2+1 local : BOP
|
ldx ZPPtr2+1 local : VarQual
|
||||||
phx
|
phx
|
||||||
|
|
||||||
sta ZPPtr2 local : expected type
|
ldx ZPPtr3 local : BOP
|
||||||
|
phx
|
||||||
|
|
||||||
lda #$ff
|
>STYA ZPPtr2 local : expected type/qual
|
||||||
|
|
||||||
|
lda #$ff no previous OP
|
||||||
pha
|
pha
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
.10 jsr CSH.GetCharNB
|
.10 jsr CSH.GetCharNB
|
||||||
|
@ -31,12 +35,11 @@ CSH.ExpEval ldx ZPPtr1
|
||||||
jsr CSH.GetNextCharNB skip (
|
jsr CSH.GetNextCharNB skip (
|
||||||
bcs .19
|
bcs .19
|
||||||
|
|
||||||
lda ZPPtr2
|
>LDYA ZPPtr2
|
||||||
|
|
||||||
jsr CSH.ExpEval
|
jsr CSH.ExpEval
|
||||||
bcs .19
|
bcs .19
|
||||||
|
|
||||||
stx ZPPtr2
|
>STYA ZPPtr2 update type/qual
|
||||||
|
|
||||||
jsr CSH.GetCharNB
|
jsr CSH.GetCharNB
|
||||||
bcs .19
|
bcs .19
|
||||||
|
@ -55,32 +58,30 @@ CSH.ExpEval ldx ZPPtr1
|
||||||
jsr CSH.GetDefine
|
jsr CSH.GetDefine
|
||||||
bcc .10
|
bcc .10
|
||||||
|
|
||||||
jsr CSH.GetVar
|
jsr CSH.VarLookup
|
||||||
bcs .21
|
bcs .21
|
||||||
|
|
||||||
ldx ZPPtr2 YA=VarID, X=expected var type (or 0=any)
|
jsr CSH.GetValue Check type & Get value on stack
|
||||||
|
|
||||||
jsr CSH.GetVarValueOnStack Y,A = VarID, Get value on stack
|
|
||||||
bcs .29
|
bcs .29
|
||||||
|
|
||||||
stx ZPPtr2 store real var type
|
|
||||||
bra .30
|
bra .30
|
||||||
|
|
||||||
.21 lda ZPPtr2 var type
|
.21 >LDYA ZPPtr2 var type/qual
|
||||||
jsr CSH.fCall X = function index
|
jsr CSH.fCall X = function index
|
||||||
bcs .29
|
bcs .29
|
||||||
|
|
||||||
stx ZPPtr2 store real var type
|
>STYA ZPPtr2 store real var type
|
||||||
bra .30
|
bra .30
|
||||||
|
*--------------------------------------
|
||||||
.22 jsr CSH.IsDigit10 number ?
|
.22 jsr CSH.IsDigit10 number ?
|
||||||
bcs .24
|
bcs .24
|
||||||
|
|
||||||
ldx ZPPtr2
|
ldy ZPPtr2
|
||||||
bne .23
|
bne .23
|
||||||
|
|
||||||
ldx #CSH.T.SINT
|
ldy #CSH.T.SINT
|
||||||
stx ZPPtr2
|
sty ZPPtr2
|
||||||
|
stz ZPPtr2+1
|
||||||
|
|
||||||
.23 jsr CSH.GetNumOnStack
|
.23 jsr CSH.GetNumOnStack
|
||||||
bcs .29
|
bcs .29
|
||||||
|
@ -112,31 +113,31 @@ CSH.ExpEval ldx ZPPtr1
|
||||||
jsr CSH.LookupOP
|
jsr CSH.LookupOP
|
||||||
bcs .90
|
bcs .90
|
||||||
|
|
||||||
stx ZPPtr2+1 save OP(n)
|
stx ZPPtr3 save OP(n)
|
||||||
|
|
||||||
.32 pla get OP(n-1)
|
.32 plx get OP(n-1)
|
||||||
bmi .33 $ff....
|
bmi .33 $ff....
|
||||||
|
|
||||||
cmp ZPPtr2+1
|
cpx ZPPtr3
|
||||||
bcc .33 OP(n) has precedence, on stack : V1,V2
|
bcc .33 OP(n) has precedence, on stack : V1,V2
|
||||||
|
|
||||||
ldy ZPPtr2 OP(n-1) has precedence...
|
>LDYA ZPPtr2 OP(n-1) has precedence...
|
||||||
|
|
||||||
jsr CSH.BOP.EXEC compute V(n-1) <OP(n-1)> V(n)
|
jsr CSH.BOP.EXEC compute V(n-1) <OP(n-1)> V(n)
|
||||||
bcc .32
|
bcc .32
|
||||||
|
|
||||||
bcs .99
|
bcs .99
|
||||||
|
|
||||||
.33 pha push back OP(n-1)
|
.33 phx push back OP(n-1)
|
||||||
lda ZPPtr2+1 get OP(n)
|
|
||||||
|
lda ZPPtr3 get OP(n)
|
||||||
pha push OP(n) on stack
|
pha push OP(n) on stack
|
||||||
|
|
||||||
jmp .10 go check for next token
|
jmp .10 go check for next token
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
.80 pla any OP on stack ?
|
.80 plx any OP on stack ?
|
||||||
bmi .88
|
bmi .88
|
||||||
|
|
||||||
ldy ZPPtr2 Var Type
|
>LDYA ZPPtr2 Var Type
|
||||||
jsr CSH.BOP.EXEC
|
jsr CSH.BOP.EXEC
|
||||||
bcc .80
|
bcc .80
|
||||||
|
|
||||||
|
@ -148,19 +149,23 @@ CSH.ExpEval ldx ZPPtr1
|
||||||
bpl .99
|
bpl .99
|
||||||
|
|
||||||
sec
|
sec
|
||||||
.HS 90 BCC
|
bra .89
|
||||||
|
|
||||||
.88 clc
|
.88 clc
|
||||||
|
|
||||||
ldx ZPPtr2 X = Var Type
|
>LDYA ZPPtr2 Type/Qual
|
||||||
|
|
||||||
|
.89 plx
|
||||||
|
stx ZPPtr3
|
||||||
|
plx
|
||||||
|
stx ZPPtr2+1
|
||||||
|
plx
|
||||||
|
stx ZPPtr2
|
||||||
|
plx
|
||||||
|
stx ZPPtr1+1
|
||||||
|
plx
|
||||||
|
stx ZPPtr1
|
||||||
|
|
||||||
ply
|
|
||||||
sty ZPPtr2+1
|
|
||||||
ply
|
|
||||||
sty ZPPtr2
|
|
||||||
ply
|
|
||||||
sty ZPPtr1+1
|
|
||||||
ply
|
|
||||||
sty ZPPtr1
|
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CSH.AddContCharP
|
CSH.AddContCharP
|
||||||
|
@ -188,6 +193,7 @@ CSH.AddContCharP
|
||||||
adc ZPCSHConst
|
adc ZPCSHConst
|
||||||
sta ZPCSHConst
|
sta ZPCSHConst
|
||||||
bcc .3
|
bcc .3
|
||||||
|
|
||||||
inc ZPCSHConst+1
|
inc ZPCSHConst+1
|
||||||
.3 jsr CSH.GetNextChar Skip "
|
.3 jsr CSH.GetNextChar Skip "
|
||||||
|
|
||||||
|
@ -199,11 +205,9 @@ CSH.AddContCharP
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CSH.GetNumOnStack
|
CSH.GetNumOnStack
|
||||||
txa
|
cpy #CSH.T.FLOAT
|
||||||
beq .99
|
|
||||||
|
|
||||||
cpx #CSH.T.FLOAT
|
|
||||||
bcc .1
|
bcc .1
|
||||||
|
|
||||||
bne .99
|
bne .99
|
||||||
|
|
||||||
>PUSHW ZPInputBufPtr
|
>PUSHW ZPInputBufPtr
|
||||||
|
@ -215,8 +219,6 @@ CSH.GetNumOnStack
|
||||||
.1 >PUSHW ZPInputBufPtr
|
.1 >PUSHW ZPInputBufPtr
|
||||||
>PUSHWI ZPInputBufPtr
|
>PUSHWI ZPInputBufPtr
|
||||||
>PUSHBI 10
|
>PUSHBI 10
|
||||||
phx
|
|
||||||
|
|
||||||
bcc .2
|
bcc .2
|
||||||
|
|
||||||
>SYSCALL StrToUL
|
>SYSCALL StrToUL
|
||||||
|
@ -224,10 +226,10 @@ CSH.GetNumOnStack
|
||||||
|
|
||||||
.2 >SYSCALL StrToL
|
.2 >SYSCALL StrToL
|
||||||
|
|
||||||
.3 plx
|
.3 bcs .9
|
||||||
bcs .9
|
|
||||||
|
|
||||||
lda CSH.TYPESIZE,x
|
ldy ZPPtr2
|
||||||
|
lda CSH.TYPESIZE-1,y
|
||||||
cmp #4
|
cmp #4
|
||||||
beq .8
|
beq .8
|
||||||
|
|
||||||
|
@ -254,6 +256,233 @@ CSH.GetNumOnStack
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
CSH.VarLookup >PUSHB.G CSH.hSymbols
|
||||||
|
|
||||||
|
>PUSHW ZPInputBufPtr
|
||||||
|
>SYSCALL SListLookup
|
||||||
|
bcs .9
|
||||||
|
|
||||||
|
phy
|
||||||
|
pha
|
||||||
|
|
||||||
|
txa
|
||||||
|
* clc
|
||||||
|
adc ZPInputBufPtr
|
||||||
|
sta ZPInputBufPtr
|
||||||
|
bcc .1
|
||||||
|
|
||||||
|
inc ZPInputBufPtr+1
|
||||||
|
clc
|
||||||
|
|
||||||
|
.1 >PUSHB.G CSH.hSymbols
|
||||||
|
|
||||||
|
pla
|
||||||
|
>PUSHA
|
||||||
|
pla
|
||||||
|
>PUSHA KeyID
|
||||||
|
|
||||||
|
>PUSHEA.G CSH.VarDef
|
||||||
|
>PUSHWI 8 8 bytes
|
||||||
|
>PUSHWI 0 From Start
|
||||||
|
>SYSCALL SListGetData
|
||||||
|
.9 rts
|
||||||
|
*--------------------------------------
|
||||||
|
CSH.GetValue lda ZPPtr2 target type
|
||||||
|
beq .1
|
||||||
|
|
||||||
|
>LDA.G CSH.VarDef Type
|
||||||
|
cmp #CSH.T.VOID
|
||||||
|
beq .11
|
||||||
|
|
||||||
|
cmp ZPPtr2
|
||||||
|
bne .9
|
||||||
|
|
||||||
|
.11 lda ZPPtr2+1 qual
|
||||||
|
>CMP.G CSH.VarDef+1
|
||||||
|
beq .2
|
||||||
|
|
||||||
|
.9 lda #E.TMISMATCH
|
||||||
|
sec
|
||||||
|
rts
|
||||||
|
|
||||||
|
.1 >LDA.G CSH.VarDef Type
|
||||||
|
sta ZPPtr2
|
||||||
|
iny
|
||||||
|
lda (pData),y
|
||||||
|
sta ZPPtr2+1
|
||||||
|
|
||||||
|
.2 lda ZPPtr3
|
||||||
|
pha
|
||||||
|
lda ZPPtr3+1
|
||||||
|
pha
|
||||||
|
|
||||||
|
>LDA.G CSH.VarDef+4
|
||||||
|
sta ZPPtr3
|
||||||
|
iny
|
||||||
|
lda (pData),y
|
||||||
|
sta ZPPtr3+1
|
||||||
|
|
||||||
|
ldx ZPPtr2
|
||||||
|
ldy CSH.TYPESIZE-1,x
|
||||||
|
|
||||||
|
.3 dey
|
||||||
|
lda (ZPPtr3),y
|
||||||
|
>PUSHA
|
||||||
|
tya
|
||||||
|
bne .3
|
||||||
|
|
||||||
|
pla
|
||||||
|
sta ZPPtr3+1
|
||||||
|
pla
|
||||||
|
sta ZPPtr3
|
||||||
|
|
||||||
|
clc
|
||||||
|
rts
|
||||||
|
*--------------------------------------
|
||||||
|
* Input:
|
||||||
|
* ZPInputBufPtr, Y,A = Expected type/qual
|
||||||
|
* Output:
|
||||||
|
* CS, A = EC
|
||||||
|
* CC, Y,A = type/qual, Result on Stack
|
||||||
|
*--------------------------------------
|
||||||
|
CSH.fCall ldx ZPPtr1
|
||||||
|
phx
|
||||||
|
ldx ZPPtr1+1 local : fdef Ptr
|
||||||
|
phx
|
||||||
|
ldx ZPPtr2 local : type
|
||||||
|
phx
|
||||||
|
ldx ZPPtr2+1 local : qual
|
||||||
|
phx
|
||||||
|
ldx ZPPtr3 local : variadic size
|
||||||
|
phx
|
||||||
|
ldx ZPPtr3+1 local : f
|
||||||
|
phx
|
||||||
|
|
||||||
|
>STYA ZPPtr2 save Type/qual
|
||||||
|
|
||||||
|
stz ZPPtr3 Reset VARIADIC byte count
|
||||||
|
|
||||||
|
>LDYA L.CSH.FN
|
||||||
|
jsr CSH.LookupFN
|
||||||
|
bcs .10
|
||||||
|
|
||||||
|
stx ZPPtr3+1 X = function index
|
||||||
|
|
||||||
|
>STYA ZPPtr1 f() definition, starting at returned type
|
||||||
|
|
||||||
|
jsr CSH.GetCharNB
|
||||||
|
bcs .10
|
||||||
|
|
||||||
|
cmp #'('
|
||||||
|
bne .52
|
||||||
|
|
||||||
|
jsr CSH.GetNextCharNB skip '('
|
||||||
|
|
||||||
|
bcs .10
|
||||||
|
|
||||||
|
jsr CSH.ZPPtr1GetW Y,A = Return value Type/Qual
|
||||||
|
|
||||||
|
ldx ZPPtr2
|
||||||
|
beq .1 no check required
|
||||||
|
|
||||||
|
cpy ZPPtr2
|
||||||
|
bne .91
|
||||||
|
|
||||||
|
cmp ZPPtr2+1
|
||||||
|
bne .91
|
||||||
|
|
||||||
|
.1 >STYA ZPPtr2 this will be the returned type/qual
|
||||||
|
|
||||||
|
jsr CSH.ZPPtr1GetNextW advance to arg list type
|
||||||
|
beq .7 end of list, go check ending ')'
|
||||||
|
*--------------------------------------
|
||||||
|
.3 cpy #CSH.T.VARIADIC if VARIADIC, don't advance to next arg and assume type = 0
|
||||||
|
bne .4
|
||||||
|
|
||||||
|
ldy #0
|
||||||
|
lda #0
|
||||||
|
|
||||||
|
.4 jsr CSH.ExpEval Y,A = 0 if VARIADIC
|
||||||
|
bcs .93
|
||||||
|
|
||||||
|
jsr CSH.GetVarSize Y,A = Var Type/Qual
|
||||||
|
|
||||||
|
tax
|
||||||
|
lda (ZPPtr1)
|
||||||
|
eor #CSH.T.VARIADIC
|
||||||
|
bne .5
|
||||||
|
|
||||||
|
txa
|
||||||
|
clc make sure pointer only 2 bytes
|
||||||
|
adc ZPPtr3
|
||||||
|
sta ZPPtr3 Add to byte count
|
||||||
|
bra .51 stay on VARIADIC tag
|
||||||
|
|
||||||
|
.5 jsr CSH.ZPPtr1NextW
|
||||||
|
|
||||||
|
.51 jsr CSH.GetCharNB
|
||||||
|
.10 bcs .90
|
||||||
|
|
||||||
|
cmp #','
|
||||||
|
bne .6
|
||||||
|
|
||||||
|
jsr CSH.GetNextCharNB Skip ,
|
||||||
|
jsr CSH.ZPPtr1GetW
|
||||||
|
bne .3 Another ARG....
|
||||||
|
|
||||||
|
.52 bra .90 extra args....error
|
||||||
|
|
||||||
|
.6 cmp #')'
|
||||||
|
bne .90
|
||||||
|
|
||||||
|
jsr CSH.ZPPtr1GetW
|
||||||
|
beq .8 no more arg after ')', exit
|
||||||
|
|
||||||
|
cpy #CSH.T.VARIADIC
|
||||||
|
bne .90 missing arg
|
||||||
|
|
||||||
|
>PUSHB ZPPtr3 push VARIADIC byte count
|
||||||
|
bra .8
|
||||||
|
|
||||||
|
.7 jsr CSH.GetCharNB
|
||||||
|
bcs .90
|
||||||
|
|
||||||
|
cmp #')'
|
||||||
|
bne .90
|
||||||
|
|
||||||
|
.8 jsr CSH.GetNextCharNB Skip )
|
||||||
|
|
||||||
|
ldx ZPPtr3+1
|
||||||
|
jsr CSH.Exec
|
||||||
|
bcs .93
|
||||||
|
|
||||||
|
>LDYA ZPPtr2 type/qual
|
||||||
|
bra .93
|
||||||
|
|
||||||
|
.90 lda #E.CSYN
|
||||||
|
bra .92
|
||||||
|
|
||||||
|
.91 lda #E.TMISMATCH
|
||||||
|
|
||||||
|
.92 sec
|
||||||
|
|
||||||
|
.93 plx
|
||||||
|
stx ZPPtr3+1
|
||||||
|
plx
|
||||||
|
stx ZPPtr3
|
||||||
|
|
||||||
|
plx
|
||||||
|
stx ZPPtr2+1
|
||||||
|
plx
|
||||||
|
stx ZPPtr2
|
||||||
|
|
||||||
|
plx
|
||||||
|
stx ZPPtr1+1
|
||||||
|
plx
|
||||||
|
stx ZPPtr1
|
||||||
|
|
||||||
|
.99 rts
|
||||||
|
*--------------------------------------
|
||||||
MAN
|
MAN
|
||||||
SAVE usr/src/bin/csh.s.exp
|
SAVE usr/src/bin/csh.s.exp
|
||||||
LOAD usr/src/bin/csh.s
|
LOAD usr/src/bin/csh.s
|
||||||
|
|
238
BIN/CSH.S.KW.txt
238
BIN/CSH.S.KW.txt
|
@ -18,10 +18,13 @@ CSH.IF jsr CSH.GetCharNB
|
||||||
jsr CSH.GetNextCharNB
|
jsr CSH.GetNextCharNB
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
lda #0 Any var type
|
ldy #0 Any var type
|
||||||
|
lda #0
|
||||||
jsr CSH.ExpEval
|
jsr CSH.ExpEval
|
||||||
bcs .99
|
bcs .99
|
||||||
|
|
||||||
|
jsr CSH.IsValue0 result in X
|
||||||
|
|
||||||
jsr CSH.GetCharNB
|
jsr CSH.GetCharNB
|
||||||
bcs .99
|
bcs .99
|
||||||
|
|
||||||
|
@ -29,16 +32,16 @@ CSH.IF jsr CSH.GetCharNB
|
||||||
bne .9
|
bne .9
|
||||||
|
|
||||||
jsr CSH.GetNextCharNB skip ')'
|
jsr CSH.GetNextCharNB skip ')'
|
||||||
bcs .99
|
bcs .9
|
||||||
|
|
||||||
cmp #'{'
|
cmp #'{'
|
||||||
bne .9
|
bne .9
|
||||||
|
|
||||||
jsr CSH.GetNextCharNB Skip '{'
|
jsr CSH.GetNextCharNB Skip '{'
|
||||||
bcs .99
|
bcs .9
|
||||||
|
|
||||||
jsr CSH.IsValue0 X = var type from ExpEval
|
txa
|
||||||
bcc .6 Value=0, skip {{....}}
|
beq .6 Value=0, skip {{....}}
|
||||||
|
|
||||||
>LDA.G CSH.CmdSave
|
>LDA.G CSH.CmdSave
|
||||||
beq .1 IF
|
beq .1 IF
|
||||||
|
@ -54,15 +57,16 @@ CSH.IF jsr CSH.GetCharNB
|
||||||
|
|
||||||
lda #'}' Tell '}' is expected at the end of block
|
lda #'}' Tell '}' is expected at the end of block
|
||||||
jsr CSH.Push
|
jsr CSH.Push
|
||||||
bcs .99
|
|
||||||
|
|
||||||
rts
|
.99 rts
|
||||||
|
|
||||||
.6 jsr CSH.SkipBlock
|
.6 jsr CSH.SkipBlock
|
||||||
|
|
||||||
bcc .99
|
bcc .99
|
||||||
|
|
||||||
.9 lda #E.CSYN
|
.9 lda #E.CSYN
|
||||||
sec
|
sec
|
||||||
.99 rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CSH.IF.END clc
|
CSH.IF.END clc
|
||||||
rts
|
rts
|
||||||
|
@ -97,16 +101,20 @@ CSH.STRUCT >ENTER 4
|
||||||
jsr CSH.NewKey
|
jsr CSH.NewKey
|
||||||
bcs .99
|
bcs .99
|
||||||
|
|
||||||
sta (pStack)
|
sta (pStack) Y,A = KeyID
|
||||||
|
tya
|
||||||
|
ldy #1
|
||||||
|
sta (pStack),y
|
||||||
|
|
||||||
jsr CSH.GetNextCharNB
|
jsr CSH.GetNextCharNB
|
||||||
bcs .99
|
bcs .99
|
||||||
|
|
||||||
cmp #'{'
|
cmp #'{'
|
||||||
bne .99
|
bne .99
|
||||||
|
|
||||||
.1 jsr CSH.GetNextCharNB
|
.1 jsr CSH.GetNextCharNB
|
||||||
bcs .99
|
bcs .99
|
||||||
|
|
||||||
cmp #'}'
|
cmp #'}'
|
||||||
bne .1
|
bne .1
|
||||||
|
|
||||||
|
@ -116,14 +124,22 @@ CSH.STRUCT >ENTER 4
|
||||||
.99 >LEAVE
|
.99 >LEAVE
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CSH.CONST lda #CSH.Q.CONST
|
* Type Declaration keywords
|
||||||
|
*--------------------------------------
|
||||||
|
CSH.CONST ldy #1
|
||||||
|
|
||||||
|
lda (pStack),y
|
||||||
|
ora #CSH.Q.CONST
|
||||||
|
sta (pStack),y
|
||||||
|
|
||||||
|
jsr CSH.CheckSpace
|
||||||
|
bcs .9
|
||||||
|
|
||||||
tsb ZPVarQual
|
|
||||||
>LDYA L.CSH.TMODS2
|
>LDYA L.CSH.TMODS2
|
||||||
jsr CSH.LookupID
|
jsr CSH.LookupID
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
jmp (J.CSH.TMODS2-2,x)
|
jmp (J.CSH.TMODS2,x)
|
||||||
|
|
||||||
.9 lda #E.CSYN
|
.9 lda #E.CSYN
|
||||||
sec
|
sec
|
||||||
|
@ -143,10 +159,10 @@ CSH.UNSIGNED clc
|
||||||
|
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
cpx #2
|
cpx #CSH.T.UCHAR
|
||||||
bcc .9
|
bcc .9 void
|
||||||
|
|
||||||
cpx #8 only char int long allowed
|
cpx #CSH.T.SLONG+1 only char int long allowed
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
plp
|
plp
|
||||||
|
@ -177,44 +193,55 @@ CSH.SHORT jsr CSH.CheckSpace
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CSH.VOID ldx #CSH.T.VOID
|
CSH.VOID lda #CSH.T.VOID
|
||||||
bra CSH.TYPE
|
bra CSH.TYPE
|
||||||
|
|
||||||
CSH.SCHAR ldx #CSH.T.SCHAR
|
|
||||||
bra CSH.TYPE
|
|
||||||
CSH.CHAR
|
CSH.CHAR
|
||||||
CSH.UCHAR ldx #CSH.T.UCHAR
|
CSH.UCHAR lda #CSH.T.UCHAR
|
||||||
bra CSH.TYPE
|
bra CSH.TYPE
|
||||||
|
|
||||||
|
CSH.SCHAR lda #CSH.T.SCHAR
|
||||||
|
bra CSH.TYPE
|
||||||
|
|
||||||
|
CSH.UINT lda #CSH.T.UINT
|
||||||
|
bra CSH.TYPE
|
||||||
|
|
||||||
CSH.INT
|
CSH.INT
|
||||||
CSH.SINT ldx #CSH.T.SINT
|
CSH.SINT lda #CSH.T.SINT
|
||||||
bra CSH.TYPE
|
bra CSH.TYPE
|
||||||
|
|
||||||
CSH.UINT ldx #CSH.T.UINT
|
CSH.ULONG lda #CSH.T.ULONG
|
||||||
bra CSH.TYPE
|
bra CSH.TYPE
|
||||||
|
|
||||||
CSH.LONG
|
CSH.LONG
|
||||||
CSH.SLONG ldx #CSH.T.SLONG
|
CSH.SLONG lda #CSH.T.SLONG
|
||||||
bra CSH.TYPE
|
bra CSH.TYPE
|
||||||
|
|
||||||
CSH.ULONG ldx #CSH.T.ULONG
|
CSH.FLOAT lda #CSH.T.FLOAT
|
||||||
bra CSH.TYPE
|
|
||||||
|
|
||||||
CSH.FLOAT ldx #CSH.T.FLOAT
|
CSH.TYPE sta (pStack)
|
||||||
|
|
||||||
CSH.TYPE stx ZPVarType
|
jsr CSH.GetCharNB
|
||||||
|
|
||||||
.11 jsr CSH.GetNextCharNB
|
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
cmp #'*'
|
ldy #1
|
||||||
|
|
||||||
|
.1 cmp #'*'
|
||||||
bne .10
|
bne .10
|
||||||
|
|
||||||
lda ZPVarType
|
lda (pStack),y
|
||||||
clc
|
clc
|
||||||
adc #CSH.Q.POINTER
|
adc #CSH.Q.POINTER
|
||||||
sta ZPVarType
|
bcs .9 more than ***
|
||||||
bcc .11
|
|
||||||
|
|
||||||
bra .9 more than ***
|
sta (pStack),y
|
||||||
|
|
||||||
|
jsr CSH.GetNextCharNB
|
||||||
|
bcc .1
|
||||||
|
|
||||||
|
.9 lda #E.CSYN
|
||||||
|
sec
|
||||||
|
.99 rts
|
||||||
|
|
||||||
.10 jsr CSH.IsLetter
|
.10 jsr CSH.IsLetter
|
||||||
bcs .8
|
bcs .8
|
||||||
|
@ -226,151 +253,16 @@ CSH.TYPE stx ZPVarType
|
||||||
sec
|
sec
|
||||||
ror bFastCall
|
ror bFastCall
|
||||||
|
|
||||||
lda #CSH.Q.FUNC
|
ldy #1
|
||||||
tsb ZPVarQual
|
lda (pStack),y
|
||||||
|
ora #CSH.Q.FUNC
|
||||||
|
sta (pStack),y
|
||||||
|
|
||||||
jsr CSH.GetNextCharNB
|
jsr CSH.GetNextCharNB
|
||||||
bcs .9 next char is an identifier, ",", "(",")"
|
bcs .9 next char is an identifier, ",", "(",")"
|
||||||
|
|
||||||
.8 clc
|
.8 clc
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.9 lda #E.CSYN
|
|
||||||
sec
|
|
||||||
.99 rts
|
|
||||||
*--------------------------------------
|
|
||||||
* Input:
|
|
||||||
* ZPInputBufPtr, A = Expected type
|
|
||||||
* Output:
|
|
||||||
* CS, A = EC
|
|
||||||
* CC, Result on Stack, X = Type
|
|
||||||
*--------------------------------------
|
|
||||||
CSH.fCall ldx ZPPtr1
|
|
||||||
phx
|
|
||||||
ldx ZPPtr1+1 local : fdef
|
|
||||||
phx
|
|
||||||
ldx ZPPtr2 local : type
|
|
||||||
phx
|
|
||||||
ldx ZPPtr2+1 local : variadic size
|
|
||||||
phx
|
|
||||||
|
|
||||||
sta ZPPtr2 save Type
|
|
||||||
stz ZPPtr2+1 Reset VARIADIC byte count
|
|
||||||
>LDYA L.CSH.FN
|
|
||||||
jsr CSH.LookupFN
|
|
||||||
phx X = function index
|
|
||||||
bcs .10
|
|
||||||
|
|
||||||
>STYA ZPPtr1 f() definition, starting at returned type
|
|
||||||
|
|
||||||
jsr CSH.GetCharNB
|
|
||||||
bcs .10
|
|
||||||
|
|
||||||
cmp #'('
|
|
||||||
bne .52
|
|
||||||
|
|
||||||
jsr CSH.GetNextCharNB skip '('
|
|
||||||
.10 bcs .90
|
|
||||||
|
|
||||||
lda ZPPtr2
|
|
||||||
bne .11
|
|
||||||
|
|
||||||
lda (ZPPtr1)
|
|
||||||
sta ZPPtr2
|
|
||||||
bra .1 expected type is 0, no check
|
|
||||||
|
|
||||||
.11 cmp (ZPPtr1) Get Return value Type
|
|
||||||
bne .91
|
|
||||||
|
|
||||||
.1 jsr CSH.ZPPtr1Next advance to arg list type
|
|
||||||
|
|
||||||
lda (ZPPtr1) get type of first arg
|
|
||||||
beq .7 end of list, go check ending ')'
|
|
||||||
*--------------------------------------
|
|
||||||
.3 eor #CSH.T.VARIADIC if VARIADIC, don't advance to next arg and assume type = 0
|
|
||||||
beq .4
|
|
||||||
|
|
||||||
eor #CSH.T.VARIADIC restore type...
|
|
||||||
|
|
||||||
.4 jsr CSH.ExpEval A=0 if VARIADIC
|
|
||||||
bcs .9 X = Var Type
|
|
||||||
|
|
||||||
lda (ZPPtr1) get current arg type
|
|
||||||
eor #CSH.T.VARIADIC
|
|
||||||
bne .5
|
|
||||||
|
|
||||||
jsr CSH.GetVarSize X = Var Type
|
|
||||||
|
|
||||||
clc make sure pointer only 2 bytes
|
|
||||||
adc ZPPtr2+1
|
|
||||||
sta ZPPtr2+1 Add to byte count
|
|
||||||
bra .51
|
|
||||||
|
|
||||||
.5 jsr CSH.ZPPtr1Next
|
|
||||||
|
|
||||||
.51 jsr CSH.GetCharNB
|
|
||||||
bcs .90
|
|
||||||
|
|
||||||
cmp #','
|
|
||||||
bne .6
|
|
||||||
|
|
||||||
jsr CSH.GetNextCharNB Skip ,
|
|
||||||
lda (ZPPtr1)
|
|
||||||
bne .3 Another ARG....
|
|
||||||
|
|
||||||
.52 bra .90 extra args....error
|
|
||||||
|
|
||||||
.6 cmp #')'
|
|
||||||
bne .90
|
|
||||||
lda (ZPPtr1)
|
|
||||||
beq .8 no more arg after ')', exit
|
|
||||||
|
|
||||||
eor #CSH.T.VARIADIC
|
|
||||||
bne .90 missing arg
|
|
||||||
|
|
||||||
>PUSHB ZPPtr2+1 push VARIADIC byte count
|
|
||||||
bra .8
|
|
||||||
.7 jsr CSH.GetCharNB
|
|
||||||
bcs .90
|
|
||||||
cmp #')'
|
|
||||||
bne .90
|
|
||||||
|
|
||||||
.8 jsr CSH.GetNextCharNB Skip )
|
|
||||||
|
|
||||||
plx restore X = function index
|
|
||||||
ldy ZPPtr2 get type in Y
|
|
||||||
pla
|
|
||||||
sta ZPPtr2+1
|
|
||||||
pla
|
|
||||||
sta ZPPtr2
|
|
||||||
pla
|
|
||||||
sta ZPPtr1+1
|
|
||||||
pla
|
|
||||||
sta ZPPtr1
|
|
||||||
phy
|
|
||||||
jsr CSH.fCall.Exec
|
|
||||||
plx restore returned type
|
|
||||||
rts
|
|
||||||
|
|
||||||
.90 lda #E.CSYN
|
|
||||||
.HS 2C BIT ABS
|
|
||||||
.91 lda #E.TMISMATCH
|
|
||||||
sec
|
|
||||||
|
|
||||||
.9 plx Discard function index
|
|
||||||
|
|
||||||
plx
|
|
||||||
stx ZPPtr2+1
|
|
||||||
plx
|
|
||||||
stx ZPPtr2
|
|
||||||
plx
|
|
||||||
stx ZPPtr1+1
|
|
||||||
plx
|
|
||||||
stx ZPPtr1
|
|
||||||
|
|
||||||
.99 rts
|
|
||||||
*--------------------------------------
|
|
||||||
CSH.fCall.Exec jmp (J.CSH.EXEC,x)
|
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
MAN
|
MAN
|
||||||
SAVE usr/src/bin/csh.s.kw
|
SAVE usr/src/bin/csh.s.kw
|
||||||
|
|
290
BIN/CSH.S.txt
290
BIN/CSH.S.txt
|
@ -10,20 +10,19 @@ NEW
|
||||||
.INB inc/mli.i
|
.INB inc/mli.i
|
||||||
.INB inc/mli.e.i
|
.INB inc/mli.e.i
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CSH.T.VOID .EQ 0
|
CSH.T.VOID .EQ 1
|
||||||
CSH.T.UCHAR .EQ 1
|
CSH.T.UCHAR .EQ 2
|
||||||
CSH.T.SCHAR .EQ 2
|
CSH.T.SCHAR .EQ 3
|
||||||
CSH.T.UINT .EQ 3
|
CSH.T.UINT .EQ 4
|
||||||
CSH.T.SINT .EQ 4
|
CSH.T.SINT .EQ 5
|
||||||
CSH.T.ULONG .EQ 5
|
CSH.T.ULONG .EQ 6
|
||||||
CSH.T.SLONG .EQ 6
|
CSH.T.SLONG .EQ 7
|
||||||
CSH.T.FLOAT .EQ 7
|
CSH.T.FLOAT .EQ 8
|
||||||
CSH.T.VARIADIC .EQ $FF
|
CSH.T.VARIADIC .EQ $FF
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CSH.Q.POINTER .EQ %01000000
|
CSH.Q.POINTER .EQ %01000000
|
||||||
CSH.Q.PPOINTER .EQ %10000000
|
CSH.Q.PPOINTER .EQ %10000000
|
||||||
CSH.Q.PPPOINTER .EQ %11000000
|
CSH.Q.PPPOINTER .EQ %11000000
|
||||||
CSH.Q.PCONST .EQ %00100000
|
|
||||||
CSH.Q.CONST .EQ %00010000
|
CSH.Q.CONST .EQ %00010000
|
||||||
CSH.Q.FUNC .EQ %00001000
|
CSH.Q.FUNC .EQ %00001000
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
@ -36,30 +35,26 @@ ZPCSHCode .BS 2
|
||||||
ZPCSHConst .BS 2
|
ZPCSHConst .BS 2
|
||||||
ZPCSHData .BS 2
|
ZPCSHData .BS 2
|
||||||
ZPCSHStack .BS 2
|
ZPCSHStack .BS 2
|
||||||
ZPCSHfDecl .BS 2
|
|
||||||
|
|
||||||
|
ZPCSHfDecl .BS 2
|
||||||
|
ZPInputBufPtr .BS 2
|
||||||
|
hDefine .BS 1
|
||||||
|
hInclude .BS 1
|
||||||
ZPVarID .BS 2
|
ZPVarID .BS 2
|
||||||
ZPVarDef .EQ *
|
|
||||||
|
ZPVarDef .EQ *
|
||||||
ZPVarType .BS 1
|
ZPVarType .BS 1
|
||||||
ZPVarQual .BS 1
|
ZPVarQual .BS 1
|
||||||
ZPVarSizeOf .BS 2
|
ZPVarSizeOf .BS 2
|
||||||
ZPVarDataPtr .BS 2
|
ZPVarDataPtr .BS 2
|
||||||
|
ZPVarDefPtr .BS 2
|
||||||
|
|
||||||
ZPInputBufPtr .BS 2
|
ArgIndex .BS 1
|
||||||
|
|
||||||
|
|
||||||
bFastCall .BS 1
|
bFastCall .BS 1
|
||||||
bCompil .BS 1
|
|
||||||
|
|
||||||
hDefine .BS 1
|
|
||||||
hInclude .BS 1
|
|
||||||
|
|
||||||
ZPPtr1 .BS 2
|
ZPPtr1 .BS 2
|
||||||
ZPPtr2 .BS 2
|
ZPPtr2 .BS 2
|
||||||
ZPPtr3 .BS 2
|
ZPPtr3 .BS 2
|
||||||
|
|
||||||
ArgIndex .BS 1
|
|
||||||
|
|
||||||
ZS.END .ED
|
ZS.END .ED
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* File Header (16 Bytes)
|
* File Header (16 Bytes)
|
||||||
|
@ -163,9 +158,12 @@ J.CSH.UTYPES .DA CSH.UCHAR
|
||||||
J.CSH.STYPES .DA CSH.SCHAR
|
J.CSH.STYPES .DA CSH.SCHAR
|
||||||
.DA CSH.SINT
|
.DA CSH.SINT
|
||||||
.DA CSH.SLONG
|
.DA CSH.SLONG
|
||||||
|
*--------------------------------------
|
||||||
J.CSH.KW.END .DA CSH.IF.END
|
J.CSH.KW.END .DA CSH.IF.END
|
||||||
.DA CSH.WHILE.END
|
.DA CSH.WHILE.END
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
L.CSH.LIBC .DA CSH.LIBC
|
||||||
|
*--------------------------------------
|
||||||
J.CSH.EXEC .DA EXEC.pwr
|
J.CSH.EXEC .DA EXEC.pwr
|
||||||
.DA EXEC.log
|
.DA EXEC.log
|
||||||
.DA EXEC.sqr
|
.DA EXEC.sqr
|
||||||
|
@ -334,6 +332,7 @@ PrintErrMsg lda hDefine
|
||||||
|
|
||||||
.1 inc ZPPtr2
|
.1 inc ZPPtr2
|
||||||
bne .2
|
bne .2
|
||||||
|
|
||||||
inc ZPPtr2+1
|
inc ZPPtr2+1
|
||||||
|
|
||||||
.2 >LDYA ZPPtr1
|
.2 >LDYA ZPPtr1
|
||||||
|
@ -343,9 +342,11 @@ PrintErrMsg lda hDefine
|
||||||
|
|
||||||
inc ZPPtr1
|
inc ZPPtr1
|
||||||
bne .3
|
bne .3
|
||||||
|
|
||||||
inc ZPPtr1+1
|
inc ZPPtr1+1
|
||||||
.3 cmp #C.CR
|
.3 cmp #C.CR
|
||||||
bne .20 Scan until EoL
|
bne .20 Scan until EoL
|
||||||
|
|
||||||
ldx ZPPtr1
|
ldx ZPPtr1
|
||||||
cpx ZPInputBufPtr
|
cpx ZPInputBufPtr
|
||||||
lda ZPPtr1+1
|
lda ZPPtr1+1
|
||||||
|
@ -449,8 +450,8 @@ MSG.USAGE .AS "Usage : CSH <option> file\r\n"
|
||||||
.AS " -D : Debug Mode\r\n"
|
.AS " -D : Debug Mode\r\n"
|
||||||
.AS " -T : Trace On"
|
.AS " -T : Trace On"
|
||||||
MSG.ECHOCRLF .AZ "\r\n"
|
MSG.ECHOCRLF .AZ "\r\n"
|
||||||
MSG.DEBUG .AZ "pStack=%H"
|
MSG.DEBUG .AZ "pStack=%H\r\n"
|
||||||
MSG.ERR .AZ "^\r\nLine #%D:"
|
MSG.ERR .AZ "-^\r\nLine #%D:"
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
ENV.INCLUDE .AZ "INCLUDE"
|
ENV.INCLUDE .AZ "INCLUDE"
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
@ -558,122 +559,251 @@ CSH.FTYPES >PSTR "fastcall"
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CSH.TYPESIZE .HS 0001010202040405
|
CSH.TYPESIZE .HS 0001010202040405
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
CSH.LIBC >PSTR "chtyp"
|
||||||
|
>PSTR "chmod"
|
||||||
|
>PSTR "fstat"
|
||||||
|
>PSTR "stat"
|
||||||
|
>PSTR "mkdir"
|
||||||
|
>PSTR "mknod"
|
||||||
|
>PSTR "mkfifo"
|
||||||
|
>PSTR "pipe"
|
||||||
|
>PSTR "opendir"
|
||||||
|
>PSTR "readdir"
|
||||||
|
>PSTR "closedir"
|
||||||
|
>PSTR "open"
|
||||||
|
>PSTR "close"
|
||||||
|
>PSTR "read"
|
||||||
|
>PSTR "write"
|
||||||
|
>PSTR "chown"
|
||||||
|
>PSTR "fputc"
|
||||||
|
>PSTR "putchar"
|
||||||
|
>PSTR "getc"
|
||||||
|
>PSTR "getchar"
|
||||||
|
>PSTR "fputs"
|
||||||
|
>PSTR "puts"
|
||||||
|
>PSTR "fgets"
|
||||||
|
>PSTR "ungetc"
|
||||||
|
>PSTR "fopen"
|
||||||
|
>PSTR "fclose"
|
||||||
|
>PSTR "fread"
|
||||||
|
>PSTR "fwrite"
|
||||||
|
>PSTR "fflush"
|
||||||
|
>PSTR "fseek"
|
||||||
|
>PSTR "ftell"
|
||||||
|
>PSTR "feof"
|
||||||
|
>PSTR "remove"
|
||||||
|
>PSTR "rename"
|
||||||
|
>PSTR "printf"
|
||||||
|
>PSTR "fprintf"
|
||||||
|
>PSTR "sprintf"
|
||||||
|
>PSTR "scanf"
|
||||||
|
>PSTR "fscanf"
|
||||||
|
>PSTR "sscanf"
|
||||||
|
>PSTR "$50"
|
||||||
|
>PSTR "$52"
|
||||||
|
>PSTR "$54"
|
||||||
|
>PSTR "$56"
|
||||||
|
>PSTR "$58"
|
||||||
|
>PSTR "$5A"
|
||||||
|
>PSTR "$5C"
|
||||||
|
>PSTR "setattr"
|
||||||
|
>PSTR "mount"
|
||||||
|
>PSTR "umount"
|
||||||
|
>PSTR "online"
|
||||||
|
>PSTR "getstkobj"
|
||||||
|
>PSTR "shift"
|
||||||
|
>PSTR "argv"
|
||||||
|
>PSTR "argvDup"
|
||||||
|
>PSTR "geterrmsg"
|
||||||
|
>PSTR "atof"
|
||||||
|
>PSTR "atoi"
|
||||||
|
>PSTR "atol"
|
||||||
|
>PSTR "strtof"
|
||||||
|
>PSTR "strtol"
|
||||||
|
>PSTR "strtoul"
|
||||||
|
>PSTR "realpath"
|
||||||
|
>PSTR "expand"
|
||||||
|
>PSTR "strlen"
|
||||||
|
>PSTR "strcpy"
|
||||||
|
>PSTR "strcat"
|
||||||
|
>PSTR "strdup"
|
||||||
|
>PSTR "strupr"
|
||||||
|
>PSTR "strlwr"
|
||||||
|
>PSTR "strcmp"
|
||||||
|
>PSTR "strcasecmp"
|
||||||
|
>PSTR "getdevbyname"
|
||||||
|
>PSTR "getdevstatus"
|
||||||
|
>PSTR "mkdev"
|
||||||
|
>PSTR "ioctl"
|
||||||
|
>PSTR "loadlib"
|
||||||
|
>PSTR "unloadlib"
|
||||||
|
>PSTR "loaddrv"
|
||||||
|
>PSTR "insdrv"
|
||||||
|
>PSTR "execl"
|
||||||
|
>PSTR "execv"
|
||||||
|
>PSTR "fork"
|
||||||
|
>PSTR "kill"
|
||||||
|
>PSTR "loadfile"
|
||||||
|
>PSTR "loadtxtfile"
|
||||||
|
>PSTR "filesearch"
|
||||||
|
>PSTR "getmemstat"
|
||||||
|
>PSTR "strvnew"
|
||||||
|
>PSTR "strvset"
|
||||||
|
>PSTR "strvget"
|
||||||
|
>PSTR "strvfree"
|
||||||
|
>PSTR "putenv"
|
||||||
|
>PSTR "setenv"
|
||||||
|
>PSTR "getenv"
|
||||||
|
>PSTR "unsetenv"
|
||||||
|
>PSTR "time"
|
||||||
|
>PSTR "strftime"
|
||||||
|
>PSTR "ctime2time"
|
||||||
|
>PSTR "md5"
|
||||||
|
>PSTR "md5init"
|
||||||
|
>PSTR "md5update"
|
||||||
|
>PSTR "md5finalize"
|
||||||
|
>PSTR "getpwuid"
|
||||||
|
>PSTR "getpwname"
|
||||||
|
>PSTR "putpw"
|
||||||
|
>PSTR "getgrpgid"
|
||||||
|
>PSTR "getgrpname"
|
||||||
|
>PSTR "putgr"
|
||||||
|
>PSTR "opensession"
|
||||||
|
>PSTR "closesession"
|
||||||
|
>PSTR "slistgetdata"
|
||||||
|
>PSTR "slistadddata"
|
||||||
|
>PSTR "slistsetdata"
|
||||||
|
>PSTR "slistgetbyid"
|
||||||
|
>PSTR "slistnewkey"
|
||||||
|
>PSTR "slistlookup"
|
||||||
|
>PSTR "slistfree"
|
||||||
|
>PSTR "slistnew"
|
||||||
|
>PSTR "malloc"
|
||||||
|
>PSTR "realloc"
|
||||||
|
>PSTR "getmemptr"
|
||||||
|
>PSTR "free"
|
||||||
|
>PSTR "newstkobj"
|
||||||
|
>PSTR "loadstkobj"
|
||||||
|
>PSTR "getstkobjptr"
|
||||||
|
>PSTR "freestkobj"
|
||||||
|
.HS 00
|
||||||
|
*--------------------------------------
|
||||||
CSH.FN
|
CSH.FN
|
||||||
* float pwr (float x, float y);
|
* float pwr (float x, float y);
|
||||||
>PSTR "pwr"
|
>PSTR "pwr"
|
||||||
.DA #CSH.T.FLOAT returned value
|
.DA #CSH.T.FLOAT,#0 returned value
|
||||||
.DA #CSH.T.FLOAT
|
.DA #CSH.T.FLOAT,#0
|
||||||
.DA #CSH.T.FLOAT
|
.DA #CSH.T.FLOAT,#0
|
||||||
.DA #0
|
.DA #0
|
||||||
* float cos (float x);
|
* float cos (float x);
|
||||||
>PSTR "log"
|
>PSTR "log"
|
||||||
.DA #CSH.T.FLOAT returned value
|
.DA #CSH.T.FLOAT,#0 returned value
|
||||||
.DA #CSH.T.FLOAT
|
.DA #CSH.T.FLOAT,#0
|
||||||
.DA #0
|
.DA #0
|
||||||
>PSTR "sqr"
|
>PSTR "sqr"
|
||||||
.DA #CSH.T.FLOAT returned value
|
.DA #CSH.T.FLOAT,#0 returned value
|
||||||
.DA #CSH.T.FLOAT
|
.DA #CSH.T.FLOAT,#0
|
||||||
.DA #0
|
.DA #0
|
||||||
>PSTR "exp"
|
>PSTR "exp"
|
||||||
.DA #CSH.T.FLOAT returned value
|
.DA #CSH.T.FLOAT,#0 returned value
|
||||||
.DA #CSH.T.FLOAT
|
.DA #CSH.T.FLOAT,#0
|
||||||
.DA #0
|
.DA #0
|
||||||
>PSTR "cos"
|
>PSTR "cos"
|
||||||
.DA #CSH.T.FLOAT returned value
|
.DA #CSH.T.FLOAT,#0 returned value
|
||||||
.DA #CSH.T.FLOAT
|
.DA #CSH.T.FLOAT,#0
|
||||||
.DA #0
|
.DA #0
|
||||||
>PSTR "sin"
|
>PSTR "sin"
|
||||||
.DA #CSH.T.FLOAT returned value
|
.DA #CSH.T.FLOAT,#0 returned value
|
||||||
.DA #CSH.T.FLOAT
|
.DA #CSH.T.FLOAT,#0
|
||||||
.DA #0
|
.DA #0
|
||||||
>PSTR "tan"
|
>PSTR "tan"
|
||||||
.DA #CSH.T.FLOAT returned value
|
.DA #CSH.T.FLOAT,#0 returned value
|
||||||
.DA #CSH.T.FLOAT
|
.DA #CSH.T.FLOAT,#0
|
||||||
.DA #0
|
.DA #0
|
||||||
>PSTR "atan"
|
>PSTR "atan"
|
||||||
.DA #CSH.T.FLOAT returned value
|
.DA #CSH.T.FLOAT,#0 returned value
|
||||||
.DA #CSH.T.FLOAT
|
.DA #CSH.T.FLOAT,#0
|
||||||
.DA #0
|
.DA #0
|
||||||
* char getchar ( void );
|
* char getchar ( void );
|
||||||
>PSTR "getchar"
|
>PSTR "getchar"
|
||||||
.DA #CSH.T.UCHAR returned value
|
.DA #CSH.T.UCHAR,#0 returned value
|
||||||
.DA #0
|
.DA #0
|
||||||
* int puts ( const char * str );
|
* int puts ( const char * str );
|
||||||
>PSTR "puts"
|
>PSTR "puts"
|
||||||
.DA #CSH.T.SINT returned value
|
.DA #CSH.T.SINT,#0 returned value
|
||||||
.DA #CSH.Q.CONST+CSH.Q.POINTER+CSH.T.UCHAR
|
.DA #CSH.T.UCHAR,#CSH.Q.CONST+CSH.Q.POINTER
|
||||||
.DA #0
|
.DA #0
|
||||||
* int execl(const char* cmdline, short int flags);
|
* int execl(const char* cmdline, short int flags);
|
||||||
>PSTR "execl"
|
>PSTR "execl"
|
||||||
.DA #CSH.T.SINT returned value
|
.DA #CSH.T.SINT,#0 returned value
|
||||||
.DA #CSH.Q.CONST+CSH.Q.POINTER+CSH.T.UCHAR
|
.DA #CSH.T.UCHAR,#CSH.Q.CONST+CSH.Q.POINTER
|
||||||
.DA #CSH.T.UCHAR
|
.DA #CSH.T.UCHAR,#0
|
||||||
.DA #0
|
.DA #0
|
||||||
* int printf ( const char * format, ... );
|
* int printf ( const char * format, ... );
|
||||||
>PSTR "printf"
|
>PSTR "printf"
|
||||||
.DA #CSH.T.SINT returned value
|
.DA #CSH.T.SINT,#0 returned value
|
||||||
.DA #CSH.Q.CONST+CSH.Q.POINTER+CSH.T.UCHAR
|
.DA #CSH.T.UCHAR,#CSH.Q.CONST+CSH.Q.POINTER
|
||||||
.DA #CSH.T.VARIADIC
|
.DA #CSH.T.VARIADIC,#0
|
||||||
.DA #0
|
.DA #0
|
||||||
* int putenv(const char *string);
|
* int putenv(const char *string);
|
||||||
>PSTR "putenv"
|
>PSTR "putenv"
|
||||||
.DA #CSH.T.SINT returned value
|
.DA #CSH.T.SINT,#0 returned value
|
||||||
.DA #CSH.Q.CONST+CSH.Q.POINTER+CSH.T.UCHAR
|
.DA #CSH.T.UCHAR,#CSH.Q.CONST+CSH.Q.POINTER
|
||||||
.DA #0
|
.DA #0
|
||||||
* int setenv(const char *name, const char *value);
|
* int setenv(const char *name, const char *value);
|
||||||
>PSTR "setenv"
|
>PSTR "setenv"
|
||||||
.DA #CSH.T.SINT returned value
|
.DA #CSH.T.SINT,#0 returned value
|
||||||
.DA #CSH.Q.CONST+CSH.Q.POINTER+CSH.T.UCHAR
|
.DA #CSH.T.UCHAR,#CSH.Q.CONST+CSH.Q.POINTER
|
||||||
.DA #CSH.Q.CONST+CSH.Q.POINTER+CSH.T.UCHAR
|
.DA #CSH.T.UCHAR,#CSH.Q.CONST+CSH.Q.POINTER
|
||||||
.DA #0
|
.DA #0
|
||||||
* char *getenv(const char *name, char *value);
|
* char *getenv(const char *name, char *value);
|
||||||
>PSTR "getenv"
|
>PSTR "getenv"
|
||||||
.DA #CSH.Q.POINTER+CSH.T.UCHAR
|
.DA #CSH.T.UCHAR,#CSH.Q.POINTER
|
||||||
.DA #CSH.Q.CONST+CSH.Q.POINTER+CSH.T.UCHAR
|
.DA #CSH.T.UCHAR,#CSH.Q.CONST+CSH.Q.POINTER
|
||||||
.DA #CSH.Q.POINTER+CSH.T.UCHAR
|
.DA #CSH.T.UCHAR,#CSH.Q.POINTER
|
||||||
.DA #0
|
.DA #0
|
||||||
* int unsetenv(const char *name);
|
* int unsetenv(const char *name);
|
||||||
>PSTR "unsetenv"
|
>PSTR "unsetenv"
|
||||||
.DA #CSH.T.SINT returned value
|
.DA #CSH.T.SINT,#0 returned value
|
||||||
.DA #CSH.Q.CONST+CSH.Q.POINTER+CSH.T.UCHAR
|
.DA #CSH.T.UCHAR,#CSH.Q.CONST+CSH.Q.POINTER
|
||||||
.DA #0
|
.DA #0
|
||||||
* void md5 (const char* str, char* digest);
|
* void md5 (const char* str, char* digest);
|
||||||
>PSTR "md5"
|
>PSTR "md5"
|
||||||
.DA #CSH.T.VOID
|
.DA #CSH.T.VOID,#0
|
||||||
.DA #CSH.Q.CONST+CSH.Q.POINTER+CSH.T.UCHAR
|
.DA #CSH.T.UCHAR,#CSH.Q.CONST+CSH.Q.POINTER
|
||||||
.DA #CSH.Q.POINTER+CSH.T.UCHAR
|
.DA #CSH.T.UCHAR,#CSH.Q.POINTER
|
||||||
.DA #0
|
.DA #0
|
||||||
* void * malloc ( int size );
|
* void * malloc ( int size );
|
||||||
>PSTR "malloc"
|
>PSTR "malloc"
|
||||||
.DA #CSH.Q.POINTER+CSH.T.VOID returned value
|
.DA #CSH.T.VOID,#CSH.Q.POINTER returned value
|
||||||
.DA #CSH.T.SINT
|
.DA #CSH.T.SINT,#0
|
||||||
.DA #0
|
.DA #0
|
||||||
* short int fopen(const char*,short int,short int,int);
|
* short int fopen(const char*,short int,short int,int);
|
||||||
>PSTR "fopen"
|
>PSTR "fopen"
|
||||||
.DA #CSH.T.SCHAR
|
.DA #CSH.T.SCHAR,#0
|
||||||
.DA #CSH.Q.CONST+CSH.Q.POINTER+CSH.T.UCHAR
|
.DA #CSH.T.UCHAR,#CSH.Q.CONST+CSH.Q.POINTER
|
||||||
.DA #CSH.T.SCHAR
|
.DA #CSH.T.SCHAR,#0
|
||||||
.DA #CSH.T.SCHAR
|
.DA #CSH.T.SCHAR,#0
|
||||||
.DA #CSH.T.SINT
|
.DA #CSH.T.SINT,#0
|
||||||
.DA #0
|
.DA #0
|
||||||
* int fclose(short int);
|
* int fclose(short int);
|
||||||
>PSTR "fclose"
|
>PSTR "fclose"
|
||||||
.DA #CSH.T.SINT
|
.DA #CSH.T.SINT,#0
|
||||||
.DA #CSH.T.SCHAR
|
.DA #CSH.T.SCHAR,#0
|
||||||
.DA #0
|
.DA #0
|
||||||
* int fread (short int,void*,int);
|
* int fread (short int,void*,int);
|
||||||
>PSTR "fread"
|
>PSTR "fread"
|
||||||
.DA #CSH.T.SINT
|
.DA #CSH.T.SINT,#0
|
||||||
.DA #CSH.T.SCHAR
|
.DA #CSH.T.SCHAR,#0
|
||||||
.DA #CSH.Q.POINTER+CSH.T.VOID
|
.DA #CSH.T.VOID,#CSH.Q.POINTER
|
||||||
.DA #CSH.T.SINT
|
.DA #CSH.T.SINT,#0
|
||||||
.DA #0
|
.DA #0
|
||||||
* int fwrite (short int,const void*,int);
|
* int fwrite (short int,const void*,int);
|
||||||
>PSTR "fwrite"
|
>PSTR "fwrite"
|
||||||
.DA #CSH.T.SINT
|
.DA #CSH.T.SINT,#0
|
||||||
.DA #CSH.T.SCHAR
|
.DA #CSH.T.SCHAR,#0
|
||||||
.DA #CSH.Q.CONST+CSH.Q.POINTER+CSH.T.VOID
|
.DA #CSH.T.VOID,#CSH.Q.CONST+CSH.Q.POINTER
|
||||||
.DA #CSH.T.SINT
|
.DA #CSH.T.SINT,#0
|
||||||
.DA #0
|
.DA #0
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
.DA #0
|
.DA #0
|
||||||
|
@ -712,7 +842,7 @@ CSH.fDeclBuf .BS 2
|
||||||
CSH.SaveInclude .BS 2
|
CSH.SaveInclude .BS 2
|
||||||
CSH.SaveDefine .BS 2
|
CSH.SaveDefine .BS 2
|
||||||
|
|
||||||
CSH.VarDef .BS 6
|
CSH.VarDef .BS 8
|
||||||
|
|
||||||
bDebug .BS 1
|
bDebug .BS 1
|
||||||
bTrace .BS 1
|
bTrace .BS 1
|
||||||
|
|
|
@ -8,6 +8,7 @@ NEW
|
||||||
.TF bin/nscutil
|
.TF bin/nscutil
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
.INB inc/macros.i
|
.INB inc/macros.i
|
||||||
|
.INB inc/io.i
|
||||||
.INB inc/a2osx.i
|
.INB inc/a2osx.i
|
||||||
.INB inc/mli.e.i
|
.INB inc/mli.e.i
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
@ -50,14 +51,14 @@ CS.RUN ldy #S.PS.ARGC
|
||||||
cmp #1
|
cmp #1
|
||||||
bcs CS.RUN.SET
|
bcs CS.RUN.SET
|
||||||
|
|
||||||
CS.RUN.READ lda $c00b
|
CS.RUN.READ jsr NSC.Init
|
||||||
jsr NSC.Init
|
|
||||||
jsr NSC.Read
|
jsr NSC.Read
|
||||||
ldx #7
|
ldx #7
|
||||||
|
|
||||||
.1 lda DS1216E.DETECT,x
|
.1 lda DS1216E.DETECT,x
|
||||||
eor DS1216E.DATA,x
|
eor DS1216E.DATA,x
|
||||||
bne .8
|
bne .8
|
||||||
|
|
||||||
dex
|
dex
|
||||||
bpl .1
|
bpl .1
|
||||||
|
|
||||||
|
@ -83,32 +84,39 @@ CS.RUN.SET lda #1
|
||||||
>SYSCALL StrLen
|
>SYSCALL StrLen
|
||||||
cpy #17
|
cpy #17
|
||||||
bne .9
|
bne .9
|
||||||
|
|
||||||
ldy #0
|
ldy #0
|
||||||
stz DS1216E.DATA+7
|
stz DS1216E.DATA+7
|
||||||
jsr GetBCD
|
jsr GetBCD
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
sta DS1216E.DATA
|
sta DS1216E.DATA
|
||||||
lda (ZPPtr1),y
|
lda (ZPPtr1),y
|
||||||
cmp #'/'
|
cmp #'/'
|
||||||
bne .9
|
bne .9
|
||||||
|
|
||||||
iny
|
iny
|
||||||
|
|
||||||
jsr GetBCD
|
jsr GetBCD
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
sta DS1216E.DATA+1
|
sta DS1216E.DATA+1
|
||||||
|
|
||||||
lda (ZPPtr1),y
|
lda (ZPPtr1),y
|
||||||
cmp #'/'
|
cmp #'/'
|
||||||
bne .9
|
bne .9
|
||||||
|
|
||||||
iny
|
iny
|
||||||
|
|
||||||
jsr GetBCD
|
jsr GetBCD
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
sta DS1216E.DATA+2
|
sta DS1216E.DATA+2
|
||||||
|
|
||||||
lda (ZPPtr1),y
|
lda (ZPPtr1),y
|
||||||
cmp #','
|
cmp #','
|
||||||
bne .9
|
bne .9
|
||||||
|
|
||||||
iny
|
iny
|
||||||
|
|
||||||
jsr GetBCD
|
jsr GetBCD
|
||||||
|
@ -118,22 +126,27 @@ CS.RUN.SET lda #1
|
||||||
lda (ZPPtr1),y
|
lda (ZPPtr1),y
|
||||||
cmp #':'
|
cmp #':'
|
||||||
bne .9
|
bne .9
|
||||||
|
|
||||||
iny
|
iny
|
||||||
|
|
||||||
jsr GetBCD
|
jsr GetBCD
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
sta DS1216E.DATA+5
|
sta DS1216E.DATA+5
|
||||||
|
|
||||||
lda (ZPPtr1),y
|
lda (ZPPtr1),y
|
||||||
cmp #':'
|
cmp #':'
|
||||||
bne .9
|
bne .9
|
||||||
|
|
||||||
iny
|
iny
|
||||||
|
|
||||||
jsr GetBCD
|
jsr GetBCD
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
sta DS1216E.DATA+6
|
sta DS1216E.DATA+6
|
||||||
stz DS1216E.DATA+7
|
stz DS1216E.DATA+7
|
||||||
jsr NSC.Write
|
jsr NSC.Write
|
||||||
|
|
||||||
lda #0 tell TSKMGR that all done ok, but
|
lda #0 tell TSKMGR that all done ok, but
|
||||||
sec we do not want to stay in memory
|
sec we do not want to stay in memory
|
||||||
rts
|
rts
|
||||||
|
@ -148,94 +161,132 @@ CS.DOEVENT sec
|
||||||
CS.QUIT clc
|
CS.QUIT clc
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
NSC.Init php
|
NSC.Init lda RDC3ROM
|
||||||
|
|
||||||
|
php
|
||||||
sei
|
sei
|
||||||
lda $C00B
|
|
||||||
lda $CFFF
|
* sta CLRC8ROM Make cards release $C8xx space
|
||||||
pha
|
sta SETC3ROM
|
||||||
|
|
||||||
ldx #7
|
ldx #7
|
||||||
|
|
||||||
.1 ldy #8
|
.1 ldy #8
|
||||||
|
|
||||||
.2 lda $C304
|
.2 lda $C304
|
||||||
lsr
|
lsr
|
||||||
ror DS1216E.DETECT,x
|
ror DS1216E.DETECT,x
|
||||||
dey
|
dey
|
||||||
bne .2
|
bne .2
|
||||||
|
|
||||||
dex
|
dex
|
||||||
bpl .1
|
bpl .1
|
||||||
|
|
||||||
|
plp
|
||||||
|
bmi .8
|
||||||
|
|
||||||
|
sta CLRC3ROM
|
||||||
|
|
||||||
|
.8 rts
|
||||||
|
*--------------------------------------
|
||||||
|
NSC.Read php
|
||||||
|
sei
|
||||||
|
|
||||||
|
lda RDC3ROM
|
||||||
|
php
|
||||||
|
|
||||||
|
* sta CLRC8ROM Make cards release $C8xx space
|
||||||
|
sta SETC3ROM
|
||||||
|
|
||||||
|
jsr NSC.Select
|
||||||
|
|
||||||
|
ldx #7
|
||||||
|
|
||||||
|
.1 ldy #8
|
||||||
|
|
||||||
|
.2 lda $C304
|
||||||
|
lsr
|
||||||
|
ror DS1216E.DATA,x
|
||||||
|
dey
|
||||||
|
bne .2
|
||||||
|
|
||||||
|
dex
|
||||||
|
bpl .1
|
||||||
|
|
||||||
|
plp
|
||||||
|
bmi .8
|
||||||
|
|
||||||
|
sta CLRC3ROM
|
||||||
|
|
||||||
|
.8 plp
|
||||||
|
rts
|
||||||
|
*--------------------------------------
|
||||||
|
NSC.Write php
|
||||||
|
sei
|
||||||
|
|
||||||
|
lda RDC3ROM
|
||||||
|
php
|
||||||
|
|
||||||
|
* sta CLRC8ROM Make cards release $C8xx space
|
||||||
|
sta SETC3ROM
|
||||||
|
|
||||||
|
jsr NSC.Select
|
||||||
|
|
||||||
|
ldx #7
|
||||||
|
|
||||||
|
.3 lda DS1216E.DATA,x
|
||||||
|
phx
|
||||||
|
ldx #8 ....of 8 bits
|
||||||
|
|
||||||
|
.4 ldy #0
|
||||||
|
lsr
|
||||||
|
bcc .5
|
||||||
|
|
||||||
|
iny
|
||||||
|
|
||||||
|
.5 pha
|
||||||
|
lda $C300,y Write Pattern bit in A0, with A2=0
|
||||||
pla
|
pla
|
||||||
bmi .99
|
dex
|
||||||
sta $CFFF
|
bne .4
|
||||||
.99 plp
|
|
||||||
|
plx
|
||||||
|
dex
|
||||||
|
bpl .3
|
||||||
|
|
||||||
|
plp
|
||||||
|
bmi .8
|
||||||
|
|
||||||
|
sta CLRC3ROM
|
||||||
|
|
||||||
|
.8 plp
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
NSC.Select sta $C300
|
NSC.Select sta $C300
|
||||||
|
|
||||||
lda $C304 Reset DS1216E comparison register with READ A2=1
|
lda $C304 Reset DS1216E comparison register with READ A2=1
|
||||||
ldx #7 Read 8 bytes...
|
ldx #7 Read 8 bytes...
|
||||||
|
|
||||||
.3 lda DS1216E.PATTERN,x
|
.3 lda DS1216E.PATTERN,x
|
||||||
phx
|
phx
|
||||||
ldx #8 ....of 8 bits
|
ldx #8 ....of 8 bits
|
||||||
|
|
||||||
.4 ldy #0
|
.4 ldy #0
|
||||||
lsr
|
lsr
|
||||||
bcc .5
|
bcc .5
|
||||||
|
|
||||||
iny
|
iny
|
||||||
|
|
||||||
.5 pha
|
.5 pha
|
||||||
lda $C300,y Write Pattern bit in A0, with A2=0
|
lda $C300,y Write Pattern bit in A0, with A2=0
|
||||||
pla
|
pla
|
||||||
dex
|
dex
|
||||||
bne .4
|
bne .4
|
||||||
|
|
||||||
plx
|
plx
|
||||||
dex
|
dex
|
||||||
bpl .3
|
bpl .3
|
||||||
rts
|
|
||||||
*--------------------------------------
|
|
||||||
NSC.Read php
|
|
||||||
sei
|
|
||||||
lda $CFFF
|
|
||||||
pha
|
|
||||||
jsr NSC.Select
|
|
||||||
|
|
||||||
ldx #7
|
|
||||||
.1 ldy #8
|
|
||||||
.2 lda $C304
|
|
||||||
lsr
|
|
||||||
ror DS1216E.DATA,x
|
|
||||||
dey
|
|
||||||
bne .2
|
|
||||||
dex
|
|
||||||
bpl .1
|
|
||||||
pla
|
|
||||||
bmi .99
|
|
||||||
sta $CFFF
|
|
||||||
.99 plp
|
|
||||||
rts
|
|
||||||
*--------------------------------------
|
|
||||||
NSC.Write php
|
|
||||||
sei
|
|
||||||
lda $CFFF
|
|
||||||
pha
|
|
||||||
jsr NSC.Select
|
|
||||||
|
|
||||||
ldx #7
|
|
||||||
.3 lda DS1216E.DATA,x
|
|
||||||
phx
|
|
||||||
ldx #8 ....of 8 bits
|
|
||||||
.4 ldy #0
|
|
||||||
lsr
|
|
||||||
bcc .5
|
|
||||||
iny
|
|
||||||
.5 pha
|
|
||||||
lda $C300,y Write Pattern bit in A0, with A2=0
|
|
||||||
pla
|
|
||||||
dex
|
|
||||||
bne .4
|
|
||||||
plx
|
|
||||||
dex
|
|
||||||
bpl .3
|
|
||||||
pla
|
|
||||||
bmi .99
|
|
||||||
sta $CFFF
|
|
||||||
.99 plp
|
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
NSC.Dump >PUSHW L.MSG.READ.OK1
|
NSC.Dump >PUSHW L.MSG.READ.OK1
|
||||||
|
@ -325,17 +376,18 @@ PrintBCD pha
|
||||||
lsr
|
lsr
|
||||||
ora #$30
|
ora #$30
|
||||||
>SYSCALL PutChar
|
>SYSCALL PutChar
|
||||||
bcs .9
|
|
||||||
pla
|
pla
|
||||||
and #$0f
|
and #$0f
|
||||||
ora #$30
|
ora #$30
|
||||||
>SYSCALL PutChar
|
>SYSCALL PutChar
|
||||||
.9 rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
GetBCD lda (ZPPtr1),y
|
GetBCD lda (ZPPtr1),y
|
||||||
iny
|
iny
|
||||||
jsr IsDigit
|
jsr IsDigit
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
asl
|
asl
|
||||||
asl
|
asl
|
||||||
asl
|
asl
|
||||||
|
@ -345,15 +397,19 @@ GetBCD lda (ZPPtr1),y
|
||||||
iny
|
iny
|
||||||
jsr IsDigit
|
jsr IsDigit
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
and #$0f
|
and #$0f
|
||||||
ora TmpByte
|
ora TmpByte
|
||||||
|
|
||||||
.9 rts
|
.9 rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
IsDigit cmp #'0'
|
IsDigit cmp #'0'
|
||||||
bcc .9
|
bcc .9
|
||||||
|
|
||||||
cmp #'9'+1
|
cmp #'9'+1
|
||||||
and #$0f
|
and #$0f
|
||||||
rts cc if ok, cs if not
|
rts cc if ok, cs if not
|
||||||
|
|
||||||
.9 sec
|
.9 sec
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
NEW
|
NEW
|
||||||
AUTO 3,1
|
AUTO 3,1
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
IO.D2.SeekTimeR .EQ 68 LIBBLKDEV Recalibration
|
IO.D2.SeekTimeR .EQ 48 LIBBLKDEV Recalibration
|
||||||
IO.D2.SeekTimeF .EQ 68 LIBBLKDEV Track Formatter
|
IO.D2.SeekTimeF .EQ 48 LIBBLKDEV Track Formatter
|
||||||
IO.D2.SeekTimeB .EQ 68 LIBBLKDEV Boot Block
|
IO.D2.SeekTimeB .EQ 48 LIBBLKDEV Boot Block
|
||||||
IO.D2.SeekTimeP .EQ 68 ProDOS.FX initial
|
IO.D2.SeekTimeP .EQ 38 ProDOS.FX initial
|
||||||
IO.D2.SeekTimeI .EQ 10 ProDOS.FX increment -> until > 128
|
IO.D2.SeekTimeI .EQ 10 ProDOS.FX increment -> until > 128
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
IO.D2.Ph0Off .EQ $C080
|
IO.D2.Ph0Off .EQ $C080
|
||||||
|
|
|
@ -28,7 +28,7 @@ RDREADAUX .EQ $C013 R
|
||||||
RDWRITEAUX .EQ $C014 R
|
RDWRITEAUX .EQ $C014 R
|
||||||
RDCXROM .EQ $C015 R
|
RDCXROM .EQ $C015 R
|
||||||
RDALTZP .EQ $C016 R
|
RDALTZP .EQ $C016 R
|
||||||
*RDC3ROM .EQ $C017 R
|
RDC3ROM .EQ $C017 R
|
||||||
RD80STORE .EQ $C018 R
|
RD80STORE .EQ $C018 R
|
||||||
VBL .EQ $C019 R
|
VBL .EQ $C019 R
|
||||||
RDTEXT .EQ $C01A R
|
RDTEXT .EQ $C01A R
|
||||||
|
|
|
@ -576,16 +576,18 @@ FPU.FOUT .EQ 210 PrintF
|
||||||
.MA ENTER
|
.MA ENTER
|
||||||
>PUSHB pBase
|
>PUSHB pBase
|
||||||
lda pStack
|
lda pStack
|
||||||
|
inc
|
||||||
sta pBase
|
sta pBase
|
||||||
sec
|
clc
|
||||||
sbc #]1
|
sbc #]1
|
||||||
sta pStack
|
sta pStack
|
||||||
.EM
|
.EM
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
.MA LEAVE
|
.MA LEAVE
|
||||||
pha
|
pha
|
||||||
lda pStack
|
lda pBase
|
||||||
sta pBase
|
dec
|
||||||
|
sta pStack
|
||||||
>PULLB pBase
|
>PULLB pBase
|
||||||
pla
|
pla
|
||||||
.EM
|
.EM
|
||||||
|
|
16
INCLUDE/math.h.txt
Normal file
16
INCLUDE/math.h.txt
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
NEW
|
||||||
|
AUTO 3,1
|
||||||
|
|
||||||
|
float pwr(float,float);
|
||||||
|
float log(float);
|
||||||
|
float sqr(float);
|
||||||
|
float exp(float);
|
||||||
|
float cos(float);
|
||||||
|
float sin(float);
|
||||||
|
float tan(float);
|
||||||
|
float atan(float);
|
||||||
|
|
||||||
|
long lrintf(float);
|
||||||
|
|
||||||
|
MAN
|
||||||
|
TEXT include/math.h
|
|
@ -13,19 +13,11 @@ NEW
|
||||||
#define SEEK_CUR 1
|
#define SEEK_CUR 1
|
||||||
#define SEEK_END 2
|
#define SEEK_END 2
|
||||||
|
|
||||||
int fastcall putchar(short int);
|
|
||||||
int fputc (short int, short int);
|
|
||||||
int fastcall puts(const char*);
|
|
||||||
int fputs (short int,const char*);
|
|
||||||
char* fgets(short int,char* s,int n);
|
|
||||||
short int getchar();
|
|
||||||
short int fastcall getc(short int);
|
|
||||||
// short int ungetc(short int c, short int );
|
|
||||||
|
|
||||||
short int fopen(const char*,short int,short int,int);
|
short int fopen(const char*,short int,short int,int);
|
||||||
int fclose(short int);
|
int fastcall fclose(short int);
|
||||||
int fread (short int,void*,int);
|
int fread(short int,void*,int);
|
||||||
int fwrite (short int,const void*,int);
|
int fwrite(short int,const void*,int);
|
||||||
|
|
||||||
int fastcall fflush(short int);
|
int fastcall fflush(short int);
|
||||||
int fseek(short int,long,short int);
|
int fseek(short int,long,short int);
|
||||||
int fastcall feof(short int);
|
int fastcall feof(short int);
|
||||||
|
@ -33,6 +25,16 @@ long fastcall ftell(short int);
|
||||||
int fastcall remove(const char*);
|
int fastcall remove(const char*);
|
||||||
int rename(const char*,const char*);
|
int rename(const char*,const char*);
|
||||||
|
|
||||||
|
int fastcall putchar(short int);
|
||||||
|
int fputc(short int, short int);
|
||||||
|
int fastcall puts(const char*);
|
||||||
|
int fputs(short int,const char*);
|
||||||
|
|
||||||
|
char* fgets(short int,char*,int);
|
||||||
|
short int getchar();
|
||||||
|
short int fastcall getc(short int);
|
||||||
|
// short int ungetc(short int c, short int );
|
||||||
|
|
||||||
int printf(const char*,...);
|
int printf(const char*,...);
|
||||||
int fprintf(short int,const char*,...);
|
int fprintf(short int,const char*,...);
|
||||||
int sprintf(char*,const char*,...);
|
int sprintf(char*,const char*,...);
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
NEW
|
NEW
|
||||||
AUTO 3,1
|
AUTO 3,1
|
||||||
|
|
||||||
|
// void* malloc(int);
|
||||||
|
// void free(void*);
|
||||||
|
|
||||||
float strtof(const char*,char**);
|
float strtof(const char*,char**);
|
||||||
float atof(const char*);
|
float atof(const char*);
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,9 @@ NEW
|
||||||
int fastcall strlen(char*);
|
int fastcall strlen(char*);
|
||||||
char* strcat(char*,const char*);
|
char* strcat(char*,const char*);
|
||||||
char* strcpy(char*,const char*);
|
char* strcpy(char*,const char*);
|
||||||
char* fastcall strdup (char*);
|
char* fastcall strdup(char*);
|
||||||
char* fastcall strupr (char*);
|
char* fastcall strupr(char*);
|
||||||
char* fastcall strlwr (char*);
|
char* fastcall strlwr(char*);
|
||||||
int strcmp(const char*,const char*);
|
int strcmp(const char*,const char*);
|
||||||
int strcasecmp(const char*,const char *);
|
int strcasecmp(const char*,const char *);
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,12 @@ NEW
|
||||||
AUTO 3,1
|
AUTO 3,1
|
||||||
|
|
||||||
short int open(const char*, short int);
|
short int open(const char*, short int);
|
||||||
short int fastcall close(short int)
|
short int fastcall close(short int);
|
||||||
int read(short int, void*, int);
|
int read(short int, void*, int);
|
||||||
int write(short int, const void*, int);
|
int write(short int, const void*, int);
|
||||||
// int lseek(short int,long,short int);
|
// int lseek(short int,long,short int);
|
||||||
|
|
||||||
short int chown(const char*, short int, short int);`
|
short int chown(const char*, short int, short int);
|
||||||
|
|
||||||
MAN
|
MAN
|
||||||
TEXT include/unistd.h
|
TEXT include/unistd.h
|
||||||
|
|
|
@ -353,75 +353,79 @@ DS1216E.DATA2 .EQ A1L
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
LDR.ClkDevScan php
|
LDR.ClkDevScan php
|
||||||
sei
|
sei
|
||||||
lda $CFFF
|
|
||||||
pha
|
lda RDC3ROM
|
||||||
|
php
|
||||||
|
|
||||||
|
* sta CLRC8ROM Make cards release $C8xx space
|
||||||
|
sta SETC3ROM
|
||||||
|
|
||||||
sta $C300
|
sta $C300
|
||||||
|
|
||||||
ldx #7
|
ldx #8
|
||||||
|
|
||||||
.1 ldy #8
|
.1 ldy #8
|
||||||
|
|
||||||
.2 lda $C304
|
.2 lda $C304
|
||||||
lsr
|
lsr
|
||||||
ror DS1216E.DATA1,x
|
ror DS1216E.DATA1-1,x
|
||||||
dey
|
dey
|
||||||
bne .2
|
bne .2
|
||||||
|
|
||||||
dex
|
dex
|
||||||
bpl .1
|
bne .1
|
||||||
|
|
||||||
lda $C304 Reset DS1216E comparison register with READ A2=1
|
lda $C304 Reset DS1216E comparison register with READ A2=1
|
||||||
ldx #7 Read 8 bytes...
|
|
||||||
|
|
||||||
.3 lda DS1216E.SIG,x
|
ldy #8 Read 8 bytes...
|
||||||
phx
|
|
||||||
|
|
||||||
ldx #8 ....of 8 bits
|
.3 ldy #8 ....of 8 bits
|
||||||
|
|
||||||
.4 ldy #0
|
lda DS1216E.SIG-1,y
|
||||||
lsr
|
|
||||||
bcc .5
|
|
||||||
|
|
||||||
iny
|
.4 lsr
|
||||||
|
bcs .5
|
||||||
|
|
||||||
.5 pha
|
bit $C300
|
||||||
lda $C300,y Write Pattern bit in A0, with A2=0
|
bra .50
|
||||||
pla
|
|
||||||
dex
|
.5 bit $C301 Write Pattern bit in A0, with A2=0
|
||||||
|
|
||||||
|
.50 dey
|
||||||
bne .4
|
bne .4
|
||||||
|
|
||||||
plx
|
|
||||||
dex
|
dex
|
||||||
bpl .3
|
bne .3
|
||||||
|
|
||||||
ldx #7
|
ldx #8
|
||||||
|
|
||||||
.6 ldy #8
|
.6 ldy #8
|
||||||
|
|
||||||
.7 lda $C304
|
.7 lda $C304
|
||||||
lsr
|
lsr
|
||||||
ror DS1216E.DATA2,x
|
ror DS1216E.DATA2-1,x
|
||||||
|
|
||||||
dey
|
dey
|
||||||
bne .7
|
bne .7
|
||||||
|
|
||||||
dex
|
dex
|
||||||
bpl .6
|
bne .6
|
||||||
|
|
||||||
pla
|
plp
|
||||||
bmi .8
|
bmi .8
|
||||||
|
|
||||||
sta $CFFF
|
sta CLRC3ROM
|
||||||
|
|
||||||
.8 plp
|
.8 plp
|
||||||
|
|
||||||
ldx #7
|
ldx #8
|
||||||
|
|
||||||
.9 lda DS1216E.DATA1,x
|
.9 lda DS1216E.DATA1-1,x
|
||||||
cmp DS1216E.DATA2,x
|
cmp DS1216E.DATA2-1,x
|
||||||
bne .90
|
bne .90
|
||||||
|
|
||||||
dex
|
dex
|
||||||
bpl .9
|
bne .9
|
||||||
|
|
||||||
bra LDR.ClkDevTCLK
|
bra LDR.ClkDevTCLK
|
||||||
|
|
||||||
|
|
|
@ -3,43 +3,56 @@ NEW
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* Driver For DS1216E
|
* Driver For DS1216E
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
* we can safely use $200 (used by TCLK)
|
||||||
|
*--------------------------------------
|
||||||
|
DS1216E.DATA .EQ $200 Reverted YY MM DD Day HH mm SS CS
|
||||||
|
*--------------------------------------
|
||||||
NCLK.START php
|
NCLK.START php
|
||||||
sei
|
sei NO IRQ !!!
|
||||||
sta $CFFF Make cards release $C8xx space
|
|
||||||
|
lda RDC3ROM because no IRQ handler at $C3FA...
|
||||||
|
php
|
||||||
|
|
||||||
|
* sta CLRC8ROM Make cards release $C8xx space
|
||||||
|
sta SETC3ROM ... after this
|
||||||
|
|
||||||
sta $C300
|
sta $C300
|
||||||
lda $C304 Reset DS1216E comparison register with READ A2=1
|
lda $C304 Reset DS1216E comparison register with READ A2=1
|
||||||
ldy #7 Read 8 bytes...
|
|
||||||
|
|
||||||
.1 lda DS1216E.PATTERN,y
|
ldx #8 Read 8 bytes...
|
||||||
phy
|
|
||||||
ldy #8 ....of 8 bits
|
|
||||||
|
|
||||||
.2 ldx #0
|
.1 ldy #8 ....of 8 bits
|
||||||
lsr
|
|
||||||
bcc .3
|
|
||||||
inx
|
|
||||||
|
|
||||||
.3 bit $C300,x Write Pattern bit in A0, with A2=0
|
lda DS1216E.PATTERN-1,x
|
||||||
dey
|
|
||||||
|
.2 lsr
|
||||||
|
bcs .3
|
||||||
|
|
||||||
|
bit $C300
|
||||||
|
bra .30
|
||||||
|
|
||||||
|
.3 bit $C301 Write Pattern bit in A0, with A2=0
|
||||||
|
|
||||||
|
.30 dey
|
||||||
bne .2
|
bne .2
|
||||||
|
|
||||||
ply
|
dex
|
||||||
dey
|
bne .1
|
||||||
bpl .1
|
|
||||||
|
|
||||||
ldx #7
|
ldx #8
|
||||||
|
|
||||||
.4 ldy #8
|
.4 ldy #8
|
||||||
|
|
||||||
.5 lda $C304 Read Byte...
|
.5 pha
|
||||||
|
lda $C304 Read Byte...
|
||||||
|
|
||||||
lsr
|
lsr
|
||||||
ror DS1216E.DATA,x
|
pla
|
||||||
|
ror
|
||||||
|
|
||||||
dey
|
dey
|
||||||
bne .5
|
bne .5
|
||||||
|
|
||||||
lda DS1216E.DATA,x
|
|
||||||
pha
|
pha
|
||||||
lsr
|
lsr
|
||||||
lsr
|
lsr
|
||||||
|
@ -57,14 +70,12 @@ NCLK.START php
|
||||||
dey
|
dey
|
||||||
bpl .6
|
bpl .6
|
||||||
|
|
||||||
sta DS1216E.DATA,x
|
sta DS1216E.DATA-1,x
|
||||||
dex
|
dex
|
||||||
bpl .4
|
bne .4
|
||||||
|
|
||||||
|
pha DS1216E.DATA
|
||||||
|
|
||||||
lda DS1216E.DATA+4 Get HH
|
|
||||||
sta TIMELO+1
|
|
||||||
lda DS1216E.DATA+5 Get mm
|
|
||||||
sta TIMELO
|
|
||||||
lda DS1216E.DATA+1 Get MM
|
lda DS1216E.DATA+1 Get MM
|
||||||
asl
|
asl
|
||||||
asl
|
asl
|
||||||
|
@ -73,17 +84,38 @@ NCLK.START php
|
||||||
asl
|
asl
|
||||||
ora DS1216E.DATA+2 Get DD
|
ora DS1216E.DATA+2 Get DD
|
||||||
sta DATELO
|
sta DATELO
|
||||||
lda DS1216E.DATA Get YY
|
|
||||||
|
* lda DS1216E.DATA Get YY
|
||||||
|
|
||||||
|
pla
|
||||||
rol
|
rol
|
||||||
sta DATELO+1
|
sta DATELO+1
|
||||||
|
|
||||||
|
lda DS1216E.DATA+5 Get mm
|
||||||
|
sta TIMELO
|
||||||
|
|
||||||
|
lda DS1216E.DATA+4 Get HH
|
||||||
|
sta TIMELO+1
|
||||||
|
|
||||||
plp
|
plp
|
||||||
|
bmi .8
|
||||||
|
|
||||||
|
sta CLRC3ROM
|
||||||
|
|
||||||
|
.8 plp
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
DS1216E.PATTERN .HS 5CA33AC55CA33AC5 Reverted 7->0
|
DS1216E.PATTERN .HS 5CA33AC55CA33AC5 Reverted 7->0
|
||||||
DS1216E.DATA .BS 8 Reverted YY MM DD Day HH mm SS CS
|
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
.LIST ON
|
||||||
NCLK.LEN .EQ *-NCLK.START
|
NCLK.LEN .EQ *-NCLK.START
|
||||||
|
.LIST OFF
|
||||||
|
*--------------------------------------
|
||||||
|
* CONTROL SECTION :
|
||||||
|
*--------------------------------------
|
||||||
|
.DO NCLK.LEN>125
|
||||||
|
ERROR:NCLK Driver too big
|
||||||
|
.FIN
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
MAN
|
MAN
|
||||||
SAVE usr/src/prodos.fx/prodos.s.nclk
|
SAVE usr/src/prodos.fx/prodos.s.nclk
|
||||||
|
|
165
SYS/KM.NSC.S.txt
165
SYS/KM.NSC.S.txt
|
@ -39,60 +39,85 @@ NSC.Init >LDYAI NSC.MSG0
|
||||||
DS1216E.DATA1 .EQ $10
|
DS1216E.DATA1 .EQ $10
|
||||||
DS1216E.DATA2 .EQ $18
|
DS1216E.DATA2 .EQ $18
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
NSC.Detect php
|
NSC.Detect lda RDC3ROM
|
||||||
|
|
||||||
|
php
|
||||||
sei
|
sei
|
||||||
lda $CFFF
|
|
||||||
pha
|
sta CLRC8ROM Make cards release $C8xx space
|
||||||
|
sta SETC3ROM
|
||||||
|
|
||||||
sta $C300
|
sta $C300
|
||||||
|
|
||||||
ldx #7
|
ldx #7
|
||||||
|
|
||||||
.1 ldy #8
|
.1 ldy #8
|
||||||
|
|
||||||
.2 lda $C304
|
.2 lda $C304
|
||||||
lsr
|
lsr
|
||||||
ror DS1216E.DATA1,x
|
ror DS1216E.DATA1,x
|
||||||
dey
|
dey
|
||||||
bne .2
|
bne .2
|
||||||
|
|
||||||
dex
|
dex
|
||||||
bpl .1
|
bpl .1
|
||||||
|
|
||||||
lda $C304 Reset DS1216E comparison register with READ A2=1
|
lda $C304 Reset DS1216E comparison register with READ A2=1
|
||||||
ldx #7 Read 8 bytes...
|
|
||||||
.3 lda DS1216E.PATTERN,x
|
ldy #7 Read 8 bytes...
|
||||||
phx
|
|
||||||
ldx #8 ....of 8 bits
|
.3 lda DS1216E.PATTERN,y
|
||||||
.4 ldy #0
|
phy
|
||||||
|
|
||||||
|
ldy #8 ....of 8 bits
|
||||||
|
|
||||||
|
.4 ldx #0
|
||||||
|
|
||||||
lsr
|
lsr
|
||||||
bcc .5
|
bcc .5
|
||||||
iny
|
|
||||||
.5 pha
|
inx
|
||||||
lda $C300,y Write Pattern bit in A0, with A2=0
|
|
||||||
pla
|
.5 bit $C300,x Write Pattern bit in A0, with A2=0
|
||||||
dex
|
|
||||||
bne .4
|
|
||||||
plx
|
|
||||||
dex
|
|
||||||
bpl .3
|
|
||||||
ldx #7
|
|
||||||
.6 ldy #8
|
|
||||||
.7 lda $C304
|
|
||||||
lsr
|
|
||||||
ror DS1216E.DATA2,x
|
|
||||||
dey
|
dey
|
||||||
bne .7
|
bne .4
|
||||||
dex
|
|
||||||
bpl .6
|
ply
|
||||||
pla
|
dey
|
||||||
bmi .8
|
bpl .3
|
||||||
sta $CFFF
|
|
||||||
.8 plp
|
|
||||||
|
|
||||||
ldx #7
|
ldx #7
|
||||||
|
|
||||||
|
.6 ldy #8
|
||||||
|
|
||||||
|
.7 lda $C304
|
||||||
|
|
||||||
|
lsr
|
||||||
|
ror DS1216E.DATA2,x
|
||||||
|
|
||||||
|
dey
|
||||||
|
bne .7
|
||||||
|
|
||||||
|
dex
|
||||||
|
bpl .6
|
||||||
|
|
||||||
|
plp
|
||||||
|
bmi .8
|
||||||
|
|
||||||
|
sta CLRC3ROM
|
||||||
|
|
||||||
|
.8 ldx #7
|
||||||
|
|
||||||
.81 lda DS1216E.DATA1,x
|
.81 lda DS1216E.DATA1,x
|
||||||
cmp DS1216E.DATA2,x
|
cmp DS1216E.DATA2,x
|
||||||
bne .9
|
bne .9
|
||||||
|
|
||||||
dex
|
dex
|
||||||
bpl .81
|
bpl .81
|
||||||
|
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.9 clc
|
.9 clc
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
@ -110,6 +135,7 @@ NSC.Install lda DATETIME+1
|
||||||
|
|
||||||
.1 lda NSCDRV.RELOC,x
|
.1 lda NSCDRV.RELOC,x
|
||||||
beq .2
|
beq .2
|
||||||
|
|
||||||
sta TmpPtr2
|
sta TmpPtr2
|
||||||
inx
|
inx
|
||||||
lda NSCDRV.RELOC,x
|
lda NSCDRV.RELOC,x
|
||||||
|
@ -123,6 +149,7 @@ NSC.Install lda DATETIME+1
|
||||||
sta (TmpPtr2),y
|
sta (TmpPtr2),y
|
||||||
inx
|
inx
|
||||||
bne .1
|
bne .1
|
||||||
|
|
||||||
.2 lda RRAMWRAMBNK1
|
.2 lda RRAMWRAMBNK1
|
||||||
lda RRAMWRAMBNK1
|
lda RRAMWRAMBNK1
|
||||||
.3 ldy #NSCDRV.SIZE-1 always < 128
|
.3 ldy #NSCDRV.SIZE-1 always < 128
|
||||||
|
@ -138,14 +165,14 @@ NSC.Install lda DATETIME+1
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
NSCDRV.RELOC .DA NSCDRV.R1+1
|
NSCDRV.RELOC .DA NSCDRV.R1+1
|
||||||
.DA NSCDRV.R2+1
|
* .DA NSCDRV.R2+1
|
||||||
.DA NSCDRV.R3+1
|
* .DA NSCDRV.R3+1
|
||||||
.DA NSCDRV.R4+1
|
.DA NSCDRV.R4+1
|
||||||
.DA NSCDRV.R5+1
|
.DA NSCDRV.R5+1
|
||||||
.DA NSCDRV.R6+1
|
.DA NSCDRV.R6+1
|
||||||
.DA NSCDRV.R7+1
|
.DA NSCDRV.R7+1
|
||||||
.DA NSCDRV.R8+1
|
.DA NSCDRV.R8+1
|
||||||
.DA NSCDRV.R9+1
|
* .DA NSCDRV.R9+1
|
||||||
.DA #0
|
.DA #0
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
NSC.Print sty TmpPtr1
|
NSC.Print sty TmpPtr1
|
||||||
|
@ -166,45 +193,56 @@ NSC.MSG2 .AZ -"No DS1216E Detected!"
|
||||||
NSC.MSG3 .AZ -"DS1216E Driver Successfully Installed."
|
NSC.MSG3 .AZ -"DS1216E Driver Successfully Installed."
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* Driver For DS1216E
|
* Driver For DS1216E
|
||||||
|
DS1216E.DATA .EQ $200 Reverted YY MM DD Day HH mm SS CS
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
NSCDRV.B.START .EQ *
|
NSCDRV.B.START .EQ *
|
||||||
NSCDRV php
|
NSCDRV php
|
||||||
sei
|
sei
|
||||||
sta $CFFF Make cards release $C8xx space
|
|
||||||
|
lda RDC3ROM
|
||||||
|
php
|
||||||
|
|
||||||
|
* sta CLRC8ROM Make cards release $C8xx space
|
||||||
|
sta SETC3ROM
|
||||||
|
|
||||||
sta $C300
|
sta $C300
|
||||||
lda $C304 Reset DS1216E comparison register with READ A2=1
|
lda $C304 Reset DS1216E comparison register with READ A2=1
|
||||||
ldy #7 Read 8 bytes...
|
|
||||||
|
|
||||||
NSCDRV.1
|
ldx #8 Read 8 bytes...
|
||||||
NSCDRV.R1 lda DS1216E.PATTERN,y
|
|
||||||
|
NSCDRV.1 ldy #8 ....of 8 bits
|
||||||
|
|
||||||
|
NSCDRV.R1 lda DS1216E.PATTERN-1,y
|
||||||
phy
|
phy
|
||||||
ldy #8 ....of 8 bits
|
|
||||||
|
|
||||||
NSCDRV.2 ldx #0
|
|
||||||
lsr
|
|
||||||
bcc NSCDRV.21
|
|
||||||
inx
|
|
||||||
|
|
||||||
NSCDRV.21 bit $C300,x Write Pattern bit in A0, with A2=0
|
NSCDRV.2 lsr
|
||||||
dey
|
bcs NSCDRV.21
|
||||||
|
|
||||||
|
NSCDRV.20 bit $C300
|
||||||
|
bra NSCDRV.22
|
||||||
|
|
||||||
|
NSCDRV.21 bit $C301 Write Pattern bit in A0, with A2=0
|
||||||
|
|
||||||
|
NSCDRV.22 dey
|
||||||
bne NSCDRV.2
|
bne NSCDRV.2
|
||||||
|
|
||||||
ply
|
|
||||||
dey
|
dey
|
||||||
bpl NSCDRV.1
|
bne NSCDRV.1
|
||||||
|
|
||||||
ldx #7
|
ldx #8
|
||||||
|
|
||||||
NSCDRV.4 ldy #8
|
NSCDRV.4 ldy #8
|
||||||
NSCDRV.5 lda $C304 Read Byte...
|
|
||||||
|
NSCDRV.5 pha
|
||||||
|
lda $C304 Read Byte...
|
||||||
|
|
||||||
lsr
|
lsr
|
||||||
NSCDRV.R2 ror DS1216E.DATA,x
|
ror
|
||||||
|
|
||||||
dey
|
dey
|
||||||
bne NSCDRV.5
|
bne NSCDRV.5
|
||||||
|
|
||||||
NSCDRV.R3 lda DS1216E.DATA,x
|
|
||||||
pha
|
pha
|
||||||
lsr
|
lsr
|
||||||
lsr
|
lsr
|
||||||
|
@ -222,13 +260,12 @@ NSCDRV.6 adc #$0A
|
||||||
dey
|
dey
|
||||||
bpl NSCDRV.6
|
bpl NSCDRV.6
|
||||||
|
|
||||||
NSCDRV.R4 sta DS1216E.DATA,x
|
NSCDRV.R4 sta DS1216E.DATA-1,x
|
||||||
dex
|
dex
|
||||||
bpl NSCDRV.4
|
bne NSCDRV.4
|
||||||
NSCDRV.R5 lda DS1216E.DATA+4 Get HH
|
|
||||||
sta TIMELO+1
|
pha
|
||||||
NSCDRV.R6 lda DS1216E.DATA+5 Get mm
|
|
||||||
sta TIMELO
|
|
||||||
NSCDRV.R7 lda DS1216E.DATA+1 Get MM
|
NSCDRV.R7 lda DS1216E.DATA+1 Get MM
|
||||||
asl
|
asl
|
||||||
asl
|
asl
|
||||||
|
@ -237,15 +274,27 @@ NSCDRV.R7 lda DS1216E.DATA+1 Get MM
|
||||||
asl
|
asl
|
||||||
NSCDRV.R8 ora DS1216E.DATA+2 Get DD
|
NSCDRV.R8 ora DS1216E.DATA+2 Get DD
|
||||||
sta DATELO
|
sta DATELO
|
||||||
NSCDRV.R9 lda DS1216E.DATA Get YY
|
|
||||||
|
* NSCDRV.R9 lda DS1216E.DATA Get YY
|
||||||
|
|
||||||
|
pla
|
||||||
rol
|
rol
|
||||||
sta DATELO+1
|
sta DATELO+1
|
||||||
|
|
||||||
|
NSCDRV.R5 lda DS1216E.DATA+4 Get HH
|
||||||
|
sta TIMELO+1
|
||||||
|
NSCDRV.R6 lda DS1216E.DATA+5 Get mm
|
||||||
|
sta TIMELO
|
||||||
|
|
||||||
plp
|
plp
|
||||||
|
bmi .8
|
||||||
|
|
||||||
|
sta CLRC3ROM
|
||||||
|
|
||||||
|
.8 plp
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
DS1216E.PATTERN .HS 5CA33AC55CA33AC5 Reverted 7->0
|
DS1216E.PATTERN .HS 5CA33AC55CA33AC5 Reverted 7->0
|
||||||
DS1216E.DATA .BS 8 Reverted YY MM DD Day HH mm SS CS
|
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
.LIST ON
|
.LIST ON
|
||||||
NSCDRV.SIZE .EQ *-NSCDRV.B.START
|
NSCDRV.SIZE .EQ *-NSCDRV.B.START
|
||||||
|
@ -254,7 +303,7 @@ NSCDRV.SIZE .EQ *-NSCDRV.B.START
|
||||||
* CONTROL SECTION :
|
* CONTROL SECTION :
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
.DO NSCDRV.SIZE>125
|
.DO NSCDRV.SIZE>125
|
||||||
* ERROR:NSCDRV.SIZE too big
|
ERROR:NSCDRV.SIZE too big
|
||||||
.FIN
|
.FIN
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
MAN
|
MAN
|
||||||
|
|
Loading…
Reference in New Issue
Block a user