Skip to content

Instantly share code, notes, and snippets.

@pmachapman
Last active August 29, 2015 14:23
Show Gist options
  • Save pmachapman/a2a3235b61e2639fbed6 to your computer and use it in GitHub Desktop.
Save pmachapman/a2a3235b61e2639fbed6 to your computer and use it in GitHub Desktop.
"The ultimate virus killer" assembly source code. Taken from the book "More Tricks & Tips for the Amiga"
;VIRUS-KILLER V1.O; by SM'87
start:
move.l 4,a6 ;EXECBASE at a6
moveq #0,d1 ;Flags: no Virus here
tst.l 46(a6) ;Test, for distorted Cool-Capture
beq.s noSCA ;Wasn't SCA-Virus
clr.l 46(a6) ;Cool-Capture clear
addq.b #1,d1 ;Bit 0 set
noSCA:
cmpi.w #$FC,148(a6) ;Vertical Blank Interrupt normal?
beq.s noVBI ;no?
addq.b #2,d1 ;Bit 1 set
bra.s ClearTag ;KickTag-Pointer clear
noVBI:
tst.l 550(a6) ;KickTag-Pointer changed?
beq.s GoOn ;no?
addq.b #4,d1 ;Bit 2 set
ClearTag:
clr.l 550(a6) ;Pointer cleared
clr.l 554(a6) ;Pointer cleared
GoOn:
move.b d1,Virusflag ;Flag reserved
lea dosname,a1 ;Address of Lib names
moveq #0,d0 ;Version is the same
jsr -552(a6) ;Open Library
move.l d0,dosbase ;Reserve Library-Base
beq errfix ;Branch on Error
move.l d0,a6 ;Prepare for DOS call
jsr -60(a6) ;Get Output-handle
move.l d0,Outputhandle ;and store
beq errfix ;Branch when error
move.l #title,d2 ;Title at d2
move.l #titleend-title,d3 ;Text-Length
jsr writeout ;Text output
tst.b Virusflag ;Virusflag test
bne.s Virusfound ;Branch on Virus
move.l #clean,d2 ;Clear Message
move.l #cleanend-clean,d3 ;Length
jsr writeout ;Text output
bra errfix ;Program end
Virusfound: ;Virus is active
btst #0,Virusflag ;Cool-Capture?
beq.s notsca ;No
move.l #scaV,d2 ;Message
move.l #scaVend-scaV,d3 ;Length
jsr writeout ;Text output
notsca:
btst #1,Virusflag ;VB-Interrupt?
beq.s notvbi ;No
move.l #bbVvbi,d2 ;Message
move.l #bbVvbiend-bbVvbi,d3 ;Length
jsr writeout ;output
bra.s bbfound ;next Message
notvbi:
btst #2,Virusflag ;Kicktag?
beq.s errfix ;No
move.l #bbVtag,d2 ;Message
move.l #bbVtagend-bbVtag,d3 ;Length
jsr writeout ;output
bbfound:
move.l #bbv,d2 ;message
move.l #bbvend-bbv,d3 ;Length
jsr writeout ;output
errfix:
move.l 4,a6
move.l dosbase,d0
beq.s quit
move.l d0,a1
jsr -414(a6)
quit:
moveq #0,d0
rts
writeout:
move.l outputhandle,d1
jmp -48(a6)
dosname:dc.b "dos.library",0
title: dc.b $c,$9b,"1;31;42m - Virus-Killer"
dc.b " V1.0 - ",10,13
dc.b "(c) 1988 by S. Maelger",10,13,10
dc.b $9b,"0;31;40m"
titleend:align
clean: dc.b "No symptoms for Virus"
dc.b "-Infection found !",10,13,10
cleanend:align
scaV: dc.b "Reset-Vector Cool-Capture has"
dc.b " been used!",10,13
dc.b "SCA-Virus suspected !",10,13
dc.b "Virus in memory destroyed.",10,13,10
scaVend:align
bbVvbi: dc.b "Vertical Blank Interrupt has"
dc.b "been used!",10,13
bbVvbiend:align
bbV: dc.b "Byte-Bandit-Virus suspected!",10,13
dc.b "Virus in memory destroyed.",10,13,10
bbVend:align
bbVtag: dc.b "KickTagPointer is no longer"
dc.b " in operating system!",10,13
bbVtagend:align
dosbase:dc.l 0
outputhandle:dc.l 0
Virusflag:dc.b 0
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment