2 ms·
In case anyone's interested, I successfully entered the following version in DOSBOX using COPY CON, and indeed even used it to recreate a copy of itself: k
by kragen 16y ago
In case anyone's interested, I successfully entered the following version in DOSBOX using COPY CON, and indeed even used it to recreate a copy of itself:
kragen@inexorable:~/devel/inexorable-misc$ od -t u1 hexconv.com
0000000 180 1 205 33 36 15 136 194 192 226 4 205 33 36 15 1
0000020 194 180 2 205 33 235 233
0000027
It turns out the 08 meaning "or %al," was getting interpreted by COPY CON as a backspace, so this version adds AX to DX instead. (I sure am glad I didn't have to debug that using TYPE.) This program has advantages and disadvantages compared to COPY CON:
1. It echoes its input so you can see, at least in theory, if you made a mistake.
2. You only need to type two keystrokes instead of one to four per byte.
3. There are no forbidden bytes. At least in Dosbox, COPY CON converts ^@ to the sequence 00 03, interprets 08 as backspace (even if entered on the keypad with Alt), and stops copying when it gets a carriage return, even if the carriage return was entered with Alt.
4. To exit, you must reboot. In Dosbox, the output has already been flushed to the filesystem, but I have my doubts about whether, on MS-DOS, every single INT 21H AH=2 would write a 512-byte floppy disk sector with the newly appended byte. On the other hand, you could probably just mash some key on autorepeat long enough to fill up a couple of sectors, and you'd be good to go. This program, after all, only has to be sufficient to enter the next phase of the bootstrap, one with backspace and explicit termination.
5. There is no backspace, so if you hit any incorrect keystrokes, you must start over. For programs of this size, that's not a major constraint — it's pretty easy to carefully enter 40 or 50 or 100 keystrokes without making any errors — but it becomes more serious as programs get larger.
- kragen 16y agoFurther details at http://lists.canonical.org/pipermail/kragen-hacks/2011-April/000519.html http://lists.canonical.org/pipermail/kragen-hacks/2011-April....