git-svn-id: http://svn.code.sf.net/p/netboot65/code@214 93682198-c243-4bdb-bd91-e943c89aac3b

This commit is contained in:
jonnosan 2009-11-07 06:00:54 +00:00
parent 1c6f188cb3
commit e31b8fd30c
13 changed files with 270 additions and 111 deletions

View File

@ -45,6 +45,7 @@ netboot.bin: netboot.o $(IP65LIB) $(C64PROGLIB) $(INCFILES) ../cfg/c64_8kcart.cf
kipperkart.bin: kipperkart.o $(IP65TCPLIB) $(C64PROGLIB) $(INCFILES) ../cfg/c64_16kcart.cfg
$(LD) -m kipperkart.map -vm -C ../cfg/c64_16kcart.cfg -o $@ $< $(IP65TCPLIB) $(C64PROGLIB)
ruby fix_cart.rb $@ 16384
ruby set_ip_config.rb $@ mac auto
ruby dupe_cart.rb kipperkart.bin kipperkart_29c040.bin 32
kipperterm.bin: kipperterm.o $(IP65TCPLIB) $(C64PROGLIB) $(INCFILES) ../cfg/c64_16kcart.cfg

View File

@ -98,6 +98,9 @@ warm_init:
lda #$05 ;petscii for white text
jsr print_a
lda #14
jsr print_a ;switch to lower case
;relocate our r/w data
ldax #__DATA_LOAD__
stax copy_src
@ -116,9 +119,9 @@ warm_init:
jsr copymem
ldax #netboot65_msg
jsr print
jsr print_ascii_as_native
ldax #init_msg+1
jsr print
jsr print_ascii_as_native
jsr ip65_init
bcs init_failed
@ -133,13 +136,11 @@ init_failed:
jmp exit_to_basic
print_main_menu:
lda #21 ;make sure we are in upper case
sta $d018
jsr cls
ldax #netboot65_msg
jsr print
jsr print_ascii_as_native
ldax #main_menu_msg
jmp print
jmp print_ascii_as_native
init_ok:
@ -153,20 +154,16 @@ main_menu:
cmp #KEYCODE_F1
bne @not_f1
jsr cls
lda #14
jsr print_a ;switch to lower case
ldax #telnet_header
jsr print
jsr print_ascii_as_native
jmp telnet_main_entry
@not_f1:
cmp #KEYCODE_F3
bne @not_f3
jsr cls
lda #14
jsr print_a ;switch to lower case
ldax #gopher_header
jsr print
jsr print_ascii_as_native
jsr prompt_for_gopher_resource ;only returns if no server was entered.
jmp exit_gopher
@not_f3:
@ -174,8 +171,6 @@ main_menu:
cmp #KEYCODE_F5
bne @not_f5
jsr cls
lda #14
jsr print_a ;switch to lower case
ldax #gopher_initial_location
sta resource_pointer_lo
@ -187,15 +182,28 @@ main_menu:
cmp #KEYCODE_F7
beq @change_config
cmp #KEYCODE_F8
bne @not_f8
jsr cls
ldax #netboot65_msg
jsr print_ascii_as_native
ldax #credits
jsr print_ascii_as_native
ldax #press_a_key_to_continue
jsr print_ascii_as_native
jsr get_key_ip65
jmp main_menu
@not_f8:
jmp @get_key
@change_config:
jsr cls
ldax #netboot65_msg
jsr print
jsr print_ascii_as_native
ldax #config_menu_msg
jsr print
jsr print_ascii_as_native
jsr print_ip_config
jsr print_cr
@get_key_config_menu:
@ -207,9 +215,9 @@ main_menu:
cmp #KEYCODE_F1
bne @not_ip
ldax #new
jsr print
jsr print_ascii_as_native
ldax #ip_address_msg
jsr print
jsr print_ascii_as_native
jsr print_cr
ldax #filter_ip
ldy #20
@ -232,9 +240,9 @@ main_menu:
cmp #KEYCODE_F2
bne @not_netmask
ldax #new
jsr print
jsr print_ascii_as_native
ldax #netmask_msg
jsr print
jsr print_ascii_as_native
jsr print_cr
ldax #filter_ip
ldy #20
@ -257,9 +265,9 @@ main_menu:
cmp #KEYCODE_F3
bne @not_gateway
ldax #new
jsr print
jsr print_ascii_as_native
ldax #gateway_msg
jsr print
jsr print_ascii_as_native
jsr print_cr
ldax #filter_ip
ldy #20
@ -284,9 +292,9 @@ main_menu:
cmp #KEYCODE_F4
bne @not_dns_server
ldax #new
jsr print
jsr print_ascii_as_native
ldax #dns_server_msg
jsr print
jsr print_ascii_as_native
jsr print_cr
ldax #filter_ip
ldy #20
@ -310,9 +318,9 @@ main_menu:
cmp #KEYCODE_F5
bne @not_tftp_server
ldax #new
jsr print
jsr print_ascii_as_native
ldax #tftp_server_msg
jsr print
jsr print_ascii_as_native
jsr print_cr
ldax #filter_dns
ldy #40
@ -321,7 +329,7 @@ main_menu:
stax temp_ax
jsr print_cr
ldax #resolving
jsr print
jsr print_ascii_as_native
ldax temp_ax
jsr dns_set_hostname
bcs @resolve_error
@ -364,7 +372,7 @@ cmp #KEYCODE_F7
wait_for_keypress:
ldax #press_a_key_to_continue
jsr print
jsr print_ascii_as_native
@loop:
jsr $ffe4
beq @loop
@ -384,48 +392,57 @@ cfg_get_configuration_ptr:
exit_telnet:
exit_gopher:
lda #142
jsr print_a ;switch to upper case
lda #$05 ;petscii for white text
jsr print_a
jmp main_menu
.rodata
netboot65_msg:
.byte 13,"KIPPERTERM V"
.byte 10,"KipperTerm V"
.include "../inc/version.i"
.byte 13,0
.byte 10,0
main_menu_msg:
.byte 13,"MAIN MENU",13,13
.byte "F1: TELNET F3: GOPHER ",13
.byte "F5: GOPHER (FLOODGAP.COM)",13
.byte " F7: CONFIG",13,13
.byte 10,"Main Menu",10,10
.byte "F1: Telnet F3: Gopher ",10
.byte "F5: Gopher (floodgap.com)",10
.byte "F7: Config F8: Credits",10,10
.byte 0
config_menu_msg:
.byte 13,"CONFIGURATION",13,13
.byte "F1: IP ADDRESS F2: NETMASK",13
.byte "F3: GATEWAY F4: DNS SERVER",13
.byte "F5: TFTP SERVER F6: RESET TO DEFAULT",13
.byte "F7: MAIN MENU",13,13
.byte 10,"Configuration",10,10
.byte "F1: IP Address F2: Netmask",10
.byte "F3: Gateway F4: DNS Server",10
.byte "F5: TFTP Server F6: Reset To Default",10
.byte "F7: Main Menu",10,10
.byte 0
gopher_initial_location:
.byte "1gopher.floodgap.com",$09,"/",$09,"gopher.floodgap.com",$09,"70",$0D,$0A,0
gopher_header: .byte "gopher",13,0
telnet_header: .byte "telnet",13,0
gopher_header: .byte "gopher",10,0
telnet_header: .byte "telnet",10,0
current:
.byte "CURRENT ",0
.byte "current ",0
new:
.byte"NEW ",0
.byte"new ",0
resolving:
.byte "RESOLVING ",0
.byte "resolving ",0
credits:
.byte 10,"License: Mozilla Public License v1.1",10,"http://www.mozilla.org/MPL/"
.byte 10
.byte 10,"Contributors:",10
.byte 10,"Jonno Downes"
.byte 10,"Glenn Holmmer"
.byte 10,"Per Olofsson"
.byte 10,"Lars Stollenwerk"
.byte 10,10
.byte 0
;-- LICENSE FOR kipperterm.s --
; The contents of this file are subject to the Mozilla Public License

View File

@ -14,7 +14,7 @@ INCFILES=\
../inc/commonprint.i\
../inc/net.i\
all: upnatom.prg upnatom.d64 httpd.d64 raster.prg sidplay.prg sidplay_zigzag.prg irc.d64
all: upnatom.prg upnatom.d64
%.o: %.s
$(AS) $(AFLAGS) $<
@ -27,7 +27,7 @@ sine_data.i: make_sine_data.rb
upnatom.prg: upnatom.o nt2play.o $(IP65TCPLIB) $(C64PROGLIB) $(INCFILES) ../cfg/c64prg.cfg
$(LD) -m upnatom.map -vm -C ../cfg/c64prg.cfg -o upnatom.prg $(AFLAGS) $< $(IP65TCPLIB) $(C64PROGLIB) $(NT2PLAY)
cp upnatom.prg ../../server/boot/
# cp upnatom.prg ../../server/boot/
%.prg: %.o $(IP65TCPLIB) $(C64PROGLIB) $(INCFILES) ../cfg/c64prg.cfg
$(LD) -m $*.map -vm -C ../cfg/c64prg.cfg -o $*.prg $(AFLAGS) $< $(IP65TCPLIB) $(C64PROGLIB)

View File

@ -307,7 +307,7 @@ print_hex:
print_errorcode:
ldax #error_code
jsr print
jsr print_ascii_as_native
lda ip65_error
jsr print_hex
jmp print_cr

View File

@ -20,7 +20,7 @@ telnet_main_entry:
;prompt for a hostname, then resolve to an IP address
ldax #remote_host
jsr print
jsr print_ascii_as_native
ldy #40 ;max chars
ldax #filter_dns
jsr get_filtered_input
@ -31,10 +31,11 @@ telnet_main_entry:
stax temp_ax
jsr print_cr
ldax #resolving
jsr print
jsr print_ascii_as_native
ldax temp_ax
jsr print
jsr print_cr
ldax temp_ax
jsr dns_set_hostname
bcs @resolve_error
jsr dns_resolve
@ -53,7 +54,7 @@ telnet_main_entry:
bpl @copy_telnet_ip_loop
@get_port:
ldax #remote_port
jsr print
jsr print_ascii_as_native
ldy #5 ;max chars
ldax #filter_number
jsr get_filtered_input
@ -69,13 +70,13 @@ telnet_main_entry:
jsr print_cr
ldax #char_mode_prompt
jsr print
jsr print_ascii_as_native
@char_mode_input:
jsr get_key_ip65
cmp #'A'
beq @ascii_mode
cmp #'a'
beq @ascii_mode
cmp #'V'
beq @vt100_mode
cmp #'v'
beq @vt100_mode
cmp #'P'
beq @petscii_mode
@ -88,7 +89,7 @@ telnet_main_entry:
beq @line_mode
jmp @char_mode_input
@ascii_mode:
@vt100_mode:
lda #0
sta telnet_use_native_charset
sta telnet_line_mode
@ -115,34 +116,34 @@ telnet_main_entry:
jsr print_a
ldax #connecting_in
jsr print
jsr print_ascii_as_native
lda telnet_use_native_charset
beq @a_mode
beq @v_mode
ldax #petscii
jmp @c_mode
@a_mode:
@v_mode:
lda telnet_line_mode
bne @l_mode
ldax #ascii
ldax #vt100
jmp @c_mode
@l_mode:
ldax #line
@c_mode:
jsr print
jsr print_ascii_as_native
ldax #mode
jsr print
jsr print_ascii_as_native
jsr telnet_connect
jmp telnet_main_entry
;constants
connecting_in: .byte "CONNECTING IN ",0
ascii: .byte "ASCII",0
petscii: .byte "PETSCII",0
line: .byte "LINE",0
mode: .byte " MODE",13,0
remote_host: .byte "HOSTNAME (LEAVE BLANK TO QUIT)",13,": ",0
remote_port: .byte "PORT # (LEAVE BLANK FOR DEFAULT)",13,": ",0
char_mode_prompt: .byte "MODE - A=ASCII, P=PETSCII, L=LINE",13,0
connecting_in: .byte "connecting in ",0
vt100: .byte "vt100",0
petscii: .byte "petscii",0
line: .byte "line",0
mode: .byte " mode",10,0
remote_host: .byte "hostname (leave blank to quit)",10,": ",0
remote_port: .byte "port # (leave blank for default)",10,": ",0
char_mode_prompt: .byte "mode - V=vt100, P=petscii, L=line",10,0

View File

@ -1 +1 @@
.byte "1.0.9"
.byte "1.0.16"

View File

@ -56,7 +56,7 @@ temp_x: .res 1
.segment "HTTP_VARS"
httpd_io_buffer: .word $2000 ;by default, use a 2k buffer at $2000 for storing inbound requests.
httpd_io_buffer: .word $2000 ;by default, use a 3k buffer at $2000 for storing inbound requests.
httpd_scratch_buffer: .word $2B00 ;by default, use a 1k buffer at $2b00 as a scratchpad
httpd_port_number: .word 80

View File

@ -28,7 +28,7 @@
.import ip65_process
.import get_key_ip65
.import get_key_if_available
.import get_filtered_input
.import ok_msg
.import failed_msg
@ -52,7 +52,7 @@ buffer_ptr: .res 2 ; source pointer
.code
telnet_connect:
lda telnet_use_native_charset
beq :+
bne :+
jsr vt100_init_terminal
:
ldax #telnet_callback
@ -71,6 +71,7 @@ telnet_connect:
jsr print_cr
ldax #failed_msg
jsr print
jsr print_cr
jsr print_errorcode
rts
@connect_ok:
@ -79,7 +80,26 @@ telnet_connect:
jsr print_cr
lda #0
sta connection_closed
sta iac_response_buffer_length
lda telnet_use_native_charset
bne @main_polling_loop
lda telnet_line_mode
bne @main_polling_loop
;if we get here, we are in VT100 'char at a time mode'
;so tell the other end that
ldax #initial_telnet_options_length
stax tcp_send_data_len
ldax #initial_telnet_options
jsr tcp_send
@main_polling_loop:
jsr ip65_process
lda connection_closed
beq @not_disconnected
@ -117,7 +137,22 @@ telnet_connect:
@not_line_mode:
jsr get_key_ip65
@wait_for_keypress:
jsr ip65_process
lda iac_response_buffer_length
beq @no_iac_response
ldx #0
stax tcp_send_data_len
stx iac_response_buffer_length
ldax #iac_response_buffer
jsr tcp_send
@no_iac_response:
jsr get_key_if_available
beq @wait_for_keypress
tax
; beq @send_char
cmp #KEYCODE_ABORT
@ -195,9 +230,8 @@ telnet_callback:
bpl :+
dec buffer_length+1
:
ldy #0
sty iac_response_buffer_length
@next_byte:
ldy #0
lda (buffer_ptr),y
tax
lda telnet_use_native_charset
@ -212,9 +246,13 @@ telnet_callback:
;if we get here, we are in ASCII 'char at a time' mode, so look for (and process) Telnet style IAC bytes
lda telnet_state
cmp #telnet_state_got_command
beq @waiting_for_option
bne :+
jmp @waiting_for_option
:
cmp #telnet_state_got_iac
beq @waiting_for_command
cmp #telnet_state_got_suboption
beq @waiting_for_suboption_end
; we must be in 'normal' mode
txa
cmp #255
@ -224,9 +262,41 @@ telnet_callback:
lda #telnet_state_got_iac
sta telnet_state
jmp @byte_processed
@waiting_for_suboption_end:
txa
ldx iac_suboption_buffer_length
sta iac_suboption_buffer,x
inc iac_suboption_buffer_length
cmp #$f0 ;SE - suboption end
bne @exit_suboption
lda #telnet_state_normal
sta telnet_state
lda iac_suboption_buffer
cmp #$18
bne @not_terminal_type
ldx #0
:
lda terminal_type_response,x
ldy iac_response_buffer_length
inc iac_response_buffer_length
sta iac_response_buffer,y
inx
txa
cmp #terminal_type_response_length
bne :-
@not_terminal_type:
@exit_suboption:
jmp @byte_processed
@waiting_for_command:
txa
sta telnet_command
cmp #$fa ; SB - suboption begin
beq @suboption
cmp #$fb ;WILL
beq @option
cmp #$fc ;WONT
@ -239,6 +309,13 @@ telnet_callback:
lda #telnet_state_normal
sta telnet_state
jmp @byte_processed
@suboption:
lda #telnet_state_got_suboption
sta telnet_state
lda #0
sta iac_suboption_buffer
jmp @byte_processed
@option:
lda #telnet_state_got_command
sta telnet_state
@ -256,8 +333,21 @@ telnet_callback:
cmp #$fc
beq @iac_wont
;if we get here, then it's a "do" or "don't", both of which we should send a "wont" back for
;(since there are no "do" options we actually honour)
cmp #$fe
beq @iac_dont
;if we get here, then it's a "do"
lda telnet_option
cmp #$18 ;terminal type
beq @do_terminaltype
cmp #$1f
beq @do_naws
;if we get here, then it's a "do" command we don't honour
@iac_dont:
lda #$fc ;wont
@add_iac_response:
ldx iac_response_buffer_length
@ -297,22 +387,40 @@ telnet_callback:
lda #$fd ;DO
jmp @add_iac_response
@do_naws:
ldx #0
:
lda naws_response,x
ldy iac_response_buffer_length
inc iac_response_buffer_length
sta iac_response_buffer,y
inx
txa
cmp #naws_response_length
bne :-
lda #telnet_state_normal
sta telnet_state
jmp @byte_processed
@do_terminaltype:
lda #$fb ;WILL
jmp @add_iac_response
@not_iac:
@convert_to_native:
txa
cmp #$0a ;suppress LF (since it probably follows a CR which will have done the LF as well)
beq @byte_processed
jsr ascii_to_native
tax
txa
jsr vt100_process_inbound_char
jmp @byte_processed
@no_conversion_req:
tya
pha
txa
jsr print_a
pla
tay
@byte_processed:
iny
inc buffer_ptr
bne :+
inc buffer_ptr+1
:
@ -328,13 +436,6 @@ telnet_callback:
jmp @next_byte
@finished:
lda iac_response_buffer_length
beq @no_iac_response
ldx #0
stax tcp_send_data_len
ldax #iac_response_buffer
jsr tcp_send
@no_iac_response:
rts
;constants
@ -342,6 +443,34 @@ closing_connection: .byte "CLOSING CONNECTION",13,0
disconnected: .byte 13,"CONNECTION CLOSED",13,0
transmission_error: .byte "ERROR WHILE SENDING ",0
initial_telnet_options:
.byte $ff,$fb,$1F ;IAC WILL NAWS
.byte $ff,$fb,$18 ;IAC WILL TERMINAL TYPE
initial_telnet_options_length=*-initial_telnet_options
terminal_type_response:
.byte $ff ; IAC
.byte $fa; SB
.byte $18 ; TERMINAL TYPE
.byte $0 ; IS
.byte "xterm" ;we pretend to be a vt100
.byte $ff ; IAC
.byte $f0 ; SE
terminal_type_response_length=*-terminal_type_response
naws_response:
.byte $ff ; IAC
.byte $fa; SB
.byte $1F ; NAWS
.byte $00 ; width (high byte)
.byte 40 ; width (low byte)
.byte $00 ; height (high byte)
.byte 25 ; height (low byte)
.byte $ff ; IAC
.byte $f0 ; SE
naws_response_length=*-naws_response
;variables
.segment "APP_SCRATCH"
telnet_ip: .res 4 ;ip address of remote server
@ -352,19 +481,23 @@ telnet_use_native_charset: .res 1 ; 0 means all data is translated to/from NVT A
buffer_offset: .res 1
telnet_local_echo: .res 1 ;0 should mean local echo is disabled - in fact at the moment we never do local echo except in 'line mode'
telnet_line_mode: .res 1 ;do characters get sent after each keypress, or can a line be created/edited and then sent only when return is pressed?
telnet_state: .res 1
telnet_command: .res 1
telnet_option: .res 1
telnet_state_normal = 0
telnet_state_got_iac = 1
telnet_state_got_command = 2
telnet_state_got_suboption=3
buffer_length: .res 2
telnet_state: .res 1
iac_response_buffer: .res 64
iac_response_buffer_length: .res 1
scratch_buffer : .res 40
iac_suboption_buffer: .res 64
iac_suboption_buffer_length: .res 1
;-- LICENSE FOR telnet.s --

View File

@ -61,6 +61,10 @@ text_background_colour = col_gray_1
border_colour = col_gray_2
.segment "APP_SCRATCH"
escape_buffer: .res $100
.zeropage
; --- esc mode ---
@ -121,8 +125,6 @@ Screen = $0400
; --- escape buffer ---
; $0800 - $0bff
escape_buffer= $0800
; --- char ---
; $2000 - $27ff
font_table = $2000

View File

@ -8,7 +8,7 @@ require 'ftools'
WORKING_DIR=File.expand_path(File.dirname(__FILE__)+"/ip65")
SRC_DIR=File.expand_path(File.dirname(__FILE__)+"/../")
["","ip65","doc","cfg","drivers","inc","test","carts"].each do |dir_suffix|
["","ip65","doc","cfg","drivers","inc","test","carts","examples"].each do |dir_suffix|
dir_path="#{WORKING_DIR}/#{dir_suffix}"
Dir.mkdir(dir_path) unless File.exist?(dir_path)
end
@ -21,6 +21,12 @@ end
["client/carts/*.rb","carts/"],
["client/carts/*.obj","carts/"],
["client/carts/*.src","carts/"],
["client/examples/*.[s|i]","examples/"],
["client/examples/Makefile","examples/"],
["client/examples/*.bin","examples/"],
["client/examples/*.spr","examples/"],
["client/examples/*.rb","examples/"],
["client/examples/*.cfg","examples/"],
["client/inc/*.i","inc/"],
["client/inc/vt100_font.bin","inc/"],
["client/test/*.[s|i]","test/"],

View File

@ -1 +1 @@
1.0.9
1.0.16

View File

@ -89,9 +89,11 @@ IP65 is a TCP/IP stack for 6502 based computers.
<tr>
<th>Applications</th>
<td class="partial" colspan="3" >Telnet</td>
<td class="partial" colspan="3">Gopher</td>
<td class="partial" colspan="1" >Telnet Client</td>
<td class="partial" colspan="1">Gopher Client</td>
<td class="partial" colspan="1">HTTP Client</td>
<td class="partial" colspan="1">HTTP Server</td>
<td class="done" colspan="1">Ping</td>
</tr>
<tr>
@ -160,6 +162,7 @@ IP65 is a TCP/IP stack for 6502 based computers.
<pre>
Release Maintainer Changes
------- ---------- -------
2009-10-31 Jonno Downes Added Web Application Server functions
2009-08-02 Jonno Downes More TCP functionality, includes telnet
2009-07-12 Jonno Downes Initial TCP implementation (use -DTCP to include)
2009-03-21 Jonno Downes Added technical reference documentation
@ -213,10 +216,6 @@ copy:
rts
</pre>
<h2>Links</h2>
<a href="http://www.a2retrosystems.com/">a2RetroSystems - home of the Uthernet Ethernet card for the Apple ][ </a>
<a href=http://www.vesalia.de/e_rrnet.htm>Vesilia - distributor for the RR-NET network adapter</a>
<h2>License</h2>