My latest CoreWar virus, the Laser, complete with commentary.
It’s only flaws are it is a shade to slow and needs to be streamlined, and sometimes, despite its test function, it will waste time dropping bombs on craters it finds…time that enemy virii like to use to close in and kill….
;redcode-94 ;name Laser ;USA ;strategy: Scan the core for enemy code at regular intervals, and if found, carpet bomb ;everything around it with DAT statements.
;assert CORESIZE == 8000
; Execution should begin with scan. ORGSCAN
; How far ahead of target should the leading fire be? LEADEQU15 ; How far behind the target should the trailing fire be? TRAIL EQU 5
; Scan for enemy virus, checking every 3 bytes ; If code is found, ;GOTO Test ; else keep scanning. ; SCANCMP-1,-1000 JMP TEST ADD #-3, SCAN JMP SCAN
; Once code is found, check that code to see if it is a bomb (DAT). ; We do this because there is no point in dropping bombs on bombs. ; We want to bomb enemy code, not the craters he left behind! ; First we overwrite the A&B registers to zero, then compare our ; bomb to the enemy code. ; ;If the code is not just a bomb, ;GOTO SET ;else, GOTO SCAN (after skipping ahead some, keep scanning ). ; TESTADD #4, SCAN MOV.F BOMB+1,@SCAN CMP.IBOMB+1,@SCAN JMP SET ADD #-5, SCAN JMP SCAN
; Set up the bombing run by setting the target and how far ahead of the target ; to drop bombs (LEAD). ; SETMOV.B SCAN, BOMB ADD #LEAD, BOMB
; Carpet Bomb the target in a loop from the leading fire place to the trailing fire place, ; before leaping back to continue scanning for the next target. ; FIREMOV BOMB,<BOMB SLT @BOMB+TRAIL,@SCAN JMP FIRE MOV BOMB+1, BOMB ADD #-TRAIL, SCAN JMP SCAN
; This is the payload. The first one also serves as a memory store, while the second one is our “pure” bomb, ; used to compare against other bombs so as to prevent wasted crater bombings. ; BOMBDAT 0,0 DAT 0,0
blog comments powered by Disqus