Kernel 0.9.1 : KERNEL, Preemtive mode, KERNEL & LIB Cleaning

This commit is contained in:
Rémy GIBERT 2018-04-18 16:18:32 +01:00
parent 4e7d011929
commit df9f1d6ac0
11 changed files with 146 additions and 31 deletions

View File

@ -46,7 +46,7 @@ And return, if found, the full path to it.
+ X = DEVID
+ Y,A = DEVSLOT
# K.GetDevStatus.A
# GetDevStatus.A
## IN:
+ A = DevID
@ -54,7 +54,7 @@ And return, if found, the full path to it.
## OUT:
+ Y,A = S.DSTAT
# K.IOCTL
# IOCTL
## IN:
+ PUSHB = DevID

View File

@ -17,7 +17,7 @@
## Out :
+ A = hMem To S.MD5
# MD5Update (Append "$80" & Padding & original size)
# MD5Update
## In:
* PUSHW DATA LEN

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -500,7 +500,7 @@ CS.END
OptionList >PSTR "ALRalr"
OptionVars .DA #bAllmostAll,#bLong,#bRecurse,#bAllmostAll,#bLong,#bRecurse
*--------------------------------------
MSG.DEVEXT .AZ "%15s S%d,D%d Blocks Used:%5D Total:%5D\r\n"
MSG.DEVEXT .AZ "/%15s S%dD%d Blocks Used:%5D Total:%5D\r\n"
MSG.DIR .AZ "\e[32m%s/\e[0m"
MSG.ENTER .AZ "Directory:%s\r\n"
MSG.DIREXT .AZ "\e[32m%16s\e[0m <dir> %s %s %s\r\n"

View File

@ -8,10 +8,13 @@ AUTO 4,1
*--------------------------------------
.INB /A2OSX.BUILD/INC/MACROS.I
.INB /A2OSX.BUILD/INC/A2OSX.I
.INB /A2OSX.BUILD/INC/MLI.ERR.I
.INB /A2OSX.BUILD/INC/LIBCRYPT.I
*--------------------------------------
FILEBUF.SIZE .EQ 4096
*--------------------------------------
ZPPtr1 .EQ ZPBIN
ZPPtr2 .EQ ZPBIN+2
ZPDataBufPtr .EQ ZPBIN+2
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
@ -46,7 +49,7 @@ CS.INIT ldy #S.PS.ARGC
.1 >INC.G ArgIndex
>SYSCALL GetArg.A
bcs .7
bcs .8
>STYA ZPPtr1
@ -76,13 +79,17 @@ CS.INIT ldy #S.PS.ARGC
sta (pData),y
bra .1
.4 >LDA.G hFullPath
.4 >LDA.G Arg
bne .99
.7 >LDA.G bText
>LDA.G ArgIndex
>STA.G Arg
bra .1
.8 >LDYA L.LIBCRYPT
>SYSCALL LoadLib.YA
bcs .9
sta hLIBCRYPT
* lda (pPs)
@ -90,34 +97,117 @@ CS.INIT ldy #S.PS.ARGC
* sta (pPs)
clc
rts
.9 rts
*--------------------------------------
CS.RUN
CS.RUN >LDA.G bText
beq CS.RUN.FILE
*--------------------------------------
CS.RUN.TEXT >LDA.G Arg
>SYSCALL GetArg.A
>PUSHYA
>PUSHEA.G MD5Buf
>LDYA L.MSG.OK
>LIBCALL hLIBCRYPT,LIBCRYPT.MD5
bcs .9
>LEA.G MD5Buf
>SYSCALL PrintF.YA
lda #13
>SYSCALL PutChar.A
lda #10
>SYSCALL PutChar.A
lda #0
sec
.9 rts
*--------------------------------------
CS.RUN.FILE >LDA.G Arg
>SYSCALL GetArg.A
>SYSCALL RealPath.YA
bcc .10
rts
.9 pha
>PUSHA
>LDYA L.MSG.ERR
.10 txa
>STA.G hFullPath
>LDYAI FILEBUF.SIZE
>SYSCALL GetMem.YA
bcs .9
>STYA ZPDataBufPtr
txa
>STA.G hDataBuf
>PUSHWI 0 Aux type
>PUSHBI 0
>PUSHBI SYS.FOpen.R
>LDA.G hFullPath
>SYSCALL GetMemPtr.A
>PUSHYA
>SYSCALL FOpen
bcs .9
>STA.G hFile
>LIBCALL hLIBCRYPT,LIBCRYPT.MD5Init
bcs .9
>STA.G hMD5Ctx
.1 >PUSHW ZPDataBufPtr Dst Ptr
>PUSHWI FILEBUF.SIZE Bytes To Read
>PUSHB.G hFile
>SYSCALL FRead
bcc .2
eor #MLI.E.EOF
beq .8
.9 rts
.2 >PUSHYA MD5 DataLen
>PUSHW ZPDataBufPtr
>PUSHB.G hMD5Ctx
>LIBCALL hLIBCRYPT,LIBCRYPT.MD5Update
bra .1
.8 >PUSHEA.G MD5Buf
>PUSHB.G hMD5Ctx
>LIBCALL hLIBCRYPT,LIBCRYPT.MD5Finalize
>LEA.G MD5Buf
>SYSCALL PrintF.YA
pla
lda #13
>SYSCALL PutChar.A
lda #10
>SYSCALL PutChar.A
lda #0
sec
rts
*--------------------------------------
CS.DOEVENT sec
rts
*--------------------------------------
CS.QUIT >LDA.G hDataBuf
CS.QUIT >LDA.G hFullPath
beq .1
>SYSCALL FreeMem.A
.1 >LDA.G hDataBuf
beq .2
>SYSCALL FreeMem.A
.2 >LDA.G hFile
beq .3
>SYSCALL FClose.A
.3
.1 lda hLIBCRYPT
.7 lda hLIBCRYPT
beq .8
>SYSCALL UnloadLib.A
@ -149,7 +239,7 @@ CS.END
OptionList >PSTR "Dd"
OptionVars .DA #bText,#bText
*--------------------------------------
MSG.USAGE .AZ "Usage : MD5 [ -d input_text | infile… ] \r\n"
MSG.USAGE .AZ "Usage : MD5 [ -d input text | input file ]\r\n"
MSG.OK .AZ "[OK]\r\n"
MSG.ERR .AZ "[%h]\r\n"
MSG.INIT .AZ "Computing %s ..."
@ -161,10 +251,13 @@ hLIBCRYPT .BS 1
.OR 0
DS.START
ArgIndex .BS 1
Arg .BS 1
bText .BS 1
hFullPath .BS 1
hFile .BS 1
hDataBuf .BS 1
hMD5CtxBuf .BS 1
hMD5Ctx .BS 1
MD5Buf .BS 33
DS.END .ED
*--------------------------------------
MAN

View File

@ -132,7 +132,7 @@ MD5 >PULLW ZPHashPtr
pha save MD5 Context hMem
jsr MD5Update.I
jsr MD5Finalize
jsr MD5Finalize.I
pla
>SYSCALL FreeMem.A Free MD5 Context
@ -170,7 +170,7 @@ MD5Init >LDYAI S.MD5.SIZE
clc
.9 rts
*/--------------------------------------
* # MD5Update (Append "$80" & Padding & original size)
* # MD5Update
* ## In:
* PUSHW DATA LEN
* PUSHW DATA PTR
@ -186,8 +186,10 @@ MD5Update >PULLA get MD5 Context
MD5Update.I ldy #S.MD5.FINALIZED
lda (ZPCtxPtr),y
beq .1
sec
rts
.1 lda ZPDataLen+1 More than 256 Bytes remaining to hash ?
bne .3 yes
lda ZPDataLen
@ -197,47 +199,61 @@ MD5Update.I ldy #S.MD5.FINALIZED
.2 cmp #64 More than 64 Bytes remaining to hash ?
bcc .50 yes
.3 lda #64
.50 sta ZPChunkLen Save Chunk Len
jsr MD5UpdateBitCount
ldy #0
.51 lda (ZPDataPtr),y Load Buffer with data
sta MD5.BUFFER64,y
iny
cpy ZPChunkLen
bne .51
cpy #64 Full 64 Bytes DATA ?
beq .58
* Append "$80" & Padding & original size
lda #$80 no, Append $80
sta MD5.BUFFER64,y
lda #0
.52 iny Pad with 0 to 64
cpy #64
beq .53
sta MD5.BUFFER64,y
bra .52
.53 ldy #S.MD5.EXTRABIT Mark MD5 Context as Appended
lda #$80
sta (ZPCtxPtr),y
lda ZPChunkLen
cmp #56 Enough room for BITCOUNT ?
bcs .58 no
jsr MD5AppendBitCount
.58 jsr MD5Transform
jsr MD5UpdateABCD0
.8 lda ZPDataLen Substract Bytes processed from LEN
sec
sbc ZPChunkLen get back chunk Len
sta ZPDataLen
bcs .81
dec ZPDataLen+1
.81 lda ZPDataPtr Add Bytes processed to DATA
clc
adc ZPChunkLen
sta ZPDataPtr
bcc .82
bcc .1
inc ZPDataPtr+1
.82 bra .1
bra .1
*/--------------------------------------
* # MD5Finalize
* ## In :
@ -246,11 +262,18 @@ MD5Update.I ldy #S.MD5.FINALIZED
* ## Out:
*\--------------------------------------
MD5Finalize >PULLA
pha
>SYSCALL GetMemPtr.A
>STYA ZPCtxPtr get MD5 Context
>PULLW ZPHashPtr
jsr MD5Finalize.I
pla
>SYSCALL FreeMem.A
rts
MD5Finalize.I ldy #S.MD5.FINALIZED
lda (ZPCtxPtr),y

View File

@ -234,6 +234,7 @@ note : '$VAR' does NOT expand Variable
| CHGRP | In Progress | -C : Continue On Error | 0.9 |
| | | -R : Recurse subdirectories | |
| FORMAT | In Progress | -L : Low-Level Format | 0.9.1 |
| MD5 | In Progress | -D : String Input | 0.9.1 |
| EDIT | Working | still missing : find/replace | 0.9.1 |
| NSCUTIL | Working | Tool for setting time in NSC/DL1216E | 0.9 |
| ---- | ------ | ------- | ----- |

View File

@ -70,7 +70,7 @@ K.GetDevByName.YA
K.GetDevDNF lda #MLI.E.NODEV CS from cpx/beq
rts
*/--------------------------------------
* # K.GetDevStatus.A
* # GetDevStatus.A
* ## IN:
* A = DevID
* ## OUT:
@ -87,7 +87,7 @@ K.GetDevStatus.A
jmp (pDev)
*/--------------------------------------
* # K.IOCTL
* # IOCTL
* ## IN:
* PUSHB = DevID
* PUSHB = Operation

View File

@ -180,8 +180,6 @@ PS.CmdLine2Args >STYA ZPPtr1
.1 lda (ZPPtr1),y compute strlen in Y,X
beq .2
cmp #'"' skip " in computation....
beq .1
iny
bne .1 max 255