nightly
This commit is contained in:
parent
74437f19f9
commit
d42c9facf5
10
FSHa.asm
10
FSHa.asm
|
|
@ -19,13 +19,18 @@ Setup:
|
||||||
|
|
||||||
CALL printmotd
|
CALL printmotd
|
||||||
|
|
||||||
|
ld hl, teststr
|
||||||
|
ld de, testkey
|
||||||
|
call xorcrypt
|
||||||
|
call _PutS
|
||||||
|
|
||||||
Input:
|
Input:
|
||||||
;; TODO: Update status bar sometimes
|
;; TODO: Update status bar sometimes
|
||||||
LD A, $00
|
LD A, $00
|
||||||
CALL commandfill
|
CALL commandfill
|
||||||
|
|
||||||
LD HL, PS1
|
LD HL, PS1
|
||||||
CALL printprompt
|
;CALL printprompt
|
||||||
|
|
||||||
LD HL, FshCmd
|
LD HL, FshCmd
|
||||||
LD DE, FshCmdInptSize
|
LD DE, FshCmdInptSize
|
||||||
|
|
@ -75,4 +80,7 @@ FshFlags: .DB %00000000
|
||||||
#include "includes/man-db.asm"
|
#include "includes/man-db.asm"
|
||||||
#include "includes/Command.asm"
|
#include "includes/Command.asm"
|
||||||
|
|
||||||
|
teststr: .db "BADww", 0
|
||||||
|
testkey: .db "OT", 0
|
||||||
|
|
||||||
.end
|
.end
|
||||||
|
|
|
||||||
BIN
bin/FSHa.8xp
BIN
bin/FSHa.8xp
Binary file not shown.
6370
bin/FSHa.lst
6370
bin/FSHa.lst
File diff suppressed because it is too large
Load Diff
2
build
2
build
|
|
@ -1,3 +1,3 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
date
|
date
|
||||||
spasm -ETA "FSHa.asm" "bin/FSHa.8xp"
|
spasm -E -T "FSHa.asm" "bin/FSHa.8xp"
|
||||||
|
|
|
||||||
|
|
@ -12,15 +12,30 @@ cryptocmdroute:
|
||||||
|
|
||||||
cryptocmdmanroute:
|
cryptocmdmanroute:
|
||||||
pop bc
|
pop bc
|
||||||
|
subroutestrjp(cryptocmdENCRYPT, cryptocmdROT, cryptocmdROTm)
|
||||||
|
subroutestrjp(cryptocmdDECRYPT, cryptocmdunROT, cryptocmdunROTm)
|
||||||
|
|
||||||
|
subroutestrjp(cryptocmdENCRYPT, cryptocmdHELP, cryptocmdHELPm)
|
||||||
|
subroutestrjp(cryptocmdDECRYPT, cryptocmdHELP, cryptocmdHELPm)
|
||||||
|
|
||||||
routestrjp(cryptocmdENCRYPT, cryptocmdENCRYPTm)
|
routestrjp(cryptocmdENCRYPT, cryptocmdENCRYPTm)
|
||||||
routeoptjp(cryptocmdDECRYPTo, cryptocmdDECRYPTf)
|
routestrjp(cryptocmdDECRYPT, cryptocmdDECRYPTm)
|
||||||
|
|
||||||
push bc
|
push bc
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
cryptocmdmanrouteu:
|
cryptocmdmanrouteu:
|
||||||
pop bc
|
pop bc
|
||||||
|
subrouteustrjp(cryptocmdENCRYPT, cryptocmdROT, cryptocmdROTu)
|
||||||
|
subrouteustrjp(cryptocmdDECRYPT, cryptocmdunROT, cryptocmdunROTu)
|
||||||
|
|
||||||
|
subrouteustrjp(cryptocmdENCRYPT, cryptocmdHELP, cryptocmdHELPu)
|
||||||
|
subrouteustrjp(cryptocmdDECRYPT, cryptocmdHELP, cryptocmdHELPu)
|
||||||
|
|
||||||
routeustrjp(cryptocmdENCRYPT, cryptocmdENCRYPTu)
|
routeustrjp(cryptocmdENCRYPT, cryptocmdENCRYPTu)
|
||||||
routeustrjp(cryptocmdDECRYPTo, cryptocmdDECRYPTf)
|
routeustrjp(cryptocmdDECRYPT, cryptocmdDECRYPTu)
|
||||||
|
|
||||||
push bc
|
push bc
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
#include "includes/CryptoCommands/ENCRYPT.asm"
|
#include "includes/CryptoCommands/ENCRYPT.asm"
|
||||||
#include "includes/CryptoCommands/ROT.asm"
|
#include "includes/CryptoCommands/ROT.asm"
|
||||||
|
|
||||||
|
#include "includes/CryptoCommands/HELP.asm"
|
||||||
|
|
||||||
#include "includes/CryptoCommands/DECRYPT.asm"
|
#include "includes/CryptoCommands/DECRYPT.asm"
|
||||||
#include "includes/CryptoCommands/unROT.asm"
|
#include "includes/CryptoCommands/unROT.asm"
|
||||||
|
|
@ -20,10 +20,16 @@ cryptocmdDECRYPTfArg0Get:
|
||||||
call inputstr
|
call inputstr
|
||||||
call _NewLine
|
call _NewLine
|
||||||
cryptocmdDECRYPTfExe:
|
cryptocmdDECRYPTfExe:
|
||||||
|
|
||||||
|
#macro cryptocmdDECRYPTcmpjp(cmdX, cmdXf)
|
||||||
ld hl, FshCmdArg0
|
ld hl, FshCmdArg0
|
||||||
ld de, cryptocmdunROT
|
ld de, CmdX
|
||||||
call strcmp
|
call strcmp
|
||||||
jp z, cryptocmdunROTf
|
jp z, cmdXf
|
||||||
|
#endmacro
|
||||||
|
|
||||||
|
cryptocmdDECRYPTcmpjp(cryptocmdunROT, cryptocmdunROTf)
|
||||||
|
cryptocmdDECRYPTcmpjp(cryptocmdHELP, cryptocmdHELPf)
|
||||||
|
|
||||||
ld hl, FshCmdArg0
|
ld hl, FshCmdArg0
|
||||||
ld de, FshCmd
|
ld de, FshCmd
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
cryptocmdENCRYPT: .db "ENCRYPT", 0
|
cryptocmdENCRYPT: .db "ENCRYPT", 0
|
||||||
cryptocmdENCRYPTo: .db $40
|
cryptocmdENCRYPTo: .db $40
|
||||||
cryptocmdENCRYPTm: .db "Encrypts a string using a cypher. see 'ENCRYPT HELP' for info on cyphers", 0
|
cryptocmdENCRYPTm: .db "Encrypts a string using a cypher. see 'ENCRYPT HELP' for info on cyphers", 0
|
||||||
cryptocmdENCRYPTu: .db "ENCRYPT <Crypt Command>", 0
|
cryptocmdENCRYPTu: .db "ENCRYPT <Crypt Command> <Crypt Args>", 0
|
||||||
cryptocmdENCRYPTf:
|
cryptocmdENCRYPTf:
|
||||||
cryptocmdENCRYPTfArg0:
|
cryptocmdENCRYPTfArg0:
|
||||||
ld hl, FshCmdArgFlags
|
ld hl, FshCmdArgFlags
|
||||||
|
|
@ -20,10 +20,16 @@ cryptocmdENCRYPTfArg0Get:
|
||||||
call inputstr
|
call inputstr
|
||||||
call _NewLine
|
call _NewLine
|
||||||
cryptocmdENCRYPTfExe:
|
cryptocmdENCRYPTfExe:
|
||||||
|
|
||||||
|
#macro cryptocmdENCRYPTcmpjp(cmdX, cmdXf)
|
||||||
ld hl, FshCmdArg0
|
ld hl, FshCmdArg0
|
||||||
ld de, cryptocmdROT
|
ld de, CmdX
|
||||||
call strcmp
|
call strcmp
|
||||||
jp z, cryptocmdROTf
|
jp z, cmdXf
|
||||||
|
#endmacro
|
||||||
|
|
||||||
|
cryptocmdENCRYPTcmpjp(cryptocmdROT, cryptocmdROTf)
|
||||||
|
cryptocmdENCRYPTcmpjp(cryptocmdHELP, cryptocmdHELPf)
|
||||||
|
|
||||||
ld hl, FshCmdArg0
|
ld hl, FshCmdArg0
|
||||||
ld de, FshCmd
|
ld de, FshCmd
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
cryptocmdHELP: .db "HELP", 0
|
||||||
|
cryptocmdHELPm: .db "Help for cyphers", 0
|
||||||
|
cryptocmdHELPu: .db "ENCRYPT HELP", 0
|
||||||
|
cryptocmdHELPf:
|
||||||
|
ld hl, FshCmdArgFlags
|
||||||
|
bit 2, (hl)
|
||||||
|
jr z, cryptocmdHELPfExe
|
||||||
|
ld hl, ErrUsageo
|
||||||
|
call ErrSet
|
||||||
|
call ErrCatch
|
||||||
|
cryptocmdHELPfExe:
|
||||||
|
ld hl, cryptocmdHELPfLine1
|
||||||
|
call _PutS
|
||||||
|
call _NewLine
|
||||||
|
|
||||||
|
#macro cryptocmdHELPmRow1(cmdXs)
|
||||||
|
xor a
|
||||||
|
ld (curCol), a
|
||||||
|
ld hl, cmdXs
|
||||||
|
call _PutS
|
||||||
|
call _NewLine
|
||||||
|
#endmacro
|
||||||
|
#macro cryptocmdHELPmRowU(cmdXs, cmdXu)
|
||||||
|
xor a
|
||||||
|
ld (curCol), a
|
||||||
|
ld hl, cmdXs
|
||||||
|
call _PutS
|
||||||
|
ld a, ':'
|
||||||
|
call _PutC
|
||||||
|
ld a, ' '
|
||||||
|
call _PutC
|
||||||
|
ld hl, cmdXu
|
||||||
|
call _PutS
|
||||||
|
call _NewLine
|
||||||
|
#endmacro
|
||||||
|
#macro cryptocmdHELPmRow2(cmdXs, cmdYs)
|
||||||
|
xor a
|
||||||
|
ld (curCol), a
|
||||||
|
ld hl, cmdXs
|
||||||
|
call _PutS
|
||||||
|
ld a, 9
|
||||||
|
ld (curcol), a
|
||||||
|
ld hl, cmdYs
|
||||||
|
call _PutS
|
||||||
|
call _NewLine
|
||||||
|
#endmacro
|
||||||
|
#macro cryptocmdHELPmRow3(cmdXs, cmdYs, cmdZs)
|
||||||
|
xor a
|
||||||
|
ld (curCol), a
|
||||||
|
ld hl, cmdXs
|
||||||
|
call _PutS
|
||||||
|
ld a, 9
|
||||||
|
ld (curcol), a
|
||||||
|
ld hl, cmdYs
|
||||||
|
call _PutS
|
||||||
|
ld a, 19
|
||||||
|
ld (curcol), a
|
||||||
|
ld hl, cmdZs
|
||||||
|
call _PutS
|
||||||
|
call _NewLine
|
||||||
|
#endmacro
|
||||||
|
|
||||||
|
cryptocmdHELPmRowU(cryptocmdROT, cryptocmdROTu)
|
||||||
|
|
||||||
|
call _NewLine
|
||||||
|
jp Fin
|
||||||
|
|
||||||
|
cryptocmdHELPfLine1: .db "Available Cryptos:", 0
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
cryptocmdROT: .db "ROT", 0
|
cryptocmdROT: .db "ROT", 0
|
||||||
cryptocmdROTm: .db "ROT Cypher, rotates the alphabet and encodes a string", 0
|
cryptocmdROTm: .db "ROT: Cypher, rotates the alphabet and encodes a string", 0
|
||||||
cryptocmdROTu: .db "ROT <shift#>", 0
|
cryptocmdROTu: .db "ENCRYPT ROT <shift#>", 0
|
||||||
cryptocmdROTf:
|
cryptocmdROTf:
|
||||||
cryptocmdROTfArg1:
|
cryptocmdROTfArg1:
|
||||||
ld hl, FshCmdArgFlags
|
ld hl, FshCmdArgFlags
|
||||||
|
|
@ -23,15 +23,14 @@ cryptocmdROTfArg1Get:
|
||||||
ld (hl), e
|
ld (hl), e
|
||||||
call _NewLine
|
call _NewLine
|
||||||
cryptocmdROTfArg2:
|
cryptocmdROTfArg2:
|
||||||
jr cryptocmdROTfArg2Get
|
|
||||||
ld hl, FshCmdArg2
|
ld hl, FshCmdArg2
|
||||||
ld de, FshScratch
|
ld de, FshScratch
|
||||||
call strcpy
|
call strcpy
|
||||||
ld hl, FshCmdArgFlags
|
ld hl, FshCmdArgFlags
|
||||||
bit 5, (hl)
|
|
||||||
jr z, cryptocmdROTfExe
|
|
||||||
bit 4, (hl)
|
bit 4, (hl)
|
||||||
jr z, cryptocmdROTfArg2Get
|
jr z, cryptocmdROTfArg2Get
|
||||||
|
bit 5, (hl)
|
||||||
|
jr z, cryptocmdROTfExe
|
||||||
ld hl, ErrUsageo
|
ld hl, ErrUsageo
|
||||||
call ErrSet
|
call ErrSet
|
||||||
call ErrCatch
|
call ErrCatch
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
cryptocmdunROT: .db "ROT", 0
|
cryptocmdunROT: .db "ROT", 0
|
||||||
cryptocmdunROTm: .db "ROT Cypher, rotates the alphabet and Decodes a string", 0
|
cryptocmdunROTm: .db "ROT: Cypher, rotates the alphabet and Decodes a string", 0
|
||||||
cryptocmdunROTu: .db "ROT <shift#>", 0
|
cryptocmdunROTu: .db "DECRYPT ROT <shift#>", 0
|
||||||
cryptocmdunROTf:
|
cryptocmdunROTf:
|
||||||
cryptocmdunROTfArg1:
|
cryptocmdunROTfArg1:
|
||||||
ld hl, FshCmdArgFlags
|
ld hl, FshCmdArgFlags
|
||||||
|
|
@ -23,15 +23,14 @@ cryptocmdunROTfArg1Get:
|
||||||
ld (hl), e
|
ld (hl), e
|
||||||
call _NewLine
|
call _NewLine
|
||||||
cryptocmdunROTfArg2:
|
cryptocmdunROTfArg2:
|
||||||
jr cryptocmdunROTfArg2Get
|
|
||||||
ld hl, FshCmdArg2
|
ld hl, FshCmdArg2
|
||||||
ld de, FshScratch
|
ld de, FshScratch
|
||||||
call strcpy
|
call strcpy
|
||||||
ld hl, FshCmdArgFlags
|
ld hl, FshCmdArgFlags
|
||||||
bit 5, (hl)
|
|
||||||
jr z, cryptocmdunROTfExe
|
|
||||||
bit 4, (hl)
|
bit 4, (hl)
|
||||||
jr z, cryptocmdunROTfArg2Get
|
jr z, cryptocmdunROTfArg2Get
|
||||||
|
bit 5, (hl)
|
||||||
|
jr z, cryptocmdunROTfExe
|
||||||
ld hl, ErrUsageo
|
ld hl, ErrUsageo
|
||||||
call ErrSet
|
call ErrSet
|
||||||
call ErrCatch
|
call ErrCatch
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
;;xorcrypt
|
||||||
|
;;<en><de>crypts a string using xor
|
||||||
|
;;Inputs:
|
||||||
|
;; HL: string pointer
|
||||||
|
;; DE: seed pointer (shorter)
|
||||||
|
;;Notes:
|
||||||
|
;; Changes string in place.
|
||||||
|
xorcrypt:
|
||||||
|
push hl
|
||||||
|
push de
|
||||||
|
call strlen
|
||||||
|
push hl
|
||||||
|
ld hl, 0
|
||||||
|
ld h, b
|
||||||
|
ld l, c
|
||||||
|
ex de, hl
|
||||||
|
call strlen
|
||||||
|
ex de, hl
|
||||||
|
ld a, l ;BC = len(seed) hl=len(string)
|
||||||
|
sub c
|
||||||
|
jr nc, xorcryptSmaller
|
||||||
|
ld a, 0
|
||||||
|
xorcryptSmaller:
|
||||||
|
ld bc, 0
|
||||||
|
ld b, a
|
||||||
|
ld c, l ;b=len(seed) c=len(string)
|
||||||
|
pop hl
|
||||||
|
or a, a
|
||||||
|
jr z, strxorPadLoopEnd
|
||||||
|
ex de, hl; hl=seed
|
||||||
|
push bc
|
||||||
|
ld c, 0
|
||||||
|
add hl, bc
|
||||||
|
pop bc
|
||||||
|
inc b
|
||||||
|
ld (hl), %10000000
|
||||||
|
push bc
|
||||||
|
strxorPadLoop:
|
||||||
|
inc hl
|
||||||
|
ld (hl), $00
|
||||||
|
djnz strxorPadLoop
|
||||||
|
pop bc
|
||||||
|
strxorPadLoopEnd:
|
||||||
|
dec hl
|
||||||
|
ld (hl), b
|
||||||
|
inc hl
|
||||||
|
ld (hl), $00
|
||||||
|
pop de
|
||||||
|
pop hl
|
||||||
|
call strxor
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
@ -1 +1,2 @@
|
||||||
#include "includes/lib/crypto/rot.asm"
|
#include "includes/lib/crypto/Rot.asm"
|
||||||
|
#include "includes/lib/crypto/Xor.asm"
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
;;randomint
|
||||||
|
;;Gets an 8-bit random number.
|
||||||
|
;;Inputs:
|
||||||
|
;; A: Seed
|
||||||
|
;;Outputs:
|
||||||
|
;; A: Random number (0-255)
|
||||||
|
;;Notes:
|
||||||
|
;; This is not cryptographically random.
|
||||||
|
randomint:
|
||||||
|
ld (randomintSeed), a
|
||||||
|
push hl
|
||||||
|
push de
|
||||||
|
push bc
|
||||||
|
ld hl, (randomintSeed)
|
||||||
|
ld de, (randomintSeed+2)
|
||||||
|
ld b, h
|
||||||
|
ld c, l
|
||||||
|
add hl, hl \ rl e \ rl d
|
||||||
|
add hl, hl \ rl e \ rl d
|
||||||
|
inc l
|
||||||
|
add hl, bc
|
||||||
|
ld (randomintSeed), hl
|
||||||
|
ld hl, (randomintSeed+2)
|
||||||
|
adc hl, de
|
||||||
|
ld (randomintSeed+3), hl
|
||||||
|
ex de, hl
|
||||||
|
ld hl, (randomintSeed)
|
||||||
|
ld de, (randomintSeed+4)
|
||||||
|
ld bc, 63838
|
||||||
|
add hl, hl \ rl c \ rl b
|
||||||
|
ld (randomintSeed+6), bc
|
||||||
|
sbc a, a
|
||||||
|
and %11110001
|
||||||
|
xor l
|
||||||
|
ld l, a
|
||||||
|
ld (randomintSeed+7), hl
|
||||||
|
ld a, d
|
||||||
|
add a, b
|
||||||
|
pop bc
|
||||||
|
pop de
|
||||||
|
pop hl
|
||||||
|
ret
|
||||||
|
;Actual random bytes
|
||||||
|
randomintSeed: .db $28, $BE, $B3, $BB, $a3, $f1, $97, $af, $87, $50, $26, $91, $46, $cc, $5f, $c7
|
||||||
|
|
@ -258,6 +258,32 @@ strtowExit:
|
||||||
pop bc
|
pop bc
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
;;strxor
|
||||||
|
;;xor 2 strings together
|
||||||
|
;;Inputs:
|
||||||
|
;; HL: string 1
|
||||||
|
;; DE: string 2
|
||||||
|
;;Outputs:
|
||||||
|
;; HL: Xor String Pointer
|
||||||
|
strxor:
|
||||||
|
push de
|
||||||
|
push hl
|
||||||
|
ex de, hl
|
||||||
|
strxorLoop:
|
||||||
|
ld a, (de)
|
||||||
|
or a, a
|
||||||
|
jr z, strxorEnd
|
||||||
|
xor (hl)
|
||||||
|
ld (de), a
|
||||||
|
inc de
|
||||||
|
inc hl
|
||||||
|
jr strxorLoop
|
||||||
|
strxorEnd:
|
||||||
|
pop hl
|
||||||
|
pop de
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
;;toLower [Strings]
|
;;toLower [Strings]
|
||||||
;;Converts every alpha character of a string to lowercase.
|
;;Converts every alpha character of a string to lowercase.
|
||||||
;;Inputs:
|
;;Inputs:
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#include "includes/lib/std/Math.asm"
|
#include "includes/lib/std/Math.asm"
|
||||||
|
#include "includes/lib/std/Random.asm"
|
||||||
#include "includes/lib/std/Byte.asm"
|
#include "includes/lib/std/Byte.asm"
|
||||||
#include "includes/lib/std/Mem.asm"
|
#include "includes/lib/std/Mem.asm"
|
||||||
#include "includes/lib/std/Char.asm"
|
#include "includes/lib/std/Char.asm"
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,21 @@ manroute:
|
||||||
jp z, manrouteReturn
|
jp z, manrouteReturn
|
||||||
#endmacro
|
#endmacro
|
||||||
|
|
||||||
|
#macro subroutestrjp(cmdXs, cmdYs, cmdYm)
|
||||||
|
push hl
|
||||||
|
ld de, cmdXs
|
||||||
|
call strcmp
|
||||||
|
ld hl, 0
|
||||||
|
jr nz, +_
|
||||||
|
ld hl, FshCmdArg1
|
||||||
|
_:
|
||||||
|
ld de, cmdYs
|
||||||
|
call strcmp
|
||||||
|
pop hl
|
||||||
|
ld de, cmdYm
|
||||||
|
jp z, manrouteReturn
|
||||||
|
#endmacro
|
||||||
|
|
||||||
call fshcmdmanroute
|
call fshcmdmanroute
|
||||||
call cryptocmdmanroute
|
call cryptocmdmanroute
|
||||||
;Extention Point
|
;Extention Point
|
||||||
|
|
@ -41,6 +56,21 @@ manrouteu:
|
||||||
jp z, manrouteuReturn
|
jp z, manrouteuReturn
|
||||||
#endmacro
|
#endmacro
|
||||||
|
|
||||||
|
#macro subrouteustrjp(cmdXs, cmdYs, cmdYu)
|
||||||
|
push hl
|
||||||
|
ld de, cmdXs
|
||||||
|
call strcmp
|
||||||
|
ld hl, 0
|
||||||
|
jr nz, +_
|
||||||
|
ld hl, FshCmdArg1
|
||||||
|
_:
|
||||||
|
ld de, cmdYs
|
||||||
|
call strcmp
|
||||||
|
pop hl
|
||||||
|
ld de, cmdYu
|
||||||
|
jp z, manrouteuReturn
|
||||||
|
#endmacro
|
||||||
|
|
||||||
call fshcmdmanrouteu
|
call fshcmdmanrouteu
|
||||||
call cryptocmdmanrouteu
|
call cryptocmdmanrouteu
|
||||||
;Extention Point
|
;Extention Point
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue