x86 Assembly, 512 bytes
Compiled with NASM and tested with QEMU. To boot you need to put a 2 byte boot signature at the end of the bootsector (510 bytes into the file) so I lost 317 bytes filling the compiled code with zeros. This is my first golf so I have to apologize for any gigantic errors.
[org 7c00h] ;So NASM can change the labels into memory locations correctly.
cld ;Tells lodsb to look forward in memory
mov bh, 65 ;Moves the ASCII value of A into the BH register
mov si, NATO ;Moves the first byte of NATO into the si register
call print ;Call the 'print' subroutine
jmp $ ;Loops forever
print:
mov ah, 0eh ;Moves the hex value 0E into the AH register. Tells interrupt 10h that we want subfucntion 0E
lodsb ;Load a byte of SI into AL and increments a register (DL i think) that tells it the offset to look at
cmp al, 3 ;Compares the AL register that now has a byte from our string to ASCII value 3 (Enf Of Text)
je R ;If AL == 3 then jump to R
cmp al, 0 ;Comapre AL to ASCII 0 (NULL)
je newWord ;If AL == 0 hump to newWord
int 10h ;Execute interrupt 10h Subfunction 0Eh (stored in AH register) which prints character value in AL
jmp print ;Jump to print
newWord:
mov al, 10 ;Move ASCII 10 (New Line) into AL
int 10h ;Print character
mov al, 13 ;Move ASCII 13 (Carriage Return) into AL
int 10h ;Print character
mov al, bh ;Move BH (which has our starting letter) into AL
int 10h ;Print Character
mov al, 58 ;Move ASCII 58 (:) into AL
int 10h ;Print Character
mov al, 32 ;Move ASCII 32 (Space) into AL
int 10h ;Print Character
mov al, bh ;Move BH into AL
int 10h ;Print Character
inc bh ;Increments BH by one (BH++)
jmp print ;Jump to print
R:
ret ;Returns from a subroutine
;Below defines bytes (db) of our string to print. I used 0 as word seperators and 3 to end the string.
NATO: db 0,"lfa",0,"ravo",0,"harlie",0,"elta",0,"cho",0,"oxtrot",0,"olf",0,"otel",0,"ndia",0,"uliet",0,"ilo",0,"ima",0,"ike",0,"ovember",0,"scar",0,"apa",0,"uebec",0,"omeo",0,"ierra",0,"ango",0,"niform",0,"ictor",0,"hiskey",0,"ray",0,"ankee",0,"ulu",3
times 0200h - 2 - ($ - $$) db 0 ;Zerofill the file with upto 510 bytes (This is where all my bytes are)
dw 0AA55H ;Write the bootsignature
Output
This is what the above code outputs. As you can see A: Alfa is missing and that is because the prompt is 25 lines tall...
To prove I printed A: Alfa I replaced 0,"ulu"
with 32,"Z: Zulu"
so that Zulu is one on the same line as Yankee.
I would appreciate it if someone told me if I would be able to subtract the 317 bytes of zerofill from my code so it would be 195 bytes. Also if this is even valid because the output won't fit on the screen.
1Related. – Martin Ender – 2017-03-07T08:53:50.730
Yea I saw that one but thought this was different enough @MartinEnder – sagiksp – 2017-03-07T09:04:34.930
@sagiksp No one said it wasn't. :) – Martin Ender – 2017-03-07T09:08:23.037
@KritixiLithos How is this a duplicate? It's completely different and the only similarity is that they are both kolmogorov complexity. – sagiksp – 2017-03-07T10:06:10.913
4I'm closing this as a dupe because it doesn't have any exploitable structure that would allow custom compression schemes to perform better than built-in compression, and the target challenge is our de facto standard challenge for built-in compression. – Mego – 2017-03-07T10:06:11.067
@Mego Is it? The rick roll has so much structure that custom compression probably makes a lot more sense than built-in compression. – Martin Ender – 2017-03-07T10:29:09.203
1Closely related. If anything I'd call it a dupe of this one, but it allowed people to choose their own words which actually made compression a lot more possible. – Martin Ender – 2017-03-07T10:31:48.990
May I have a leading newline? – Titus – 2017-03-07T14:04:36.890
3shouldn't the first one be
A: Alpha
? – SeanC – 2017-03-07T15:13:44.6103@SeanC: According to wikipedia (see link in question), no. That´s ATIS, not NATO. But then, it should be
Juliett
, notJuliet
andX-ray
instead ofXray
. – Titus – 2017-03-07T15:27:01.5331@Titus I removed the dash from xray on purpose because I thought that would complicate any compression trying to decode it, I have no idea how juliet lost a t and for your other question, yes, but just one. – sagiksp – 2017-03-07T19:05:07.160
I found a kind of related joke language. My favorite example usage is Input:
– mbomb007 – 2017-03-07T19:43:06.650= pants nopants
Output:100%, nopants
.Didn't know about that one :D @mbomb007 – sagiksp – 2017-03-07T20:30:12.600
Brings back memories. The answer I had to give in military inspection was always "November-oscar-sierra-romeo-hotel-echo-papa-sierra-romeo-echo-delta-november-alpha-romeo, sir." – Glenn Randers-Pehrson – 2017-03-07T21:15:16.613
See also a related problem with solutions public: http://golf.shinh.org/p.rb?International+Radiotelephony+Spelling+Alphabet
– b_jonas – 2017-03-09T12:45:04.207