Kernel 0.9.1 : Code reorganization & move to CSTR (SHELL, History, bugfix)

This commit is contained in:
Rémy GIBERT 2017-09-25 17:50:33 +02:00
parent e85146e6cc
commit 3e3aa41e87
26 changed files with 334 additions and 297 deletions

Binary file not shown.

Binary file not shown.

View File

@ -101,11 +101,10 @@ J.CTRL .DA Ctrl.Invalid
.DA 0 .DA 0
*-------------------------------------- *--------------------------------------
CS.INIT lda #$ff CS.INIT lda #$ff
ldy #bSaved >STA.G bSaved
sta (pData),y
ldy #S.PS.ARGC
>SYSCALL GetArgC lda (pPs),y
cmp #1
beq .1 No arg, new file.... beq .1 No arg, new file....
lda #1 lda #1

View File

@ -352,8 +352,7 @@ CS.RUN.PUSHDATES
lda (ZPFileStat),y lda (ZPFileStat),y
beq .1 Month=0.....invalid date/time beq .1 Month=0.....invalid date/time
>LEA.G TIME.Mod >PUSHEA.G TIME.Mod
>PUSHYA
>PUSHW L.FMT.DateTime >PUSHW L.FMT.DateTime
lda ZPFileStat lda ZPFileStat
clc clc
@ -368,8 +367,7 @@ CS.RUN.PUSHDATES
lda (ZPFileStat),y lda (ZPFileStat),y
beq .2 Month=0.....invalid date/time beq .2 Month=0.....invalid date/time
>LEA.G TIME.Create >PUSHEA.G TIME.Create
>PUSHYA
>PUSHW L.FMT.DateTime >PUSHW L.FMT.DateTime
lda ZPFileStat lda ZPFileStat
clc clc
@ -380,10 +378,8 @@ CS.RUN.PUSHDATES
>PUSHYA >PUSHYA
>SYSCALL StrFTime >SYSCALL StrFTime
.2 >LEA.G TIME.Mod .2 >PUSHEA.G TIME.Mod
>PUSHYA >PUSHEA.G TIME.Create
>LEA.G TIME.Create
>PUSHYA
rts rts
*-------------------------------------- *--------------------------------------
CS.RUN.UpdateColCnt CS.RUN.UpdateColCnt

View File

@ -123,8 +123,7 @@ DumpHeader ldy #S.DEV.DRV.JMP+1
dex dex
bpl .1 bpl .1
>LEA.G DEV.SFLAGS >PUSHEA.G DEV.SFLAGS
>PUSHYA
>LDA.G DEV.ID >LDA.G DEV.ID
>PUSHA >PUSHA
@ -148,8 +147,7 @@ DumpStatus >LDA.G DEV.S
lda (ZPPTR2),y lda (ZPPTR2),y
>STA.G DEV.SIZE+2 >STA.G DEV.SIZE+2
>LEA.G DEV.SIZE >PUSHEA.G DEV.SIZE
>PUSHYA
.1 ldy #S.DEVSTAT.VERSION+1 .1 ldy #S.DEVSTAT.VERSION+1
>PUSHB (ZPPTR2),y >PUSHB (ZPPTR2),y

View File

@ -45,7 +45,7 @@ L.MSG2 .DA MSG2
L.MSG3 .DA MSG3 L.MSG3 .DA MSG3
L.MSG4 .DA MSG4 L.MSG4 .DA MSG4
L.MSG5 .DA MSG5 L.MSG5 .DA MSG5
L.MSG6 .DA MSG6 L.MSG.FREE .DA MSG.FREE
.DA 0 .DA 0
*-------------------------------------- *--------------------------------------
CS.INIT ldy #MEM.COUNT Skip SLOT0 CS.INIT ldy #MEM.COUNT Skip SLOT0
@ -53,6 +53,9 @@ CS.INIT ldy #MEM.COUNT Skip SLOT0
inc inc
sta (pData),y sta (pData),y
>LEA.G MemStat
>SYSCALL GetMemStat.YA
lda (pPs) lda (pPs)
ora #S.PS.F.EVENT Now accept events ora #S.PS.F.EVENT Now accept events
sta (pPs) sta (pPs)
@ -82,9 +85,8 @@ CS.RUN >SYSCALL GetChar
lda (pData),y lda (pData),y
bne .8 bne .8
ldy #MEM.COUNT >LDA.G MEM.COUNT
lda (pData),y >CMP.G MemStat+S.MEMSTAT.MLastSlot
cmp MemMgr.LastSlot
beq .10 beq .10
ldy #LINE.COUNT ldy #LINE.COUNT
@ -144,27 +146,31 @@ CS.RUN >SYSCALL GetChar
>LDYA L.MSG2 >LDYA L.MSG2
>SYSCALL PrintF.YA >SYSCALL PrintF.YA
>PUSHW MemMgr.HiMem >LDYA.G MemStat+S.MEMSTAT.MH
>PUSHYA
>LDYA L.MSG3 >LDYA L.MSG3
>SYSCALL PrintF.YA >SYSCALL PrintF.YA
>PUSHW MemMgr.Free >LDYA.G MemStat+S.MEMSTAT.MF
>PUSHYA
>LDYA L.MSG4 >LDYA L.MSG4
>SYSCALL PrintF.YA >SYSCALL PrintF.YA
>PUSHW MemMgr.LoMem >LDYA.G MemStat+S.MEMSTAT.ML
>PUSHYA
>LDYA L.MSG5 >LDYA L.MSG5
>SYSCALL PrintF.YA >SYSCALL PrintF.YA
lda MemMgr.Free
sec sec
sbc MemMgr.LoMem >LDA.G MemStat+S.MEMSTAT.MF
tay >SBC.G MemStat+S.MEMSTAT.ML
lda MemMgr.Free+1 pha
sbc MemMgr.LoMem+1 >LDA.G MemStat+S.MEMSTAT.MF+1
>SBC.G MemStat+S.MEMSTAT.ML+1
ply
>PUSHYA >PUSHYA
>LDYA L.MSG6 >LDYA L.MSG.FREE
>SYSCALL PrintF.YA >SYSCALL PrintF.YA
sec sec
rts rts
@ -281,7 +287,7 @@ MSG2 >CSTR "\r\nAllocated hMem:%d, Total:%d\r\n"
MSG3 >CSTR "High Memory: $%H\r\n" MSG3 >CSTR "High Memory: $%H\r\n"
MSG4 >CSTR "Free ULimit: $%H\r\n" MSG4 >CSTR "Free ULimit: $%H\r\n"
MSG5 >CSTR "Low Memory: $%H\r\n" MSG5 >CSTR "Low Memory: $%H\r\n"
MSG6 >CSTR "\r\nFree Memory: %D Bytes.\r\n" MSG.FREE >CSTR "\r\nFree Memory: %D Bytes.\r\n"
*-------------------------------------- *--------------------------------------
.DUMMY .DUMMY
.OR 0 .OR 0
@ -290,6 +296,7 @@ LINE.COUNT .BS 1
MEM.COUNT .BS 1 MEM.COUNT .BS 1
USED.COUNT .BS 1 USED.COUNT .BS 1
bSTOP .BS 1 bSTOP .BS 1
MemStat .BS S.MEMSTAT
DS.END DS.END
.ED .ED
*-------------------------------------- *--------------------------------------

View File

@ -27,8 +27,7 @@ InitSrcDirYA >SYSCALL GetFullPath.YA
lda (ZPPtr1),y lda (ZPPtr1),y
beq .5 we have '/' beq .5 we have '/'
>LEA.G STAT >PUSHEA.G STAT
>PUSHYA
>PUSHW ZPPtr1 >PUSHW ZPPtr1
>SYSCALL Stat >SYSCALL Stat
bcs .1 File/DIR does not exists, go extract pattern bcs .1 File/DIR does not exists, go extract pattern
@ -143,8 +142,7 @@ InitDstDirYA >SYSCALL GetFullPath.YA
stx .90+1 stx .90+1
>STYA ZPPtr1 >STYA ZPPtr1
>LEA.G STAT >PUSHEA.G STAT
>PUSHYA
>PUSHW ZPPtr1 >PUSHW ZPPtr1
>SYSCALL Stat >SYSCALL Stat
bcs .1 File/DIR does not exists, go extract DstFileName bcs .1 File/DIR does not exists, go extract DstFileName

View File

@ -83,7 +83,7 @@ Dev.Detect >STYA Args
>STYA ZPTmpPTR >STYA ZPTmpPTR
jsr DecodeMac jsr DecodeMac
bcc .4 bcc .4
lda #DEVMGR.ERRICL lda #SYSMGR.ERRSYN
sec sec
rts rts

View File

@ -119,7 +119,7 @@ Dev.Detect >STYA Args
.4 jsr DecodeMac .4 jsr DecodeMac
bcc .8 bcc .8
lda #DEVMGR.ERRICL lda #SYSMGR.ERRSYN
sec sec
rts rts

View File

@ -113,7 +113,7 @@ Dev.Detect >STYA ARGS
.4 jsr DecodeMac .4 jsr DecodeMac
bcc .8 bcc .8
lda #DEVMGR.ERRICL lda #SYSMGR.ERRSYN
sec sec
rts rts

View File

@ -118,7 +118,7 @@ Dev.Detect >STYA Args
.4 jsr DecodeMac .4 jsr DecodeMac
bcc .8 bcc .8
lda #DEVMGR.ERRICL lda #SYSMGR.ERRSYN
sec sec
rts rts

View File

@ -5,20 +5,6 @@ INC 1
AUTO 6 AUTO 6
.LIST OFF .LIST OFF
*-------------------------------------- *--------------------------------------
* KERNEL CONSTANTS DEFINITON
*--------------------------------------
K.ENV.SIZE .EQ 256
K.FLT.MAX .EQ 4
K.EVT.MAX .EQ 8
K.DEV.MAX .EQ 32
K.PS.MAX .EQ 32
*--------------------------------------
* Kernel ZP Aux
*--------------------------------------
ZPKERNEL .EQ $0
*--------------------------------------
ZPMEMMGR .EQ $8
*--------------------------------------
pDrv .EQ $10 pDrv .EQ $10
pDev .EQ $12 pDev .EQ $12
pEvent .EQ $14 pEvent .EQ $14
@ -36,63 +22,6 @@ ZPBIN .EQ $20
ZPDRV .EQ $30 ZPDRV .EQ $30
ZPLIB .EQ $40 32 bytes for TCPIP ZPLIB .EQ $40 32 bytes for TCPIP
*-------------------------------------- *--------------------------------------
* $42-$47 ProDOS Block Device Drivers Main
* $5E-$C8 RESERVED APPLESOFT Main/Aux (ROM Call, no need to switch back MainZP)
*--------------------------------------
* Memory Map
*--------------------------------------
A2osX.SaveSM .EQ $100 Aux
A2osX.SaveSX .EQ $101 Aux
*--------------------------------------
* Main $200 -> 2FF : (Used By ProDOS,Clock DRV....)
* Main $300 -> 3EF : <free>
* Main $3F0 -> 3FF : SYS Vectors (reset,IRQ...)
* Aux $200 -> 3FD : /RAM Driver
* Aux $3FE -> 3FF : IRQ Vector
*--------------------------------------
K.S.STAT .EQ $0300 S.STAT for internal kernel operations
K.S.DEVSTAT .EQ $0340 S.DEVSTAT=25 or higher depends on dev type
K.SP.PARAMS .EQ $0380 Max 9 bytes
K.MLI.PARAMS .EQ $0390 Main, 18 bytes min for GetFileInfo (ATLK needs MORE!!!...32 max for now)
K.MLI.PATH .EQ $03B0 64+1 -> $03D0
*--------------------------------------
*** $3F0-$3FF IRQ Handler.... ***
*--------------------------------------
* Main/Aux $400 -> $7FF : Console Screen
* Main/Aux $800 -> $BFF : System Screen
*--------------------------------------
PS.Table.PID .EQ $0C00 K.PS.MAX
PS.Table.hMem .EQ $0C00+K.PS.MAX
K.Buf256 .EQ $0E00 Main
*--------------------------------------
K.STACKTOP .EQ $0F20 down to $0f00
*--------------------------------------
*** Z80 Reserved $0F00-10FF***
*--------------------------------------
Z80STACK .EQ $0FFF (0FFFFh) Down to $0F20
Z80JMP .EQ $1000 (00000h) Up To $10FF
*--------------------------------------
FltMgr.Table .EQ $1100 K.FLT.MAX*S.FLT.SIZE=8*32=128b
*--------------------------------------
EvtMgr.Table .EQ $1180 K.EVT.MAX*S.EVT.SIZE=16*8=128b
*--------------------------------------
DevMgr.Table .EQ $1200 K.DEV.MAX*S.DEV.SIZE=32*16=512b
*--------------------------------------
* MemMgr : $1800->$1FFF MAIN/AUX (2 kBytes)
*--------------------------------------
MemMgr.Table .EQ $1800 Slot 0 is Reserved
MemMgr.LoMem .EQ $1800
MemMgr.Free .EQ $1802
MemMgr.HiMem .EQ $1804
MemMgr.LastSlot .EQ $1806
*--------------------------------------
MemMgr.MLoMem .EQ $2000
MemMgr.MHiMem .EQ $BD00
MemMgr.XLoMem .EQ $2000
MemMgr.XHiMem .EQ $C000
*--------------------------------------
DevMgr.HiMem .EQ $FFFA Protect IRQ vectors in Aux LC
*--------------------------------------
* A2osX GLOBAL PAGE * A2osX GLOBAL PAGE
* $BD00->$BD0F : Public Vetors * $BD00->$BD0F : Public Vetors
*-------------------------------------- *--------------------------------------
@ -304,10 +233,6 @@ SYS.Sleep .EQ $E0
MEMMGR.ERROOM .EQ $FF Out Of Memory Error MEMMGR.ERROOM .EQ $FF Out Of Memory Error
MEMMGR.ERROOH .EQ $FE Out Of Handle Error MEMMGR.ERROOH .EQ $FE Out Of Handle Error
*-------------------------------------- *--------------------------------------
DEVMGR.ERROOM .EQ $EF Out Of Memory Error
DEVMGR.ERROOH .EQ $EE Out Of Handle Error
DEVMGR.ERRICL .EQ $ED Invalid Command Line
*--------------------------------------
TSKMGR.ERROOH .EQ $DF Out Of Handle Error TSKMGR.ERROOH .EQ $DF Out Of Handle Error
TSKMGR.ERRNSP .EQ $DD No Such Process Error TSKMGR.ERRNSP .EQ $DD No Such Process Error
*-------------------------------------- *--------------------------------------
@ -336,14 +261,17 @@ S.MEM .EQ 8
S.MEMSTAT.ML .EQ 0 S.MEMSTAT.ML .EQ 0
S.MEMSTAT.MF .EQ 2 S.MEMSTAT.MF .EQ 2
S.MEMSTAT.MH .EQ 4 S.MEMSTAT.MH .EQ 4
S.MEMSTAT.MLastSlot .EQ 6
* *
S.MEMSTAT.XL .EQ 8 S.MEMSTAT.XL .EQ 8
S.MEMSTAT.XF .EQ 10 S.MEMSTAT.XF .EQ 10
S.MEMSTAT.XH .EQ 12 S.MEMSTAT.XH .EQ 12
S.MEMSTAT.XLastSlot .EQ 14
* *
S.MEMSTAT.DL .EQ 16 S.MEMSTAT.DL .EQ 16
S.MEMSTAT.DF .EQ 18 S.MEMSTAT.DF .EQ 18
S.MEMSTAT.DH .EQ 20 S.MEMSTAT.DH .EQ 20
S.MEMSTAT.DCount .EQ 22
* *
S.MEMSTAT .EQ 24 S.MEMSTAT .EQ 24
*-------------------------------------- *--------------------------------------

87
INC/KERNEL.I.txt Normal file
View File

@ -0,0 +1,87 @@
PR#3
PREFIX /A2OSX.BUILD
LOMEM $900
INC 1
AUTO 6
.LIST OFF
*--------------------------------------
* KERNEL CONSTANTS DEFINITON
*--------------------------------------
K.ENV.SIZE .EQ 256
K.FLT.MAX .EQ 4
K.EVT.MAX .EQ 8
K.DEV.MAX .EQ 32
K.PS.MAX .EQ 32
*--------------------------------------
* Kernel ZP Aux
*--------------------------------------
ZPKERNEL .EQ $0
ZPPtr1 .EQ ZPKERNEL
ZPPtr2 .EQ ZPKERNEL+2
ZPPtr3 .EQ ZPKERNEL+4
ZPPtr4 .EQ ZPKERNEL+6
*--------------------------------------
ZPMEMMGR .EQ $8
*--------------------------------------
*--------------------------------------
* $42-$47 ProDOS Block Device Drivers Main
* $5E-$C8 RESERVED APPLESOFT Main/Aux (ROM Call, no need to switch back MainZP)
*--------------------------------------
* Memory Map
*--------------------------------------
A2osX.SaveSM .EQ $100 Aux
A2osX.SaveSX .EQ $101 Aux
*--------------------------------------
* Main $200 -> 2FF : (Used By ProDOS,Clock DRV....)
* Main $300 -> 3EF : <free>
* Main $3F0 -> 3FF : SYS Vectors (reset,IRQ...)
* Aux $200 -> 3FD : /RAM Driver
* Aux $3FE -> 3FF : IRQ Vector
*--------------------------------------
K.S.STAT .EQ $0300 S.STAT for internal kernel operations
K.S.DEVSTAT .EQ $0340 S.DEVSTAT=25 or higher depends on dev type
K.SP.PARAMS .EQ $0380 Max 9 bytes
K.MLI.PARAMS .EQ $0390 Main, 18 bytes min for GetFileInfo (ATLK needs MORE!!!...32 max for now)
K.MLI.PATH .EQ $03B0 64+1 -> $03D0
*--------------------------------------
*** $3F0-$3FF IRQ Handler.... ***
*--------------------------------------
* Main/Aux $400 -> $7FF : Console Screen
* Main/Aux $800 -> $BFF : System Screen
*--------------------------------------
PS.Table.PID .EQ $0C00 K.PS.MAX
PS.Table.hMem .EQ $0C00+K.PS.MAX
K.Buf256 .EQ $0E00 Main
*--------------------------------------
K.STACKTOP .EQ $0F20 down to $0f00
*--------------------------------------
*** Z80 Reserved $0F00-10FF***
*--------------------------------------
Z80STACK .EQ $0FFF (0FFFFh) Down to $0F20
Z80JMP .EQ $1000 (00000h) Up To $10FF
*--------------------------------------
FltMgr.Table .EQ $1100 K.FLT.MAX*S.FLT.SIZE=8*32=128b
*--------------------------------------
EvtMgr.Table .EQ $1180 K.EVT.MAX*S.EVT.SIZE=16*8=128b
*--------------------------------------
DevMgr.Table .EQ $1200 K.DEV.MAX*S.DEV.SIZE=32*16=512b
*--------------------------------------
* MemMgr : $1800->$1FFF MAIN/AUX (2 kBytes)
*--------------------------------------
MemMgr.Table .EQ $1800 Slot 0 is Reserved
MemMgr.LoMem .EQ $1800
MemMgr.Free .EQ $1802
MemMgr.HiMem .EQ $1804
MemMgr.LastSlot .EQ $1806
*--------------------------------------
MemMgr.MLoMem .EQ $2000
MemMgr.MHiMem .EQ $BD00
MemMgr.XLoMem .EQ $2000
MemMgr.XHiMem .EQ $C000
*--------------------------------------
DevMgr.HiMem .EQ $FFFA Protect IRQ vectors in Aux LC
*--------------------------------------
MAN
SAVE /A2OSX.BUILD/INC/KERNEL.I
LOAD /A2OSX.SRC/SYS/KERNEL.S
ASM

View File

@ -116,13 +116,28 @@ AUTO 6
* Global DATA Segment Access * Global DATA Segment Access
*-------------------------------------- *--------------------------------------
.MA LEA.G .MA LEA.G
lda #]1
clc clc
adc pData lda pData
adc #]1
tay tay
lda pData+1 lda pData+1
adc /]1 adc /]1
.EM .EM
*--------------------------------------
.MA PUSHEA.G
clc
lda pData
adc #]1
tay
lda pData+1
adc /]1
dec pStack
sta (pStack)
tya
dec pStack
sta (pStack)
.EM
*-------------------------------------- *--------------------------------------
.MA LDA.G .MA LDA.G
ldy #]1 ldy #]1
@ -138,6 +153,25 @@ AUTO 6
ldy #]1 ldy #]1
cmp (pData),y cmp (pData),y
.EM .EM
*--------------------------------------
.MA SBC.G
ldy #]1
sbc (pData),y
.EM
*--------------------------------------
.MA DEC.G
ldy #]1
lda (pData),y
dec
sta (pData),y
.EM
*--------------------------------------
.MA INC.G
ldy #]1
lda (pData),y
inc
sta (pData),y
.EM
*-------------------------------------- *--------------------------------------
.MA INCW.G .MA INCW.G
ldy #]1 ldy #]1

View File

@ -311,27 +311,27 @@ SKT.AcceptA jsr SKT.GetA.I
*\-------------------------------------- *\--------------------------------------
SKT.MkNodA sta NODE.SSOCK+S.NODE.SSOCK.HSKT SKT.MkNodA sta NODE.SSOCK+S.NODE.SSOCK.HSKT
>SYSCALL MkNodA >SYSCALL MkNod.A
K.MkNod.A sta .1+1 K.MkNod.A sta .1+1
>LDYAI S.NODE.SSOCK >LDYAI S.NODE.SSOCK
jsr K.GetMem0.YA >SYSCALL GetMem0.YA
bcs .9 bcs .9
>STYA ZPPtr1 >STYA ZPTmpPtr1
ldy #S.NODE.T ldy #S.NODE.T
lda #S.NODE.T.SSOCK lda #S.NODE.T.SSOCK
sta (ZPPtr1),y sta (ZPTmpPtr1),y
ldy #S.NODE.SSOCK.HSKT ldy #S.NODE.SSOCK.HSKT
.1 lda #$ff .1 lda #$ff
sta (ZPPtr1),y sta (ZPTmpPtr1),y
>LDYA ZPPtr1 >LDYA ZPTmpPtr1
.9 rts rts
@ -342,10 +342,10 @@ K.MkNod.A sta .1+1
ldy #S.NODE.SSOCK-1 ldy #S.NODE.SSOCK-1
.1 lda NODE.SSOCK,y .2 lda NODE.SSOCK,y
sta (ZPTmpPtr1),y sta (ZPTmpPtr1),y
dey dey
bpl .1 bpl .2
txa txa
* clc * clc

View File

@ -295,8 +295,8 @@ NODE.SSOCK .BS 1 S.NODE.HANDLER
.BS 1 S.NODE.SSOCK.HSKT .BS 1 S.NODE.SSOCK.HSKT
.DA #0 S.NODE.SSOCK.OPEN .DA #0 S.NODE.SSOCK.OPEN
.DA #0 S.NODE.SSOCK.CLOSE .DA #0 S.NODE.SSOCK.CLOSE
.DA LIBTCPIP.SKT.GetC.A .DA LIBTCPIP.SKT.GetChar.A
.DA LIBTCPIP.SKT.PutC .DA LIBTCPIP.SKT.PutChar
.DA #0 S.NODE.SSOCK.STATUS .DA #0 S.NODE.SSOCK.STATUS
*-------------------------------------- *--------------------------------------
MAN MAN

View File

@ -178,8 +178,7 @@ CS.RUN.ToggleSlotA
sta (ZPTmp1),y sta (ZPTmp1),y
rts rts
*-------------------------------------- *--------------------------------------
CS.RUN.Load >LEA.G StatBuf CS.RUN.Load >PUSHEA.G StatBuf
>PUSHYA
>LDA.G hFileName >LDA.G hFileName
>SYSCALL GetMemPtr.A >SYSCALL GetMemPtr.A
>PUSHYA >PUSHYA

View File

@ -83,7 +83,6 @@ Cmd.Exec lda #0
txa txa
>STA.G CMD.hCmdLine >STA.G CMD.hCmdLine
>LDYA L.INTCMDS >LDYA L.INTCMDS
>STYA ZPPtr2 >STYA ZPPtr2
@ -154,8 +153,7 @@ Cmd.Exec.EXT jsr Cmd.Exec.Split
cmp #'/' Command line is already full path, no search cmp #'/' Command line is already full path, no search
bne .1 bne .1
>LEA.G CMD.Stat >PUSHEA.G CMD.Stat
>PUSHYA
>PUSHW ZPPtr1 >PUSHW ZPPtr1
>SYSCALL STAT >SYSCALL STAT
bcs Cmd.Exec.Done bcs Cmd.Exec.Done
@ -241,8 +239,7 @@ Cmd.Exec.EXT.Search
>PUSHYA push search list >PUSHYA push search list
>PUSHW ZPPtr1 push CMD >PUSHW ZPPtr1 push CMD
>PUSHW ZPCMDBuf push dest full path >PUSHW ZPCMDBuf push dest full path
>LEA.G CMD.Stat >PUSHEA.G CMD.Stat
>PUSHYA
>SYSCALL FileSearch >SYSCALL FileSearch
rts rts
*-------------------------------------- *--------------------------------------
@ -356,8 +353,7 @@ Cmd.Exec.CD1 lda (ZPPTR2) Get ARG
lda #'!' lda #'!'
>SYSCALL PutChar.A >SYSCALL PutChar.A
>LEA.G CMD.Stat >PUSHEA.G CMD.Stat
>PUSHYA
>PUSHW ZPCMDBuf >PUSHW ZPCMDBuf
>SYSCALL STAT >SYSCALL STAT
bcs .9 bcs .9
@ -509,8 +505,7 @@ Cmd.Exec.TIME clc
bra .2 bra .2
.1 >PUSHW L.FMT.TIME .1 >PUSHW L.FMT.TIME
.2 >LEA.G CMD.Time .2 >PUSHEA.G CMD.Time
>PUSHYA
>SYSCALL StrFTime >SYSCALL StrFTime
>LDYAI ZPCMDBuf >LDYAI ZPCMDBuf
@ -621,8 +616,7 @@ Cmd.Exec.READ lda (ZPPtr2)
Cmd.Exec.SLEEP lda (ZPPtr2) Cmd.Exec.SLEEP lda (ZPPtr2)
beq .9 beq .9
>LEA.G Sleep >PUSHEA.G Sleep
>PUSHYA
>PUSHW ZPPtr2 >PUSHW ZPPtr2
>SYSCALL AToI.YA >SYSCALL AToI.YA

View File

@ -5,7 +5,7 @@ INC 1
AUTO 6 AUTO 6
.LIST OFF .LIST OFF
*-------------------------------------- *--------------------------------------
HIS.Init >LDYAI 256 Get a buffer for History HIS.Init >LDYAI History.MAX Get a buffer for History
>SYSCALL GetMem0.YA >SYSCALL GetMem0.YA
bcs .9 bcs .9
@ -13,8 +13,8 @@ HIS.Init >LDYAI 256 Get a buffer for History
>STA.G HIS.hBuf >STA.G HIS.hBuf
lda #0 lda #0
>STA.G HIS.BufIndex >STA.G HIS.Count
>STA.G HIS.BufEnd >STA.G HIS.Index
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
HIS.Add >LDA.G HIS.hBuf HIS.Add >LDA.G HIS.hBuf
@ -23,14 +23,25 @@ HIS.Add >LDA.G HIS.hBuf
>SYSCALL GetMemPtr.A >SYSCALL GetMemPtr.A
>STYA ZPPTR1 >STYA ZPPTR1
.10 >LDA.G HIS.BufEnd .10 lda #$ff
jsr HIS.GetA Y=ending 0
.11 sec add len+1 tya
sec add len+1
adc CmdBuflen CmdBuffer length adc CmdBuflen CmdBuffer length
bcc .2 enough room bcc .2 enough room
lda (ZPPTR1) get len of oldest string >DEC.G HIS.Count we must remove oldest
sec
ldy #$ff
.12 iny
lda (ZPPTR1),y get len of oldest string
bne .12
tya
* sec
adc ZPPTR1 adc ZPPTR1
sta ZPPTR2 sta ZPPTR2
lda ZPPTR1+1 lda ZPPTR1+1
@ -40,122 +51,117 @@ HIS.Add >LDA.G HIS.hBuf
ldy #$FF ldy #$FF
.1 iny .1 iny
lda (ZPPTR2),y move back until ending 0 found lda (ZPPTR2),y move back until String ending 0 found
sta (ZPPTR1),y sta (ZPPTR1),y
bne .1 bne .1
tya
>STA.G HIS.BufEnd mark new end of history
bra .11 retry....
.2 tax keep new HIS.BufEnd
tay
lda #0
sta (ZPPTR1),y set ending 0
>LDA.G HIS.BufEnd save old END
pha
txa get back new END
>STA.G HIS.BufIndex set it as new IDX
>STA.G HIS.BufEnd set new HIS.BufEnd
pla get back old END
clc
adc ZPPTR1
sta ZPPTR1
bcc .3
inc ZPPTR1+1
.3 ldy #0
.4 lda (ZPCMDBuf),y
beq .5
iny iny
lda (ZPPTR2),y move back until Array ending 0 found
sta (ZPPTR1),y sta (ZPPTR1),y
iny bne .1
bra .4
.5 tya bra .10 retry....
sta (ZPPTR1)
.2 tya Y=Array Ending 0
sec
adc ZPPTR1
sta ZPPTR2
lda ZPPTR1+1
adc #0
sta ZPPTR2+1
.3 ldy #$ff
.4 iny
lda (ZPCMDBuf),y
sta (ZPPTR1),y
bne .4
iny
sta (ZPPTR1),y set new array ending 0
* lda #0
>STA.G HIS.Index Reset Index
>INC.G HIS.Count
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
HIS.GetPrev >LDA.G HIS.hBuf HIS.GetPrev >LDA.G HIS.hBuf
beq HISTORY.RTS beq HISTORY.RTS
tax
>LDA.G HIS.BufEnd
beq HISTORY.RTS empty history,nothing to do
>LDA.G HIS.BufIndex
beq HISTORY.RTS already oldest,nothing to do
txa
>SYSCALL GetMemPtr.A >SYSCALL GetMemPtr.A
>STYA ZPPTR1 >STYA ZPPTR1
lda #0 >LDA.G HIS.Count
beq HISTORY.RTS empty history,nothing to do
.1 tax >LDA.G HIS.Index
tay bne .1
sec
adc (ZPPTR1),y
bcs History.RTS out of buffer
ldy #HIS.BufIndex >LDA.G HIS.Count
cmp (pData),y
bne .1 reached current index
.2 txa .1 dec
>STA.G HIS.BufIndex set new index >STA.G HIS.Index
jsr HIS.GetA
bra HIS.SetBuf bra HIS.SetBuf
History.RTS rts History.RTS rts
*-------------------------------------- *--------------------------------------
HIS.GetNext >LDA.G HIS.hBuf HIS.GetNext >LDA.G HIS.hBuf
beq HISTORY.RTS beq HISTORY.RTS
tax
>LDA.G HIS.BufEnd
beq HISTORY.RTS empty history,nothing to do
>CMP.G HIS.BufIndex
beq HISTORY.RTS already oldest,nothing to do
txa
>SYSCALL GetMemPtr.A >SYSCALL GetMemPtr.A
>STYA ZPPTR1 >STYA ZPPTR1
>LDA.G HIS.BufIndex >LDA.G HIS.Count
tay beq HISTORY.RTS empty history,nothing to do
sec
adc (ZPPTR1),y add length+1 of current line in history >LDA.G HIS.Index
>STA.G HIS.BufIndex inc
>CMP.G HIS.Count
bne .1
lda #0
.1 >STA.G HIS.Index
jsr HIS.GetA
>CMP.G HIS.BufEnd
bne HIS.SetBuf bne HIS.SetBuf
jmp CmdLine.CLR end of history, just blank buffer jmp CmdLine.CLR end of history, just blank buffer
*-------------------------------------- *--------------------------------------
HIS.SetBuf jsr CmdLine.CLR HIS.GetA tax
beq .8
>LDA.G HIS.BufIndex
tay keep length of string
clc ldy #0
adc ZPPTR1 lda (ZPPTR1),y
sta ZPPTR1 beq .9
bcc .1
inc ZPPTR1+1 .1 iny
lda (ZPPTR1),y
bne .1
dex
beq .8
iny
lda (ZPPTR1),y
bne .1
.9 sec Found ending 0....
rts
.8 clc
rts
*--------------------------------------
HIS.SetBuf jsr CmdLine.CLR
ldy #$ff
.1 lda (ZPPTR1),y .1 lda (ZPPTR1),y
sta (ZPCMDBuf),y sta (ZPCMDBuf),y
dey bne .1
bpl .1
jmp CmdLine.PRINT jmp CmdLine.PRINT
*-------------------------------------- *--------------------------------------
HIS.Quit >LDA.G HIS.hBuf HIS.Quit >LDA.G HIS.hBuf

View File

@ -23,6 +23,7 @@ ZPCSHStack .EQ ZPBIN+14
*-------------------------------------- *--------------------------------------
CmdLine.MAX .EQ 255 CmdLine.MAX .EQ 255
VarLen.MAX .EQ 15 VarLen.MAX .EQ 15
History.MAX .EQ 256
CSH.Stack.MAX .EQ 15 CSH.Stack.MAX .EQ 15
CSH.Name.MAX .EQ 15 CSH.Name.MAX .EQ 15
@ -583,8 +584,8 @@ CMD.Stat .BS S.STAT
CMD.Time .BS S.TIME CMD.Time .BS S.TIME
HIS.hBuf .BS 1 HIS.hBuf .BS 1
HIS.BufIndex .BS 1 HIS.Count .BS 1
HIS.BufEnd .BS 1 HIS.Index .BS 1
IO.hIn .BS 1 IO.hIn .BS 1
IO.hOut .BS 1 IO.hOut .BS 1

View File

@ -12,48 +12,41 @@ AUTO 6
* Y,A = CStr To Arg[A] * Y,A = CStr To Arg[A]
* CS : Out Of Bound * CS : Out Of Bound
*\-------------------------------------- *\--------------------------------------
K.GetArg.A sta .2+1 K.GetArg.A pha save requested arg#
jsr ARG.InitArgPtr1
lda .2+1
beq .8
ldx #0 ldy #S.PS.hARGS
.1 lda (ZPPtr1)
beq .9
.2 cpx #$ff Self Modified
beq .8
jsr ARG.NextArgPtr1
inx
bra .1
.8 >LDYA ZPPtr1
clc
rts
.9 sec
rts
*--------------------------------------
ARG.InitArgPtr1 ldy #S.PS.hARGS
lda (pPs),y lda (pPs),y
jsr K.GetMemPtr.A jsr K.GetMemPtr.A
>STYA ZPPtr1
rts plx we want 0 ?
*--------------------------------------
ARG.NextArgPtr1 inc ZPPtr1 beq .80 yes, returns MemPtr
>STYA ZPPtr1 no, save it
.1 lda (ZPPtr1) end of ARG[]
beq .9 yes, not found....
.3 inc ZPPtr1 skip next one....
bne .4
inc ZPPtr1+1
.4 lda (ZPPtr1)
bne .3
inc ZPPtr1 ....and point to next, or ending 0
bne .5
inc ZPPtr1+1
.5 dex
bne .1 bne .1
inc ZPPtr1+1
.8 >LDYA ZPPtr1
.1 lda (ZPPtr1) .80 clc
bne ARG.NextArgPtr1 rts
inc ZPPtr1 .9 sec
bne .8 rts
inc ZPPtr1+1
.8 rts
*-------------------------------------- *--------------------------------------
MAN MAN
SAVE /A2OSX.SRC/SYS/KERNEL.S.ARG SAVE /A2OSX.SRC/SYS/KERNEL.S.ARG

View File

@ -388,11 +388,11 @@ BIN.InstallDRV ldy #H.BIN.DRV.CODE.O
cmp #K.DEV.MAX cmp #K.DEV.MAX
bne .10 No Device Handle Left bne .10 No Device Handle Left
lda #DEVMGR.ERROOH lda #MEMMGR.ERROOH
sec sec
rts rts
.9 lda #DEVMGR.ERROOM .9 lda #MEMMGR.ERROOM
sec sec
rts rts

View File

@ -357,9 +357,9 @@ ENV.ExpandSysVar
cmp #'9'+1 cmp #'9'+1
bcs .1 bcs .1
and #$0F and #$0F
>DEBUG
jsr K.GetArg.A jsr K.GetArg.A
bcs .99 bcs .8 Arg# is undefined, do not append anything
>STYA ZPPtr3 >STYA ZPPtr3
jmp ENV.AppendPtr3ToBuf jmp ENV.AppendPtr3ToBuf

View File

@ -692,7 +692,7 @@ DevMgrInit.AddDev
clc clc
rts rts
.9 lda #DEVMGR.ERROOH .9 lda #MEMMGR.ERROOH
sec sec
rts rts
*-------------------------------------- *--------------------------------------

View File

@ -173,9 +173,6 @@ PS.CreateChild ldx #0
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
PS.CmdLine2Args >STYA ZPPtr1 PS.CmdLine2Args >STYA ZPPtr1
>SYSCALL PrintF.YA
lda #']'
>SYSCALL PutChar.A
ldy #0 ldy #0
@ -207,39 +204,43 @@ PS.CmdLine2Args >STYA ZPPtr1
stz PS.CmdLine2Args.bInQuote stz PS.CmdLine2Args.bInQuote
ldy #0 ldy #$ff
ldx #0 Arg Count ldx #0 Arg Count
.4 lda (ZPPtr1),y .4 iny
beq .8 lda (ZPPtr1),y
beq .7
cmp #'"' found a quote ? cmp #'"' found a quote ?
bne .5 bne .5
lda PS.CmdLine2Args.bInQuote lda PS.CmdLine2Args.bInQuote
eor #$ff eor #$ff
sta PS.CmdLine2Args.bInQuote sta PS.CmdLine2Args.bInQuote
bra .71 bra .4
.5 cmp #' ' .5 cmp #' '
bne .70 bne .6
bit PS.CmdLine2Args.bInQuote bit PS.CmdLine2Args.bInQuote
bmi .70 bmi .6
inx Found one arg !!! inx Found one arg !!!
lda #0 lda #0 set this token End
.70 sta (ZPPtr2) yes, set this token len .6 sta (ZPPtr2)
.71 inc ZPPtr2 inc ZPPtr2
bne .72 bne .4
inc ZPPtr2+1
bra .4
.7 sta (ZPPtr2) set Arg Ending 0
inc ZPPtr2
bne .8
inc ZPPtr2+1 inc ZPPtr2+1
.72 iny .8 sta (ZPPtr2) set Array Ending 0
bne .4
.8 lda #0
sta (ZPPtr2) set Array Ending 0
txa txa
ldy #S.PS.ARGC ldy #S.PS.ARGC

View File

@ -9,16 +9,12 @@ AUTO 6
.TF SYS/KERNEL .TF SYS/KERNEL
.INB INC/MACROS.I .INB INC/MACROS.I
.INB INC/KERNEL.I
.INB INC/A2OSX.I .INB INC/A2OSX.I
.INB INC/IO.I .INB INC/IO.I
.INB INC/PRODOS.I .INB INC/PRODOS.I
.INB INC/MLI.ERR.I .INB INC/MLI.ERR.I
ZPPtr1 .EQ ZPKERNEL
ZPPtr2 .EQ ZPKERNEL+2
ZPPtr3 .EQ ZPKERNEL+4
ZPPtr4 .EQ ZPKERNEL+6
.INB /A2OSX.SRC/SYS/KERNEL.S.INIT .INB /A2OSX.SRC/SYS/KERNEL.S.INIT
.INB /A2OSX.SRC/X.PRINTF.S .INB /A2OSX.SRC/X.PRINTF.S