;redcode
;name MiniDeathStarV13
;author Skybuck Flying
;strategy
Massive-Serial-Threaded-Dual-Beam-Single-Instruction-Plasma-Cannon,
PlasmaSelect, 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 13
;date 14 december 2007
;
; Info: Unoptimized version.
; Info: No front/forward laser yet.
; Info: No read/backward laser yet.
; Info still kicks millinium falcon's ass !





=DDDDD
;
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 DeathStarPowerUpSystemBottomRayBegin
spl DeathStarPowerUpSystemTopRayBegin
spl DeathStarPowerUpSubSystemsBegin
; wait for systems to come online
djn 0, #6
; 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 30 threads
; 38-1 is 37, in binary: 100101
spl 1
mov -1, 0
mov -1, 0
spl 1
mov -1, 0
spl 1
jmz 0, DeathStarActivateSystems
jmp >DeathStarThreadCounter
DeathStarThreadCounter dat $0, $1
DeathStarBootUpSystemDriveBegin
; number of threads must equal death star body.
; 25 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
jmp DeathStarDrive ; 15
jmp DeathStarDrive ; 16
jmp DeathStarDrive ; 17
jmp DeathStarDrive ; 18
jmp DeathStarDrive ; 19
jmp DeathStarDrive ; 20
jmp DeathStarDrive ; 21
jmp DeathStarDrive ; 22
jmp DeathStarDrive ; 23
jmp DeathStarDrive ; 24
jmp DeathStarDrive ; 25
DeathStarBootUpSystemDriveEnd
DeathStarBootUpSystemDrivePowerInjectorBegin
; 1 thread for drive power injector
jmp DeathStarDriveInjectPower + 1 ; compensate for movement
DeathStarBootUpSystemDrivePowerInjectorEnd
DeathStarBootUpWeaponsControlBegin
; 12 threads for weapon control
jmp DeathStarWeaponControlBegin + 1
jmp DeathStarWeaponControlBegin + 2
jmp DeathStarWeaponControlBegin + 3
jmp DeathStarWeaponControlBegin + 4
jmp DeathStarWeaponControlBegin + 5
jmp DeathStarWeaponControlBegin + 6
jmp DeathStarWeaponControlBegin + 7
jmp DeathStarWeaponControlBegin + 8
jmp DeathStarWeaponControlBegin + 9
jmp DeathStarWeaponControlBegin + 10
jmp DeathStarWeaponControlBegin + 11
jmp DeathStarWeaponControlBegin + 12
DeathStarBootUpWeaponsControlEnd
DeathStarPowerUpSubSystemsEnd
; kill off closeby enemies.
DeathStarPowerUpSystemTopRayBegin
spl 1 ; 2
spl 1 ; 4
spl 1 ; 8
spl 1 ; 16
spl 1 ; 32
jmz 0, DeathStarActivateSystems
jmp DeathStarFireTopRay
DeathStarPowerUpSystemTopRayEnd
; stun far away enemies
DeathStarPowerUpSystemBottomRayBegin
spl 1 ; 2
spl 1 ; 4
spl 1 ; 8
spl 1 ; 16
spl 1 ; 32
jmz 0, DeathStarActivateSystems
jmp DeathStarFireBottomRay
DeathStarPowerUpSystemBottomRayEnd
DeathStarConstructionEnd
DeathStarBodyBegin
DeathStarBodyLength equ (DeathStarBodyEnd - DeathStarBodyBegin)
; could protection for rear too, from top and bottom
TopRayStartPosition equ -128 - 16
BottomRayStartPosition equ +128 - 17; (to compensate for variable being
one lower)
; old doesn't cover it's ass:
; TopRayStartPosition equ -128;
; BottomRayStartPosition equ +128 ; (to compensate for variable being one
lower)
RayNextLine equ 1
RayLines equ 32
RaySpacing equ 128
DeathStarDriveBegin
DeathStarDriveSourceDest dat #DeathStarEnd, #DeathStarEnd + 1
DeathStarDrive mov {DeathStarDriveSourceDest, <DeathStarDriveSourceDest
DeathStarDriveEnd
DeathStarWeaponsBegin
DeathStarWeaponControlBegin
; reset ray positions
mov #TopRayStartPosition, TopRayPosition
mov #BottomRayStartPosition, BottomRayPosition
; calculate ray counter
add.ab #RayNextLine, RayCounter
mod #RayLines, RayCounter
; copy ray counter to ray offset
mov.b RayCounter, RayOffset
; multiple ray counter/offset with spacing to get good ray offset
without disturbing the ray counter
mul #RaySpacing, RayOffset
; sub ray offset from top ray position
sub RayOffset, TopRayPosition
; add ray offset to bottom ray position
add RayOffset, BottomRayPosition
; plasma counter
add #1, PlasmaCounter
; plasma counter is allowed to increment to twice the line size
mod #256, PlasmaCounter
; copy it to plasma select to keep plasma counter intact, could reuse
offset or so as plasma select but ok.
mov.b PlasmaCounter, PlasmaSelect
; divide it by line size, 0 will be stun plasma, 1 will be deadly plasma
div #128, PlasmaSelect
; plasma switcher.
; DeathStarSelectPlasma mov.x #DeathStarStunningPlasma,
#DeathStarDeadlyPlasma
DeathStarWeaponControlEnd
DeathStarFireWeaponsBegin
; DeathStarFireTopRay mov DeathStarStunningPlasma, >TopRayPosition
; DeathStarFireBottomRay mov DeathStarStunningPlasma, >BottomRayPosition
DeathStarFireTopRay mov @PlasmaSelect, >TopRayPosition
DeathStarFireBottomRay mov @PlasmaSelect, >BottomRayPosition
DeathStarFireWeaponsEnd
DeathStarWeaponsDataBegin
TopRayPosition dat $0, #TopRayStartPosition
BottomRayPosition dat $0, #BottomRayStartPosition
RayCounter dat $0, $0
RayOffset dat $0, $0
PlasmaCounter dat $0, $128 ; must start at 128 to start with stun
plasma
DeathStarWeaponsDataEnd
DeathStarWeaponsEnd
DeathStarPlasmasBegin
; plasma select also functions as deadly plasma.
DeathStarDeadlyPlasma
PlasmaSelect dat $0, $1 ; set it to one to start with stun plasma on
first bombing run first line.
DeathStarStunningPlasma spl.a $0, $1
DeathStarPlasmasEnd
DeathStarDrivePowerSourceBegin
DeathStarDriveInjectPower mov.f DeathStarDrivePowerSource,
DeathStarDriveSourceDest
DeathStarDrivePowerSource dat #0, #0
DeathStarDrivePowerSourceEnd
DeathStarBodyEnd
DeathStarEnd
dat $0, $0 ; included to make pmars compilers happy.