Kernel 0.9.1 : Code reorganization & move to CSTR (MemMgr)

This commit is contained in:
Rémy GIBERT 2017-09-18 17:43:00 +02:00
parent 0bb04a48a0
commit ad0eacec75
7 changed files with 89 additions and 98 deletions

Binary file not shown.

Binary file not shown.

View File

@ -58,7 +58,7 @@ CS.INIT ldy #MEM.COUNT Skip SLOT0
clc
rts
*--------------------------------------
CS.RUN >SYSCALL GetC
CS.RUN >SYSCALL GetChar
bcs .13
cmp #3 Ctrl-C ?
@ -273,8 +273,8 @@ CS.QUIT clc
CS.END
MSG0 >CSTR " # Flags PID REF PTR LEN BINPATH/DATA\r\n"
MSG1 >CSTR "%03d %b %03d %03d $%H %05D "
MSG1.BIN >CSTR "!BIN:%41S\r\n"
MSG1.STR >CSTR "[%02h]:%41S\r\n"
MSG1.BIN >CSTR "!BIN:%41s\r\n"
MSG1.STR >CSTR "[%02h]:%41s\r\n"
MSG1.HEX >CSTR "?HEX:%h%h%h%h.%h%h%h%h.%h%h%h%h.%h%h%h%h\r\n"
MSG2 >CSTR "\r\nAllocated hMem:%d, Total:%d\r\n"
MSG3 >CSTR "High Memory: $%H\r\n"

View File

@ -261,11 +261,16 @@ Cmd.Exec.PWD ldy #S.PS.hPREFIX
>SYSCALL PrintF.YA
jmp Cmd.Exec.Done
Cmd.Exec.CD1 lda #0
Cmd.Exec.CD1 lda (ZPPTR2) Get ARG
cmp #'/' Full Path?
bne .1
sta (ZPCMDBuf)
cmp #'/' Full Path?
beq .1
ldy #1 strlen = 1
lda #0
sta (ZPCMDBuf),y
bra .1
ldy #S.PS.hPREFIX no, init target prefix with actual prefix
lda (pPs),y
@ -274,85 +279,63 @@ Cmd.Exec.CD1 lda #0
>PUSHW ZPCMDBuf
>SYSCALL StrCpy
.1 >PUSHW ZPPTR2 Append ARG to buffer
>PUSHW ZPCMDBuf
>SYSCALL StrCat
ldy #0
ldy #$ff
ldx #'/'
.10 tax
iny
.10 iny
lda (ZPCMDBuf),y
bne .10
bne .10 get strlen ...
.1 ldx #0 dot counter for /./ & /../ detection
.12 inc ZPPTR2
bne .11
inc ZPPTR2+1
cpx #'/'
beq .2
lda #'/'
.11 lda (ZPPTR2)
beq .8 last char...
sta (ZPCMDBuf),y
iny
lda #0
cmp #'/'
beq .13
cmp #'.' a dot ?
bne .1 no, reset counter...
inx
bra .12
.13 txa counting dot ?
beq .12
cpx #2 /../ ?
beq .14
dex /./ ?
bne Cmd.Exec.ERRSYN
dey
dey remove "./" at the end of path....
bra .1
.14 dey remove "/../" at the end of path : "/dir1/../"
dey
dey
dey
beq Cmd.Exec.ERRSYN path was "/../".....error....
.16 dey
lda (ZPCMDBuf),y path is something like : /dir1
cmp #'/'
bne .16
bra .1 Start over...
.8 lda #0
sta (ZPCMDBuf),y
.2 ldy #$ff path is something like : /dir1/../dir2/
.3 ldx #0 reset char counter
.4 iny
lda (ZPCMDBuf),y
beq .8
cmp #'/'
bne .4
.5 txa any char count?
bne .51 no, start counting...
inx
bra .4
.51 inx
cpx #2 do we have /xx/?
bne .3 no, skip this token
dey
lda (ZPCMDBuf),y /yy/x./ ?
dey
cmp (ZPCMDBuf),y /yy/../ ?
bne .3
cpy #3 /../ ?
beq Cmd.Exec.ERRSYN illegal
txa
tay save end of /../
sec
sbc #3 remove ../
tax
.6 dex
lda UsrBuf256,x Found beginning of dir before /../
cmp #'/'
bne .6
.7 lda UsrBuf256,y strip dir/../
sta UsrBuf256,x
cpy UsrBuf256
beq .71
iny
inx
bra .7
.71 stx UsrBuf256
bra .2 Start over...
.8 cpx #1
cpy #1
beq .80 we have '/' go change prefix
>LEA.G CMD.Stat
>PUSHYA
>PUSHWI UsrBuf256
>PUSHW ZPCMDBuf
>SYSCALL STAT
bcs .9
@ -361,7 +344,7 @@ Cmd.Exec.CD1 lda #0
cmp #$0F Directory ?
bne Cmd.Exec.ERRSYN
.80 >LDYAI UsrBuf256
.80 >LDYA ZPCMDBuf
>SYSCALL NewStr.YA
bcs .9
phx

View File

@ -12,8 +12,6 @@ AUTO 6
.INB /A2OSX.BUILD/INC/A2OSX.I
.INB /A2OSX.BUILD/INC/MLI.ERR.I
*--------------------------------------
UsrBuf256 .EQ $200
*--------------------------------------
ZPPTR1 .EQ ZPBIN
ZPPTR2 .EQ ZPBIN+2
ZPCMDBuf .EQ ZPBIN+4

View File

@ -6,7 +6,7 @@ AUTO 6
*--------------------------------------
SYS.BASL0 .EQ $800
*--------------------------------------
CORE.Run jsr CORE.TskMgrRun
CORE.Run jsr CORE.PSRun
stx A2osX.RANDOM16
jsr CORE.GetEvents
txa
@ -102,10 +102,7 @@ CORE.ScreenSelect
.8 rts
*--------------------------------------
CORE.CPULOADI .BS 1
CORE.CPULOADC .AS -"/-\|"
*--------------------------------------
CORE.TskMgrRun >LDYAI TskMgr.Table+S.PS skip PS 0
CORE.PSRun >LDYAI TskMgr.Table+S.PS skip PS 0
>STYA pPs
lda TskMgr.Count
@ -365,21 +362,6 @@ CORE.GetEvents lda #EvtMgr.Table
.8 clc
.9 rts
*--------------------------------------
CORE.PSWakeUp and #$FF^S.PS.F.SLEEP unmark as SLEEP
sta (pPS)
ldy #S.PS.PC
lda (pPs),y
sec Advance PC by one as it was saved by a JSR
adc pCode setup by PS.Select
sta .1+1
iny
lda (pPs),y
adc pCode+1
sta .1+2
.1 jmp $FFFF
*--------------------------------------
* CORE.DispatchEvents
* IN:
* OUT:
@ -499,12 +481,40 @@ K.Sleep pla get PC LO
sbc pCode+1
iny
sta (pPs),y
lda pStack Save DATA Stack Pointer
ldy #S.PS.SP
sta (pPs),y
lda (pPs)
ora #S.PS.F.SLEEP
sta (pPs)
clc No error,
rts back to Kernel
*--------------------------------------
CORE.PSWakeUp and #$FF^S.PS.F.SLEEP unmark as SLEEP
sta (pPS)
ldy #S.PS.SP
lda (pPs),y
sta pStack
ldy #S.PS.PC
lda (pPs),y
sec Advance PC by one as it was saved by a JSR
adc pCode setup by PS.Select
sta .1+1
iny
lda (pPs),y
adc pCode+1
sta .1+2
.1 jmp $FFFF
*--------------------------------------
CORE.CPULOADI .BS 1
CORE.CPULOADC .AS -"/-\|"
*--------------------------------------
TskMgr.Idx .BS 1
TSKMGR.EVENTCNT .BS 1
*--------------------------------------

View File

@ -351,7 +351,7 @@ K.FreeMem.A phy
bit RRAMWRAMBNK2
bit RRAMWRAMBNK2
>LDYAI TskMgr.Table Delect PS0 for proper In/out devices
>LDYAI TskMgr.Table Select PS0 for proper I/O devices
>STYA pPs
jsr DevMgr.SYS.Control