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

View File

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

View File

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

View File

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