;redcode
;name Corporate Program
;author Jack Twilley
;----
;strategy This program is designed to copy off seven small portions
;strategy of code whose sole purpose is to find something abnormal.
;strategy If they do, then they set a flag in their routine to a 
;strategy non-zero value, and wait until it becomes zero again.  
;strategy The second part of the program scans each of the small 
;strategy portion's flags, and based on the response, bombs a 
;strategy certain portion of core heavily.  Having completed that, 
;strategy then it resumes scanning the other pointers.
;----
csize     equ 8000
num       equ 7                     ;Number of scanning programs
slen      equ send-sstart+1         ;Length of scanning program
dist      equ 1000                  ;(csize/(num+1)) - Distance between the programs
step      equ 5
stepx2    equ step*2
;----
; Scan unit
;----
sstart    add #5,             spoint
snext     jmn scall,          @spoint
spoint    jmp sstart,         #-1           
          dat #0,             #0
scall     add spoint,         send        
          jmn 0,              send
sback     jmp sstart,         0    
send      dat #0,             #0           
;----
; Copy-split unit
;----
cstart    add #1000+send-sstart+1,     dest
          mov #send-2,        source
cloop     mov <source,        <dest
          cmp #sstart-1,      source
source    jmp cloop,          #source
dest      spl @dest,          sstart
cend      djn cstart,         #7
;----
; Bomb unit
;---- 
bstart    mov #1000-send-sstart-13,  bdist
          mov #7,             bcount
bloop     jmn bkill,          @bdist 
bback     add #1000,          bdist
bcount    djn bloop,          #0
bbomb     jmp bstart,         #10
bkill     mov @bdist,         btemp
          add bdist,          btemp
          add #5,             btemp
burp      mov btemp,          <btemp
          djn burp,           bbomb
          add #10,            bbomb          
bexit     sub @bdist,         @bdist
          jmp bback,          #0
bdist     dat #0,             #0
btemp     dat #0,            #0
;----
          end cstart
