Bootstrapping, or booting away, is where the main body of a program is moved from its initial location. This is used to leave behind a decoy to distract scanners, or to space out multiple components in the core.
Unrolled Loop
The simplest boot method is an unrolled loop, which uses one MOV
instruction for each instruction to be copied.
; boot code
bdist equ 1000
mov <ssrc, {sdest
mov <ssrc, {sdest
mov <ssrc, {sdest
mov <ssrc, {sdest
sdest jmp bdist+4 ; destination pointer
ssrc dat inc+4 ; source pointer
; stone to be booted away
step equ 1185
inc spl #-step, <step
stone mov >step, 1-step
sub inc, stone
djn.f stone, <5555
Parallel Boot
Another common technique uses parallel processes, where a single MOV
instruction is executed by multiple processes.
; boot code
bdist equ 1000
spl 1 ; 4 parallel processes
spl 1
mov <ssrc, {sdest ; executed 4 times
sdest jmp bdist+4 ; destination pointer
ssrc dat inc+4 ; source pointer
; stone to be booted away
step equ 1185
inc spl #-step, <step
stone mov >step, 1-step
sub inc, stone
djn.f stone, <5555
Further Reading
- . "Multi boot routines." Core Warrior 27 (29 Apr 1996).
- . "To boot or not to boot, that is the question." PUSH OFF 13 (8 Jun 1993).