From 1c6f188cb340499324207d8c6fae2d6882325ca6 Mon Sep 17 00:00:00 2001 From: jonnosan Date: Fri, 30 Oct 2009 20:42:50 +0000 Subject: [PATCH] git-svn-id: http://svn.code.sf.net/p/netboot65/code@213 93682198-c243-4bdb-bd91-e943c89aac3b --- client/carts/kipperkart.s | 178 +-- client/cfg/c64_16kcart.cfg | 4 +- client/drivers/c64print.s | 42 +- client/inc/commonprint.i | 60 +- client/inc/menu.i | 16 +- client/inc/ping.i | 12 +- client/inc/version.i | 23 +- client/inc/vt100_font.bin | Bin 0 -> 1024 bytes client/ip65/Makefile | 1 + client/ip65/telnet.s | 14 +- client/ip65/vt100_c64.s | 2096 ++++++++++++++++++++++++++++++++++++ client/test/Makefile | 5 +- client/test/file1.html | 3 + client/test/index.html | 3 + client/test/test_vt100.s | 105 ++ dist/make_dist.rb | 5 +- dist/make_dist_ip65.rb | 16 +- dist/version_number.txt | 2 +- doc/CONTRIBUTORS.txt | 6 + doc/LICENSE.txt | 471 ++++++++ 20 files changed, 2894 insertions(+), 168 deletions(-) create mode 100644 client/inc/vt100_font.bin create mode 100644 client/ip65/vt100_c64.s create mode 100644 client/test/file1.html create mode 100644 client/test/index.html create mode 100644 client/test/test_vt100.s create mode 100644 doc/CONTRIBUTORS.txt create mode 100644 doc/LICENSE.txt diff --git a/client/carts/kipperkart.s b/client/carts/kipperkart.s index 33bb21f..c48a44e 100644 --- a/client/carts/kipperkart.s +++ b/client/carts/kipperkart.s @@ -4,13 +4,13 @@ .macro print_failed ldax #failed_msg - jsr print + jsr print_ascii_as_native jsr print_cr .endmacro .macro print_ok ldax #ok_msg - jsr print + jsr print_ascii_as_native jsr print_cr .endmacro @@ -27,12 +27,6 @@ .include "../inc/c64keycodes.i" .include "../inc/menu.i" - KEY_NEXT_PAGE=KEYCODE_F7 - KEY_PREV_PAGE=KEYCODE_F1 - KEY_SHOW_HISTORY=KEYCODE_F2 - KEY_BACK_IN_HISTORY=KEYCODE_F3 - KEY_NEW_SERVER=KEYCODE_F5 - .include "../inc/ping.i" .include "../inc/sidplay.i" @@ -134,6 +128,10 @@ cold_init: warm_init: + + lda #14 + jsr print_a ;switch to lower case + ;set some funky colours LDA #$04 ;purple @@ -162,9 +160,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 kippercall #KPR_INITIALIZE bcc init_ok @@ -174,30 +172,29 @@ warm_init: 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: ;look for an 'autoexec' file jsr print_cr ldax #loading_msg - jsr print + jsr print_ascii_as_native ldax #autoexec_filename stax io_filename - jsr print + jsr print_ascii_as_native jsr print_cr ldax #$0000 jsr io_read_file bcs main_menu @file_read_ok: ldax #load_ok_msg - jsr print + jsr print_ascii_as_native ldax io_load_address jmp boot_into_file @@ -209,9 +206,6 @@ main_menu: @get_key: jsr get_key_ip65 -; pha -; jsr print_hex -; pla cmp #KEYCODE_F1 bne @not_f1 @@ -241,10 +235,8 @@ main_menu: cmp #KEYCODE_F6 bne @not_f6 jsr cls - lda #14 - jsr print_a ;switch to lower case ldax #ping_header - jsr print + jsr print_ascii_as_native jsr ping_loop jmp exit_ping @@ -252,6 +244,20 @@ 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 @@ -263,9 +269,9 @@ main_menu: @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: @@ -277,9 +283,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 @@ -302,9 +308,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 @@ -327,9 +333,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 @@ -354,9 +360,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 @@ -380,9 +386,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 @@ -391,7 +397,7 @@ main_menu: stax kipper_param_buffer jsr print_cr ldax #resolving - jsr print + jsr print_ascii_as_native ldax #kipper_param_buffer kippercall #KPR_DNS_RESOLVE bcs @resolve_error @@ -468,7 +474,7 @@ boot_into_file: jmp exit_cart_via_ax ;good luck! @not_a_basic_stub: ldax #cant_boot_basic - jsr print + jsr print_ascii_as_native jsr wait_for_keypress jmp warm_init @@ -488,7 +494,7 @@ get_tftp_directory_listing: stax kipper_param_buffer+KPR_TFTP_POINTER ldax #getting_dir_listing_msg - jsr print + jsr print_ascii_as_native ldax #kipper_param_buffer kippercall #KPR_TFTP_DOWNLOAD @@ -500,10 +506,6 @@ get_tftp_directory_listing: jmp @no_files_on_server : - ;switch to lower case charset - lda #23 - sta $d018 - ldax #directory_buffer ldy #1 ;filenames will be ASCII @@ -548,13 +550,13 @@ get_tftp_directory_listing: @dir_failed: ldax #dir_listing_fail_msg - jsr print + jsr print_ascii_as_native sec rts @no_files_on_server: ldax #no_files - jsr print + jsr print_ascii_as_native sec rts @@ -575,8 +577,6 @@ disk_boot: jmp @no_files_on_disk : - ;switch to lower case charset - ldax #directory_buffer ldy #0 ;filenames will NOT be ASCII @@ -587,14 +587,14 @@ disk_boot: @dir_failed: ldax #dir_listing_fail_msg @print_error: - jsr print + jsr print_ascii_as_native jsr print_errorcode jsr print_cr jmp @wait_keypress_then_return_to_main @no_files_on_disk: ldax #no_files - jsr print + jsr print_ascii_as_native @wait_keypress_then_return_to_main: jsr wait_for_keypress jmp main_menu @@ -602,9 +602,9 @@ disk_boot: @disk_filename_set: stax io_filename ldax #loading_msg - jsr print + jsr print_ascii_as_native ldax io_filename - jsr print + jsr print_ascii_as_native jsr print_cr ldax #$0000 jsr io_read_file @@ -613,7 +613,7 @@ disk_boot: jmp @print_error @file_read_ok: ldax #load_ok_msg - jsr print + jsr print_ascii_as_native ldax io_load_address jmp boot_into_file @@ -677,7 +677,7 @@ download: ;AX should point at filename to download download2: ldax #downloading_msg - jsr print + jsr print_ascii_as_native ldax kipper_param_buffer+KPR_TFTP_FILENAME jsr print_ascii_as_native jsr print_cr @@ -688,20 +688,20 @@ download2: bcc :+ ldax #tftp_download_fail_msg - jsr print + jsr print_ascii_as_native jsr print_errorcode sec rts : ldax #tftp_download_ok_msg - jsr print + jsr print_ascii_as_native clc rts wait_for_keypress: ldax #press_a_key_to_continue - jsr print + jsr print_ascii_as_native @loop: jsr $ffe4 beq @loop @@ -721,8 +721,6 @@ cfg_get_configuration_ptr: rts exit_ping: - lda #142 - jsr print_a ;switch to upper case lda #$05 ;petscii for white text jsr print_a jmp main_menu @@ -782,57 +780,57 @@ init_tod: .rodata netboot65_msg: -.byte 13,"KIPPERKART V" +.byte 10,"KipperKart V" .include "../inc/version.i" -.byte 13,0 +.byte 10,0 main_menu_msg: -.byte 13,"MAIN MENU",13,13 -.byte "F1: TFTP BOOT F2: DISK BOOT",13 -.byte "F3: UPLOAD D64 F4: DOWNLOAD D64",13 -.byte "F5: SID NETPLAY F6: PING",13 -.byte "F7: CONFIG",13,13 +.byte 10,"Main Menu",10,10 +.byte "F1: TFTP Boot F2: Disk Boot",10 +.byte "F3: Upload D64 F4: Download D64",10 +.byte "F5: SID Netplay F6: Ping",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 cant_boot_basic: -.byte "BASIC FILE EXECUTION NOT SUPPORTED",13,0 +.byte "BASIC file execution not supported",10,0 -ping_header: .byte "ping",13,0 +ping_header: .byte "ping",10,0 -file_read_error: .asciiz "ERROR READING FILE" +file_read_error: .asciiz "Error reading file" autoexec_filename: .byte "AUTOEXEC.PRG",0 -downloading_msg: .byte "DOWN" -loading_msg: .asciiz "LOADING " +downloading_msg: .byte "down" +loading_msg: .asciiz "loading " -uploading_msg: .byte "UPLOADING ",0 +uploading_msg: .byte "uploading ",0 -getting_dir_listing_msg: .byte "FETCHING DIRECTORY",13,0 +getting_dir_listing_msg: .byte "fetching directory",10,0 dir_listing_fail_msg: - .byte "DIR FAILED",13,0 + .byte "directory listing failed",10,0 tftp_download_fail_msg: - .byte "DOWNLOAD FAILED", 13, 0 + .byte "download failed", 10, 0 tftp_download_ok_msg: - .byte "DOWN" + .byte "down" load_ok_msg: - .byte "LOAD OK", 13, 0 + .byte "load OK", 10, 0 current: -.byte "CURRENT ",0 +.byte "current ",0 new: -.byte"NEW ",0 +.byte"new ",0 tftp_dir_filemask: .asciiz "$/*.prg" @@ -844,12 +842,22 @@ sid_filemask: .asciiz "$/*.sid" no_files: - .byte "NO FILES",13,0 + .byte "no files",10,0 resolving: - .byte "RESOLVING ",0 + .byte "resolving ",0 -remote_host: .byte "HOSTNAME (LEAVE BLANK TO QUIT)",13,": ",0 +remote_host: .byte "hostname (return to quit)",10,": ",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 +.byte 10 +.byte 0 ;-- LICENSE FOR kipperkart.s -- ; The contents of this file are subject to the Mozilla Public License diff --git a/client/cfg/c64_16kcart.cfg b/client/cfg/c64_16kcart.cfg index 6d940b1..9262fc4 100644 --- a/client/cfg/c64_16kcart.cfg +++ b/client/cfg/c64_16kcart.cfg @@ -1,6 +1,7 @@ # CA65 config for a 16KB cart MEMORY { + ZP: start = $02, size = $1A, type = rw ; IP65ZP: start = $20, size = $13, type = rw, define = yes; #this cart replaces BASIC so ok to use that space HEADER: start = $8000, size = $18, file = %O; DEFAULTS: start = $8018, size = $1E, file = %O; @@ -22,5 +23,6 @@ SEGMENTS { APP_SCRATCH: load = RAM4, type = bss; TCP_VARS: load = RAM2, type = bss; HTTP_VARS: load=ROM, run = RAM3, type = rw,define = yes; - IP65ZP: load = IP65ZP, type = zp; + IP65ZP: load = IP65ZP, type = zp; + ZEROPAGE: load = ZP, type = zp, optional=yes; } diff --git a/client/drivers/c64print.s b/client/drivers/c64print.s index b726963..e347e6d 100644 --- a/client/drivers/c64print.s +++ b/client/drivers/c64print.s @@ -12,12 +12,15 @@ screen_current_row=$d6 screen_current_col=$d3 -.data + ;use C64 Kernel ROM function to print a character to the screen ;inputs: A contains petscii value of character to print ;outputs: none print_a = $ffd2 +.bss +beep_timer: .res 1 + .code ;use C64 Kernel ROM function to move to a new line @@ -38,7 +41,44 @@ cls: ;inputs: none ;outputs: none beep: + lda #15 + sta $d418 ;set volume + + lda #0 + sta $d405 + lda #240 + sta $d406 + lda #8 + sta $d403 + + ;tone values for voice 1 + lda #48 + sta $d400 + lda #28 + sta $d401 + + ;enable tone register + lda #65 + sta $d404 + + +; pause for qtr second + lda $dd06 ; + sta beep_timer + inc beep_timer ;time counts backwards +: + lda $dd06 ; + cmp beep_timer + bne :- + + ;disable tone register + lda #65 + sta $d404 + lda #0 + sta $d418 ;set volume + rts + ;print a single char in inverse text: print_a_inverse: diff --git a/client/inc/commonprint.i b/client/inc/commonprint.i index 787f66a..ff49c89 100644 --- a/client/inc/commonprint.i +++ b/client/inc/commonprint.i @@ -22,8 +22,6 @@ .import ip65_error .export print_errorcode .export press_a_key_to_continue - .import arp_cache - .importzp ac_size .import ascii_to_native @@ -41,28 +39,28 @@ temp_ptr: .res 2 .code .macro print_driver_init ldax #cs_driver_name - jsr print + jsr print_ascii_as_native ldax #init_msg - jsr print + jsr print_ascii_as_native .endmacro .macro print_dhcp_init ldax #dhcp_msg - jsr print + jsr print_ascii_as_native ldax #init_msg - jsr print + jsr print_ascii_as_native .endmacro .macro print_failed ldax #failed_msg - jsr print + jsr print_ascii_as_native jsr print_cr .endmacro .macro print_ok ldax #ok_msg - jsr print + jsr print_ascii_as_native jsr print_cr .endmacro @@ -75,21 +73,21 @@ temp_ptr: .res 2 print_ip_config: ldax #interface_type - jsr print + jsr print_ascii_as_native ldax #cs_driver_name - jsr print + jsr print_ascii_as_native jsr print_cr ldax #mac_address_msg - jsr print + jsr print_ascii_as_native jsr cfg_get_configuration_ptr ;ax=base config, carry flag clear ;first 6 bytes of cfg_get_configuration_ptr is MAC address jsr print_mac jsr print_cr ldax #ip_address_msg - jsr print + jsr print_ascii_as_native jsr cfg_get_configuration_ptr ;ax=base config, carry flag clear adc #KPR_CFG_IP bcc :+ @@ -99,7 +97,7 @@ print_ip_config: jsr print_cr ldax #netmask_msg - jsr print + jsr print_ascii_as_native jsr cfg_get_configuration_ptr ;ax=base config, carry flag clear adc #KPR_CFG_NETMASK bcc :+ @@ -109,7 +107,7 @@ print_ip_config: jsr print_cr ldax #gateway_msg - jsr print + jsr print_ascii_as_native jsr cfg_get_configuration_ptr ;ax=base config, carry flag clear adc #KPR_CFG_GATEWAY bcc :+ @@ -119,7 +117,7 @@ print_ip_config: jsr print_cr ldax #dns_server_msg - jsr print + jsr print_ascii_as_native jsr cfg_get_configuration_ptr ;ax=base config, carry flag clear adc #KPR_CFG_DNS_SERVER bcc :+ @@ -128,13 +126,13 @@ print_ip_config: jsr print_cr ldax #tftp_server_msg - jsr print + jsr print_ascii_as_native ldax #cfg_tftp_server jsr print_dotted_quad jsr print_cr ldax #dhcp_server_msg - jsr print + jsr print_ascii_as_native jsr cfg_get_configuration_ptr ;ax=base config, carry flag clear adc #KPR_CFG_DHCP_SERVER bcc :+ @@ -319,52 +317,50 @@ hexdigits: .byte "0123456789ABCDEF" interface_type: -.byte "INTERFACE : ",0 +.byte "Interface : ",0 mac_address_msg: -.byte "MAC ADDRESS : ", 0 +.byte "MAC Address : ", 0 ip_address_msg: -.byte "IP ADDRESS : ", 0 +.byte "IP Address : ", 0 netmask_msg: -.byte "NETMASK : ", 0 +.byte "Netmask : ", 0 gateway_msg: -.byte "GATEWAY : ", 0 +.byte "Gateway : ", 0 dns_server_msg: -.byte "DNS SERVER : ", 0 +.byte "DNS Server : ", 0 dhcp_server_msg: -.byte "DHCP SERVER : ", 0 +.byte "DHCP Server : ", 0 tftp_server_msg: -.byte "TFTP SERVER : ", 0 +.byte "TFTP Server : ", 0 dhcp_msg: .byte "DHCP",0 init_msg: - .byte " INITIALIZING ",0 + .byte " Initializing ",0 -arp_cache_header: - .byte " MEM MAC IP",13,0 failed_msg: - .byte "FAILED", 0 + .byte "failed", 0 ok_msg: .byte "OK", 0 dns_lookup_failed_msg: - .byte "DNS LOOKUP FAILED", 0 + .byte "DNS lookup failed", 0 error_code: - .asciiz "ERROR CODE: " + .asciiz "error code: " press_a_key_to_continue: - .byte "PRESS A KEY TO CONTINUE",13,0 + .byte "Press a key to continue",10,0 diff --git a/client/inc/menu.i b/client/inc/menu.i index 5006930..8e9b184 100644 --- a/client/inc/menu.i +++ b/client/inc/menu.i @@ -119,7 +119,7 @@ select_option_from_menu: jsr cls ldax #select_from_following_options - jsr print + jsr print_ascii_as_native jsr print_cr @@ -173,7 +173,7 @@ select_option_from_menu: @jump_to: jsr print_cr ldax #jump_to_prompt - jsr print + jsr print_ascii_as_native lda #'?' jsr get_key @@ -218,7 +218,7 @@ select_option_from_menu: bcc :+ @navigation_instructions: ldax #navigation_instructions - jsr print + jsr print_ascii_as_native : @get_keypress: lda #'?' @@ -311,13 +311,13 @@ select_option_from_menu: .rodata -select_from_following_options: .byte "SELECT ONE OF THE FOLLOWING OPTIONS:",13,0 -navigation_instructions: .byte 13,"ARROW KEYS NAVIGATE BETWEEN MENU PAGES",13 -.byte "/ TO JUMP OR " +select_from_following_options: .byte "Select one of the following options:",10,0 +navigation_instructions: .byte 10,"Arrow keys navigate between menu pages",10 +.byte "/ to jump or " .byte KEYNAME_ABORT -.byte " TO QUIT",13,0 +.byte " to quit",10,0 -jump_to_prompt: .byte "JUMP TO:",0 +jump_to_prompt: .byte "jump to:",0 diff --git a/client/inc/ping.i b/client/inc/ping.i index a35deaa..94a59be 100644 --- a/client/inc/ping.i +++ b/client/inc/ping.i @@ -8,7 +8,7 @@ ping_retries: .res 1 .code ping_loop: ldax #remote_host - jsr print + jsr print_ascii_as_native kippercall #KPR_INPUT_HOSTNAME bcc @host_entered ;if no host entered, then bail. @@ -17,7 +17,7 @@ ping_loop: stax kipper_param_buffer jsr print_cr ldax #resolving - jsr print + jsr print_ascii_as_native ldax kipper_param_buffer kippercall #KPR_PRINT_ASCIIZ jsr print_cr @@ -35,7 +35,7 @@ ping_loop: sta ping_retries @ping_once: ldax #pinging - jsr print + jsr print_ascii_as_native ldax #kipper_param_buffer jsr print_dotted_quad lda #' ' @@ -51,7 +51,7 @@ ping_loop: bcs @ping_error jsr print_integer ldax #ms - jsr print + jsr print_ascii_as_native @check_retries: dec ping_retries bpl @ping_once @@ -62,8 +62,8 @@ bcs @ping_error jmp @check_retries -ms: .byte " MS",13,0 -pinging: .byte "PINGING ",0 +ms: .byte " ms",10,0 +pinging: .byte "pinging ",0 diff --git a/client/inc/version.i b/client/inc/version.i index 50e646d..911eea2 100644 --- a/client/inc/version.i +++ b/client/inc/version.i @@ -1,22 +1 @@ -.byte "0.9.37" - - - -;-- LICENSE FOR version.i -- -; The contents of this file are subject to the Mozilla Public License -; Version 1.1 (the "License"); you may not use this file except in -; compliance with the License. You may obtain a copy of the License at -; http://www.mozilla.org/MPL/ -; -; Software distributed under the License is distributed on an "AS IS" -; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -; License for the specific language governing rights and limitations -; under the License. -; -; The Original Code is ip65. -; -; The Initial Developer of the Original Code is Jonno Downes, -; jonno@jamtronix.com. -; Portions created by the Initial Developer are Copyright (C) 2009 -; Jonno Downes. All Rights Reserved. -; -- LICENSE END -- +.byte "1.0.9" diff --git a/client/inc/vt100_font.bin b/client/inc/vt100_font.bin new file mode 100644 index 0000000000000000000000000000000000000000..702a3ed7f007f2dd7aee5c6200c19c62aa28ab85 GIT binary patch literal 1024 zcmXw2L2Bbb5G;rpd=N(LsUgNBkOznygbsrYKJ3Y`Ul?rY94t&ui4S7@jvV(Vd04<( zHRB!2ZdI$hy1HAAem<5 zi1bgFiGF&EAAY@_j?5#y(@#Ek#tY9W-T8tr3)4TQNP1Xi{)$*>(xEifKc22*FB~n3 zPmh}mkQ?hVVy8p?)L9cA5E~uh8qD}|ZvStjQcaMhxZH32IIPGp9GtZNo2ujR=3A^9 zX#nW$SONStyqBC?kz*2GLP)Cz$af?RJOqX(@|{042eW|+sM|x+rDE5C{;=BkH3Z}| z2jS@2Pei63N#+!F$&Pxi9&}Y}or*}G%1eNzA)TsY41DjZNRB0|carN;os`JO9lB2! z)=!s2UDZl=I;$?9mb@r6-2X;no(3@IUHc~sPsZ_++dm%RA2~BodU@h~`{EN^6|6k+ zNA;ua^Qevjs^$L4b-I3%udLtYmjvW8*37+FXY9LV(=Slg@VeJR9ib|AGKjB+3x@Bx22By zLuqBKhIrlgv48E!XD_xG7`JS- go on + jsr cursor_off + jsr scroll_up_scrollregion ; yes -> scroll up + jsr cursor_on + rts + +handle_special_char: + tya ; restore original char + cmp #$0d ; CR? + beq do_cr + + cmp #$08 ; BS? + bne @not_bs + ldy $d3 ; get col + beq @bs_done ; stop at left margin + dey ; dec column + ldx $d6 ; get row + jsr cursor_plot ; set crsr +@bs_done: + rts +@not_bs: + cmp #$1b ; esc? + bne @not_escape + lda #$0f ; set esc mode + sta escape_mode + rts +@not_escape: + cmp #$07 ; BEL? + bne @not_bell + jsr beep + rts +@not_bell: + cmp #$0a ; LF? + beq do_line_feed + +@not_lf: + cmp #$09 ; TAB? + bne @not_tab + lda $d3 ; crsr col + and #$f8 ; (col DIV 8) * 8 + clc ; col + 8 + adc #$08 + cmp #$28 ; col=40? + bne @not_last_col ; no -> skip + lda #$27 ; yes -> col=39 +@not_last_col: + tay ; col to y + ldx $d6 ; line to x + jsr cursor_plot ; set crsr + rts + +@not_tab: + rts + +down_one_line: + cpx #$18 ; end of screen? + bne @not_end_of_screen ; no -> go on + rts ; yes -> do nothing +@not_end_of_screen: + inx ; next line + ldy $d3 ; get col + jsr cursor_plot ; set crsr + rts + + +; esc mode +; data in Y +; escape_mode <> $00 in A +handle_escape_char: + tax ; save escape_mode + and #$0f ; escape_mode = $0f? + bne @not_discard_mode + +; --- discard mode --- escape_mode = $f0 +;discard char + lda #$00 ; reset escape_mode + sta escape_mode + rts + +@not_discard_mode: + txa ; restore escape_mode + and #$f0 ; escape_mode = $ff? + beq @short_escape_mode ; no -> short Emode + jmp long_escape_mode ; yes -> long Emode + +; short esc mode +; escape_mode = $0f +; process first char +@short_escape_mode: + tya ; restore char +; --- [ --- + cmp #brace ; [ ? + bne @not_brace + lda #$ff ; set esc [ mode + sta escape_mode + rts +; --- ( --- +@not_brace: + cmp #$28 ; ( ? + bne :+ + jmp set_discard_mode +; --- ) --- +: + cmp #$29 ; ) ? + bne :+ + jmp set_discard_mode +; --- # --- +: + cmp #$23 ; # ? + bne :+ + jmp set_discard_mode +; --- D --- index +: + cmp #$44 ; D ? + bne :+ + jsr do_line_feed ; same as LF + jmp done_escape +; --- M --- reverse index +: + cmp #$4d ; M ? + bne @not_M + ldx $d6 ; get crsr row + cpx scroll_region_start ; top of scroll reg? + bne :+ + jsr cursor_off ; yes -> scroll down + jsr scroll_down_scrollregion + jsr cursor_on + jmp done_escape +: + cpx #$00 ; top of screen? + bne :+ + jmp done_escape ; yes -> do nothing +: + dex ; one line up + ldy $d3 ; get crsr col + jsr cursor_plot ; set crsr + jmp done_escape + +@not_M: +; --- E --- next line + cmp #$45 ; E ? + bne :+ + jsr do_cr + jsr do_line_feed + jmp done_escape +: +; --- 7 --- save crsr + cmp #$37 ; 7? + bne :+ + lda font_mode ; save font + sta saved_font_mode + lda $c7 ; save reverse mode + sta saved_reverse_mode + ldx $d6 ; save position + ldy $d3 + stx saved_row + sty saved_column + jmp done_escape +: +; --- 8 --- restore crsr + cmp #$38 ; 8? + bne :+ + ldx saved_row ; restore pos + ldy saved_column + jsr cursor_plot + lda saved_reverse_mode ; restore .. + sta $c7 ; .. reverse mode + ldx saved_font_mode ; restore font + stx font_mode + lda font_attribute_table,x + sta $0286 ; set colour + jmp done_escape + +; --- unknown --- +: +; --- reset ESC mode --- +done_escape: + lda #$00 ; reset escape_mode + sta escape_mode + rts + +; --- set Discard mode --- +set_discard_mode: + lda #$f0 ; set esc mode $f0 + sta escape_mode + rts + + +; ------------------------------------- +; [ esc mode +; +; escape_mode = $ff +; ------------------------------------- + +long_escape_mode: + tya ; restore char + ldy escape_buffer_length + sta escape_buffer,y ; store char + iny + sty escape_buffer_length ; inc esc buffer + jsr test_if_letter ; test letter + bcs :+ ; process command + rts + +; --- process esc command --- +; A = last char +; Y = escape_buffer_length +; X counts processed command chars +: + ldx #$00 ; first char + +; --- A --- crsr up + cmp #$41 ; A? + bne @not_A + jsr get_number_from_esc_seq ; get argument + lda escape_parameter ; escape_parameter = 0... + bne :+ + inc escape_parameter ; .. means 1 +: + lda $d6 ; get crsr row + sec + sbc escape_parameter ; row = row - up + cmp scroll_region_start ; stop at top of .. + bpl :+ ; ..scroll region + lda scroll_region_start +: + tax ; x is row + ldy $d3 ; y is col + jsr cursor_plot ; set crsr + jmp @end_escape_seq + +; --- B --- crsr down +@not_A: + cmp #$42 ; B? + bne @not_B + jsr get_number_from_esc_seq ; get argument + lda escape_parameter ; escape_parameter = 0... + bne :+ + inc escape_parameter ; .. means 1 +: + lda $d6 ; get crsr row + clc + adc escape_parameter ; row = row + down + cmp scroll_region_end ; outside scrregion? + bcs :+ ; yes -> branch + tax ; x is row + jmp @skip +: + ldx scroll_region_end ; x = row = scroll_region_end +@skip: + ldy $d3 ; y is col + jsr cursor_plot ; set crsr + jmp @end_escape_seq + +; --- C --- crsr right +@not_B: + cmp #$43 ; C? + bne @not_C + jsr get_number_from_esc_seq ; get argument + lda escape_parameter ; escape_parameter = 0... + bne :+ + inc escape_parameter ; .. means 1 +: + lda $d3 ; get crsr col + clc + adc escape_parameter ; col = col + right + cmp #$27 ; outside screen? + bcs :+ ; yes -> branch + tay + jmp @skip2 +: + ldy #$27 ; y=col=left margin +@skip2: + ldx $d6 ; x is row + jsr cursor_plot ; set crsr + jmp @end_escape_seq + +; --- D --- crsr left +@not_C: + cmp #$44 ; D? + bne @not_D + jsr get_number_from_esc_seq ; get argument + lda escape_parameter ; escape_parameter = 0... + bne :+ + inc escape_parameter ; .. means 1 +: + lda $d3 ; get crsr col + sec + sbc escape_parameter ; col = col - left + bpl :+ ; stop at left.. + lda #$00 ; ..margin +: + tay ; y is col + ldx $d6 ; x is row + jsr cursor_plot ; set crsr + jmp @end_escape_seq + +; --- m --- font attributes +@not_D: + cmp #$6d ; m? + bne @not_m +@next_font_attribute: + jsr get_number_from_esc_seq + pha ; save nondigit char + lda escape_parameter ; parameter to A + ; -- 0 -- + bne :+ ; 0? + sta font_mode ; set font = vanilla + sta $c7 ; reverse off + jmp @end_font_attribute ; jmp next par + ; -- 1 -- bold +: + cmp #$01 + bne :+ + lda font_mode ; set bold + ora #$01 + sta font_mode + jmp @end_font_attribute ; next char + ; -- 4 -- underline +: + cmp #$04 + bne :+ + lda font_mode ; set u_line + ora #$02 + sta font_mode + jmp @end_font_attribute ; next char + ; -- 5 -- blink +: + cmp #$05 + bne :+ + lda font_mode ; set blink + ora #$04 + sta font_mode + jmp @end_font_attribute ; next char + ; -- 7 -- reverse +: + cmp #$07 + bne :+ + lda #$01 ; set revers + sta $c7 + jmp @end_font_attribute ; next char +: + ; -- 30 - 37 -- + cmp #38 ; >= 38? + bcs @end_font_attribute + cmp #30 ; < 30? + bcc @end_font_attribute + sbc #30 ; pointer for table + sta direct_colour + lda #$80 ; set direct colour + sta font_mode + +@end_font_attribute: ; -- next char -- + pla ; get nondigit char + cmp #$3b ; is semicolon? + beq @next_font_attribute ; then next cahr + ; -- set colour -- + lda font_mode ; + bmi :+ ; bit 7->direct col + tax ; font to colour + lda font_attribute_table,x + sta $0286 ; set colour + jmp @end_escape_seq +: + ; -- set direct colour -- + ldx direct_colour ; colour maping + lda direct_colour_table,x + sta $0286 ; set colour + jmp @end_escape_seq + +; --- K --- erase line +@not_m: + cmp #$4b ; K? + bne @not_K + jsr get_number_from_esc_seq ; get parameter + lda escape_parameter ; in A + ; -- 0 -- crsr to end of line + bne :+ + jsr erase_to_end_of_line ; erase end line + jmp @end_escape_seq + ; -- 1 -- begin to crsr +: + cmp #$01 + bne :+ + jsr erase_line_to_cursor ; erase beg line + jmp @end_escape_seq + ; -- 2 -- whole line +: + cmp #$02 + bne :+ ; par undefined + ldx $d6 ; line in X + jsr erase_line_by_number ; erase line + sta $ce ; del char .. + ; ..under crsr +: + jmp @end_escape_seq + +; --- f --- same as H +@not_K: + cmp #$66 + bne @not_f + jmp @set_cursor_position ; same as H + +; --- H --- cursor position +@not_f: + cmp #$48 + bne @not_H +@set_cursor_position: + cpy #$01 ; no par means home + bne :+ + ; -- home -- + ldx #$00 + ldy #$00 + jsr cursor_plot ; set crsr + jmp @end_escape_seq + ; -- row, col -- +: + jsr get_number_from_esc_seq + cmp #$3b ; is ;? + bne @end_set_cursor_position ; no -> error + ; -- prepare row -- + ldy escape_parameter ; get row + bne :+ ; 0 means 1 + iny +: + dey ; line 1 -> line 0 + cpy #$19 ; >= 25?.. + bcs @end_set_cursor_position ; ..error! + sty temp_ptr_x ; save row + ; -- prepare col + jsr get_number_from_esc_seq + ldy escape_parameter ; get col + bne :+ ; 0 means 1 + iny +: + dey ; line 1 -> line 0 + cpy #$28 ; >= 40?.. + bcs @end_set_cursor_position ; ..error! + ldx temp_ptr_x ; restore row to X + jsr cursor_plot ; set crsr +@end_set_cursor_position: + jmp @end_escape_seq + + +; --- J --- erase screen +@not_H: + cmp #$4a ;J? + bne @not_J + jsr get_number_from_esc_seq ; get parameter + lda escape_parameter ; in A + ; -- 0 -- crsr to end + bne @not_cursor_to_end + jsr erase_to_end_of_line ; del rest of line + ldx $d6 ; get crsr line +@erase_next_line: + inx ; next line + cpx #$19 ; line 25? + bcs @end_escape_seq ; then end + txa + pha ; save X + jsr erase_line_by_number ; erase line + pla + tax ; restore X + jmp @erase_next_line ; next line + ; -- 1 -- beg of screen to crsr +@not_cursor_to_end: + cmp #$01 + bne @not_start_to_cursor + jsr erase_line_to_cursor ; del start of ln + ldx $d6 ; get crsr line +: + dex ; previous line + bmi @end_escape_seq ; neg line -> end + txa + pha ; save X + jsr erase_line_by_number ; erase line + pla + tax ; restore X + jmp :- + ; -- 2 -- del screen +@not_start_to_cursor: + cmp #$02 ; unknown? + bne @end_escape_seq ; then ingnore + ldx #$18 ; start at ln 24 +: + txa + pha ; save X + jsr erase_line_by_number ; erase line + pla + tax ; restore X + dex ; previous line + bpl :- + jmp @end_escape_seq + + +; --- r --- set scroll region +@not_J: + cmp #$72 ; r? + bne @not_r + ; -- prepare top -- + jsr get_number_from_esc_seq + cmp #$3b ; is ;? + bne @error_in_escape_seq ; no -> error + ldy escape_parameter ; get top + dey ; line 1 -> line 0 + cpy #$19 ; >=25?.. + bcs @error_in_escape_seq ; ..error! + sty temp_ptr_x ; save top + ; -- prepare bottom -- + jsr get_number_from_esc_seq + ldy escape_parameter ; get bottom + dey ; line 1 -> line 0 + cpy #$19 ; >=25?.. + bcs @error_in_escape_seq ; ..error! + sty temp_ptr_y ; save bottom + ; -- validate lines -- + lda temp_ptr_x ; restore top + cmp temp_ptr_y ; >= bottom?.. + bcs @error_in_escape_seq ; ..error! + sta scroll_region_start ; top -> SRStart + sty scroll_region_end ; bottom -> SREnd + ; -- home crsr + ldx #$00 + ldy #$00 + jsr cursor_plot +@error_in_escape_seq: + jmp @end_escape_seq + + +@not_r: +; --- unknown --- +@end_escape_seq: + lda #$00 + sta escape_buffer_length ; reset esc buffer + sta escape_mode ; reset esc mode + rts + + + +; ------------------------------------- +; Test letter +; +; char in A +; returns carry = 1 for A = letter +; ------------------------------------- +test_if_letter: + cmp #$41 ; smaller then A? + bcs :+ ; no -> go on + rts ; return no letter +: + cmp #$5b ; smaller then Z+1? + bcs :+ ; no -> go on + sec ; return letter + rts +: + cmp #$61 ; smaller then a? + bcs :+ ; no -> go on + rts ; return no letter +: + cmp #$7b ; smaller then z+1? + bcs :+ ; no -> go on + sec ; return letter + rts +: + clc ; return no letter + rts + + + +; ------------------------------------- +; test digit +; +; char in A +; returns carry = 1 for A = digit +; ------------------------------------- + +test_if_digit: + cmp #$30 ; smaller then 0? + bcs :+ ; no -> go on + rts ; return no digit +: + cmp #$3a ; smaller then 9+1? + bcs :+ ; no -> go on + sec ; return digit + rts +: + clc ; return no digit + rts + + +; ------------------------------------- +; get decimal number from esc sequence +; +; esc sequence in escape_buffer +; first index to process in X +; returns: number escape_parameter +; first non digit char in A +; ------------------------------------- +get_number_from_esc_seq: + lda #$00 ; assume $00 + sta escape_parameter +@next_digit: + lda escape_buffer,x ; get next char + inx + jsr test_if_digit ; digit? + bcc @done ; no -> return + sbc #$30 ; ascii to # + pha ; save digit + ; old value * 10 + ; 10a = ( 4a + a ) * 2 + lda escape_parameter + asl + asl ; ( 4a + clc + adc escape_parameter ; + a ) + asl ; *2 + sta escape_parameter ; = 10a + ; add new digit + pla ; resore new digit + clc + adc escape_parameter + sta escape_parameter + jmp @next_digit ; next char +@done: + rts + + + +; ************************************* +; * +; * outgoing data +; * +; ************************************* +; ------------------------------------- +; given a single char (read from keyboard) +; work out what data should be sent to the remote host. +; input: +; A = keypress +; output: +; Y=0 - no data to be sent (i.e. ignore keypress) +; Y=1 - A contains single byte to send +; Y=2 - AX points to null terminated string to send +; ------------------------------------- + +;Y=0 nothing to send +;Y=1 A = char to send +;Y=2 AX=pointer to asciiz string to send + +vt100_transform_outbound_char: + tay + lda petscii_to_ascii,y ; PETSCII to ASCII + bne :+ + ldy #0 ; ignore key + rts +: + cmp #$ff + beq cursor_sequence ; send a string + cmp #$fe + beq command_key ; command key + ;default - send (possibly transformed) single char + ldy #1 ;means A contains single byte to send +@done: +rts + + + +; ------------------------------------- +; create an ansi control sequence +; ------------------------------------- + + +cursor_sequence: + tya ; restore original key + +; --- crsr U --- + cmp #$91 ; test crsr U + bne @not_U + ldax #ansi_cursor_up + ldy #2 + rts +; --- crsr L --- +@not_U: + cmp #$9d ; test crsr L + bne @done + ldax #ansi_cursor_left + ldy #2 + rts + +@done: + ldy #0 ;must be some kind of error + rts + + +; ------------------------------------- +; keypress was a command key +; ------------------------------------- + +command_key: + tya ; restore character + +; --- crsr R --- +; --- ^] --- +; both events send $1d + cmp #$1d + bne @not_crsr_R + lda #$04 ; test control Key + bit $028d + beq @cursor_right ; not pressed + ; control ] is pressed + tya ; send ^] + ldy #1 + rts + +; crsr R +@cursor_right: + ldax #ansi_cursor_right + ldy #2 + rts + +; --- crsr D --- +; --- ^Q --- +; both events send char $11 +@not_crsr_R: + cmp #$11 ;^Q / crsr down + bne @not_crsr_D + lda #$04 ; test control Key + bit $028d + beq @cursor_down ; not pressed + ; control Q is pressed + tya ; send ^Q + ldy #1 + rts + + ; crsr down is pressed +@cursor_down: + ldax #ansi_cursor_down + ldy #2 + rts + +; --- HOME key --- +; --- ^S --- +; both events send char $13 +@not_crsr_D: + cmp #$13 ;^S / HOME + bne @not_home + lda #$04 ; test control Key + bit $028d + beq @home ; not pressed + ; control S is pressed + tya ; send ^S + ldy #1 + rts + +@home: + lda #$09 ; send TAB + ldy #1 + rts + +; --- DEL key --- +; --- ^T --- +; both events send char $14 +@not_home: + cmp #$14 ;^T / DEL + bne @not_del + lda #$04 ; test control Key + bit $028d + beq @del ; not pressed + ; control T is pressed + tya ; send ^T + ldy #1 + rts + + ; send DEL +@del: + lda #$08 + ldy #1 + rts + + +; --- unknown C=-Key --- +@not_del: + ldy #0 ;means don't send anything + rts + +; ************************************* +; * +; * screen handling +; * +; ************************************* + +; --- these variables become updated --- +; on crsr movement. +; +; $d1 $d2 start of screen line +; $d3 crsr column +; $d6 crsr row +; $f3 $f4 start of colour line +; $0286 colour + +; --- these variables become updated --- +; on crsr switching. +; +; $cc crsr flag, 0 = on +; $cd crsr blink counter +; $ce char under crsr +; $cf crsr blink phase, 0 normal +; $0287 colour under crsr + + + +; ------------------------------------- +; switch curser off and restore char. +; this has to be done before every crsr +; movement. +; After movement there has to be a jump +; to cursor_on. +; ------------------------------------- +cursor_off: + pha ; save registers + tya + pha + + ldy #$01 ; crsr of + sty $cc + lda $cf ; crsr revers? + beq :+ ; no -> return + dey ; set normal phase + sty $cf + ldy $d3 ; get column + lda $ce ; restore char + sta ($d1),y + lda $0287 ; restore colour + sta ($f3),y + +: + pla ; restore registers + tay + pla + rts + +; ------------------------------------- +; opposite of cursor_off +; ------------------------------------- + +cursor_on: + pha + tya + pha + + ldy $d3 ; get column + lda ($d1),y ; save chr + sta $ce + eor #$80 ; reverse char + sta ($d1),y + lda ($f3),y ; save colour + sta $0287 + lda $0286 ; set crsr colour + sta ($f3),y + inc $cf ; set reverse phase + lda #$14 ; set crsr counter.. + sta $cd ; ..to max + lda #$00 ; cursor on + sta $cc + + pla + tay + pla + rts + + + +; ------------------------------------- +; moves the crsr to column Y +; and line X +; the crsr ist turned off during +; operation +; destroys all registers +; ------------------------------------- +cursor_plot: + jsr cursor_off + + stx $d6 ; set row + sty $d3 ; set col + jsr set_line_vectors + ldx temp_ptr_x ; set screen line + ldy temp_ptr_x+1 + stx $d1 + sty $d2 + ldx temp_ptr_y ; set color line + ldy temp_ptr_y+1 + stx $f3 + sty $f4 + + jsr cursor_on + rts + + +; ------------------------------------- +; Print char in A to screen +; being aware of the crsr state +; ------------------------------------- + +print_to_screen: + jsr cursor_off + jsr plot_char + jsr cursor_on + rts + +; ------------------------------------- +; print char to screen +; char = $ff means no output +; chr in A +; X and Y unaffected +; ------------------------------------- +;plot_char = $e716 + +plot_char: + sta temp_ptr_x ; save char + txa ; save registers + pha + tya + pha + lda temp_ptr_x ; restore char + +; PETSCII to ScreenCode (SC) +; --- $c0-$ff --- - illegal - + cmp #$c0 + bcc :+ + jmp end_plot_char ; no output +; --- $a0-$bf --- C=(latin-1) chars +: + cmp #$a0 + bcc :+ + sbc #$40 ; SC = PET - $40 + jmp @check_for_reverse +; --- $80-$9f --- - illegal - +: + cmp #$80 + bcc :+ + jmp end_plot_char ; no output +; --- $60-$7f --- kapital letters +: + cmp #$60 + bcc :+ + sbc #$20 ; SC = PET - $20 + jmp @check_for_reverse +; --- $40-$5f --- small letters +: + cmp #$40 + bcc :+ + sbc #$40 ; SC = PET - $40 + jmp @check_for_reverse +; --- $20-$3f --- interpunction +: + cmp #$20 + bcc :+ + jmp @check_for_reverse ; SC = PET +; --- $00-$1f --- - illegal - +: + jmp end_plot_char ; no output + +; --- handle reverse mode--- +@check_for_reverse: + ldx $c7 ; reverse mode? + beq @put_char + ora #$80 ; reverse char + +; --- put char to screen --- +@put_char: + ldy $d3 ; get crsr col + sta ($d1),y ; char to screen + lda $0286 ; get colour + sta ($f3),y ; set colour + +; --- move on crsr --- + cpy #$27 ; col = 39? + beq move_to_next_line ; yes -> new line + iny ; move on + sty $d3 + +end_plot_char: + pla ; restore registers + tay + pla + tax + rts + +; ------------------------------------- +; subtask of plot_char +; ends at end_plot_char +; ------------------------------------- +move_to_next_line: + ldx $d6 ; get crsr row + cpx scroll_region_end ; end of scroll reg? + beq @scroll_up ; yes -> branche + cpx #$18 ; line 24? + beq end_plot_char ; yes -> crsr stays +; --- normal wrap --- + inx ; increase line + stx $d6 + ldy #$00 ; begin of line + sty $d3 + jsr set_line_vectors + ldx temp_ptr_x ; set screen line + ldy temp_ptr_x+1 + stx $d1 + sty $d2 + ldx temp_ptr_y ; set colour line + ldy temp_ptr_y+1 + stx $f3 + sty $f4 + jmp end_plot_char +; --- scroll up --- +@scroll_up: + jsr scroll_up_scrollregion + ldy #$00 ; begin of line + sty $d3 + jmp end_plot_char + + + +scroll_up_scrollregion: + ldx scroll_region_start ; get first line +@scroll_one_line: + ; -- new line: -- + ; -- temp_ptr_z and temp_ptr_w -- + jsr set_line_vectors + lda temp_ptr_x ; screen line + ldy temp_ptr_x+1 + sta temp_ptr_z + sty temp_ptr_z+1 + lda temp_ptr_y ; colour line + ldy temp_ptr_y+1 + sta temp_ptr_w + sty temp_ptr_w+1 + ; -- old line: -- + ; -- temp_ptr_x and temp_ptr_y + inx ; old line + jsr set_line_vectors + ; -- copy chars and colours -- + ldy #$27 ; col 39 +@scroll_one_char: + lda (temp_ptr_x),y ; copy char + sta (temp_ptr_z),y + lda (temp_ptr_y),y ; copy colour + sta (temp_ptr_w),y + dey + bpl @scroll_one_char + cpx scroll_region_end ; last line? + bne @scroll_one_line ; no -> go on + jsr erase_line_by_vector ; del last line + + rts + + +scroll_down_scrollregion: + ldx scroll_region_end ; get last line +@scroll_one_line: + jsr set_line_vectors + lda temp_ptr_x ; screen line + ldy temp_ptr_x+1 + sta temp_ptr_z + sty temp_ptr_z+1 + lda temp_ptr_y ; colour line + ldy temp_ptr_y+1 + sta temp_ptr_w + sty temp_ptr_w+1 + ; -- old line: -- + ; -- temp_ptr_x and temp_ptr_y + dex ; old line + jsr set_line_vectors + ; -- copy chars ond colours -- + ldy #$27 ; col 39 +@scroll_one_char: + lda (temp_ptr_x),y ; copy char + sta (temp_ptr_z),y + lda (temp_ptr_y),y ; copy colour + sta (temp_ptr_w),y + dey + bpl @scroll_one_char + cpx scroll_region_start ; first line? + bne @scroll_one_line ; no -> go on + jsr erase_line_by_vector ; del first line + + rts + + +; ------------------------------------- +; print string to screen +; string: chars, terminated by $00 +; start lo in x +; start hi in y +; affects A +; takes care of crsr +; the string must be smaller +; than 255 chrs +; ------------------------------------- + + +plot_string: + stx print_ptr ; store start vector + sty print_ptr+1 + jsr cursor_off + ldy #$00 +@next_char: + lda (print_ptr),y + beq @end_string ; $00 terminates string + jsr plot_char + iny + jmp @next_char + +@end_string: + jsr cursor_on + rts + + + +; ------------------------------------- +; delete screen line +; (Erase Line) +; +; line number in X +; +; erase_line_by_vector needs line vectors in temp_ptr_x +; and temp_ptr_y +; +; destroys all registers +; returns $20 (space) in A +; ------------------------------------- + +erase_line_by_number: + jsr set_line_vectors ; line start in temp_ptr_x + ; col start in temp_ptr_y + +; erase chars +erase_line_by_vector: + ldy #$27 ; col 39 + lda #$20 ; load space +: + sta (temp_ptr_x),y ; clear char + dey + bpl :- + +; set colour + ldy #$27 ; col 39 + lda #charmode_vanilla ; load vanilla +: + sta (temp_ptr_y),y ; clear char + dey + bpl :- + + rts + + + +; ------------------------------------- +; delete screen line from crsr to end +; (Erase End of Line) +; destroys all registers +; ------------------------------------- + +erase_to_end_of_line: +; erase chars + ldy $d3 ; get crsr col + lda #$20 ; load space +: + sta ($d1),y ; clear char + iny + cpy #$28 ; pos 40? + bne :- ; next char + sta $ce ; del char .. + ; ..under crsr +; set colour + ldy $d3 ; get crsr col + lda #charmode_vanilla ; load vanilla +: + sta ($f3),y ; set colour + iny + cpy #$28 ; pos 40? + bne :- ; next char + rts + +; ------------------------------------- +; delete screen line up to crsr +; (Erase Begin of Line) +; destroys all registers +; ------------------------------------- +erase_line_to_cursor: +; erase chars + ldy $d3 ; get crsr col + lda #$20 ; load space +: + sta ($d1),y ; clear char + dey + bpl :- ; pos>=0 -> next + sta $ce ; del char .. + ; ..under crsr +; set colour + ldy $d3 ; get crsr col + lda #charmode_vanilla ; load vanilla +: + sta ($f3),y ; clear char + dey + bpl :- ; pos>=0 -> next + rts + + +; ------------------------------------- +; set line vectors +; +; line no in X +; destroys A and Y +; +; sets start of screen line in temp_ptr_x +; sets start of colour line in temp_ptr_y +; ------------------------------------- + +set_line_vectors: + lda $ecf0,x ; get lo byte + sta temp_ptr_x + sta temp_ptr_y + ; determin hi byte + ldy #$04 ; hi byte + cpx #$07 ; line < 7? + bcc @got_line_vector + iny + cpx #$0d ; line < 13? + bcc @got_line_vector + iny + cpx #$14 ; line < 20? + bcc @got_line_vector + iny ; line 20-24 +@got_line_vector: + sty temp_ptr_x+1 + tya + clc ; colour RAM = + adc #$d4 ; video RAM + d4 + sta temp_ptr_y+1 + rts + + + +; ------------------------------------- +; init routines +; +; ------------------------------------- + + +initialise_screen: + + ;--- set background --- + lda #border_colour + sta $d020 + lda #text_background_colour + sta $d021 +; --- disable Shift C= --- + lda #$80 + sta $0291 +; --- erase screen --- + ldx #$18 ; start at ln 24 +@erase_one_line: + txa + pha ; save X + jsr erase_line_by_number ; erase line + pla + tax ; restore X + dex ; previous line + bpl @erase_one_line + + lda #charmode_vanilla ; load vanilla + sta $0286 +; --- crsr on --- + jsr cursor_off + jsr cursor_on +; --- put crsr --- + jsr do_cr + jsr do_line_feed + jsr do_line_feed + + rts + + + +initialise_variables: + lda #$00 + sta escape_mode + sta escape_buffer_length + sta scroll_region_start + sta font_mode + sta saved_font_mode + sta saved_reverse_mode + sta saved_row + sta saved_column + + lda #$18 ; last line + sta scroll_region_end ; = 24 + + rts + + +reverse_font_table = font_table + $0400 +initialise_font: + sei + ldx #ROM_FONT + stx temp_ptr_z + sty temp_ptr_z+1 + ldx #font_table + stx temp_ptr_y + sty temp_ptr_y+1 + ldx #reverse_font_table + stx temp_ptr_x + sty temp_ptr_x+1 + +; copy font + ldx #$04 ; copy 4 pages = 1KB + ldy #$00 +: + lda (temp_ptr_z),y + sta (temp_ptr_y),y + eor #$ff ; reverse char + sta (temp_ptr_x),y + iny + bne :- + ; switch to next page + inc temp_ptr_z+1 + inc temp_ptr_y+1 + inc temp_ptr_x+1 + dex + bne :- + +; enable font + lda $d018 + and #$f1 + ora #$09 + sta $d018 + cli + rts + + +.rodata +font_attribute_table: ; bits mean blink, underline, bold +.byte charmode_vanilla, charmode_bold ; 000 001 +.byte charmode_underline, charmode_underline_bold ; 010 011 +.byte charmode_blink, charmode_blink_bold ; 100 101 +.byte charmode_blink_underline, charmode_blink_underline_bold ; 110 111 + +direct_colour_table: +;ANSI 30 31 32 32 34 35 36 37 +; blk rd gr ye blu mg cy wh +.byte 0, $0a, 5, 7, $0e, 4, 3, 1 + +ansi_cursor_up: .byte esc, brace, $41, $00 ; esc [ A +ansi_cursor_down: .byte esc, brace, $42, $00 ; esc [ B +ansi_cursor_right: .byte esc, brace, $43, $00 ; esc [ C +ansi_cursor_left: .byte esc, brace, $44, $00 ; esc [ D + + +; ------------------------------------- +; table ASCII to PETSCII +; +; these characters cat be printed +; +; pet=$00 means ignore the char +; pet=$01 means do something complicated +; ------------------------------------- +ascii_to_petscii: + .byte $00 ; $00 + .byte $00 ; $01 + .byte $00 ; $02 + .byte $00 ; $03 + .byte $00 ; $04 + .byte $00 ; $05 + .byte $00 ; $06 + .byte $01 ; $07 BEL + .byte $01 ; $08 BS/DEL + .byte $01 ; $09 TAB + .byte $01 ; $0a LF + .byte $00 ; $0b + .byte $00 ; $0c + .byte $01 ; $0d CR + .byte $00 ; $0e + .byte $00 ; $0f + .byte $00 ; $10 + .byte $00 ; $11 + .byte $00 ; $12 + .byte $00 ; $13 + .byte $00 ; $14 + .byte $00 ; $15 + .byte $00 ; $16 + .byte $00 ; $17 + .byte $00 ; $18 + .byte $00 ; $19 + .byte $00 ; $1a + .byte $01 ; $1b ESC + .byte $00 ; $1c + .byte $00 ; $1d + .byte $00 ; $1e + .byte $00 ; $1f + .byte $20 ; $20 1:1 + .byte $21 ; $21 1:1 + .byte $22 ; $22 1:1 + .byte $23 ; $23 1:1 + .byte $24 ; $24 1:1 + .byte $25 ; $25 1:1 + .byte $26 ; $26 1:1 + .byte $27 ; $27 1:1 + .byte $28 ; $28 1:1 + .byte $29 ; $29 1:1 + .byte $2a ; $2a 1:1 + .byte $2b ; $2b 1:1 + .byte $2c ; $2c 1:1 + .byte $2d ; $2d 1:1 + .byte $2e ; $2e 1:1 + .byte $2f ; $2f 1:1 + .byte $30 ; $30 1:1 + .byte $31 ; $31 1:1 + .byte $32 ; $32 1:1 + .byte $33 ; $33 1:1 + .byte $34 ; $34 1:1 + .byte $35 ; $35 1:1 + .byte $36 ; $36 1:1 + .byte $37 ; $37 1:1 + .byte $38 ; $38 1:1 + .byte $39 ; $39 1:1 + .byte $3a ; $3a 1:1 + .byte $3b ; $3b 1:1 + .byte $3c ; $3c 1:1 + .byte $3d ; $3d 1:1 + .byte $3e ; $3e 1:1 + .byte $3f ; $3f 1:1 + .byte $40 ; $40 1:1 + .byte $61 ; $41 ----- + .byte $62 ; $42 + .byte $63 ; $43 + .byte $64 ; $44 capital + .byte $65 ; $45 + .byte $66 ; $46 + .byte $67 ; $47 + .byte $68 ; $48 + .byte $69 ; $49 + .byte $6a ; $4a + .byte $6b ; $4b + .byte $6c ; $4c + .byte $6d ; $4d letters + .byte $6e ; $4e + .byte $6f ; $4f + .byte $70 ; $50 + .byte $71 ; $51 + .byte $72 ; $52 + .byte $73 ; $53 + .byte $74 ; $54 + .byte $75 ; $55 + .byte $76 ; $56 + .byte $77 ; $57 + .byte $78 ; $58 + .byte $79 ; $59 + .byte $7a ; $5a ----- + .byte $5b ; $5b 1:1 + .byte $5c ; $5c 1:1 + .byte $5d ; $5d 1:1 + .byte $5e ; $5e 1:1 + .byte $5f ; $5f 1:1 + .byte $60 ; $60 1:1 + .byte $41 ; $61 ----- + .byte $42 ; $62 + .byte $43 ; $63 + .byte $44 ; $64 small + .byte $45 ; $65 + .byte $46 ; $66 + .byte $47 ; $67 + .byte $48 ; $68 + .byte $49 ; $69 + .byte $4a ; $6a + .byte $4b ; $6b letters + .byte $4c ; $6c + .byte $4d ; $6d + .byte $4e ; $6e + .byte $4f ; $6f + .byte $50 ; $70 + .byte $51 ; $71 + .byte $52 ; $72 + .byte $53 ; $73 + .byte $54 ; $74 + .byte $55 ; $75 + .byte $56 ; $76 + .byte $57 ; $77 + .byte $58 ; $78 + .byte $59 ; $79 + .byte $5a ; $7a ----- + .byte $7b ; $7b 1:1 { + .byte $7c ; $7c 1:1 | + .byte $7d ; $7d 1:1 } + .byte $7e ; $7e 1:1 ~ + .byte $00 ; $7f + .byte $00 ; $80 + .byte $00 ; $81 + .byte $00 ; $82 + .byte $00 ; $83 + .byte $00 ; $84 + .byte $00 ; $85 + .byte $00 ; $86 + .byte $00 ; $87 + .byte $00 ; $88 + .byte $00 ; $89 + .byte $00 ; $8a + .byte $00 ; $8b + .byte $00 ; $8c + .byte $00 ; $8d + .byte $00 ; $8e + .byte $00 ; $8f + .byte $00 ; $90 + .byte $00 ; $91 + .byte $00 ; $92 + .byte $00 ; $93 + .byte $00 ; $94 + .byte $00 ; $95 + .byte $00 ; $96 + .byte $00 ; $97 + .byte $00 ; $98 + .byte $00 ; $99 + .byte $00 ; $9a + .byte $00 ; $9b + .byte $00 ; $9c + .byte $00 ; $9d + .byte $00 ; $9e + .byte $00 ; $9f + .byte $20 ; $a0 + .byte $7f ; $a1 + .byte $7f ; $a2 + .byte $bf ; $a3 + .byte $be ; $a4 + .byte $7f ; $a5 + .byte $73 ; $a6 + .byte $b5 ; $a7 + .byte $53 ; $a8 + .byte $bb ; $a9 + .byte $7f ; $aa + .byte $bc ; $ab + .byte $7f ; $ac + .byte $2d ; $ad + .byte $7f ; $ae + .byte $7f ; $af + .byte $ba ; $b0 + .byte $b8 ; $b1 + .byte $b6 ; $b2 + .byte $b7 ; $b3 + .byte $7a ; $b4 + .byte $b9 ; $b5 + .byte $7f ; $b6 + .byte $7f ; $b7 + .byte $5a ; $b8 + .byte $7f ; $b9 + .byte $7f ; $ba + .byte $bd ; $bb + .byte $b0 ; $bc + .byte $b0 ; $bd + .byte $79 ; $be + .byte $7f ; $bf + .byte $a5 ; $c0 + .byte $61 ; $c1 + .byte $a4 ; $c2 + .byte $61 ; $c3 + .byte $a3 ; $c4 + .byte $a4 ; $c5 + .byte $7f ; $c6 + .byte $63 ; $c7 + .byte $ad ; $c8 + .byte $ab ; $c9 + .byte $ac ; $ca + .byte $65 ; $cb + .byte $69 ; $cc + .byte $69 ; $cd + .byte $69 ; $ce + .byte $69 ; $cf + .byte $64 ; $d0 + .byte $6e ; $d1 + .byte $6f ; $d2 + .byte $6f ; $d3 + .byte $b1 ; $d4 + .byte $6f ; $d5 + .byte $af ; $d6 + .byte $7f ; $d7 + .byte $6f ; $d8 + .byte $75 ; $d9 + .byte $75 ; $da + .byte $75 ; $db + .byte $b3 ; $dc + .byte $79 ; $dd + .byte $7f ; $de + .byte $b4 ; $df + .byte $a2 ; $e0 + .byte $41 ; $e1 + .byte $a1 ; $e2 + .byte $41 ; $e3 + .byte $a0 ; $e4 + .byte $a1 ; $e5 + .byte $7f ; $e6 + .byte $a6 ; $e7 + .byte $aa ; $e8 + .byte $a8 ; $e9 + .byte $a9 ; $ea + .byte $a7 ; $eb + .byte $49 ; $ec + .byte $49 ; $ed + .byte $49 ; $ee + .byte $49 ; $ef + .byte $7f ; $f0 + .byte $4e ; $f1 + .byte $4f ; $f2 + .byte $4f ; $f3 + .byte $b1 ; $f4 + .byte $4f ; $f5 + .byte $ae ; $f6 + .byte $7f ; $f7 + .byte $4f ; $f8 + .byte $55 ; $f9 + .byte $55 ; $fa + .byte $55 ; $fb + .byte $b2 ; $fc + .byte $59 ; $fd + .byte $7f ; $fe + .byte $59 ; $ff + +; ------------------------------------- +; table PETSCII to ASCII +; +; these characters can be typed with +; the keyboard +; +; ascii = $00 means ignore key +; ascii = $ff menas send string +; ascii = $fe means do something +; complicated (command key) +; ------------------------------------- +petscii_to_ascii: + .byte $00 ; $00 + .byte $01 ; $01 + .byte $02 ; $02 + .byte $03 ; $03 + .byte $04 ; $04 + .byte $05 ; $05 + .byte $06 ; $06 + .byte $07 ; $07 + .byte $08 ; $08 DEL + .byte $09 ; $09 TAB + .byte $0a ; $0a + .byte $0b ; $0b + .byte $0c ; $0c + .byte $0d ; $0d CR + .byte $0e ; $0e + .byte $0f ; $0f + .byte $10 ; $10 + .byte $fe ; $11 ^Q (crsr down) + .byte $12 ; $12 + .byte $fe ; $13 ^S TAB (HOME) + .byte $fe ; $14 ^T BS (DEL) + .byte $15 ; $15 + .byte $16 ; $16 + .byte $17 ; $17 + .byte $18 ; $18 + .byte $19 ; $19 + .byte $1a ; $1a + .byte $1b ; $1b ESC + .byte $1c ; $1c + .byte $fe ; $1d ^](crsr right) + .byte $1e ; $1e + .byte $1f ; $1f + .byte $20 ; $20 SPACE + .byte $21 ; $21 ! + .byte $22 ; $22 " + .byte $23 ; $23 # + .byte $24 ; $24 $ + .byte $25 ; $25 % + .byte $26 ; $26 & + .byte $27 ; $27 ' + .byte $28 ; $28 ( + .byte $29 ; $29 ) + .byte $2a ; $2a * + .byte $2b ; $2b + + .byte $2c ; $2c , + .byte $2d ; $2d - + .byte $2e ; $2e . + .byte $2f ; $2f / + .byte $30 ; $30 0 + .byte $31 ; $31 1 + .byte $32 ; $32 2 + .byte $33 ; $33 3 + .byte $34 ; $34 4 + .byte $35 ; $35 5 + .byte $36 ; $36 6 + .byte $37 ; $37 7 + .byte $38 ; $38 8 + .byte $39 ; $39 9 + .byte $3a ; $3a : + .byte $3b ; $3b ; + .byte $3c ; $3c < + .byte $3d ; $3d = + .byte $3e ; $3e > + .byte $3f ; $3f ? + .byte $40 ; $40 @ + .byte $61 ; $41 a + .byte $62 ; $42 b + .byte $63 ; $43 c + .byte $64 ; $44 d + .byte $65 ; $45 e + .byte $66 ; $46 f + .byte $67 ; $47 g + .byte $68 ; $48 h + .byte $69 ; $49 i + .byte $6a ; $4a j + .byte $6b ; $4b k + .byte $6c ; $4c l + .byte $6d ; $4d m + .byte $6e ; $4e n + .byte $6f ; $4f o + .byte $70 ; $50 p + .byte $71 ; $51 q + .byte $72 ; $52 r + .byte $73 ; $53 s + .byte $74 ; $54 t + .byte $75 ; $55 u + .byte $76 ; $56 v + .byte $77 ; $57 w + .byte $78 ; $58 x + .byte $79 ; $59 y + .byte $7a ; $5a z + .byte $5b ; $5b [ + .byte $5c ; $5c \ (Pound) + .byte $5d ; $5d ] + .byte $5e ; $5e ^ + .byte $1b ; $5f ESC ( <- ) + .byte $00 ; $60 + .byte $41 ; $61 A + .byte $42 ; $62 B + .byte $43 ; $63 C + .byte $44 ; $64 D + .byte $45 ; $65 E + .byte $46 ; $66 F + .byte $47 ; $67 G + .byte $48 ; $68 H + .byte $49 ; $69 I + .byte $4a ; $6a J + .byte $4b ; $6b K + .byte $4c ; $6c L + .byte $4d ; $6d M + .byte $4e ; $6e N + .byte $4f ; $6f O + .byte $50 ; $70 P + .byte $51 ; $71 Q + .byte $52 ; $72 R + .byte $53 ; $73 S + .byte $54 ; $74 T + .byte $55 ; $75 U + .byte $56 ; $76 V + .byte $57 ; $77 W + .byte $58 ; $78 X + .byte $59 ; $79 Y + .byte $5a ; $7a Z + .byte $00 ; $7b + .byte $00 ; $7c + .byte $00 ; $7d + .byte $00 ; $7e + .byte $00 ; $7f + .byte $00 ; $80 + .byte $00 ; $81 + .byte $00 ; $82 + .byte $00 ; $83 + .byte $00 ; $84 + .byte $00 ; $85 (f1) + .byte $00 ; $86 (f3) + .byte $00 ; $87 (f5) + .byte $00 ; $88 (f7) + .byte $00 ; $89 (f2) + .byte $00 ; $8a (f4) + .byte $00 ; $8b (f6) + .byte $00 ; $8c (f8) + .byte $00 ; $8d (Shift RET) + .byte $00 ; $8e + .byte $00 ; $8f + .byte $00 ; $90 + .byte $ff ; $91 (crsr up) + .byte $00 ; $92 + .byte $00 ; $93 (Shift Clr/Home) + .byte $7f ; $94 DEL (Shift Ins/Del) + .byte $00 ; $95 + .byte $00 ; $96 + .byte $00 ; $97 + .byte $00 ; $98 + .byte $00 ; $99 + .byte $00 ; $9a + .byte $00 ; $9b + .byte $00 ; $9c + .byte $ff ; $9d (crsr left) + .byte $00 ; $9e + .byte $00 ; $9f + .byte $00 ; $a0 (Shift Space) + .byte $00 ; $a1 + .byte $00 ; $a2 + .byte $00 ; $a3 + .byte $00 ; $a4 + .byte $00 ; $a5 + .byte $00 ; $a6 + .byte $00 ; $a7 + .byte $00 ; $a8 + .byte $7c ; $a9 | (Shift Pound) + .byte $00 ; $aa + .byte $00 ; $ab + .byte $fe ; $ac C= D + .byte $00 ; $ad + .byte $fe ; $ae C= S + .byte $00 ; $af + .byte $fe ; $b0 C= A + .byte $00 ; $b1 + .byte $fe ; $b2 C= R + .byte $00 ; $b3 + .byte $00 ; $b4 + .byte $00 ; $b5 + .byte $fe ; $b6 C= L + .byte $00 ; $b7 + .byte $00 ; $b8 + .byte $00 ; $b9 + .byte $60 ; $ba ` ( Shift @ ) + .byte $00 ; $bb + .byte $fe ; $bc C= C + .byte $00 ; $bd + .byte $00 ; $be + .byte $fe ; $bf C= B + .byte $5f ; $c0 _ ( Shift * ) + .byte $41 ; $c1 ----- + .byte $42 ; $c2 + .byte $43 ; $c3 capital + .byte $44 ; $c4 + .byte $45 ; $c5 letters + .byte $46 ; $c6 + .byte $47 ; $c7 generate + .byte $48 ; $c8 + .byte $49 ; $c9 these + .byte $4a ; $ca + .byte $4b ; $cb codes + .byte $4c ; $cc + .byte $4d ; $cd + .byte $4e ; $ce + .byte $4f ; $cf + .byte $50 ; $d0 + .byte $51 ; $d1 + .byte $52 ; $d2 + .byte $53 ; $d3 + .byte $54 ; $d4 + .byte $55 ; $d5 + .byte $56 ; $d6 + .byte $57 ; $d7 + .byte $58 ; $d8 + .byte $59 ; $d9 + .byte $5a ; $da ----- + .byte $7b ; $db { ( Shift + ) + .byte $00 ; $dc ( C= - ) + .byte $7d ; $dd } ( Shift - ) + .byte $7e ; $de ~ ( Pi ) + .byte $00 ; $df + .byte $00 ; $e0 + .byte $00 ; $e1 + .byte $00 ; $e2 + .byte $00 ; $e3 + .byte $00 ; $e4 + .byte $00 ; $e5 + .byte $00 ; $e6 + .byte $00 ; $e7 + .byte $00 ; $e8 + .byte $00 ; $e9 + .byte $00 ; $ea + .byte $00 ; $eb + .byte $00 ; $ec + .byte $00 ; $ed + .byte $00 ; $ee + .byte $00 ; $ef + .byte $00 ; $f0 + .byte $00 ; $f1 + .byte $00 ; $f2 + .byte $00 ; $f3 + .byte $00 ; $f4 + .byte $00 ; $f5 + .byte $00 ; $f6 + .byte $00 ; $f7 + .byte $00 ; $f8 + .byte $00 ; $f9 + .byte $00 ; $fa + .byte $00 ; $fb + .byte $00 ; $fc + .byte $00 ; $fd + .byte $00 ; $fe + .byte $00 ; $ff + +ROM_FONT: +.incbin "../inc/vt100_font.bin" + +;-- LICENSE FOR vt100_c64.s -- +; The contents of this file are subject to the Mozilla Public License +; Version 1.1 (the "License"); you may not use this file except in +; compliance with the License. You may obtain a copy of the License at +; http://www.mozilla.org/MPL/ +; +; Software distributed under the License is distributed on an "AS IS" +; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +; License for the specific language governing rights and limitations +; under the License. +; +; The Initial Developer of the Original Code is Lars Stollenwerk. +; +; Portions created by the Initial Developer are Copyright (C) 2003 +; Lars Stollenwerk. All Rights Reserved. +; +;Contributor(s): Jonno Downes +; -- LICENSE END -- diff --git a/client/test/Makefile b/client/test/Makefile index 77b5cfa..6ec3d8b 100644 --- a/client/test/Makefile +++ b/client/test/Makefile @@ -21,11 +21,12 @@ INCFILES=\ all: \ testdns.prg \ test_disk_io.prg \ - test_disk_io.d64 \ +# test_disk_io.d64 \ testdns.pg2 \ testtftp.prg \ testtftp.pg2\ test_cart_api.prg\ + test_vt100.prg\ testdottedquad.pg2\ testdottedquad.prg\ test_tcp.prg \ @@ -35,7 +36,7 @@ all: \ test_sntp.prg \ test_get_url.prg \ test_parse_querystring.prg \ - httpd_test.d64 \ +# httpd_test.d64 \ # ip65test.dsk \ %.o: %.c diff --git a/client/test/file1.html b/client/test/file1.html new file mode 100644 index 0000000..4e65228 --- /dev/null +++ b/client/test/file1.html @@ -0,0 +1,3 @@ + +This is file1 + \ No newline at end of file diff --git a/client/test/index.html b/client/test/index.html new file mode 100644 index 0000000..83daf07 --- /dev/null +++ b/client/test/index.html @@ -0,0 +1,3 @@ + +This is index.html + \ No newline at end of file diff --git a/client/test/test_vt100.s b/client/test/test_vt100.s new file mode 100644 index 0000000..b1de18c --- /dev/null +++ b/client/test/test_vt100.s @@ -0,0 +1,105 @@ + +.ifndef KIPPER_API_VERSION_NUMBER + .define EQU = + .include "../inc/kipper_constants.i" +.endif + +.include "../inc/common.i" +.include "../inc/commonprint.i" +.import print_a +.import cfg_get_configuration_ptr + +.import get_key +.import timer_init +.import beep +.segment "STARTUP" ;this is what gets put at the start of the file on the C64 + +.word basicstub ; load address + +.import vt100_init_terminal +.import vt100_process_inbound_char + +basicstub: + .word @nextline + .word 2003 + .byte $9e + .byte <(((init / 1000) .mod 10) + $30) + .byte <(((init / 100 ) .mod 10) + $30) + .byte <(((init / 10 ) .mod 10) + $30) + .byte <(((init ) .mod 10) + $30) + .byte 0 +@nextline: + .word 0 + +.code +init: + + jsr timer_init + jsr vt100_init_terminal + ldax #string1 + jsr emit_string + + rts + + +emit_string: + stax next_byte+1 +: + jsr next_byte + + beq @done + jsr vt100_process_inbound_char + jmp :- +@done: + rts + +next_byte: + lda $ffff + inc next_byte+1 + bne :+ + inc next_byte+2 +: + cmp #0 + rts + + +.rodata + +string1: +.byte $1b,"[H" ;HOME +.byte "hello world",13,10 +.byte $1b,"[1m" ;BOLD +.byte "hello bold",13,10 +.byte $1b,"[7m" ;reverse +.byte "hello reverse bold",13,10 +.byte $1b,"7" ;save cursor position & attributes +.byte $1b,"[m" ;normal +.byte "hello normal",13,10 +.byte 07 +.byte "that was a beep!",13,10 +.byte $1b,"8" ;restor cursor position & attributes +.byte $1b,"[20;1H"; ;move to row 20, pos 1 +.byte "ABCDEFGhijklmnopqRsTuVwXyZ01234567890" +.byte $1b,"[20;10f"; ;move to row 20, pos 1 +.byte $1b,"[1K" + +.byte 0 + +;-- LICENSE FOR test_vt00.s -- +; The contents of this file are subject to the Mozilla Public License +; Version 1.1 (the "License"); you may not use this file except in +; compliance with the License. You may obtain a copy of the License at +; http://www.mozilla.org/MPL/ +; +; Software distributed under the License is distributed on an "AS IS" +; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +; License for the specific language governing rights and limitations +; under the License. +; +; The Original Code is ip65. +; +; The Initial Developer of the Original Code is Jonno Downes, +; jonno@jamtronix.com. +; Portions created by the Initial Developer are Copyright (C) 2009 +; Jonno Downes. All Rights Reserved. +; -- LICENSE END -- diff --git a/dist/make_dist.rb b/dist/make_dist.rb index e6ac18e..690a533 100644 --- a/dist/make_dist.rb +++ b/dist/make_dist.rb @@ -24,7 +24,7 @@ end ["client/carts/kipperkart.prg","c64/"], ["client/carts/kipperkart.bin","c64/"], ["client/carts/kipperkart_rr.bin","c64/"], -["client/carts/kipperterm.bin","c64/"], +#["client/carts/kipperterm.bin","c64/"], ["client/carts/netboot.bin","c64/"], ["client/nb65/d64_upload.prg","boot/"], ["client/examples/upnatom.prg","boot/"], @@ -38,6 +38,9 @@ end ["doc/netboot65.html","doc/index.html"], #["doc/README.Apple2.html","doc"], ["doc/README.C64.html","doc"], +["doc/CONTRIBUTORS.txt","doc/"], +["doc/LICENSE.txt","doc/"], + ["doc/kipper_api_technical_reference.doc","doc"], ["client/inc/common.i","inc"], ["client/inc/kipper_constants.i","inc"], diff --git a/dist/make_dist_ip65.rb b/dist/make_dist_ip65.rb index 3be86ea..7aefaa8 100644 --- a/dist/make_dist_ip65.rb +++ b/dist/make_dist_ip65.rb @@ -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","nb65"].each do |dir_suffix| +["","ip65","doc","cfg","drivers","inc","test","carts"].each do |dir_suffix| dir_path="#{WORKING_DIR}/#{dir_suffix}" Dir.mkdir(dir_path) unless File.exist?(dir_path) end @@ -16,7 +16,13 @@ end [ ["client/ip65/*.[s|i]","ip65/"], ["client/ip65/Makefile","ip65/"], + ["client/carts/*.[s|i]","carts/"], + ["client/carts/Makefile","carts/"], + ["client/carts/*.rb","carts/"], + ["client/carts/*.obj","carts/"], + ["client/carts/*.src","carts/"], ["client/inc/*.i","inc/"], + ["client/inc/vt100_font.bin","inc/"], ["client/test/*.[s|i]","test/"], ["client/test/Makefile","test/"], ["client/drivers/*.[s|i]","drivers/"], @@ -24,6 +30,8 @@ end ["client/cfg/*","cfg/"], ["doc/ip65.html","doc/index.html"], ["doc/ca65-doc*.*","doc/"], + ["doc/CONTRIBUTORS.txt","doc/"], + ["doc/LICENSE.txt","doc/"], ["client/Makefile","/"], ].each do |args| dest="#{WORKING_DIR}/#{args[1]}" @@ -33,9 +41,9 @@ end end end -dummy_makefile=File.new("#{WORKING_DIR}/nb65/Makefile","w") -dummy_makefile<<"#dummy makefile, so we can reuse the top level Makefile from the netboot65/client directory\nall:\n" -dummy_makefile.close +#dummy_makefile=File.new("#{WORKING_DIR}/carts/Makefile","w") +#dummy_makefile<<"#dummy makefile, so we can reuse the top level Makefile from the netboot65/client directory\nall:\n" +#dummy_makefile.close require 'document_ca65_source_as_html.rb' codebase_dir=WORKING_DIR diff --git a/dist/version_number.txt b/dist/version_number.txt index a4c112a..e5a4a5e 100644 --- a/dist/version_number.txt +++ b/dist/version_number.txt @@ -1 +1 @@ -0.9.37 \ No newline at end of file +1.0.9 \ No newline at end of file diff --git a/doc/CONTRIBUTORS.txt b/doc/CONTRIBUTORS.txt new file mode 100644 index 0000000..7817ad9 --- /dev/null +++ b/doc/CONTRIBUTORS.txt @@ -0,0 +1,6 @@ +CONTRIBUTORS + +Jonno Downes - current maintainer of ip75, layers 4-7 (dhcp,dns,tcp,telnet, http, gopher) +Glenn Holmmer - icmp enhancements, bugfixes +Per Olofsson - initial creator of ip65, layers 1-3 (eth,arp,ip,icmp,udp) +Lars Stollenwerk - vt100 emulation diff --git a/doc/LICENSE.txt b/doc/LICENSE.txt new file mode 100644 index 0000000..0721004 --- /dev/null +++ b/doc/LICENSE.txt @@ -0,0 +1,471 @@ + MOZILLA PUBLIC LICENSE + Version 1.1 + + --------------- + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the + Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to + the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original + Code, prior Modifications used by a Contributor, and the Modifications + made by that particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the + combination of the Original Code and Modifications, in each case + including portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally + accepted in the software development community for the electronic + transfer of data. + + 1.5. "Executable" means Covered Code in any form other than Source + Code. + + 1.6. "Initial Developer" means the individual or entity identified + as the Initial Developer in the Source Code notice required by Exhibit + A. + + 1.7. "Larger Work" means a work which combines Covered Code or + portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum + extent possible, whether at the time of the initial grant or + subsequently acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the + substance or structure of either the Original Code or any previous + Modifications. When Covered Code is released as a series of files, a + Modification is: + A. Any addition to or deletion from the contents of a file + containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or + previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code + which is described in the Source Code notice required by Exhibit A as + Original Code, and which, at the time of its release under this + License is not already Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or + hereafter acquired, including without limitation, method, process, + and apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for + making modifications to it, including all modules it contains, plus + any associated interface definition files, scripts used to control + compilation and installation of an Executable, or source code + differential comparisons against either the Original Code or another + well known, available Covered Code of the Contributor's choice. The + Source Code can be in a compressed or archival form, provided the + appropriate decompression or de-archiving software is widely available + for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity + exercising rights under, and complying with all of the terms of, this + License or a future version of this License issued under Section 6.1. + For legal entities, "You" includes any entity which controls, is + controlled by, or is under common control with You. For purposes of + this definition, "control" means (a) the power, direct or indirect, + to cause the direction or management of such entity, whether by + contract or otherwise, or (b) ownership of more than fifty percent + (50%) of the outstanding shares or beneficial ownership of such + entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, + non-exclusive license, subject to third party intellectual property + claims: + (a) under intellectual property rights (other than patent or + trademark) Licensable by Initial Developer to use, reproduce, + modify, display, perform, sublicense and distribute the Original + Code (or portions thereof) with or without Modifications, and/or + as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or + selling of Original Code, to make, have made, use, practice, + sell, and offer for sale, and/or otherwise dispose of the + Original Code (or portions thereof). + + (c) the licenses granted in this Section 2.1(a) and (b) are + effective on the date Initial Developer first distributes + Original Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is + granted: 1) for code that You delete from the Original Code; 2) + separate from the Original Code; or 3) for infringements caused + by: i) the modification of the Original Code or ii) the + combination of the Original Code with other software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor + hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or + trademark) Licensable by Contributor, to use, reproduce, modify, + display, perform, sublicense and distribute the Modifications + created by such Contributor (or portions thereof) either on an + unmodified basis, with other Modifications, as Covered Code + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or + selling of Modifications made by that Contributor either alone + and/or in combination with its Contributor Version (or portions + of such combination), to make, use, sell, offer for sale, have + made, and/or otherwise dispose of: 1) Modifications made by that + Contributor (or portions thereof); and 2) the combination of + Modifications made by that Contributor with its Contributor + Version (or portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are + effective on the date Contributor first makes Commercial Use of + the Covered Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is + granted: 1) for any code that Contributor has deleted from the + Contributor Version; 2) separate from the Contributor Version; + 3) for infringements caused by: i) third party modifications of + Contributor Version or ii) the combination of Modifications made + by that Contributor with other software (except as part of the + Contributor Version) or other devices; or 4) under Patent Claims + infringed by Covered Code in the absence of Modifications made by + that Contributor. + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are + governed by the terms of this License, including without limitation + Section 2.2. The Source Code version of Covered Code may be + distributed only under the terms of this License or a future version + of this License released under Section 6.1, and You must include a + copy of this License with every copy of the Source Code You + distribute. You may not offer or impose any terms on any Source Code + version that alters or restricts the applicable version of this + License or the recipients' rights hereunder. However, You may include + an additional document offering the additional rights described in + Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be + made available in Source Code form under the terms of this License + either on the same media as an Executable version or via an accepted + Electronic Distribution Mechanism to anyone to whom you made an + Executable version available; and if made available via Electronic + Distribution Mechanism, must remain available for at least twelve (12) + months after the date it initially became available, or at least six + (6) months after a subsequent version of that particular Modification + has been made available to such recipients. You are responsible for + ensuring that the Source Code version remains available even if the + Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a + file documenting the changes You made to create that Covered Code and + the date of any change. You must include a prominent statement that + the Modification is derived, directly or indirectly, from Original + Code provided by the Initial Developer and including the name of the + Initial Developer in (a) the Source Code, and (b) in any notice in an + Executable version or related documentation in which You describe the + origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's + intellectual property rights is required to exercise the rights + granted by such Contributor under Sections 2.1 or 2.2, + Contributor must include a text file with the Source Code + distribution titled "LEGAL" which describes the claim and the + party making the claim in sufficient detail that a recipient will + know whom to contact. If Contributor obtains such knowledge after + the Modification is made available as described in Section 3.2, + Contributor shall promptly modify the LEGAL file in all copies + Contributor makes available thereafter and shall take other steps + (such as notifying appropriate mailing lists or newsgroups) + reasonably calculated to inform those who received the Covered + Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming + interface and Contributor has knowledge of patent licenses which + are reasonably necessary to implement that API, Contributor must + also include this information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to + Section 3.4(a) above, Contributor believes that Contributor's + Modifications are Contributor's original creation(s) and/or + Contributor has sufficient rights to grant the rights conveyed by + this License. + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source + Code. If it is not possible to put such notice in a particular Source + Code file due to its structure, then You must include such notice in a + location (such as a relevant directory) where a user would be likely + to look for such a notice. If You created one or more Modification(s) + You may add your name as a Contributor to the notice described in + Exhibit A. You must also duplicate this License in any documentation + for the Source Code where You describe recipients' rights or ownership + rights relating to Covered Code. You may choose to offer, and to + charge a fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Code. However, You + may do so only on Your own behalf, and not on behalf of the Initial + Developer or any Contributor. You must make it absolutely clear than + any such warranty, support, indemnity or liability obligation is + offered by You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred by the + Initial Developer or such Contributor as a result of warranty, + support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the + requirements of Section 3.1-3.5 have been met for that Covered Code, + and if You include a notice stating that the Source Code version of + the Covered Code is available under the terms of this License, + including a description of how and where You have fulfilled the + obligations of Section 3.2. The notice must be conspicuously included + in any notice in an Executable version, related documentation or + collateral in which You describe recipients' rights relating to the + Covered Code. You may distribute the Executable version of Covered + Code or ownership rights under a license of Your choice, which may + contain terms different from this License, provided that You are in + compliance with the terms of this License and that the license for the + Executable version does not attempt to limit or alter the recipient's + rights in the Source Code version from the rights set forth in this + License. If You distribute the Executable version under a different + license You must make it absolutely clear that any terms which differ + from this License are offered by You alone, not by the Initial + Developer or any Contributor. You hereby agree to indemnify the + Initial Developer and every Contributor for any liability incurred by + the Initial Developer or such Contributor as a result of any such + terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code + not governed by the terms of this License and distribute the Larger + Work as a single product. In such a case, You must make sure the + requirements of this License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this + License with respect to some or all of the Covered Code due to + statute, judicial order, or regulation then You must: (a) comply with + the terms of this License to the maximum extent possible; and (b) + describe the limitations and the code they affect. Such description + must be included in the LEGAL file described in Section 3.4 and must + be included with all distributions of the Source Code. Except to the + extent prohibited by statute or regulation, such description must be + sufficiently detailed for a recipient of ordinary skill to be able to + understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has + attached the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised + and/or new versions of the License from time to time. Each version + will be given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the + License, You may always continue to use it under the terms of that + version. You may also choose to use such Covered Code under the terms + of any subsequent version of the License published by Netscape. No one + other than Netscape has the right to modify the terms applicable to + Covered Code created under this License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may + only do in order to apply it to code which is not already Covered Code + governed by this License), You must (a) rename Your license so that + the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", + "MPL", "NPL" or any confusingly similar phrase do not appear in your + license (except to note that your license differs from this License) + and (b) otherwise make it clear that Your version of the license + contains terms which differ from the Mozilla Public License and + Netscape Public License. (Filling in the name of the Initial + Developer, Original Code or Contributor in the notice described in + Exhibit A shall not of themselves be deemed to be modifications of + this License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF + DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. + THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE + IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, + YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE + COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER + OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate + automatically if You fail to comply with terms herein and fail to cure + such breach within 30 days of becoming aware of the breach. All + sublicenses to the Covered Code which are properly granted shall + survive any termination of this License. Provisions which, by their + nature, must remain in effect beyond the termination of this License + shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement + claim (excluding declatory judgment actions) against Initial Developer + or a Contributor (the Initial Developer or Contributor against whom + You file such action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly + infringes any patent, then any and all rights granted by such + Participant to You under Sections 2.1 and/or 2.2 of this License + shall, upon 60 days notice from Participant terminate prospectively, + unless if within 60 days after receipt of notice You either: (i) + agree in writing to pay Participant a mutually agreeable reasonable + royalty for Your past and future use of Modifications made by such + Participant, or (ii) withdraw Your litigation claim with respect to + the Contributor Version against such Participant. If within 60 days + of notice, a reasonable royalty and payment arrangement are not + mutually agreed upon in writing by the parties or the litigation claim + is not withdrawn, the rights granted by Participant to You under + Sections 2.1 and/or 2.2 automatically terminate at the expiration of + the 60 day notice period specified above. + + (b) any software, hardware, or device, other than such Participant's + Contributor Version, directly or indirectly infringes any patent, then + any rights granted to You by such Participant under Sections 2.1(b) + and 2.2(b) are revoked effective as of the date You first made, used, + sold, distributed, or had made, Modifications made by that + Participant. + + 8.3. If You assert a patent infringement claim against Participant + alleging that such Participant's Contributor Version directly or + indirectly infringes any patent where such claim is resolved (such as + by license or settlement) prior to the initiation of patent + infringement litigation, then the reasonable value of the licenses + granted by such Participant under Sections 2.1 or 2.2 shall be taken + into account in determining the amount or value of any payment or + license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, + all end user license agreements (excluding distributors and resellers) + which have been validly granted by You or any distributor hereunder + prior to termination shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL + DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, + OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR + ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY + CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, + WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY + RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW + PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE + EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO + THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in + 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer + software" and "commercial computer software documentation," as such + terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 + C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), + all U.S. Government End Users acquire Covered Code with only those + rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the extent + necessary to make it enforceable. This License shall be governed by + California law provisions (except to the extent applicable law, if + any, provides otherwise), excluding its conflict-of-law provisions. + With respect to disputes in which at least one party is a citizen of, + or an entity chartered or registered to do business in the United + States of America, any litigation relating to this License shall be + subject to the jurisdiction of the Federal Courts of the Northern + District of California, with venue lying in Santa Clara County, + California, with the losing party responsible for costs, including + without limitation, court costs and reasonable attorneys' fees and + expenses. The application of the United Nations Convention on + Contracts for the International Sale of Goods is expressly excluded. + Any law or regulation which provides that the language of a contract + shall be construed against the drafter shall not apply to this + License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or indirectly, + out of its utilization of rights under this License and You agree to + work with Initial Developer and Contributors to distribute such + responsibility on an equitable basis. Nothing herein is intended or + shall be deemed to constitute any admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as + "Multiple-Licensed". "Multiple-Licensed" means that the Initial + Developer permits you to utilize portions of the Covered Code under + Your choice of the NPL or the alternative licenses, if any, specified + by the Initial Developer in the file described in Exhibit A. + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. + Portions created by ______________________ are Copyright (C) ______ + _______________________. All Rights Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms + of the _____ license (the "[___] License"), in which case the + provisions of [______] License are applicable instead of those + above. If you wish to allow use of your version of this file only + under the terms of the [____] License and not to allow others to use + your version of this file under the MPL, indicate your decision by + deleting the provisions above and replace them with the notice and + other provisions required by the [___] License. If you do not delete + the provisions above, a recipient may use your version of this file + under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of + the notices in the Source Code files of the Original Code. You should + use the text of this Exhibit A rather than the text found in the + Original Code Source Code for Your Modifications.] + +