mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-22 16:31:07 +00:00
Kernel 0.93++
This commit is contained in:
parent
b6f7d0ec1a
commit
c0a6c74550
112
SYS/KERNEL.S.MD5.txt
Normal file
112
SYS/KERNEL.S.MD5.txt
Normal file
@ -0,0 +1,112 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*/--------------------------------------
|
||||
* ## MD5
|
||||
* Return MD5 Hash for input String
|
||||
* # C
|
||||
* `void md5 (const char* str, char* digest);`
|
||||
* # ASM
|
||||
* `>PUSHW str`
|
||||
* `>PUSHW digest`
|
||||
* `>SYSCALL md5`
|
||||
* ## RETURN VALUE
|
||||
* CC
|
||||
*\--------------------------------------
|
||||
K.MD5 >PULLW FORPNT
|
||||
>PULLYA
|
||||
>STYA TXTPTR
|
||||
|
||||
>SYSCALL2 strlen
|
||||
>STYA ZPDataLen
|
||||
|
||||
sta SETREADAUX
|
||||
sta SETWRITEAUX
|
||||
|
||||
.1 jsr K.MD5Init.I
|
||||
bcs .9
|
||||
pha save MD5 Context hMem
|
||||
|
||||
jsr MD5Update.I
|
||||
jsr MD5Finalize.I
|
||||
pla
|
||||
>SYSCALL2 FreeMem Free MD5 Context
|
||||
clc
|
||||
|
||||
.9 sta CLRREADAUX
|
||||
sta CLRWRITEAUX
|
||||
rts
|
||||
*/--------------------------------------
|
||||
* ## MD5Init
|
||||
* Initialize a MD5 computation
|
||||
* # C
|
||||
* `hMD5 md5init ();`
|
||||
* # ASM
|
||||
* `>SYSCALL MD5Init`
|
||||
* ## RETURN VALUE
|
||||
* A = hMem To S.MD5
|
||||
*\--------------------------------------
|
||||
K.MD5Init sta SETREADAUX
|
||||
sta SETWRITEAUX
|
||||
|
||||
jsr K.MD5Init.I
|
||||
|
||||
sta CLRREADAUX
|
||||
sta CLRWRITEAUX
|
||||
rts
|
||||
*/--------------------------------------
|
||||
* ## MD5Update
|
||||
* Add Data to MD5 computation
|
||||
* # C
|
||||
* `void md5update (hMD5 md5, char* data, int len);`
|
||||
* # ASM
|
||||
* `>PUSHB md5`
|
||||
* `>PUSHW data`
|
||||
* `>PUSHW len`
|
||||
* `>SYSCALL MD5Update`
|
||||
* ## RETURN VALUE
|
||||
*\--------------------------------------
|
||||
K.MD5Update >PULLW ZPDataLen get LEN
|
||||
>PULLW TXTPTR get DATA
|
||||
>PULLA
|
||||
>SYSCALL2 GetMemPtr get MD5 Context
|
||||
>STYA ZPCtxPtr
|
||||
|
||||
sta SETREADAUX
|
||||
sta SETWRITEAUX
|
||||
|
||||
jsr K.MD5Update.I
|
||||
|
||||
sta CLRREADAUX
|
||||
sta CLRWRITEAUX
|
||||
rts
|
||||
*/--------------------------------------
|
||||
* ## MD5Finalize
|
||||
* # C
|
||||
* `void md5finalize (hMD5 md5, char* digest);`
|
||||
* # ASM
|
||||
* `>PUSHB md5`
|
||||
* `>PUSHW digest`
|
||||
* `>SYSCALL MD5Finalize`
|
||||
* ## RETURN VALUE
|
||||
*\--------------------------------------
|
||||
K.MD5Finalize >PULLW FORPNT
|
||||
>PULLA
|
||||
sta .8+1
|
||||
>SYSCALL2 GetMemPtr
|
||||
>STYA ZPCtxPtr get MD5 Context
|
||||
|
||||
sta SETREADAUX
|
||||
sta SETWRITEAUX
|
||||
|
||||
jsr MD5Finalize.I
|
||||
|
||||
.8 lda #$ff SELF MODIFIED
|
||||
>SYSCALL2 FreeMem
|
||||
sta CLRREADAUX
|
||||
sta CLRWRITEAUX
|
||||
rts
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE USR/SRC/SYS/KERNEL.S.MD5
|
||||
LOAD USR/SRC/SYS/KERNEL.S
|
||||
ASM
|
@ -79,46 +79,8 @@ ZS.END .ED
|
||||
dex
|
||||
bne :2
|
||||
.EM
|
||||
*/--------------------------------------
|
||||
* ## MD5
|
||||
* Return MD5 Hash for input String
|
||||
* # C
|
||||
* `void md5 (const char* str, char* digest);`
|
||||
* # ASM
|
||||
* `>PUSHW str`
|
||||
* `>PUSHW digest`
|
||||
* `>SYSCALL md5`
|
||||
* ## RETURN VALUE
|
||||
* CC
|
||||
*\--------------------------------------
|
||||
K.MD5 >PULLW FORPNT
|
||||
>PULLYA
|
||||
>STYA TXTPTR
|
||||
|
||||
>SYSCALL2 strlen
|
||||
>STYA ZPDataLen
|
||||
|
||||
.1 jsr K.MD5Init
|
||||
bcs .9
|
||||
pha save MD5 Context hMem
|
||||
|
||||
jsr MD5Update.I
|
||||
jsr MD5Finalize.I
|
||||
pla
|
||||
>SYSCALL2 FreeMem Free MD5 Context
|
||||
clc
|
||||
.9 rts
|
||||
*/--------------------------------------
|
||||
* ## MD5Init
|
||||
* Initialize a MD5 computation
|
||||
* # C
|
||||
* `hMD5 md5init ();`
|
||||
* # ASM
|
||||
* `>SYSCALL MD5Init`
|
||||
* ## RETURN VALUE
|
||||
* A = hMem To S.MD5
|
||||
*\--------------------------------------
|
||||
K.MD5Init >LDYAI S.MD5
|
||||
*--------------------------------------
|
||||
K.MD5Init.I >LDYAI S.MD5
|
||||
>SYSCALL2 getmem
|
||||
bcs .9
|
||||
|
||||
@ -142,24 +104,7 @@ K.MD5Init >LDYAI S.MD5
|
||||
|
||||
clc
|
||||
.9 rts
|
||||
*/--------------------------------------
|
||||
* ## MD5Update
|
||||
* Add Data to MD5 computation
|
||||
* # C
|
||||
* `void md5update (hMD5 md5, char* data, int len);`
|
||||
* # ASM
|
||||
* `>PUSHB md5`
|
||||
* `>PUSHW data`
|
||||
* `>PUSHW len`
|
||||
* `>SYSCALL MD5Update`
|
||||
* ## RETURN VALUE
|
||||
*\--------------------------------------
|
||||
K.MD5Update >PULLW ZPDataLen get LEN
|
||||
>PULLW TXTPTR get DATA
|
||||
>PULLA
|
||||
>SYSCALL2 GetMemPtr get MD5 Context
|
||||
>STYA ZPCtxPtr
|
||||
|
||||
*--------------------------------------
|
||||
MD5Update.I ldy #S.MD5.FINALIZED
|
||||
lda (ZPCtxPtr),y
|
||||
beq .1
|
||||
@ -220,28 +165,7 @@ MD5Update.I ldy #S.MD5.FINALIZED
|
||||
bcc .1
|
||||
inc TXTPTR+1
|
||||
bra .1
|
||||
*/--------------------------------------
|
||||
* ## MD5Finalize
|
||||
* # C
|
||||
* `void md5finalize (hMD5 md5, char* digest);`
|
||||
* # ASM
|
||||
* `>PUSHB md5`
|
||||
* `>PUSHW digest`
|
||||
* `>SYSCALL MD5Finalize`
|
||||
* ## RETURN VALUE
|
||||
*\--------------------------------------
|
||||
K.MD5Finalize >PULLW FORPNT
|
||||
>PULLA
|
||||
sta .8+1
|
||||
>SYSCALL2 GetMemPtr
|
||||
>STYA ZPCtxPtr get MD5 Context
|
||||
|
||||
jsr MD5Finalize.I
|
||||
|
||||
.8 lda #$ff SELF MODIFIED
|
||||
>SYSCALL2 FreeMem
|
||||
rts
|
||||
|
||||
*--------------------------------------
|
||||
MD5Finalize.I ldy #S.MD5.FINALIZED
|
||||
|
||||
lda (ZPCtxPtr),y
|
||||
|
Loading…
Reference in New Issue
Block a user