From d8a871b0adf773f9543cdfaf454a8a39453eba16 Mon Sep 17 00:00:00 2001 From: jonnosan Date: Sun, 1 Feb 2009 10:11:21 +0000 Subject: [PATCH] menu now works with more than 128 items, also more efficient use of memory, and ability to jump to a particular letter git-svn-id: http://svn.code.sf.net/p/netboot65/code@36 93682198-c243-4bdb-bd91-e943c89aac3b --- client/inc/menu.i | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/client/inc/menu.i b/client/inc/menu.i index 9b00946..835b307 100644 --- a/client/inc/menu.i +++ b/client/inc/menu.i @@ -10,6 +10,7 @@ first_option_this_page: .res 2 options_shown_this_page: .res 1 options_table_pointer: .res 2 jump_to_prefix: .res 1 +last_page_flag: .res 1 .code @@ -98,7 +99,8 @@ select_option_from_menu: sta current_option lda first_option_this_page+1 sta current_option+1 - + lda #0 + sta last_page_flag jsr @move_to_current_option @@ -168,6 +170,7 @@ select_option_from_menu: lda current_option+1 cmp number_of_options+1 bne :+ + inc last_page_flag jmp @print_instructions_and_get_keypress : inc options_shown_this_page @@ -266,25 +269,17 @@ select_option_from_menu: @forward_one_page: clc + lda last_page_flag + beq :+ +@back_to_first_page: + jmp @display_first_page_of_options +: lda first_option_this_page adc #OPTIONS_PER_PAGE sta first_option_this_page bcc :+ inc first_option_this_page+1 : - lda first_option_this_page+1 - cmp number_of_options+1 - beq :+ - bcc @back_to_first_page - bcs @not_last_page_of_options -: - lda first_option_this_page - cmp number_of_options - bcc @not_last_page_of_options - -@back_to_first_page: - jmp @display_first_page_of_options -@not_last_page_of_options: jmp @print_current_page