diff --git a/client/cfg/c64prg.cfg b/client/cfg/c64prg.cfg index 9cd8359..a9ef89f 100644 --- a/client/cfg/c64prg.cfg +++ b/client/cfg/c64prg.cfg @@ -1,7 +1,7 @@ MEMORY { ZP: start = $02, size = $1A, type = rw, define = yes; IP65ZP: start = $5f, size = $10, type = rw, define = yes; - RAM: start = $07FF, size = $58ab, define = yes, file = %O; + RAM: start = $07FF, size = $77ab, define = yes, file = %O; DISCARD: start = $77FF, size = $10, define = yes; } SEGMENTS { diff --git a/client/inc/nb65_constants.i b/client/inc/nb65_constants.i index 7c15183..ffb646b 100644 --- a/client/inc/nb65_constants.i +++ b/client/inc/nb65_constants.i @@ -33,7 +33,7 @@ NB65_SEND_UDP_PACKET EQU $12 ;inputs: AX points to a UDP packet parame NB65_UDP_REMOVE_LISTENER EQU $13 ;inputs: AX contains UDP port number that listener will be removed from NB65_TCP_CONNECT EQU $14 ;inputs: AX points to a TCP connect parameter structure, outputs: A = connection # -NB65_TCP_SEND_PACKET EQU $15 ;inputs: AX points to a TCP send parameter structure, outputs: none packet is sent +NB65_SEND_TCP_PACKET EQU $15 ;inputs: AX points to a TCP send parameter structure, outputs: none packet is sent NB65_TCP_CLOSE_CONNECTION EQU $16 ;inputs: A = connection # to close, outputs: none NB65_TFTP_SET_SERVER EQU $20 ;inputs: AX points to a TFTP server parameter structure, outputs: none @@ -88,9 +88,8 @@ NB65_TCP_PORT EQU $04 ;2 byte port number (to li NB65_TCP_CALLBACK EQU $06 ;2 byte address of routine to be called whenever a new packet arrives ;offsets in TCP send parameter structure -NB65_TCP_CONNECTION_NUMBER EQU $00 ;1 byte connection number for previously set up connection -NB65_TCP_PAYLOAD_LENGTH EQU $01 ;2 byte length of payload of packet (after all ethernet,IP,UDP/TCP headers) -NB65_TCP_PAYLOAD_POINTER EQU $03 ;2 byte pointer to payload of packet (after all headers) +NB65_TCP_PAYLOAD_LENGTH EQU $00 ;2 byte length of payload of packet (after all ethernet,IP,UDP/TCP headers) +NB65_TCP_PAYLOAD_POINTER EQU $02 ;2 byte pointer to payload of packet (after all headers) ;offsets in TCP/UDP packet parameter structure NB65_REMOTE_IP EQU $00 ;4 byte IP address of remote machine (src of inbound packets, dest of outbound packets) @@ -99,7 +98,6 @@ NB65_LOCAL_PORT EQU $06 ;2 byte port number of loc NB65_PAYLOAD_LENGTH EQU $08 ;2 byte length of payload of packet (after all ethernet,IP,UDP/TCP headers) ; in a TCP connection, if the length is $FFFF, this actually means "end of connection" NB65_PAYLOAD_POINTER EQU $0A ;2 byte pointer to payload of packet (after all headers) -NB65_CONNECTION_NUMBER EQU $0C ;1 byte "connection number" (valid for TCP connections only) ;error codes (as returned by NB65_GET_LAST_ERROR) NB65_ERROR_PORT_IN_USE EQU $80 diff --git a/client/ip65/tcp.s b/client/ip65/tcp.s index 5ce5d77..0632b10 100644 --- a/client/ip65/tcp.s +++ b/client/ip65/tcp.s @@ -1,4 +1,10 @@ ;TCP (transmission control protocol) functions +;NB to use these functions, you must pass "-DTCP" to ca65 when assembling "ip.s" +;otherwise inbound tcp packets won't get passed in to tcp_process +;currently only a single outbound (client) connection is supported +;to use, first call "tcp_connect" to create a connection. to send data on that connection, call "tcp_send". +;whenever data arrives, a call will be made to the routine pointed at by tcp_callback. + MAX_TCP_PACKETS_SENT=8 ;timeout after sending 8 messages will be about 7 seconds (1+2+3+4+5+6+7+8)/4 @@ -12,7 +18,6 @@ MAX_TCP_PACKETS_SENT=8 ;timeout after sending 8 messages will be about 7 sec .export tcp_init .export tcp_process -.export tcp_listen .export tcp_connect .export tcp_callback .export tcp_connect_ip @@ -21,7 +26,7 @@ MAX_TCP_PACKETS_SENT=8 ;timeout after sending 8 messages will be about 7 sec .export tcp_inbound_data_ptr .export tcp_inbound_data_length -.export tcp_ack_number + .import ip_calc_cksum .import ip_send @@ -113,22 +118,22 @@ tcp_ack_number: .res 4 tcp_data_ptr: .res 2 tcp_data_len: .res 2 tcp_send_data_ptr: .res 2 -tcp_send_data_len: .res 2 -tcp_callback: .res 2 +tcp_send_data_len: .res 2 ;length (in bytes) of data to be sent over tcp connection +tcp_callback: .res 2 ;vector to routine to be called when data is received over tcp connection tcp_flags: .res 1 -tcp_inbound_data_ptr: .res 2 -tcp_inbound_data_length: .res 2 - +tcp_inbound_data_ptr: .res 2 ;pointer to data just recieved over tcp connection +tcp_inbound_data_length: .res 2 ;length of data just received over tcp connection +;(if this is $ffff, that means "end of file", i.e. remote end has closed connection) tcp_connect_sequence_number: .res 4 ;the seq number we will next send out tcp_connect_expected_ack_number: .res 4 ;what we expect to see in the next inbound ack tcp_connect_ack_number: .res 4 ;what we will next ack tcp_connect_last_received_seq_number: .res 4 ;the seq field in the last inbound packet for this connection tcp_connect_last_ack: .res 4 ;ack field in the last inbound packet for this connection -tcp_connect_local_port: .res 2 +tcp_connect_local_port: .res 2 ; tcp_connect_remote_port: .res 2 -tcp_connect_ip: .res 4 +tcp_connect_ip: .res 4 ;ip address of remote server to connect to tcp_timer: .res 1 @@ -137,6 +142,10 @@ tcp_packet_sent_count: .res 1 .code +; initialize tcp +;called automatically by ip_init if "ip.s" was compiled with -DTCP +; inputs: none +; outputs: none tcp_init: rts @@ -473,11 +482,6 @@ tcp_send_packet: jmp ip_send ; send packet, sec on error -;listen on the tcp port specified -; tcp_callback: vector to call when data arrives on specified port -; AX: set to tcp port to listen on -tcp_listen: - rts check_current_connection: ;see if the ip packet we just got is for a valid (non-closed) tcp connection @@ -516,14 +520,14 @@ check_current_connection: clc rts -tcp_process: ;process incoming tcp packet +;called automatically by ip_process if "ip.s" was compiled with -DTCP ;inputs: ; eth_inp: should contain an ethernet frame encapsulating an inbound tcp packet ;outputs: ; none but if connection was found, an outbound message may be created, overwriting eth_outp ; also tcp_state and other tcp variables may be modified - +tcp_process: lda #tcp_flag_RST bit tcp_inp+tcp_flags_field diff --git a/client/nb65/nb65_c64.s b/client/nb65/nb65_c64.s index 035b482..6cdd5a3 100644 --- a/client/nb65/nb65_c64.s +++ b/client/nb65/nb65_c64.s @@ -587,7 +587,9 @@ netboot65_msg: main_menu_msg: .byte 13," MAIN MENU",13,13 .byte "F1: TFTP BOOT" -.if !(BANKSWITCH_SUPPORT=$03) +.if (BANKSWITCH_SUPPORT=$03) +.byte " F3: GOPHER" +.else .byte " F3: BASIC" .endif .byte 13 diff --git a/client/nb65/nb65_version.i b/client/nb65/nb65_version.i index a0b445f..20597ad 100644 --- a/client/nb65/nb65_version.i +++ b/client/nb65/nb65_version.i @@ -1 +1 @@ -.byte "0.9.8" +.byte "0.9.14" diff --git a/client/test/Makefile b/client/test/Makefile index 46e9d42..150558a 100644 --- a/client/test/Makefile +++ b/client/test/Makefile @@ -21,7 +21,7 @@ INCFILES=\ all: \ ip65test.dsk \ testdns.prg \ - test_gopher.prg \ + gopher_browser.prg \ testdns.pg2 \ testtftp.prg \ testtftp.pg2\ @@ -42,8 +42,8 @@ all: \ test_tcp.prg: test_tcp.o $(IP65TCPLIB) $(C64PROGLIB) $(INCFILES) ../cfg/c64prg.cfg $(LD) -m test_tcp.map -vm -C ../cfg/c64prg.cfg -o test_tcp.prg $(AFLAGS) $< $(IP65TCPLIB) $(C64PROGLIB) -test_gopher.prg: test_gopher.o $(IP65TCPLIB) $(C64PROGLIB) $(INCFILES) ../cfg/c64prg.cfg - $(LD) -m test_gopher.map -vm -C ../cfg/c64prg.cfg -o test_gopher.prg $(AFLAGS) $< $(IP65TCPLIB) $(C64PROGLIB) +gopher_browser.prg: gopher_browser.o $(IP65TCPLIB) $(C64PROGLIB) $(INCFILES) ../cfg/c64prg.cfg + $(LD) -m gopher_browser.map -vm -C ../cfg/c64prg.cfg -o gopher_browser.prg $(AFLAGS) $< $(IP65TCPLIB) $(C64PROGLIB) %.pg2: %.o $(IP65LIB) $(APPLE2PROGLIB) $(INCFILES) ../cfg/a2bin.cfg diff --git a/dist/version_number.txt b/dist/version_number.txt index b5d0ec5..69010fa 100644 --- a/dist/version_number.txt +++ b/dist/version_number.txt @@ -1 +1 @@ -0.9.8 \ No newline at end of file +0.9.14 \ No newline at end of file diff --git a/doc/C64 gopher client.txt b/doc/C64 gopher client.txt new file mode 100644 index 0000000..bf16e2b --- /dev/null +++ b/doc/C64 gopher client.txt @@ -0,0 +1,33 @@ +C64 gopher browser v0.1 + + +REQUIREMENTS + 1) RR-NET or compatible + 2) DHCP server on LAN + +USAGE + +When run, the program will use DHCP to assign itself an IP address, default gateway and DNS server address. + +You will then be prompted for the address of a gopher server. you can enter a hostname or an ip address. If +you just hit enter at this prompt, "gopher.floodgap.com" will load. NB - in the current version you can only +enter a server name, not a specific resource on that server, or a port (the default gopher port 70 is used). + +Once a gopher resource is loaded, the following keys are active: + +SPACE, F7 or down arrow : scroll down to next page +F1 or up arror : scroll up to previous page +F2 : show recently visited resource +F3 or left arrow : go back to last visited resource +F5 : prompt to enter a new server (nb server name only - not resource or port) +RUN/STOP : quit + +If the page currently being displayed has links to further resources in it, each link will be displayed +starting with a highlighted letter (e.g. the first link on a page will have an inverse "A" next to it, +the 2nd link on a page will have an inverse "B" next to it etc). Press the letter assigned to the link +will load up that resource. + +Currently only Text and Directory resources are handled. + +jonno @ jamtronix.com +2009-07-11 \ No newline at end of file diff --git a/doc/ip65.html b/doc/ip65.html index 53dfb08..9270d01 100644 --- a/doc/ip65.html +++ b/doc/ip65.html @@ -89,7 +89,7 @@ IP65 is a TCP/IP stack for 6502 based computers. Services - TCP + TCP DHCP/DNS/TFTP Echo @@ -153,6 +153,7 @@ IP65 is a TCP/IP stack for 6502 based computers.
   Release	Maintainer	Changes
   -------	----------	-------
+  2009-07-12	Jonno Downes	Initial TCP implementation (use -DTCP to include)
   2009-03-21	Jonno Downes	Added technical reference documentation
   2009-03-15	Jonno Downes	Added DHCP, DNS & TFTP
   2009-01-22	Per Olofsson	Added copymem fix from Jonno Downes. Added MPL license.
diff --git a/doc/nb65_api_technical_reference.doc b/doc/nb65_api_technical_reference.doc
index 2899433..5643bd9 100644
Binary files a/doc/nb65_api_technical_reference.doc and b/doc/nb65_api_technical_reference.doc differ