What's missing from this list?

What do you see missing from this LIST?
I found it interesting to note the widely variable program lengths.
Also notice versions in Malbolge, Esoteric Perl, and Shakespeare. lol
I found it interesting to note the widely variable program lengths.
Also notice versions in Malbolge, Esoteric Perl, and Shakespeare. lol
Comments
It might be a bit of a challenge to write this, because you would have to add the code for a TV or VGA driver or a serial port driver.
BCX basic is not there, but it is the same as most other Basic languages, ie PRINT "Hello World"
jabaco is not there, but it is the same as vb6, ie Msgbox("Hello World")
For the old-skool gang, nice to see Z80 is there.
PBASIC is in there, and one of the examples blinks an LED.
That PBASIC program that just flashes a LED is a bit of a cheat, since it is not doing anything analogous to communicating the message "Hello, world!".
But how about one that flashes out "Hello, World!" using morse code? Anyone want to program that up in SPIN and lodge it?
Ross.
I disagree. When using a micro-controller for the first time, a blinking LED says "hey there. I'm working." very nicely.
I'm looking at kyedos thinking what you could strip out.
1) attach a vga monitor to pins 16 to 23
2) Main code
OBJ VT100: "VGA_1024_VT100" ' VGA VT100 Terminal Driver
3) include all that code, including the sub object vga : "vga_80x40"4) Strip out all the code not used for printing "Hello World"
5) some housekeeping
VT100.start(16) ' start the vga driver VGA starts on pin 16 VT100.startcursor ' start the cursor VT100.color(%00001000_11111100) ' Blue_White blue =3/4 power 10, white =full VT100.cursorset(5) ' cursor type 5
6) print it outvt100.str("Hello World") ' send to vga screen
Rather than trying to hide any of this complexity, I would highlight it. eg - here is a software vga driver. Here are the fonts for this text. Here is how to change the text color.
I think that really shows the flexibility of the propeller in being able to emulate things that once upon a time would have required extra support chips.
I'd also emphasise that this is a chip with a monitor/tv directly connected to some of the pins. Coz I think that is a really cool feature of the propeller!
I disagree. The spirit of the hello world program is:
1) To print the message "Hello World!" on whatever device the user can read it.
2) To do so with the least amount of code.
3) Basically it the simplest thing required to show that the compiler, tool chain and system on which it runs does actually work.
To that end no regard is paid to any operating system required to run the thing, or device drivers, or libraries it may have to be linked with.
Look at the C version (The mother of them all) it pulls is stdio.h with no worries about how big and complicated that may be or what else it may pull in or what libraries and OS support is required to make printf work.
So I propose that in the spirit of the thing hello world in Spin looks like this:
CON _clkmode = xtal1 + pll16x _xinfreq = 5_00_000 baud = 115_200 OBJ console : "FullDuplexSerial" PUB start console.start(31, 30, 0, baud) console.str(string("Hello, world!", 13))
The CON section is required to get a stable good clock frequency running.
The OBJ section is require to pull in the serial driver. FullDuplexSerial is supplied with the Parallax Propeller Tool so I'm going to consider it equivalent to stdio in C for example.
The serial console needs starting and the the string can be printed.
That's it.
Of course anyone can "fix" it if they like.
I suggest it should just contain the tx side of a UART driver and enough code to print the message. It will need to be wrapped in Spin to get it started though.
All that is required is a composite monitor and 1 pin and a resistor anywhere between 240R and 1K.
Shows off how easy the software and hardware is
I have not tested as no composite monitor available at the moment. I just stripped out most of the demo code for this. It is set for 64x25 NTSC.
CON _XINFREQ = 5_000_000 + 0000 _CLKMODE = XTAL1 + PLL16X tvPin = 14 'TV pin (1-pin version) (best pin to use if trying on existing circuit) OBJ TV : "Debug_1pinTV" ' TV (Composite Video, monochrome) driver using 1 pin and 1 resistor PUB main TV.start(tvPin) 'start the 1pinTV driver TV.chr(0) 'clear screen TV.str(string("Hello World",13))
Postedit: Just realised, this is the only code required to be posted.
Heater: Since you have an a/c would you loke to post this too?
Comment: Using 1 pin and a resistor of 100R-1K ohms and an external monitor, you can print "Hello World" to your screen and the 1pinTV software driver.
Hmm heater, yes, the more I think about it, the more you may be right there.
You used the example of C on the PC.
printf("Hello World\n");
and one might then say that you need STDIO. Well, that kind of goes without saying. And an operating system? Well, *of course* you need an operating system. And video drivers for you particular monitor? Well, yes, that too.
So...
If all of that is allowed to be added on a PC, then by the same logic, I propose this single line of code for Spin:
TV.str(string("Hello World",13))
No, a single line like that will not do. That ignores requirement 3) that we have complete program that will compile and run so as to verify that the tool chain and execution environment works.
I'm just assuming that FullDuplexSerial is available in the same way as helloworld in C assumes the presence of stdio.h and the required libraries to make it work.
Difference is that in C the IO is part of the standard for the language but in Spin it is not. But FDX is sort of standard for Spin as it comes with the Prop Tool.
#include <stdio.h> int main( void ) { printf("Hello, world!\n"); return 0; }
You need to include stdio, but you don't need to list the code in stdio.
So does that mean one can include libraries that came with the standard download of the prop tool?
In which case, I vote for the code in post #8, but I don't think you need to add any more code as alluded to in post #10. I see that is on the website now. Nice work.
The spirit of helloworld is that it is the minimum a user has to write to checkout that everything works. I think we have that now.
However I think there should also be single COG PASM verxsion on that list as well.
I did not mention the indenting. Language features are not much referred to on that page.
'
The list is impartial and biased.
Just as well, that snippet will compile without indenting anyway.
For a cut-paste and execute approach here is a PASM ... Hello World that works up to 250k baud. No other drivers or libraries required.
CON _CLKMODE = XTAL1 + PLL16X _CLKFREQ = 80_000_000 Baud = 250000 TX = 30 PUB start cognew(@PASM, string(" PASM Hello World! ")) repeat DAT PASM org or dira, PinMask 'Make min an Output or outa, PinMask 'Set pin HIGH Clear mov Index, par add Index, #2 NextChar rdbyte Buff, Index wz if_z jmp #Clear add Index, #1 add Buff, #$100 'Add Start Bit shl Buff, #1 'Add Stop Bit mov BitCount, #10 'Start Bit + Stop Bit + Byte = 10 bits Bits ror Buff, #1 wc 'Send Bit LSB first muxc outa, PinMask mov delay, BaudDelay 'Pause based on Baud djnz delay, #$ djnz BitCount, #Bits 'More Bits to send? jmp #NextChar 'Send Next Character PinMask long |<TX BaudDelay long ((_CLKFREQ / Baud)>>2)-5 delay long 0 Index long 0 Buff long 0 BitCount long 0
Serves me right! It is in fact adjusted within the program but that feels wrong. Thanks for pointing out my oversight Beau
CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 LED = 23 PUB Start | i dira[LED]~~ repeat repeat i from 0 to 5 repeat 32 outa[LED] := (Hello[i] <-= 1) < 0 waitcnt(clkfreq / 5 + cnt) DAT Hello long $aa22ea2e->1,$a3bb8eea->1,$ee02ee3b->1,$b8ba2ea3->1,$a8ebaee0->1,0
-PhilCON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 BUZZER1 = 0 BUZZER2 = 1 TONE = 1000 PUB Start : i FRQA := (|<30) / (clkfreq / TONE) * 4 dira[BUZZER1]~~ dira[BUZZER2]~~ CTRA := %00101 << 26 | BUZZER1 << 9 | BUZZER2 << 0 repeat repeat i from 0 to 5 repeat 32 if (Hello[i] <-= 1) < 0 CTRA := %00101 << 26 | BUZZER1 << 9 | BUZZER2 << 0 else CTRA := 0 waitcnt(clkfreq / 20 + cnt) DAT Hello long $aa22ea2e->1,$a3bb8eea->1,$ee02ee3b->1,$b8ba2ea3->1,$a8ebaee0->1,0