Kernel 0.93+

This commit is contained in:
Rémy GIBERT 2019-10-13 10:35:31 +02:00
parent a447e582aa
commit 25a904276f
7 changed files with 61 additions and 150 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -439,6 +439,7 @@ WRITE php
eor #$ff eor #$ff
adc #0 adc #0
.1 ora #L91C96.2.MMUCR.ALLOC .1 ora #L91C96.2.MMUCR.ALLOC
sta L91C96.2.MMUCR,x sta L91C96.2.MMUCR,x
@ -493,7 +494,7 @@ WRITE php
adc #$00 adc #$00
sta L91C96.2.DATA,x sta L91C96.2.DATA,x
ldy #2 ldy #0
.5 inc Counter .5 inc Counter
bne .51 bne .51
@ -517,6 +518,7 @@ WRITE php
sta L91C96.2.DATA,x sta L91C96.2.DATA,x
iny iny
bne .5 bne .5
inc ZPBufPtr+1 inc ZPBufPtr+1
bra .5 bra .5

View File

@ -6,9 +6,6 @@ TOP.MAX .EQ 32
REP.MAX .EQ 1+254 REP.MAX .EQ 1+254
BL.MIN .EQ 3 BL.MIN .EQ 3
BL.MAX .EQ 3+63 BL.MAX .EQ 3+63
STR.MIN .EQ 127 DISABLED
STR.MAX .EQ 3+15
*-------------------------------------- *--------------------------------------
PAK.B.BYTE8.W .EQ 1 PAK.B.BYTE8.W .EQ 1
PAK.B.BYTE8 .EQ %0 PAK.B.BYTE8 .EQ %0
@ -26,9 +23,6 @@ PAK.B.REP.W .EQ 6
PAK.B.REP .EQ %111110 PAK.B.REP .EQ %111110
PAK.B.BL.W .EQ 6 PAK.B.BL.W .EQ 6
PAK.B.BL .EQ %111111 PAK.B.BL .EQ %111111
PAK.B.STR.W .EQ 6 DISABLED
PAK.B.STR .EQ %01.0000
*-------------------------------------- *--------------------------------------
* Shunk Header : * Shunk Header :
* WORD : Target UNCompressed Length * WORD : Target UNCompressed Length
@ -49,11 +43,10 @@ S.PAKSTAT.TOP16 .EQ 6
S.PAKSTAT.TOP24 .EQ 8 S.PAKSTAT.TOP24 .EQ 8
S.PAKSTAT.TOP32 .EQ 10 S.PAKSTAT.TOP32 .EQ 10
S.PAKSTAT.BYTE8 .EQ 12 S.PAKSTAT.BYTE8 .EQ 12
S.PAKSTAT.STR .EQ 14 S.PAKSTAT.REPN .EQ 14
S.PAKSTAT.REPN .EQ 16 S.PAKSTAT.BL .EQ 16
S.PAKSTAT.BL .EQ 18
* *
S.PAKSTAT .EQ 20 S.PAKSTAT .EQ 18
*-------------------------------------- *--------------------------------------
LIBPAK.Pak .EQ 4 LIBPAK.Pak .EQ 4
*-------------------------------------- *--------------------------------------

View File

@ -16,8 +16,6 @@ ZPStatPtr .EQ ZPLIB+4
ZPSrcBLPtr .EQ ZPLIB+8 ZPSrcBLPtr .EQ ZPLIB+8
ZPCnt .EQ ZPLIB+10 ZPCnt .EQ ZPLIB+10
ZPBLCnt .EQ ZPLIB+12 ZPBLCnt .EQ ZPLIB+12
*-------------------------------------- *--------------------------------------
* File Header (16 Bytes) * File Header (16 Bytes)
*-------------------------------------- *--------------------------------------
@ -107,8 +105,6 @@ Pak >PULLW Pak.SrcPtr
Pak.Run >LDYA Pak.SrcPtr Pak.Run >LDYA Pak.SrcPtr
>STYA ZPSrcPtr >STYA ZPSrcPtr
stz Pak.Str.Longest
stz Pak.Rep.Longest stz Pak.Rep.Longest
stz Pak.BL.Longest stz Pak.BL.Longest
@ -128,8 +124,6 @@ Pak.Run >LDYA Pak.SrcPtr
stz Pak.RepCnt stz Pak.RepCnt
stz Pak.LastByte stz Pak.LastByte
stz Pak.Out.StrLen
ldx #S.PAKSTAT.PASS1 ldx #S.PAKSTAT.PASS1
bit Pak.bPass2 bit Pak.bPass2
bpl .1 bpl .1
@ -181,7 +175,7 @@ Pak.Run.1 inc Pak.SrcCnt
inc Pak.SrcCnt+1 inc Pak.SrcCnt+1
bmi .1 bmi .1
.8 jmp Pak.Out.Flush .8 clc
.9 rts .9 rts
@ -301,10 +295,13 @@ Pak.ScanBL >LDYA Pak.SrcPtr Start at beginning of Src buf
rts rts
*-------------------------------------- *--------------------------------------
Pak.ComputeLenBits Pak.ComputeLenBits
ldx #8
lda Pak.Rep.Longest lda Pak.Rep.Longest
dec tax
dec Longest=1, one bit
beq .15
ldx #8
.14 asl .14 asl
bcs .15 bcs .15
@ -415,7 +412,8 @@ Pak.BuildTOPTable
cpy #TOP.MAX cpy #TOP.MAX
bne .1 bne .1
.8 tya .8 sty Pak.TOP.Count
tya
ora Pak.Shnk+S.PAKSHNK.TOPCNT ora Pak.Shnk+S.PAKSHNK.TOPCNT
sta Pak.Shnk+S.PAKSHNK.TOPCNT sta Pak.Shnk+S.PAKSHNK.TOPCNT
@ -436,10 +434,7 @@ Pak.PutRep ldx #S.PAKSTAT.REPN
clc clc
rts rts
Pak.PutRep.2 jsr Pak.Out.Flush Pak.PutRep.2 ldy #PAK.B.REP.W
bcs .9
ldy #PAK.B.REP.W
lda #PAK.B.REP lda #PAK.B.REP
jsr Pak.Out.PutYBits jsr Pak.Out.PutYBits
bcs .9 bcs .9
@ -484,10 +479,7 @@ Pak.PutBL ldx #S.PAKSTAT.BL
clc clc
rts rts
.20 jsr Pak.Out.Flush .20 ldy #PAK.B.BL.W
bcs .9
ldy #PAK.B.BL.W
lda #PAK.B.BL lda #PAK.B.BL
jsr Pak.Out.PutYBits jsr Pak.Out.PutYBits
bcs .9 bcs .9
@ -524,42 +516,42 @@ Pak.PutByte8 sta Pak.LastByte
inc Pak.CntH,x inc Pak.CntH,x
.6 ldx #S.PAKSTAT.PASS1 .6 ldx #S.PAKSTAT.BYTE8
jsr Pak.UpdateStats jsr Pak.UpdateStats
ldx #S.PAKSTAT.BYTE8 ldx #S.PAKSTAT.PASS1
jsr Pak.UpdateStats jsr Pak.UpdateStats
clc clc
rts rts
Pak.PutByte8.2 ldy Pak.Shnk+S.PAKSHNK.TOPCNT Pak.PutByte8.2 ldy Pak.TOP.Count
.1 cmp Pak.Shnk+S.PAKSHNK.TOPBYTES-1,y .1 cmp Pak.Shnk+S.PAKSHNK.TOPBYTES-1,y
beq .3 beq .3
dey dey
bne .1 bne .1
inc Pak.Out.StrLen ldx #S.PAKSTAT.BYTE8
ldy Pak.Out.StrLen jsr Pak.UpdateStats
sta Pak.Out.StrBuf,y
cpy #STR.MAX
bcc .9
jmp Pak.Out.Flush pha
ldy #PAK.B.BYTE8.W
.3 phy lda #PAK.B.BYTE8
jsr Pak.Out.Flush jsr Pak.Out.PutYBits
ply pla
bcs .9 bcs .9
dey Range 0-23 ldy #8
jmp Pak.Out.PutYBits
.3 dey Range 0-31
tya tya
lsr lsr
lsr lsr
lsr lsr
tax Range 0-2 tax Range 0-3
tya tya
and #7 and #7
@ -591,15 +583,13 @@ Pak.Out.Init lda Pak.Shnk+S.PAKSHNK.BLBITS
bcs .9 bcs .9
iny iny
cpy Pak.Shnk+S.PAKSHNK.TOPCNT cpy Pak.TOP.Count
bne .1 bne .1
lda #$80 lda #$80
sta Pak.Out.Mask sta Pak.Out.Mask
stz Pak.Out.Byte stz Pak.Out.Byte
stz Pak.Out.StrLen
clc clc
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
@ -610,69 +600,6 @@ Pak.Out.Close bit Pak.Out.Mask
.8 clc .8 clc
rts rts
*-------------------------------------- *--------------------------------------
Pak.Out.Flush lda Pak.Out.StrLen
beq .8
cmp #STR.MIN
bcs .2
ldx #0
.1 ldy #PAK.B.BYTE8.W
lda PAK.B.BYTE8
jsr Pak.Out.PutYBits
bcs .9
inc Pak.Stat+S.PAKSTAT.BYTE8
bne .10
inc Pak.Stat+S.PAKSTAT.BYTE8+1
.10 inx
lda Pak.Out.StrBuf,x
ldy #8
jsr Pak.Out.PutYBits
bcs .9
cpx Pak.Out.StrLen
bne .1
bra .7
.2 dec
dec
dec
ora #PAK.B.STR
ldy #PAK.B.STR.W
jsr Pak.Out.PutYBits
bcs .9
ldx #0
.3 inx
lda Pak.Out.StrBuf,x
ldy #8
jsr Pak.Out.PutYBits
bcs .9
cpx Pak.Out.StrLen
bne .3
cpx Pak.Str.Longest
bcc .7
stx Pak.Str.Longest
ldx #S.PAKSTAT.STR
jsr Pak.UpdateStats
.7 stz Pak.Out.StrLen
.8 clc
.9 rts
*--------------------------------------
Pak.Out.PutYBits Pak.Out.PutYBits
phy phy
@ -753,9 +680,6 @@ Pak.PrintStats lda Pak.BL.OfsBitsL
>PUSHB Pak.REP.Longest >PUSHB Pak.REP.Longest
>PUSHW Pak.Stat+S.PAKSTAT.REPN >PUSHW Pak.Stat+S.PAKSTAT.REPN
>PUSHB Pak.Str.Longest
>PUSHW Pak.Stat+S.PAKSTAT.STR
ldx #S.PAKSTAT.BYTE8 ldx #S.PAKSTAT.BYTE8
.1 >PUSHW Pak.Stat,x .1 >PUSHW Pak.Stat,x
@ -763,16 +687,18 @@ Pak.PrintStats lda Pak.BL.OfsBitsL
dex dex
bpl .1 bpl .1
>PUSHBI 28 >PUSHBI 25
>LDYA L.MSG.Stats >LDYA L.MSG.Stats
>SYSCALL printf >SYSCALL printf
ldx #TOP.MAX ldx #TOP.MAX-1
.2 >PUSHB Pak.Shnk+S.PAKSHNK.TOPCNT,x .2 >PUSHB Pak.Shnk+S.PAKSHNK.TOPBYTES,x
dex dex
bpl .2 bpl .2
>PUSHB Pak.TOP.Count
>PUSHBI TOP.MAX+1 >PUSHBI TOP.MAX+1
>LDYA L.MSG.TopBytes >LDYA L.MSG.TopBytes
>SYSCALL printf >SYSCALL printf
@ -818,10 +744,9 @@ MSG.Stats .AS "\r\nPass 1 : %5D\r\n"
.AS "Top 24 : %5D\r\n" .AS "Top 24 : %5D\r\n"
.AS "Top 32 : %5D\r\n" .AS "Top 32 : %5D\r\n"
.AS "Byte 8 : %5D\r\n" .AS "Byte 8 : %5D\r\n"
.AS "String : %5D, Longest : %d\r\n"
.AS "Rep : %5D, Longest : %d (%d bits)\r\n" .AS "Rep : %5D, Longest : %d (%d bits)\r\n"
.AZ "BL : %5D, Longest : %d (%d bits), Farest : %D (%d bits)\r\n" .AZ "BL : %5D, Longest : %d (%d bits), Farest : %D (%d bits)\r\n"
MSG.TopBytes .AZ "Top : %5d, %h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h\r\n" MSG.TopBytes .AZ "Top : %2d:%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h\r\n"
TOP.Bits .DA #PAK.B.TOP8,#PAK.B.TOP16,#PAK.B.TOP24,#PAK.B.TOP32 TOP.Bits .DA #PAK.B.TOP8,#PAK.B.TOP16,#PAK.B.TOP24,#PAK.B.TOP32
TOP.BitCnt .DA #PAK.B.TOP8.W,#PAK.B.TOP16.W,#PAK.B.TOP24.W,#PAK.B.TOP32.W TOP.BitCnt .DA #PAK.B.TOP8.W,#PAK.B.TOP16.W,#PAK.B.TOP24.W,#PAK.B.TOP32.W
TOP.Stat .DA #S.PAKSTAT.TOP8,#S.PAKSTAT.TOP16,#S.PAKSTAT.TOP24,#S.PAKSTAT.TOP32 TOP.Stat .DA #S.PAKSTAT.TOP8,#S.PAKSTAT.TOP16,#S.PAKSTAT.TOP24,#S.PAKSTAT.TOP32
@ -833,6 +758,8 @@ Pak.DstCnt .BS 2
Pak.bPass2 .BS 1 Pak.bPass2 .BS 1
Pak.TOP.Count .BS 1
Pak.BL.Longest .BS 1 Pak.BL.Longest .BS 1
Pak.BL.Farest .BS 2 Pak.BL.Farest .BS 2
@ -847,9 +774,7 @@ Pak.BestBL .BS 2
Pak.Cnt .BS 2 Pak.Cnt .BS 2
Pak.bStop .BS 1 Pak.bStop .BS 1
Pak.Str.Longest .BS 1
Pak.Rep.Longest .BS 1 Pak.Rep.Longest .BS 1
Pak.Rep.LenBits .BS 1 Pak.Rep.LenBits .BS 1
Pak.RepCnt .BS 1 Pak.RepCnt .BS 1
@ -857,9 +782,6 @@ Pak.LastByte .BS 1
Pak.Out.Byte .BS 1 Pak.Out.Byte .BS 1
Pak.Out.Mask .BS 1 Pak.Out.Mask .BS 1
Pak.Out.StrLen .BS 1
Pak.Out.StrBuf .BS STR.MAX
*-------------------------------------- *--------------------------------------
Pak.CntL .BS 256 Pak.CntL .BS 256
Pak.CntH .BS 256 Pak.CntH .BS 256

View File

@ -153,10 +153,10 @@ STDLIB.realpath.I
>STYA ZPPtr1 >STYA ZPPtr1
stx .99+1 save expanded buffer hMem stx .99+1 save expanded buffer hMem
ldx #$ff ldx #$ff
lda (ZPPtr1) lda (ZPPtr1)
beq .1
cmp #'/' full path starting with '/'? cmp #'/' full path starting with '/'?
beq .3 yes, do not append to current prefix beq .3 yes, do not append to current prefix
@ -189,52 +189,41 @@ STDLIB.realpath.I
*-------------------------------------- *--------------------------------------
* X=LEN, K.Buf256 = /dir1/./../file(/)\0 * X=LEN, K.Buf256 = /dir1/./../file(/)\0
*-------------------------------------- *--------------------------------------
ldx #1 skip leading / ldx #0 will skip leading /
.5 ldy #0 reset dot counter=0
.6 inx
lda K.Buf256,x lda K.Buf256,x
beq .8
.5 ldy #0 dot counter=0 .7 cmp #'/'
.6 cmp #'/'
beq .8 beq .8
cmp #'.' cmp #'.'
bne .7 bne .5
iny iny
.HS 2C BIT ABS, skip "LDY #0" bra .6
.7 ldy #0 not a dot....reset dot counter
inx
lda K.Buf256,x
bne .6 we have /dir\0
.8 tya .8 tya
beq .80 Y was 0....nothing to do... beq .80 Y was 0....nothing to do...
dey "./" ? dey one dot ?
bne .9 no.. bne .9 no..
lda K.Buf256-2,x
cmp #'/' "/./" ?
bne .80
dex dex
dex dex
jsr K.RealPath.RemoveAtX we found "/./", remove,useless.... jsr K.RealPath.RemoveAtX we found "/.", remove,useless....
bra .80 bra .80
.9 dey "../" ? .9 dey "/.." ?
bne .99 ".../" ??!!...mmm...syntax error bne .99 "/..." ??!!...syntax error
lda K.Buf256-3,x
cmp #'/' "/../" ?
bne .80
dex dex
dex dex
dex dex
txa we found "/../" txa we found "/.."
beq .99 at the beginning of string...cannot remove /dir/.. beq .99 at the beginning of string...cannot remove /dir/..
jsr K.RealPath.RemoveAtX remove "/.." jsr K.RealPath.RemoveAtX remove "/.."
@ -245,8 +234,8 @@ STDLIB.realpath.I
bne .10 bne .10
jsr K.RealPath.RemoveAtX ...remove "/dir" jsr K.RealPath.RemoveAtX ...remove "/dir"
.80 inx
lda K.Buf256,x .80 lda K.Buf256,x was / or \0 ?
bne .5 bne .5
*-------------------------------------- *--------------------------------------
.81 jsr .99 .81 jsr .99
@ -274,16 +263,21 @@ K.RealPath.RemoveAtX
.1 iny .1 iny
lda K.Buf256,y lda K.Buf256,y
beq .2 found /something\0 beq .2 found /something\0
cmp #'/' cmp #'/'
bne .1 found /something/ bne .1 found /something/
.2 phx save X for exit .2 phx save X for exit
.3 iny K.Buf256,y=/ or 0 .3 iny K.Buf256,y=/ or 0
inx inx
lda K.Buf256-1,y lda K.Buf256-1,y
sta K.Buf256-1,x sta K.Buf256-1,x
bne .3 bne .3
txa txa
bne .8 bne .8
lda #'/' Make sure we have a least '/' in the buffer lda #'/' Make sure we have a least '/' in the buffer
sta K.Buf256 sta K.Buf256
stz K.Buf256+1 stz K.Buf256+1