;redcode
;name CloackTechnologyV3
;author Skybuck Flying
;strategy cloack/decloack demonstration
;version 3
;date 26 january 2008
; I am a bit bored right now, so let's do something usefull and write a
; little bit of code which I might re-use later or just for demonstration
purposes.
; this piece of code / demonstration / demo / routines / CODE LOL
; will show how to completely cloack some instruction and complete de-cloack
; them by using some routines and some loops and some counters and some
p-space.
; ok v2 working, now let's try to optimize it a little bit by getting rid of
the extra
; counter
; extra counter illiminated, counter is now reset by subtracting the
instruction length of it.
; code repeats it self, cloack/decloack/cloack/decloack/cloack/decloack
jmp Cloack
; Instructions to be cloacked/decloacked:
InstructionsBegin
InstructionsLength equ InstructionsEnd - InstructionsBegin
nop $555, $666
mov $777, $888
add #999, #1010
spl @1111, @1212
jmp #1313, #1414
dat $1515, $1616
jmz $1717, $1818
sub $1919, $2020
InstructionsEnd
; Counter which will be used to cloack instructions.
Counter dat $0, $InstructionsBegin
Cloack
CloackParameterA stp.ab @Counter, #1
CloackParameterB stp.b @Counter, #2
sub @Counter, @Counter
add.ab #1, $Counter
add.ab #2, $CloackParameterA
add.ab #2, $CloackParameterB
djn Cloack, #InstructionsLength
mov #InstructionsLength, -1
; reset counter for decloack
sub.ab #InstructionsLength, $Counter
DeCloack
DeCloackParameterA ldp.a #1, @Counter
DeCloackParameterB ldp.ab #2, @Counter
add.ab #1, $Counter
add.a #2, $DeCloackParameterA
add.a #2, $DeCloackParameterB
djn DeCloack, #InstructionsLength
mov #InstructionsLength, -1
; reset counter for cloack
sub.ab #InstructionsLength, $Counter
jmp Cloack