mirror of
https://github.com/A2osX/A2osX.git
synced 2025-01-15 07:31:32 +00:00
Kernel version 0.9 : saved few bytes with MemMgr Optimization
This commit is contained in:
parent
915226f209
commit
e9062c4674
@ -4,16 +4,6 @@ LOMEM $A00
|
||||
INC 1
|
||||
AUTO 6
|
||||
*--------------------------------------
|
||||
PullPtr1Ptr2Ptr3
|
||||
sec
|
||||
.HS 90 bcc
|
||||
PullPtr1Ptr2 clc
|
||||
>PULLW ZPPtr1
|
||||
>PULLW ZPPtr2
|
||||
bcc .9
|
||||
>PULLW ZPPtr3
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
* Convert HEXBUF to ASCBUF decimal padded with 0
|
||||
*--------------------------------------
|
||||
HEX2DEC ldx #4
|
||||
|
@ -71,14 +71,14 @@ A2osX.PrtDrv.Cnt
|
||||
.HS 03030301030101010404
|
||||
*--------------------------------------
|
||||
DevMgr.NUL.Code .DA .1 STATUS
|
||||
.DA DevMgr.BADCALL READBLOCK
|
||||
.DA DevMgr.BADCALL WRITEBLOCK
|
||||
.DA DevMgr.BADCALL FORMAT
|
||||
.DA DevMgr.BADCALL CONTROL
|
||||
.DA DevMgr.BADCALL INIT
|
||||
.DA DevMgr.BADCALL OPEN
|
||||
.DA DevMgr.BADCALL CLOSE
|
||||
.DA DevMgr.BADCALL READ
|
||||
.DA A2osX.BADCALL READBLOCK
|
||||
.DA A2osX.BADCALL WRITEBLOCK
|
||||
.DA A2osX.BADCALL FORMAT
|
||||
.DA A2osX.BADCALL CONTROL
|
||||
.DA A2osX.BADCALL INIT
|
||||
.DA A2osX.BADCALL OPEN
|
||||
.DA A2osX.BADCALL CLOSE
|
||||
.DA A2osX.BADCALL READ
|
||||
.DA .8 WRITE
|
||||
.8 clc
|
||||
rts
|
||||
@ -95,13 +95,13 @@ DevMgr.NUL.Code .DA .1 STATUS
|
||||
.DA $0900
|
||||
*--------------------------------------
|
||||
DevMgr.SYS.Code .DA .1 STATUS
|
||||
.DA DevMgr.BADCALL READBLOCK
|
||||
.DA DevMgr.BADCALL WRITEBLOCK
|
||||
.DA DevMgr.BADCALL FORMAT
|
||||
.DA A2osX.BADCALL READBLOCK
|
||||
.DA A2osX.BADCALL WRITEBLOCK
|
||||
.DA A2osX.BADCALL FORMAT
|
||||
.DA DevMgr.SYS.Control
|
||||
.DA DevMgr.BADCALL INIT
|
||||
.DA A2osX.BADCALL INIT
|
||||
.DA DevMgr.SYS.Open
|
||||
.DA DevMgr.BADCALL CLOSE
|
||||
.DA A2osX.BADCALL CLOSE
|
||||
.DA DevMgr.SYS.Read
|
||||
.DA DevMgr.SYS.Write
|
||||
*--------------------------------------
|
||||
@ -341,10 +341,6 @@ DevMgr.SYS.TITLE >CSTR "A2osX System Screen"
|
||||
DevMgr.SYS.BASEL .HS 00.80.00.80.00.80.00.80.28.A8.28.A8.28.A8.28.A8.50.D0.50.D0.50.D0.50.D0
|
||||
DevMgr.SYS.BASEH .HS 08.08.09.09.0A.0A.0B.0B.08.08.09.09.0A.0A.0B.0B.08.08.09.09.0A.0A.0B.0B
|
||||
*--------------------------------------
|
||||
DevMgr.BADCALL lda #MLI.ERR.BADCALL
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
DevMgr.FreeMem .EQ *
|
||||
MAN
|
||||
SAVE /A2OSX.SRC/SYS/KERNEL.S.D01
|
||||
|
@ -117,9 +117,8 @@ K.MkNodYA jsr K.GetDevByNameYA Ptr1=NAME
|
||||
jsr pDevJmp
|
||||
bcs .9
|
||||
|
||||
>PUSHWI S.NODE.DEV
|
||||
>PUSHBI S.MEM.F.INIT0
|
||||
jsr K.GetMem
|
||||
>LDYAI S.NODE.DEV
|
||||
jsr K.GetMem0YA
|
||||
bcs .9
|
||||
|
||||
>STYA ZPPtr3 Ptr3=S.NODE
|
||||
@ -158,9 +157,8 @@ K.MkNodYA jsr K.GetDevByNameYA Ptr1=NAME
|
||||
* Y,A = pFILE
|
||||
*\--------------------------------------
|
||||
K.MkNodA sta .1+1
|
||||
>PUSHWI S.NODE.SSOCK
|
||||
>PUSHBI S.MEM.F.INIT0
|
||||
jsr K.GetMem
|
||||
>LDYAI S.NODE.SSOCK
|
||||
jsr K.GetMem0YA
|
||||
bcs .9
|
||||
|
||||
>STYA ZPPtr1
|
||||
@ -183,16 +181,14 @@ K.MkNodA sta .1+1
|
||||
* CC = OK, CS = ERROR
|
||||
* A = hFILE
|
||||
*\--------------------------------------
|
||||
K.MKFIFO >PUSHWI 256
|
||||
>PUSHBI 0
|
||||
jsr K.GetMem
|
||||
K.MKFIFO >LDYAI 256
|
||||
jsr K.GetMemYA
|
||||
bcs .99
|
||||
|
||||
stx .1+1 save FIFO buffer
|
||||
|
||||
>PUSHWI S.NODE.FIFO
|
||||
>PUSHBI S.MEM.F.INIT0
|
||||
jsr K.GetMem
|
||||
>LDYAI S.NODE.FIFO
|
||||
jsr K.GetMem0YA
|
||||
|
||||
bcs .9
|
||||
|
||||
|
@ -17,9 +17,8 @@ K.OpenDirYA jsr PFT.CheckPathYA
|
||||
>STYA ZPPtr2
|
||||
>STYA K.MLI.PARAMS+1 For GETFILEINFO,MLIOPEN
|
||||
|
||||
>PUSHWI S.NODE.DIR
|
||||
>PUSHBI S.MEM.F.INIT0
|
||||
jsr K.GetMem
|
||||
>LDYAI S.NODE.DIR
|
||||
jsr K.GetMem0YA
|
||||
bcs .99
|
||||
|
||||
>STYA ZPPtr1
|
||||
@ -216,9 +215,8 @@ K.ReadDirA.ROOT ldy #S.NODE.DIR.FC did we already returned something ?
|
||||
*--------------------------------------
|
||||
K.ReadDirA.DIR sta K.MLI.PARAMS+1 A=#S.DIR.PRODOS.REF
|
||||
|
||||
>PUSHWI 512 Get a 512 bytes buffer for reading dir...
|
||||
>PUSHBI 0
|
||||
jsr K.GetMem
|
||||
>LDYAI 512 Get a 512 bytes buffer for reading dir...
|
||||
jsr K.GetMemYA
|
||||
bcs .99
|
||||
stx K.ReadDirA.hMem
|
||||
|
||||
@ -427,9 +425,8 @@ K.ReadDirA.CLN pha
|
||||
rts
|
||||
*--------------------------------------
|
||||
K.ReadDirA.GetBuf
|
||||
>PUSHW K.ReadDirA.BufSize Get a BufSize bytes buffer for storing results
|
||||
>PUSHBI S.MEM.F.INIT0 make sure 0 filled
|
||||
jsr K.GetMem
|
||||
>LDYA K.ReadDirA.BufSize Get a BufSize bytes buffer for storing results
|
||||
jsr K.GetMem0YA make sure 0 filled
|
||||
bcs .9
|
||||
stx K.ReadDirA.hDIRENT
|
||||
>STYA ZPPtr4
|
||||
|
@ -56,9 +56,8 @@ K.FOpen jsr PFT.CheckPathSTK
|
||||
bcc K.FOpen.10
|
||||
K.FOpen.9 rts
|
||||
|
||||
K.FOpen.10 >PUSHWI S.NODE.REG
|
||||
>PUSHBI S.MEM.F.INIT0
|
||||
jsr K.GetMem
|
||||
K.FOpen.10 >LDYAI S.NODE.REG
|
||||
jsr K.GetMem0YA
|
||||
bcs K.FOpen.9
|
||||
|
||||
>STYA ZPPtr1
|
||||
|
@ -141,9 +141,8 @@ K.LoadFile lda (pStack) read PTR.LO on top of stack
|
||||
ora K.S.STAT+S.STAT.SIZE+2
|
||||
bne .11
|
||||
|
||||
>PUSHW K.S.STAT+S.STAT.SIZE push len
|
||||
>PUSHBI 0
|
||||
jsr K.GetMem
|
||||
>LDYA K.S.STAT+S.STAT.SIZE push len
|
||||
jsr K.GetMemYA
|
||||
bcs .10
|
||||
>STYA K.LoadFile.Mem
|
||||
stx K.LoadFile.hMem
|
||||
|
@ -29,7 +29,13 @@ AUTO 6
|
||||
*--------------------------------------
|
||||
jmp A2osX.MLICALL1
|
||||
*--------------------------------------
|
||||
.BS $BD10-*
|
||||
jmp * SPARE
|
||||
*--------------------------------------
|
||||
* BADCALL
|
||||
*--------------------------------------
|
||||
lda #MLI.ERR.BADCALL
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
jmp (pCode) pCodeJmp
|
||||
jmp (*) pLibJmp
|
||||
@ -42,12 +48,12 @@ GO.Reset jsr GO.A2osX
|
||||
*--------------------------------------
|
||||
* *** MUST BE REINTRANT ***
|
||||
*--------------------------------------
|
||||
A2osX.SYSCALL1 bit KERNEL.SYSCALL.FLAGS,x
|
||||
A2osX.SYSCALL1 bit K.SYSCALL.FLAGS,x
|
||||
bpl .8 in $E000, no BNK change
|
||||
|
||||
sta .7+1 save A (Func Arg)
|
||||
|
||||
lda KERNEL.SYSCALL.FLAGS+1,x Get Target BNK
|
||||
lda K.SYSCALL.FLAGS+1,x Get Target BNK
|
||||
|
||||
cmp $D000 #RRAMWRAMBNK1 or #RRAMWRAMBNK2
|
||||
beq .7 same as actual BNK...go restore A and JMP
|
||||
@ -71,7 +77,7 @@ A2osX.SYSCALL1 bit KERNEL.SYSCALL.FLAGS,x
|
||||
|
||||
.6 ldx #$FF Self Modified
|
||||
.7 lda #$FF Self Modified
|
||||
.8 jmp (KERNEL.SYSCALL,x)
|
||||
.8 jmp (K.SYSCALL.JMP,x)
|
||||
*--------------------------------------
|
||||
A2osX.LIBCALL1 pha No need to save X, K.GetMemPtrA will leave it unmodified
|
||||
tya Get LIB hMem in A
|
||||
@ -101,7 +107,7 @@ A2osX.MLICALL1 stx .1
|
||||
A2osX.DIIDrv .DA A2osX.DIIDrv.S status
|
||||
.DA A2osX.DIIDrv.RW Read
|
||||
.DA A2osX.DIIDrv.RW Write
|
||||
.DA A2osX.DRV.BadCall Format
|
||||
.DA A2osX.BadCall Format
|
||||
* .DA A2osX.DRV.BadCall
|
||||
* .DA A2osX.DRV.BadCall
|
||||
* .DA A2osX.DRV.BadCall
|
||||
@ -228,11 +234,6 @@ A2osX.Blk.GetCmdAndDevAX
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
A2osX.DRV.BadCall
|
||||
lda #MLI.ERR.BADCALL
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
GO.ProDOS pha
|
||||
lda $D000 We re coming from AUXLC, saving bank...
|
||||
sta GO.A2osX.BNK+1
|
||||
|
@ -4,13 +4,11 @@ LOMEM $A00
|
||||
INC 1
|
||||
AUTO 6
|
||||
*--------------------------------------
|
||||
* $D000-D0FF KERNEL.SYSCALL Jmp Table
|
||||
*--------------------------------------
|
||||
KERNEL.SYSCALL
|
||||
* $D000-D0FF K.SYSCALL.JMP Jmp Table
|
||||
*--------------------------------------
|
||||
* Bank 1
|
||||
*--------------------------------------
|
||||
.DA K.FileSearch $00
|
||||
K.SYSCALL.JMP .DA K.FileSearch $00
|
||||
.DA K.GetFullPathYA
|
||||
.DA K.LoadFile
|
||||
.DA K.SaveFile
|
||||
@ -100,17 +98,17 @@ KERNEL.SYSCALL
|
||||
.DA K.GetMemPtrA
|
||||
.DA K.GetMemByIDA
|
||||
.DA K.GetMemYA
|
||||
.DA K.LoadStkObjYA
|
||||
.DA K.GetStkObjA
|
||||
.DA K.FreeStkObjA
|
||||
.DA 0
|
||||
.DA 0
|
||||
.DA 0
|
||||
*--------------------------------------
|
||||
.DA K.SetLoMem $A0
|
||||
.DA K.GetMemStatYA
|
||||
.DA 0
|
||||
.DA 0
|
||||
.DA 0
|
||||
.DA 0
|
||||
.DA 0
|
||||
.DA K.LoadStkObjYA
|
||||
.DA K.GetStkObjA
|
||||
.DA K.FreeStkObjA
|
||||
.DA 0
|
||||
*--------------------------------------
|
||||
.DA K.FPutCAY $B0
|
||||
@ -125,9 +123,7 @@ KERNEL.SYSCALL
|
||||
* LO Byte :
|
||||
* #RRAMWRAMBNK1 or #RRAMWRAMBNK2
|
||||
*--------------------------------------
|
||||
KERNEL.SYSCALL.FLAGS
|
||||
*--------------------------------------
|
||||
.DA #$80 $00
|
||||
K.SYSCALL.FLAGS .DA #$80 $00
|
||||
.DA #RRAMWRAMBNK1
|
||||
.DA #$80
|
||||
.DA #RRAMWRAMBNK1
|
||||
@ -345,6 +341,16 @@ KERNEL.SYSCALL.FLAGS
|
||||
.DA 0
|
||||
.DA 0
|
||||
*--------------------------------------
|
||||
PullPtr1Ptr2Ptr3
|
||||
sec
|
||||
.HS 90 bcc
|
||||
PullPtr1Ptr2 clc
|
||||
>PULLW ZPPtr1
|
||||
>PULLW ZPPtr2
|
||||
bcc .9
|
||||
>PULLW ZPPtr3
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE /A2OSX.SRC/SYS/KERNEL.S.JMP
|
||||
LOAD /A2OSX.SRC/SYS/KERNEL.S
|
||||
|
@ -73,6 +73,10 @@ K.GetMem >PULLB MemMgr.ReqFlags store requested flags
|
||||
* CS :
|
||||
* A = EC
|
||||
*\--------------------------------------
|
||||
K.GetMem0YA ldx #S.MEM.F.INIT0
|
||||
stx MemMgr.ReqFlags
|
||||
.HS 2C bit abs
|
||||
|
||||
K.GetMemYA stz MemMgr.ReqFlags
|
||||
sta MemMgr.ReqSize+1
|
||||
tya
|
||||
|
@ -260,10 +260,10 @@ PS.Init >LDYA K.CreateProcess.CmdLine
|
||||
|
||||
beq .2 DS.SIZE=0...
|
||||
|
||||
lda (ZPPtr4),y
|
||||
>PUSHAX Push DS.SIZE
|
||||
>PUSHBI S.MEM.F.INIT0 Clear DS
|
||||
jsr K.GetMem
|
||||
lda (ZPPtr4),y
|
||||
tay
|
||||
txa Y,A = DS.SIZE
|
||||
jsr K.GetMem0YA
|
||||
bcs .9
|
||||
|
||||
txa
|
||||
@ -348,9 +348,8 @@ PS.Select ldy #S.PS.hCS
|
||||
*--------------------------------------
|
||||
PS.DupEnvA jsr K.GetMemPtrA
|
||||
>STYA ZPPtr1
|
||||
>PUSHWI K.ENV.SIZE
|
||||
>PUSHBI 0
|
||||
jsr K.GetMem
|
||||
>LDYAI K.ENV.SIZE
|
||||
jsr K.GetMemYA
|
||||
bcs .9
|
||||
>STYA ZPPtr2
|
||||
|
||||
|
@ -20,9 +20,7 @@ K.NewPStrYA >STYA ZPPtr2
|
||||
inc
|
||||
tay
|
||||
lda #0 Y,A = len of new string
|
||||
>PUSHYA
|
||||
>PUSHBI 0 0 = no option
|
||||
jsr K.GetMem
|
||||
jsr K.GetMemYA
|
||||
bcs .9
|
||||
|
||||
>STYA ZPPtr1
|
||||
@ -466,14 +464,12 @@ K.PStrFTime.DEC .BS 1 always < 100
|
||||
K.PStr2StrArrayYA
|
||||
>STYA ZPPtr1
|
||||
lda (ZPPtr1) Get mem size STRLEN+1
|
||||
ldx #0
|
||||
inc
|
||||
bne .1
|
||||
inx
|
||||
tay
|
||||
|
||||
.1 >PUSHAX
|
||||
>PUSHBI 0
|
||||
jsr K.GetMem
|
||||
lda #0
|
||||
|
||||
jsr K.GetMemYA
|
||||
bcs .9
|
||||
phx save hMem
|
||||
phy save PTR.LO
|
||||
|
@ -196,12 +196,13 @@ K.CTime2Time jsr PullPtr1Ptr2
|
||||
bcc .3 end of DIV/MOD ?
|
||||
|
||||
sta K.CTime.DWORD+3
|
||||
pla
|
||||
sta K.CTime.DWORD+2
|
||||
pla
|
||||
sta K.CTime.DWORD+1
|
||||
pla
|
||||
sta K.CTime.DWORD
|
||||
|
||||
ldx #2
|
||||
|
||||
.21 pla
|
||||
sta K.CTime.DWORD,x
|
||||
dex
|
||||
bpl .21
|
||||
|
||||
inc K.CTime.DivDay
|
||||
bne .2
|
||||
|
@ -52,6 +52,7 @@ A2osX.D1 .PH $D000
|
||||
.INB /A2OSX.SRC/SYS/KERNEL.S.FILE
|
||||
.INB /A2OSX.SRC/SYS/KERNEL.S.DIR
|
||||
|
||||
.INB /A2OSX.SRC/SYS/KERNEL.S.PFT
|
||||
.INB /A2OSX.SRC/SYS/KERNEL.S.BIN
|
||||
.EP
|
||||
A2osX.D1.E .EQ *
|
||||
@ -65,6 +66,7 @@ A2osX.D2 .PH $D000
|
||||
.INB /A2OSX.SRC/SYS/KERNEL.S.ARG
|
||||
.INB /A2OSX.SRC/SYS/KERNEL.S.ENV
|
||||
|
||||
.INB /A2OSX.SRC/SYS/KERNEL.S.CNV
|
||||
.INB /A2OSX.SRC/SYS/KERNEL.S.RUN
|
||||
.INB /A2OSX.SRC/SYS/KERNEL.S.EVT
|
||||
.INB /A2OSX.SRC/SYS/KERNEL.S.TSK
|
||||
@ -76,8 +78,6 @@ A2osX.E0 .PH $E000
|
||||
.INB /A2OSX.SRC/SYS/KERNEL.S.DAT
|
||||
.INB /A2OSX.SRC/SYS/KERNEL.S.IRQ
|
||||
.INB /A2OSX.SRC/SYS/KERNEL.S.MEM
|
||||
.INB /A2OSX.SRC/SYS/KERNEL.S.PFT
|
||||
.INB /A2OSX.SRC/SYS/KERNEL.S.CNV
|
||||
.INB /A2OSX.SRC/SYS/KERNEL.S.CHR
|
||||
.INB /A2OSX.SRC/SYS/KERNEL.S.D01
|
||||
.EP
|
||||
|
Loading…
x
Reference in New Issue
Block a user