A TCP/IP Stack and Web Server In BASIC
A writes "Back in the day, a BASIC interpreter was standard on every home computer system and everyone had to know at least a little BASIC to be able to use their computer. But who would have thought that you could write some serious networking code in BASIC over 20 years later? Just a few days ago, Lee Davison released the BASIC source code for his 6502-based Ethernet web server. The web server runs under his EhBASIC interpreter on the 1 MHz 6502 CPU and is able to blast out web pages at an amazing speed of 20-35 seconds per page!" Sure, it's not really practical, but I give it cool points.
If you want to slashdot it, the IP address is visible in some of the screen shots. It's 169.254.226.132, but I'm not cruel enough to actually turn that into a hyperlink. :-)
At 20+ secs per page - immediately?
(I know the article isn't on the EhBASIC webserver - I was talking about any page served up by the webserver alone.)
ten out of ten for style, but minus several million for good thinking.
//e's lying around. Maybe I'll dig up an ethernet card and see if i can get this to work.
I actually have some Apple
Imagine a beowulf cluster of... Nah...
You cant fight in here, its a war room!
"Pre-slashdotted for your convenience."
Seriously cool! I'm going to key it into my TRS-80 right now!
with my fax machine. It's not nearly as cool though.
Can the code really be called BASIC? It looks more like tons of in-line assembly code, wrapped in a few ifs and loops.
Fat-fingered the paste. Rather, the source code is here.
someone will come up with a shell script webserver.
Isn't he worried about someone else commercialising this?
Yes, actually. Look in your ports collection. A real quick grep turned this up:
y abasic/
$ ls | grep basic
bwbasic/
gnomebasic/
pbasic/
wxbasic/
No matter where you go... there you are.
A lot of microcontrollers can be programmed in Basic-like languages. It's easy to write basic interpreters/compilers because of the limited features of the language. Remember that "pure" basic doesn't have a subroutine concept at all (besides the very limited GOSUB), and no local variables. Commercial PLC systems have been using Basic as the "high-level"-language of choice for ages. Though they are now more and more moving to IEC-61131-compatible languages like ST ("structured text") and graphical languages.
I've looked at assembly and not understood it, I've looked at C and not understood it, and I think every time I have looked anything in perl I've not understood it. But, now the unthinkable has happened and I've looked at basic and not understood it.
Nyquil = Nectar of the devil
It's the chuncking through those data statements at the end that helps really beats up performance. Defining all those as strings at the beginning will ameliorate that problem.
Screw that - I want a version of FreeBSD written in BASIC
And here I was thinking this was some sort of obscure Canadian BASIC..
inline-assembler
definable functions
re-entrant procedures
http://www.bbcbasic.com/
Sophie Wilson did a great job and did anyone at school in the UK who was interested in computing the biggest favour of all - she gave us the gift of learning structured programming from day 0
There are places where the networks are not touching,and there are places where they are-Boeing's Lori Gunter
When I first read its name, I thought it was Canadian. :)
Shh.
Why can't everyone just agree that BASIC is dead, should stay dead and preferably staked through the heart? I personally can't see any use at all for BASIC.
I'd probably agree with you on that one.... but it's interesting to note that many of the commonly-criticized features of Basic were the result of memory-kludges and featuritis, that the original designers of Basic did not approve of at all (according to their book 'Back to Basic').
Unfortunately, I don't have the book to hand to check out the details, but here's a link to it anyway.
"Slashdot - News and Chat Sites Deviant". (Click "homepage" link above for details).
Actually, Parallax was doing this since what... 1992? They got TCP/IP stack for their BasicStamps too. But of course, their stuff runs a bit faster than 1MHz... :)
They were slow and limited, but playing with them and extending them was a great way to learn. After those came the Small C compilers--never looked back.
One line blog. I hear that they're called Twitters now.
Until it breaks mozilla while running fine in IE.
Ooh, moderator points! Five more idjits go to Minus One Hell!
Delendae sunt RIAA, MPAA et Windoze
unlike the others I wrote mine from scratch in response to the post
sadly I posted a slightly wrong version
here's the one that works
http://www.proweb.co.uk/~matt/rc/webserver.rc
it's only a toy, of course.
http://server/../../../../../../etc/passwd
will get you the passwd file
There are places where the networks are not touching,and there are places where they are-Boeing's Lori Gunter
Who saw that and thought lda #254, $e2 - wtf, illegal opcode? :-)
... for stuff like this. The annual Totally worthless, 100% hack value, too-much-geek-time-to-spare prize. And the 6502 BASIC TCP/IP stack-based web server should be the first winner.
It's worth mentioning that, for the C64/128 at least, you could actually have variable names longer than two characters but only the first two characters would be recognized. All the rest were ignored. By way of example, here's a made up code sample. Since my C128 is currently in the closet, I can't guarentee this example's accuracy. Some other pedant may wish to.
Example
10 LET FROGS = 16
20 LET FRAGGLE = 12
30 LET FRANCE = FROLLIC * FROBNITZ
40 PRINT FROGS
Output: 144
Furry cows moo and decompress.
I use it in conjunction with .NET and ANSI C. Check out their company history for some background then take a look at the delicious capabilities of their Windows and Console compilers.
They also have a kick-ass DOS Compiler that has put dinner on my table for years. As we know, many people are still using DOS and DOS-mode apps every day.
When looking at PowerBASIC you have to get rid of any preconcieved notions of BASIC or how it has been implimented in the past. PowerBASIC is a dream to use, has a huge community, and compilers smaller and faster than most ANSI C programs I've seen. Also, check out their partial client list - you'll be in good company.
No, I do not work for them. I am a loyal customer and a geek that loves cool stuff. PB delivers.
Somebody needs to attend the Vintage Computer Festival! The TRS-80 Model I, II, III, 4, et al used the Z-80, not the 6502. Unless you mean the Color Computer, which (iirc) used the 6809. There was another one (Model 6000?) that used the 68000, iirc. But no 6502's.
Stupid people will be persecuted to the fullest extent allowed by law.
Okay, I recognize the value of doing this (as a hobbyist myself). The fortitude required to accomplish such a feat is noteworthy. However, I have noticed a strange trend in these kinds of posts on Slashdot. Why do so many people respond with comments like, "I didn't know it could be done!"?.
Technically, all of these languages are mathematically reducible to Turing machines. Thus, they are all *technically* able to perform the same tasks (ok, sure, you might have to extend your interpreter/compiler to handle things like syscalls, but hey, it's within the scope of reasonability). We could effectively use any programming language to produce any program. If the first web server is written in C, then by mathematical extension, we know that it could also be written in Perl, Forth, Fortran, and even BASIC. The difference is just that it might be a royal pain.
I don't mean to denigrate the work this guy did -- in fact I'm amazed that he did it. But I'm not amazed *that it's possible*.
What should elicit such responses? If the guy wrote a web server in HTML (a markup language). That is theoretically impossible. There are all kinds of languages that are not reducible to Turing machines -- make a web server using nothing but regular expressions and *I'll* say "Wow, I didn't know that was possible!"
-Josh O-
VB is alive and well, and used for pretty much the same reason as original BASIC - simplicity.
I would agree it still lives, but disagree about your reasons...
VB strips away all the simplicity normally present in BASIC, in that if you know basic, you don't necessarily know VB (very similar to C vs JAVA... They have very similar atomic statements, but the different paradigm makes proficiency in one not map 1-to-1 to the other).
VB excels in making pretty GUIs under Windows. I have yet to find a language that makes creating a spiffy user interface anywhere *near* so easy. People rave about JAVA for GUIs, but I would say that, line-for-line, it takes just as much work as using pure Win32. Tk does fairly well, as long as you like the system default of everything, but if you want more control, it makes you jump through all sorts of unpleasant hoops. But VB... Just no way to beat its level of GUI-oneness.
Unfortunately, it crawls when it comes to execution speed. I remember writing an app for a professor back in college, did nothing but text processing and a few simple stats to compile student evaluation surveys. Running through a list of only 30-50 students took almost two minutes. Incidentally, I prototyped it in C (but he wanted a spiffy GUI, and I hadn't yet mastered raw Win32), and the same thing would finish in well under a second.
--- Gary McClellan
34040 DATA "HTTP/1.0 200 OK",$,"Content-Type: text/html",$,$
;)
34041 DATA "<HTML><HEAD><TITLE>Error 404</TITLE></HEAD><BODY BGCOLOR=#"
is it just me who's spotted that the 404 page isn't really a 404?
A server written like...
1248 goto 10
I know rusty was trying to cut costs on kuro5hin.org, but this is rediculous.