Kernel 0.9.1 : Code reorganization & move to CSTR (LS & many API bug fixes)

This commit is contained in:
Rémy GIBERT 2017-09-22 17:25:21 +02:00
parent d8bd97c7cb
commit 61b210742e
12 changed files with 200 additions and 144 deletions

View File

@ -662,6 +662,29 @@ Convert string to UPPERCASE/lowercase
## Out:
+ Uppercased/lowercased String in Buffer
# Time.YA
+ Get System Time in Buffer
## In :
+ Y,A = PTR to S.TIME
## Out :
+ S.TIME filled with System date/time
# PTime2Time
+ Convert ProDOS Time To S.TIME
## In :
+ PUSHW = Dst PTR To S.TIME
+ PUSHW = Src PTR to ProDOS DATE/TIME (DWORD)
# K.CTime2Time
+ Convert CTIME to S.TIME
## In :
+ PUSHW = Dst PTR To S.TIME
+ PUSHW = Src CTIME DWORD
# StrFTime
Convert S.TIME struct to CSTR

Binary file not shown.

Binary file not shown.

View File

@ -48,29 +48,24 @@ L.MSG.DIREXT .DA MSG.DIREXT
L.MSG.FILE .DA MSG.FILE
L.MSG.FILEEXT .DA MSG.FILEEXT
L.PRODOS.FT.TXT .DA PRODOS.FT.TXT
L.TIME.Format .DA TIME.Format
L.FMT.DateTime .DA FMT.DateTime
.DA 0
*--------------------------------------
CS.INIT ldy #S.PS.ARGC
lda (pPs),y
>STA.G ArgCount
beq .7
>STA.G ArgCount
.1 >SYSCALL GetArg.A
>STYA ZPPtr1
lda (ZPPtr1)
cmp #2
cmp #'-'
bne .4
ldy #1
lda (ZPPtr1),y
cmp #'-'
bne .4
iny
lda (ZPPtr1),y
ldx OptionList
.2 cmp OptionList,x
@ -85,7 +80,7 @@ CS.INIT ldy #S.PS.ARGC
.3 ldy OptionVars-1,x
lda #$80
sta (pData),y
bra .7
bra .6
.4 >LDYA ZPPtr1
jsr InitSrcDirYA
@ -96,11 +91,10 @@ CS.INIT ldy #S.PS.ARGC
sta (pData),y
bne .1 scan for any other args
.7 ldy #index
lda (pData),y
.6 >LDA.G index do we have a Source dir ?
bne .8
ldy #S.PS.hPREFIX
.7 ldy #S.PS.hPREFIX
lda (pPs),y
>SYSCALL GetMemPtr.A
jsr InitSrcDirYA
@ -123,21 +117,18 @@ CS.RUN >SYSCALL GetChar
cmp #$13 Ctrl-S
bne .10
ldy #bPause
lda (pData),y
>LDA.G bPause
eor #$ff
sta (pData),y
bne .80
.10 ldy #bPause
lda (pData),y
.10 >LDA.G bPause
bne .80 Pause...
jsr GetEntry
bcs .9
ldy #hFilter
lda (pData),y
>LDA.G hFilter
beq .4 No filter....
>SYSCALL GetMemPtr.A
@ -217,7 +208,7 @@ CS.RUN.DEV ldy #bLong
.9 rts
*--------------------------------------
CS.RUN.DIR >LDA.G bAllmostAll
bpl .10
bmi .10
lda (ZPFileName)
cmp #'.'
@ -233,23 +224,25 @@ CS.RUN.DIR >LDA.G bAllmostAll
ldy #0
.1 lda (ZPFileName),y
beq .11
.1 iny
lda (ZPFileName),y
bne .1
.11 lda #' '
.11 iny
cpy #19
bcs .2
lda #' '
phy
>SYSCALL PutChar.A
ply
bcs .9
iny
cpy #16
bne .11
bcc .11
rts
.2 jsr CS.RUN.UpdateColCnt
bcc .5
rts
.4 jsr CS.RUN.PUSHEXTRA
.4 jsr CS.RUN.PUSHDATES
ldy #S.STAT.MODE+1
lda (ZPFileStat),y
@ -298,7 +291,7 @@ CS.RUN.FILE ldy #bLong
clc
rts
.8 jsr CS.RUN.PUSHEXTRA
.8 jsr CS.RUN.PUSHDATES
lda ZPFileStat
clc
@ -336,14 +329,24 @@ CS.RUN.FILE ldy #bLong
clc
.9 rts
*--------------------------------------
CS.RUN.PUSHEXTRA
ldy TIME.NODATE Set NODATE as default
CS.RUN.PUSHDATES
ldx #$ff
ldy #TIME.Mod-1 Set NODATE as default
.10 lda TIME.NODATE,y
sta TIME.Mod,y
sta TIME.Create,y
dey
bpl .10
.10 inx
iny
lda MSG.NODATE,x
sta (pData),y
bne .10
ldx #$ff
ldy #TIME.Create-1 Set NODATE as default
.11 inx
iny
lda MSG.NODATE,x
sta (pData),y
bne .11
ldy #S.STAT.MTIME+S.TIME.MONTH
lda (ZPFileStat),y
@ -351,7 +354,7 @@ CS.RUN.PUSHEXTRA
>LEA.G TIME.Mod
>PUSHYA
>PUSHW L.TIME.Format
>PUSHW L.FMT.DateTime
lda ZPFileStat
clc
adc #S.STAT.MTIME
@ -367,7 +370,7 @@ CS.RUN.PUSHEXTRA
>LEA.G TIME.Create
>PUSHYA
>PUSHW L.TIME.Format
>PUSHW L.FMT.DateTime
lda ZPFileStat
clc
adc #S.STAT.CTIME
@ -487,8 +490,8 @@ PRODOS.FT.TXT >PSTR "TXT"
>PSTR "ATK"
>PSTR "SYS"
PRODOS.FT.DFLT >PSTR "$ "
TIME.NODATE >CSTR " <No-Date> "
TIME.Format >CSTR "%d-%b-%y %H:%M"
MSG.NODATE >CSTR " <No-Date> "
FMT.DateTime >CSTR "%d-%b-%y %H:%M"
HEXDIGIT .AS '0123456789ABCDEF'
*--------------------------------------
.DUMMY
@ -501,7 +504,6 @@ TIME.Create .BS 20
TIME.Mod .BS 20
hFullPath .BS 1
bExists .BS 1
hDIRs .BS X.MAX.RECURSE
hDIRENTs .BS X.MAX.RECURSE
oDIRENTs .BS X.MAX.RECURSE*2

View File

@ -5,14 +5,16 @@ INC 1
AUTO 6
.LIST OFF
*--------------------------------------
* Uses: (pData)
* hDIRs .BS X.MAX.RECURSE+1
* hDIRENTs .BS X.MAX.RECURSE+1
* hSrcBasePath .BS 1
* hDstBasePath .BS 1 (optional)
*--------------------------------------
X.MAX.RECURSE .EQ 8
*--------------------------------------
* Uses: (pData)
* hDIRs .BS X.MAX.RECURSE+1
* hDIRENTs .BS X.MAX.RECURSE+1
* Index .BS 1
* hSrcBasePath .BS 1
* hDstBasePath .BS 1 (optional)
* STAT .BS S.STAT
*--------------------------------------
InitSrcDirYA >SYSCALL GetFullPath.YA
bcc .10
rts
@ -29,26 +31,27 @@ InitSrcDirYA >SYSCALL GetFullPath.YA
>PUSHYA
>PUSHW ZPPtr1
>SYSCALL Stat
ror
>STA.G bExists save file exists for later.....
bmi .1 File/DIR does not exists, go extract pattern
bcs .1 File/DIR does not exists, go extract pattern
>LDA.G STAT+S.STAT.P.TYPE
cmp #$0f
beq .5 TYPE=DIR, do not extract wildcard
bne .4 TYPE not a DIR, extract....
beq .5 TYPE=DIR, do not extract pattern
ldy #0
ldy #0 TYPE is not DIR, check if wc
.1 iny
lda (ZPPtr1),y Get Src Path Len
bne .1
dey
ldx #0 Init Wildcard count
.2 lda (ZPPtr1),y search backward for a /
cmp #'/'
beq .3
cmp #'?' Test if some wildcard chars....
beq .21
cmp #'*'
@ -58,30 +61,38 @@ InitSrcDirYA >SYSCALL GetFullPath.YA
.22 dey
bne .2
.3 tya
* cmp (ZPPtr1)
* beq .5 Make sure at least one char
.3 txa
beq .91 no wc, file not found....
txa
bne .4 we have wc, go extract....
.30 lda #$ff no wc, remember if file exists?
bmi .91 no, file not found....
.4 ldy #0
.41 iny Search end of string.....
lda (ZPPtr1),y
bne .41
.4 tya save / pos to trunk string later
>STA.G index
lda #'/'
.42 dey
cmp (ZPPtr1),y Search backward /
bne .42
tya
clc
adc ZPPtr1
sta ZPPtr2
tay
lda ZPPtr1+1
adc #0
sta ZPPtr2+1
>SYSCALL Newstr.YA
bcs .9
txa
>STA.G hFilter
>STA.G hFilter
lda #0
sta (ZPPtr2)
.5 >LDYAI 256
>SYSCALL GetMem.YA Get a 256 buffer to store BasePath
@ -91,18 +102,6 @@ InitSrcDirYA >SYSCALL GetFullPath.YA
txa
>STA.G hSrcBasePath
>LDA.G index
tay
dey
lda #'/'
cmp (ZPPtr1),y
beq .51
iny
sta (ZPPtr1),y
.51 lda #0
sta (ZPPtr1),y Trunk before filter string
ldy #$ff
.6 iny
@ -128,8 +127,9 @@ InitSrcDirYA >SYSCALL GetFullPath.YA
rts
.91 lda #MLI.ERR.FNOTFND
.9 pha
.90 >LDA.G hFullPath
>LDA.G hFullPath
>SYSCALL FreeMem.A
pla
sec
@ -357,9 +357,14 @@ GetEntry ldy #index
adc (pData),y
sta ZPFileName+1 ZPFileName=ZPFileName+oDIRENT
.8 lda ZPFileName
.8 ldy #0
.81 iny
lda (ZPFileName),y
bne .81
tya
sec
adc (ZPFileName)
adc ZPFileName
sta ZPFileStat
lda ZPFileName+1
adc #0
@ -464,12 +469,18 @@ EnterSubDirYA.1 lda (pData),y
>PUSHW ZPPtr1
>SYSCALL StrCat
lda (ZPPtr1)
inc
tay
sta (ZPPtr1)
ldy #0
.1 iny
lda (ZPPtr1),y
bne .1
lda #'/'
sta (ZPPtr1),y
iny
lda #0
sta (ZPPtr1),y
rts
*--------------------------------------
LeaveSubDir ldy #index
@ -537,16 +548,23 @@ BasePath..1 lda (pData),y
>STYA ZPPtr1 save full path
lda (ZPPtr1) get len
tay
ldy #0
.1 dey At first run, discard ending /
lda (ZPPtr1),y
cmp #'/'
.1 iny
lda (ZPPtr1),y get len
bne .1
tya
sta (ZPPtr1) cut DIR2/ from /dir1/DIR2/
dey discard ending /
.2 dey
lda (ZPPtr1),y
cmp #'/'
bne .2
iny
lda #0
sta (ZPPtr1),y cut DIR2/ from /dir1/DIR2/
rts
*--------------------------------------

View File

@ -246,7 +246,7 @@ SYS.StrLwr.YA .EQ $8A
SYS.StrFTime .EQ $8C
* .EQ $8E
SYS.TimeYA .EQ $90
SYS.Time.YA .EQ $90
SYS.CTime2Time .EQ $92
SYS.PTime2Time .EQ $94
* .EQ $96

View File

@ -1,14 +1,36 @@
# A2osX (0.9.1) Multi-Tasking OS for Apple II
# A2osX (0.9.1) Multi-Tasking OS for Apple II
0.9 has been archived, next Kernel Version is 0.9.1
...preemtive ?
## Latest News 2017-09-22
**Disk images :**
+ **A2OSX.BOOT.po** : **0.9** 140k BOOT disk image with all binaries
+ **A2OSX.DEV.po** : **0.9** 140k disk image with ASM binaries, Debug Tools & INClude files
+ **A2OSX.BUILD.po** : **0.9.1** 800k BOOT disk image with S-C MASM 2.0 and all binaries (BOOT+DEV)
+ **A2OSX.SRC.po** : **0.9.1** 800k disk image with all sources
(once Kernel 0.9.1 stable enough, BOOT & DEV will be updated)
**0.9 has been archived, next Kernel Version is 0.9.1**
+ More Standard C API compliance
+ API Cleanup, many functions still use shared space
+ Per process Stack Segment
+ Larger S.PS structure
+ More Standard C API compliance __(done!)__
+ API Cleanup, many functions still use shared space __(done!)__
+ Per process Stack Segment __(done!)__
+ Larger S.PS structure __(done!)__
+ ...
+ to allow...Preemtive!
**"System Tick" sources for preemtive mode :**
| Hardware | Resolution | Status | Comment |
| -------------------------| ---------- | ----------- | ------- |
| //c,//c+,IIgs Mouse port | 50/50 Hz | Working | Supported at Kernel level, no conflict with GUI's Mouse.DRV (not required to be loaded), requires setting "Machine Timing" properly in KConfig Utility |
| IIe Mouse Card | 50/50 Hz | Working | (same as above) |
| ThunderClock Plus | 64 Hz | In Progress | ...Need to fix this faulty H/W first! |
| ... Any suggestion ? | | | |
## !!!HELP NEEDED!!!
@ -77,11 +99,6 @@ Kernel API is confined in Aux LC Bank 1 & 2 to leave enough room at $EOOO for Dr
Network drivers, Mouse, DHGR.DRV can load and fit in Aux LC.
Now it's time to make all external BINs use new API, then GUI development will resume.
+ **A2OSX.BOOT.po** : 140k BOOT disk image with all binaries
+ **A2OSX.DEV.po** : 140k disk image with ASM binaries, Debug Tools & INClude files
+ **A2OSX.BUILD.po** : 800k BOOT disk image with S-C MASM 2.0 and all binaries (BOOT+DEV)
+ **A2OSX.SRC.po** : 800k disk image with all sources
OApple+1,OApple+2,OApple+3 to switch between screens : Kernel Log, text, DHGR.
(OApple+shift+1,OApple+shift+2,OApple+shift+3 on FR keyboard)

View File

@ -268,6 +268,7 @@ Cmd.Exec.PWD ldy #S.PS.hPREFIX
lda (pPs),y
>SYSCALL GetMemPtr.A
>SYSCALL PrintF.YA
jsr Cmd.Exec.ECHO.CR
jmp Cmd.Exec.Done
Cmd.Exec.CD1 lda (ZPPTR2) Get ARG
@ -487,7 +488,7 @@ Cmd.Exec.DATE sec
Cmd.Exec.TIME clc
php
>LEA.G CMD.Time
>SYSCALL TimeYA
>SYSCALL Time.YA
>PUSHWI ZPCMDBuf
plp
@ -608,12 +609,7 @@ Cmd.Exec.READ lda (ZPPtr2)
Cmd.Exec.SLEEP lda (ZPPtr2)
beq .9
lda #Sleep
clc
adc pData
tay
lda /Sleep
adc pData+1
>LEA.G Sleep
>PUSHYA
>PUSHW ZPPtr2
>SYSCALL AToI.YA

View File

@ -322,10 +322,10 @@ CORE.PSFree.A sta .1+1 Save PS ID
.3 stz PS.Table.PID-1,x
lda PS.TABLE.hMem-1,x
jmp K.FreeMem.A
.4 jmp K.FreeMem.A
.8 lda (ZPPtr1),y
bne .9
bne .4
.9 rts
*--------------------------------------
* X unmodofied

View File

@ -492,13 +492,11 @@ K.ReadDir.A.AddAccess
sta K.S.STAT+S.STAT.MODE
*--------------------------------------
K.ReadDir.A.AddTime
ldx #K.S.STAT+S.STAT.CTIME
ldy /K.S.STAT+S.STAT.CTIME
>PUSHWI K.S.STAT+S.STAT.CTIME
lda #$18 creation Date/time
jsr K.ReadDir.A.ConvertTime
ldx #K.S.STAT+S.STAT.MTIME
ldy /K.S.STAT+S.STAT.MTIME
>PUSHWI K.S.STAT+S.STAT.MTIME
lda #$21 mod Date/time
jsr K.ReadDir.A.ConvertTime
*--------------------------------------
@ -589,16 +587,14 @@ K.ReadDir.A.AddToBuf
.8 rts
*--------------------------------------
K.ReadDir.A.ConvertTime
stx ZPPtr2
sty ZPPtr2+1
clc
adc ZPPtr3
sta ZPPtr1
tay
lda ZPPtr3+1
adc #0
sta ZPPtr1+1
jmp TIME.PTime2TimePtr1Ptr2
>PUSHYA
>SYSCALL PTime2Time
rts
*/-------------------------------------
* # CloseDir.A
* ## In:

View File

@ -15,15 +15,16 @@ AUTO 6
*\--------------------------------------
K.GetFullPath.YA
>STYA ZPPtr1
ldx #0
lda (ZPPtr1)
beq .8
beq .10
cmp #'/' full path starting with '/'?
beq .2 yes, do not append to current prefix
ldy #S.PS.hPREFIX
.10 ldy #S.PS.hPREFIX
lda (pPs),y
jsr K.GetMemPtr.A
>STYA ZPPtr2
@ -48,8 +49,7 @@ K.GetFullPath.YA
.8 stz K.Buf256,x
>LDYAI K.Buf256
jsr K.NewStr.YA
rts
jmp K.NewStr.YA
*/--------------------------------------
* # LoadFile
* ## In:

View File

@ -10,25 +10,28 @@ SECSDAY .EQ 86400 60*60*24
CENTURY0 .EQ 19
YEAR0 .EQ 70
DAY0 .EQ 4 day 0 was a thursday
*--------------------------------------
* K.Time.YA get System Time
* In :
* Y,A = PTR to S.TIME
* Out :
* S.TIME filled with System date/time
*--------------------------------------
*/--------------------------------------
* # Time.YA
* Get System Time in Buffer
* ## In :
* Y,A = PTR to S.TIME
* ## Out :
* S.TIME filled with System date/time
*\--------------------------------------
K.Time.YA >STYA ZPPtr2
>MLICALL MLIGETTIME
>LDYAI DATELO
>STYA ZPPtr1
bra TIME.PTime2TimePtr1Ptr2
*--------------------------------------
* In :
* PULLW = Src PDATE/TIME (DWORD)
* PULLW = Dst PTR To S.TIME
*--------------------------------------
bra TIME.PTime2TimeP1P2
*/--------------------------------------
* # PTime2Time
* Convert ProDOS Time To S.TIME
* ## In :
* PUSHW = Dst PTR To S.TIME
* PUSHW = Src PTR to ProDOS DATE/TIME (DWORD)
*\--------------------------------------
K.PTime2Time jsr PullPtr1Ptr2
TIME.PTime2TimePtr1Ptr2
TIME.PTime2TimeP1P2
ldy #1
lda (ZPPtr1),y Get Year
lsr C is high bit of month
@ -157,12 +160,13 @@ K.ComputeWDAY lda #3 Thursday : 4 (-1 for mod 7)
clc
rts
*--------------------------------------
* K.CTime2Time
* In :
* PULLW = Src CTIME DWORD
* PULLW = Dst PTR To S.TIME
*--------------------------------------
*/--------------------------------------
* # K.CTime2Time
* Convert CTIME to S.TIME
* ## In :
* PUSHW = Dst PTR To S.TIME
* PUSHW = Src CTIME DWORD
*\--------------------------------------
K.CTime2Time jsr PullPtr1Ptr2
ldy #3