x86アセンブリ、512バイト
NASMでコンパイルされ、QEMUでテストされました。ブートするには、ブートセクターの最後に2バイトのブート署名(ファイルに510バイト)を入れる必要があるため、コンパイルされたコードをゼロで埋める317バイトを失いました。これは私の最初のゴルフですので、私はすべての巨大なエラーについて謝罪する必要があります。
[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
出力
これは上記のコードが出力するものです。ご覧のとおり、A:Alfa is missing and that is because the prompt is 25 lines tall...

証明するために私が印刷されたアルファ:Aが、私は交換し0,"ulu"
て32,"Z: Zulu"
ズールーはヤンキーと同じ行に1になるように。

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.