;redcode
;name MiniDeathStarV9
;author Skybuck Flying
;strategy
Massive-Serial-Threaded-Dual-Beam-Single-Instruction-Plasma-Cannon,
PlasmaSwitcher, StunPlasma, DeadlyPlasma, RayControl, RaySpacing,
SublightDrive, PowerUp and BootUp Program.
;strategy Ask yourself: Can my warrior stop the death star before it fires ?
;strategy Ask yourself: Can my warrior stop the death star during it's
firement ?
;strategy Ask yourself: Can my warrior survive the deadly rays of the death
star ?
;strategy Ask yourself: Is my warrior fast enough to catch up with the death
star ?
;strategy Ask yourself: Is there a place to hide ?
;version 9
;date 12 december 2007
CoreLineLength equ 128
DeathStarBegin
DeathStarConstructionLength equ (DeathStarConstructionEnd -
DeathStarConstructionBegin)
DeathStarConstructionBegin
DeathStarInitializeDriveSystemBegin
DeathStarDetermineDrivePowerType mov.f DeathStarDriveSourceDest,
DeathStarDrivePowerSource
DeathStarInitializeDriveSystemEnd
DeathStarPowerUpBegin
; systems must be powered up in reverse order
spl DeathStarPowerUpSystemDeathRayBegin
spl DeathStarPowerUpSystemStunRayBegin
spl DeathStarPowerUpSubSystemsBegin
; wait for systems to come online
djn 0, #5
; activate systems
mov.ab #1, DeathStarActivateSystems
; 0 = systems waiting for activation, 1 = activating systems
DeathStarActivateSystems nop $0, $0
dat $0, $0
DeathStarPowerUpEnd
DeathStarPowerUpSubSystemsBegin
; sub systems need 20 threads
; 20-1 is 19, in binary: 10011
spl 1
mov -1, 0
mov -1, 0
spl 1
spl 1
jmz 0, DeathStarActivateSystems
jmp >DeathStarThreadCounter
DeathStarThreadCounter dat $0, $1
DeathStarBootUpSystemDriveBegin
; number of threads must equal death star body.
; 14 threads needed for drive system
jmp DeathStarDrive ; 1
jmp DeathStarDrive ; 2
jmp DeathStarDrive ; 3
jmp DeathStarDrive ; 4
jmp DeathStarDrive ; 5
jmp DeathStarDrive ; 6
jmp DeathStarDrive ; 7
jmp DeathStarDrive ; 8
jmp DeathStarDrive ; 9
jmp DeathStarDrive ; 10
jmp DeathStarDrive ; 11
jmp DeathStarDrive ; 12
jmp DeathStarDrive ; 13
jmp DeathStarDrive ; 14
DeathStarBootUpSystemDriveEnd
DeathStarBootUpSystemDrivePowerInjectorBegin
; 1 thread for drive power injector
jmp DeathStarDriveInjectPower + 1 ; compensate for movement
DeathStarBootUpSystemDrivePowerInjectorEnd
DeathStarBootUpWeaponsControlBegin
; 5 threads for weapon control
; ray control prevents self kill
jmp DeathStarWeaponControlBegin + 1
jmp DeathStarWeaponControlBegin + 2
jmp DeathStarWeaponControlBegin + 3
jmp DeathStarWeaponControlBegin + 4
jmp DeathStarWeaponControlBegin + 5
DeathStarBootUpWeaponsControlEnd
DeathStarPowerUpSubSystemsEnd
; kill off closeby enemies.
DeathStarPowerUpSystemDeathRayBegin
spl 1 ; 2
spl 1 ; 4
spl 1 ; 8
spl 1 ; 16
spl 1 ; 32
jmz 0, DeathStarActivateSystems
; nop only necessary if wait time for system to come online was set too
short
; nop $0, $0
jmp DeathStarFireDeathRay
DeathStarPowerUpSystemDeathRayEnd
; stun far away enemies
DeathStarPowerUpSystemStunRayBegin
spl 1 ; 2
spl 1 ; 4
spl 1 ; 8
spl 1 ; 16
spl 1 ; 32
jmz 0, DeathStarActivateSystems
; nop only necessary if wait time for system to come online was set too
short
; nop $0, $0
jmp DeathStarFireStunRay
DeathStarPowerUpSystemStunRayEnd
DeathStarConstructionEnd
DeathStarBodyBegin
DeathStarBodyLength equ (DeathStarBodyEnd - DeathStarBodyBegin)
DeathStarMinimumRayDistance equ DeathStarBodyEnd
DeathStarMaximumRayDistance equ (CORESIZE - DeathStarBodyLength) - 64
DeathStarRaySpacing equ 127
DeathStarDriveBegin
DeathStarDriveSourceDest dat #DeathStarEnd, #DeathStarEnd + 1
DeathStarDrive mov {DeathStarDriveSourceDest, <DeathStarDriveSourceDest
DeathStarDriveEnd
DeathStarWeaponsBegin
DeathStarWeaponControlBegin
; ray spacing and self-kill protection
mov.ab #DeathStarMinimumRayDistance, DeathStarRayPosition
add.ab #DeathStarRaySpacing, DeathStarRayOffset
mod #DeathStarMaximumRayDistance - DeathStarMinimumRayDistance,
DeathStarRayOffset
add.b DeathStarRayOffset, DeathStarRayPosition
; plasma switcher
DeathStarSelectPlasma mov.x #DeathStarStunningPlasma,
#DeathStarDeadlyPlasma
DeathStarWeaponControlEnd
DeathStarFireWeaponsBegin
DeathStarFireStunRay mov *DeathStarSelectPlasma, >DeathStarRayPosition
DeathStarFireDeathRay mov @DeathStarSelectPlasma, >DeathStarRayPosition
DeathStarFireWeaponsEnd
DeathStarWeaponsDataBegin
DeathStarRayPosition dat $0, #DeathStarMinimumRayDistance
DeathStarRayOffset dat $0, $0
DeathStarWEaponsDataEnd
DeathStarWeaponsEnd
DeathStarPlasmasBegin
DeathStarStunningPlasma spl.a $0, $1
DeathStarPlasmasEnd
DeathStarDrivePowerSourceBegin
DeathStarDriveInjectPower mov.f DeathStarDrivePowerSource,
DeathStarDriveSourceDest
DeathStarDeadlyPlasma
DeathStarDrivePowerSource dat #0, #0
DeathStarDrivePowerSourceEnd
DeathStarBodyEnd
DeathStarEnd
dat $0, $0 ; included to make pmars compilers happy.