From f78591a5811c5b1021148ef180805aafebbe95c2 Mon Sep 17 00:00:00 2001 From: jonnosan Date: Sun, 2 Aug 2009 08:49:38 +0000 Subject: [PATCH] git-svn-id: http://svn.code.sf.net/p/netboot65/code@171 93682198-c243-4bdb-bd91-e943c89aac3b --- client/Makefile | 14 ++-- client/drivers/a2charconv.s | 2 - client/drivers/a2print.s | 15 ++++- client/inc/gopher.i | 42 ++++++++++++ client/ip65/cs8900a.s | 2 +- client/ip65/telnet.s | 21 ++++-- client/kipper/Makefile | 46 +++++++++++++ client/{test/a2_telnet.s => kipper/kipper.s} | 68 +++++++++++++++++--- client/nb65/nb65_c64.s | 17 +++-- client/nb65/nb65_version.i | 2 +- client/test/Makefile | 16 ----- client/test/a2_gopher.s | 67 ------------------- dist/version_number.txt | 2 +- 13 files changed, 200 insertions(+), 114 deletions(-) create mode 100644 client/kipper/Makefile rename client/{test/a2_telnet.s => kipper/kipper.s} (75%) delete mode 100644 client/test/a2_gopher.s diff --git a/client/Makefile b/client/Makefile index 05bdc41..14be830 100644 --- a/client/Makefile +++ b/client/Makefile @@ -1,10 +1,10 @@ TARGET=c64 -.PHONY: ip65 drivers test clean distclean nb65 +.PHONY: ip65 drivers test clean distclean nb65 kipper -all: ip65 drivers test nb65 +all: ip65 drivers test nb65 kipper ip65: make -C ip65 all @@ -12,6 +12,9 @@ ip65: drivers: make -C drivers all +kipper: + make -C kipper all + test: make -C test TARGET=$(TARGET) all @@ -22,11 +25,14 @@ clean: make -C ip65 clean make -C drivers clean make -C test clean - make -C nb65 clean + make -C nb65 clean + make -C kipper clean + distclean: make -C ip65 distclean make -C drivers clean make -C test distclean - make -C nb65 distclean + make -C nb65 distclean + make -C kipper distclean rm -f *~ diff --git a/client/drivers/a2charconv.s b/client/drivers/a2charconv.s index 1bb366e..cfe504c 100644 --- a/client/drivers/a2charconv.s +++ b/client/drivers/a2charconv.s @@ -1,5 +1,3 @@ -;ASCII/PETSCII conversion tables -;cribbed from http://www.ffd2.com/fridge/misc/petcom.c .export ascii_to_native diff --git a/client/drivers/a2print.s b/client/drivers/a2print.s index dfc435d..c35756f 100644 --- a/client/drivers/a2print.s +++ b/client/drivers/a2print.s @@ -17,7 +17,16 @@ screen_current_row=$25 ; CV - Vertical cursor-position (0-23) ;inputs: A should be set to ASCII char to display ;outputs: none print_a: - ora #$80 ;turn ASCII into Apple 2 screen codes + ora #$80 ;turn ASCII into Apple 2 screen codes + cmp #$8A ;is it a line feed? + bne @not_line_feed +; jmp print_cr + pha + lda #$0 + sta screen_current_col + pla +@not_line_feed: + jmp $fded @@ -42,5 +51,5 @@ beep: jmp $fbdd print_a_inverse: - and #$7F ;turn off bit 8 - jmp $fded \ No newline at end of file + and #$7F ;turn off top bits + jsr $fded diff --git a/client/inc/gopher.i b/client/inc/gopher.i index 0aff85c..f093073 100644 --- a/client/inc/gopher.i +++ b/client/inc/gopher.i @@ -37,6 +37,14 @@ .importzp screen_current_row .importzp screen_current_col .import print_a_inverse + + .import telnet_port + .import telnet_ip + .import telnet_connect + .import telnet_local_echo + .import telnet_line_mode + .import telnet_use_native_charset + .segment "IP65ZP" : zeropage ; pointer for moving through buffers @@ -166,6 +174,8 @@ display_resource_in_buffer: beq @standard_resource cmp #'7' beq @standard_resource + cmp #'8' + beq @standard_resource ;if we got here, we know not what it is jmp @skip_to_end_of_line @@ -208,6 +218,9 @@ display_resource_in_buffer: @skip_to_end_of_line: jsr get_next_byte + cmp #0 + beq @last_line + cmp #$0A bne @skip_to_end_of_line @@ -464,6 +477,7 @@ show_history: sec sbc #1 bne @show_one_entry +get_keypress_then_rts: jsr print_cr ldax #any_key_to_continue jsr print @@ -492,6 +506,7 @@ load_resource_into_buffer: ldx #3 ; save IP address just retrieved : lda dns_ip,x sta tcp_connect_ip,x + sta telnet_ip,x dex bpl :- ldax #gopher_download_callback @@ -499,7 +514,34 @@ load_resource_into_buffer: ldax #connecting jsr print + lda displayed_resource_type + cmp #'8' ;is it a 'telnet' resource? + bne @not_telnet_resource ldax resource_port + stax telnet_port + lda #0 + sta telnet_local_echo + sta telnet_line_mode + sta telnet_use_native_charset + + ;if the username = '/native', then connect in native mode + lda resource_selector_length + + cmp #7 + bne @not_native + lda resource_selector+1 + cmp #'n' + bne @not_native + lda resource_selector+2 + cmp #'a' + bne @not_native + inc telnet_use_native_charset +@not_native: + jsr telnet_connect + jmp get_keypress_then_rts + +@not_telnet_resource: + ldax resource_port jsr tcp_connect bcs @error diff --git a/client/ip65/cs8900a.s b/client/ip65/cs8900a.s index e0091c8..c2306ca 100644 --- a/client/ip65/cs8900a.s +++ b/client/ip65/cs8900a.s @@ -204,7 +204,7 @@ eth_tx: sta cs_tx_len lda eth_outp_len + 1 sta cs_tx_len + 1 - cmp #7 + cmp #6 bmi :+ lda #NB65_ERROR_INPUT_TOO_LARGE sta ip65_error diff --git a/client/ip65/telnet.s b/client/ip65/telnet.s index a759916..e11c2bf 100644 --- a/client/ip65/telnet.s +++ b/client/ip65/telnet.s @@ -1,5 +1,12 @@ -;telnet implementation -; +;minimal telnet implementation (dumb terminal emulation only) +;to use: +;set the following variables - telnet_local_echo, telnet_line_mode,telnet_use_native_charset,telnet_port,telnet_ip +;then call telnet_connect +;sensible combinations of telnet_local_echo, telnet_line_mode,telnet_use_native_charset are: +;for interacting with 'line at time' servers (smtp/pop3/http/gopher): telnet_local_echo=1, telnet_line_mode=1,telnet_use_native_charset=0 +;for logging in to a normal telnet server: telnet_local_echo=0, telnet_line_mode=0,telnet_use_native_charset=0 +;for logging in to a PETSCII BBS on a C64 : telnet_local_echo=0, telnet_line_mode=0,telnet_use_native_charset=1 + .include "../inc/common.i" @@ -333,14 +340,14 @@ transmission_error: .byte "ERROR WHILE SENDING ",0 ;variables .segment "APP_SCRATCH" -telnet_ip: .res 4 -telnet_port: .res 2 +telnet_ip: .res 4 ;ip address of remote server +telnet_port: .res 2 ;port number to connect to connection_closed: .res 1 -telnet_use_native_charset: .res 1 +telnet_use_native_charset: .res 1 ; 0 means all data is translated to/from NVT ASCII buffer_offset: .res 1 -telnet_local_echo: .res 1 -telnet_line_mode: .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 diff --git a/client/kipper/Makefile b/client/kipper/Makefile new file mode 100644 index 0000000..6b14c0d --- /dev/null +++ b/client/kipper/Makefile @@ -0,0 +1,46 @@ +CC=cl65 +AS=ca65 +LD=ld65 +CFLAGS=-Oirs -t $(TARGET) +AFLAGS= + + +IP65LIB=../ip65/ip65.lib + +IP65TCPLIB=../ip65/ip65_tcp.lib + +C64PNB65LIB=../drivers/c64nb65.lib +APPLE2PROGLIB=../drivers/apple2prog.lib + +INCFILES=\ + ../inc/common.i\ + ../inc/commonprint.i\ + ../inc/net.i\ + +all: \ + kipper.dsk \ + +%.o: %.c + $(CC) -c $(CFLAGS) $< + +%.o: %.s + $(AS) $(AFLAGS) $< + +kipper.o: kipper.s ../inc/gopher.i ../inc/telnet.i + $(AS) $(AFLAGS) $< + +kipper.pg2: kipper.o $(IP65TCPLIB) $(APPLE2PROGLIB) $(INCFILES) ../cfg/a2bin.cfg + $(LD) -C ../cfg/a2bin.cfg -m kipper.map -vm -o kipper.pg2 $(AFLAGS) $< $(IP65TCPLIB) $(APPLE2PROGLIB) + +#%.pg2: %.o $(IP65LIB) $(APPLE2PROGLIB) $(INCFILES) ../cfg/a2bin.cfg +# $(LD) -C ../cfg/a2bin.cfg -o $*.pg2 $(AFLAGS) $< $(IP65LIB) $(APPLE2PROGLIB) + +kipper.dsk: kipper.pg2 + ripxplore.rb --init BeautifulBoot kipper.dsk -a kipper.pg2 -t AppleBinary + +clean: + rm -f *.o *.pg2 *.prg + rm -f kipper.dsk + +distclean: clean + rm -f *~ diff --git a/client/test/a2_telnet.s b/client/kipper/kipper.s similarity index 75% rename from client/test/a2_telnet.s rename to client/kipper/kipper.s index f44e048..76bbb1a 100644 --- a/client/test/a2_telnet.s +++ b/client/kipper/kipper.s @@ -1,5 +1,6 @@ -;A2 telnet -;july 2009 (at Mt Keira Fest!) - jonno @ jamtronix.com +; Kipper +;started as a port of c64 telnet to A2 at Mt Keira Fest, July 2009 +; jonno @ jamtronix.com .include "../inc/common.i" .include "../inc/commonprint.i" @@ -15,6 +16,8 @@ .import get_key .import cls +.import print_a_inverse + .import telnet_connect .import telnet_local_echo .import telnet_line_mode @@ -30,14 +33,19 @@ .import filter_dns .import filter_number + KEY_NEXT_PAGE=$8E ; ^N + KEY_PREV_PAGE=$90; ^P + KEY_SHOW_HISTORY=$93; ^S + KEY_BACK_IN_HISTORY=$82 ; ^B + KEY_NEW_SERVER=$89 ;TAB key + +.include "../inc/gopher.i" + .segment "EXEHDR" ;this is what gets put an the start of the file on the Apple 2 .addr __CODE_LOAD__-3 ; Start address .word __CODE_SIZE__+__RODATA_SIZE__+__DATA_SIZE__+4 ; Size jmp init - .segment "IP65ZP" : zeropage - -buffer_ptr: .res 2 .code @@ -51,10 +59,50 @@ init: init_ip_via_dhcp jsr print_ip_config +main_loop: + ldax #main_menu + jsr print + +@command_input: + jsr get_key + and #$7f ;strip high bit + cmp #'T' + beq @telnet + cmp #'t' + beq @telnet + + cmp #'G' + beq @gopher + cmp #'g' + beq @gopher + + cmp #'Q' + beq @quit + cmp #'q' + beq @quit + + jmp @command_input + +@telnet: jmp telnet_main_entry -exit_telnet: +@gopher: + ldax #gopher_initial_location + sta resource_pointer_lo + stx resource_pointer_hi +; jsr print + ldx #0 + jsr select_resource_from_current_directory + jmp main_loop + +@quit: jmp $e000 +exit_telnet: +exit_gopher: + jmp main_loop + + + telnet_main_entry: @@ -218,8 +266,12 @@ get_port_number: .bss hostname_ptr: .res 2 port_number: .res 2 + .rodata -title: .byte " TELNET ][",13," jonno@jamtronix.com",13,0 +gopher_initial_location: +.byte "1gopher.floodgap.com",$09,"/",$09,"gopher.floodgap.com",$09,"70",$0D,$0A,0 +main_menu: .byte "COMMAND - T=TELNET, G=GOPHER, Q=QUIT",13,0 + resolving: .byte "RESOLVING ",0 connecting_in: .byte "CONNECTING IN ",0 ascii: .byte "ASCII",0 @@ -230,4 +282,4 @@ 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, N=NATIVE, L=LINE",13,0 - +title: .byte "KIPPER ][",13,"jonno@jamtronix.com",13,0 diff --git a/client/nb65/nb65_c64.s b/client/nb65/nb65_c64.s index 820bfa1..7c2c4d5 100644 --- a/client/nb65/nb65_c64.s +++ b/client/nb65/nb65_c64.s @@ -573,7 +573,14 @@ net_apps_menu: jsr cls lda #14 jsr print_a ;switch to lower case - jsr prompt_for_gopher_resource ;only returns if no server was entered. +; jsr prompt_for_gopher_resource ;only returns if no server was entered. + + ldax #gopher_initial_location + sta resource_pointer_lo + stx resource_pointer_hi + ldx #0 + jsr select_resource_from_current_directory + jmp exit_gopher @not_gopher: cmp #KEYCODE_F7 @@ -679,6 +686,11 @@ net_apps_menu_msg: .byte "F1: TELNET F3: GOPHER",13 .byte "F5: F7: MAIN MENU",13,13 .byte 0 + +cant_boot_basic: .byte "BASIC FILE EXECUTION NOT SUPPORTED",13,0 +gopher_initial_location: +.byte "1gopher.floodgap.com",$09,"/",$09,"gopher.floodgap.com",$09,"70",$0D,$0A,0 + .endif downloading_msg: .asciiz "DOWNLOADING " @@ -714,9 +726,6 @@ press_a_key_to_continue: resolving: .byte "RESOLVING ",0 -.if (BANKSWITCH_SUPPORT=$03) -cant_boot_basic: .byte "BASIC FILE EXECUTION NOT SUPPORTED",13,0 - .endif nb65_ram_stub: ; this gets copied to $C000 so programs can bank in the cartridge .byte $4E,$42,$36,$35 ; "NB65" - API signature diff --git a/client/nb65/nb65_version.i b/client/nb65/nb65_version.i index 20597ad..17b64ab 100644 --- a/client/nb65/nb65_version.i +++ b/client/nb65/nb65_version.i @@ -1 +1 @@ -.byte "0.9.14" +.byte "0.9.17" diff --git a/client/test/Makefile b/client/test/Makefile index 4f9bab3..ccd4d52 100644 --- a/client/test/Makefile +++ b/client/test/Makefile @@ -30,9 +30,6 @@ all: \ testdottedquad.pg2\ testdottedquad.prg\ test_tcp.prg \ - a2_gopher.pg2 \ - a2_telnet.pg2 \ - a2_netapps.dsk \ %.o: %.c $(CC) -c $(CFLAGS) $< @@ -46,22 +43,10 @@ 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) -#gopher_browser.prg: gopher_browser.o $(IP65TCPLIB) $(C64PROGLIB) $(INCFILES) ../cfg/c64prg.cfg ../inc/gopher.i -# $(LD) -m gopher_browser.map -vm -C ../cfg/c64prg.cfg -o gopher_browser.prg $(AFLAGS) $< $(IP65TCPLIB) $(C64PROGLIB) - -a2_gopher.pg2: a2_gopher.o $(IP65TCPLIB) $(APPLE2PROGLIB) $(INCFILES) ../cfg/a2bin.cfg ../inc/gopher.i - $(AS) $(AFLAGS) a2_gopher.s - $(LD) -C ../cfg/a2bin.cfg -o a2_gopher.pg2 $(AFLAGS) $< $(IP65TCPLIB) $(APPLE2PROGLIB) - -a2_telnet.pg2: a2_telnet.o $(IP65TCPLIB) $(APPLE2PROGLIB) $(INCFILES) ../cfg/a2bin.cfg - $(LD) -C ../cfg/a2bin.cfg -m a2_telnet.map -vm -o a2_telnet.pg2 $(AFLAGS) $< $(IP65TCPLIB) $(APPLE2PROGLIB) %.pg2: %.o $(IP65LIB) $(APPLE2PROGLIB) $(INCFILES) ../cfg/a2bin.cfg $(LD) -C ../cfg/a2bin.cfg -o $*.pg2 $(AFLAGS) $< $(IP65LIB) $(APPLE2PROGLIB) -a2_netapps.dsk: a2_gopher.pg2 a2_telnet.pg2 - ripxplore.rb --init BeautifulBoot a2_netapps.dsk -a a2_gopher.pg2 -t AppleBinary - ripxplore.rb a2_netapps.dsk -a a2_telnet.pg2 -t AppleBinary ip65test.dsk: testdns.pg2 testdottedquad.pg2 testtftp.pg2 ripxplore.rb --init BeautifulBoot ip65test.dsk -a testdns.pg2 -t AppleBinary @@ -76,7 +61,6 @@ test_disk_io.d64: test_disk_io.prg clean: rm -f *.o *.pg2 *.prg rm -f ip65test.dsk - rm -f a2_netapps.dsk distclean: clean rm -f *~ diff --git a/client/test/a2_gopher.s b/client/test/a2_gopher.s deleted file mode 100644 index 48f6047..0000000 --- a/client/test/a2_gopher.s +++ /dev/null @@ -1,67 +0,0 @@ -;Apple 2 gopher browser -;july 2009 - jonno @ jamtronix.com - - .include "../inc/common.i" - .include "../inc/commonprint.i" - .include "../inc/net.i" - .include "../inc/a2keycodes.i" -; .include "../inc/c64keycodes.i" - - - - KEY_NEXT_PAGE=$8E ; ^N - KEY_PREV_PAGE=$90; ^P - KEY_SHOW_HISTORY=$93; ^S - KEY_BACK_IN_HISTORY=$82 ; ^B - KEY_NEW_SERVER=$89 ;TAB key - -.include "../inc/gopher.i" - - .import __CODE_LOAD__ - .import __CODE_SIZE__ - .import __RODATA_SIZE__ - .import __DATA_SIZE__ - - .import get_key - - .segment "EXEHDR" ;this is what gets put an the start of the file on the Apple 2 - .addr __CODE_LOAD__-3 ; Start address - .word __CODE_SIZE__+__RODATA_SIZE__+__DATA_SIZE__+4 ; Size - jmp init - - -.code - -init: - - jsr cls - jsr $c300 ; go to 80 column mode - - - ldax #title - jsr print - jsr print_cr - init_ip_via_dhcp - jsr print_ip_config - - - ldax #initial_location - sta resource_pointer_lo - stx resource_pointer_hi - ldx #0 - jsr select_resource_from_current_directory - -exit_gopher: - jmp $e000 -; rts - -.rodata -title: -.byte " GOPHER ][",13," jonno@jamtronix.com",13,0 - -resolving: -.byte "RESOLVING ",0 - -initial_location: -.byte "1gopher.floodgap.com",$09,"/",$09,"gopher.floodgap.com",$09,"70",$0D,$0A,0 - diff --git a/dist/version_number.txt b/dist/version_number.txt index 69010fa..60edc91 100644 --- a/dist/version_number.txt +++ b/dist/version_number.txt @@ -1 +1 @@ -0.9.14 \ No newline at end of file +0.9.17 \ No newline at end of file