SH:new ALIAS cmd, new && operator

MKDIR:completely implemented
LS/RM/MV/CP: combined switches
KERNEL:SList API now handle options to handle several languages/parsers
This commit is contained in:
burniouf 2022-10-07 21:21:37 +02:00
parent 89af12918a
commit 04a83f00f3
61 changed files with 2383 additions and 1680 deletions

View File

@ -24,6 +24,23 @@ exists, thus return value is limited to
whether or not a valid argument was
given.
# MKDIR
Create directories
*
## Arguments
**-M mode**
Apply specified mode to created directories
*
**-P**
Create parent directories if required
*
**-V**
Verbose mode
*
## Return Value
# SEQ
Prints sequences of numbers.
*

View File

@ -375,6 +375,13 @@ Add Data to MD5 computation
CS :
A = EC
# Free
Y,A = Ptr To Free
## RETURN VALUE
none.
(X unmodified)
# FreeMem
A = hMem To Free
@ -414,22 +421,6 @@ Y,A = PTR to MemBlock
none.
(X,Y unmodified)
# GetStkObj
## C
`int *ptr getstkobj (short int hStkObj);`
## ASM
`lda hStkObj`
`>SYSCALL GetStkObj`
## RETURN VALUE
CC : success
X = hMem
Y,A = ptr
CS : error
A = EC
# Online
Get ProDOS Volume Info
@ -531,17 +522,6 @@ A = Child PSID
## RETURN VALUE
# LoadStkObj
Load a file in AUX memory (Stock Objects)
PUSHW = PATH (Handled by....
PUSHB = MODE ...
PUSHB = TYPE ...
PUSHW = AUXTYPE ...FOpen)
## RETURN VALUE
Y,A = File Length
X = hMem of Loaded Object in AUX mem
# LoadTxtFile
Load TXT a file in memory (with ending 0)
@ -716,7 +696,7 @@ CS : not found
`>PUSHB hSList`
`>PUSHW KeyID`
`>PUSHW DataPtr`
`>PUSHW DataLen`
`>PUSHW DataLen` (Data bytes to add, 0 if String mode)
`>SYSCALL SListAddData`
## RETURN VALUE
@ -727,7 +707,7 @@ CS : not found
`>PUSHB hSList`
`>PUSHW KeyID`
`>PUSHW DataPtr`
`>PUSHW DataLen`
`>PUSHW DataLen` (Data bytes to set, 0 if String mode)
`>SYSCALL SListSetData`
## RETURN VALUE
@ -776,6 +756,7 @@ CS : not found
# SListNew
## ASM
`lda Opt`
`>SYSCALL SListNew`
## RETURN VALUE
@ -1392,6 +1373,33 @@ if expanded == null
if expanded = null
Y,A = strlen
# LoadStkObj
Load a file in AUX memory (Stock Objects)
PUSHW = PATH (Handled by....
PUSHB = MODE ...
PUSHB = TYPE ...
PUSHW = AUXTYPE ...FOpen)
## RETURN VALUE
Y,A = File Length
X = hMem of Loaded Object in AUX mem
# GetStkObj
## C
`int *ptr getstkobj (short int hStkObj);`
## ASM
`lda hStkObj`
`>SYSCALL GetStkObj`
## RETURN VALUE
CC : success
X = hMem
Y,A = ptr
CS : error
A = EC
# StrLen
Returns Length of C-String
@ -1544,7 +1552,7 @@ CS : no match
Get System Time in Buffer
## C
`int time (S.TIME* timer);`
`void time (struct tm* timeptr);`
## ASM
`>PUSHW timer`
@ -1557,7 +1565,7 @@ S.TIME filled with System date/time
## C
Convert S.TIME struct to CSTR
`void strftime (char* str, const char* format, const struct S.TIME* timeptr );`
`void strftime (char* str, const char* format, const struct tm* timeptr );`
## ASM
`>PUSHW str`
@ -1587,7 +1595,7 @@ Convert S.TIME struct to CSTR
Convert ProDOS Time To S.TIME
## C
`int PTime2Time (long* ptime, S.TIME* timer);`
`void PTime2Time (long* ptime, const struct tm* timeptr );`
## ASM
`>PUSHW ptime`
@ -1600,7 +1608,7 @@ Convert S.TIME struct to CSTR
Convert CTime Time To S.TIME
## C
`int CTime2Time (long* ctime, S.TIME* timer);`
`void CTime2Time (long* ctime, const struct tm* timeptr );`
## ASM
`>PUSHW ctime`

View File

@ -16,7 +16,7 @@ Initialize screen & create a new context
CC = success, A = hCTX
# tuiClose
destroy context and all sub objects
destroy context
## C
`void fastcall tuiClose(short int hCTX);`

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -43,7 +43,7 @@ CORE.Init lda #SL._
* clc
.9 rts
*--------------------------------------
CORE.Quit jsr CC.FIO.FClose
CORE.Quit jsr FIO.FClose
bne CORE.Quit
ldy ScopeIdx
@ -77,7 +77,7 @@ CORE.Quit jsr CC.FIO.FClose
>LDA.G CC.hSymBuf
jsr .7
.5 jsr CC.SYM.LookupFree
.5 jsr SYM.LookupFree
bcc .5
>LDA.G CC.hStack
@ -88,7 +88,8 @@ CORE.Quit jsr CC.FIO.FClose
.8 rts
*--------------------------------------
CC.CompileFile >SLEEP
CORE.CompileFile
>SLEEP
ldy #S.PS.hStdIn
lda (pPS),y
@ -104,22 +105,23 @@ CC.CompileFile >SLEEP
cmp #3 Ctrl-C
beq .9
.1 jsr CC.FIO.FGetS
.1 jsr FIO.FGetS
bcs .9
jsr CC.CompileLine
jsr CORE.CompileLine
bcs .9
>LDA.G bDebug
bpl CC.CompileFile
bpl CORE.CompileFile
jsr PrintDebugMsg
bra CC.CompileFile
bra CORE.CompileFile
.9 rts
*--------------------------------------
CC.CompileLine jsr CC.GetCharNB
CORE.CompileLine
jsr CC.GetCharNB
bcs .9
cmp #C.CR EOL....
@ -128,44 +130,45 @@ CC.CompileLine jsr CC.GetCharNB
cmp #'#' directive ?
bne .1
jmp CC.DIR
jmp DIR
.1 cmp #'/'
bne .2 comments ...
jmp CC.Comments
jmp CORE.Comments
.2 cmp #'}' End of CPStmt ?
bne .3
jsr CC.GetNextCharNB Skip '}'
jsr CORE.GetNCharNB Skip '}'
jsr CC.STMT.CPStmt.END
bcs .9
bra CC.CompileLine
bra CORE.CompileLine
.3 cmp #';' End of Stmt ?
bne .4
jsr CC.GetNextCharNB Skip ';'
jsr CORE.GetNCharNB Skip ';'
jsr CC.STMT.Stmt.END
bcs .9
bra CC.CompileLine
bra CORE.CompileLine
.4 jsr CC.CompileStmt
.4 jsr CORE.CompileStmt
bcs .9
bra CC.CompileLine
bra CORE.CompileLine
.8 clc
.9 rts
*--------------------------------------
* keyword : for, while ....
*--------------------------------------
CC.CompileStmt >LDYA L.CC.KW
CORE.CompileStmt
>LDYA L.CC.KW
jsr CC.LookupID
bcs .1 not an internal CC keyword....
@ -185,31 +188,31 @@ CC.CompileStmt >LDYA L.CC.KW
jsr CC.LookupID
bcs .3
jmp CC.DECL
jmp DECL.X
*--------------------------------------
* Statement : ++var, var=, func();
*--------------------------------------
.3 jmp CC.STMT
.3 jmp STMT.Get
*--------------------------------------
.99 lda #E.CSYN
sec
.9 rts
*--------------------------------------
CC.Comments jsr CC.GetNextChar TODO : /* ... */
CORE.Comments jsr CC.GetNextChar TODO : /* ... */
cmp #'/'
bne .90
jmp CC.SkipLine skip line.....
jmp CORE.SkipLine skip line.....
.90 lda #E.CSYN
sec
rts
*--------------------------------------
CC.SkipLine jsr CC.GetNextChar
CORE.SkipLine jsr CC.GetNextChar
bcs .9
cmp #C.CR
bne CC.SkipLine
bne CORE.SkipLine
clc
@ -447,44 +450,44 @@ CC.GetIDLen ldy #0
rts
*--------------------------------------
CC.GetCharNB jsr CC.GetChar
bcs CC.GetNextCharNB.RTS
bcs CORE.GetNCharNB.RTS
jsr CC.CheckCharNB
bcc CC.GetNextCharNB.RTS
bcc CORE.GetNCharNB.RTS
*--------------------------------------
CC.GetNextCharNB
jsr CC.GetNextChar
bcs CC.GetNextCharNB.RTS
CORE.GetNCharNB jsr CC.GetNextChar
bcs CORE.GetNCharNB.RTS
jsr CC.CheckCharNB
bcs CC.GetNextCharNB
bcs CORE.GetNCharNB
CC.GetNextCharNB.RTS
CORE.GetNCharNB.RTS
rts
*--------------------------------------
CC.GetCharNBNL jsr CC.GetChar
bcs CC.GetNextCharNB.RTS
CORE.GetCharNBNL
jsr CC.GetChar
bcs CORE.GetNCharNB.RTS
jsr CC.CheckCharNB
bcs CC.GetNextCharNBNL
bcs CORE.GetNCharNBNL
cmp #C.CR
clc
bne CC.GetNextCharNB.RTS
bne CORE.GetNCharNB.RTS
jsr CC.FIO.FGetS
bcs CC.GetNextCharNB.RTS
jsr FIO.FGetS
bcs CORE.GetNCharNB.RTS
*--------------------------------------
CC.GetNextCharNBNL
jsr CC.GetNextCharNB
bcs CC.GetNextCharNB.RTS
CORE.GetNCharNBNL
jsr CORE.GetNCharNB
bcs .9
cmp #C.CR
clc
bne .9
jsr CC.FIO.FGetS
bcc CC.GetNextCharNBNL
jsr FIO.FGetS
bcc CORE.GetCharNBNL
.9 rts
*--------------------------------------
@ -494,7 +497,7 @@ CC.CheckSpace jsr CC.GetChar
cmp #C.SPACE
bne .90
jsr CC.GetNextCharNB
jsr CORE.GetNCharNB
bcc .99
.90 lda #E.CSYN

View File

@ -1,16 +1,15 @@
NEW
AUTO 3,1
*--------------------------------------
CC.SCSPEC.AUTO
CC.SCSPEC.REGISTER
CC.SCSPEC.STATIC
CC.SCSPEC.EXTERN
DECL.AUTO
DECL.REGISTER
DECL.STATIC
DECL.EXTERN
.98 lda #E.CSYN
sec
.99 rts
*--------------------------------------
CC.SCSPEC.TYPEDEF
jsr CC.GetNextCharNB
DECL.TYPEDEF jsr CORE.GetNCharNB
bcs .98
>LDYA L.CC.TYPEQUAL
@ -20,12 +19,12 @@ CC.SCSPEC.TYPEDEF
cpx #4 no const nor volatile
bcc .98
jsr CC.TYPE.Decl
jsr TYPE.GetTQInYA
bcs .99
ldx #SYM.SC.TYPEDEF
sec Reset Buffer
jsr CC.SYM.New Y,A=T/Q,storage class TYPEDEF
jsr SYM.New Y,A=T/Q,storage class TYPEDEF
bcs .99
jsr CC.GetCharNB
@ -34,24 +33,63 @@ CC.SCSPEC.TYPEDEF
cmp #';'
bne .98
jsr CC.GetNextCharNB skip ';'
jsr CORE.GetNCharNB skip ';'
jmp CC.SYM.Store
jmp SYM.Store
.98 lda #E.CSYN
sec
.99
CC.SCSPEC.TYPEDEF.RTS
DECL.TYPEDEF.RTS
rts
*--------------------------------------
* X = type qual
*--------------------------------------
CC.DECL jsr CC.TYPE.Decl
bcs CC.SCSPEC.TYPEDEF.RTS
DECL.X jsr TYPE.GetTQInYA
bcs .99
cpy #SYM.T.SU
bne .7
sec Reset Buffer
tax save Q
jsr CC.GetCharNB
bcs .98
cmp #';' from a tag def
beq .8
CC.DECL.YAC ldx #SYM.SC.STATIC Y,A = Type/Qual
jsr CC.IsLetter
bcs .98
* >DEBUG
.1 clc reuse buffer
ldy #SYM.T.SU
txa restore Q
jsr DECL.YAC
bcs .99
jsr CC.GetCharNB
bcs .98
cmp #','
bne .2
jsr CORE.GetNCharNBNL
bcc .1
bcs .98
.2 cmp #';' TODO: struct initalizers
bne .98
.8 clc
rts
.98 lda #E.CSYN
sec
.99 rts
*--------------------------------------
.7 sec Reset Buffer
DECL.YAC ldx #SYM.SC.STATIC Y,A = Type/Qual
bit bLocalScope
bpl .25
@ -60,7 +98,7 @@ CC.DECL.YAC ldx #SYM.SC.STATIC Y,A = Type/Qual
ldx #SYM.SC.AUTO
.25 jsr CC.SYM.New Y,A=T/Q, add with undef value...
.25 jsr SYM.New Y,A=T/Q, X=SC, C=clear/reuse
bcs .98 OOM or DUP
.22 jsr CC.GetCharNB
@ -72,31 +110,31 @@ CC.DECL.YAC ldx #SYM.SC.STATIC Y,A = Type/Qual
cmp #'{'
bne .26
jsr CC.GetNextCharNB skip '{'
jsr CORE.GetNCharNB skip '{'
bcs .98
jmp CC.SYM.StoreF
jmp SYM.StoreF
*--------------------------------------
* Initializer
*--------------------------------------
.26 cmp #'=' type var = value ?
bne .98
jsr CC.GetNextCharNB skip '='
jsr CORE.GetNCharNB skip '='
bcs .98
jsr CC.SYM.GetTypeInYA expected T/Q
jsr CC.EXP.Eval
jsr SYM.GetTypeInYA expected T/Q
jsr EXP.Eval
bcs .99
jsr CC.SYM.GetAddr1
jsr SYM.GetAddr1
bcs .99
jsr CC.SYM.GetTypeInYA Y,A = T/Q
jsr CC.SYM.PopValue Set value to this var
jsr SYM.GetTypeInYA Y,A = T/Q
jsr SYM.PopValue Set value to this var
.29 bcs .99
.28 jsr CC.SYM.Store
.28 jsr SYM.Store
bcs .99
jsr CC.GetCharNB

View File

@ -1,15 +1,10 @@
NEW
AUTO 3,1
*--------------------------------------
CC.DIR jsr CC.GetNextCharNB
bcs .99
DIR jsr CORE.GetNCharNB
bcs .91
cmp #'!' #!/bin/cc
bne .1
jmp CC.SkipLine
.1 >LDYA L.CC.DIRS
>LDYA L.CC.DIRS
jsr CC.LookupID
bcs .91
@ -19,7 +14,7 @@ CC.DIR jsr CC.GetNextCharNB
sec
.99 rts
*--------------------------------------
CC.DIR.DEFINE clc
DIR.DEFINE clc
bit bPass2
bmi .8
@ -31,7 +26,7 @@ CC.DIR.DEFINE clc
ldx #SYM.SC.DEFINE
>LDA.G CC.hDefines
jsr CC.SYM.NewKey
jsr SYM.NewKey
bcs .99
>STYA ZPPtr1 SymID
@ -67,13 +62,13 @@ CC.DIR.DEFINE clc
>SYSCALL SListAddData
bcs .99
.8 jmp CC.SkipLine
.8 jmp CORE.SkipLine
.90 lda #E.CSYN
sec
.99 rts
*--------------------------------------
CC.DIR.INCLUDE lda #0 >STZ.G PathBuf
DIR.INCLUDE lda #0 >STZ.G PathBuf
sta (pData)
jsr CC.CheckSpace
@ -134,7 +129,10 @@ CC.DIR.INCLUDE lda #0 >STZ.G PathBuf
rts
.5 >LDYA pData
jmp CC.FIO.FOpen
jmp FIO.FOpen
*--------------------------------------
DIR.IFDEF
DIR.IFNDEF
*--------------------------------------
MAN
SAVE usr/src/bin/cc.s.dir

View File

@ -7,10 +7,10 @@ NEW
* CS, A = EC
* CC, Y,A = type/qual
*--------------------------------------
CC.EXP.Eval00 lda #0
EXP.Eval00 lda #0
tay
CC.EXP.Eval ldx ZPPtr1 local : returned T/Q
EXP.Eval ldx ZPPtr1 local : returned T/Q
phx
ldx ZPPtr1+1
phx
@ -40,20 +40,20 @@ CC.EXP.Eval ldx ZPPtr1 local : returned T/Q
cmp #'('
bne .20
jsr CC.GetNextCharNB skip (
jsr CORE.GetNCharNB skip (
bcs .19
>LDYA L.CC.TYPEQUAL
jsr CC.LookupID
bcs .12
jsr CC.EXP.Cast
jsr EXP.Cast
bcs .19
bra .20
*--------------------------------------
.12 >LDYA ZPPtr2 expected T/Q
jsr CC.EXP.Eval
jsr EXP.Eval
bcs .19
>STYA ZPPtr2 update T/Q
@ -64,10 +64,10 @@ CC.EXP.Eval ldx ZPPtr1 local : returned T/Q
cmp #')'
bne .19
jsr CC.GetNextCharNB skip )
jsr CORE.GetNCharNB skip )
bcc .31
.19 jmp CC.EXP.Eval.ESYN
.19 jmp EXP.Eval.ESYN
*--------------------------------------
.20 >LDYA L.CC.PREOPS
jsr CC.LookupOP
@ -82,7 +82,7 @@ CC.EXP.Eval ldx ZPPtr1 local : returned T/Q
jsr CC.GetDefine
bcc .10
jsr CC.SYM.Lookup
jsr SYM.Lookup
bcs .22
ldy #SYM.Q
@ -90,21 +90,21 @@ CC.EXP.Eval ldx ZPPtr1 local : returned T/Q
and #SYM.Q.FUNC
bne .21
jsr CC.EXP.GetVar Check T/Q & Get value on stack
jsr EXP.GetVar Check T/Q & Get value on stack
bcs .29
jsr CC.SYM.LookupFree
jsr SYM.LookupFree
bra .30
*--------------------------------------
.21 >LDYA ZPPtr2 get expected T/Q
jsr CC.F.CallRetV
jsr F.CallRetV
bcs .29
>STYA ZPPtr2 store real T/Q
jsr CC.SYM.LookupFree
jsr SYM.LookupFree
bra .30
*--------------------------------------
@ -118,7 +118,7 @@ CC.EXP.Eval ldx ZPPtr1 local : returned T/Q
sty ZPPtr2
stz ZPPtr2+1 Q
.23 jsr CC.EXP.GetNum
.23 jsr EXP.GetNum
bcs .29
bra .30
@ -126,29 +126,29 @@ CC.EXP.Eval ldx ZPPtr1 local : returned T/Q
.24 cmp #'''
bne .25
jsr CC.EXP.GetChar
jsr EXP.GetChar
bcs .29
bra .30
.25 cmp #'"' String literal
bne CC.EXP.Eval.ESYN
bne EXP.Eval.ESYN
jsr CC.EXP.AddConstCharP
.29 bcs CC.EXP.Eval.Err
jsr EXP.AddConstCharP
.29 bcs EXP.Eval.Err
*--------------------------------------
.30 jsr CC.GetCharNB
bcs CC.EXP.Eval.ESYN
bcs EXP.Eval.ESYN
.31 jsr CC.IsEndArg , ; ) ? :
bcc CC.EXP.Eval.End
bcc EXP.Eval.End
jsr CC.IsOPChar
bcs CC.EXP.Eval.ESYN
bcs EXP.Eval.ESYN
>LDYA L.CC.BOPS we are at V1 op1 V2 op2...
jsr CC.LookupOP
bcs CC.EXP.Eval.ESYN
bcs EXP.Eval.ESYN
stx ZPPtr3 save OP(n)
@ -159,10 +159,10 @@ CC.EXP.Eval ldx ZPPtr1 local : returned T/Q
bcc .38 OP(n) has precedence, on stack : V1,V2
>LDYA ZPPtr2 OP(n-1) has precedence...
jsr CC.EXP.BOPS compute V(n-1) <OP(n-1)> V(n)
jsr EXP.BOPS compute V(n-1) <OP(n-1)> V(n)
bcc .33
bcs CC.EXP.Eval.Err
bcs EXP.Eval.Err
.38 phx push back OP(n-1)
@ -171,28 +171,25 @@ CC.EXP.Eval ldx ZPPtr1 local : returned T/Q
jmp .10 go check for next token
*--------------------------------------
CC.EXP.Eval.End plx any OP on stack ?
bmi CC.EXP.Eval.Exit
EXP.Eval.End plx any OP on stack ?
bmi EXP.Eval.Exit
>LDYA ZPPtr2 Var Type
jsr CC.EXP.BOPS
bcc CC.EXP.Eval.End
jsr EXP.BOPS
bcc EXP.Eval.End
bra CC.EXP.Eval.Err
bra EXP.Eval.Err
*--------------------------------------
CC.EXP.Eval.ESYN
lda #E.ESYN
EXP.Eval.ESYN lda #E.ESYN
CC.EXP.Eval.Err
plx
bpl CC.EXP.Eval.Err
EXP.Eval.Err plx
bpl EXP.Eval.Err
sec
bra CC.EXP.Eval.ExitErr
bra EXP.Eval.ExitErr
*--------------------------------------
CC.EXP.Eval.Exit
lda ZPPtr1+1
EXP.Eval.Exit lda ZPPtr1+1
ldy ZPPtr1
bne .1
@ -201,7 +198,7 @@ CC.EXP.Eval.Exit
.1 and #$FC ignore SYM.Q.FUNC+SYM.Q.FASTCALL
clc
CC.EXP.Eval.ExitErr
EXP.Eval.ExitErr
plx
stx ZPPtr3+1
plx
@ -219,7 +216,7 @@ CC.EXP.Eval.ExitErr
rts
*--------------------------------------
CC.EXP.Cast jsr CC.TYPE.Decl
EXP.Cast jsr TYPE.GetTQInYA
bcs .99
>STYA ZPPtr1
@ -230,7 +227,7 @@ CC.EXP.Cast jsr CC.TYPE.Decl
cmp #')'
bne .9
jsr CC.GetNextCharNB skip )
jsr CORE.GetNCharNB skip )
clc
rts
@ -241,7 +238,7 @@ CC.EXP.Cast jsr CC.TYPE.Decl
*--------------------------------------
* Y,A = Type/Qual, X = OP
*--------------------------------------
CC.EXP.BOPS bit #SYM.Q.PPPOINTER
EXP.BOPS bit #SYM.Q.PPPOINTER
beq .10
ldy #SYM.T.UINT
@ -275,7 +272,7 @@ CC.EXP.BOPS bit #SYM.Q.PPPOINTER
clc
rts
*--------------------------------------
CC.EXP.IntConst >PUSHW ZPLineBufPtr
EXP.IntConst >PUSHW ZPLineBufPtr
>PUSHWI ZPLineBufPtr
>PUSHBI 10
>SYSCALL StrToUL
@ -290,7 +287,7 @@ CC.EXP.IntConst >PUSHW ZPLineBufPtr
rts
*--------------------------------------
CC.EXP.GetNum cpy #SYM.T.FLOAT
EXP.GetNum cpy #SYM.T.FLOAT
bcc .1
beq .11
@ -352,7 +349,7 @@ CC.EXP.GetNum cpy #SYM.T.FLOAT
* https://riptutorial.com/c/example/16255/character-literals
* 'c', '\n', '\123', '\xAB'
*--------------------------------------
CC.EXP.GetChar ldy ZPPtr2+1
EXP.GetChar ldy ZPPtr2+1
bne .9
lda ZPPtr2
@ -374,7 +371,7 @@ CC.EXP.GetChar ldy ZPPtr2+1
cmp #'''
bne .9
jsr CC.GetNextCharNB skip '
jsr CORE.GetNCharNB skip '
clc
@ -384,7 +381,7 @@ CC.EXP.GetChar ldy ZPPtr2+1
sec
.99 rts
*--------------------------------------
CC.EXP.AddConstCharP
EXP.AddConstCharP
lda ZPCCConst
ldx ZPCCConst+1
@ -415,7 +412,7 @@ CC.EXP.AddConstCharP
bra .1
.3 jsr CC.GetNextCharNBNL Skip "
.3 jsr CORE.GetNCharNBNL Skip "
bcs .8
cmp #'"'
@ -434,13 +431,13 @@ CC.EXP.AddConstCharP
* ZPPtr2 = expected T/Q
* ZPPtr3+1 = PREOPS
*--------------------------------------
CC.EXP.GetVar stz ExpState
EXP.GetVar stz ExpState
jsr CC.EXP.POSTOPS var++, var[0]... ?
jsr EXP.POSTOPS var++, var[0]... ?
bcs .99
ldx ZPPtr3+1 preop &, * ...
jsr CC.EXP.PREOPS
jsr EXP.PREOPS
bcs .99
lda ExpState
@ -453,7 +450,7 @@ CC.EXP.GetVar stz ExpState
asl
bmi .6 AonStack
jsr CC.EXP.GetAddr2
jsr EXP.GetAddr2
bcs .99
bra .7
@ -462,16 +459,16 @@ CC.EXP.GetVar stz ExpState
jsr CODE.EmitPCC
bcs .99
.7 jsr CC.EXP.PushValue
.7 jsr EXP.PushValue
bcs .99
.8 jmp CC.SYM.LookupCheckTQ
.8 jmp SYM.LookupCheckTQ
.99 rts
*--------------------------------------
* POSTOPS
*--------------------------------------
CC.EXP.POSTOPS >LDYA L.CC.POSTOPS
EXP.POSTOPS >LDYA L.CC.POSTOPS
jsr CC.LookupOP
bcs .8
@ -480,11 +477,11 @@ CC.EXP.POSTOPS >LDYA L.CC.POSTOPS
.8 clc
rts
*--------------------------------------
CC.EXP.postinc lda ExpState
EXP.postinc lda ExpState
bit #ExpState.AinPTR
bne .1
jsr CC.EXP.GetAddr2
jsr EXP.GetAddr2
bcs .99
lda #ExpState.AinPTR
@ -524,11 +521,11 @@ CC.EXP.postinc lda ExpState
sec
.99 rts
*--------------------------------------
CC.EXP.postdec lda ExpState
EXP.postdec lda ExpState
bit #ExpState.AinPTR
bne .1
jsr CC.EXP.GetAddr2
jsr EXP.GetAddr2
bcs .99
lda #ExpState.AinPTR
@ -568,11 +565,11 @@ CC.EXP.postdec lda ExpState
sec
.99 rts
*--------------------------------------
CC.EXP.Idx ldy #SYM.Q
EXP.Idx ldy #SYM.Q
lda (ZPLookupSymPtr),y
bit #SYM.Q.AAARRAY
bne CC.EXP.array
bne EXP.array
and #SYM.Q.PPPOINTER
cmp #SYM.Q.POINTER
@ -582,17 +579,17 @@ CC.EXP.Idx ldy #SYM.Q
eor #SYM.Q.POINTER+SYM.Q.ARRAY
sta (ZPLookupSymPtr),y convert from *type to type[]
jsr CC.EXP.GetAddr2
jsr EXP.GetAddr2
bcs .99
>LDYA L.PCC.PushDeref2
jsr CODE.EmitPCC
bcs .99
jsr CC.EXP.array.getIdx ...int16 on stack...
jsr EXP.array.getIdx ...int16 on stack...
bcs .99
jsr CC.EXP.GetSymSizeOfInAXC
jsr EXP.GetSymSizeOfInAXC
cmp #1
bne .1
@ -616,7 +613,7 @@ CC.EXP.Idx ldy #SYM.Q
cmp #']'
bne .97
jsr CC.GetNextCharNB skip ']'
jsr CORE.GetNCharNB skip ']'
lda #ExpState.AonStack
sta ExpState
@ -632,28 +629,28 @@ CC.EXP.Idx ldy #SYM.Q
sec
.99 rts
*--------------------------------------
CC.EXP.array ldy #SYM.Def
EXP.array ldy #SYM.Def
lda (ZPLookupSymPtr),y
iny
ora (ZPLookupSymPtr),y
beq .1
* jsr CODE.DEBUG
jsr CC.EXP.PushAddr array[int]...
jsr EXP.PushAddr array[int]...
bcc .2
rts
.1 jsr CC.EXP.GetAddr2 array[]...it is a *
.1 jsr EXP.GetAddr2 array[]...it is a *
bcs .9
>LDYA L.PCC.PushDeref2
jsr CODE.EmitPCC
bcs .9
.2 jsr CC.EXP.array.getIdx ...int16 on stack...
.2 jsr EXP.array.getIdx ...int16 on stack...
bcs .9
jsr CC.EXP.GetSymSizeOfInAXC
jsr EXP.GetSymSizeOfInAXC
jsr CODE.PUSHAXI ...sizeof on stack...
bcs .9
@ -665,13 +662,13 @@ CC.EXP.array ldy #SYM.Def
jsr CODE.FPUCALL ...add to base address
bcs .9
.3 jsr CC.GetNextCharNB skip ']'
.3 jsr CORE.GetNCharNB skip ']'
bcs .98
cmp #'['
bne .8
jsr CC.GetNextCharNB skip '['
jsr CORE.GetNCharNB skip '['
bcs .98
ldy #SYM.Q
@ -679,7 +676,7 @@ CC.EXP.array ldy #SYM.Def
and #SYM.Q.AAARRAY
.39 beq .99
jsr CC.EXP.array.getIdx ...int16 on stack...
jsr EXP.array.getIdx ...int16 on stack...
bcs .9
ldy #SYM.Def+3
@ -692,7 +689,7 @@ CC.EXP.array ldy #SYM.Def
ldx #FPU.wMUL
jsr CODE.FPUCALL [][SIZE] * int16 on stack
jsr CC.EXP.GetSymSizeOfInAXC
jsr EXP.GetSymSizeOfInAXC
jsr CODE.PUSHAXI ...sizeof on stack...
bcs .9
@ -703,7 +700,7 @@ CC.EXP.array ldy #SYM.Def
jsr CODE.FPUCALL ...add to base address
bcs .9
jsr CC.GetNextCharNB skip ']'
jsr CORE.GetNCharNB skip ']'
bcs .98
@ -723,11 +720,11 @@ CC.EXP.array ldy #SYM.Def
sec
.9 rts
*--------------------------------------
CC.EXP.array.getIdx
EXP.array.getIdx
ldy #SYM.T.SINT
lda #0
jsr CC.EXP.Eval
jsr EXP.Eval
bcs .9
jsr CC.GetCharNB
@ -749,7 +746,7 @@ CC.EXP.array.getIdx
sec
.9 rts
*--------------------------------------
CC.EXP.SU lda (ZPLookupSymPtr)
EXP.SU lda (ZPLookupSymPtr)
cmp #SYM.T.SU
bne .97
@ -764,7 +761,7 @@ CC.EXP.SU lda (ZPLookupSymPtr)
jsr CC.IsLetter
bcs .98
jsr CC.EXP.SU.GetF
jsr EXP.SU.GetF
bcs .98
jsr CC.SkipX
@ -789,7 +786,7 @@ CC.EXP.SU lda (ZPLookupSymPtr)
ply
iny
lda (ZPLookupSymPtr),y SU.F.O
lda (ZPLookupSymPtr),y SU.F.O+1
ldy #SYM.Addr+1
adc (ZPLookupSymPtr),y
sta (ZPLookupSymPtr),y
@ -805,11 +802,11 @@ CC.EXP.SU lda (ZPLookupSymPtr)
sec
.99 rts
*--------------------------------------
CC.EXP.pSU lda #E.ESYN
EXP.pSU lda #E.ESYN
sec
rts
*--------------------------------------
CC.EXP.SU.GetF jsr CC.GetIDLen
EXP.SU.GetF jsr CC.GetIDLen
tya
tax
@ -875,27 +872,27 @@ CC.EXP.SU.GetF jsr CC.GetIDLen
*--------------------------------------
* PREOPS
*--------------------------------------
CC.EXP.PREOPS bmi .8
EXP.PREOPS bmi .8
jmp (J.CC.PREOPS,x)
.8 clc
rts
*--------------------------------------
CC.EXP.Ref ldy #SYM.Q
EXP.Ref ldy #SYM.Q
lda (ZPLookupSymPtr),y
clc
adc #SYM.Q.POINTER
bcs .9 more than ***
and #%11001111
* and #%11001111
sta (ZPLookupSymPtr),y
bit ExpState
bvs .8
jsr CC.EXP.PushAddr
jsr EXP.PushAddr
bcs .99
.8 lda #ExpState.VonStack
@ -908,7 +905,7 @@ CC.EXP.Ref ldy #SYM.Q
* sec
.99 rts
*--------------------------------------
CC.EXP.Deref ldy #SYM.Q
EXP.Deref ldy #SYM.Q
lda (ZPLookupSymPtr),y
bit #SYM.Q.PPPOINTER
beq .9
@ -917,7 +914,7 @@ CC.EXP.Deref ldy #SYM.Q
sbc #SYM.Q.POINTER
sta (ZPLookupSymPtr),y
jsr CC.EXP.GetAddr2
jsr EXP.GetAddr2
bcs .99
>LDYA L.PCC.Deref2
@ -934,43 +931,43 @@ CC.EXP.Deref ldy #SYM.Q
sec
.99 rts
*--------------------------------------
CC.EXP.Abs
EXP.Abs
clc
.99 rts
*--------------------------------------
CC.EXP.negate
EXP.negate
clc
.99 rts
*--------------------------------------
CC.EXP.lnot
EXP.lnot
clc
.99 rts
*--------------------------------------
CC.EXP.bnot
EXP.bnot
clc
.99 rts
*--------------------------------------
CC.EXP.preinc
EXP.preinc
clc
.99 rts
*--------------------------------------
CC.EXP.predec
EXP.predec
clc
.99 rts
*--------------------------------------
CC.EXP.PushAddr ldy #SYM.SC
EXP.PushAddr ldy #SYM.SC
lda (ZPLookupSymPtr),y
beq .1 SYM.SC.STATIC
* LOCAL
@ -1014,7 +1011,7 @@ CC.EXP.PushAddr ldy #SYM.SC
.9 rts
*--------------------------------------
CC.EXP.GetAddr1 ldy #SYM.SC
EXP.GetAddr1 ldy #SYM.SC
lda (ZPLookupSymPtr),y
beq .1 SYM.SC.STATIC
* LOCAL
@ -1052,7 +1049,7 @@ CC.EXP.GetAddr1 ldy #SYM.SC
.9 rts
*--------------------------------------
CC.EXP.GetAddr2 ldy #SYM.SC
EXP.GetAddr2 ldy #SYM.SC
lda (ZPLookupSymPtr),y
beq .1 SYM.SC.STATIC
* LOCAL
@ -1090,8 +1087,7 @@ CC.EXP.GetAddr2 ldy #SYM.SC
.9 rts
*--------------------------------------
CC.EXP.PushValue
jsr CC.EXP.GetSymSizeOfInAXC
EXP.PushValue jsr EXP.GetSymSizeOfInAXC
tay
dey
bne .1
@ -1115,7 +1111,7 @@ CC.EXP.PushValue
*--------------------------------------
* out : A,X,C = size
*--------------------------------------
CC.EXP.GetSymSizeOfInAXC
EXP.GetSymSizeOfInAXC
ldy #SYM.Q
lda (ZPLookupSymPtr),y
pha
@ -1123,7 +1119,7 @@ CC.EXP.GetSymSizeOfInAXC
tay
pla
CC.EXP.GetYASizeOfInAXC
EXP.GetYASizeOfInAXC
bit #SYM.Q.PPPOINTER+SYM.Q.AAARRAY
bne .1

View File

@ -1,7 +1,7 @@
NEW
AUTO 3,1
*--------------------------------------
CC.F.Decl stz LocalPtr
F.Decl stz LocalPtr
jsr CC.PushTQ push T/Q for RETURN
bcs .99
@ -10,21 +10,21 @@ CC.F.Decl stz LocalPtr
jsr CC.STMT.CPStmt.NEW
bcs .99
jsr CC.SYM.NewScope
jsr SYM.NewScope
bcs .99
jsr CC.GetNextCharNB Skip (
jsr CORE.GetNCharNB Skip (
bcs .9
cmp #')' func()
beq .6
*--------------------------------------
.1 jsr CC.F.DeclGetTQ
.1 jsr F.DeclGetTQ
bcs .99
>STYA ZPPtr2 Save T/Q
jsr CC.SYM.AddWord
jsr SYM.AddWord
bcs .99
jsr CC.GetCharNB
@ -33,7 +33,7 @@ CC.F.Decl stz LocalPtr
jsr CC.IsLetter
bcs .2
jsr CC.F.NewArg
jsr F.NewArg
bcs .99
jsr CC.GetCharNB
@ -45,24 +45,24 @@ CC.F.Decl stz LocalPtr
cmp #','
bne .9
jsr CC.GetNextCharNB Skip ,
jsr CORE.GetNCharNB Skip ,
bcc .1
.9 lda #E.CSYN
sec
.99 rts
*--------------------------------------
.6 jsr CC.SYM.Add0000 definition End
.6 jsr SYM.Add0000 definition End
bcs .99
jsr CC.GetNextCharNBNL Skip )
jsr CORE.GetNCharNBNL Skip ')'
bcs .9
cmp #';'
bne .7
jsr CC.SYM.FreeScope discard local scope
jsr SYM.FreeScope discard local scope
lda CStackPtr
clc
adc #8
@ -87,7 +87,7 @@ CC.F.Decl stz LocalPtr
.8 >LDYA ZPCCCode f() Code starts HERE
jsr CC.SYM.SetAddrYA
jsr SYM.SetAddrYA
lda LocalPtr
jsr CODE.LDAI A = f() ARGS size
@ -96,7 +96,7 @@ CC.F.Decl stz LocalPtr
>LDYA L.PCC.ENTER
jmp CODE.EmitPCC Store f() Declaration / Start Definition
*--------------------------------------
CC.F.DeclGetTQ lda (ZPLineBufPtr)
F.DeclGetTQ lda (ZPLineBufPtr)
cmp #'.'
bne .5
@ -111,7 +111,7 @@ CC.F.DeclGetTQ lda (ZPLineBufPtr)
dex
bne .1
jsr CC.GetNextCharNB
jsr CORE.GetNCharNB
bcs .9
eor #')'
@ -122,23 +122,27 @@ CC.F.DeclGetTQ lda (ZPLineBufPtr)
* clc
rts
*--------------------------------------
.5 >LDYA L.CC.TYPEQUAL
.5 jsr SYM.Lookup var or func() ?
bcs .6
ldy #SYM.SC
lda (ZPLookupSymPtr),y
cmp #SYM.SC.TYPEDEF
bne .9
jmp TYPE.GetTQInYA2
.6 >LDYA L.CC.TYPEQUAL
jsr CC.LookupID
bcs .9
jsr CC.TYPE.Decl
bcs .9
* Y,A = Type/Qual
bra .8
jmp TYPE.GetTQInYA
.9 lda #E.CSYN
sec
.8 rts
rts
*--------------------------------------
CC.F.NewArg >LDYA.G CC.SymID
F.NewArg >LDYA.G CC.SymID
>STYA.G CC.SymIDSave
>LEA.G CC.ArgBuf
@ -147,10 +151,10 @@ CC.F.NewArg >LDYA.G CC.SymID
>LDYA ZPPtr2
ldx #SYM.SC.AUTO
sec Reset Buffer
jsr CC.SYM.New
jsr SYM.New
bcs .9
jsr CC.SYM.StoreL Store f() Args in Local scope
jsr SYM.StoreL Store f() Args in Local scope
bcs .9
>LDA.G CC.hSymBuf
@ -162,11 +166,11 @@ CC.F.NewArg >LDYA.G CC.SymID
.9 rts
*--------------------------------------
CC.F.Def.END >LDYA L.PCC.LEAVE
F.Def.END >LDYA L.PCC.LEAVE
jsr CODE.EmitPCC
bcs .9
jsr CC.SYM.FreeScope
jsr SYM.FreeScope
stz LocalPtr back to global
@ -177,11 +181,11 @@ CC.F.Def.END >LDYA L.PCC.LEAVE
* in : ZPSymPtr
* Y,A = Expected T/Q
*--------------------------------------
CC.F.CallNoRetV ldy #0 no expected T/Q
F.CallNoRetV ldy #0 no expected T/Q
tya
clc
.HS B0 BCS
CC.F.CallRetV sec
F.CallRetV sec
ldx ZPPtr1 local : variadic size
phx
@ -202,13 +206,13 @@ CC.F.CallRetV sec
* lda (ZPLookupSymPtr),y
* beq .20 SYS/LIB/FPU call, no ret value space
jsr CC.EXP.GetSymSizeOfInAXC
jsr EXP.GetSymSizeOfInAXC
jsr CODE.nAddLocal
.20 jsr CC.GetNextCharNB skip '('
* >DEBUG
.20 jsr CORE.GetNCharNB skip '('
bcs .90
jsr CC.SYM.LookupCheckTQ
jsr SYM.LookupCheckTQ
bcs .93
*--------------------------------------
stz ZPPtr1 Reset VARIADIC byte count
@ -216,7 +220,7 @@ CC.F.CallRetV sec
lda #SYM.Def
>STA.G CC.LookupSymPtr
jsr CC.F.GetTQ get First Arg T/Q
jsr F.GetTQ get First Arg T/Q
beq .7 end of list, go check ending ')'
.3 cpy #SYM.T.VARIADIC
@ -227,13 +231,13 @@ CC.F.CallRetV sec
.4 and #$F0 CONST+VOLATILE+FUNC+FASTCALL
jsr CC.EXP.Eval
jsr EXP.Eval
bcs .93
jsr CC.EXP.GetYASizeOfInAXC
jsr EXP.GetYASizeOfInAXC
tax save Sizeof in X
jsr CC.F.GetTQ
jsr F.GetTQ
cpy #SYM.T.VARIADIC
bne .50 if VARIADIC, don't advance to next arg
@ -255,9 +259,9 @@ CC.F.CallRetV sec
cmp #','
bne .6
jsr CC.GetNextCharNBNL Skip ','
jsr CORE.GetNCharNBNL Skip ','
jsr CC.F.GetTQ
jsr F.GetTQ
bne .3 Another ARG....
bra .90 extra args....error
@ -265,7 +269,7 @@ CC.F.CallRetV sec
.6 cmp #')'
bne .90
jsr CC.F.GetTQ
jsr F.GetTQ
beq .8 no more arg after ')', exit
cpy #SYM.T.VARIADIC
@ -280,9 +284,9 @@ CC.F.CallRetV sec
cmp #')'
bne .90
.8 jsr CC.GetNextCharNB Skip )
.8 jsr CORE.GetNCharNB Skip )
jsr CC.F.Call2
jsr F.Call2
bra .93
.90 lda #E.CSYN
@ -303,14 +307,14 @@ CC.F.CallRetV sec
*--------------------------------------
* X = last var size
*--------------------------------------
CC.F.Call2 ldy #SYM.Q
F.Call2 ldy #SYM.Q
lda (ZPLookupSymPtr),y
and #SYM.Q.FASTCALL
beq .1
ldy #SYM.Def Get first (only) argument
jsr CC.F.GetTQAtY
jsr CC.TYPE.SizeOf
jsr F.GetTQAtY
jsr TYPE.SizeOf
dex
bne .19
@ -320,7 +324,7 @@ CC.F.Call2 ldy #SYM.Q
.19 jsr CODE.PULLYA
.1 jsr CC.F.Call3
.1 jsr F.Call3
bcs .9
bit ZPPtr1+1 bRetV
@ -329,7 +333,7 @@ CC.F.Call2 ldy #SYM.Q
* NO Return Value : call & discard stack if not in Y,A
>LDYA ZPPtr2 function T/Q
jsr CC.TYPE.SizeOf
jsr TYPE.SizeOf
txa
beq .11 void
@ -352,7 +356,7 @@ CC.F.Call2 ldy #SYM.Q
bcs .8 not a SYS/FPU/LIB call...Ret value on stack
>LDYA ZPPtr2 function T/Q
jsr CC.TYPE.SizeOf
jsr TYPE.SizeOf
cpx #3
bcs .8 leave on stack
@ -369,7 +373,7 @@ CC.F.Call2 ldy #SYM.Q
clc
rts
*--------------------------------------
CC.F.Call3 ldy #SYM.Addr+1
F.Call3 ldy #SYM.Addr+1
lda (ZPLookupSymPtr),y
beq .9
@ -427,10 +431,10 @@ CC.F.Call3 ldy #SYM.Addr+1
sec
.99 rts
*--------------------------------------
CC.F.GetTQ >LDA.G CC.LookupSymPtr
F.GetTQ >LDA.G CC.LookupSymPtr
tay
CC.F.GetTQAtY lda (ZPLookupSymPtr),y
F.GetTQAtY lda (ZPLookupSymPtr),y
pha
iny
lda (ZPLookupSymPtr),y

View File

@ -1,8 +1,7 @@
NEW
AUTO 3,1
*--------------------------------------
CC.FIO.LoadLIB.o
>LDA.G LibCount
FIO.LoadLIB.o >LDA.G LibCount
cmp #LIBS.MAX
bne .1
@ -57,10 +56,10 @@ CC.FIO.LoadLIB.o
.99 rts
*--------------------------------------
CC.FIO.FOpen1st >LDA.G CC.InFileArg
FIO.FOpen1st >LDA.G CC.InFileArg
>SYSCALL ArgV
CC.FIO.FOpen phy
FIO.FOpen phy
pha
>PUSHW L.MSG.READING
@ -100,7 +99,7 @@ CC.FIO.FOpen phy
.9 rts
*--------------------------------------
CC.FIO.FGetS >LDYA.G LineBufPtr
FIO.FGetS >LDYA.G LineBufPtr
>STYA ZPLineBufPtr
>LDA.G LineCntPtr
@ -134,7 +133,7 @@ CC.FIO.FGetS >LDYA.G LineBufPtr
.9 rts
*--------------------------------------
CC.FIO.FClose >LDA.G hFilePtr
FIO.FClose >LDA.G hFilePtr
cmp #hFilePtr
beq .8
@ -156,7 +155,7 @@ CC.FIO.FClose >LDA.G hFilePtr
.8 rts
*--------------------------------------
CC.FIO.FCreate lda ZPCCCode+1
FIO.FCreate lda ZPCCCode+1
sta PCC.FH+PCC.FH.CONST+1
sec
sbc #$20

View File

@ -3,7 +3,7 @@ NEW
*--------------------------------------
* Built in Keywords
*--------------------------------------
CC.KW.IF jsr CC.KW.BEGIN00
KW.IF jsr KW.BEGIN00
bcs .99
jsr CC.GetCharNB
@ -12,16 +12,16 @@ CC.KW.IF jsr CC.KW.BEGIN00
cmp #'('
bne .9
jsr CC.GetNextCharNB
jsr CORE.GetNCharNB
bcs .9
jsr CC.EXP.Eval00 Any var type
jsr EXP.Eval00 Any var type
bcs .99
jsr CC.KW.TestZero Y,A=T/Q
jsr KW.TestZero Y,A=T/Q
lda #'E'
jsr CC.SYM.LookupA
jsr SYM.LookupA
bcs .99
lda #$4C emit JMP else
@ -34,13 +34,13 @@ CC.KW.IF jsr CC.KW.BEGIN00
cmp #')'
bne .9
jmp CC.KW.STMT
jmp KW.STMT
.9 lda #E.CSYN
sec
.99 rts
*--------------------------------------
CC.KW.IF.END jsr CC.GetCharNBNL
KW.IF.END jsr CORE.GetCharNBNL
bcs .1
cmp #';'
@ -51,14 +51,14 @@ CC.KW.IF.END jsr CC.GetCharNBNL
bcc .2
.1 lda #'E' define ELSE Label
jsr CC.KW.NewLabel
jsr KW.NewLabel
bcs .99
clv pop context
rts
*--------------------------------------
.2 lda #'X'
jsr CC.SYM.LookupA
jsr SYM.LookupA
bcs .99
lda #$4C emit JMP exit
@ -66,7 +66,7 @@ CC.KW.IF.END jsr CC.GetCharNBNL
bcs .99
lda #'E' define ELSE Label
jsr CC.KW.NewLabel
jsr KW.NewLabel
bcs .99
inc CStackPtr pop ; or }
@ -75,7 +75,7 @@ CC.KW.IF.END jsr CC.GetCharNBNL
ldy CStackPtr
sta (ZPCCStack),y
jsr CC.KW.STMT
jsr KW.STMT
bcs .99
bit .99 set V : DONT pop context
@ -85,22 +85,22 @@ CC.KW.IF.END jsr CC.GetCharNBNL
sec
.99 rts
*--------------------------------------
CC.KW.ELSE lda #E.CSYN illegal
KW.ELSE lda #E.CSYN illegal
sec
rts
*--------------------------------------
CC.KW.ELSE.END lda #'X' define EXIT Label
jsr CC.KW.NewLabel
KW.ELSE.END lda #'X' define EXIT Label
jsr KW.NewLabel
bcs .99
clv pop context
.99 rts
*--------------------------------------
CC.KW.WHILE jsr CC.KW.BEGIN00
KW.WHILE jsr KW.BEGIN00
bcs .99
lda #'C' define CONT Label
jsr CC.SYM.NewA
jsr SYM.NewA
bcs .99
jsr CC.GetCharNB
@ -109,16 +109,16 @@ CC.KW.WHILE jsr CC.KW.BEGIN00
cmp #'('
bne .9
jsr CC.GetNextCharNB
jsr CORE.GetNCharNB
bcs .9
jsr CC.EXP.Eval00 Any var type
jsr EXP.Eval00 Any var type
bcs .99
jsr CC.KW.TestZero
jsr KW.TestZero
lda #'B'
jsr CC.SYM.LookupA
jsr SYM.LookupA
bcs .99
lda #$4C emit JMP break:
@ -131,14 +131,14 @@ CC.KW.WHILE jsr CC.KW.BEGIN00
cmp #')'
bne .9
jmp CC.KW.STMT
jmp KW.STMT
.9 lda #E.CSYN
sec
.99 rts
*--------------------------------------
CC.KW.WHILE.END lda #'C'
jsr CC.KW.GetLabel
KW.WHILE.END lda #'C'
jsr KW.GetLabel
bcs .99
lda #$4C
@ -146,25 +146,25 @@ CC.KW.WHILE.END lda #'C'
bcs .99
lda #'B' define BREAK Label
jsr CC.KW.NewLabel
jsr KW.NewLabel
bcs .99
clv pop context
.99 rts
*--------------------------------------
CC.KW.DO jsr CC.KW.BEGIN00
KW.DO jsr KW.BEGIN00
bcs .99
lda #'C' define CONT Label
jsr CC.SYM.NewA
jsr SYM.NewA
bcs .99
jmp CC.KW.STMT
jmp KW.STMT
.99 rts
*--------------------------------------
CC.KW.DO.END >LDYA L.CC.KW2.DO Check allowed KW for DO....
KW.DO.END >LDYA L.CC.KW2.DO Check allowed KW for DO....
jsr CC.LookupID
bcs .9
@ -174,16 +174,16 @@ CC.KW.DO.END >LDYA L.CC.KW2.DO Check allowed KW for DO....
cmp #'('
bne .9
jsr CC.GetNextCharNB
jsr CORE.GetNCharNB
bcs .9
jsr CC.EXP.Eval00 Any var type
jsr EXP.Eval00 Any var type
bcs .99
jsr CC.KW.TestnZero
jsr KW.TestnZero
lda #'C'
jsr CC.KW.GetLabel
jsr KW.GetLabel
bcs .99
lda #$4C emit JMP cont
@ -191,7 +191,7 @@ CC.KW.DO.END >LDYA L.CC.KW2.DO Check allowed KW for DO....
bcs .99
lda #'B' define BREAK Label
jsr CC.KW.NewLabel
jsr KW.NewLabel
bcs .99
jsr CC.GetCharNB
@ -200,7 +200,7 @@ CC.KW.DO.END >LDYA L.CC.KW2.DO Check allowed KW for DO....
cmp #')'
bne .9
jsr CC.GetNextCharNB
jsr CORE.GetNCharNB
bcs .9
clv pop context
@ -227,31 +227,31 @@ CC.KW.DO.END >LDYA L.CC.KW2.DO Check allowed KW for DO....
* break:
* }
*--------------------------------------
CC.KW.FOR jsr CC.GetCharNB
KW.FOR jsr CC.GetCharNB
bcs .29
cmp #'('
bne .29
jsr CC.KW.BEGIN00
jsr KW.BEGIN00
bcs .29
jsr CC.GetNextCharNB skip '('
jsr CORE.GetNCharNB skip '('
bcs .29
>LDYA L.CC.TYPEQUAL
jsr CC.LookupID
bcs .1
jsr CC.DECL
jsr DECL.X
bcc .2
.19 rts
.1 jsr CC.STMT get s1
.1 jsr STMT.Get get s1
bcs .19
* jsr CC.KW.StackDiscard
* jsr KW.StackDiscard
.2 jsr CC.GetCharNB
bcs .9
@ -259,28 +259,28 @@ CC.KW.FOR jsr CC.GetCharNB
cmp #';'
bne .9
jsr CC.GetNextCharNB skip ';'
jsr CORE.GetNCharNB skip ';'
bcs .9
*--------------------------------------
lda #'L' LOOP Label
jsr CC.SYM.NewA
jsr SYM.NewA
bcs .99
jsr CC.EXP.Eval00 get e2
jsr EXP.Eval00 get e2
.29 bcs .99
jsr CC.KW.TestZero
jsr KW.TestZero
bcs .99
lda #'B'
jsr CC.SYM.LookupA
jsr SYM.LookupA
bcs .99
lda #$4C emit JMP break:
jsr CODE.TOABSYX
lda #'S'
jsr CC.SYM.LookupA
jsr SYM.LookupA
bcs .99
lda #$20 emit JSR s:
@ -292,17 +292,17 @@ CC.KW.FOR jsr CC.GetCharNB
cmp #';'
bne .9
jsr CC.GetNextCharNB skip ';'
jsr CORE.GetNCharNB skip ';'
bcs .9
*--------------------------------------
lda #'C' CONT Label
jsr CC.SYM.NewA
jsr SYM.NewA
bcs .99
jsr CC.STMT get s3
jsr STMT.Get get s3
bcs .99
* jsr CC.KW.StackDiscard
* jsr KW.StackDiscard
jsr CC.GetCharNB
bcs .9
@ -311,45 +311,45 @@ CC.KW.FOR jsr CC.GetCharNB
bne .9
lda #'L'
jsr CC.SYM.LookupA
jsr SYM.LookupA
bcs .99
lda #$4C
jsr CODE.TOABSYX emit JMP loop
lda #'S' S Label
jsr CC.SYM.NewA
jsr SYM.NewA
bcs .99
jmp CC.KW.STMT
jmp KW.STMT
.9 lda #E.CSYN
sec
.99 rts
*--------------------------------------
CC.KW.FOR.END lda #$60
KW.FOR.END lda #$60
jsr CODE.EmitByte set RTS for JSR code;
bcs .99
lda #'B' define BREAK Label
jsr CC.KW.NewLabel
jsr KW.NewLabel
bcs .99
clv pop context
.99 rts
*--------------------------------------
CC.KW.SWITCH jsr CC.GetCharNB
KW.SWITCH jsr CC.GetCharNB
bcs .98
cmp #'('
bne .98
jsr CC.GetNextCharNB
jsr CORE.GetNCharNB
bcs .98
jsr CC.EXP.Eval00 Any var type
jsr EXP.Eval00 Any var type
bcs .99 Y,A=T/Q
tax
@ -372,7 +372,7 @@ CC.KW.SWITCH jsr CC.GetCharNB
jsr CC.Push push SizeOf(type)
bcs .99
jsr CC.KW.BEGIN
jsr KW.BEGIN
bcs .99
jsr CC.GetCharNB
@ -381,7 +381,7 @@ CC.KW.SWITCH jsr CC.GetCharNB
cmp #')'
bne .98
jmp CC.KW.STMT
jmp KW.STMT
.97 lda #E.TMISMATCH
sec
@ -391,16 +391,16 @@ CC.KW.SWITCH jsr CC.GetCharNB
sec
.99 rts
*--------------------------------------
CC.KW.SWITCH.END
KW.SWITCH.END
lda #'B' define BREAK Label
jsr CC.KW.NewLabel
jsr KW.NewLabel
bcs .99
clv pop context
.99 rts
*--------------------------------------
CC.KW.CASE ldy CStackPtr
KW.CASE ldy CStackPtr
beq .9
iny skip ; or }
@ -417,7 +417,7 @@ CC.KW.CASE ldy CStackPtr
tay
lda #0 for integral type
jsr CC.EXP.Eval
jsr EXP.Eval
bcs .99
jsr CC.GetCharNB
@ -426,7 +426,7 @@ CC.KW.CASE ldy CStackPtr
cmp #':'
bne .9
jsr CC.GetNextCharNB skip ':'
jsr CORE.GetNCharNB skip ':'
clc
rts
@ -435,7 +435,7 @@ CC.KW.CASE ldy CStackPtr
sec
.99 rts
*--------------------------------------
CC.KW.DEFAULT ldy CStackPtr
KW.DEFAULT ldy CStackPtr
beq .9
iny skip ; or }
@ -449,7 +449,7 @@ CC.KW.DEFAULT ldy CStackPtr
cmp #':'
bne .9
jsr CC.GetNextCharNB skip ':'
jsr CORE.GetNCharNB skip ':'
clc
rts
@ -458,9 +458,9 @@ CC.KW.DEFAULT ldy CStackPtr
sec
.99 rts
*--------------------------------------
CC.KW.BREAK lda #'B'
KW.BREAK lda #'B'
jsr CC.KW.LookupLabel
jsr KW.LookupLabel
bcs .9
lda #$4C emit JMP break
@ -470,9 +470,9 @@ CC.KW.BREAK lda #'B'
sec
rts
*--------------------------------------
CC.KW.CONTINUE lda #'C'
KW.CONTINUE lda #'C'
jsr CC.KW.LookupLabel
jsr KW.LookupLabel
bcs .9
lda #$4C emit JMP cont
@ -482,7 +482,7 @@ CC.KW.CONTINUE lda #'C'
sec
rts
*--------------------------------------
CC.KW.RETURN ldy CStackPtr
KW.RETURN ldy CStackPtr
beq .9
.1 iny skip ; or }
@ -515,10 +515,10 @@ CC.KW.RETURN ldy CStackPtr
ply
jsr CC.EXP.Eval
jsr EXP.Eval
bcs .99
jsr CC.SYM.GetYASizeOfInAXC Y,A=T/Q
jsr SYM.GetYASizeOfInAXC Y,A=T/Q
tax X = sizeof
jsr CODE.SetRetValue
bcs .99
@ -526,287 +526,19 @@ CC.KW.RETURN ldy CStackPtr
>LDYA L.PCC.LEAVE
jmp CODE.EmitPCC
*--------------------------------------
CC.KW.SIZEOF
KW.SIZEOF
lda #E.CSYN
sec
rts
*--------------------------------------
CC.KW.STRUCT clc
.HS B0 BCS
*--------------------------------------
CC.KW.UNION sec
stz ZPPtr2 bNewTagDef
ror ZPPtr2+1 bStrucUnion
bit bPass2
bpl CC.KW.SU.1 Pass 1: create def
*--------------------------------------
CC.KW.SU.2 jsr CC.GetNextCharNB
bcs .98
cmp #'{'
beq .1 no TAG
jsr CC.KW.GetTag
bcs .99
jsr CC.GetNextCharNBNL
bcs .98
cmp #'{'
bne .2
.1 jsr CC.GetNextCharNBNL skip '{'
cmp #'}'
bne .1
jsr CC.GetNextCharNBNL skip '}'
cmp #';'
bne .2
jsr CC.GetNextCharNB skip ';'
clc
rts
.2 clc reuse buffer
jsr CC.SYM.Lookup
bcs .99
jsr CC.GetCharNB
bcs .98
cmp #','
bne .3
jsr CC.GetNextCharNBNL
bcc .2
bcs .98
.3 cmp #';'
bne .98
clc
rts
.98 lda #E.CSYN
sec
.99 rts
*--------------------------------------
CC.KW.SU.1 ldy #SYM.T.SU
lda #0
ldx #SYM.SC.TAG
sec reset buffer
jsr CC.SYM.BufInitYAX
jsr CC.GetNextCharNB
bcs .98
cmp #'{'
beq .30 no TAG
jsr CC.KW.NewTag
bcc .20
jsr CC.KW.GetTag
bcs .99
*--------------------------------------
.20 jsr CC.GetNextCharNBNL
bcs .98
cmp #'{'
beq .30
bit ZPPtr2 bNewTagDef
bmi .98
bra .41 go create vars...
*--------------------------------------
.30 jsr CC.GetNextCharNBNL skip '{' of ';'
bcs .98
cmp #'}'
beq .38
>LDYA L.CC.TYPEQUAL
jsr CC.LookupID
bcs .98
cpx #4 no const nor volatile
bcc .98
jsr CC.TYPE.Decl
bcs .99
jsr CC.TYPE.SizeOf get sizeof in X
jsr CC.KW.SU.AddYAX
bcs .99
jsr CC.SYM.Add0000 TODO: bitO & bitW
bcs .99
jsr CC.SYM.AddName
bcs .99
jsr CC.GetCharNB
cmp #';'
bne .98
bra .30
.38 jsr CC.GetNextCharNB skip '}'
bcs .98
jsr CC.SYM.Add0000 Close F definition
bcs .99
cmp #';'
bne .40
jsr CC.GetNextCharNB skip ';'
bit ZPPtr2 bNewTagDef
bpl .98 no tag & no var, error
jmp CC.KW.StoreTag
*--------------------------------------
.98 lda #E.CSYN
sec
.99 rts
*--------------------------------------
.40 bit ZPPtr2 bNewTagDef
bpl .41
jsr CC.KW.StoreTag
bcs .99
.41 clc reuse buffer
ldy #SYM.T.SU
lda #0
jsr CC.DECL.YAC
bcs .99
jsr CC.GetCharNB
bcs .98
cmp #','
bne .42
jsr CC.GetNextCharNBNL
bcc .41
bcs .98
.42 cmp #';'
bne .98
clc
rts
*--------------------------------------
CC.KW.SU.AddYAX jsr CC.SYM.AddWord add T/Q
bcs .99
bit ZPPtr2+1 bStrucUnion
bmi .1
ldy #SYM.SizeOf
lda (ZPSymBufPtr),y
pha
iny
lda (ZPSymBufPtr),y
ply
jsr CC.SYM.AddWord Add Y/A Offset
bcs .99
txa
ldy #SYM.SizeOf
* clc
adc (ZPSymBufPtr),y
sta (ZPSymBufPtr),y
bcc .99
iny
lda #0
adc (ZPSymBufPtr),y
sta (ZPSymBufPtr),y
* clc
.99 rts
.1 txa
ldy #SYM.SizeOf
cmp (ZPSymBufPtr),y
bcs .2
sta (ZPSymBufPtr),y
.2 jmp CC.SYM.Add0000 Add Y/A Offset (always 0 for union)
*--------------------------------------
CC.KW.ENUM
lda #E.CSYN
sec
rts
*--------------------------------------
CC.KW.NewTag >LDA.G CC.hTags
jsr CC.SYM.NewKey
bcs .9
>STYA ZPPtr1 TagID
dec ZPPtr2 bNewTagDef = true
jsr CC.SkipX
.9 rts
*--------------------------------------
CC.KW.GetTag >PUSHB.G CC.hTags
>PUSHW ZPLineBufPtr
>SYSCALL SListLookup
bcs .9
phy Y,A = KeyID
pha
jsr CC.SkipX X = KeyLen
>PUSHB.G CC.hTags
pla
>PUSHA
pla
>PUSHA
>PUSHW ZPSymBufPtr
>PUSHWI 65535 all
>PUSHWZ From Start
>SYSCALL SListGetData
.9 rts
*--------------------------------------
CC.KW.StoreTag >PUSHB.G CC.hTags
>PUSHW ZPPtr1
>PUSHW ZPSymBufPtr
>PUSHBI 0
ldy #SYM.DefSize
lda (ZPSymBufPtr),y
>PUSHA
>SYSCALL SListAddData
rts
*--------------------------------------
CC.KW.BEGIN00 lda #0
KW.BEGIN00 lda #0
jsr CC.Push no T/Q
bcs CC.KW.BEGIN.RTS
bcs KW.BEGIN.RTS
jsr CC.Push
bcs CC.KW.BEGIN.RTS
bcs KW.BEGIN.RTS
CC.KW.BEGIN jsr CC.SYM.NewCPSID
KW.BEGIN jsr SYM.NewCPSID
bcs .99
>LDA.G CC.CPSPFX+3
@ -829,15 +561,15 @@ CC.KW.BEGIN jsr CC.SYM.NewCPSID
jmp CC.Push
.99
CC.KW.BEGIN.RTS rts
KW.BEGIN.RTS rts
*--------------------------------------
CC.KW.STMT jsr CC.GetNextCharNBNL
KW.STMT jsr CORE.GetNCharNBNL
bcs .9
cmp #'{'
bne .1
jsr CC.GetNextCharNB skip '{'
jsr CORE.GetNCharNB skip '{'
bcs .99
lda #'}'
@ -850,7 +582,7 @@ CC.KW.STMT jsr CC.GetNextCharNBNL
sec
.99 rts
*--------------------------------------
CC.KW.NewLabel pha
KW.NewLabel pha
lda CStackPtr
clc
@ -865,9 +597,9 @@ CC.KW.NewLabel pha
>STYA.G CC.CPSPFX+2
pla
jmp CC.SYM.NewA
jmp SYM.NewA
*--------------------------------------
CC.KW.GetLabel pha
KW.GetLabel pha
lda CStackPtr
clc
@ -882,10 +614,9 @@ CC.KW.GetLabel pha
>STYA.G CC.CPSPFX+2
pla
jmp CC.SYM.LookupA
jmp SYM.LookupA
*--------------------------------------
CC.KW.LookupLabel
pha
KW.LookupLabel pha
ldy CStackPtr
sty ArgIndex
@ -918,7 +649,7 @@ CC.KW.LookupLabel
pla
pha
jsr CC.SYM.LookupA
jsr SYM.LookupA
bcs .1
pla
@ -931,7 +662,7 @@ CC.KW.LookupLabel
*--------------------------------------
* Input : Value on Stack, Y,A = Type/Qual
*--------------------------------------
CC.KW.TestZero jsr CC.EXP.GetYASizeOfInAXC
KW.TestZero jsr EXP.GetYASizeOfInAXC
tax
cpx #1
bne .1
@ -955,7 +686,7 @@ CC.KW.TestZero jsr CC.EXP.GetYASizeOfInAXC
*--------------------------------------
* Input : Value on Stack, Y,A = Type/Qual
*--------------------------------------
CC.KW.TestnZero jsr CC.EXP.GetYASizeOfInAXC
KW.TestnZero jsr EXP.GetYASizeOfInAXC
tax
cpx #1
bne .1
@ -979,9 +710,7 @@ CC.KW.TestnZero jsr CC.EXP.GetYASizeOfInAXC
*--------------------------------------
* Input : Value on Stack, Y,A = Type/Qual
*--------------------------------------
CC.KW.StackDiscard
jsr CC.TYPE.SizeOf
KW.StackDiscard jsr TYPE.SizeOf
txa
beq .8 void

View File

@ -180,8 +180,8 @@ CC.Link.Dump >PUSHW L.MSG.LINKING2
iny
>PUSHB (ZPSymBufPtr),y SYM.SC
iny
>PUSHB (ZPSymBufPtr),y SYM.DefSize
ldy #SYM.DefSize
>PUSHB (ZPSymBufPtr),y
ldy #SYM.SizeOf+1
>PUSHB (ZPSymBufPtr),y

View File

@ -1,7 +1,7 @@
NEW
AUTO 3,1
*--------------------------------------
CC.STMT jsr CC.GetCharNB
STMT.Get jsr CC.GetCharNB
jsr CC.IsLetter
ldx #$ff
bcc .20
@ -12,49 +12,49 @@ CC.STMT jsr CC.GetCharNB
.20 stx StmtPreOp
jsr CC.SYM.Lookup var or func() ?
jsr SYM.Lookup var or func() ?
bcs .99
ldy #SYM.Q
lda (ZPLookupSymPtr),y
bit #SYM.Q.FUNC
beq .60
bit StmtPreOp
bpl .9 ++func ????????
jsr CC.F.CallNoRetV func( ... );
bcs .99
jmp CC.SYM.LookupFree
.60 ldy #SYM.SC
ldy #SYM.SC
lda (ZPLookupSymPtr),y
cmp #SYM.SC.TYPEDEF
bne .61
jsr CC.GetNextCharNB
bne .60
*--------------------------------------
jsr CORE.GetNCharNB
bcs .9
* >DEBUG
ldy #SYM.Q
lda (ZPLookupSymPtr),y
pha
lda (ZPLookupSymPtr)
pha
jsr CC.SYM.LookupFree
jsr SYM.LookupFree
ply
pla
sec Reset Buffer
jmp CC.DECL.YAC
jmp DECL.YAC
*--------------------------------------
.60 ldy #SYM.Q
lda (ZPLookupSymPtr),y
bit #SYM.Q.FUNC
beq .61
bit StmtPreOp
bpl .9 ++func ????????
jsr F.CallNoRetV func( ... );
bcs .99
jmp SYM.LookupFree
*--------------------------------------
.61 jsr STMT.SetVar
bcs .99
jmp CC.SYM.LookupFree
jmp SYM.LookupFree
.9 lda #E.CSYN
sec
@ -62,11 +62,11 @@ CC.STMT jsr CC.GetCharNB
*--------------------------------------
STMT.SetVar stz ExpState
jsr CC.EXP.POSTOPS var++, var[0]... ?
jsr EXP.POSTOPS var++, var[0]... ?
bcs .99
ldx StmtPreOp
jsr CC.EXP.PREOPS apply ++var, ....
jsr EXP.PREOPS apply ++var, ....
bcs .99
jsr CC.GetCharNB
@ -91,7 +91,7 @@ STMT.SetVar stz ExpState
asl
bmi .6 AonStack
jsr CC.EXP.GetAddr1
jsr EXP.GetAddr1
bcc .7
rts
@ -107,10 +107,10 @@ STMT.SetVar stz ExpState
tay
pla get expected T/Q
jsr CC.EXP.Eval
jsr EXP.Eval
bcs .99
jmp CC.SYM.PopValue
jmp SYM.PopValue
.8 clc
rts
@ -197,7 +197,7 @@ CC.STMT.POP bne .98
jmp (J.CC.KW.END,x)
.8 jmp CC.F.Def.END
.8 jmp F.Def.END
.98 lda #E.CSYN
sec

View File

@ -6,20 +6,20 @@ NEW
* CC : Reuse Buffer
* Output : Y,A = VarID
*--------------------------------------
CC.SYM.New >STYA ZPPtr2 T/Q
SYM.New >STYA ZPPtr2 T/Q
stx ZPPtr3 SC
bit bPass2
bpl CC.SYM.New.1
bpl SYM.New.1
bit bLocalScope
bmi CC.SYM.New.1
bmi SYM.New.1
>PUSHB.G CC.hScopes Global Scope
>PUSHW ZPLineBufPtr
>SYSCALL SListLookup
bcs CC.SYM.New.9
bcs SYM.New.9
>STYA.G CC.SymID Y,A = KeyID
@ -31,22 +31,22 @@ CC.SYM.New >STYA ZPPtr2 T/Q
>PUSHWI 65535 all
>PUSHWZ From Start
>SYSCALL SListGetData
bcc CC.SYM.New.2
bcc SYM.New.2
CC.SYM.New.9 rts Y,A = SymSize
SYM.New.9 rts Y,A = SymSize
*--------------------------------------
CC.SYM.New.1 jsr CC.SYM.BufInitYAX set buf according C
SYM.New.1 jsr SYM.BufInitYAXC set buf according C
ldy ScopeIdx
lda (pData),y
jsr CC.SYM.NewKey
bcs CC.SYM.New.9
jsr SYM.NewKey
bcs SYM.New.9
>STYA.G CC.SymID Y,A = KeyID
jsr CC.SkipX X = KeyLen
*--------------------------------------
CC.SYM.New.2 jsr CC.GetCharNB
SYM.New.2 jsr CC.GetCharNB
bcs .98
cmp #';'
@ -54,35 +54,35 @@ CC.SYM.New.2 jsr CC.GetCharNB
lda ZPPtr3
cmp #SYM.SC.TYPEDEF
bne CC.SYM.SetAddr
bne SYM.SetAddr
clc
rts
.1 cmp #'('
bne CC.SYM.NewV
bne SYM.NewV
ldy #SYM.Q
lda #SYM.Q.FUNC
ora (ZPSymBufPtr),y
sta (ZPSymBufPtr),y
jmp CC.F.Decl
jmp F.Decl
.98 lda #E.CSYN
sec
.99 rts
*--------------------------------------
CC.SYM.NewV cmp #'['
bne CC.SYM.SetAddr
SYM.NewV cmp #'['
bne SYM.SetAddr
ldy #SYM.Q
lda (ZPSymBufPtr),y
and #%11001111
sta (ZPSymBufPtr),y
lda #SYM.Def
ldy #SYM.DefSize
lda #SYM.Def
sta (ZPSymBufPtr),y
ldy #SYM.Q
@ -92,7 +92,7 @@ CC.SYM.NewV cmp #'['
adc #SYM.Q.ARRAY
sta (ZPSymBufPtr),y
jsr CC.GetNextCharNB Skip [
jsr CORE.GetNCharNB Skip [
bcs .98
cmp #']'
@ -103,15 +103,15 @@ CC.SYM.NewV cmp #'['
and #SYM.Q.PPPOINTER
beq .98 [] only allowed for *
jsr CC.SYM.Add0000 set as [0] (deref)
jsr SYM.Add0000 set as [0] (deref)
bcs .99
bra .3
.2 jsr CC.EXP.IntConst
.2 jsr EXP.IntConst
bcs .98
jsr CC.SYM.AddWord
jsr SYM.AddWord
bcs .99
jsr CC.GetCharNB
@ -120,11 +120,11 @@ CC.SYM.NewV cmp #'['
cmp #']'
bne .98
.3 jsr CC.GetNextCharNB Skip ]
bcs CC.SYM.SetAddr
.3 jsr CORE.GetNCharNB Skip ]
bcs SYM.SetAddr
cmp #'['
bne CC.SYM.SetAddr
bne SYM.SetAddr
ldy #SYM.Q
lda (ZPSymBufPtr),y
@ -136,14 +136,14 @@ CC.SYM.NewV cmp #'['
sec
.99 rts
*--------------------------------------
CC.SYM.SetAddr ldy #SYM.SizeOf
SYM.SetAddr ldy #SYM.SizeOf
lda (ZPSymBufPtr),y
iny
ora (ZPSymBufPtr),y
bne .1
jsr CC.SYM.GetSymSizeOfInAXC
jsr CC.SYM.SetSizeOf
jsr SYM.GetSymSizeOfInAXC
jsr SYM.SetSizeOf
.1 ldy #SYM.Q
lda (ZPSymBufPtr),y
@ -152,16 +152,16 @@ CC.SYM.SetAddr ldy #SYM.SizeOf
ldy #SYM.SC
lda (ZPSymBufPtr),y
beq CC.SYM.SetAddrG SYM.SC.STATIC
beq SYM.SetAddrG SYM.SC.STATIC
cmp #SYM.SC.AUTO
beq CC.SYM.SetAddrL
beq SYM.SetAddrL
.9 lda #E.TMISMATCH
sec
rts
*--------------------------------------
CC.SYM.SetAddrG ldy #SYM.Addr
SYM.SetAddrG ldy #SYM.Addr
lda ZPCCData
sta (ZPSymBufPtr),y
@ -185,7 +185,7 @@ CC.SYM.SetAddrG ldy #SYM.Addr
clc
rts
*--------------------------------------
CC.SYM.SetAddrL ldy #SYM.SizeOf+1
SYM.SetAddrL ldy #SYM.SizeOf+1
lda (ZPSymBufPtr),y
bne .9
@ -212,8 +212,7 @@ CC.SYM.SetAddrL ldy #SYM.SizeOf+1
sec
rts
*--------------------------------------
CC.SYM.BufInitYAX
pha
SYM.BufInitYAXC pha
tya
sta (ZPSymBufPtr) #SYM.T
@ -227,21 +226,20 @@ CC.SYM.BufInitYAX
bcc .8 DONT reset buffer
iny
lda #0
.1 sta (ZPSymBufPtr),y
iny
cpy #SYM.Def
.1 iny
sta (ZPSymBufPtr),y
cpy #SYM.DefSize-1
bne .1
tya
ldy #SYM.DefSize
iny #SYM.DefSize
lda #SYM.Def
sta (ZPSymBufPtr),y
.8 rts
*--------------------------------------
CC.SYM.PushAddr ldy #SYM.SC
SYM.PushAddr ldy #SYM.SC
lda (ZPSymBufPtr),y
beq .1 SYM.SC.STATIC
* LOCAL
@ -284,7 +282,7 @@ CC.SYM.PushAddr ldy #SYM.SC
.9 rts
*--------------------------------------
CC.SYM.GetAddr1 ldy #SYM.SC
SYM.GetAddr1 ldy #SYM.SC
lda (ZPSymBufPtr),y
beq .1 SYM.SC.STATIC
* LOCAL
@ -322,7 +320,7 @@ CC.SYM.GetAddr1 ldy #SYM.SC
.9 rts
*--------------------------------------
CC.SYM.GetAddr2 ldy #SYM.SC
SYM.GetAddr2 ldy #SYM.SC
lda (ZPSymBufPtr),y
beq .1 SYM.SC.STATIC
* LOCAL
@ -360,7 +358,7 @@ CC.SYM.GetAddr2 ldy #SYM.SC
.9 rts
*--------------------------------------
CC.SYM.NewKey >PUSHA
SYM.NewKey >PUSHA
>PUSHW ZPLineBufPtr
>SYSCALL SListNewKey
bcs .9
@ -369,9 +367,9 @@ CC.SYM.NewKey >PUSHA
.9 rts Y,A = KeyID, X = KeyLen
*--------------------------------------
CC.SYM.Add0000 >LDYAI 0
SYM.Add0000 >LDYAI 0
*--------------------------------------
CC.SYM.AddWord phy
SYM.AddWord phy
pha
ldy #SYM.DefSize
@ -407,7 +405,7 @@ CC.SYM.AddWord phy
sec
rts
*--------------------------------------
CC.SYM.AddName jsr CC.GetCharNB
SYM.AddName jsr CC.GetCharNB
bcs .98
jsr CC.IsLetter
@ -415,14 +413,14 @@ CC.SYM.AddName jsr CC.GetCharNB
jsr CC.GetIDLen
tax
jsr CC.SYM.AddByte
jsr SYM.AddByte
bcs .99
ldy #0
.1 lda (ZPLineBufPtr),y
phy
jsr CC.SYM.AddByte
jsr SYM.AddByte
ply
bcs .99
@ -440,7 +438,7 @@ CC.SYM.AddName jsr CC.GetCharNB
sec
.99 rts
*--------------------------------------
CC.SYM.AddByte pha
SYM.AddByte pha
ldy #SYM.DefSize
lda (ZPSymBufPtr),y
@ -462,7 +460,7 @@ CC.SYM.AddByte pha
sec
rts
*--------------------------------------
CC.SYM.NewCPSID >LDYA.G CC.CPSID
SYM.NewCPSID >LDYA.G CC.CPSID
>STYA.G CC.CPSPFX+2
>LDA.G CC.CPSID+1
@ -490,7 +488,7 @@ CC.SYM.NewCPSID >LDYA.G CC.CPSID
* sec
rts
*--------------------------------------
CC.SYM.NewA bit bPass2
SYM.NewA bit bPass2
bmi .8
>STA.G CC.CPSPFX A = "B"reak, "C"ontinue...
@ -514,49 +512,48 @@ CC.SYM.NewA bit bPass2
iny #SYM.SC
sta (ZPSymBufPtr),y
iny
lda #0
.1 sta (ZPSymBufPtr),y
iny
cpy #SYM.Def
.1 iny
sta (ZPSymBufPtr),y
cpy #SYM.DefSize-1
bne .1
tya
ldy #SYM.DefSize
iny #SYM.DefSize
lda #SYM.Def
sta (ZPSymBufPtr),y
>LDYA ZPCCCode
jsr CC.SYM.SetAddrYA
jsr SYM.SetAddrYA
>LDA.G CC.hScopes Global Scope
jmp CC.SYM.Store.1
jmp SYM.Store.1
.8 clc
.99 rts
*--------------------------------------
CC.SYM.StoreF >LDA.G CC.hScopes
SYM.StoreF >LDA.G CC.hScopes
bit bPass2
bpl CC.SYM.Store.1
bpl SYM.Store.1
clc
rts
*--------------------------------------
CC.SYM.Store bit bPass2
bpl CC.SYM.StoreL Store Global & Local at Pass 1
SYM.Store bit bPass2
bpl SYM.StoreL Store Global & Local at Pass 1
bit bLocalScope Store Local at Pass 2
bmi CC.SYM.StoreL
bmi SYM.StoreL
clc
rts
CC.SYM.StoreL ldy ScopeIdx
SYM.StoreL ldy ScopeIdx
lda (pData),y
CC.SYM.Store.1 >PUSHA
SYM.Store.1 >PUSHA
>PUSHW.G CC.SymID
>PUSHW ZPSymBufPtr
>PUSHBI 0
@ -568,7 +565,7 @@ CC.SYM.Store.1 >PUSHA
rts
*--------------------------------------
CC.SYM.NewScope ldy ScopeIdx
SYM.NewScope ldy ScopeIdx
cpy #CC.hScopes+SCOPE.MAX
bcs .9
@ -588,8 +585,7 @@ CC.SYM.NewScope ldy ScopeIdx
sec
.99 rts
*--------------------------------------
CC.SYM.FreeScope
ldy ScopeIdx
SYM.FreeScope ldy ScopeIdx
cpy #CC.hScopes
beq *
@ -601,7 +597,7 @@ CC.SYM.FreeScope
rts
*--------------------------------------
CC.SYM.Lookup >LDA.G CC.LookupIdx
SYM.Lookup >LDA.G CC.LookupIdx
cmp #CC.LookupIdx+LOOKUP.MAX
beq .99
@ -646,7 +642,7 @@ CC.SYM.Lookup >LDA.G CC.LookupIdx
* sec
rts
*--------------------------------------
CC.SYM.LookupA bit bPass2
SYM.LookupA bit bPass2
bmi .1
ldx #0
@ -684,8 +680,7 @@ CC.SYM.LookupA bit bPass2
.99 rts
*--------------------------------------
CC.SYM.LookupFree
>LDA.G CC.LookupIdx
SYM.LookupFree >LDA.G CC.LookupIdx
cmp #CC.LookupIdx
beq .9
@ -714,7 +709,7 @@ CC.SYM.LookupFree
* ZPPtr2 = expected T/Q
* ZPLookupSymPtr
*--------------------------------------
CC.SYM.LookupCheckTQ
SYM.LookupCheckTQ
lda ZPPtr2 target T
bne .1
@ -744,9 +739,16 @@ CC.SYM.LookupCheckTQ
ldy #SYM.Q
eor (ZPLookupSymPtr),y
and #$F8 ignore VOLATILE|FUNC|FASTCALL
beq .8
and #SYM.Q.AAARRAY is mismatch about array ?
beq .9 no...
lda ZPPtr2+1 Q
and #SYM.Q.AAARRAY
bne .9
clc
.8 clc
rts
.9 lda #E.TMISMATCH
@ -755,7 +757,7 @@ CC.SYM.LookupCheckTQ
*--------------------------------------
* on RT stack : Addr,value
*--------------------------------------
CC.SYM.PopValue jsr CC.SYM.GetYASizeOfInAXC
SYM.PopValue jsr SYM.GetYASizeOfInAXC
tax
dex
bne .1
@ -779,8 +781,7 @@ CC.SYM.PopValue jsr CC.SYM.GetYASizeOfInAXC
*--------------------------------------
* out : Y,A = T/Q
*--------------------------------------
CC.SYM.GetTypeInYA
ldy #SYM.Q
SYM.GetTypeInYA ldy #SYM.Q
lda (ZPSymBufPtr),y
pha
lda (ZPSymBufPtr)
@ -790,7 +791,7 @@ CC.SYM.GetTypeInYA
*--------------------------------------
* out : A,X,C = size
*--------------------------------------
CC.SYM.GetSymSizeOfInAXC
SYM.GetSymSizeOfInAXC
ldy #SYM.Q
lda (ZPSymBufPtr),y
pha
@ -798,7 +799,7 @@ CC.SYM.GetSymSizeOfInAXC
tay
pla
CC.SYM.GetYASizeOfInAXC
SYM.GetYASizeOfInAXC
bit #SYM.Q.PPPOINTER
beq .1
@ -852,8 +853,7 @@ CC.SYM.GetYASizeOfInAXC
*--------------------------------------
* in/out : A,X,C = size
*--------------------------------------
CC.SYM.SetSizeOf
ldy #SYM.SizeOf
SYM.SetSizeOf ldy #SYM.SizeOf
sta (ZPSymBufPtr),y
pha
@ -865,8 +865,7 @@ CC.SYM.SetSizeOf
pla
rts
*--------------------------------------
CC.SYM.SetAddrYA
phy
SYM.SetAddrYA phy
ldy #SYM.Addr+1
sta (ZPSymBufPtr),y

View File

@ -1,7 +1,7 @@
NEW
AUTO 3,1
*--------------------------------------
CC.TYPE.Decl >ENTER 2
TYPE.GetTQInYA >ENTER 2
lda #0
sta (pStack) Type
ldy #1
@ -24,15 +24,40 @@ CC.TYPE.Decl >ENTER 2
.8 jmp (J.CC.TYPEQUAL,x)
*--------------------------------------
TYPE.GetTQInYA2 >ENTER 2
lda (ZPLookupSymPtr)
sta (pStack) Type
ldy #SYM.Q
lda (ZPLookupSymPtr),y
* ldy #1
sta (pStack),y Qual
jsr TYPE.GetQ2
bcs .99
jsr SYM.LookupFree
ldy #1
lda (pStack),y
pha
lda (pStack)
tay Y = Type
pla A = Qual
clc
.99 >LEAVE
rts
*--------------------------------------
* Type Declaration keywords
*--------------------------------------
CC.TYPE.CONST lda #SYM.Q.CONST
bra CC.TYPE.VOLATILE.1
TYPE.CONST lda #SYM.Q.CONST
bra TYPE.VOLATILE.1
*--------------------------------------
CC.TYPE.VOLATILE
lda #SYM.Q.VOLATILE
CC.TYPE.VOLATILE.1
ldy #1
TYPE.VOLATILE lda #SYM.Q.VOLATILE
TYPE.VOLATILE.1 ldy #1
ora (pStack),y
sta (pStack),y
@ -49,11 +74,225 @@ CC.TYPE.VOLATILE.1
sec
rts
*--------------------------------------
CC.TYPE.SIGNED sec
TYPE.STRUCT clc
.HS B0 BCS
*--------------------------------------
TYPE.UNION sec
ror ZPPtr2+1 bStrucUnion
stz ZPPtr2 bNewTagDef
bit bPass2
bpl TYPE.SU.1 Pass 1: create def
*--------------------------------------
TYPE.SU.2 jsr CORE.GetCharNBNL
bcs .98
cmp #'{'
beq .1 no TAG
jsr TYPE.GetTag
bcs .99
jsr CORE.GetNCharNBNL
bcs .98
cmp #'{'
bne .8
.1 jsr CORE.GetNCharNBNL skip '{'
cmp #'}'
bne .1 skip definition
jsr CORE.GetNCharNB skip '}'
.8 lda #SYM.T.SU
jmp TYPE.GetQ
.98 lda #E.CSYN
sec
.99 rts
*--------------------------------------
TYPE.SU.1 ldy #SYM.T.SU
lda #0
ldx #SYM.SC.TAG
sec reset buffer
jsr SYM.BufInitYAXC
jsr CORE.GetCharNBNL
bcs .98
cmp #'{'
beq .30 no TAG
jsr TYPE.GetTag
bcc .20
jsr TYPE.NewTag
bcs .99
sec
ror ZPPtr2 bNewTagDef
*--------------------------------------
.20 jsr CORE.GetCharNBNL
bcs .98
cmp #'{'
beq .30
bit ZPPtr2 bNewTagDef
bmi .98
bra .38
*--------------------------------------
.30 jsr CORE.GetNCharNBNL skip '{' of ';'
bcs .98
cmp #'}'
beq .37
>LDYA L.CC.TYPEQUAL
jsr CC.LookupID
bcs .98
cpx #4 no const nor volatile
bcc .98
jsr TYPE.GetTQInYA
bcs .99
jsr TYPE.SizeOf get sizeof in X
jsr TYPE.SU.AddYAX
bcs .99
jsr SYM.Add0000 TODO: bitO & bitW
bcs .99
jsr SYM.AddName
bcs .99
jsr CC.GetCharNB
cmp #';'
bne .98
bra .30
*--------------------------------------
.37 jsr CORE.GetNCharNB skip '}'
bcs .98
jsr SYM.Add0000 Close F definition
bcs .99
bit ZPPtr2 bNewTagDef
bpl .38
jsr TYPE.StoreTag
bcs .99
*--------------------------------------
.38 lda #SYM.T.SU
jmp TYPE.GetQ
.98 lda #E.CSYN
sec
.99 rts
*--------------------------------------
TYPE.SU.AddYAX jsr SYM.AddWord add T/Q
bcs .99
bit ZPPtr2+1 bStrucUnion
bmi .1
ldy #SYM.SizeOf
lda (ZPSymBufPtr),y
pha
iny
lda (ZPSymBufPtr),y
ply
jsr SYM.AddWord Add Y/A Offset
bcs .99
txa
ldy #SYM.SizeOf
* clc
adc (ZPSymBufPtr),y
sta (ZPSymBufPtr),y
bcc .99
iny
lda #0
adc (ZPSymBufPtr),y
sta (ZPSymBufPtr),y
* clc
.99 rts
.1 txa
ldy #SYM.SizeOf
cmp (ZPSymBufPtr),y
bcs .2
sta (ZPSymBufPtr),y
.2 jmp SYM.Add0000 Add Y/A Offset (always 0 for union)
*--------------------------------------
TYPE.ENUM
lda #E.CSYN
sec
rts
*--------------------------------------
TYPE.NewTag >LDA.G CC.hTags
jsr SYM.NewKey
bcs .9
>STYA ZPPtr1 TagID
dec ZPPtr2 bNewTagDef = true
jsr CC.SkipX
.9 rts
*--------------------------------------
TYPE.GetTag >PUSHB.G CC.hTags
>PUSHW ZPLineBufPtr
>SYSCALL SListLookup
bcs .9
phy Y,A = KeyID
pha
jsr CC.SkipX X = KeyLen
>PUSHB.G CC.hTags
pla
>PUSHA
pla
>PUSHA
>PUSHW ZPSymBufPtr
>PUSHWI 65535 all
>PUSHWZ From Start
>SYSCALL SListGetData
.9 rts
*--------------------------------------
TYPE.StoreTag >PUSHB.G CC.hTags
>PUSHW ZPPtr1
>PUSHW ZPSymBufPtr
>PUSHBI 0
ldy #SYM.DefSize
lda (ZPSymBufPtr),y
>PUSHA
>SYSCALL SListAddData
rts
*--------------------------------------
TYPE.SIGNED sec
.HS 90 BCC
*--------------------------------------
CC.TYPE.UNSIGNED
clc
TYPE.UNSIGNED clc
php
jsr CC.CheckSpace
@ -61,7 +300,6 @@ CC.TYPE.UNSIGNED
>LDYA L.CC.TYPES
jsr CC.LookupID
bcs .9
cpx #SYM.T.UCHAR
@ -83,50 +321,50 @@ CC.TYPE.UNSIGNED
sec
rts
*--------------------------------------
CC.TYPE.SHORT jsr CC.CheckSpace
TYPE.SHORT jsr CC.CheckSpace
bcs .9
>LDYA L.CC.TYPES
jsr CC.LookupID
bcs CC.TYPE.UCHAR
bcs TYPE.UCHAR
cpx #4 only int allowed
beq CC.TYPE.SCHAR
beq TYPE.SCHAR
.9 lda #E.CSYN
sec
rts
*--------------------------------------
CC.TYPE.VOID lda #SYM.T.VOID
bra CC.TYPE
TYPE.VOID lda #SYM.T.VOID
bra TYPE.GetQ
CC.TYPE.CHAR
CC.TYPE.UCHAR lda #SYM.T.UCHAR
bra CC.TYPE
TYPE.CHAR
TYPE.UCHAR lda #SYM.T.UCHAR
bra TYPE.GetQ
CC.TYPE.SCHAR lda #SYM.T.SCHAR
bra CC.TYPE
TYPE.SCHAR lda #SYM.T.SCHAR
bra TYPE.GetQ
CC.TYPE.UINT lda #SYM.T.UINT
bra CC.TYPE
TYPE.UINT lda #SYM.T.UINT
bra TYPE.GetQ
CC.TYPE.INT
CC.TYPE.SINT lda #SYM.T.SINT
bra CC.TYPE
TYPE.INT
TYPE.SINT lda #SYM.T.SINT
bra TYPE.GetQ
CC.TYPE.ULONG lda #SYM.T.ULONG
bra CC.TYPE
TYPE.ULONG lda #SYM.T.ULONG
bra TYPE.GetQ
CC.TYPE.LONG
CC.TYPE.SLONG lda #SYM.T.SLONG
bra CC.TYPE
TYPE.LONG
TYPE.SLONG lda #SYM.T.SLONG
bra TYPE.GetQ
CC.TYPE.FLOAT lda #SYM.T.FLOAT
TYPE.FLOAT lda #SYM.T.FLOAT
CC.TYPE sta (pStack) T
TYPE.GetQ sta (pStack) T
jsr CC.GetCharNB
TYPE.GetQ2 jsr CC.GetCharNB
bcs .9
.1 cmp #'*'
@ -140,13 +378,13 @@ CC.TYPE sta (pStack) T
sta (pStack),y
jsr CC.GetNextCharNB
jsr CORE.GetNCharNB
bcc .1
.9 lda #E.CSYN
sec
.99 rts
*--------------------------------------
.10 jsr CC.IsLetter
bcs .8
@ -159,7 +397,7 @@ CC.TYPE sta (pStack) T
ora #SYM.Q.FUNC+SYM.Q.FASTCALL
sta (pStack),y
jsr CC.GetNextCharNB
jsr CORE.GetNCharNB
bcs .9 next char is an identifier, ",", "(",")"
.8 clc
@ -168,7 +406,7 @@ CC.TYPE sta (pStack) T
* in : Y,A = type/qual
* out : X = size
*--------------------------------------
CC.TYPE.SizeOf bit #SYM.Q.PPPOINTER
TYPE.SizeOf bit #SYM.Q.PPPOINTER
bne .2
ldx CC.TYPESIZE-1,y

View File

@ -46,12 +46,15 @@ SYM.SC.EXTERN .EQ 6
SYM.SC.TYPEDEF .EQ 8
SYM.SC.DEFINE .EQ 10
SYM.SC.TAG .EQ 12
SYM.DefSize .EQ 3
SYM.hSym .EQ 3
SYM.SizeOf .EQ 4
SYM.Addr .EQ 6
SYM.Def .EQ 8 Funtions : fTQ,a1TQ,a2TQ....
SYM.BitO .EQ 8
SYM.BitW .EQ 9
SYM.DefSize .EQ 10
SYM.Def .EQ 11 Funtions : fTQ,a1TQ,a2TQ....
*
SYM .EQ 10
SYM .EQ 14
*--------------------------------------
SU.F.T .EQ 0
SU.F.Q .EQ 1
@ -135,20 +138,7 @@ L.LIB.O .DA LIB.O
*--------------------------------------
L.CC.AOPS .DA CC.AOPS
L.CC.PREOPS .DA CC.PREOPS
J.CC.PREOPS .DA CC.EXP.Ref
.DA CC.EXP.Deref
.DA CC.EXP.Abs
.DA CC.EXP.negate
.DA CC.EXP.lnot
.DA CC.EXP.bnot
.DA CC.EXP.preinc
.DA CC.EXP.predec
L.CC.POSTOPS .DA CC.POSTOPS
J.CC.POSTOPS .DA CC.EXP.postinc
.DA CC.EXP.postdec
.DA CC.EXP.idx
.DA CC.EXP.SU
.DA CC.EXP.pSU
L.CC.BOPS .DA CC.BOPS
L.CC.DIRS .DA CC.DIRS
L.CC.KW .DA CC.KW
@ -159,60 +149,77 @@ L.CC.TYPEQUAL .DA CC.TYPEQUAL
L.CC.TYPESPEC .DA CC.TYPESPEC
L.CC.TYPES .DA CC.TYPES
L.CC.FTYPES .DA CC.FTYPES
J.CC.DIRS .DA CC.DIR.DEFINE
.DA CC.DIR.INCLUDE
*--------------------------------------
J.CC.KW .DA CC.KW.IF
.DA CC.KW.WHILE
.DA CC.KW.ELSE
.DA CC.KW.DO
.DA CC.KW.FOR
.DA CC.KW.SWITCH
.DA CC.KW.CASE
.DA CC.KW.DEFAULT
.DA CC.KW.BREAK
.DA CC.KW.CONTINUE
.DA CC.KW.RETURN
J.CC.DIRS .DA DIR.DEFINE
.DA DIR.INCLUDE
.DA DIR.IFDEF
.DA DIR.IFNDEF
*--------------------------------------
.DA CC.KW.SIZEOF
.DA CC.KW.STRUCT
.DA CC.KW.UNION
.DA CC.KW.ENUM
J.CC.PREOPS .DA EXP.Ref
.DA EXP.Deref
.DA EXP.Abs
.DA EXP.negate
.DA EXP.lnot
.DA EXP.bnot
.DA EXP.preinc
.DA EXP.predec
*--------------------------------------
J.CC.KW.END .DA CC.KW.IF.END
.DA CC.KW.WHILE.END
.DA CC.KW.ELSE.END
.DA CC.KW.DO.END
.DA CC.KW.FOR.END
.DA CC.KW.SWITCH.END
J.CC.POSTOPS .DA EXP.postinc
.DA EXP.postdec
.DA EXP.idx
.DA EXP.SU
.DA EXP.pSU
*--------------------------------------
J.CC.SCSPEC .DA CC.SCSPEC.AUTO
.DA CC.SCSPEC.REGISTER
.DA CC.SCSPEC.STATIC
.DA CC.SCSPEC.EXTERN
.DA CC.SCSPEC.TYPEDEF
J.CC.TYPEQUAL .DA CC.TYPE.CONST
.DA CC.TYPE.VOLATILE
J.CC.TYPESPEC .DA CC.TYPE.SIGNED
.DA CC.TYPE.UNSIGNED
.DA CC.TYPE.SHORT
J.CC.TYPES .DA CC.TYPE.VOID
.DA CC.TYPE.CHAR
.DA CC.TYPE.INT
.DA CC.TYPE.LONG
.DA CC.TYPE.FLOAT
J.CC.UTYPES .DA CC.TYPE.UCHAR
.DA CC.TYPE.UINT
.DA CC.TYPE.ULONG
J.CC.STYPES .DA CC.TYPE.SCHAR
.DA CC.TYPE.SINT
.DA CC.TYPE.SLONG
J.CC.KW .DA KW.IF
.DA KW.WHILE
.DA KW.ELSE
.DA KW.DO
.DA KW.FOR
.DA KW.SWITCH
.DA KW.CASE
.DA KW.DEFAULT
.DA KW.BREAK
.DA KW.CONTINUE
.DA KW.RETURN
.DA KW.SIZEOF
*--------------------------------------
J.CC.KW.END .DA KW.IF.END
.DA KW.WHILE.END
.DA KW.ELSE.END
.DA KW.DO.END
.DA KW.FOR.END
.DA KW.SWITCH.END
*--------------------------------------
J.CC.SCSPEC .DA DECL.AUTO
.DA DECL.REGISTER
.DA DECL.STATIC
.DA DECL.EXTERN
.DA DECL.TYPEDEF
J.CC.TYPEQUAL .DA TYPE.CONST
.DA TYPE.VOLATILE
J.CC.TYPESPEC .DA TYPE.STRUCT
.DA TYPE.UNION
.DA TYPE.ENUM
.DA TYPE.SIGNED
.DA TYPE.UNSIGNED
.DA TYPE.SHORT
J.CC.TYPES .DA TYPE.VOID
.DA TYPE.CHAR
.DA TYPE.INT
.DA TYPE.LONG
.DA TYPE.FLOAT
J.CC.UTYPES .DA TYPE.UCHAR
.DA TYPE.UINT
.DA TYPE.ULONG
J.CC.STYPES .DA TYPE.SCHAR
.DA TYPE.SINT
.DA TYPE.SLONG
*--------------------------------------
L.CC.MAIN .DA CC.MAIN
L.CC.SYSCALL .DA CC.SYSCALL
L.CC.FPUCALL .DA CC.FPUCALL
L.PCC.FH .DA PCC.FH
*--------------------------------------
L.PCC.FH .DA PCC.FH
L.PCC.DEBUG .DA PCC.DEBUG
L.PCC.SLEEP .DA PCC.SLEEP
L.PCC.ENTER .DA PCC.ENTER
@ -330,15 +337,15 @@ CS.RUN >PUSHW L.MSG.GREETINGS
jsr CODE.Init
bcs CS.INIT.RTS
jsr CC.FIO.FOpen1st
jsr FIO.FOpen1st
bcs CS.INIT.RTS
*--------------------------------------
CS.RUN.CLOOP jsr CC.CompileFile
CS.RUN.CLOOP jsr CORE.CompileFile
cmp #MLI.E.EOF
bne .9
jsr CC.FIO.FClose
jsr FIO.FClose
bne CS.RUN.CLOOP
*--------------------------------------
jsr PrintSummary
@ -346,22 +353,22 @@ CS.RUN.CLOOP jsr CC.CompileFile
jsr CC.Link
bcs .99
* >DEBUG
>DEBUG
jsr CC.Link.CheckMain
bcs .99
dec bPass2
jsr CC.FIO.FCreate
jsr FIO.FCreate
bcs .99
jsr CODE.Init
bcs .99
jsr CC.FIO.FOpen1st
jsr FIO.FOpen1st
bcs .99
*--------------------------------------
.2 jsr CC.CompileFile
.2 jsr CORE.CompileFile
cmp #MLI.E.EOF
bne .9
@ -369,7 +376,7 @@ CS.RUN.CLOOP jsr CC.CompileFile
jsr CODE.EmitTail
bcs .9
jsr CC.FIO.FClose
jsr FIO.FClose
bne .2
*--------------------------------------
.8 lda #0 Exit Code = Success
@ -416,7 +423,7 @@ CS.RUN.ARGS inc ArgIndex
>SYSCALL ArgV
bcs .90
jsr CC.FIO.LoadLIB.o
jsr FIO.LoadLIB.o
bcc CS.RUN.ARGS
rts
@ -672,12 +679,12 @@ CC.AOPS .PS "="
*--------------------------------------
* Pre Operators: & * + - ! ~ ++ --
*--------------------------------------
CC.PREOPS .PS "&" ref
.PS "*" deref
.PS "+" abs
.PS "-" negate
.PS "!" logical not
.PS "~" bitwise not
CC.PREOPS .PS "&" ref
.PS "*" deref
.PS "+" abs
.PS "-" negate
.PS "!" logical not
.PS "~" bitwise not
.PS "++" pre increase
.PS "--" pre decrease
.HS 00
@ -738,9 +745,6 @@ CC.KW .PS "if"
.PS "continue"
.PS "return"
.PS "sizeof"
.PS "struct"
.PS "union"
.PS "enum"
.HS 00
CC.KW2.IF .PS "else"
.HS 00
@ -754,11 +758,14 @@ CC.SCSPEC .PS "auto"
.PS "typedef"
.HS 00
*--------------------------------------
CC.TYPEQUAL .PS "const" ALL
CC.TYPEQUAL .PS "const" ALL
.PS "volatile"
CC.TYPESPEC .PS "signed" char,int,long
.PS "unsigned" char,int,long
.PS "short" int
CC.TYPESPEC .PS "struct"
.PS "union"
.PS "enum"
.PS "signed" char,int,long
.PS "unsigned" char,int,long
.PS "short" int
CC.TYPES .PS "void"
.PS "char"
.PS "int"
@ -878,7 +885,7 @@ CC.SYSCALL .PS "chtyp"
* .DA #0
* .PS "umount"
* .DA #0
* .PS "online"
* .PS "loadstkobj"
* .DA #0
* .PS "getstkobj"
* .DA #0
@ -1024,12 +1031,12 @@ CC.SYSCALL .PS "chtyp"
.DA #SYS.Realloc
* .PS "getmemptr"
* .DA #0
* .PS "freemem"
* .DA #SYS.FreeMem
.PS "free"
.DA #SYS.FreeMem
.DA #SYS.Free
* .PS "newstkobj"
* .DA #0
* .PS "loadstkobj"
* .DA #0
* .PS "getstkobjptr"
* .DA #0
* .PS "freestkobj"

View File

@ -328,13 +328,13 @@ CS.END
OptionList .AS "CRcr"
OptionVars .DA #bContinue,#bRecurse,#bContinue,#bRecurse
*--------------------------------------
MSG.USAGE .AS "Usage : CHMOD mode [File *,? wildcards allowed]\r\n"
.AS " -C : Continue on error\r\n"
.AZ " -R : Recurse subdirectories\r\n"
MSG.OK .AZ "[OK]"
MSG.ERR .AZ "[%h]\r\n"
MSG.DIR .AZ "Dir :%s..."
MSG.FILE .AZ "File:%s..."
MSG.USAGE .CS "Usage : CHMOD mode [File *,? wildcards allowed]\r\n"
.CS " -C : Continue on error\r\n"
.CZ " -R : Recurse subdirectories\r\n"
MSG.OK .CZ "[OK]"
MSG.ERR .CZ "[%h]\r\n"
MSG.DIR .CZ "Dir :%s..."
MSG.FILE .CZ "File:%s..."
*--------------------------------------
.DUMMY
.OR 0

View File

@ -25,18 +25,18 @@ OptionVars .DA #bContinue,#bContinue
.DA #bRecurse,#bRecurse
.DA #bNoConfirm,#bNoConfirm
*--------------------------------------
MSG.USAGE .AS "Usage : CP [Src File/Dir, *,? wildcards allowed]\r\n"
.AS " -C : Continue on error\r\n"
.AS " -Q : Quiet\r\n"
.AS " -R : Recurse subdirectories\r\n"
.AZ " -Y : Don't prompt for override\r\n"
MSG.DIR .AZ "CP Dir :%s to %s..."
MSG.REG .AZ "CP File:%s to %s..."
MSG.OVERWRITE .AZ "Overwrite %s [Yes,No,All]?"
MSG.OK .AZ "[OK]"
MSG.ERR .AS "[%h]"
MSG.CRLF .AZ "\r\n"
MSG.DONE .AZ "%D File(s) Copied.\r\n"
MSG.USAGE .CS "Usage : CP [Src File/Dir, *,? wildcards allowed]\r\n"
.CS " -C : Continue on error\r\n"
.CS " -Q : Quiet\r\n"
.CS " -R : Recurse subdirectories\r\n"
.CZ " -Y : Don't prompt for override\r\n"
MSG.DIR .CZ "CP Dir :%s to %s..."
MSG.REG .CZ "CP File:%s to %s..."
MSG.OVERWRITE .CZ "Overwrite %s [Yes,No,All]?"
MSG.OK .CZ "[OK]"
MSG.ERR .CS "[%h]"
MSG.CRLF .CZ "\r\n"
MSG.DONE .CZ "%D File(s) Copied.\r\n"
*--------------------------------------
.DUMMY
.OR 0

View File

@ -610,7 +610,7 @@ CSH.LIBC .PS "chtyp"
.PS "setattr"
.PS "mount"
.PS "umount"
.PS "online"
.PS "loadstkobj"
.PS "getstkobj"
.PS "shift"
.PS "argv"
@ -682,9 +682,9 @@ CSH.LIBC .PS "chtyp"
.PS "malloc"
.PS "realloc"
.PS "getmemptr"
.PS "freemem"
.PS "free"
.PS "newstkobj"
.PS "loadstkobj"
.PS "getstkobjptr"
.PS "freestkobj"
.HS 00

View File

@ -459,75 +459,75 @@ CharIn.TmpByte10pA
*--------------------------------------
CS.END
SEQS .EQ *
SEQ.BAR .AZ "\e[7m\e[37;40m"
SEQ.DLG.BAR .AS "\e[0m\e[37;40m"
SEQ.BAR .CZ "\e[7m\e[37;40m"
SEQ.DLG.BAR .CS "\e[0m\e[37;40m"
.DA #C.SO,#'x',#C.SI
.AZ "\e[7m\e[37;40m"
SEQ.DLG .AS "\e[30;46m"
.CZ "\e[7m\e[37;40m"
SEQ.DLG .CS "\e[30;46m"
.DA #C.SO,#'x',#C.SI
.DA #0
SEQ.DLG.VBAR .AS "\e[37;40m"
SEQ.DLG.VBAR .CS "\e[37;40m"
.DA #C.SO,#'x',#C.SI
.DA #0
SEQ.DLG.LBL .AZ "\e[0m\e[30;46m"
SEQ.DLG.TB .AZ "\e[0m\e[93;44m"
SEQ.DLG.BUT .AZ "\e[7m\e[93;44m"
SEQ.EDIT .AS "\e[0m\e[93;44m" +CEOL
SEQ.CEOL .AZ "\e[K"
SEQ.NORM .AZ "\e[0m"
SEQ.INV .AZ "\e[7m"
SEQ.CURSAVE .AZ "\e7"
SEQ.CURRESTORE .AZ "\e8"
SEQ.DLG.LBL .CZ "\e[0m\e[30;46m"
SEQ.DLG.TB .CZ "\e[0m\e[93;44m"
SEQ.DLG.BUT .CZ "\e[7m\e[93;44m"
SEQ.EDIT .CS "\e[0m\e[93;44m" +CEOL
SEQ.CEOL .CZ "\e[K"
SEQ.NORM .CZ "\e[0m"
SEQ.INV .CZ "\e[7m"
SEQ.CURSAVE .CZ "\e7"
SEQ.CURRESTORE .CZ "\e8"
*--------------------------------------
SEQ.RESET .AZ "\ec"
SEQ.INIT .AS "\ec\e(B\e)0"
SEQ.SCROLLRGN .AZ "\e[?7l\e[2;%dr"
SEQ.SCROLLCURUP .AS "\e[?7l\e[%d;%dr"
SEQ.SCROLLUP .AZ "\eD"
SEQ.SCROLLCURDN .AS "\e[?7l\e[%d;%dr"
SEQ.SCROLLDN .AZ "\eM"
SEQ.RESET .CZ "\ec"
SEQ.INIT .CS "\ec\e(B\e)0"
SEQ.SCROLLRGN .CZ "\e[?7l\e[2;%dr"
SEQ.SCROLLCURUP .CS "\e[?7l\e[%d;%dr"
SEQ.SCROLLUP .CZ "\eD"
SEQ.SCROLLCURDN .CS "\e[?7l\e[%d;%dr"
SEQ.SCROLLDN .CZ "\eM"
*--------------------------------------
MSG.TERMCAP .AZ "\e[999;999H\e[6n"
MSG.TOPBAR .AZ "A2osX Edit %d.%d:%s (%s)"
MSG.TXTCR .AZ "TXT/CR"
MSG.TXTCRLF .AZ "TXT/CRLF"
MSG.ASM .AZ "ASM"
MSG.STATUSBAR .AZ "Press Ctrl-A For Help Len:%5D Pos:%5D Col:%3d Line:%5D"
MSG.STATUSBAR.H .AZ "Press any key to exit this screen "
MSG.STATUSBAR.U .AZ "Quit without Saving [Y/N] ? "
MSG.STATUSBAR.S .AZ "%s Saved."
MSG.STATUSBAR.E .AZ "Error:%h"
MSG.GOTOXY .AZ "\e[%d;%dH"
MSG.HELPLINE .AZ "\e[0m\e[93;44m%S\e[K"
MSG.TERMCAP .CZ "\e[999;999H\e[6n"
MSG.TOPBAR .CZ "A2osX Edit %d.%d:%s (%s)"
MSG.TXTCR .CZ "TXT/CR"
MSG.TXTCRLF .CZ "TXT/CRLF"
MSG.ASM .CZ "ASM"
MSG.STATUSBAR .CZ "Press Ctrl-A For Help Len:%5D Pos:%5D Col:%3d Line:%5D"
MSG.STATUSBAR.H .CZ "Press any key to exit this screen "
MSG.STATUSBAR.U .CZ "Quit without Saving [Y/N] ? "
MSG.STATUSBAR.S .CZ "%s Saved."
MSG.STATUSBAR.E .CZ "Error:%h"
MSG.GOTOXY .CZ "\e[%d;%dH"
MSG.HELPLINE .CZ "\e[0m\e[93;44m%S\e[K"
*--------------------------------------
MSG.HELP >PSTR "All commands:"
>PSTR "-------------"
>PSTR " Ctrl-A : This help screen"
>PSTR " Ctrl-B : Mark beginning of selection"
>PSTR " Ctrl-C : Copy selection to clipboard"
>PSTR " Ctrl-D : Delete selection"
>PSTR " Ctrl-E : Mark end of selection"
>PSTR " Ctrl-F : Find/Replace..."
>PSTR " Ctrl-G : Go to start of current line"
>PSTR " Ctrl-L : Go to end of current line"
>PSTR " Ctrl-N : Find next"
>PSTR " Ctrl-O : Page up"
>PSTR " Ctrl-P : Page down"
>PSTR " Ctrl-Q : Quit"
>PSTR " Ctrl-R : Replace next"
>PSTR " Ctrl-S : Save file..."
>PSTR " Ctrl-T : Go to top of file"
>PSTR " Ctrl-V : Paste clipboard at cursor position"
>PSTR " Ctrl-W : Erase current line"
>PSTR " Ctrl-X : Cut block to clipboard"
>PSTR " Ctrl-Y : Go to end of file"
>PSTR " Ctrl-Z : Erase char under cursor"
MSG.HELP .PS "All commands:"
.PS "-------------"
.PS " Ctrl-A : This help screen"
.PS " Ctrl-B : Mark beginning of selection"
.PS " Ctrl-C : Copy selection to clipboard"
.PS " Ctrl-D : Delete selection"
.PS " Ctrl-E : Mark end of selection"
.PS " Ctrl-F : Find/Replace..."
.PS " Ctrl-G : Go to start of current line"
.PS " Ctrl-L : Go to end of current line"
.PS " Ctrl-N : Find next"
.PS " Ctrl-O : Page up"
.PS " Ctrl-P : Page down"
.PS " Ctrl-Q : Quit"
.PS " Ctrl-R : Replace next"
.PS " Ctrl-S : Save file..."
.PS " Ctrl-T : Go to top of file"
.PS " Ctrl-V : Paste clipboard at cursor position"
.PS " Ctrl-W : Erase current line"
.PS " Ctrl-X : Cut block to clipboard"
.PS " Ctrl-Y : Go to end of file"
.PS " Ctrl-Z : Erase char under cursor"
.HS 00
*--------------------------------------
MSG.NEWFILE .AZ "newfile"
EscChars .AS "DBAC"
EscChars .AS "DABC"
EscChars.Cnt .EQ *-EscChars
EscAscii .HS 080A0B15
EscAscii .DA #C.BS,#C.VT,#C.LF,#C.FS
*--------------------------------------
S.DLG.Size .EQ 0
S.DLG.X .EQ 1

View File

@ -284,31 +284,49 @@ CS.QUIT lda hFont
rts
*--------------------------------------
LoadResources >LDYA L.FONTFILE
>SYSCALL LoadStkObj
bcs .99
ldx #S.FI.T.FON
jsr .1
bcs .9
stx hFont
>LDYA L.FONTFILEB
>SYSCALL LoadStkObj
bcs .99
ldx #S.FI.T.FON
jsr .1
bcs .9
stx hFontB
>LDYA L.MARILYNFILE
>SYSCALL LoadStkObj
.99 bcs .9
ldx #S.FI.T.PIX
jsr .1
bcs .9
stx CB.PIX+S.CB.SrcPtr
>LDYA L.LOGOFILE
>SYSCALL LoadStkObj
ldx #S.FI.T.PIX
jsr .1
bcs .9
stx CB.LOGO+S.CB.SrcPtr
>LDYA L.PALETTEFILE
>SYSCALL LoadStkObj
ldx #S.FI.T.PIX
jsr .1
bcs .9
stx CB.PALETTE+S.CB.SrcPtr
.9 rts
.1 >PUSHYA
>PUSHBI O.RDONLY
txa
>PUSHA type
>PUSHWZ Aux type
>SYSCALL LoadStkObj
rts
*--------------------------------------
GFX.Open >PUSHW L.DEVNAME.GFX
>PUSHBI 0

View File

@ -7,7 +7,7 @@ NEW
*--------------------------------------
.INB inc/macros.i
.INB inc/a2osx.i
.INB inc/kernel.i
.INB inc/mli.i
.INB inc/gfx.i
.INB inc/libgui.i
*--------------------------------------
@ -55,7 +55,10 @@ CS.INIT >LDYA L.LIBGUI
* clc
.9 rts
*--------------------------------------
CS.RUN >LDYA L.LOGOFILE
CS.RUN >PUSHW L.LOGOFILE
>PUSHBI O.RDONLY
>PUSHBI S.FI.T.PIX
>PUSHWZ Aux type
>SYSCALL LoadStkObj
bcs .9
@ -151,7 +154,7 @@ hLIBGUI .BS 1
*--------------------------------------
MouseData .BS S.MOUSE
*--------------------------------------
LOGOFILE .AZ "${ROOT}root/bmp/A2OSX.LOGO"
LOGOFILE .AZ "${ROOT}A2osX.logo"
WND.TITLE .AZ "Window Title"
WND.STATUS .AZ "Window status bar message"
*--------------------------------------

View File

@ -110,6 +110,7 @@ CS.RUN ldy #S.PS.hStdOut
.10 dec bToFile
.1 inc ArgCount
lda ArgCount
>SYSCALL ArgV
bcs .6
@ -121,8 +122,9 @@ CS.RUN ldy #S.PS.hStdOut
ldy #1
lda (ZPPtr1),y
beq .99
ldx #OptionVars-OptionList-1
.20 ldx #OptionVars-OptionList-1
.2 cmp OptionList,x
beq .3
@ -130,7 +132,7 @@ CS.RUN ldy #S.PS.hStdOut
dex
bpl .2
>PUSHW L.MSG.USAGE
.99 >PUSHW L.MSG.USAGE
>PUSHBI 0
>SYSCALL PrintF
@ -138,9 +140,15 @@ CS.RUN ldy #S.PS.hStdOut
sec
rts
.3 ldy OptionVars,x
lda #$80
sta $0,y
.3 lda OptionVars,x
tax
* sec
ror $0,x
iny
lda (ZPPtr1),y
bne .20
bra .1
.4 >LDYA ZPPtr1
@ -880,20 +888,20 @@ CS.END
OptionList .AS "ACFLRacflr"
OptionVars .DA #bAllmostAll,#bColumn,#bFullPath,#bLong,#bRecurse,#bAllmostAll,#bColumn,#bFullPath,#bLong,#bRecurse
*--------------------------------------
MSG.USAGE .AS "Usage : LS [-A] [-C] [-F] [-L] [-R] [filespec]\r\n"
.AS " -A : Show all files\r\n"
.AS " -C : List in multiple columns\r\n"
.AS " -F : Show full paths\r\n"
.AS " -L : Use long listing format\r\n"
.AZ " -R : Recursively list subdirectories\r\n"
MSG.USAGE .CS "Usage : LS [-A] [-C] [-F] [-L] [-R] [filespec]\r\n"
.CS " -A : Show all files\r\n"
.CS " -C : List in one column\r\n"
.CS " -F : Show full paths\r\n"
.CS " -L : Use long listing format\r\n"
.CZ " -R : Recursively list subdirectories\r\n"
*--------------------------------------
MSG.ENTER .AZ "Directory:"
MSG.ENTER .CZ "Directory:"
*--------------------------------------
MSG.REGEXT .AZ " %10u "
MSG.DIREXT .AZ " <dir> "
MSG.BDEVEXT .AZ " %5D/%5D s%dd%d "
MSG.REGEXT .CZ " %10u "
MSG.DIREXT .CZ " <dir> "
MSG.BDEVEXT .CZ " %5D/%5D s%dd%d "
*--------------------------------------
MSG.SETCOLOR .AZ "\e[1;%dm"
MSG.SETCOLOR .CZ "\e[1;%dm"
PRODOS.FT.HEX .HS 0406FAFCFDCBCCCFFF
PRODOS.FT.TXT .AZ "txt"
.AZ "bin"

View File

@ -246,14 +246,13 @@ CS.QUIT clc
rts
*--------------------------------------
CS.END
MSG0 .AZ "hFD Type Name Addr Status Typ/Sub IDString Version Size (BLK)"
MSG.DEV .AZ "%3d %5s %12s %H "
MSG.DEV.ERR .AZ "Device Error : $%h\r\n"
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.PIPE .AZ "%3d %5s %s\r\n"
MSG0 .CZ "hFD Type Name Addr Status Typ/Sub IDString Version Size (BLK)"
MSG.DEV .CZ "%3d %5s %12s %H "
MSG.DEV.ERR .CZ "Device Error : $%h\r\n"
MSG.DEV.DIB .CZ "%s $%h/$%h %16S %03d.%03d "
MSG.DEV.B .CZ "%10u\r\n"
MSG.DEV.C .CZ "n/a\r\n"
MSG.PIPE .CZ "%3d %5s %s\r\n"
*--------------------------------------
MSG.SFLAGS .AS "bwrlneio"
NO.PATH .AZ "(no path)"
@ -269,7 +268,7 @@ FD.T.PIPE .AZ "PIPE"
*--------------------------------------
BLANK.DIB .DA #0 #S.DIB.S.BLOCK+S.DIB.S.WRITE+S.DIB.S.READ
.BS 3
>PSTR "(No IDS String!)"
.PS "(No IDS String!)"
.DA #0 #S.DIB.T.PRODOS
.DA #0
.DA 0 K.VER

View File

@ -4,9 +4,35 @@ NEW
.OP 65C02
.OR $2000
.TF bin/mkdir
*--------------------------------------
*/-------------------------------------
* # MKDIR
* Create directories
*
* ## Arguments
* **-M mode**
* Apply specified mode to created directories
*
* **-P**
* Create parent directories if required
*
* **-V**
* Verbose mode
*
* ## Return Value
*\-------------------------------------
.INB inc/macros.i
.INB inc/a2osx.i
*--------------------------------------
.DUMMY
.OR ZPBIN
ZS.START
ZPPtr1 .BS 2
ZPMode .BS 2
ArgIndex .BS 1
ArgLen .BS 1
bParent .BS 1
bVerbose .BS 1
ZS.END .ED
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
@ -25,41 +51,254 @@ CS.START cld
*--------------------------------------
.1 .DA CS.INIT
.DA CS.RUN
.DA CS.DOEVENT
.DA CS.DOEVENT
.DA CS.QUIT
L.MSG.USAGE .DA MSG.USAGE
L.MSG.DIR .DA MSG.DIR
L.MSG.OK .DA MSG.OK
L.MSG.ERR .DA MSG.ERR
.DA 0
*--------------------------------------
CS.INIT clc
CS.INIT
CS.QUIT clc
rts
*--------------------------------------
CS.RUN lda #1
>SYSCALL ArgV
bcs .99
>PUSHYA
>PUSHWI S.STAT.MODE.FO+S.STAT.MODE.FG+S.STAT.MODE.FU
>SYSCALL MKDir
CS.RUN >LDYAI S.STAT.MODE.FO+S.STAT.MODE.FG+S.STAT.MODE.FU
>STYA ZPMode
.1 jsr CS.RUN.GetNextArg
bcs .8
lda (ZPPtr1)
cmp #'-'
bne .6
ldy #1
lda (ZPPtr1),y
beq .9
.2 ldx #OptionVars-OptionList-1
.3 cmp OptionList,x
beq .5
dex
bpl .3
cmp #'M'
beq .4
cmp #'m'
bne .9
.4 jsr CS.RUN.GetNextArg
bcs .9
jsr CS.RUN.Str2Mode
bcc .1
bra .9
.5 lda OptionVars,x
tax
* sec
ror $0,x
iny
lda (ZPPtr1),y
bne .2
bra .1
.6 lda (pData)
bne .9
>PUSHW ZPPtr1
>PUSHW pData
>SYSCALL RealPath
bcc .1
.9 >LDYA L.MSG.USAGE
>SYSCALL PutS
lda #E.SYN
sec
rts
.8 lda (pData)
beq .9
*--------------------------------------
CS.RUN.Create bit bParent
bmi CS.RUN.CreateP
jsr CS.RUN.Create1
bcs .9
lda #0
sec
.9 rts
*--------------------------------------
CS.RUN.CreateP ldy #$ff
.99 lda #E.SYN
.1 iny
lda (pData),y
bne .1
sty ArgLen
ldy #0 skip /
.2 iny
lda (pData),y
beq .8 /VOL
eor #'/'
bne .2
.3 iny /VOL/
lda (pData),y
beq .4 /VOL/DIR
eor #'/'
bne .3
.4 sty ArgIndex /VOL/DIR/
sta (pData),y /VOL/DIR
>PUSHW pData
>PUSHEA.G StatBuf
>SYSCALL Stat
bcc .5
jsr CS.RUN.Create1
bcs .9
.5 ldy ArgIndex
cpy ArgLen
beq .8
lda #'/'
sta (pData),y /VOL/DIR/.....
bra .3
.8 lda #0
sec
.9 rts
*--------------------------------------
CS.RUN.Create1 clc
bit bVerbose
bpl .1
>PUSHW L.MSG.DIR
>PUSHW pData
>PUSHBI 2
>SYSCALL PrintF
.1 >PUSHW pData
>PUSHW ZPMode
>SYSCALL MKDir
bit bVerbose
bpl .8
bcs .2
>LDYA L.MSG.OK
>SYSCALL PutS
clc
rts
.2 pha
>PUSHW L.MSG.ERR
pla
pha
>PUSHA
>PUSHBI 1
>SYSCALL PrintF
pla
sec
.8 rts
*--------------------------------------
CS.RUN.GetNextArg
inc ArgIndex
lda ArgIndex
>SYSCALL ArgV
bcs .9
>STYA ZPPtr1
.9 rts
*--------------------------------------
CS.RUN.Str2Mode ldy #$ff
.1 iny
lda (ZPPtr1),y
bne .1
cpy #4 must be "765" max
bcs .9
stz ZPMode
stz ZPMode+1
ldy #0
.2 lda (ZPPtr1),y
beq .8
cmp #'0'
bcc .9
cmp #'7'+1
bcs .9
asl ZPMode
rol ZPMode+1
asl ZPMode
rol ZPMode+1
asl ZPMode
rol ZPMode+1
and #7
clc
adc ZPMode
sta ZPMode
bcc .3
inc ZPMode+1
.3 iny
bra .2
.8 clc
rts
.9
*--------------------------------------
CS.DOEVENT sec
rts
*--------------------------------------
CS.QUIT clc
rts
*--------------------------------------
CS.END
*--------------------------------------
OptionList .AS "PpVv"
OptionVars .DA #bParent,#bParent
.DA #bVerbose,#bVerbose
*--------------------------------------
MSG.USAGE .CS "Usage : MKDIR newdir\r\n"
.CS " -M mode : set mode\r\n"
.CS " -P : Make parent directories as needed\r\n"
.CZ " -V : Verbose"
MSG.DIR .CZ "MKDir:%s..."
MSG.OK .CZ "[OK]"
MSG.ERR .CS "[%h]"
MSG.CRLF .CZ "\r\n"
*--------------------------------------
.DUMMY
.OR 0
DS.START
DS.START .BS 128 Path buffer
StatBuf .BS S.STAT
DS.END .ED
*--------------------------------------
MAN

View File

@ -61,11 +61,12 @@ L.MSG.PauseErase .DA MSG.PauseErase
CS.INIT clc
rts
*--------------------------------------
CS.RUN
CS.RUN
.1 inc ArgCount
lda ArgCount
>SYSCALL ArgV
bcs .7
>STYA ZPPtr1
lda (ZPPtr1)
cmp #'-'
@ -74,12 +75,13 @@ CS.RUN
ldy #1
lda (ZPPtr1),y
ldx OptionList
ldx #OptionVars-OptionList-1
.2 cmp OptionList,x
beq .3
dex
bne .2
bpl .2
.99 >PUSHW L.MSG.USAGE
>PUSHBI 0
@ -88,7 +90,7 @@ CS.RUN
sec
.9 rts
.3 ldy OptionVars-1,x
.3 ldy OptionVars,x
lda #$80
sta (pData),y
bra .1
@ -305,19 +307,19 @@ CS.DOEVENT sec
*--------------------------------------
CS.END
*--------------------------------------
OptionList >PSTR "NnHhPpSs"
OptionList .AS "NnHhPpSs"
OptionVars .DA #bLineNum,#bLineNum,#bHelp,#bHelp,#bPage,#bPage,#bEscCodes,#bEscCodes
*--------------------------------------
MSG.USAGE .AS "Usage : MORE <File>\r\n"
.AS " -H : This help screen\r\n"
.AS " -N : Number all output lines\r\n"
.AS " -P : Page mode, no scroll\r\n"
.AS " -S : Process ESC codes"
MSG.CRLF .AZ "\r\n"
MSG.Init .AZ "\e[?7l"
MSG.NUMLINE .AZ "%5D:"
MSG.Pause .AZ "\r\e[7m --- 'SPACE' for more, 'CR' one line, 'Q/q' to quit --- \e[0m"
MSG.PauseErase .AZ "\r\e[2K"
MSG.USAGE .CS "Usage : MORE <File>\r\n"
.CS " -H : This help screen\r\n"
.CS " -N : Number all output lines\r\n"
.CS " -P : Page mode, no scroll\r\n"
.CS " -S : Process ESC codes"
MSG.CRLF .CZ "\r\n"
MSG.Init .CZ "\e[?7l"
MSG.NUMLINE .CZ "%5D:"
MSG.Pause .CZ "\r\e[7m --- 'SPACE' for more, 'CR' one line, 'Q/q' to quit --- \e[0m"
MSG.PauseErase .CZ "\r\e[2K"
*--------------------------------------
.DUMMY
.OR 0

View File

@ -25,18 +25,18 @@ OptionVars .DA #bContinue,#bContinue
.DA #bRecurse,#bRecurse
.DA #bNoConfirm,#bNoConfirm
*--------------------------------------
MSG.USAGE .AS "Usage : MV [Src File/Dir, *,? wildcards allowed]\r\n"
.AS " -C : Continue on error\r\n"
.AS " -Q : Quiet\r\n"
.AS " -R : Recurse subdirectories\r\n"
.AZ " -Y : Dont't prompt for override\r\n"
MSG.DIR .AZ "MV Dir :%s to %s..."
MSG.REG .AZ "MV File:%s to %s..."
MSG.OVERWRITE .AZ "Overwrite %s [Yes,No,All]?"
MSG.OK .AZ "[OK]"
MSG.ERR .AS "[%h]"
MSG.CRLF .AZ "\r\n"
MSG.DONE .AZ "%D File(s) Moved.\r\n"
MSG.USAGE .CS "Usage : MV [Src File/Dir, *,? wildcards allowed]\r\n"
.CS " -C : Continue on error\r\n"
.CS " -Q : Quiet\r\n"
.CS " -R : Recurse subdirectories\r\n"
.CZ " -Y : Dont't prompt for override\r\n"
MSG.DIR .CZ "MV Dir :%s to %s..."
MSG.REG .CZ "MV File:%s to %s..."
MSG.OVERWRITE .CZ "Overwrite %s [Yes,No,All]?"
MSG.OK .CZ "[OK]"
MSG.ERR .CS "[%h]"
MSG.CRLF .CZ "\r\n"
MSG.DONE .CZ "%D File(s) Moved.\r\n"
*--------------------------------------
.DUMMY
.OR 0

View File

@ -24,16 +24,16 @@ OptionVars .DA #bContinue,#bContinue
.DA #bQuiet,#bQuiet
.DA #bRecurse,#bRecurse
*--------------------------------------
MSG.USAGE .AS "Usage : RM [File/Dir, *,? wildcards allowed]\r\n"
.AS " -C : Continue on error\r\n"
.AS " -Q : Quiet\r\n"
.AZ " -R : Recurse subdirectories\r\n"
MSG.DIR .AZ "RM Dir :%s..."
MSG.REG .AZ "RM File:%s..."
MSG.OK .AZ "[OK]"
MSG.ERR .AS "[%h]"
MSG.CRLF .AZ "\r\n"
MSG.DONE .AZ "%D File(s) Removed.\r\n"
MSG.USAGE .CS "Usage : RM [File/Dir, *,? wildcards allowed]\r\n"
.CS " -C : Continue on error\r\n"
.CS " -Q : Quiet\r\n"
.CZ " -R : Recurse subdirectories\r\n"
MSG.DIR .CZ "RM Dir :%s..."
MSG.REG .CZ "RM File:%s..."
MSG.OK .CZ "[OK]"
MSG.ERR .CS "[%h]"
MSG.CRLF .CZ "\r\n"
MSG.DONE .CZ "%D File(s) Removed.\r\n"
*--------------------------------------
.DUMMY
.OR 0

View File

@ -19,16 +19,13 @@ CL.PrintPrompt >PUSHW L.PS1
phx
>PUSHYA
>PUSHBI 0
>SYSCALL PrintF
jsr PrintYANoCR
pla
>SYSCALL FreeMem
.1 >PUSHW L.MSG.PROMPT
>PUSHBI 0
>SYSCALL PrintF
.1 >LDYA L.MSG.PROMPT
jsr PrintYANoCR
.9 rts
*--------------------------------------
CL.READN0A tax
@ -188,7 +185,9 @@ CL.CHARIN.CTRL cpx #C.CR
.8 clc
.9 rts
*--------------------------------------
CL.CLR lda (ZPCLBuf)
CL.CLR >STZ.G HIS.Ptr
CL.CLR.1 lda (ZPCLBuf)
beq CL.Reset.1
>LDA.G CL.bSilent
@ -213,7 +212,8 @@ CL.CLR lda (ZPCLBuf)
lda (ZPCLBuf),y
bne .3
jsr CL.Print
>LDYA ZPCLBuf
jsr PrintYANoCR
*--------------------------------------
CL.Reset lda #0
sta (ZPCLBuf)
@ -329,14 +329,6 @@ CL.PrintEOL >LDA.G CL.Ptr
CL.PrintEOL.8 clc
rts
*--------------------------------------
CL.Print ldy #S.PS.hStdOut
lda (pPS),y
>PUSHA
>PUSHW ZPCLBuf
>SYSCALL FPutS
rts
*--------------------------------------
MAN
SAVE usr/src/bin/sh.s.cl
LOAD usr/src/bin/sh.s

View File

@ -2,6 +2,99 @@ NEW
AUTO 3,1
.LIST OFF
*--------------------------------------
* https://linuxize.com/post/how-to-create-bash-aliases/
*--------------------------------------
CMD.ALIAS lda (ZPArgVBufPtr)
bne CMD.ALIAS.ADD
>LDA.G hAliases
beq .8
ldy #0
lda #1
.1 >STYA ZPTmpW Save KeyID
clc
jsr CMD.ALIAS.Push
>SYSCALL SListGetByID
bcs .8
>STYA ZPPtr1 NextID
>LDYA ZPCLBuf
jsr PrintYANoCR
bcs .9
sec
jsr CMD.ALIAS.Push
>SYSCALL SListGetData
bcs .9
>PUSHW L.MSG.ALIAS
>PUSHW ZPCLBuf
>PUSHBI 2
>SYSCALL PrintF
bcs .9
>LDYA ZPPtr1
bra .1
.8 clc
.9 rts
*--------------------------------------
CMD.ALIAS.ADD >LDYA ZPArgVBufPtr
>STYA ZPVarNamePtr
jsr CORE.ArgV.Next
beq .9
cmp #'='
bne .99
jsr CORE.ArgV.Next
beq .9
>LDA.G hAliases
bne .1
lda #0
>SYSCALL SListNew
bcs .99
>STA.G hAliases
.1 >PUSHA
>PUSHW ZPVarNamePtr
>SYSCALL SListNewKey
bcs .99
>STYA ZPTmpW Save KeyID
>PUSHB.G hAliases
>PUSHW ZPTmpW KeyID
>PUSHW ZPArgVBufPtr DataPtr
>PUSHWZ String Mode
>SYSCALL SListAddData
rts
.9 lda #E.CSYN
sec
.99 rts
*--------------------------------------
CMD.ALIAS.Push >PUSHB.G hAliases
>PUSHW ZPTmpW KeyID
>PUSHW ZPCLBuf
bcc .8
>PUSHWI $ffff All
>PUSHWZ from Start
.8 rts
*--------------------------------------
CMD.. lda (ZPArgVBufPtr)
beq CMD...9
@ -9,9 +102,9 @@ CMD.. lda (ZPArgVBufPtr)
>SYSCALL LoadTxtFile
bcs CMD.SHIFTA.RTS
>LDYA ZPArgVBufPtr
>LDYA ZPArgVBufPtr Exec . file
CMD..EXEC.YAX jsr CORE.Load.YAX Exec . file
CMD..EXEC.YAX jsr CORE.Load.YAX Y,A = Args, X = Code
bcs CMD.SHIFTA.RTS
lda #$C0+C..
@ -55,7 +148,7 @@ CMD.PUSHD >LDA.G PUSHD.STACK
lda (ZPArgVBufPtr)
bne CMD.CD.0
.8 clc
* clc
.9 rts
*--------------------------------------
CMD.POPD >LDA.G PUSHD.STACK
@ -170,21 +263,19 @@ CMD.SET.1
.1 jsr CMD.IsSwitch
bcs .6
ldx #SET.VARS-SET.FLAGS
ldx #SET.VARS-SET.FLAGS-1
.2 dex
bmi .4
.2 cmp SET.FLAGS,x
bne .3
cmp SET.FLAGS,x
bne .2
ldy SET.VARS,x
lda (pData),y
eor #$ff
sta (pData),y
lda SET.VARS,x
eor bState
sta bState
bra .5
.3 dex
bpl .2
.4 cmp #'F'
bne .99
@ -308,7 +399,8 @@ CMD.ECHO stz ZPPtr1 echo -N
lda #C.SPACE
>SYSCALL PutChar
.3 jsr CMD.PrintArgVBufPtr
.3 >LDYA ZPArgVBufPtr
jsr PrintYANoCR
bcs .9
inc ZPPtr1+1
@ -319,13 +411,11 @@ CMD.ECHO stz ZPPtr1 echo -N
.7 bit ZPPtr1
bmi .8
>PUSHW L.MSG.ECHOCRLF
>PUSHBI 0
>SYSCALL PrintF
.9 rts
>LDYA L.MSG.ECHOCRLF
jmp PrintYANoCR
.8 clc
rts
.9 rts
CMD.ECHO.CSYN lda #E.CSYN
sec
@ -355,7 +445,8 @@ CMD.READ lda (ZPArgVBufPtr)
jsr CORE.ArgV.Next
beq CMD.ECHO.CSYN
jsr CMD.PrintArgVBufPtr
>LDYA ZPArgVBufPtr
jsr PrintYANoCR
bcs CMD.ECHO.RTS
bra .5
@ -408,8 +499,8 @@ CMD.SLEEP lda (ZPArgVBufPtr)
CMD.SLEEP.RTS rts
*--------------------------------------
CMD.PAUSE lda #$FF
>STA.G bPause
CMD.PAUSE lda #bState.Pause
tsb bState
clc
rts
*--------------------------------------
@ -529,14 +620,14 @@ CMD.FUNCTION lda (ZPArgVBufPtr)
jsr CORE.StkGetCtx
bcc .9 No context allowed
>LDA.G hFuncList
>LDA.G hFunctions
bne .1
lda #SL..+SL._
>SYSCALL SListNew
bcs .99
>STA.G hFuncList
>STA.G hFunctions
.1 >PUSHA
>PUSHW ZPArgVBufPtr
@ -597,21 +688,21 @@ CMD.FUNCTION lda (ZPArgVBufPtr)
inc ZPPtr2+1
.15 jsr CORE.GetNextChar
bne .12
bcc .12
.6 txa
bpl .9
.7 jsr CORE.GetNextChar skip ending '}'
>PUSHB.G hFuncList
>PUSHB.G hFunctions
>PUSHW ZPTmpW KeyID
>PUSHW ZPPtr1 DataPtr
>PUSHW ZPPtr2 DataLen
>SYSCALL SListAddData
bcs .99
>PUSHB.G hFuncList
>PUSHB.G hFunctions
>PUSHW ZPTmpW KeyID
>PUSHW L.PtrZero DataPtr
>PUSHWI 1 DataLen
@ -623,7 +714,7 @@ CMD.CALL jsr CMD.CALL.GETFUNC
>STYA ZPTmpW KeyID
>PUSHB.G hFuncList
>PUSHB.G hFunctions
>PUSHW ZPTmpW KeyID
>PUSHWZ Allocate..
>PUSHWI $ffff all
@ -640,10 +731,10 @@ CMD.CALL jsr CMD.CALL.GETFUNC
jmp CORE.StkPush
*--------------------------------------
CMD.CALL.GETFUNC
>LDA.G hFuncList
>LDA.G hFunctions
beq CMD.CALL.UNDEF
>PUSHB.G hFuncList
>PUSHB.G hFunctions
>PUSHW ZPArgVBufPtr
>SYSCALL SListLookup
bcc CMD.CALL.RTS
@ -678,8 +769,9 @@ CMD.EXIT lda (ZPArgVBufPtr)
rts
.8 jsr CMD.EXIT.FILE
lda #$ff
>STA.G bExitOnEOF
lda #bState.ExitOnEOF
tsb bState
clc
.9 rts
*--------------------------------------
@ -834,6 +926,7 @@ CMD.FOR jsr CORE.StkGetCtx
jsr CORE.ArgV.Next
beq CMD.E.CSYN
>PUSHW L.IN
>PUSHW ZPArgVBufPtr
>SYSCALL StrCaseCmp
@ -995,8 +1088,10 @@ CMD.NEXT.LIST.TOKEN
ldy #0
.10 jsr GetPtr1NextChar
beq .3
cmp #C.SPACE
beq .10
sta (ZPCLBuf),y
iny
.1 jsr GetPtr1NextChar
@ -1207,7 +1302,7 @@ CMD.IsSwitch lda (ZPArgVBufPtr)
cmp #'9'+1
bcc .9
.1 tax
tax
iny
lda (ZPArgVBufPtr),y
bne .9
@ -1218,12 +1313,6 @@ CMD.IsSwitch lda (ZPArgVBufPtr)
.9 sec
rts
*--------------------------------------
CMD.PrintArgVBufPtr
>PUSHW ZPArgVBufPtr
>PUSHBI 0
>SYSCALL PrintF
rts
*--------------------------------------
MAN
SAVE usr/src/bin/sh.s.cmd
LOAD usr/src/bin/sh.s

View File

@ -1,34 +1,39 @@
NEW
AUTO 3,1
.LIST OFF
.LIST OFF
*--------------------------------------
CORE.Init lda #PUSHD.STACK
>STA.G PUSHD.STACK
tay
sta (pdata),y
lda #CODE.STACK
tay
sta (pdata),y
.9 rts
*--------------------------------------
CORE.FUNCRESET >LDA.G hFuncList
CORE.FUNCRESET >LDA.G hFunctions
beq .8
>SYSCALL SListFree
>STZ.G hFuncList
.8 rts
>STZ.G hFunctions
.8 rts
*--------------------------------------
* stack-6 InputBuf
* stack-4 InputBufPtr
* stack-6,7 InputBuf
* stack-4,5 InputBufPtr
* stack-3 old ARGC
* stack-2 old ARGV
* stack-1 new hCode
* stack
* stack
*--------------------------------------
CORE.Load.YAX stx M32.ACC X = Code to Execute
CORE.Load.YAX stx LOAD.hCode X = Code to Execute
>SYSCALL ArgVDup Y,A = ArgV
bcs .9
stx M32.ACC+1 X = hARGV
sta M32.ACC+2 A = ARGC
stx LOAD.hArgs X = hARGV
sta LOAD.ArgCnt A = ARGC
lda #8
jsr CORE.StkCheck
@ -48,17 +53,17 @@ CORE.Load.YAX stx M32.ACC X = Code to Execute
jsr CORE.StkPush old hARGV
ldy #S.PS.ARGC
lda M32.ACC+2 new ARGC
lda LOAD.ArgCnt new ARGC
dec Skip ARG0 in count
sta (pPS),y
iny #S.PS.hARGV
lda M32.ACC+1
lda LOAD.hArgs
sta (pPS),y new hARGV
lda M32.ACC new code
lda LOAD.hCode new code
jsr CORE.StkPush
* lda M32.ACC
* lda LOAD.hCode
>SYSCALL GetMemPtr
>STYA ZPInputBuf
>STYA ZPInputBufPtr
@ -72,7 +77,7 @@ CORE.Load.YAX stx M32.ACC X = Code to Execute
* Input : ZPInputBufPtr (String)
* Tokenize ZPArgVBuf
* :LOOP
* if CmdSep=| :
* if CmdSep=| :
* set hStdIn = hStdOut
* set hStdOut = Std
* GetCmd from line until | or EOL
@ -95,13 +100,17 @@ CORE.Run.EOF jsr CORE.StkPull
bcs *
cmp #$C0+C.. check CALL . CL context
beq .1
cmp #$C0+C.CALL
beq .1
cmp #$C0+C.CLEXEC
bne .9
.1 jsr CMD.EXIT.FILE
jsr IO.Reset
lda #0
sec
jmp CORE.Run.Exit Ending 0, CS,A=0
@ -109,7 +118,7 @@ CORE.Run.EOF jsr CORE.StkPull
.9 lda #E.UNEXPEOF
sec
jmp CORE.Run.Exit
CORE.Run.RTS rts
*--------------------------------------
CORE.Run jsr IO.Reset
@ -122,14 +131,9 @@ CORE.Run jsr IO.Reset
txa
>STA.G CORE.hArgVBuf
clc
.HS B0 BCS
>STZ.G CORE.bPipeIn
CORE.Run.1 sec coming from PIPE OUT
ror
>STA.G CORE.bPipeIn
>LDYA ZPInputBufPtr Save Actual ptr for looping
CORE.Run.1 >LDYA ZPInputBufPtr Save Actual ptr for looping
>STYA ZPInputCmdPtr
>LDYA ZPArgVBuf Reset ArgV Buffer
@ -137,7 +141,7 @@ CORE.Run.1 sec coming from PIPE OUT
lda #0
sta (ZPArgVBuf)
sec
ror CORE.IntCmd assume external
@ -154,15 +158,41 @@ CORE.Run.1 sec coming from PIPE OUT
bra .8
.33 cmp #'#' commented line?
bne .4
bne CORE.Run.3
.12 jsr CORE.SkipLine
.8 lda #0
clc
.9 jmp CORE.Run.Exit EOL, CS,A=0
*--------------------------------------
CORE.Run.3 >LDA.G hAliases
beq CORE.Run.4
.4 >LDYA L.CMD internal command ?
>PUSHA
>PUSHW ZPInputBufPtr
>SYSCALL SListLookup
bcs CORE.Run.4
>STYA ZPTmpW Save KeyID
txa
jsr CORE.SkipCharsA
>PUSHB.G hAliases
>PUSHW ZPTmpW KeyID
>PUSHWZ Allocate..
>PUSHWI $ffff all
>PUSHWZ From Start
>SYSCALL SListGetData X = hMem
bcs .9
jsr CORE.PushBufX
bcc CORE.Run.3
.9 rts
*--------------------------------------
CORE.Run.4 >LDYA L.CMD internal command ?
jsr CORE.LookupInputBuf
bcc .41
@ -170,11 +200,10 @@ CORE.Run.1 sec coming from PIPE OUT
bra .42
.41 stx CORE.IntCmd
asl CORE.IntCmd
jsr CORE.SkipCharsA
.42 jsr CORE.StkGet
bcs CORE.Run.7 no particular context, exec...
.42 jsr CORE.StkGet
bcs CORE.Run.5 no particular context, exec...
tax
lda CORE.IntCmd
@ -182,13 +211,13 @@ CORE.Run.1 sec coming from PIPE OUT
and #$3F
cmp #C.SWITCH SWITCH....FI ?
bcs CORE.Run.7
bcs CORE.Run.5
.45 txa
bpl .43 context is FALSE, skip line
bpl .43 context is FALSE, skip line
asl
bmi CORE.Run.7 parent context is true, exec
bmi CORE.Run.5 parent context is true, exec
.43 jsr CORE.GetCharNB
bcs .44 EOF
@ -206,86 +235,131 @@ CORE.Run.1 sec coming from PIPE OUT
clc
jmp CORE.Run.Exit
*--------------------------------------
CORE.Run.5 >LDYA L.CORE.IO
CORE.Run.5 jsr CORE.GetCharNB
bcs CORE.Run.NOPIPE Nothing to skip
jsr CORE.IsEndCmd
bcc .3
>LDYA L.CORE.IO
jsr CORE.LookupInputBuf
bcs CORE.Run.6
bcs .2
jsr CORE.SkipCharsA
jsr CORE.IO.JMP
bcc CORE.Run.7
bcc CORE.Run.5
bcs .9
.2 jsr CORE.ArgV.Add
bcc CORE.Run.5
.9 lda #E.SYN
sec
jmp CORE.Run.Exit
CORE.Run.6 jsr CORE.ArgV.Add
.3 cmp #C.CR
beq .7
CORE.Run.7 jsr CORE.GetCharNB
bcs .2 Nothing to skip
jsr CORE.IsEndCmd
bcs CORE.Run.5
tax
cmp #';'
beq .7
cmp #'|'
bne .5
jsr CORE.GetNextCharNB Skip EoL char
jsr CORE.GetNextCharNB '|'
bra CORE.Run.PIPE
cpx #'|' Pipe OUT ?
bne .2
sec
.1 .HS 90 BCC
.5 cmp #'&'
bne .9
jsr CORE.GetNextChar Skip '&'
bcs .50
cmp #'&'
beq .6 &&
.50 lda #S.PS.F.HOLD Run in the background...
trb CORE.PSFlags
bra CORE.Run.NOPIPE
.6 jsr CORE.GetNextChar Skip '&&'
.2 clc
jsr CORE.ExecCmd
bcc .60
jsr CORE.SkipLine
clc
lda #0
jmp CORE.Run.Exit
.60 jmp CORE.Run.1
.7 jsr CORE.GetNextCharNB Skip EoL char
.8 bra CORE.Run.NOPIPE
*--------------------------------------
CORE.Run.NOPIPE clc no pipe
.HS B0 BCS
CORE.Run.PIPE sec
ror
>STA.G CORE.bPipeOut
>LDA.G CORE.bPipeIn
bpl .3
bpl .1
jsr IO.Pipe.In
bcs CORE.Run.Exit
.3 >LDA.G CORE.bPipeOut
.1 >LDA.G CORE.bPipeOut
bpl .7
jsr IO.Pipe.Out
bcs CORE.Run.Exit
lda #S.PS.F.HOLD Run in the background...
trb CORE.PSFlags
lda #S.PS.F.CLOSEONX ...and close PIPE OUT on exit
tsb CORE.PSFlags
jsr CORE.ExecCmd
php
pha
lda CORE.IntCmd $ff if external
eor #$80
asl if cc Was external...
jsr IO.Reset.OutC restore Output, NO close if EXTERNAL
>LDA.G CORE.bPipeIn
bpl .6
jsr IO.Pop.In restore Input
.6 pla
plp
bcs CORE.Run.Exit
lda #$FF
>STA.G CORE.bPipeIn
jmp CORE.Run.1 Loop with Pipe IN
.7 jsr CORE.ExecCmd
.7 jsr CORE.ExecCmd
*--------------------------------------
CORE.Run.Exit php
pha
>LDA.G CORE.hArgVBuf
beq .1
>SYSCALL FreeMem
>STZ.G CORE.hArgVBuf
.1 pla
plp
rts
@ -297,17 +371,23 @@ CORE.ExecCmd lda #0
>LDYA ZPArgVBuf
>STYA ZPArgVBufPtr
ldx CORE.IntCmd
lda CORE.IntCmd
bmi CORE.ExecExtCmd
asl
tax
jmp (J.CMD,x)
*--------------------------------------
CORE.ExecExtCmd ldy #S.PS.RC
lda #0
sta (pPS),y
CORE.ExecExtCmd >PUSHW ZPArgVBuf
>PUSHW ZPArgVBuf
>PUSHB CORE.PSFlags
>SYSCALL ExecV
bcs .9
tax CPID
lda CORE.PSFlags
and #S.PS.F.HOLD
@ -320,7 +400,7 @@ CORE.ExecExtCmd >PUSHW ZPArgVBuf
lda (pPS),y
>PUSHA
>PUSHW L.MSG.PID
txa
>PUSHA
>PUSHBI 1
@ -341,6 +421,7 @@ CORE.SkipLine jsr CORE.GetNextCharNB
cmp #C.CR EOL
bne CORE.SkipLine
jsr CORE.GetNextChar skip CR...
.8 rts
@ -355,7 +436,9 @@ CORE.LookupArgVBuf
>STYA ZPPtr1 Keywords table
>LDYA ZPArgVBufPtr
bcc CORE.Lookup
>LDYA ZPInputBufPtr
CORE.Lookup >STYA ZPPtr2
ldx #0
@ -377,7 +460,7 @@ CORE.Lookup >STYA ZPPtr2
.8 tya Keyword Len
clc
clc
rts
.3 dey
@ -389,6 +472,7 @@ CORE.Lookup >STYA ZPPtr2
.4 lda (ZPPtr1)
bpl .41
jsr IncPtr1
.6 inx
@ -403,11 +487,11 @@ CORE.Lookup >STYA ZPPtr2
.7 iny
lda (ZPPtr2),y Get Src text char...
beq .9 end of text
jsr CORE.IsSpaceOrEndCmd
bcc .9 end of valid chars
clc
CORE.ArgV.Add.RTS
CORE.ArgV.Add.RTS
rts
*--------------------------------------
* ArgV
@ -416,7 +500,7 @@ CORE.ArgV.Add lda #C.SPACE
sta ZPTmpW
ldy #0
jsr CORE.GetCharNB
bcs CORE.ArgV.Add.RTS
@ -432,7 +516,7 @@ CORE.ArgV.Add lda #C.SPACE
ldx #')'
stx ZPTmpW
bra .12
.11 cmp #'`'
bne .12
@ -475,16 +559,16 @@ CORE.ArgV.Add lda #C.SPACE
tya
beq .8 Empty string....
sec
adc ZPArgVBufPtr
sta ZPArgVBufPtr
bcc .8
inc ZPArgVBufPtr+1
clc
.8
.8
.9 rts
*--------------------------------------
CORE.ArgV.Next lda (ZPArgVBufPtr)
@ -515,18 +599,15 @@ CORE.IO.JMP txa
tax
jmp (J.CORE.IO,x)
CORE.IO.AMP lda #S.PS.F.HOLD
trb CORE.PSFlags
clc
CORE.IO.RTS rts
CORE.IO.IN lda #O.RDONLY+O.TEXT
jsr CORE.IO.Open
bcs CORE.IO.RTS
jmp IO.Set.In
CORE.IO.OUTA
CORE.IO.1OUTA lda #O.WRONLY+O.APPEND+O.CREATE+O.TEXT
bra CORE.IO.OUT.1
CORE.IO.OUT
CORE.IO.OUT
CORE.IO.1OUT lda #O.WRONLY+O.TRUNC+O.CREATE+O.TEXT
CORE.IO.OUT.1 jsr CORE.IO.Open
@ -535,10 +616,12 @@ CORE.IO.OUT.1 jsr CORE.IO.Open
CORE.IO.2OUTA lda #O.WRONLY+O.APPEND+O.CREATE+O.TEXT
bra CORE.IO.2OUT.1
CORE.IO.2OUT lda #O.WRONLY+O.TRUNC+O.CREATE+O.TEXT
CORE.IO.2OUT.1 jsr CORE.IO.Open
bcs CORE.IO.RTS
jmp IO.Set.Err
*--------------------------------------
CORE.IO.Open pha Open Mode
@ -551,10 +634,11 @@ CORE.IO.Open pha Open Mode
>STYA ZPArgVBufPtr Discard filename
plx
jmp IO.FOpenYAX
.9 pla
lda #E.SYN
sec
rts
CORE.IO.RTS rts
*--------------------------------------
* Input Buffer
*--------------------------------------
@ -568,6 +652,9 @@ CORE.IsEndCmd cmp #';'
cmp #C.CR
beq CORE.IsEndCmd.8
cmp #'&'
beq CORE.IsEndCmd.8
cmp #'|'
beq CORE.IsEndCmd.8
@ -581,7 +668,7 @@ CORE.GetCharNB jsr CORE.GetChar
bcs CORE.GetNextCharNB.RTS
jsr CORE.CheckCharNB
bcc CORE.GetNextCharNB.RTS
bcc CORE.GetNextCharNB.RTS
*--------------------------------------
CORE.GetNextCharNB
jsr CORE.GetNextChar
@ -611,22 +698,98 @@ CORE.GetNextChar
inc ZPInputBufPtr+1
*--------------------------------------
CORE.GetChar lda (ZPInputBufPtr)
CORE.GetChar phy
.1 lda (ZPInputBufPtr)
bne .8
>LDA.G CODE.STACK
cmp #CODE.STACK
beq .9
clc
rts
jsr CORE.PopBuf
bra .1
.9 sec
.8 clc
.9 ply
rts
*--------------------------------------
CORE.SkipCharsA clc
adc ZPInputBufPtr
sta ZPInputBufPtr
bcc .8
inc ZPInputBufPtr+1
.8 rts
*--------------------------------------
CORE.PushBufX >LDA.G CODE.STACK
cmp #CODE.STACK.MAX*5
beq .9
inc
tay
phx next hBuffer
ldx #0
.1 lda ZPInputBuf,x
sta (pData),y
inx
iny
cpx #6
bne .1
pla
pha
sta (pData),y
tya
>STA.G CODE.STACK
pla
>SYSCALL GetMemPtr
>STYA ZPInputBuf
>STYA ZPInputBufPtr
* clc
rts
.9 lda #E.STKOVERFLOW
* sec
rts
*--------------------------------------
CORE.PopBuf >LDA.G CODE.STACK
cmp #CODE.STACK
beq .9
tay
lda (pData),y
phy
>SYSCALL FreeMem
ply
ldx #5
dey
.1 lda (pData),y
sta ZPInputBuf,x
dey
dex
bpl .1
tya
>STA.G CODE.STACK
* clc
rts
.9 lda #E.STACKERROR
* sec
rts
*--------------------------------------
* Stack
*--------------------------------------
CORE.StkPopCtx jsr CORE.StkPull
@ -651,34 +814,34 @@ CORE.StkPopCtxA and #$3F
cmp #C.DEFAULT DEFAULT : C.DEFAULT + hValue
bne .9
.1 jsr CORE.StkPopX
.2 jsr CORE.StkPullFree
.8 clc
.8 clc
rts
.3 jsr CORE.StkPull Get FOR sub cmd
beq .4 FOR List
jsr CORE.StkPullFree hVARNAME
jsr CORE.StkPullFClose hFILE/hPIPE
ldx #2 CmdPtr
jmp CORE.StkPopX
.4 jsr CORE.StkPullFree hVARNAME
jsr CORE.StkPullFClose hFILE/hPIPE
ldx #4 ListPtr,CmdPtr
jmp CORE.StkPopX
.9 lda #E.STACKERROR
sec
rts
rts
*--------------------------------------
CORE.StkPopX lda (pData)
.1 dec
@ -701,8 +864,10 @@ CORE.StkCheck sec
*--------------------------------------
CORE.StkPushYAX phx
jsr CORE.StkPushYA
bcs CORE.StkPushYA.9
bra CORE.StkPush.1
bcc CORE.StkPush.1
plx
rts
*--------------------------------------
CORE.StkPushInputBufPtr
>LDYA ZPInputBufPtr
@ -710,15 +875,15 @@ CORE.StkPushInputBufPtr
CORE.StkPushYA phy
jsr CORE.StkPush
bcc CORE.StkPush.1
CORE.StkPushYA.9
plx
CORE.StkPushYA.RTS
rts
*--------------------------------------
CORE.PushVarName
CORE.PushVarName
>LDYA ZPVarNamePtr
>SYSCALL StrDup
bcs CORE.StkPushYA.RTS
bcs CORE.StkPush.RTS
txa
*--------------------------------------
CORE.StkPush pha
@ -730,7 +895,7 @@ CORE.StkPush.1 lda (pData) StackPtr
sta (pData) StackPtr
tay
pla
pla
sta (pData),y
* clc
rts
@ -738,6 +903,7 @@ CORE.StkPush.1 lda (pData) StackPtr
.9 pla
lda #E.STKOVERFLOW
* sec
CORE.StkPush.RTS
rts
*--------------------------------------
CORE.StkGetCtx jsr CORE.StkGet

View File

@ -2,7 +2,7 @@ NEW
AUTO 3,1
.LIST OFF
*--------------------------------------
HIS.Init >LDYAI HISTORY.MAX Get a buffer for History
HIS.Init >LDYAI HISBUF.MAX Get a buffer for History
>SYSCALL StrVNew
bcs .9
@ -10,39 +10,37 @@ HIS.Init >LDYAI HISTORY.MAX Get a buffer for History
>STA.G HIS.hBuf
* >STZ.G HIS.Count
* >STA.G HIS.Index
* >STA.G HIS.LRU
* >STZ.G HIS.Head
* clc
.9 rts
*--------------------------------------
HIS.Add >LDA.G HIS.hBuf
beq .9
>LDA.G HIS.Count
cmp #HIS.MAX
bcc .2
cmp #HISCNT.MAX
bcs .1
>LDA.G HIS.LRU
cmp #HIS.MAX
bne .1
inc
sta (pData),y
lda #0
.1 inc
>STA.G HIS.LRU
>STA.G HIS.Head
tax
bra .7
.2 inc
>STA.G HIS.Count
.1 ldy #HIS.Head
jsr HIS.NextY replace oldest
.7 tax
>PUSHB.G HIS.hBuf
tax
.7 >PUSHB.G HIS.hBuf
>PUSHBI 0
txa
>PUSHA
>PUSHW ZPCLBuf
>SYSCALL StrVSet
>STZ.G HIS.Index Reset Index
.9 rts
*--------------------------------------
HIS.Select >LDA.G HIS.Count
@ -50,39 +48,44 @@ HIS.Select >LDA.G HIS.Count
clc
.99 rts
.10 jsr CL.Reset
>STZ.G HIS.Index
ldx #0
.1 >INC.G HIS.Index
jsr HIS.GetIndex
.1 inx
phx
jsr HIS.GetX
plx
bcs .99
>PUSHW L.MSG.HIS
>LDA.G HIS.Index
txa
dec
>PUSHA
>PUSHW ZPCLBuf
>PUSHBI 3
phx
>SYSCALL PrintF
plx
bcs .9
>LDA.G HIS.Index
txa
>CMP.G HIS.Count
bne .1
>PUSHW L.MSG.HISPROMPT
>PUSHBI 0
>SYSCALL PrintF
>STZ.G HIS.Index
>LDYA L.MSG.HISPROMPT
jsr PrintYANoCR
bcs .9
lda #0
sta (ZPCLBuf)
ldy #HIS.Ptr
sta (ZPCLBuf),y
>SYSCALL GetChar
bcs HIS.Select.RTS
bcs .9
cmp #'0'
bcc .7
@ -92,13 +95,12 @@ HIS.Select >LDA.G HIS.Count
and #$f
inc
>STA.G HIS.Ptr
>STA.G HIS.Index
.7 >PUSHW L.MSG.HISROMPTCLR
>PUSHBI 0
>SYSCALL PrintF
.7 >LDYA L.MSG.HISROMPTCLR
jsr PrintYANoCR
bcs .9
jsr CL.PrintPrompt
bcc HIS.GetToCL1
.9
@ -107,32 +109,38 @@ HIS.Select.RTS rts
HIS.GetPrev >LDA.G HIS.Count
beq HIS.Select.RTS empty history,nothing to do
>LDA.G HIS.Index
>LDA.G HIS.Ptr
bne .1
>LDA.G HIS.Count
>LDA.G HIS.Head Get newest
bra HIS.GetToCL
.1 dec
bra HIS.GetToCL
bne .2
>LDA.G HIS.Count
.2 bra HIS.GetToCL
*--------------------------------------
HIS.GetNext >LDA.G HIS.Count
beq HIS.Select.RTS empty history,nothing to do
>EOR.G HIS.Index
beq HIS.GetToCL
>LDA.G HIS.Ptr
bne .1
>LDA.G HIS.Index
inc
ldy #HIS.Head
.1 jsr HIS.NextY
*--------------------------------------
HIS.GetToCL >STA.G HIS.Index
HIS.GetToCL >STA.G HIS.Ptr
jsr CL.CLR
jsr CL.CLR.1
HIS.GetToCL1 >LDA.G HIS.Index
HIS.GetToCL1 >LDA.G HIS.Ptr
beq .9
jsr HIS.GetIndex
tax
jsr HIS.GetX
bcs .9
ldy #$ff
@ -145,17 +153,34 @@ HIS.GetToCL1 >LDA.G HIS.Index
>STA.G CL.Ptr
>STA.G CL.Len
jmp CL.Print
>LDYA ZPCLBuf
jmp PrintYANoCR
.9 rts
*--------------------------------------
HIS.GetIndex >PUSHB.G HIS.hBuf
HIS.GetX >PUSHB.G HIS.hBuf
>PUSHBI 0
>PUSHB.G HIS.Index
txa
>PUSHA
>PUSHW ZPCLBuf
>SYSCALL StrVGet
rts
*--------------------------------------
HIS.NextY lda (pData),y
phy
>CMP.G HIS.Count
ply
bcc .1
lda #0
.1 inc
rts
*--------------------------------------
MAN
SAVE usr/src/bin/sh.s.his
LOAD usr/src/bin/sh.s

View File

@ -5,46 +5,48 @@ NEW
.OR $2000
.TF bin/sh
*--------------------------------------
HIS.MAX .EQ 10
HISTORY.MAX .EQ 256
HISCNT.MAX .EQ 10
HISBUF.MAX .EQ 256
CORE.STACK.MAX .EQ 128
PUSHD.STACK.MAX .EQ 4
CODE.STACK.MAX .EQ 4
*--------------------------------------
C... .EQ 0
C.. .EQ 2
C.CD .EQ 4
C.NOHUP .EQ 6
C.DATE .EQ 8
C.ECHO .EQ 10
C.EXIT .EQ 12
C.MD .EQ 14
C.PAUSE .EQ 16
C.PWD .EQ 18
C.RD .EQ 20
C.READ .EQ 22
C.REN .EQ 24
C.SET .EQ 26
C.SLEEP .EQ 28
C.SHIFT .EQ 30
C.PUSHD .EQ 32
C.POPD .EQ 34
C.FUNCTION .EQ 36
C.CALL .EQ 38
C.BREAK .EQ 40
C.SWITCH .EQ 42
C.CASE .EQ 44
C.DEFAULT .EQ 46
C.. .EQ 1
C.CD .EQ 2
C.NOHUP .EQ 3
C.DATE .EQ 4
C.ECHO .EQ 5
C.EXIT .EQ 6
C.MD .EQ 7
C.PAUSE .EQ 8
C.PWD .EQ 9
C.RD .EQ 10
C.READ .EQ 11
C.REN .EQ 12
C.SET .EQ 13
C.SLEEP .EQ 14
C.SHIFT .EQ 15
C.PUSHD .EQ 16
C.POPD .EQ 17
C.FUNCTION .EQ 18
C.CALL .EQ 19
C.BREAK .EQ 20
C.SWITCH .EQ 21
C.CASE .EQ 22
C.DEFAULT .EQ 23
*--------------------------------------
C.FOR .EQ 48
C.FOR .EQ 24
C.FOR.LIST .EQ 0
C.FOR.FILEEXEC .EQ 1
C.WHILE .EQ 50
C.IF .EQ 52
C.NEXT .EQ 54
C.LOOP .EQ 56
C.ELSE .EQ 58
C.FI .EQ 60
C.END .EQ 62
C.WHILE .EQ 25
C.IF .EQ 26
C.NEXT .EQ 27
C.LOOP .EQ 28
C.ELSE .EQ 29
C.FI .EQ 30
C.END .EQ 31
C.ALIAS .EQ 32
*--------------------------------------
C.CLEXEC .EQ 63
*--------------------------------------
@ -77,7 +79,21 @@ ZPTmpW .BS 2
ZPPtr1 .BS 2
ZPPtr2 .BS 2
M32.ACC .BS 4
LOAD.hCode .BS 1
LOAD.hArgs .BS 1
LOAD.ArgCnt .BS 1
bState .BS 1
bState.ExitOnEOF .EQ %10000000
bState.Pause .EQ %01000000
bState.PipeIn .EQ %00100000
bState.PipeOut .EQ %00010000
bState.AmpAmp .EQ %00001000
bState.SET.C .EQ %00000100
bState.SET.E .EQ %00000010
bState.SET.X .EQ %00000001
ZS.END .ED
*--------------------------------------
@ -114,13 +130,14 @@ L.MSG.BATCHLINE .DA MSG.BATCHLINE
L.MSG.BATCHERR .DA MSG.BATCHERR
L.MSG.ERROR .DA MSG.ERROR
L.MSG.PID .DA MSG.PID
L.MSG.ALIAS .DA MSG.ALIAS
L.FMT.DATE .DA FMT.DATE
L.FMT.Long .DA FMT.Long
L.FMT.Byte .DA FMT.Byte
J.ESC .DA CL.BS left arrow
.DA HIS.GetNext
.DA HIS.GetPrev
.DA CL.NAK right arrow
.DA HIS.GetPrev up
.DA HIS.GetNext down
.DA CL.NAK right
L.CD.. .DA CD..
L.IN .DA IN
L.CMD .DA CMD
@ -156,9 +173,9 @@ J.CMD .DA CMD...
.DA CMD.ELSE
.DA CMD.FI
.DA CMD.END
.DA CMD.ALIAS
L.CORE.IO .DA CORE.IO
J.CORE.IO .DA CORE.IO.AMP
.DA CORE.IO.IN
J.CORE.IO .DA CORE.IO.IN
.DA CORE.IO.OUTA
.DA CORE.IO.OUT
.DA CORE.IO.1OUTA
@ -193,9 +210,10 @@ CS.RUN jsr CL.Init
lda (pPS),y
beq .2 no arg, continue starting interactive
lda #$ff
>STA.G bExitOnEOF
inc lda #0
lda #bState.ExitOnEOF
tsb bState
lda #0
jsr CMD.SHIFTA Remove $0 = /bin/sh
jsr GetArgV
@ -207,22 +225,21 @@ CS.RUN jsr CL.Init
ldy #1
lda (ZPPtr1),y
cmp #'c'
beq .10
jsr ToUpperCase
cmp #'C'
bne .1
.10 iny
iny
lda (ZPPtr1),y
bne .1
* lda #0
* lda #0
jsr CMD.SHIFTA Remove $0 = -C
jsr GetArgV
jmp CS.RUN.CMDLINE
*--------------------------------------
.1 jsr GetArgV Load SH batch file
>SYSCALL LoadTxtFile
bcs .9
@ -232,7 +249,7 @@ CS.RUN jsr CL.Init
plx
jsr CMD..EXEC.YAX Execute . Batch file
bcc CS.RUN.LOOP
.9 rts
*--------------------------------------
.2 jsr CMD.CD.HOME
@ -249,8 +266,10 @@ CS.RUN jsr CL.Init
>SYSCALL LoadTxtFile
bcs CS.RUN.LOOP No profile...
>LDYA L.HOME.PROFILE
jsr CMD..EXEC.YAX Execute . ${home}profile
phx X = loaded file hMem
jsr GetArgV Y,A = Args
plx
jsr CMD..EXEC.YAX Execute . ${home}.profile
*--------------------------------------
CS.RUN.LOOP >SLEEP
@ -274,7 +293,8 @@ CS.RUN.LOOP >SLEEP
lda (pData) batch mode ?
beq CS.RUN.LOOP
>LDA.G bSET.C
lda bState
and #bState.SET.C
beq .8
bra CS.RUN.LOOP
@ -282,16 +302,17 @@ CS.RUN.LOOP >SLEEP
.11 cmp #19 test Ctrl-s
bne CS.RUN.LOOP
lda #$80
>STA.G bPause
lda #bState.Pause
tsb bState
bra CS.RUN.LOOP
*--------------------------------------
.8 lda #3 User Interrupt
sec
.9 rts
*--------------------------------------
.2 >LDA.G bPause
bpl .6
.2 lda bState
and #bState.Pause
beq .6
.3 >SYSCALL GetChar
bcs .9 I/O err
@ -302,22 +323,24 @@ CS.RUN.LOOP >SLEEP
lda (pData) batch mode ?
beq .5
>LDA.G bSET.C
lda bState
and #bState.SET.C
beq .8
bra .5
.4 tax
>LDA.G bPause
asl $ff ?
bpl .5 not from PAUSE command
lda bState
and #bState.Pause
beq .5 not from PAUSE command
cpx #C.CR
bne .5
jsr CheckLFAfterCR Check for any extra LF
bcs .9
.5 >STZ.G bPause
bcs .9
.5 lda #bState.Pause
trb bState
*--------------------------------------
.6 lda (pData) batch mode ?
bne CS.RUN.BATCH
@ -326,13 +349,15 @@ CS.RUN.INTERACTIVE
jsr IO.Reset
jsr CL.Reset
>STZ.G HIS.Ptr
jsr CL.ReadResetV
jsr CL.PrintPrompt
bcs CS.RUN.CMDLINE.9
.1 >SYSCALL GetChar
bcs CS.RUN.CMDLINE.9 I/O error
bcs CS.RUN.CMDLINE.9 I/O error
.2 cmp #C.EOF ....or Ctrl-D
beq CS.RUN.CMDLINE.9 CS
@ -342,9 +367,8 @@ CS.RUN.INTERACTIVE
>LDA.G CL.bReady Something to execute ?
bpl .1
>PUSHW L.MSG.PROMPTCRLF
>PUSHBI 0
>SYSCALL PrintF
>LDYA L.MSG.PROMPTCRLF
jsr PrintYANoCR
bcs CS.RUN.CMDLINE.9
lda (ZPCLBuf)
@ -356,7 +380,7 @@ CS.RUN.INTERACTIVE
CS.RUN.CMDLINE >SYSCALL StrDup
bcs CS.RUN.CMDLINE.9
phx
jsr GetArgV
plx Y,A=ARGV, X=strdup
@ -370,9 +394,10 @@ CS.RUN.CMDLINE >SYSCALL StrDup
bra CS.RUN.LOOP.RUN
CS.RUN.CMDLINE.9
rts
rts
*--------------------------------------
CS.RUN.BATCH >LDA.G bSET.X
CS.RUN.BATCH lda bState
and #bState.SET.X
beq CS.RUN.LOOP.RUN
ldy #$ff
@ -402,8 +427,9 @@ CS.RUN.LOOP.END ldy #S.PS.RC
tay
beq CS.RUN.LOOP.80 0 = EOF
>LDA.G bSET.E
bmi CS.RUN.LOOP.80
lda bState
and #bState.SET.E
bne CS.RUN.LOOP.80
.1 jsr CORE.StkGet
cmp #$C0+C.CLEXEC
@ -414,13 +440,13 @@ CS.RUN.LOOP.END ldy #S.PS.RC
cmp #$C0+C.CALL in CALL ?
beq .7
jsr CORE.StkPopCtx
bcc .1
.7 jsr IO.PrintBatchErrMsg
bcs CS.RUN.LOOP.RTS
jsr CORE.StkPull
jsr CMD.EXIT.FILE
@ -430,8 +456,9 @@ CS.RUN.LOOP.END ldy #S.PS.RC
CS.RUN.LOOP.80 lda (pData) something on stack ?
bne CS.RUN.LOOP.88
>LDA.G bExitOnEOF
bmi CS.RUN.LOOP.EXIT
lda bState
and #bState.ExitOnEOF
bne CS.RUN.LOOP.EXIT
CS.RUN.LOOP.88 jmp CS.RUN.LOOP
CS.RUN.LOOP.EXIT
@ -461,9 +488,14 @@ CS.DOEVENT lda (pEvent)
*--------------------------------------
CS.QUIT jsr CORE.FUNCRESET
>LDA.G HIS.hBuf
>LDA.G hFunctions
beq .10
>SYSCALL SListFree
.10 >LDA.G HIS.hBuf
beq .1
>SYSCALL FreeStkObj
.1 ldy #CL.hBuf
@ -476,9 +508,9 @@ CS.QUIT jsr CORE.FUNCRESET
.7 lda (pData),y
beq .8
>SYSCALL FreeMem
.8 clc
rts
*--------------------------------------
@ -495,11 +527,11 @@ CheckLFAfterCR ldy #S.PS.hStdIn Check for any extra LF
lda (pPS),y
>SYSCALL FEOF
bcs .9
tay
bne .9
>SYSCALL GetChar
.9 rts
*--------------------------------------
CheckSleep ldy #Sleep+3
@ -540,9 +572,12 @@ AddAp1Ptr1 sec
*--------------------------------------
ToUpperCase cmp #'a'
bcc .8
cmp #'z'+1
bcs .8
eor #$20
.8 clc exit CC to allow Jmp to
rts
*--------------------------------------
@ -551,6 +586,11 @@ IncPStack3 inc pStack
inc pStack
inc pStack
rts
*--------------------------------------
PrintYANoCR >PUSHYA
>PUSHBI 0
>SYSCALL PrintF
rts
*--------------------------------------
.INB usr/src/bin/sh.s.cl
.INB usr/src/bin/sh.s.his
@ -561,28 +601,30 @@ IncPStack3 inc pStack
*--------------------------------------
CS.END
*--------------------------------------
MSG.GREETINGS .AZ "\r\nA2osX-SH %d.%d\r\n\r\n"
MSG.HIS .AZ "\r\n%3d : %s"
MSG.HISPROMPT .AZ "\r\n\r\n? "
MSG.HISROMPTCLR .DA #C.BS,#C.BS,#0
MSG.PROMPT .AZ "\e[?7h$ " Enable Line Wrap
MSG.PROMPTCRLF .AZ "\e[?7l\r\n" Disable Line Wrap
MSG.TRACE .AS ">"
MSG.BATCHLINE .AZ "%s\r\n"
MSG.BATCHERR .AZ "%s^\r\nLine #%D:"
MSG.ERROR .AS "[$%h]:%s."
MSG.ECHOCRLF .AZ "\r\n"
MSG.PID .AZ "PID=%d\r\n"
MSG.GREETINGS .CZ "\r\nA2osX-SH %d.%d\r\n\r\n"
MSG.HIS .CZ "\r\n%3d : %s"
MSG.HISPROMPT .CZ "\r\n\r\n? "
MSG.HISROMPTCLR .CZ "\b\b"
MSG.PROMPT .CZ "\e[?7h$ " Enable Line Wrap
MSG.PROMPTCRLF .CZ "\e[?7l\r\n" Disable Line Wrap
MSG.TRACE .CS ">"
MSG.BATCHLINE .CZ "%s\r\n"
MSG.BATCHERR .CZ "%s^\r\nLine #%D:"
MSG.ERROR .CS "[$%h]:%s."
MSG.ECHOCRLF .CZ "\r\n"
MSG.PID .CZ "PID=%d\r\n"
MSG.ALIAS .CZ ' = "%s"\r\n'
*--------------------------------------
FMT.DATE .AZ "%A, %B %d %Y %H:%M:%S"
FMT.Long .AZ "%L"
FMT.Byte .AZ "%d"
*--------------------------------------
HOME.PROFILE .AZ "${HOME}profile"
PtrZero .HS 00 To Make It ArgV
HOME.PROFILE .AS "${HOME}.profile"
PtrZero .HS 00
PS1 .AZ "${PS1}"
HOME .AZ "${HOME}"
*--------------------------------------
EscChars .AS 'DBAC'
EscChars .AS "DABC"
EscChars.Cnt .EQ *-EscChars
EscChars.Remap .DA #C.BS,#C.VT,#C.LF,#C.FS
*--------------------------------------
@ -622,9 +664,9 @@ CMD .AT ".."
.AT "ELSE"
.AT "FI"
.AT "END"
.AT "ALIAS"
.HS 00
CORE.IO .AT "&"
.AT "<"
CORE.IO .AT "<"
.AT ">>"
.AT ">"
.AT "1>>"
@ -676,29 +718,22 @@ EXP.OP.BINARY.BITS
*--------------------------------------
EXP.OP.MATH.FPU .DA #FPU.lMUL,#FPU.lDIV,#FPU.lMOD,#FPU.lADD,#FPU.lSUB
*--------------------------------------
SET.FLAGS .AS "CXE"
SET.VARS .DA #bSET.C,#bSET.X,#bSET.E
SET.FLAGS .AS "CEX"
SET.VARS .DA #bState.SET.C,#bState.SET.E,#bState.SET.X
*--------------------------------------
.DUMMY
.OR 0
DS.START
CORE.STACK .BS CORE.STACK.MAX+1 pData (0 = Stack Ptr)
PUSHD.STACK .BS PUSHD.STACK.MAX+1
CODE.STACK .BS CODE.STACK.MAX*7+1
hFuncList .BS 1
hAliases .BS 1
hFunctions .BS 1
bExitOnEOF .BS 1
bPause .BS 1
bSET.C .BS 1
bSET.E .BS 1
bSET.X .BS 1
Sleep .BS 4
CORE.hArgVBuf .BS 1
CL.hBuf .BS 1
CL.Ptr .BS 1
CL.Len .BS 1
CL.bReady .BS 1
@ -706,19 +741,20 @@ CL.bEscMode .BS 1
CL.MaxCnt .BS 1
CL.bSilent .BS 1
CORE.hArgVBuf .BS 1
CORE.bPipeIn .BS 1
CORE.bPipeOut .BS 1
HIS.hBuf .BS 1
HIS.Count .BS 1
HIS.Index .BS 1
HIS.LRU .BS 1
HIS.Ptr .BS 1
HIS.Head .BS 1
IO.hIn .BS 1
IO.hOut .BS 1
IO.hErr .BS 1
Sleep .BS 4
*TimeBuf .BS S.TIME 8 bytes
*M32.BUF .BS 12 -1234567890\0
TimeBuf .EQ *

View File

@ -1,89 +0,0 @@
NEW
PREFIX
AUTO 4,1
#!/bin/csh
// This is a comment....
puts(argv[1]);
exit
puts("puts: test 'const char *' string.");
struct tag_test {
int cnt;
float f;
tag_test *next;
};
long L1=3;
long L2=5;
long L3=7;
printf("L1=%L, L2=%L, L3=%L\r\n", L1, L2, L3);
L3=L1*L2+1;
printf("L3=L1*L2+1:L1=%L, L2=%L, L3=%L\r\n", L1, L2, L3);
L3=L1+5*9;
printf("L3=L1+5*9:L1=%L, L2=%L, L3=%L\r\n", L1, L2, L3);
L3=(L1+5)*L2+10;
printf("L3=(L1+5)*L2+10:L1=%L, L2=%L, L3=%L\r\n", L1, L2, L3);
#define PI 3.14159265
float f = PI / 3;
printf("f=%e\r\n", f);
float COSPI3=cos(f);
float SQR2=sqr(2);
printf("cos(PI/3)=%e, sqr(2)=%e\r\n", COSPI3, SQR2);
printf("f=%e, COSPI3=%e\r\n", f, COSPI3);
int i = 36;
i = i - 11;
i=i<<4;
printf("i=%I\r\n", i);
float BILLION=1000000000; //9E6E6B2800
printf("BILLION=%e %h%h%h%h%h\r\n", BILLION, BILLION);
unsigned int Test=61027;
printf("Test=%D\r\n", Test);
float a = 66 / 3;
printf("a=%e\r\n", a);
a=a+1;
printf("a=%e\r\n", a);
float mul=256*128;
printf("mul=%e\r\n", mul);
puts("Press a key");
char chr = getchar();
printf("chr=%d\r\n", chr);
int cnt=3;
if (cnt) {
puts("IF block...");
cnt=cnt+1;
printf("cnt=%I\r\n", cnt);
}
puts("Press a key");
chr=getchar();
while (cnt) {
cnt=cnt-1;
printf("cnt=%5I, 0x%H\r\n", cnt, cnt);
}
puts("Press a key");
getchar();
if (0) {
puts("false{{{{{SKIPTHIS");
}
MAN
TEXT /MAKE/USR/SHARE/ctests/ctest

View File

@ -170,7 +170,7 @@ SEEK.END .EQ $02
*--------------------------------------
SL.. .EQ %10000000
SL._ .EQ %01000000
SL.NoCase .EQ %01000010
SL.NoCase .EQ %00000010
SL.EndDollar .EQ %00000001
*--------------------------------------
* A2osX.SYSCALL Functions Indexes
@ -235,7 +235,8 @@ SYS.SetAttr .EQ $5E
* MOUNT
SYS.Mount .EQ $60
SYS.UMount .EQ $62
* .EQ $64
* STKOBJ
SYS.LoadStkObj .EQ $64
SYS.GetStkObj .EQ $66
* ARG
SYS.Shift .EQ $68
@ -325,9 +326,9 @@ SYS.GetMem .EQ $F0
SYS.Realloc .EQ $F2
SYS.GetMemPtr .EQ $F4
SYS.FreeMem .EQ $F6
SYS.Free .EQ $F8
SYS.NewStkObj .EQ $F8
SYS.LoadStkObj .EQ $FA
SYS.NewStkObj .EQ $FA
SYS.GetStkObjPtr .EQ $FC
SYS.FreeStkObj .EQ $FE
*--------------------------------------

View File

@ -10,6 +10,8 @@ LIBBLKDEV.D2HeadSelect .EQ 14
LIBBLKDEV.D2TrkFmt16s .EQ 16
LIBBLKDEV.D2TrkRead16s .EQ 18
LIBBLKDEV.D2TrkWrite16s .EQ 20
LIBBLKDEV.D2TrkReadNIB .EQ 22
LIBBLKDEV.D2TrkWriteNIB .EQ 24
*--------------------------------------
MAN
SAVE inc/libblkdev.i

48
INCLUDE/SYS/socket.h.txt Normal file
View File

@ -0,0 +1,48 @@
NEW
AUTO 3,1
#define AF_LOCAL 0
#define AF_INET 2
#define AF_ETHERTALK 4
#define SOCK_RAW 0
#define SOCK_DGRAM 2
#define SOCK_SEQPACKET 4
#define SOCK_STREAM 6
#define SO_DEBUG 1
#define SO_ACCEPTCONN 2
#define SO_REUSEADDR 4
#define SO_KEEPALIVE 8
#define SO_DONTROUTE 16
#define SO_BROADCAST 32
#define SO_USELOOPBACK 64
#define SO_LINGER 128
typedef int sa_family_t;
typedef int ssize_t;
struct sockaddr
{
sa_family_t sa_family;
char sa_data[];
};
int socket(int, int, int);
int bind(int, const struct sockaddr *, socklen_t);
int connect(int, const struct sockaddr *, socklen_t);
int listen(int, int);
int accept(int, struct sockaddr *restrict, socklen_t *restrict);
int shutdown(int, int);
ssize_t recv(int, void *, size_t, int);
ssize_t send(int, const void *, size_t, int);
ssize_t recvfrom(int, void *restrict, size_t, int,struct sockaddr *restrict, socklen_t *restrict);
ssize_t sendto(int, const void *, size_t, int, const struct sockaddr *,socklen_t);
int getsockopt(int, int, int, void *restrict, socklen_t *restrict);
int setsockopt(int, int, int, const void *, socklen_t);
MAN
TEXT include/sys/socket.h

View File

@ -2,19 +2,19 @@ NEW
AUTO 3,1
struct stat {
mode_t st_mode
dev_t st_dev
uid_t st_uid
gid_t st_gid
ino_t st_ino
nlink_t st_nlink
off_t st_size
//dev_t st_rdev
time_t st_atime
time_t st_mtime
time_t st_ctime
blkcnt_t st_blocks
blksize_t st_blksize
mode_t st_mode
dev_t st_dev
uid_t st_uid
gid_t st_gid
ino_t st_ino
nlink_t st_nlink
off_t st_size
//dev_t st_rdev
time_t st_atime
time_t st_mtime
time_t st_ctime
blkcnt_t st_blocks
blksize_t st_blksize
short int st_P_type
int st_P_auxtype
@ -26,6 +26,6 @@ short int se_P_fsid
short int st_P_access
short int st_P_SPARE
};
MAN
TEXT include/sys/stat.h

View File

@ -3,6 +3,10 @@ NEW
typedef int mode_t;
typedef short int dev_t;
typedef short int uid_t;
typedef short int gid_t;
typedef short int ino_t[8];
typedef int nlink_t;
typedef unsigned long int off_t;
MAN
TEXT include/sys/types.h

17
INCLUDE/libblkdev.h.txt Normal file
View File

@ -0,0 +1,17 @@
NEW
AUTO 3,1
int blkdevGetProDOSCatSize(int, short int, short int);
void blkdevBuildProDOSCat(int, short int, short int, char*, void*);
short int blkdevD2MotorControl(short int, short int);
short int fastcall blkdevD2Recalibrate(short int);
short int blkdevD2HeadSelect(short int, short int);
short int blkdevD2MoveHead(short int, short int, short int);
short int blkdevD2TrkFmt16s(short int, short int, short int, short int);
short int blkdevD2TrkRead16s(short int, short int, void*);
short int blkdevD2TrkWrite16s(short int, short int, short int, void*);
short int blkdevD2TrkReadNIB(short int, short int, void*);
short int blkdevD2TrkWriteNIB(short int, short int, short int, void*);
MAN
TEXT include/libblkdev.h

View File

@ -1,23 +1,26 @@
NEW
AUTO 3,1
struct tm {
short int tm_cent;
short int tm_year;
short int tm_mon;
short int tm_mday;
short int tm_hour;
short int tm_min;
short int tm_sec;
short int tm_wday;
};
// short int tm_yday;
// short int tm_isdst;
typedef unsigned long time_t;
struct tm {
short int tm_cent;
short int tm_year;
short int tm_mon;
short int tm_mday;
short int tm_hour;
short int tm_min;
short int tm_sec;
short int tm_wday;
// short int tm_yday;
// short int tm_isdst;
};
time_t time(time_t *);
struct tm* time(struct tm*);
void strftime(char*,const char*,const struct tm*);
void ptime2time(time_t*,const struct tm*);
void ctime2time(time_t*,const struct tm*);
MAN
TEXT include/time.h

36
LIB/LIBBLKDEV.O.S.txt Normal file
View File

@ -0,0 +1,36 @@
NEW
AUTO 3,1
.LIST OFF
.OR $0
.TF lib/libblkdev.o
*--------------------------------------
.INB inc/libblkdev.i
*--------------------------------------
.PS "blkdevGetProDOSCatSize"
.DA #LIBBLKDEV.GetProDOSCatSize
.PS "blkdevBuildProDOSCat"
.DA #LIBBLKDEV.BuildProDOSCat
.PS "blkdevD2MotorControl"
.DA #LIBBLKDEV.D2MotorControl
.PS "blkdevD2Recalibrate"
.DA #LIBBLKDEV.D2Recalibrate
.PS "blkdevD2MoveHead"
.DA #LIBBLKDEV.D2MoveHead
.PS "blkdevD2HeadSelect"
.DA #LIBBLKDEV.D2HeadSelect
.PS "blkdevD2TrkFmt16s"
.DA #LIBBLKDEV.D2TrkFmt16s
.PS "blkdevD2TrkRead16s"
.DA #LIBBLKDEV.D2TrkRead16s
.PS "blkdevD2TrkWrite16s"
.DA #LIBBLKDEV.D2TrkWrite16s
.PS "blkdevD2TrkReadNIB"
.DA #LIBBLKDEV.D2TrkReadNIB
.PS "blkdevD2TrkWriteNIB"
.DA #LIBBLKDEV.D2TrkWriteNIB
.DA #0
*--------------------------------------
MAN
SAVE usr/src/lib/libblkdev.o.s
ASM

View File

@ -2,13 +2,13 @@ NEW
AUTO 3,1
*--------------------------------------
FON.Init >LDYA L.SYSX7
>SYSCALL2 LoadStkObj
jsr .1
bcs .9
stx hSYSFON
>LDYA L.SYSX7B
>SYSCALL2 LoadStkObj
jsr .1
bcs .9
stx hSYSFONB
@ -25,6 +25,13 @@ FON.Init >LDYA L.SYSX7
sta SYSFON.Hp2
.9 rts
.1 >PUSHYA
>PUSHBI O.RDONLY
>PUSHBI S.FI.T.FON
>PUSHWZ Aux type
>SYSCALL LoadStkObj
rts
*--------------------------------------
FON.GetTextSize >STYA CB.CACHE+S.CB.TxtPtr
stx CB.CACHE+S.CB.hFont

View File

@ -7,7 +7,7 @@ NEW
*--------------------------------------
.INB inc/macros.i
.INB inc/a2osx.i
.INB inc/kernel.i
.INB inc/mli.i
.INB inc/gfx.i
.INB inc/libgui.i
*--------------------------------------

View File

@ -4,48 +4,47 @@ NEW
.OR $0
.TF lib/libtui.o
*--------------------------------------
.INB inc/macros.i
.INB inc/libtui.i
*--------------------------------------
>PSTR "tuiInit"
.PS "tuiInit"
.DA #LIBTUI.Init
>PSTR "tuiClose"
.PS "tuiClose"
.DA #LIBTUI.Close
>PSTR "tuiNewScrn"
.PS "tuiNewScrn"
.DA #LIBTUI.NewScrn
>PSTR "tuiNewDlg"
.PS "tuiNewDlg"
.DA #LIBTUI.NewDlg
>PSTR "tuiNewLabel"
.PS "tuiNewLabel"
.DA #LIBTUI.NewLabel
>PSTR "tuiNewTLine"
.PS "tuiNewTLine"
.DA #LIBTUI.NewTLine
>PSTR "tuiNewTBox"
.PS "tuiNewTBox"
.DA #LIBTUI.NewTBox
>PSTR "tuiNewLBox"
.PS "tuiNewLBox"
.DA #LIBTUI.NewLBox
>PSTR "tuiNewCBox"
.PS "tuiNewCBox"
.DA #LIBTUI.NewCBox
>PSTR "tuiNewBut"
.PS "tuiNewBut"
.DA #LIBTUI.NewBut
>PSTR "tuiNewRadio"
.PS "tuiNewRadio"
.DA #LIBTUI.NewRadio
>PSTR "tuiExec"
.PS "tuiExec"
.DA #LIBTUI.Exec
>PSTR "tuiDestroy"
.PS "tuiDestroy"
.DA #LIBTUI.Destroy
>PSTR "tuiRun"
.PS "tuiRun"
.DA #LIBTUI.Run
>PSTR "tuiDraw"
.PS "tuiDraw"
.DA #LIBTUI.Draw
>PSTR "tuiGetProp"
.PS "tuiGetProp"
.DA #LIBTUI.GetProp
>PSTR "tuiSetProp"
.PS "tuiSetProp"
.DA #LIBTUI.SetProp
>PSTR "tuiActivate"
.PS "tuiActivate"
.DA #LIBTUI.Activate
>PSTR "tuiDeactivate"
.PS "tuiDeactivate"
.DA #LIBTUI.Deactivate
.DA #0
*--------------------------------------

View File

@ -225,8 +225,8 @@ LibCnt .BS 1
hLineBuf .BS 1
LineBuf .BS 2
*--------------------------------------
ESC.In .AS "DBAC"
ESC.Out .DA #C.BS,#C.LF,#C.VT,#C.FS
ESC.In .AS "DABC"
ESC.Out .DA #C.BS,#C.VT,#C.LF,#C.FS
*--------------------------------------
FMT.ESCCSI.R .AZ "%d;%d"
*--------------------------------------
@ -242,45 +242,26 @@ OBJ.COLORS .DA #93,#44 SCRN
.DA #92,#100 BUT
.DA #93,#0 RADIO
*--------------------------------------
SEQ.INIT .DA #C.ESC
.AS "c" FF
.DA #C.ESC
.AS "[999;999H" Set Cursor Pos to 999,999
.DA #C.ESC
.AS "[6n" then query Cursor Pos
.DA #C.ESC
.AS "(B" font select
.DA #C.ESC
.AS ")0" font select
.DA #C.ESC
.AS "[?7l" Disable Line Wrap
.DA #C.ESC
.AS "[?25l" Hide Cursor
.DA #0
SEQ.INIT .CS "\ec\e[999;999H" Set Cursor Pos to 999,999
.CS "\e[6n" then query Cursor Pos
.CS "\e(B" font select
.CS "\e)0" font select
.CS "\e[?7l" Disable Line Wrap
.CZ "\e[?25l" Hide Cursor
*--------------------------------------
SEQ.GOTOXY .AZ "\e[%d;%dH"
SEQ.GOTOXY .CZ "\e[%d;%dH"
*--------------------------------------
SEQ.COLOR .AZ "\e[%d;%dm"
SEQ.COLOR .CZ "\e[%d;%dm"
*--------------------------------------
SEQS .EQ *
*--------------------------------------
SEQ.CURON .DA #C.ESC
.AS "[?25h" Show Cursor
.DA #0
SEQ.CUROFF .DA #C.ESC
.AS "[?25l" Hide Cursor
.DA #0
SEQ.CURON .CZ "\e[?25h" Show Cursor
SEQ.CUROFF .CZ "\e[?25l" Hide Cursor
*--------------------------------------
SEQ.BAR .DA #C.ESC
.AS "[1m" BOLD
.DA #C.ESC
.AS "[7m" INVERSE
.DA #C.ESC
.AS "[37;40m"
.DA #0
SEQ.BAREND .DA #C.ESC
.AS "[0m"
.DA #0
SEQ.BAR .CS "\e[1m" BOLD
.CS "\e[7m" INVERSE
.CZ "\e[37;40m"
SEQ.BAREND .CZ "\e[0m"
*--------------------------------------
SEQ.BORDERTL .DA #C.SO,#'l'
.DA #0
@ -294,22 +275,15 @@ SEQ.BORDERBR .DA #C.SO,#'j',#C.SI
* .DA #0
SEQ.BORDERV .DA #C.SO,#'x',#C.SI
.DA #0
SEQ.INVERSE .DA #C.ESC
.AS "[7m"
.DA #0
SEQ.NORMAL .DA #C.ESC
.AS "[0m"
.DA #0
SEQ.INVERSE .CZ "\e[7m"
SEQ.NORMAL .CZ "\e[0m"
*--------------------------------------
*SEQ.SCROLLCURUP .AS "\e[?7l\e[%d;%dr"
*SEQ.SCROLLUP .AZ "\eD"
*SEQ.SCROLLCURDN .AS "\e[?7l\e[%d;%dr"
*SEQ.SCROLLDN .AZ "\eM"
*SEQ.SCROLLCURUP .CS "\e[?7l\e[%d;%dr"
*SEQ.SCROLLUP .CZ "\eD"
*SEQ.SCROLLCURDN .CS "\e[?7l\e[%d;%dr"
*SEQ.SCROLLDN .CZ "\eM"
*--------------------------------------
SEQ.CLOSE .DA #C.ESC
.AS "c"
.DA #C.ESC
.AZ "[?7h" Enable Line Wrap
SEQ.CLOSE .CZ "\ec\e[?7h" Enable Line Wrap
*--------------------------------------
MAN
SAVE usr/src/lib/libtui.s

View File

@ -43,9 +43,7 @@ bin/ipconfig
bin/irc
bin/kconfig
bin/kill
bin/l
bin/lc
bin/lm
bin/ls
bin/lsdev
bin/lsof
@ -153,12 +151,16 @@ inc/xy.mouse.i
inc/zp.i
include/md5.h
include/math.h
include/time.h
include/stdio.h
include/stdlib.h
include/string.h
include/unistd.h
include/libblkdev.h
include/libtui.h
include/sys/types.h
include/sys/stat.h
include/sys/socket.h
lib/libblkdev
lib/libcifs
lib/libcrypt
@ -168,6 +170,7 @@ lib/libpak
lib/libtcpip
lib/libtui
lib/libtui.o
lib/libblkdev.o
root/profile
root/netd
root/netd2

View File

@ -63,13 +63,14 @@ CS.INIT
ldy #1
lda (ZPPtr1),y
beq .99
ldy #OptionVars-OptionList-1
.20 ldx #OptionVars-OptionList-1
.2 cmp OptionList,y
.2 cmp OptionList,x
beq .3
dey
dex
bpl .2
.99 >PUSHW L.MSG.USAGE
@ -79,9 +80,15 @@ CS.INIT
sec
rts
.3 ldx OptionVars,y
.3 lda OptionVars,x
tax
* sec
ror $0,x
iny
lda (ZPPtr1),y
bne .20
bra .1
.4 >LDA.G index

View File

@ -853,7 +853,7 @@ DIB .DO SSCIRQ=1
.DA #S.DIB.S.WRITE+S.DIB.S.READ
.FIN
.DA #0,#0,#0
>PSTR "Serial Card/Port"
.PS "Serial Card/Port"
.DA #S.DIB.T.CHAR
.DA #0
.DA K.VER

View File

@ -1213,22 +1213,28 @@ PwdMgrInit >LDYAI MSG.PWD
>SYSCALL2 puts
>LDYAI PWD.ETCPASSWD
>SYSCALL2 LoadStkObj
bcs .1
jsr .1
bcs .9
stx PWD.hUsrDB
>STYA PWD.UsrDBSize
>LDYAI PWD.ETCGROUP
>SYSCALL2 LoadStkObj
bcs .1
jsr .1
bcs .9
stx PWD.hGrpDB
>STYA PWD.GrpDBSize
.1
* clc
.9 rts
.1 >PUSHYA
>PUSHBI O.RDONLY
>PUSHBI S.FI.T.TXT
>PUSHWZ Auxtype=0000
>SYSCALL2 LoadStkObj
rts
*--------------------------------------
* Modified CHARGET/CHARGOT for ROM CALL
* CHRGET .EQ $B1 - C8

View File

@ -46,7 +46,7 @@ K.SYSCALL .DA 0 $00 : STAT
.DA K.PrintF
.DA K.FPrintF
.DA K.SPrintF
.DA K.ScanF
.DA K.ScanF
.DA K.FScanF
.DA K.SScanF
@ -61,9 +61,9 @@ K.SYSCALL .DA 0 $00 : STAT
*--------------------------------------
* Bank 2
*--------------------------------------
.DA K.Mount $60
.DA K.Mount $60 : MOUNT
.DA K.UMount
.DA 0
.DA K.LoadStkObj $64 : STKOBJ
.DA K.GetStkObj
.DA K.Shift $68 : ARG
.DA K.ArgV
@ -113,9 +113,9 @@ K.SYSCALL .DA 0 $00 : STAT
.DA K.StrVGet
.DA K.StrVFree
.DA K.PutEnv $B8 : ENV
.DA K.SetEnv
.DA K.SetEnv
.DA K.GetEnv
.DA K.UnsetEnv
.DA K.UnsetEnv
.DA K.Time $C0 : TIME
.DA K.StrFTime
@ -151,9 +151,9 @@ K.SYSCALL .DA 0 $00 : STAT
.DA K.Realloc
.DA K.GetMemPtr
.DA K.FreeMem
.DA K.Free
.DA K.GetMem K.NewStkObj
.DA K.LoadStkObj
.DA K.GetMemPtr K.GetStkObjPtr
.DA K.FreeMem K.FreeStkObj
*--------------------------------------
@ -194,15 +194,15 @@ K.SYSCALL.BANK .DA #RRAMWRAMBNK1 $00
.DA #RRAMWRAMBNK1
.DA #0
.DA #RRAMWRAMBNK1
.DA #0
.DA #0
.DA #RRAMWRAMBNK1 $20
.DA #RRAMWRAMBNK1 $20 : STDIO
.DA #0
.DA #RRAMWRAMBNK1
.DA #0
.DA #RRAMWRAMBNK1
.DA #0
.DA #RRAMWRAMBNK1
.DA #RRAMWRAMBNK1
.DA #0
.DA #RRAMWRAMBNK1
.DA #0
@ -219,7 +219,7 @@ K.SYSCALL.BANK .DA #RRAMWRAMBNK1 $00
.DA #0
.DA #RRAMWRAMBNK1
.DA #0
.DA #RRAMWRAMBNK1
.DA #RRAMWRAMBNK1
.DA #0
.DA #RRAMWRAMBNK1
.DA #0
@ -236,7 +236,7 @@ K.SYSCALL.BANK .DA #RRAMWRAMBNK1 $00
.DA #0
.DA #RRAMWRAMBNK1
.DA #0
.DA #RRAMWRAMBNK1
.DA #RRAMWRAMBNK1
.DA #0
.DA #RRAMWRAMBNK1
.DA #0
@ -253,10 +253,10 @@ K.SYSCALL.BANK .DA #RRAMWRAMBNK1 $00
.DA #0
.DA #RRAMWRAMBNK1
.DA #0
.DA #RRAMWRAMBNK1
.DA #0
.DA #RRAMWRAMBNK1
.DA #0
.DA #RRAMWRAMBNK1 $58 : PRODOS
.DA #0
.DA #RRAMWRAMBNK1
.DA #0
.DA #RRAMWRAMBNK1
@ -268,9 +268,9 @@ K.SYSCALL.BANK .DA #RRAMWRAMBNK1 $00
.DA #0
.DA #RRAMWRAMBNK2
.DA #0
.DA #RRAMWRAMBNK2
.DA #RRAMWRAMBNK2 $64 : STKOBJ
.DA #0
.DA #RRAMWRAMBNK2
.DA #RRAMWRAMBNK2
.DA #0
.DA #RRAMWRAMBNK2 $68 : ARG
.DA #0
@ -426,9 +426,9 @@ K.SYSCALL.BANK .DA #RRAMWRAMBNK1 $00
.DA #0
.DA #0
.DA #0
.DA #$C0 NewStkObj
.DA #0
.DA #RRAMWRAMBNK2 LoadStkObj
.DA #0
.DA #$C0 NewStkObj
.DA #0
.DA #$C0 GetStkObjPtr
.DA #0
@ -494,7 +494,7 @@ K.SYSCALL.JMPX2 clc
bcc K.SYSCALL.JMPX
>PULLA
K.SYSCALL.JMPX sta SETREADAUX
sta SETWRITEAUX
jsr JMPX

View File

@ -327,6 +327,35 @@ MEM.Init0 phx
.13 plx
rts
*/--------------------------------------
* # Free
* Y,A = Ptr To Free
* ## RETURN VALUE
* none.
* (X unmodified)
*\--------------------------------------
K.Free >STYA ZPMemMgrTmp1
ldx Mem.LastSlot
.1 txa
jsr MEM.GetMemByID
ldy #S.MEM.PTR
lda (ZPMemMgrSPtr),y
cmp ZPMemMgrTmp1
bne .2
iny
lda (ZPMemMgrSPtr),y
cmp ZPMemMgrTmp1+1
beq MEM.FreeMem
.2 dex
bne .1
sec
rts
*/--------------------------------------
* # FreeMem
* A = hMem To Free
* ## RETURN VALUE
@ -355,14 +384,15 @@ K.FreeMem tay
beq K.FreeMem.ERR Slot=0, reserved by Kernel
cmp Mem.LastSlot
bcc .10
bcc .1
bne K.FreeMem.ERR
.10 jsr MEM.GetMemByID X,Y unmodified
lda (ZPMemMgrSPtr) In use ?
.1 jsr MEM.GetMemByID X,Y unmodified
*--------------------------------------
MEM.FreeMem lda (ZPMemMgrSPtr) In use ?
bpl K.FreeMem.ERR
ldy #S.MEM.REFCNT
lda (ZPMemMgrSPtr),y
dec only one left ?

View File

@ -54,32 +54,6 @@ K.UMount tax
.9 lda #E.INVH
sec
rts
*/--------------------------------------
* # GetStkObj
* ## C
* `int *ptr getstkobj (short int hStkObj);`
* ## ASM
* `lda hStkObj`
* `>SYSCALL GetStkObj`
* ## RETURN VALUE
* CC : success
* X = hMem
* Y,A = ptr
* CS : error
* A = EC
*\--------------------------------------
K.GetStkObj tax hMem for CopyToMain
jsr MEM.GetMemByID
ldy #S.MEM.LEN
lda (ZPMemMgrSPtr),y
pha
iny
lda (ZPMemMgrSPtr),y
ply YA = Len
jmp MEM.CopyToMain
*--------------------------------------
MAN
SAVE usr/src/sys/kernel.s.mount

View File

@ -777,46 +777,6 @@ K.Kill.2 ldy #S.PS.hSession
.10 .DA #S.PS.hSS,#S.PS.hDS,#S.PS.hCS
.DA #S.PS.hARGV,#S.PS.hCWD
*/--------------------------------------
* # LoadStkObj
* Load a file in AUX memory (Stock Objects)
* PUSHW = PATH (Handled by....
* PUSHB = MODE ...
* PUSHB = TYPE ...
* PUSHW = AUXTYPE ...FOpen)
* ## RETURN VALUE
* Y,A = File Length
* X = hMem of Loaded Object in AUX mem
*\--------------------------------------
K.LoadStkObj >PUSHYA
>PUSHBI O.RDONLY
>PUSHBI 0 any type...
jsr K.LoadFile.1 ... ending \0
bcs .99
stx .90+1
sty .81+1 Save File Len
sta .82+1
iny
bne .1
inc +1 for ending 0
.1 jsr MEM.MoveToAux X = AUX hMem
bcs .9
.81 ldy #$ff and file len in Y,A
.82 lda #$ff
* clc
rts
.9 pha
.90 lda #$ff SELF MODIFIED
jsr K.freemem
pla
sec
.99 rts
*/--------------------------------------
* # LoadTxtFile
* Load TXT a file in memory (with ending 0)
* ## C
@ -832,10 +792,9 @@ K.LoadStkObj >PUSHYA
K.LoadTxtFile >PUSHYA
>PUSHBI O.RDONLY
>PUSHBI S.FI.T.TXT
K.LoadFile.1 >PUSHWZ Aux type
>PUSHWZ Aux type
sec
K.LoadFile0 sec
.HS 90 BCC
*/--------------------------------------
* # LoadFile

View File

@ -20,7 +20,7 @@ K.SListGetData >PULLW ZPSListDataOfs
* `>PUSHB hSList`
* `>PUSHW KeyID`
* `>PUSHW DataPtr`
* `>PUSHW DataLen`
* `>PUSHW DataLen` (Data bytes to add, 0 if String mode)
* `>SYSCALL SListAddData`
* ## RETURN VALUE
*\--------------------------------------
@ -31,7 +31,7 @@ K.SListAddData
* `>PUSHB hSList`
* `>PUSHW KeyID`
* `>PUSHW DataPtr`
* `>PUSHW DataLen`
* `>PUSHW DataLen` (Data bytes to set, 0 if String mode)
* `>SYSCALL SListSetData`
* ## RETURN VALUE
*\--------------------------------------

View File

@ -97,6 +97,7 @@ SLISTX.GetData jsr SLIST.Select
.5 jsr SHARED.FORPNTpn
inc ZPSListDataLen
bne .2
inc ZPSListDataLen+1
bra .2
@ -120,6 +121,8 @@ SLISTX.AddData jsr SLIST.Select
jsr SLIST.SkipKey
jsr SLISTX.CheckLen
ldy iByte
lda (DBlkPtr),y
pha
@ -152,6 +155,7 @@ SLISTX.AddData jsr SLIST.Select
.1 inc ZPSListDataLen
bne .2
inc ZPSListDataLen+1
beq .8
@ -172,6 +176,9 @@ SLISTX.AddData jsr SLIST.Select
SLISTX.SetData jsr SLIST.Select
jsr SLIST.SkipKey
jsr SLISTX.CheckLen
jsr SLIST.GetDataLen
lda SLIST.DataLen
@ -204,6 +211,38 @@ SLISTX.SetData jsr SLIST.Select
sec
rts
*--------------------------------------
SLISTX.CheckLen lda ZPSListDataLen
ora ZPSListDataLen+1
bne .8
ldx #0
ldy #0
lda FORPNT+1
pha
.1 jsr SHARED.FORPNTgY
beq .2
iny
bne .1
inx
bra .1
.2 iny add Ending \0
bne .3
inx
.3 sty ZPSListDataLen
stx ZPSListDataLen+1
pla
sta FORPNT+1
.8 rts
*--------------------------------------
SLISTX.GetByID jsr SLIST.Select
jsr BLISTX.GetNByte

69
SYS/KERNEL.S.STKOBJ.txt Normal file
View File

@ -0,0 +1,69 @@
NEW
AUTO 3,1
*/--------------------------------------
* # LoadStkObj
* Load a file in AUX memory (Stock Objects)
* PUSHW = PATH (Handled by....
* PUSHB = MODE ...
* PUSHB = TYPE ...
* PUSHW = AUXTYPE ...FOpen)
* ## RETURN VALUE
* Y,A = File Length
* X = hMem of Loaded Object in AUX mem
*\--------------------------------------
K.LoadStkObj jsr K.LoadFile0 ... ending \0
bcs .99
stx .90+1
sty .81+1 Save File Len
sta .82+1
iny
bne .1
inc +1 for ending 0
.1 jsr MEM.MoveToAux X = AUX hMem
bcs .9
.81 ldy #$ff and file len in Y,A
.82 lda #$ff
* clc
rts
.9 pha
.90 lda #$ff SELF MODIFIED
jsr K.freemem
pla
sec
.99 rts
*/--------------------------------------
* # GetStkObj
* ## C
* `int *ptr getstkobj (short int hStkObj);`
* ## ASM
* `lda hStkObj`
* `>SYSCALL GetStkObj`
* ## RETURN VALUE
* CC : success
* X = hMem
* Y,A = ptr
* CS : error
* A = EC
*\--------------------------------------
K.GetStkObj tax hMem for CopyToMain
jsr MEM.GetMemByID
ldy #S.MEM.LEN
lda (ZPMemMgrSPtr),y
pha
iny
lda (ZPMemMgrSPtr),y
ply YA = Len
jmp MEM.CopyToMain
*--------------------------------------
MAN
SAVE usr/src/sys/kernel.s.stkobj
LOAD usr/src/sys/kernel.s
ASM

View File

@ -4,7 +4,7 @@ NEW
* # Time
* Get System Time in Buffer
* ## C
* `int time (S.TIME* timer);`
* `void time (struct tm* timeptr);`
* ## ASM
* `>PUSHW timer`
* `>SYSCALL time`
@ -21,7 +21,7 @@ K.Time >PULLW FORPNT
* # StrFTime
* ## C
* Convert S.TIME struct to CSTR
* `void strftime (char* str, const char* format, const struct S.TIME* timeptr );`
* `void strftime (char* str, const char* format, const struct tm* timeptr );`
* ## ASM
* `>PUSHW str`
* `>PUSHW format`
@ -52,7 +52,7 @@ K.StrFTime >PULLW ZPPtr3 S.TIME
* # PTime2Time
* Convert ProDOS Time To S.TIME
* ## C
* `int PTime2Time (long* ptime, S.TIME* timer);`
* `void PTime2Time (long* ptime, const struct tm* timeptr );`
* ## ASM
* `>PUSHW ptime`
* `>PUSHW timer`
@ -68,7 +68,7 @@ K.PTime2Time .EQ K.SYSCALL.JMPX2
* # CTime2Time
* Convert CTime Time To S.TIME
* ## C
* `int CTime2Time (long* ctime, S.TIME* timer);`
* `void CTime2Time (long* ctime, const struct tm* timeptr );`
* ## ASM
* `>PUSHW ctime`
* `>PUSHW timer`

View File

@ -93,6 +93,7 @@ D2 .DA #0
D2.B .PH $D000
.DA #RRAMWRAMBNK2
.INB usr/src/sys/kernel.s.mount
.INB usr/src/sys/kernel.s.stkobj
.INB usr/src/sys/kernel.s.arg
.INB usr/src/sys/kernel.s.error
.INB usr/src/sys/kernel.s.stdlib