Slashdot Mirror


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.

6 of 251 comments (clear)

  1. Re:Down in three seconds flat by ultrapenguin · · Score: 5, Informative

    NetRange: 169.254.0.0 - 169.254.255.255
    is one of those "non-routable private IP address spaces".

    RTFRFC

  2. data statements by magarity · · Score: 5, Informative

    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.

  3. Not new by wumpus188 · · Score: 4, Informative

    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... :)

  4. R *this* FRFC. by L.+J.+Beauregard · · Score: 4, Informative
    There are more special IP ranges than the private network ranges in RFC 1918. They are documented in RFC 3330. The one in question is:

    169.254.0.0/16 - This is the "link local" block. It is allocated for communication between hosts on a single link. Hosts obtain these addresses by auto-configuration, such as when a DHCP server may not be found.
    --
    Ooh, moderator points! Five more idjits go to Minus One Hell!
    Delendae sunt RIAA, MPAA et Windoze
  5. Re:Looks more like assembler to me... by yellowstone · · Score: 4, Informative
    Variable names limited to two characters

    What BASIC had that limitation? Surely none that I ever used as a kid (mid 80s).

    The BASIC on the Commodore C64/C128 did. The BASIC on the TI-99/4 did. The BASIC on the PDP-11/45 where I first programmed did by default (you could issue an EXTEND keyword to allow longer identifiers -- back then I didn't see why you'd want to bother with all that typing...)

    (mid 80s).
    Newb. ;-)
    --
    150 Opening BINARY mode data connection for slashdot.sig (129323052 bytes).
  6. Re:Looks more like assembler to me... by McDutchie · · Score: 4, Informative
    Old-skool BASIC was really heinous:

    * Variable names limited to two characters
    This restriction was not universal, it depended on the dialect (there was, and is, no such thing as a standardized BASIC language).
    * Only data types are integers and strings
    I'm pretty sure that all variants had floating point data types as well.
    * No structured data types, only (fixed size) arrays
    But you could DIM them dynamically using a variable.
    * No names in control flow, just GOTO 100 and GOSUB 9000. No parameters for subroutines.
    Mostly true, but control flow was a bit better than that: there was also ON X GOTO 10,20,50,80 (which would go to line 10 if X=1, line 20 if X=2, etc) as well as ON X GOSUB in the same way.

    Also, there were user-defined one-line functions with parameters, which could even be recursive, as in: DEF FNX(P1,P2)=Y where X is the function name, P1 and P2 are parameters and Y is an expression.
    * Plus, it was typically interpreted, for extra slowness at run time.
    No argument there!