FizzBuzz is an extremely basic competence test for programmers. So I thought I'd write a version extremely in BASIC. Here it is in BBC Basic's embedded 6502 assembler.
What's that got to do with Perl? Well I used my 6502 emulator written in Perl to develop it on.
10 REM FizzBuzz in 6502 assembler 20 DIM code% 1000 30 OSWRCH = &FFEE 40 OSNEWL = &FFE7 50 work = &70 60 DIM FizzM 4 : $FizzM = "zziF" 70 DIM BuzzM 4 : $BuzzM = "zzuB" 80 FOR pass% = 0 TO 3 STEP 3 90 P%=code% 100 [opt pass% 110 120 .FizzBuzz LDA #1 130 LDX #3 140 LDY #5 150 .FB1 SEC 160 DEX 170 BNE FB2 180 JSR Fizz 190 LDX #3 200 .FB2 DEY 210 BNE FB3 220 JSR Buzz 230 LDY #5 240 .FB3 BCC FB4 250 JSR PrDecimal 260 .FB4 PHA 270 JSR OSNEWL 280 PLA 290 CLC 300 ADC #1 310 CMP #101 320 BCC FB1 330 RTS 340 350 .Fizz PHA 360 LDX #3 370 .Fizz1 LDA FizzM, X 380 JSR OSWRCH 390 DEX 400 BPL Fizz1 410 CLC 420 PLA 430 RTS 440 450 .Buzz PHA 460 LDY #3 470 .Buzz1 LDA BuzzM, Y 480 JSR OSWRCH 490 DEY 500 BPL Buzz1 510 CLC 520 PLA 530 RTS 540 550 .PrDecimal STA work 560 PHA 570 TXA 580 PHA 590 LDA #0 600 PHA 610 .PrDec0 LDX #8 620 LDA #0 630 .PrDec1 ASL work 640 ROL A 650 CMP #10 660 BCC PrDec2 670 SBC #10 680 INC work 690 .PrDec2 DEX 700 BNE PrDec1 710 CLC 720 ADC #ASC"0" 730 PHA 740 LDX work 750 BNE PrDec0 760 .PrDec3 PLA 770 BEQ PrDec4 780 JSR OSWRCH 790 JMP PrDec3 800 .PrDec4 PLA 810 TAX 820 PLA 830 RTS 840 ] 850 NEXT
Acme because
To make the insanity complete I was thinking about writing a small Perl-like language in 6502 code to distribute with Acme::6502. But it turns out that life actually is too short.