bootstrapping from ECHO

Dave Long dave.long at
Fri Apr 22 12:18:30 EDT 2011

> Ha! That's awesome.  You don't look that old.

Thanks.  I hope I'm not that old: it's a long story, part of a mis- 
spent youth, but essentially I had access to this stuff thanks to the  
relative vulnerability of PDP-11s at the time, not due to actually  
having been on the payroll for the project.

> What did you use at the time to copy executables across?  MODEM7?

I don't recall anymore, but it was some sort of serial kermit-y kind  
of thing; it did work over modem lines as well as physical tty  

>> I haven't tried this myself yet, as some combination of Q, Freedos,
>> or laptop prevents me from entering ALT-numerics in the dos box.
> If it's the laptop, have you considered getting a US$5 USB keyboard?
> They're usually better than laptop keyboards, even if you aren't
> attempting feats of keyboard bootstrapping.

That would have been a good idea.  In the meantime, I've come up with  
the following bletcherous hack:


It's rather important to not leave any space between the end of the  
code and the > redirection, as it expects its input (2 characters in  
kragen-bootstrap hex format, hence the h//Z!UHhOOZ!UH fragment) to  
come immediately after the CRLF which echo appends to the code.  In  
fact the whole thing is rather fragile as it has to do a certain  
amount of self-modification just to do any I/O, and I didn't feel  
like doing more to set up a loop.  For that, we have the following  
batch file (for which I trust there's a suitable way to escape the  
redirections were one to actually compose the file via echo?)

@echo off
if (%1)==() goto done
echo %1 >> >> a.out
goto loop

which then allowed me to generate your on the first try (8  
octets at a time).


- int 21 AH=2 seems to mangle tabs; it might be wise to change the  
output path before anything in the bootstrap needs to generate 0x09
- if you look at this in DEBUG be sure to clear CX before starting.   
(did I mention the whole thing is rather fragile?)

>> [0] I have, once in my life, programmed (an application, not an
>> exercise) using front panel switches and the reference manual
> That sounds like a lot of work.  What was the application?

"rolling" dice, when no dice were available but there was --probably  
left by someone's father-- a sort of demo board with an 8-bit cpu, a  
two-digit 7-segment display, and a hex keypad.  It wasn't that much  
work as the app was not very complex at all: it used a button press  
interrupting a counter instead of a prng to generate a result, but  
even so, by the time I had the code hand-assembled, toggled in, and  
debugged, it had taken enough time that actual dice had simply been  
acquired from someone else's home.

More information about the Kragen-discuss mailing list