;redcode-94nop verbose
;name test (24pilt)
;author Philip Thorne
;strategy test. bombs. needs pspace protection
;kill pilt
;bench c=124#7800 lk=117#400 w=154#400 o=137#400 mps=128#400
;url http://www.koth.org/stats/

for CORESIZE==8000
 ;assert (CORESIZE==8000)
 ;assert (MAXLENGTH==100) && (MINDISTANCE==100)
 ;assert (MAXCYCLES==80000)
 ;assert (MAXPROCESSES==8000)
rof
for CORESIZE==55440
 ;assert (CORESIZE==55440) 
 ;assert (MAXPROCESSES>=8)
 ;assert (MAXCYCLES==500000)
 ;assert (MAXLENGTH==200) && (MINDISTANCE==200)
rof

for CORESIZE==8000
 STEP   EQU     (2936)          ;mod-8
rof
for CORESIZE==55440
 STEP   EQU     (-24184)        ;mod-8
rof

MSIZ    EQU     (8)
MSPACE  EQU     for MSIZ
        EQU         dat 0, 0
        EQU     rof
MFILL   EQU     for MSIZ-(CURLINE%MSIZ)
        EQU         dat 0, 0
        EQU     rof

WACK    EQU     cptr

;assert ((STEP%(MSIZ)) == 0)
;assert ((CURLINE%MSIZ) == 0)

lure:   mov.b   #(2*STEP),      *(WATCH-(2*STEP))
inc:    spl     #(STEP-1),      #(-STEP-1)
;vbmb:   jmp     -(MSIZ),        >1     ;
vbmb:   djn.f    -(MSIZ),        <6     ;
        MFILL

;assert ((CURLINE%MSIZ) == 0)

DROP    EQU     (lure-4000-STEP)
WATCH   EQU     (lure+STEP)

        dat     0,              0
loop:   mov.i   @1,             }lure   ;A==lure
        mov.i   vbmb,           >lure
        add.f   inc,            @-1     ;B==lure
eloop:  jmz.b   loop,           DROP    ;misses WATCH overruns
;eloop:  jmz.b   loop,           *WATCH
        spl     clr,            DROP
prep:   sub.b   @-1,            WACK

        MFILL

;assert ((CURLINE%MSIZ) == 0)

;The clear from quiz
for 1
        dat     0,      0
cptr    dat.f   clr,    (WATCH-WACK-1)  ;Was B==15
d       dat.f   <2667,  15
        dat.f   <-15,   15
clr     spl     #-3000,   15
        mov.i   @2,     >cptr
        mov.i   @1,     >cptr
        djn.b   -2,     {clr
        ;MFILL: 
rof

;assert ((CURLINE%MSIZ) == 0)

        MSPACE
        MSPACE
        MSPACE
        MSPACE
        MSPACE

;assert ((CURLINE%MSIZ) == 0)

        dat     0,              0
for 0                               ;ZZZ 94nop comp problem
for (PSPACESIZE >1)
;pbmb:   stp.b    >0,             }-20
;pbmb:   stp.a    #1723,         }0
pbmb:   dat     >0,             >1
rof
for (PSPACESIZE <2)
pbmb:   dat     >0,             >1
rof
rof
pbmb:   dat     >0,             >1  ;ZZZ 94nop comp problem

start:  mov.a   #(DROP-WATCH),  WATCH
        mov.i   <3333,          start
        ;jmp     loop,           {0

;--
for 1
for CORESIZE==8000
JCNT    EQU     (18)    ;(30)
rof
for CORESIZE==55440
JCNT    EQU     (131)
rof
JSTEP   EQU     ((CORESIZE - MAXLENGTH) / JCNT)
qbmb:
J   for JCNT
        mov.i   pbmb,           <(JSTEP*J)+(start)
    rof
begin:  jmp     loop,           {0
rof
;--
F   for (MAXLENGTH-CURLINE)
        dat     0,              0
    rof

    end start