Kernel 0.9.1 : Code reorganization & move to CSTR : Stack Segment

This commit is contained in:
Rémy GIBERT 2017-09-12 08:20:24 +02:00
parent 8d4c55130b
commit 75c95bd1eb
6 changed files with 51 additions and 71 deletions

Binary file not shown.

Binary file not shown.

View File

@ -58,11 +58,9 @@ K.MLI.PATH .EQ $03B0 64+1 -> $03D0
* Main/Aux $400 -> $7FF : Console Screen
* Main/Aux $800 -> $BFF : System Screen
*--------------------------------------
*UsrBuf256 .EQ $0C00 Main
K.Buf256 .EQ $0E00 Main
*--------------------------------------
K.Buf256 .EQ $0D00 Main
*--------------------------------------
K.STACK .EQ $0F00 from $0fff down to $f00
K.STACK .EQ $0F00 from up to $0fff
*--------------------------------------
*** Z80 Reserved $0F00-10FF***
*--------------------------------------

View File

@ -166,92 +166,92 @@ AUTO 6
* STACK PUSH/PULL
*--------------------------------------
.MA PUSHA
dec pStack
sta (pStack)
inc pStack
.EM
*--------------------------------------
.MA PULLA
dec pStack
lda (pStack)
inc pStack
.EM
*--------------------------------------
.MA PUSHYA
dec pStack
sta (pStack)
inc pStack
tya
dec pStack
sta (pStack)
inc pStack
.EM
*--------------------------------------
.MA PULLYA
dec pStack
lda (pStack)
inc pStack
tay
dec pStack
lda (pStack)
inc pStack
.EM
*--------------------------------------
.MA PUSHBI
dec pStack
lda #]1
sta (pStack)
inc pStack
.EM
*--------------------------------------
.MA PUSHB
.DO ]#=2
dec pStack
lda ]1,]2
sta (pStack)
inc pStack
.ELSE
dec pStack
lda ]1
sta (pStack)
inc pStack
.FIN
.EM
*--------------------------------------
.MA PULLB
.DO ]#=2
dec pStack
lda (pStack)
sta ]1,]2
inc pStack
.ELSE
dec pStack
lda (pStack)
sta ]1
inc pStack
.FIN
.EM
*--------------------------------------
.MA PUSHWI
dec pStack
lda /]1
sta (pStack)
dec pStack
inc pStack
lda #]1
sta (pStack)
inc pStack
.EM
*--------------------------------------
.MA PUSHW
dec pStack
lda ]1+1
sta (pStack)
dec pStack
inc pStack
lda ]1
sta (pStack)
inc pStack
.EM
*--------------------------------------
.MA PULLW
dec pStack
lda (pStack)
sta ]1
inc pStack
dec pStack
lda (pStack)
sta ]1+1
inc pStack
.EM
*--------------------------------------
.MA POP
lda pStack
clc
adc ]1
sec
sbc ]1
sta pStack
.EM
*--------------------------------------

View File

@ -234,7 +234,7 @@ CORE.GetPSByID.A
CORE.PSSelect0 >LDYAI TskMgr.Table Select PS0
>STYA pPs
lda K.STACK+$ff
>LDYA K.STACK
>STYA pStack
rts
*--------------------------------------
@ -256,26 +256,10 @@ CORE.PSSelect ldy #S.PS.hCS
jsr K.GetMemPtr.A
>STYA pStack
ldy #S.PS.SP
lda pStack
clc
adc (pPs),y
sta pStack
bcc .8
inc pStack+1
.8 clc
rts
*--------------------------------------
CORE.PSLeave ldy #S.PS.hSS
lda (pPs),y
jsr K.GetMemPtr.A
rts
CORE.PSLeave rts
*--------------------------------------
* PS.Free.A
* In : A = PID to free

View File

@ -28,7 +28,7 @@ K.Sleep pla get PC LO
rts back to Kernel
*/--------------------------------------
* # ExecProcessNewEnv.YA
* # ExecProcess.YA (Blocking Parent PID)
* # ExecProcess.YA (Blocking Parent PID)
* # CreateProcessNewEnv.YA
* # CreateProcess.YA (Non Blocking)
* ## In:
@ -58,7 +58,7 @@ K.CreateProcess.YA
>LDYA K.CreateProcess.CmdLine
jsr PS.CmdLine2Args Y,A = Args[0]
bcs .9
jsr PS.Init
bcc .8
@ -68,7 +68,7 @@ K.CreateProcess.YA
pla get back error code
sec
rts
.8 lda #$ff self modified
.9 rts
*--------------------------------------
@ -185,7 +185,7 @@ PS.CreateChild >LDYAI TskMgr.Table+S.PS
.82 lda #S.PS.F.INUSE+S.PS.F.INIT
ora (ZPPtr3)
sta (ZPPtr3) Make this PS Init....
sta (ZPPtr3) Make this PS Init....
ldy #S.PS.CPID
lda TSKMGR.LASTID
@ -195,16 +195,16 @@ PS.CreateChild >LDYAI TskMgr.Table+S.PS
.9 rts
*--------------------------------------
PS.CmdLine2Args >STYA ZPPtr1
ldy #0
.1 lda (ZPPtr1),y compute strlen in Y,X
beq .2
cmp #'"' skip "" in computation....
beq .1
iny
bne .1 max 255
.2 tya +2 for ending 0 for last string, and endig 0 for array
clc
adc #2
@ -273,53 +273,51 @@ PS.CmdLine2Args.bInQuote
*--------------------------------------
PS.Init jsr BIN.Load.YA Y,A=filename full path
bcs .9
>STYA ZPPtr4 save PTR to Code Segment
txa
ldy #S.PS.hCS
sta (ZPPtr3),y save CS hMem in TSKSLOT
ldy #H.BIN.EXE.DS.SIZE+1
lda (ZPPtr4),y Load DS.SIZE HI
tax
dey
ora (ZPPtr4),y
beq .2 DS.SIZE=0...
lda (ZPPtr4),y
tay
txa Y,A = DS.SIZE
jsr K.GetMem0.YA
bcs .9
txa
ldy #S.PS.hDS
sta (ZPPtr3),y save DS hMem in TSKSLOT
.2 ldy #H.BIN.EXE.SS.SIZE
lda (ZPPtr4),y Load SS.SIZE.LO
pha Save it....
>DEBUG
dec set SP to top
ldy #S.PS.SP
sta (ZPPtr3),y
lda #0 set SS.SIZE.HI
ply get back SS.SIZE.LO....
.2 ldy #H.BIN.EXE.SS.SIZE+1
lda (ZPPtr4),y Load SS.SIZE.HI
tax
dey
ora (ZPPtr4),y
bne .3 SS.SIZE=0, set as default $100
inc SS.SIZE.HI
.3 jsr K.GetMem.YA
inx SS.SIZE.HI
.3 lda (ZPPtr4),y
tay
txa
>PUSHYA
>PUSHBI S.MEM.F.ALIGN
jsr K.GetMem
bcs .9
txa
ldy #S.PS.hSS
sta (ZPPtr3),y save SS hMem in TSKSLOT
clc
.9 rts
*--------------------------------------