diff --git a/client/drivers/a2input.s b/client/drivers/a2input.s index 5ccdcae..030f1b1 100644 --- a/client/drivers/a2input.s +++ b/client/drivers/a2input.s @@ -1,8 +1,22 @@ .export get_key - +.export check_for_abort_key .code ;use Apple 2 monitor ROM function to read from keyboard ;inputs: none ;outputs: A contains ASCII code of key pressed get_key: - jmp $fd1b \ No newline at end of file + jmp $fd1b + + +;check whether the escape key is being pressed +;inputs: none +;outputs: sec if escape pressed, clear otherwise +check_for_abort_key: +lda $c000 ;current key pressed +cmp #$9B +bne :+ +sec +rts +: +clc +rts diff --git a/client/drivers/c64inputs.s b/client/drivers/c64inputs.s index e24eb6a..4a864e0 100644 --- a/client/drivers/c64inputs.s +++ b/client/drivers/c64inputs.s @@ -3,6 +3,8 @@ .export filter_text .export filter_ip .export filter_dns +.export check_for_abort_key + .importzp copy_src .include "../inc/common.i" @@ -18,6 +20,18 @@ get_key: beq get_key rts +;check whether the RUN/STOP key is being pressed +;inputs: none +;outputs: sec if RUN/STOP pressed, clear otherwise +check_for_abort_key: +lda $cb ;current key pressed +cmp #$3F +bne :+ +sec +rts +: +clc +rts ;cribbed from http://codebase64.org/doku.php?id=base:robust_string_input ;====================================================================== diff --git a/client/inc/nb65_constants.i b/client/inc/nb65_constants.i index f5c372c..b87b924 100644 --- a/client/inc/nb65_constants.i +++ b/client/inc/nb65_constants.i @@ -80,5 +80,6 @@ NB65_ERROR_TRANSMIT_FAILED EQU $82 NB65_ERROR_TRANSMISSION_REJECTED_BY_PEER EQU $83 NB65_ERROR_INPUT_TOO_LARGE EQU $84 NB65_ERROR_DEVICE_FAILURE EQU $85 +NB65_ERROR_ABORTED_BY_USER EQU $86 NB65_ERROR_OPTION_NOT_SUPPORTED EQU $FE NB65_ERROR_FUNCTION_NOT_SUPPORTED EQU $FF diff --git a/client/ip65/dhcp.s b/client/ip65/dhcp.s index b7887ae..a20c31c 100644 --- a/client/ip65/dhcp.s +++ b/client/ip65/dhcp.s @@ -46,7 +46,7 @@ MAX_DHCP_MESSAGES_SENT=12 ;timeout after sending 12 messages will be about 1 .import udp_send_src_port .import udp_send_dest_port .import udp_send_len - + .import check_for_abort_key .import timer_read .bss @@ -157,6 +157,12 @@ dhcp_init: @inner_delay_loop: jsr ip65_process + jsr check_for_abort_key + bcc @no_abort + lda #NB65_ERROR_ABORTED_BY_USER + sta ip65_error + rts +@no_abort: lda #0 cmp dhcp_break_polling_loop bne @break_polling_loop diff --git a/client/ip65/dns.s b/client/ip65/dns.s index a231877..7d22a74 100644 --- a/client/ip65/dns.s +++ b/client/ip65/dns.s @@ -34,7 +34,7 @@ .import udp_send_src_port .import udp_send_dest_port .import udp_send_len - + .import check_for_abort_key .import timer_read .segment "IP65ZP" : zeropage @@ -219,6 +219,13 @@ dns_resolve: @inner_delay_loop: jsr ip65_process + jsr check_for_abort_key + bcc @no_abort + lda #NB65_ERROR_ABORTED_BY_USER + sta ip65_error + rts +@no_abort: + lda dns_state cmp #dns_complete beq @complete diff --git a/client/nb65/nb65_c64.s b/client/nb65/nb65_c64.s index 08a700e..bf92373 100644 --- a/client/nb65/nb65_c64.s +++ b/client/nb65/nb65_c64.s @@ -182,7 +182,6 @@ main_menu: cmp #KEYCODE_F7 beq @change_config - jsr print_hex jmp @get_key @exit_to_basic: diff --git a/doc/nb65_api_technical_reference.doc b/doc/nb65_api_technical_reference.doc index 06b739a..695f8bf 100644 Binary files a/doc/nb65_api_technical_reference.doc and b/doc/nb65_api_technical_reference.doc differ