From 7b5f7a9ef768b8020a1656c212d3d6155364dee3 Mon Sep 17 00:00:00 2001 From: jonnosan Date: Sun, 12 Sep 2010 07:58:52 +0000 Subject: [PATCH] git-svn-id: http://svn.code.sf.net/p/netboot65/code@281 93682198-c243-4bdb-bd91-e943c89aac3b --- client/basic/BoB.htm | 189 +++++++++++++++++++++++++++++++++++++++++++ client/basic/KB.htm | 182 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 371 insertions(+) create mode 100644 client/basic/BoB.htm create mode 100644 client/basic/KB.htm diff --git a/client/basic/BoB.htm b/client/basic/BoB.htm new file mode 100644 index 0000000..ef84c8c --- /dev/null +++ b/client/basic/BoB.htm @@ -0,0 +1,189 @@ +

BASIC ON BAILS

+

COMMAND SUMMARY

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CommandDescrptionParametersExample
IPCFGDisplay the current IP stack configurationnone
  • IPCFG
  • MACSet the last 3 bytes of the MAC address. Top 3 bytes will always be "00:80:10".
    This command + also resets the whole IP stack, so new IP address will need to be assigned (via MYIP or DHCP) after calling MAC
    3 byte string
  • MAC "FOO" - MAC will become 00:80:10:46:4F:4F (in PETSCII, $46 is 'F' and $4F is 'O')
  • DHCPUse DHCP to assign IP address, netmask, default gateway and DNS server none
  • DHCP
  • MYIPAssign a new IP address
  • IP address (string)
  • MYIP"10.1.1.2"
  • NETMASKAssign a new netmask
  • netmask (string)
  • NETMASK"255.255.255.0"
  • GATEWAYAssign a new default gateway (router to send non-local traffic to)
  • gateway IP address (string)
  • GATEWAY"10.1.1.1"
  • DNSSpecify the DNS server to be used for resolving hostnames
  • DNS server IP address (string)
  • DNS"10.1.1.1"
  • PINGSends a number of ICMP echo requests to the specified host. For each packet sent, if a response is received a "." is displayed, if an error occurs (including a timeout) then a "!" is displayed.
  • hostname or IP ddress (string)
  • [optional] number of PING request to be sent (1..255) - default is 3
  • PING"JAMTRONIX.COM"
  • PING"10.1.1.1",10
  • HTTPDstart listening on a TCP port for inbound HTTP requests. When a HTTP request is received, go to the specified +default line number, unless the request happens to be for a path that has previously been HOOKed
  • port number (1..65535)
  • line number (1..65535)
  • HTTPD80,100 - will listen on port 80 and GOTO line 100 when a HTTP request is received
  • HOOKsociate the 'path' part of a URL with a BASIC line number to jump to when a request for the specified path is received
  • path (string) - must start with "/"
  • line number (1..65535)
  • HOOK"/HELLO",200 - line 200 will be executed if request for "/HELLO" is received
  • TYPEchange the HTTP Content Type field in the HTTP header +from the default "text/html" to whatever is specified. Be careful with +case - the remote end will be expecting ASCII not PETSCII! For this to be effective, it must +be set BEFORE any data is output with the ! or XSEND keywords
  • mime type (string)
  • TYPE"application/octet-stream"
  • STATUSchange the HTTP status line from default +"200 OK". Be careful you include the 3 digit code (as an ASCII string) +then a space then a free form status description (ASCII NOT PETSCII). +To be effective, it must be set BEFORE any data is output with the ! or XSEND keywords
  • HTTP status line (string)
  • STATUS"404 File Not Found"
  • !Send specified string expression. If no +HTTP header has been sent yet, one will be sent now. +
  • string to output
  • !"<H1>HELLO WORLD</H1>"
  • XSENDSend a file from the default drive. If the file does +not exist, then an error message will be sent to the remote browser. If no HTTP header has +been sent yet, one will be sent first.
  • filename (string)
  • XSEND"FAVICON.ICO"
  • YIELDfinish processing the current request, go back and wait for +another HTTP request.
  • none
  • YIELD
  • +

    Magic Variables

    +The following BASIC variables are set by BASIC ON BAILS whenever a HTTP request is being handled. +

    PA$

    +Set to the "path" part of the HTTP request. +

    Query String Variables

    +For each variable in the query string part of the HTTP request,the value is +decoded and stuck into a BASIC string variable. +
    +
    +Only the first letter of the query string variable is significant, +i.e. query strings N, NA, NAME, all would map to N$. +
    +
    +If there are multiple query string variables that all start with the +same letter, the LAST such variable in the query string is the one +that would be effective +.e.g if BASIC ON BAILS is processing a HTTP request with a query string /FOO?N=1&NA=2?NAME=3 then +in the BASIC handler, N$ would be "3", and NA$ and NAME$ would be +empty (BASIC only treats first 2 chars as significant anyway, so NA$ +is same as NAME$) +
    +

    STARTUP

    +If you try and load BASIC ON BAILS twice (or some other BASIC extender before BASIC ON BAILS) you will get an 'insufficient memory' error. +
    +
    + +After BASIC ON BAILS has been installed, it will attempt to load (and run) a file (from whatever device BASIC ON BAILS was loaded from itself) called "INDEX.BAS". +If this file does not exist, then BASIC ON BAILS will exit with 'FILE NOT FOUND ERROR IN 10". This error can be ignored - you can load any file you want from then, or type +in a new one, or even use the commands in interactive mode. +
    +
    +

    ERROR HANDLING

    +Before HTTPD is called, BASIC errors are treated normally, i.e. on a SYNTAX ERROR or TYPE MISMATCH error, an error will be displayed on the screen, and +program execution will stop. But once you have fired up HTTPD, any BASIC errors are displayed on the +screen AND passed back to the browser as a HTTP error, and are non-fatal i.e. the HTTPD loop will keep running. You can exit HTTPD by +pressing RUN/STOP though. +

    EXAMPLE

    +
    +
    +5 MAC CHR$(192)+CHR$(29)+CHR$(85)
    +10 DHCP
    +20 HOOK"/HELLO",1000 
    +25 FA$="/"+CHR$(102)+CHR$(97)+CHR$(118)+CHR$(105)+CHR$(99)+CHR$(111)
    +27 FA$=FA$+CHR$(110)+CHR$(46)+CHR$(105)+CHR$(99)+CHR$(111)
    +30 HOOKFA$,2000
    +40 HTTPD80,100
    +
    +100 !"<H1>HELLO</H1>"
    +110 !"<FORM ACTION=/HELLO>"
    +120 !"WHAT'S YOUR NAME?"
    +130 !"<INPUT TYPE=TEXT NAME=N>"
    +140 !"</FORM>"
    +200 YIELD
    +
    +1000!"HELLO "+N$+", I'M A C64 RUNNING BASIC ON BAILS."
    +1010 FOR I=1 TO 10
    +1020 !"<BR>"
    +1030 !STR$(I)
    +1040 NEXT I
    +1100 YIELD
    +
    +2000 TYPE"IMAGE/X-ICON"
    +2010 XSEND"FAVICON.ICO"
    +2020 YIELD
    +
    +
    +
    + + diff --git a/client/basic/KB.htm b/client/basic/KB.htm new file mode 100644 index 0000000..ada56fc --- /dev/null +++ b/client/basic/KB.htm @@ -0,0 +1,182 @@ +

    KIPPER BASIC

    +

    COMMAND SUMMARY

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    CommandDescrptionParametersExample
    IPCFGDisplay the current IP stack configurationnone
  • IPCFG
  • MACSet the last 3 bytes of the MAC address. Top 3 bytes will always be "00:80:10".
    This command + also resets the whole IP stack, so new IP address will need to be assigned (via MYIP or DHCP) after calling MAC
    3 byte string
  • MAC "FOO" - MAC will become 00:80:10:46:4F:4F (in PETSCII, $46 is 'F' and $4F is 'O')
  • DHCPUse DHCP to assign IP address, netmask, default gateway and DNS server none
  • DHCP
  • MYIPAssign a new IP address
  • IP address (string)
  • MYIP"10.1.1.2"
  • NETMASKAssign a new netmask
  • netmask (string)
  • NETMASK"255.255.255.0"
  • GATEWAYAssign a new default gateway (router to send non-local traffic to)
  • gateway IP address (string)
  • GATEWAY"10.1.1.1"
  • DNSSpecify the DNS server to be used for resolving hostnames
  • DNS server IP address (string)
  • DNS"10.1.1.1"
  • TFTPSpecify the TFTP server that will be accessed by TFPUT and TFGET.
  • TFTP server IP address or hostname (string)
  • TFTP"10.1.1.5"
  • TFTP"JAMTRONIX.COM"
  • PINGSends a number of ICMP echo requests to the specified host. For each packet sent, if a response is received a "." is displayed, if an error occurs (including a timeout) then a "!" is displayed.
  • hostname or IP ddress (string)
  • [optional] number of PING request to be sent (1..255) - default is 3
  • PING"JAMTRONIX.COM"
  • PING"10.1.1.1",10
  • NETCATOpen a TCP connection to a remote server. Any data received on the connection will be displayed on screen, any keypress will be sent to the remote server. To exit, hit RUN/STOP.

    The optional mode paramater determines whether the connection should be in PETSCII 'char at a time' mode, where every keypress is sent 'as is' to the remote site, or ASCII 'line mode', which allows a line to be edited and is sent (with a CR/LF at the end) only when the RETURN key is pressed. In this mode, data is converted between the PETSCII character set and standard ASCII - you will need to shift to the "lower case" char set for this to display properly. +

    The PETSCII mode is appropriate for connecting to e.g. a PETSCII BBS. The ASCII mode is appropriate for connecting to a server running a "network ASCII" derived protocol, e.g. SMTP or HTTP. + ' + +
  • hostname or IP ddress (string)
  • port number (1..65535)
  • [optional] mode:
    • 0=PETSCII (default)
    • 1=ASCII
  • NETCAT"JAMTRONIX.COM",6464
  • NETCAT"10.1.1.1",25,1
  • TFPUTUpload a file to a TFTP server. By default, TFPUT will use the broadcast address (255.255.255.255), meaning +any TFTP server on the LAN will respond. To send a file to a specific TFTP server (including one not on the local network), specify the +destination TFTP server with the "TFTP" command prior to calling TFPUT. The filename specified will be looked for on whichever drive was last accessed.
  • filename (string)
  • TFPUT"KIPPERBAS.PRG"
  • TFGETDownload a file from a TFTP server. By default, TFPUT will use the broadcast address (255.255.255.255), meaning +any TFTP server on the LAN will respond. To download a file from a specific TFTP server (including one not on the local network), specify the +destination TFTP server with the "TFTP" command prior to calling TFGET. The file will be written (as a PRG file) to whichever drive was last accessed.
  • filename (string)
  • TFGET"KIPPERBAS.PRG"
  • TCPCONNECTOpen a TCP connection to a remote server.
  • hostname or IP address (string)
  • port number (1..65535)
  • TCPCONNECT"JAMTRONIX.COM",70
  • TCPCONNECT"10.1.1.1",80
  • TCPLISTENWait for an inbound TCP connection from a remote client. This is a blocking command, i.e. the BASIC program will not continue executing until either an inbound connection is made, or the program is terminated by pressing RUN/STOP
  • port number (1..65535)
  • TCPLISTEN 80
  • POLLCheck for network traffic. If data has arrived on a previously opened TCP connection, that data (up to a maximum of 255 bytes) will be set into string variable IN$.If no data has arrived since the last POLL, then IN$ will be an empty string. Integer variables CO% and ER% +are also set to indicate current connection state and error conditions (if any). + + +nonePOLL
    TCPSENDSend a string (up to 255 bytes) over a previously opened connection.Integer variables CO% and ER% ae aset to indicate current connection state and any error condition which may occur during the sending of the file. NB - in the current implementation of Kipper BASIC, it is possible for data to arrive during a call to TCPSEND, which may not be passed through to the BASIC program.
  • data (string)
  • TCPSEND"HELLO "+"WORLD"
  • TCPBLATSend a file (of any length) over a previously opened connection. The file will be looked for on the current 'default' device, i.e. which ever drive was last accessed. Integer variables CO% and ER% ae aset to indicate current connection state and any error condition which may occur during the sending of the file. NB - in the current implementation of Kipper BASIC, it is possible for data to arrive during a call to TCPSEND, which may not be passed through to the BASIC program.
  • filename (string)
  • TCPBLAT"GOPHERMAP.TXT"
  • + +

    Magic Variables

    +The following BASIC variables are set by the TCP commands and POLL. +

    CO%

    +
  • CO%=1 means there is a current TCP connection
  • +
  • CO%=0 means there is no current TCP connection (either one has never been opened, or else it has been closed) + +

    ER%

    +ER% is set to indicate any error occuring inside the ip65 TCP/IP stack that Kipper BASIC is built on top of. +Possible values: + + + + + + + + + + + + + + + + + + + +
    ERROR CODE
    HEX / DEC
    DESCRIPTION
    $80 / 128PORT IN USE
    $81 / 129TIMEOUT ON RECEIVE
    $82 / 130TRANSMIT FAILED
    $83 / 131TRANSMISSION REJECTED BY PEER
    $84 / 132INPUT TOO LARGE
    $85 / 133DEVICE FAILURE
    $86 / 134ABORTED BY USER
    $87 / 135LISTENER NOT AVAILABLE
    $88 / 136NO SUCH LISTENER
    $89 / 137CONNECTION RESET BY PEER
    $8A / 138CONNECTION CLOSED
    $8B / 139TOO MANY ERRORS
    $90 / 140FILE ACCESS FAILURE
    $A0 / 160MALFORMED URL
    $A1 / 161DNS LOOKUP FAILED
    $FE / 254OPTION NOT SUPPORTED
    $FF / 255FUNCTION NOT SUPPORTED
    + +

    STARTUP

    +If you try and load Kipper BASIC twice (or some other BASIC extender before Kipper BASIC) you will get an 'insufficient memory' error. +
    +
    + +After Kipper BASIC has been installed, it will attempt to load (and run) a file (from whatever device Kipper BASIC was loaded from) called "AUTOEXEC.BAS". +If this file does not exist, then Kipper BASIC will exit with 'FILE NOT FOUND ERROR IN 10". This error can be ignored - you can load any file you want from then, or type +in a new one, or even use the commands in interactive mode. +
    +
    +For example, try: +
    +DHCP:NETCAT"JAMTRONIX.COM",6464
    +
    + +