What's missing from this list?
Martin Hodge
Posts: 1,246
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 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 6) print it out
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:
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.
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:
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.
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.
Serves me right! It is in fact adjusted within the program but that feels wrong. Thanks for pointing out my oversight Beau I need my coffee consume sorted out.
-Phil