Kernel 0.9.2

This commit is contained in:
Rémy GIBERT 2018-08-11 12:57:57 +02:00
parent 45cd7d04fa
commit 41338d85f7
15 changed files with 77 additions and 101 deletions

Binary file not shown.

Binary file not shown.

View File

@ -12,6 +12,7 @@ AUTO 4,1
*-------------------------------------- *--------------------------------------
ZPPtr1 .EQ ZPBIN ZPPtr1 .EQ ZPBIN
ZPPtr2 .EQ ZPBIN+2 ZPPtr2 .EQ ZPBIN+2
ZPPtrFD .EQ ZPBIN+4
*-------------------------------------- *--------------------------------------
* File Header (16 Bytes) * File Header (16 Bytes)
*-------------------------------------- *--------------------------------------
@ -23,7 +24,7 @@ CS.START cld
.DA CS.END-CS.START CS .DA CS.END-CS.START CS
.DA DS.END-DS.START DS .DA DS.END-DS.START DS
.DA #16 SS .DA #16 SS
.DA #4 ZP .DA #6 ZP
.DA 0 .DA 0
*-------------------------------------- *--------------------------------------
* Relocation Table * Relocation Table
@ -81,14 +82,17 @@ CS.INIT ldy #S.PS.ARGC
sta (pData),y sta (pData),y
bra .1 bra .1
.4 >LDA.G hDev .4 >LDA.G hDevFD
bne .5 Already have a dev name...go get VolName bne .5 Already have a dev...go get VolName
>LDYA ZPPtr1 >LDYA ZPPtr1
>SYSCALL GetDevByName >SYSCALL GetDevByName
bcs .99 bcs .99
>STYA ZPPtrFD
txa txa
>STA.G hDev >SYSCALL GetDevByID
txa
>STA.G hDevFD
bra .1 bra .1
.5 ldy #$ff .5 ldy #$ff
@ -201,19 +205,15 @@ CS.RUN.InitCat >LDA.G CatSize
rts rts
*-------------------------------------- *--------------------------------------
CS.RUN.BuildCat >PUSHEA.G DIB CS.RUN.BuildCat >PUSHEA.G DIB
>LDA.G hDev >LDA.G hDevFD
>SYSCALL GetDevStatus >SYSCALL GetDevStatus
bcs .99 bcs .99
>LDA.G hDev lda ZPPtrFD
>SYSCALL GetDevByID * clc
bcs .99
pha
tya
adc #S.FD.DEV.NAME adc #S.FD.DEV.NAME
sta ZPPtr2 sta ZPPtr2
pla lda ZPPtrFD+1
adc /S.FD.DEV.NAME adc /S.FD.DEV.NAME
sta ZPPtr2+1 sta ZPPtr2+1
@ -259,8 +259,7 @@ CS.RUN.BuildCat >PUSHEA.G DIB
*-------------------------------------- *--------------------------------------
CS.RUN.WriteCat >PUSHEA.G IOCTL CS.RUN.WriteCat >PUSHEA.G IOCTL
>PUSHBI IOCTL.WRITEBLOCK >PUSHBI IOCTL.WRITEBLOCK
>LDA.G hDev >LDA.G hDevFD
>SYSCALL IOCTL >SYSCALL IOCTL
bcs .9 bcs .9
@ -335,7 +334,7 @@ DS.START
ArgIndex .BS 1 ArgIndex .BS 1
bLL .BS 1 bLL .BS 1
VolName .BS 16 VolName .BS 16
hDev .BS 5 hDevFD .BS 5
CatSize .BS 1 CatSize .BS 1
CatOptions .BS 1 CatOptions .BS 1
BlkCnt .BS 1 BlkCnt .BS 1

View File

@ -411,8 +411,7 @@ CS.DOEVENT sec
CS.QUIT jsr LeaveSubDir CS.QUIT jsr LeaveSubDir
bcc CS.QUIT bcc CS.QUIT
ldy #hFilter >LDA.G hFilter
lda (pData),y
beq .3 beq .3
>SYSCALL FreeMem >SYSCALL FreeMem

View File

@ -68,26 +68,21 @@ CS.RUN >SYSCALL GetChar
cmp #19 Ctrl-S ? cmp #19 Ctrl-S ?
bne .12 bne .12
ldy #bSTOP >LDA.G bSTOP
lda (pData),y
eor #$ff eor #$ff
sta (pData),y sta (pData),y
bra .13 bra .13
.12 ldy #bSTOP .12 >STZ.G bSTOP
lda #0
sta (pData),y
.13 ldy #bSTOP .13 >LDA.G bSTOP
lda (pData),y
bne .8 bne .8
>LDA.G MEM.COUNT >LDA.G MEM.COUNT
>CMP.G MemStat+S.MSTAT.MLast >CMP.G MemStat+S.MSTAT.MLast
beq .10 beq .10
ldy #LINE.COUNT >LDA.G LINE.COUNT
lda (pData),y
bne .1 bne .1
>LDYA L.MSG0 >LDYA L.MSG0
@ -111,20 +106,17 @@ CS.RUN >SYSCALL GetChar
.9 sec .9 sec
rts rts
.10 ldy #LINE.COUNT .10 >LDA.G LINE.COUNT
lda (pData),y
clc clc
adc #FOOTERLEN adc #FOOTERLEN
cmp #PAGELEN cmp #PAGELEN
bcc .11 bcc .11
lda #$FF lda #$FF
ldy #bSTOP >STA.G bSTOP
sta (pData),y
lda #0 inc
ldy #LINE.COUNT >STA.G LINE.COUNT
sta (pData),y
clc clc
rts rts
@ -157,6 +149,7 @@ CS.RUN >SYSCALL GetChar
>PUSHYA >PUSHYA
>LDYA L.MSG.FREE >LDYA L.MSG.FREE
>SYSCALL printf >SYSCALL printf
lda #0
sec sec
rts rts
*-------------------------------------- *--------------------------------------
@ -294,7 +287,7 @@ MSG3 .AZ "High Memory: $%H\r\n"
MSG4 .AZ "Free ULimit: $%H\r\n" MSG4 .AZ "Free ULimit: $%H\r\n"
MSG5 .AZ "Low Memory: $%H\r\n" MSG5 .AZ "Low Memory: $%H\r\n"
MSG.FREE .AZ "\r\nFree Memory: %D Bytes.\r\n" MSG.FREE .AZ "\r\nFree Memory: %D Bytes.\r\n"
MSG.FLAGS .AS "UZCNA--" MSG.FLAGS .AS "UZNAfcds"
*-------------------------------------- *--------------------------------------
.DUMMY .DUMMY
.OR 0 .OR 0

View File

@ -19,7 +19,7 @@ CS.START cld
.DA 0 .DA 0
.DA CS.END-CS.START CS .DA CS.END-CS.START CS
.DA DS.END-DS.START DS .DA DS.END-DS.START DS
.DA #16 SS .DA #64 SS
.DA #8 ZP .DA #8 ZP
.DA 0 .DA 0
*-------------------------------------- *--------------------------------------
@ -52,15 +52,10 @@ CS.INIT
>STYA ZPPtr1 >STYA ZPPtr1
lda (ZPPtr1) lda (ZPPtr1)
cmp #2
bne .4
ldy #1
lda (ZPPtr1),y
cmp #'-' cmp #'-'
bne .4 bne .4
iny ldy #1
lda (ZPPtr1),y lda (ZPPtr1),y
ldx OptionList ldx OptionList
@ -81,9 +76,7 @@ CS.INIT
sta (pData),y sta (pData),y
bra .1 bra .1
.4 tax Save len .4 >LDA.G index
>LDA.G index
.DO X.COPY.TO.DEST=1 .DO X.COPY.TO.DEST=1
bne .5 Already have a Src dir... bne .5 Already have a Src dir...
@ -199,9 +192,7 @@ CS.RUN >SYSCALL GetChar
bcc .21 bcc .21
rts rts
.21 ldy #hToDelete .21 >STZ.G hToDelete Cancel delete if any
lda #0
sta (pData),y Cancel delete if any
jmp CS.RUN.NEXT jmp CS.RUN.NEXT
.FIN .FIN
.FIN .FIN
@ -231,8 +222,7 @@ CS.RUN >SYSCALL GetChar
.3 jsr GetEntry .3 jsr GetEntry
bcs CS.RUN.LEAVE bcs CS.RUN.LEAVE
ldy #hFilter >LDA.G hFilter
lda (pData),y
beq .4 No filter.... beq .4 No filter....
>SYSCALL GetMemPtr >SYSCALL GetMemPtr
@ -470,8 +460,7 @@ CS.RUN.DIR.MSG sec
.HS 90 bcc opcode .HS 90 bcc opcode
CS.RUN.FILE.MSG clc CS.RUN.FILE.MSG clc
ldy #bQuiet >LDA.G bQuiet
lda (pData),y
bmi .8 bmi .8
php php
@ -503,8 +492,7 @@ CS.RUN.FILE.MSG clc
.DO X.COPY.TO.DEST=1 .DO X.COPY.TO.DEST=1
CS.RUN.OVERWRITE.MSG CS.RUN.OVERWRITE.MSG
ldy #bQuiet >LDA.G bQuiet
lda (pData),y
bmi .1 bmi .1
jsr CS.RUN.CR jsr CS.RUN.CR
@ -557,8 +545,7 @@ CS.RUN.CopyStart
jsr CS.RUN.Open jsr CS.RUN.Open
bcs .99 bcs .99
ldy #hSrcFile >STA.G hSrcFile
sta (pData),y
ldy #hDstFullPath ldy #hDstFullPath
lda #SYS.FOpen.W+SYS.FOpen.X lda #SYS.FOpen.W+SYS.FOpen.X
@ -579,8 +566,7 @@ CS.RUN.CopyStart
rts rts
.9 pha .9 pha
ldy #hSrcFile >LDA.G hSrcFile
lda (pData),y
>SYSCALL fclose >SYSCALL fclose
pla pla
@ -605,7 +591,6 @@ CS.RUN.Open phy Save Filename
ply ply
jsr CS.RUN.GetPathY jsr CS.RUN.GetPathY
>SYSCALL FOpen >SYSCALL FOpen
rts rts
*-------------------------------------- *--------------------------------------
@ -656,8 +641,7 @@ CS.RUN.Copy stz .90+1
beq CS.RUN.CopyEnd beq CS.RUN.CopyEnd
>SYSCALL FreeMem >SYSCALL FreeMem
*-------------------------------------- *--------------------------------------
CS.RUN.CopyEnd ldy #hSrcFile CS.RUN.CopyEnd >LDA.G hSrcFile
lda (pData),y
>SYSCALL fclose >SYSCALL fclose
ldy #hDstFile ldy #hDstFile
@ -774,15 +758,13 @@ CS.QUIT jsr LeaveSubDir
.DO X.COPY.TO.DEST=1 .DO X.COPY.TO.DEST=1
ldy #bCopy >LDA.G bCopy
lda (pData),y
bpl .1 bpl .1
ldy #hSrcFile >LDA.G hSrcFile
lda (pData),y
>SYSCALL fclose >SYSCALL fclose
ldy #hDstFile
lda (pData),y >LDA.G hDstFile
>SYSCALL fclose >SYSCALL fclose
.1 ldy #hDstFullPath .1 ldy #hDstFullPath
@ -796,6 +778,9 @@ CS.QUIT jsr LeaveSubDir
ldy #hSrcFullPath ldy #hSrcFullPath
jsr CS.QUIT.FREE jsr CS.QUIT.FREE
ldy #hFilter
jsr CS.QUIT.FREE
clc clc
rts rts
*-------------------------------------- *--------------------------------------
@ -806,3 +791,5 @@ CS.QUIT.FREE lda (pData),y
*-------------------------------------- *--------------------------------------
MAN MAN
SAVE /A2OSX.SRC/BIN/X.CPMVRM.S SAVE /A2OSX.SRC/BIN/X.CPMVRM.S
LOAD /A2OSX.SRC/BIN/CP.S
ASM

View File

@ -259,9 +259,12 @@ K.E.FTB .EQ $CC File Too Big Error
S.MEM.F .EQ 0 S.MEM.F .EQ 0
S.MEM.F.INUSE .EQ %10000000 (Internal Flag) S.MEM.F.INUSE .EQ %10000000 (Internal Flag)
S.MEM.F.INIT0 .EQ %01000000 Fill with "0" S.MEM.F.INIT0 .EQ %01000000 Fill with "0"
S.MEM.F.CODE .EQ %00100000 S.MEM.F.NOMOVE .EQ %00100000
S.MEM.F.NOMOVE .EQ %00010000 S.MEM.F.ALIGN .EQ %00010000
S.MEM.F.ALIGN .EQ %00001000 S.MEM.F.FD .EQ %00001000
S.MEM.F.CODE .EQ %00000100
S.MEM.F.DATA .EQ %00000010
S.MEM.F.STACK .EQ %00000001
S.MEM.REFCNT .EQ 1 S.MEM.REFCNT .EQ 1
S.MEM.OWNERPID .EQ 2 S.MEM.OWNERPID .EQ 2
S.MEM.BIN .EQ 3 S.MEM.BIN .EQ 3

View File

@ -220,7 +220,7 @@ CS.DOEVENT lda (pEvent)
*-------------------------------------- *--------------------------------------
CS.QUIT >LDA.G hBinName CS.QUIT >LDA.G hBinName
beq .1 beq .1
>SYSCALL FreeMem * >SYSCALL FreeMem
.1 >LDA.G hDEV .1 >LDA.G hDEV
beq .8 beq .8

View File

@ -147,7 +147,7 @@ Cmd.Exec.Done php
>LDA.G CMD.hFullpath >LDA.G CMD.hFullpath
beq .1 beq .1
>SYSCALL FreeMem >SYSCALL FreeMem
>STZ.G CMD.hFullpath
.1 pla .1 pla
plp plp
rts rts

View File

@ -123,7 +123,8 @@ K.MKDev >STYA .1+1
beq .9 beq .9
>LDYAI S.FD.DEV >LDYAI S.FD.DEV
jsr K.GetMem ldx #S.MEM.F.FD
jsr MEM.GetMem.YAX
>STYA .2+1 >STYA .2+1
phx phx

View File

@ -23,12 +23,12 @@ K.OpenDir jsr PFT.CheckPathYA
jsr K.GetMem0 jsr K.GetMem0
bcs .99 bcs .99
>STYA ZPPtr1 >STYA pFD
stx .8+1 stx .8+1
ldy #S.FD.T Done by GetMem0 ldy #S.FD.T
lda #S.FD.T.DIR lda #S.FD.T.DIR
sta (ZPPtr1),y sta (pFD),y
ldy #1 ldy #1
lda (ZPPtr2),y One char ? lda (ZPPtr2),y One char ?
@ -49,7 +49,7 @@ K.OpenDir jsr PFT.CheckPathYA
lda K.MLI.PARAMS+5 get ref_num lda K.MLI.PARAMS+5 get ref_num
ldy #S.FD.DIR.REF ldy #S.FD.DIR.REF
sta (ZPPtr1),y sta (pFD),y
.8 lda #$ff Self Modified .8 lda #$ff Self Modified
clc clc
@ -78,7 +78,6 @@ K.OpenDir jsr PFT.CheckPathYA
* A = EC * A = EC
* note : A = 0 means no more entry * note : A = 0 means no more entry
*\-------------------------------------- *\--------------------------------------
K.ReadDir.hDir .BS 1
K.ReadDir.hMem .BS 1 K.ReadDir.hMem .BS 1
K.ReadDir.BufSize .BS 2 K.ReadDir.BufSize .BS 2
K.ReadDir.ECIB .BS 1 K.ReadDir.ECIB .BS 1
@ -88,12 +87,11 @@ K.ReadDir.EPB .BS 1
K.ReadDir.EC .BS 2 K.ReadDir.EC .BS 2
*-------------------------------------- *--------------------------------------
K.ReadDir jsr PFT.CheckNodeA K.ReadDir jsr PFT.CheckNodeA
sta K.ReadDir.hDir
jsr K.GetMemPtr jsr K.GetMemPtr
>STYA ZPPtr1 >STYA pFD
ldy #S.FD.DIR.REF ldy #S.FD.DIR.REF
lda (ZPPtr1),y lda (pFD),y
beq K.ReadDir.ROOT beq K.ReadDir.ROOT
jmp K.ReadDir.DIR jmp K.ReadDir.DIR
@ -104,7 +102,7 @@ K.ReadDir.NoMore
*-------------------------------------- *--------------------------------------
K.ReadDir.ROOT K.ReadDir.ROOT
ldy #S.FD.DIR.FC did we already returned something ? ldy #S.FD.DIR.FC did we already returned something ?
lda (ZPPtr1),y lda (pFD),y
bne K.ReadDir.NoMore bne K.ReadDir.NoMore
stz K.MLI.PARAMS+1 All Volumes stz K.MLI.PARAMS+1 All Volumes
@ -218,7 +216,7 @@ K.ReadDir.ROOT
.5 ldy #S.FD.DIR.FC .5 ldy #S.FD.DIR.FC
lda #16 lda #16
sta (ZPPtr1),y Flag that we returned somthing for next time sta (pFD),y Flag that we returned somthing for next time
jmp K.ReadDir.EXIT jmp K.ReadDir.EXIT
*-------------------------------------- *--------------------------------------
@ -249,7 +247,7 @@ K.ReadDir.DIR sta K.MLI.PARAMS+1 A=#S.DIR.PRODOS.REF
bcs .98 bcs .98
ldy #S.FD.DIR.EL Check if first run.... ldy #S.FD.DIR.EL Check if first run....
lda (ZPPtr1),y lda (pFD),y
bne .2 no, we have all we need.... bne .2 no, we have all we need....
ldy #$1f+3 ldy #$1f+3
@ -273,7 +271,7 @@ K.ReadDir.DIR sta K.MLI.PARAMS+1 A=#S.DIR.PRODOS.REF
.2 ldy #S.FD.DIR.EL+3 .2 ldy #S.FD.DIR.EL+3
ldx #3 ldx #3
.3 lda (ZPPtr1),y get this session parameters from S.DIR .3 lda (pFD),y get this session parameters from S.DIR
sta K.ReadDir.EL,x sta K.ReadDir.EL,x
dey dey
dex dex
@ -408,15 +406,11 @@ K.ReadDir.DIR2 jsr K.ReadDir.GetBuf
* lda #0 S.MEM.F.INIT0 already did this * lda #0 S.MEM.F.INIT0 already did this
* sta (ZPPtr4) Ending 0 * sta (ZPPtr4) Ending 0
lda K.ReadDir.hDir Restore ZPPtr1 trashed by STR API calls
jsr K.GetMemPtr
>STYA ZPPtr1
ldx #3 ldx #3
ldy #S.FD.DIR.EL+3 ldy #S.FD.DIR.EL+3
.81 lda K.ReadDir.EL,x Store back this session prameters to S.DIR .81 lda K.ReadDir.EL,x Store back this session prameters to S.DIR
sta (ZPPtr1),y sta (pFD),y
dey dey
dex dex
bpl .81 bpl .81

View File

@ -197,7 +197,7 @@ Mem.AddSlot >STYA ZPMemMgrTmp1 save req size
ldy #S.MEM.PTR ldy #S.MEM.PTR
sta Mem.Free set as system Mem.Free value sta Mem.Free set as system Mem.Free value
sta (ZPMemMgrSPtr),y store is as base address of new slot sta (ZPMemMgrSPtr),y store it as base address of new slot
iny iny
pla get back Mem.Free HI pla get back Mem.Free HI
sta Mem.Free+1 sta Mem.Free+1

View File

@ -282,7 +282,8 @@ PS.Load jsr BIN.Load Y,A=filename full path
lda (ZPPtr4),y lda (ZPPtr4),y
tay tay
txa Y,A = DS.SIZE txa Y,A = DS.SIZE
jsr K.GetMem0 ldx #S.MEM.F.INIT0+S.MEM.F.DATA
jsr MEM.GetMem.YAX
bcs .9 bcs .9
phy phy
@ -311,7 +312,7 @@ PS.Load jsr BIN.Load Y,A=filename full path
.HS 2C bit abs .HS 2C bit abs
.3 lda #0 .3 lda #0
ldx #S.MEM.F.ALIGN ldx #S.MEM.F.ALIGN+S.MEM.F.STACK
jsr MEM.GetMem.YAX jsr MEM.GetMem.YAX
bcs .9 bcs .9

View File

@ -948,8 +948,8 @@ K.FOpen.10 lda #S.FD.REG
adc K.MLI.PATH adc K.MLI.PATH
tay tay
lda #0 lda #0
ldx #S.MEM.F.INIT0+S.MEM.F.FD
jsr K.GetMem0 jsr MEM.GetMem.YAX
bcs K.FOpen.9 bcs K.FOpen.9
>STYA pFD >STYA pFD
@ -1039,7 +1039,6 @@ K.FOpen.AUXTYPE .BS 2
*\-------------------------------------- *\--------------------------------------
K.FClose jsr PFT.CheckNodeA K.FClose jsr PFT.CheckNodeA
sta .8+1 sta .8+1
jsr K.GetMemPtr jsr K.GetMemPtr
>STYA pFD >STYA pFD

View File

@ -278,7 +278,7 @@ STDLIB.32.Clear ldx #3
bpl .1 bpl .1
rts rts
*/-------------------------------------- */--------------------------------------
* # realpath * # RealPath
* Return the canonicalized absolute pathname * Return the canonicalized absolute pathname
* ## C * ## C
* `unsigned short int realpath (const char* str);` * `unsigned short int realpath (const char* str);`