Kernel 0.93+

This commit is contained in:
Rémy GIBERT 2019-09-08 14:09:47 +02:00
parent 9251e05c0f
commit 3ca18cfac6
6 changed files with 83 additions and 41 deletions

Binary file not shown.

Binary file not shown.

View File

@ -27,8 +27,9 @@ CORE.Load.YAX stx M32.ACC X = Code to Execute
jsr CORE.ArgV.Dup Y,A = ArgV
bcs .9
sta M32.ACC+2 A = ARGC
stx M32.ACC+1 X = hARGV
sta M32.ACC+2 A = ARGC
lda #8
jsr CORE.StkCheck
@ -406,12 +407,12 @@ CORE.ArgV.Dup >STYA ZPPtr1
phx
ldx #$ff Arg count-1 (skip $0)
.5 inx
jsr StrCpyPtr1Ptr2
.5 jsr StrCpyPtr1Ptr2
tya
beq .8
inx
jsr AddAp1Ptr2
jsr AddYp1Ptr1
bra .5

View File

@ -219,6 +219,7 @@ CS.RUN jsr CL.Init
jsr IO.Load
bcs CS.INIT.RTS
phx
ldy #S.PS.hARGV
lda (pPS),y

View File

@ -9,11 +9,25 @@ NEW
.INB INC/A2OSX.I
.INB INC/LIBCRYPT.I
*--------------------------------------
ZPCtxPtr .EQ ZPLIB
ZPDataPtr .EQ ZPLIB+2
ZPDataLen .EQ ZPLIB+4
ZPChunkLen .EQ ZPLIB+6
ZPHashPtr .EQ ZPLIB+8
.DUMMY
.OR ZPLIB
ZS.START
ZPCtxPtr .BS 2
ZPDataPtr .BS 2
ZPHashPtr .BS 2
ZPChunkLen .BS 2
MD5.ABCD
MD5.A .BS 4 Chunk Level,A,B,C,D
MD5.B .BS 4
MD5.C .BS 4
MD5.D .BS 4
MD5.F1 .BS 4
MD5.F2 .BS 4
ZS.END .ED
*--------------------------------------
* DWORD Macros : Do NOT disturb carry with cpx, cpy...
*--------------------------------------
@ -104,6 +118,10 @@ CS.START cld
.DA MD5Init
.DA MD5Update
.DA MD5Finalize
J.MD5.XXXX .DA MD5.0015
.DA MD5.1631
.DA MD5.3247
.DA MD5.4863
.DA 0
*--------------------------------------
LIB.LOAD
@ -334,12 +352,14 @@ MD5Finalize.I ldy #S.MD5.FINALIZED
MD5AppendBitCount
ldx #56
ldy #S.MD5.BITCOUNT Append 8 Bytes of BITCOUNT
.1 lda (ZPCtxPtr),y
sta MD5.BUFFER64,x
inx
iny
cpy #S.MD5.BITCOUNT+8
bne .1
ldy #S.MD5.FINALIZED Mark MD5 Context as Finalized
lda #$80
sta (ZPCtxPtr),y
@ -368,13 +388,16 @@ MD5UpdateBitCount
adc (ZPCtxPtr),y
sta (ZPCtxPtr),y
bcc .8
.1 iny
lda (ZPCtxPtr),y
inc
sta (ZPCtxPtr),y
bne .8
cpy #7
bne .1
.8 rts
*--------------------------------------
* MD5ExtraChunk
@ -388,14 +411,17 @@ MD5ExtraChunk ldy #S.MD5.FINALIZED
ldy #S.MD5.EXTRABIT Extra Bit already appended ?
lda (ZPCtxPtr),y
bne .1
lda #$80
sta MD5.BUFFER64 Add extra bit to buffer
sta (ZPCtxPtr),y Mark Extrabit added
inx
.1 stz MD5.BUFFER64,x pad with "0"...
inx
cpx #56
bne .1 ...until room for bitcount
jsr MD5AppendBitCount
jsr MD5Transform
*--------------------------------------
@ -404,7 +430,9 @@ MD5ExtraChunk ldy #S.MD5.FINALIZED
* ZPCtxPtr = MD5 Context
*--------------------------------------
MD5UpdateABCD0 ldy #0
.1 clc ADC32 A+A0->A0, B, C, D....
.2 lda MD5.ABCD,y
adc (ZPCtxPtr),y
sta (ZPCtxPtr),y
@ -412,8 +440,10 @@ MD5UpdateABCD0 ldy #0
tya
and #3
bne .2
cpy #16
bne .1
rts
*--------------------------------------
* MD5Transform
@ -424,52 +454,65 @@ MD5UpdateABCD0 ldy #0
* Updated MD5.ABCD
*--------------------------------------
MD5Transform ldy #15 init ABCD Chunk with Context ABCD0
.1 lda (ZPCtxPtr),y
sta MD5.ABCD,y
dey
bpl .1
stz MD5.i Start Proceed 0 to 63 bytes
lda #0 lda MD5.i
.2 lsr
lsr
lsr
and #6
tax
jsr MD5.XXXX
inc MD5.i
lda MD5.i
cmp #64
bne .2
rts
*--------------------------------------
MD5.0015 lda MD5.i
cmp #16
bcs MD5.1631
>AND32 MD5.B,MD5.C,MD5.F1
MD5.XXXX jmp (J.MD5.XXXX,x)
*--------------------------------------
MD5.0015 >AND32 MD5.B,MD5.C,MD5.F1
>NOT32 MD5.B,MD5.F2
>AND32 MD5.F2,MD5.D,MD5.F2
>ORA32 MD5.F1,MD5.F2,MD5.F
jmp MD5.NEXTi
bra MD5.XXXX.END
*--------------------------------------
MD5.1631 cmp #32
bcs MD5.3247
>AND32 MD5.D,MD5.B,MD5.F1
MD5.1631 >AND32 MD5.D,MD5.B,MD5.F1
>NOT32 MD5.D,MD5.F2
>AND32 MD5.F2,MD5.C,MD5.F2
>ORA32 MD5.F1,MD5.F2,MD5.F
jmp MD5.NEXTi
bra MD5.XXXX.END
*--------------------------------------
MD5.3247 cmp #48
bcs MD5.4863
>EOR32 MD5.B,MD5.C,MD5.F
MD5.3247 >EOR32 MD5.B,MD5.C,MD5.F
>EOR32 MD5.F,MD5.D,MD5.F
jmp MD5.NEXTi
bra MD5.XXXX.END
*--------------------------------------
MD5.4863 cmp #64
bne .1
rts
.1 >NOT32 MD5.D,MD5.F1
MD5.4863 >NOT32 MD5.D,MD5.F1
>ORA32 MD5.F1,MD5.B,MD5.F2
>EOR32 MD5.F2,MD5.C,MD5.F
*--------------------------------------
MD5.NEXTi >MOV32 MD5.D,MD5.DTemp
MD5.XXXX.END >MOV32 MD5.D,MD5.DTemp
>MOV32 MD5.C,MD5.D
>MOV32 MD5.B,MD5.C
>ADC32 MD5.A,MD5.F,MD5.F
lda MD5.i
asl
asl
tay
ldx #0
clc
.1 lda MD5.K,y ADC32 MD5.K[i],MD5.F,MD5.F
adc MD5.F,x
sta MD5.F,x
@ -478,6 +521,7 @@ MD5.NEXTi >MOV32 MD5.D,MD5.DTemp
txa
eor #4 DO NOT DISTURB carry with cpx !!!
bne .1
ldy MD5.i
lda MD5.g,y
asl
@ -485,6 +529,7 @@ MD5.NEXTi >MOV32 MD5.D,MD5.DTemp
tay
ldx #0
clc
.2 lda MD5.BUFFER64,y ADC32 M[g],MD5.F,MD5.F
adc MD5.F,x
sta MD5.F,x
@ -493,14 +538,14 @@ MD5.NEXTi >MOV32 MD5.D,MD5.DTemp
txa
eor #4 DO NOT DISTURB carry with cpx !!!
bne .2
ldy MD5.i
lda MD5.s,y get s[i] in x
tax
ldx MD5.s,y get s[i] in x
>ROL32x MD5.F
>ADC32 MD5.B,MD5.F,MD5.B
>MOV32 MD5.DTemp,MD5.A
inc MD5.i
jmp MD5.0015
rts
*--------------------------------------
CS.END
MD5.ABCDINIT .HS 01234567.89ABCDEF.FEDCBA98.76543210
@ -534,15 +579,10 @@ MD5.K .HS 78A46AD7.56B7C7E8.DB702024.EECEBDC1
*--------------------------------------
MD5.DIGITS .AS "0123456789ABCDEF"
*--------------------------------------
MD5.ABCD
MD5.A .BS 4 Chunk Level,A,B,C,D
MD5.B .BS 4
MD5.C .BS 4
MD5.D .BS 4
ZPDataLen .BS 2
MD5.DTemp .BS 4
MD5.F .BS 4
MD5.F1 .BS 4
MD5.F2 .BS 4
MD5.i .BS 1
MD5.BUFFER64 .BS 64
*--------------------------------------

View File

@ -522,15 +522,15 @@ ENV.SysVarsArgs lda #1
bcs ENV.SysVarsNum.8
>STYA ZPPtr3
.1 lda (ZPPtr3)
beq ENV.SysVarsNum
beq ENV.SysVarsNum.8
.2 jsr ENV.AddP3ToBuf
jsr ENV.NextEnvP3
lda (ZPPtr3)
beq ENV.SysVarsNum
beq ENV.SysVarsNum.8
lda #' '
jsr ENV.AddAToBuf