mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-25 20:33:13 +00:00
Kernel 0.9.1 : Code reorganization & move to CSTR (SHELL, History, bugfix)
This commit is contained in:
parent
e85146e6cc
commit
3e3aa41e87
Binary file not shown.
Binary file not shown.
@ -101,11 +101,10 @@ J.CTRL .DA Ctrl.Invalid
|
||||
.DA 0
|
||||
*--------------------------------------
|
||||
CS.INIT lda #$ff
|
||||
ldy #bSaved
|
||||
sta (pData),y
|
||||
>STA.G bSaved
|
||||
|
||||
>SYSCALL GetArgC
|
||||
cmp #1
|
||||
ldy #S.PS.ARGC
|
||||
lda (pPs),y
|
||||
beq .1 No arg, new file....
|
||||
|
||||
lda #1
|
||||
|
12
BIN/LS.S.txt
12
BIN/LS.S.txt
@ -352,8 +352,7 @@ CS.RUN.PUSHDATES
|
||||
lda (ZPFileStat),y
|
||||
beq .1 Month=0.....invalid date/time
|
||||
|
||||
>LEA.G TIME.Mod
|
||||
>PUSHYA
|
||||
>PUSHEA.G TIME.Mod
|
||||
>PUSHW L.FMT.DateTime
|
||||
lda ZPFileStat
|
||||
clc
|
||||
@ -368,8 +367,7 @@ CS.RUN.PUSHDATES
|
||||
lda (ZPFileStat),y
|
||||
beq .2 Month=0.....invalid date/time
|
||||
|
||||
>LEA.G TIME.Create
|
||||
>PUSHYA
|
||||
>PUSHEA.G TIME.Create
|
||||
>PUSHW L.FMT.DateTime
|
||||
lda ZPFileStat
|
||||
clc
|
||||
@ -380,10 +378,8 @@ CS.RUN.PUSHDATES
|
||||
>PUSHYA
|
||||
>SYSCALL StrFTime
|
||||
|
||||
.2 >LEA.G TIME.Mod
|
||||
>PUSHYA
|
||||
>LEA.G TIME.Create
|
||||
>PUSHYA
|
||||
.2 >PUSHEA.G TIME.Mod
|
||||
>PUSHEA.G TIME.Create
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.RUN.UpdateColCnt
|
||||
|
@ -123,8 +123,7 @@ DumpHeader ldy #S.DEV.DRV.JMP+1
|
||||
dex
|
||||
bpl .1
|
||||
|
||||
>LEA.G DEV.SFLAGS
|
||||
>PUSHYA
|
||||
>PUSHEA.G DEV.SFLAGS
|
||||
|
||||
>LDA.G DEV.ID
|
||||
>PUSHA
|
||||
@ -148,8 +147,7 @@ DumpStatus >LDA.G DEV.S
|
||||
lda (ZPPTR2),y
|
||||
>STA.G DEV.SIZE+2
|
||||
|
||||
>LEA.G DEV.SIZE
|
||||
>PUSHYA
|
||||
>PUSHEA.G DEV.SIZE
|
||||
|
||||
.1 ldy #S.DEVSTAT.VERSION+1
|
||||
>PUSHB (ZPPTR2),y
|
||||
|
@ -45,7 +45,7 @@ L.MSG2 .DA MSG2
|
||||
L.MSG3 .DA MSG3
|
||||
L.MSG4 .DA MSG4
|
||||
L.MSG5 .DA MSG5
|
||||
L.MSG6 .DA MSG6
|
||||
L.MSG.FREE .DA MSG.FREE
|
||||
.DA 0
|
||||
*--------------------------------------
|
||||
CS.INIT ldy #MEM.COUNT Skip SLOT0
|
||||
@ -53,6 +53,9 @@ CS.INIT ldy #MEM.COUNT Skip SLOT0
|
||||
inc
|
||||
sta (pData),y
|
||||
|
||||
>LEA.G MemStat
|
||||
>SYSCALL GetMemStat.YA
|
||||
|
||||
lda (pPs)
|
||||
ora #S.PS.F.EVENT Now accept events
|
||||
sta (pPs)
|
||||
@ -82,9 +85,8 @@ CS.RUN >SYSCALL GetChar
|
||||
lda (pData),y
|
||||
bne .8
|
||||
|
||||
ldy #MEM.COUNT
|
||||
lda (pData),y
|
||||
cmp MemMgr.LastSlot
|
||||
>LDA.G MEM.COUNT
|
||||
>CMP.G MemStat+S.MEMSTAT.MLastSlot
|
||||
beq .10
|
||||
|
||||
ldy #LINE.COUNT
|
||||
@ -144,27 +146,31 @@ CS.RUN >SYSCALL GetChar
|
||||
>LDYA L.MSG2
|
||||
>SYSCALL PrintF.YA
|
||||
|
||||
>PUSHW MemMgr.HiMem
|
||||
>LDYA.G MemStat+S.MEMSTAT.MH
|
||||
>PUSHYA
|
||||
>LDYA L.MSG3
|
||||
>SYSCALL PrintF.YA
|
||||
|
||||
>PUSHW MemMgr.Free
|
||||
>LDYA.G MemStat+S.MEMSTAT.MF
|
||||
>PUSHYA
|
||||
>LDYA L.MSG4
|
||||
>SYSCALL PrintF.YA
|
||||
|
||||
>PUSHW MemMgr.LoMem
|
||||
>LDYA.G MemStat+S.MEMSTAT.ML
|
||||
>PUSHYA
|
||||
>LDYA L.MSG5
|
||||
>SYSCALL PrintF.YA
|
||||
|
||||
lda MemMgr.Free
|
||||
sec
|
||||
sbc MemMgr.LoMem
|
||||
tay
|
||||
lda MemMgr.Free+1
|
||||
sbc MemMgr.LoMem+1
|
||||
>LDA.G MemStat+S.MEMSTAT.MF
|
||||
>SBC.G MemStat+S.MEMSTAT.ML
|
||||
pha
|
||||
>LDA.G MemStat+S.MEMSTAT.MF+1
|
||||
>SBC.G MemStat+S.MEMSTAT.ML+1
|
||||
ply
|
||||
|
||||
>PUSHYA
|
||||
>LDYA L.MSG6
|
||||
>LDYA L.MSG.FREE
|
||||
>SYSCALL PrintF.YA
|
||||
sec
|
||||
rts
|
||||
@ -281,7 +287,7 @@ MSG2 >CSTR "\r\nAllocated hMem:%d, Total:%d\r\n"
|
||||
MSG3 >CSTR "High Memory: $%H\r\n"
|
||||
MSG4 >CSTR "Free ULimit: $%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
|
||||
.OR 0
|
||||
@ -290,6 +296,7 @@ LINE.COUNT .BS 1
|
||||
MEM.COUNT .BS 1
|
||||
USED.COUNT .BS 1
|
||||
bSTOP .BS 1
|
||||
MemStat .BS S.MEMSTAT
|
||||
DS.END
|
||||
.ED
|
||||
*--------------------------------------
|
||||
|
@ -27,8 +27,7 @@ InitSrcDirYA >SYSCALL GetFullPath.YA
|
||||
lda (ZPPtr1),y
|
||||
beq .5 we have '/'
|
||||
|
||||
>LEA.G STAT
|
||||
>PUSHYA
|
||||
>PUSHEA.G STAT
|
||||
>PUSHW ZPPtr1
|
||||
>SYSCALL Stat
|
||||
bcs .1 File/DIR does not exists, go extract pattern
|
||||
@ -143,8 +142,7 @@ InitDstDirYA >SYSCALL GetFullPath.YA
|
||||
stx .90+1
|
||||
>STYA ZPPtr1
|
||||
|
||||
>LEA.G STAT
|
||||
>PUSHYA
|
||||
>PUSHEA.G STAT
|
||||
>PUSHW ZPPtr1
|
||||
>SYSCALL Stat
|
||||
bcs .1 File/DIR does not exists, go extract DstFileName
|
||||
|
@ -83,7 +83,7 @@ Dev.Detect >STYA Args
|
||||
>STYA ZPTmpPTR
|
||||
jsr DecodeMac
|
||||
bcc .4
|
||||
lda #DEVMGR.ERRICL
|
||||
lda #SYSMGR.ERRSYN
|
||||
sec
|
||||
rts
|
||||
|
||||
|
@ -119,7 +119,7 @@ Dev.Detect >STYA Args
|
||||
|
||||
.4 jsr DecodeMac
|
||||
bcc .8
|
||||
lda #DEVMGR.ERRICL
|
||||
lda #SYSMGR.ERRSYN
|
||||
sec
|
||||
rts
|
||||
|
||||
|
@ -113,7 +113,7 @@ Dev.Detect >STYA ARGS
|
||||
|
||||
.4 jsr DecodeMac
|
||||
bcc .8
|
||||
lda #DEVMGR.ERRICL
|
||||
lda #SYSMGR.ERRSYN
|
||||
sec
|
||||
rts
|
||||
|
||||
|
@ -118,7 +118,7 @@ Dev.Detect >STYA Args
|
||||
|
||||
.4 jsr DecodeMac
|
||||
bcc .8
|
||||
lda #DEVMGR.ERRICL
|
||||
lda #SYSMGR.ERRSYN
|
||||
sec
|
||||
rts
|
||||
|
||||
|
@ -5,20 +5,6 @@ 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
|
||||
*--------------------------------------
|
||||
ZPMEMMGR .EQ $8
|
||||
*--------------------------------------
|
||||
pDrv .EQ $10
|
||||
pDev .EQ $12
|
||||
pEvent .EQ $14
|
||||
@ -36,63 +22,6 @@ ZPBIN .EQ $20
|
||||
ZPDRV .EQ $30
|
||||
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
|
||||
* $BD00->$BD0F : Public Vetors
|
||||
*--------------------------------------
|
||||
@ -304,10 +233,6 @@ SYS.Sleep .EQ $E0
|
||||
MEMMGR.ERROOM .EQ $FF Out Of Memory 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.ERRNSP .EQ $DD No Such Process Error
|
||||
*--------------------------------------
|
||||
@ -336,14 +261,17 @@ S.MEM .EQ 8
|
||||
S.MEMSTAT.ML .EQ 0
|
||||
S.MEMSTAT.MF .EQ 2
|
||||
S.MEMSTAT.MH .EQ 4
|
||||
S.MEMSTAT.MLastSlot .EQ 6
|
||||
*
|
||||
S.MEMSTAT.XL .EQ 8
|
||||
S.MEMSTAT.XF .EQ 10
|
||||
S.MEMSTAT.XH .EQ 12
|
||||
S.MEMSTAT.XLastSlot .EQ 14
|
||||
*
|
||||
S.MEMSTAT.DL .EQ 16
|
||||
S.MEMSTAT.DF .EQ 18
|
||||
S.MEMSTAT.DH .EQ 20
|
||||
S.MEMSTAT.DCount .EQ 22
|
||||
*
|
||||
S.MEMSTAT .EQ 24
|
||||
*--------------------------------------
|
||||
|
87
INC/KERNEL.I.txt
Normal file
87
INC/KERNEL.I.txt
Normal 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
|
@ -116,13 +116,28 @@ AUTO 6
|
||||
* Global DATA Segment Access
|
||||
*--------------------------------------
|
||||
.MA LEA.G
|
||||
lda #]1
|
||||
clc
|
||||
adc pData
|
||||
lda pData
|
||||
adc #]1
|
||||
tay
|
||||
lda pData+1
|
||||
adc /]1
|
||||
.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
|
||||
ldy #]1
|
||||
@ -138,6 +153,25 @@ AUTO 6
|
||||
ldy #]1
|
||||
cmp (pData),y
|
||||
.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
|
||||
ldy #]1
|
||||
|
@ -311,27 +311,27 @@ SKT.AcceptA jsr SKT.GetA.I
|
||||
*\--------------------------------------
|
||||
SKT.MkNodA sta NODE.SSOCK+S.NODE.SSOCK.HSKT
|
||||
|
||||
>SYSCALL MkNodA
|
||||
>SYSCALL MkNod.A
|
||||
|
||||
|
||||
|
||||
K.MkNod.A sta .1+1
|
||||
>LDYAI S.NODE.SSOCK
|
||||
jsr K.GetMem0.YA
|
||||
>SYSCALL GetMem0.YA
|
||||
bcs .9
|
||||
|
||||
>STYA ZPPtr1
|
||||
>STYA ZPTmpPtr1
|
||||
|
||||
ldy #S.NODE.T
|
||||
lda #S.NODE.T.SSOCK
|
||||
sta (ZPPtr1),y
|
||||
sta (ZPTmpPtr1),y
|
||||
|
||||
ldy #S.NODE.SSOCK.HSKT
|
||||
.1 lda #$ff
|
||||
|
||||
sta (ZPPtr1),y
|
||||
>LDYA ZPPtr1
|
||||
.9 rts
|
||||
sta (ZPTmpPtr1),y
|
||||
>LDYA ZPTmpPtr1
|
||||
rts
|
||||
|
||||
|
||||
|
||||
@ -342,10 +342,10 @@ K.MkNod.A sta .1+1
|
||||
|
||||
ldy #S.NODE.SSOCK-1
|
||||
|
||||
.1 lda NODE.SSOCK,y
|
||||
.2 lda NODE.SSOCK,y
|
||||
sta (ZPTmpPtr1),y
|
||||
dey
|
||||
bpl .1
|
||||
bpl .2
|
||||
txa
|
||||
* clc
|
||||
|
||||
|
@ -295,8 +295,8 @@ NODE.SSOCK .BS 1 S.NODE.HANDLER
|
||||
.BS 1 S.NODE.SSOCK.HSKT
|
||||
.DA #0 S.NODE.SSOCK.OPEN
|
||||
.DA #0 S.NODE.SSOCK.CLOSE
|
||||
.DA LIBTCPIP.SKT.GetC.A
|
||||
.DA LIBTCPIP.SKT.PutC
|
||||
.DA LIBTCPIP.SKT.GetChar.A
|
||||
.DA LIBTCPIP.SKT.PutChar
|
||||
.DA #0 S.NODE.SSOCK.STATUS
|
||||
*--------------------------------------
|
||||
MAN
|
||||
|
@ -178,8 +178,7 @@ CS.RUN.ToggleSlotA
|
||||
sta (ZPTmp1),y
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.RUN.Load >LEA.G StatBuf
|
||||
>PUSHYA
|
||||
CS.RUN.Load >PUSHEA.G StatBuf
|
||||
>LDA.G hFileName
|
||||
>SYSCALL GetMemPtr.A
|
||||
>PUSHYA
|
||||
|
@ -83,7 +83,6 @@ Cmd.Exec lda #0
|
||||
|
||||
txa
|
||||
>STA.G CMD.hCmdLine
|
||||
|
||||
>LDYA L.INTCMDS
|
||||
>STYA ZPPtr2
|
||||
|
||||
@ -154,8 +153,7 @@ Cmd.Exec.EXT jsr Cmd.Exec.Split
|
||||
cmp #'/' Command line is already full path, no search
|
||||
bne .1
|
||||
|
||||
>LEA.G CMD.Stat
|
||||
>PUSHYA
|
||||
>PUSHEA.G CMD.Stat
|
||||
>PUSHW ZPPtr1
|
||||
>SYSCALL STAT
|
||||
bcs Cmd.Exec.Done
|
||||
@ -241,8 +239,7 @@ Cmd.Exec.EXT.Search
|
||||
>PUSHYA push search list
|
||||
>PUSHW ZPPtr1 push CMD
|
||||
>PUSHW ZPCMDBuf push dest full path
|
||||
>LEA.G CMD.Stat
|
||||
>PUSHYA
|
||||
>PUSHEA.G CMD.Stat
|
||||
>SYSCALL FileSearch
|
||||
rts
|
||||
*--------------------------------------
|
||||
@ -356,8 +353,7 @@ Cmd.Exec.CD1 lda (ZPPTR2) Get ARG
|
||||
lda #'!'
|
||||
>SYSCALL PutChar.A
|
||||
|
||||
>LEA.G CMD.Stat
|
||||
>PUSHYA
|
||||
>PUSHEA.G CMD.Stat
|
||||
>PUSHW ZPCMDBuf
|
||||
>SYSCALL STAT
|
||||
bcs .9
|
||||
@ -509,8 +505,7 @@ Cmd.Exec.TIME clc
|
||||
bra .2
|
||||
.1 >PUSHW L.FMT.TIME
|
||||
|
||||
.2 >LEA.G CMD.Time
|
||||
>PUSHYA
|
||||
.2 >PUSHEA.G CMD.Time
|
||||
>SYSCALL StrFTime
|
||||
|
||||
>LDYAI ZPCMDBuf
|
||||
@ -621,8 +616,7 @@ Cmd.Exec.READ lda (ZPPtr2)
|
||||
Cmd.Exec.SLEEP lda (ZPPtr2)
|
||||
beq .9
|
||||
|
||||
>LEA.G Sleep
|
||||
>PUSHYA
|
||||
>PUSHEA.G Sleep
|
||||
>PUSHW ZPPtr2
|
||||
>SYSCALL AToI.YA
|
||||
|
||||
|
@ -5,7 +5,7 @@ INC 1
|
||||
AUTO 6
|
||||
.LIST OFF
|
||||
*--------------------------------------
|
||||
HIS.Init >LDYAI 256 Get a buffer for History
|
||||
HIS.Init >LDYAI History.MAX Get a buffer for History
|
||||
>SYSCALL GetMem0.YA
|
||||
bcs .9
|
||||
|
||||
@ -13,8 +13,8 @@ HIS.Init >LDYAI 256 Get a buffer for History
|
||||
>STA.G HIS.hBuf
|
||||
|
||||
lda #0
|
||||
>STA.G HIS.BufIndex
|
||||
>STA.G HIS.BufEnd
|
||||
>STA.G HIS.Count
|
||||
>STA.G HIS.Index
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
HIS.Add >LDA.G HIS.hBuf
|
||||
@ -23,14 +23,25 @@ HIS.Add >LDA.G HIS.hBuf
|
||||
>SYSCALL GetMemPtr.A
|
||||
>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
|
||||
bcc .2 enough room
|
||||
|
||||
lda (ZPPTR1) get len of oldest string
|
||||
sec
|
||||
>DEC.G HIS.Count we must remove oldest
|
||||
|
||||
ldy #$ff
|
||||
|
||||
.12 iny
|
||||
lda (ZPPTR1),y get len of oldest string
|
||||
bne .12
|
||||
|
||||
tya
|
||||
* sec
|
||||
adc ZPPTR1
|
||||
sta ZPPTR2
|
||||
lda ZPPTR1+1
|
||||
@ -40,122 +51,117 @@ HIS.Add >LDA.G HIS.hBuf
|
||||
ldy #$FF
|
||||
|
||||
.1 iny
|
||||
lda (ZPPTR2),y move back until ending 0 found
|
||||
lda (ZPPTR2),y move back until String ending 0 found
|
||||
sta (ZPPTR1),y
|
||||
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
|
||||
lda (ZPPTR2),y move back until Array ending 0 found
|
||||
sta (ZPPTR1),y
|
||||
iny
|
||||
bra .4
|
||||
bne .1
|
||||
|
||||
bra .10 retry....
|
||||
|
||||
.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
|
||||
|
||||
.5 tya
|
||||
sta (ZPPTR1)
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
HIS.GetPrev >LDA.G HIS.hBuf
|
||||
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
|
||||
>STYA ZPPTR1
|
||||
|
||||
lda #0
|
||||
>LDA.G HIS.Count
|
||||
beq HISTORY.RTS empty history,nothing to do
|
||||
|
||||
.1 tax
|
||||
tay
|
||||
sec
|
||||
adc (ZPPTR1),y
|
||||
bcs History.RTS out of buffer
|
||||
>LDA.G HIS.Index
|
||||
bne .1
|
||||
|
||||
ldy #HIS.BufIndex
|
||||
cmp (pData),y
|
||||
bne .1 reached current index
|
||||
>LDA.G HIS.Count
|
||||
|
||||
.1 dec
|
||||
>STA.G HIS.Index
|
||||
|
||||
jsr HIS.GetA
|
||||
|
||||
.2 txa
|
||||
>STA.G HIS.BufIndex set new index
|
||||
bra HIS.SetBuf
|
||||
History.RTS rts
|
||||
*--------------------------------------
|
||||
HIS.GetNext >LDA.G HIS.hBuf
|
||||
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
|
||||
>STYA ZPPTR1
|
||||
|
||||
>LDA.G HIS.BufIndex
|
||||
tay
|
||||
sec
|
||||
adc (ZPPTR1),y add length+1 of current line in history
|
||||
>STA.G HIS.BufIndex
|
||||
>LDA.G HIS.Count
|
||||
beq HISTORY.RTS empty history,nothing to do
|
||||
|
||||
>LDA.G HIS.Index
|
||||
inc
|
||||
>CMP.G HIS.Count
|
||||
bne .1
|
||||
lda #0
|
||||
|
||||
.1 >STA.G HIS.Index
|
||||
|
||||
jsr HIS.GetA
|
||||
|
||||
>CMP.G HIS.BufEnd
|
||||
bne HIS.SetBuf
|
||||
jmp CmdLine.CLR end of history, just blank buffer
|
||||
*--------------------------------------
|
||||
HIS.GetA tax
|
||||
beq .8
|
||||
|
||||
ldy #0
|
||||
lda (ZPPTR1),y
|
||||
beq .9
|
||||
|
||||
.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
|
||||
|
||||
>LDA.G HIS.BufIndex
|
||||
tay keep length of string
|
||||
|
||||
clc
|
||||
adc ZPPTR1
|
||||
sta ZPPTR1
|
||||
bcc .1
|
||||
inc ZPPTR1+1
|
||||
ldy #$ff
|
||||
|
||||
.1 lda (ZPPTR1),y
|
||||
sta (ZPCMDBuf),y
|
||||
dey
|
||||
bpl .1
|
||||
bne .1
|
||||
|
||||
jmp CmdLine.PRINT
|
||||
*--------------------------------------
|
||||
HIS.Quit >LDA.G HIS.hBuf
|
||||
|
@ -23,6 +23,7 @@ ZPCSHStack .EQ ZPBIN+14
|
||||
*--------------------------------------
|
||||
CmdLine.MAX .EQ 255
|
||||
VarLen.MAX .EQ 15
|
||||
History.MAX .EQ 256
|
||||
|
||||
CSH.Stack.MAX .EQ 15
|
||||
CSH.Name.MAX .EQ 15
|
||||
@ -583,8 +584,8 @@ CMD.Stat .BS S.STAT
|
||||
CMD.Time .BS S.TIME
|
||||
|
||||
HIS.hBuf .BS 1
|
||||
HIS.BufIndex .BS 1
|
||||
HIS.BufEnd .BS 1
|
||||
HIS.Count .BS 1
|
||||
HIS.Index .BS 1
|
||||
|
||||
IO.hIn .BS 1
|
||||
IO.hOut .BS 1
|
||||
|
@ -12,49 +12,42 @@ AUTO 6
|
||||
* Y,A = CStr To Arg[A]
|
||||
* CS : Out Of Bound
|
||||
*\--------------------------------------
|
||||
K.GetArg.A sta .2+1
|
||||
jsr ARG.InitArgPtr1
|
||||
K.GetArg.A pha save requested arg#
|
||||
|
||||
lda .2+1
|
||||
beq .8
|
||||
ldy #S.PS.hARGS
|
||||
lda (pPs),y
|
||||
jsr K.GetMemPtr.A
|
||||
|
||||
ldx #0
|
||||
plx we want 0 ?
|
||||
|
||||
.1 lda (ZPPtr1)
|
||||
beq .9
|
||||
beq .80 yes, returns MemPtr
|
||||
|
||||
.2 cpx #$ff Self Modified
|
||||
beq .8
|
||||
>STYA ZPPtr1 no, save it
|
||||
|
||||
jsr ARG.NextArgPtr1
|
||||
inx
|
||||
bra .1
|
||||
.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
|
||||
|
||||
.8 >LDYA ZPPtr1
|
||||
clc
|
||||
.80 clc
|
||||
rts
|
||||
|
||||
.9 sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
ARG.InitArgPtr1 ldy #S.PS.hARGS
|
||||
lda (pPs),y
|
||||
jsr K.GetMemPtr.A
|
||||
>STYA ZPPtr1
|
||||
rts
|
||||
*--------------------------------------
|
||||
ARG.NextArgPtr1 inc ZPPtr1
|
||||
bne .1
|
||||
inc ZPPtr1+1
|
||||
|
||||
.1 lda (ZPPtr1)
|
||||
bne ARG.NextArgPtr1
|
||||
|
||||
inc ZPPtr1
|
||||
bne .8
|
||||
inc ZPPtr1+1
|
||||
.8 rts
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE /A2OSX.SRC/SYS/KERNEL.S.ARG
|
||||
LOAD /A2OSX.SRC/SYS/KERNEL.S
|
||||
|
@ -388,11 +388,11 @@ BIN.InstallDRV ldy #H.BIN.DRV.CODE.O
|
||||
cmp #K.DEV.MAX
|
||||
bne .10 No Device Handle Left
|
||||
|
||||
lda #DEVMGR.ERROOH
|
||||
lda #MEMMGR.ERROOH
|
||||
sec
|
||||
rts
|
||||
|
||||
.9 lda #DEVMGR.ERROOM
|
||||
.9 lda #MEMMGR.ERROOM
|
||||
sec
|
||||
rts
|
||||
|
||||
|
@ -357,9 +357,9 @@ ENV.ExpandSysVar
|
||||
cmp #'9'+1
|
||||
bcs .1
|
||||
and #$0F
|
||||
>DEBUG
|
||||
|
||||
jsr K.GetArg.A
|
||||
bcs .99
|
||||
bcs .8 Arg# is undefined, do not append anything
|
||||
|
||||
>STYA ZPPtr3
|
||||
jmp ENV.AppendPtr3ToBuf
|
||||
|
@ -692,7 +692,7 @@ DevMgrInit.AddDev
|
||||
clc
|
||||
rts
|
||||
|
||||
.9 lda #DEVMGR.ERROOH
|
||||
.9 lda #MEMMGR.ERROOH
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
|
@ -173,9 +173,6 @@ PS.CreateChild ldx #0
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
PS.CmdLine2Args >STYA ZPPtr1
|
||||
>SYSCALL PrintF.YA
|
||||
lda #']'
|
||||
>SYSCALL PutChar.A
|
||||
|
||||
ldy #0
|
||||
|
||||
@ -207,39 +204,43 @@ PS.CmdLine2Args >STYA ZPPtr1
|
||||
|
||||
stz PS.CmdLine2Args.bInQuote
|
||||
|
||||
ldy #0
|
||||
ldy #$ff
|
||||
ldx #0 Arg Count
|
||||
|
||||
.4 lda (ZPPtr1),y
|
||||
beq .8
|
||||
.4 iny
|
||||
lda (ZPPtr1),y
|
||||
beq .7
|
||||
|
||||
cmp #'"' found a quote ?
|
||||
bne .5
|
||||
lda PS.CmdLine2Args.bInQuote
|
||||
eor #$ff
|
||||
sta PS.CmdLine2Args.bInQuote
|
||||
bra .71
|
||||
bra .4
|
||||
|
||||
.5 cmp #' '
|
||||
bne .70
|
||||
bne .6
|
||||
|
||||
bit PS.CmdLine2Args.bInQuote
|
||||
bmi .70
|
||||
bmi .6
|
||||
|
||||
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
|
||||
bne .72
|
||||
inc ZPPtr2
|
||||
bne .4
|
||||
inc ZPPtr2+1
|
||||
bra .4
|
||||
|
||||
.7 sta (ZPPtr2) set Arg Ending 0
|
||||
|
||||
inc ZPPtr2
|
||||
bne .8
|
||||
inc ZPPtr2+1
|
||||
|
||||
.72 iny
|
||||
bne .4
|
||||
|
||||
.8 lda #0
|
||||
sta (ZPPtr2) set Array Ending 0
|
||||
.8 sta (ZPPtr2) set Array Ending 0
|
||||
|
||||
txa
|
||||
ldy #S.PS.ARGC
|
||||
|
@ -9,16 +9,12 @@ AUTO 6
|
||||
.TF SYS/KERNEL
|
||||
|
||||
.INB INC/MACROS.I
|
||||
.INB INC/KERNEL.I
|
||||
.INB INC/A2OSX.I
|
||||
.INB INC/IO.I
|
||||
.INB INC/PRODOS.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/X.PRINTF.S
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user