Mercurial > public > hwos_code
comparison src/menu_processor.asm @ 640:8c1f1f334275
3.13 release
| author | heinrichsweikamp |
|---|---|
| date | Thu, 29 Oct 2020 09:29:15 +0100 |
| parents | 4050675965ea |
| children | 7d8a4c60ec1a |
comparison
equal
deleted
inserted
replaced
| 639:0ff82370991d | 640:8c1f1f334275 |
|---|---|
| 1 ;============================================================================= | 1 ;============================================================================= |
| 2 ; | 2 ; |
| 3 ; File menu_processor.asm * combined next generation V3.09.5 | 3 ; File menu_processor.asm * combined next generation V3.12.1 |
| 4 ; | 4 ; |
| 5 ; Routines to handle all hwOS graphic/text menus. | 5 ; Routines to handle all hwOS graphic/text menus. |
| 6 ; | 6 ; |
| 7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. | 7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. |
| 8 ;============================================================================= | 8 ;============================================================================= |
| 67 clrf STKPTR ; never return from here | 67 clrf STKPTR ; never return from here |
| 68 | 68 |
| 69 VARARGS_GET8 menu_item_count ; get number of items | 69 VARARGS_GET8 menu_item_count ; get number of items |
| 70 VARARGS_GET8 menu_vertical_start ; get vertical start position of 1st menu item | 70 VARARGS_GET8 menu_vertical_start ; get vertical start position of 1st menu item |
| 71 | 71 |
| 72 movf menu_vertical_start,W ; excite flags | 72 movf menu_vertical_start,W ; excite flags, vertical start = 0, i.e. no menu title text? |
| 73 bz menu_processor_no_title ; no menu title text -> skip reading menu title text address | 73 bz menu_processor_no_title ; YES - skip reading menu title text address |
| 74 | 74 |
| 75 VARARGS_GET16 menu_title_addr ; get address of menu title text | 75 VARARGS_GET16 menu_title_addr ; get address of menu title text |
| 76 | 76 |
| 77 menu_processor_no_title: | 77 menu_processor_no_title: |
| 78 | 78 |
| 79 movff TBLPTRL, menu_item_data_start+0 ; store base address for menu_read_menu_item_data | 79 movff TBLPTRL, menu_item_data_start+0 ; store base address of menu items for menu_read_menu_item_data |
| 80 movff TBLPTRH, menu_item_data_start+1 ; ... | 80 movff TBLPTRH, menu_item_data_start+1 ; ... |
| 81 movff TBLPTRU, menu_item_data_start+2 ; ... | 81 movff TBLPTRU, menu_item_data_start+2 ; ... |
| 82 | 82 |
| 83 btfss divemode ; in dive mode? | 83 btfss divemode ; in dive mode? |
| 84 bra menu_processor_menu_title ; NO - no frame in surface mode menu | 84 bra menu_processor_menu_title ; NO - no frame in surface mode menu |
| 93 WIN_FRAME_COLOR dm_menu_row, dm_menu_lower, dm_menu_left ,dm_menu_right ; top, bottom, left, right | 93 WIN_FRAME_COLOR dm_menu_row, dm_menu_lower, dm_menu_left ,dm_menu_right ; top, bottom, left, right |
| 94 bra menu_processor_menu_body ; the dive mode menu has no menu title and footer | 94 bra menu_processor_menu_body ; the dive mode menu has no menu title and footer |
| 95 | 95 |
| 96 menu_processor_menu_title: | 96 menu_processor_menu_title: |
| 97 ; prepare screen | 97 ; prepare screen |
| 98 btfsc screen_type3 ; screen type 3 ? | |
| 99 bra menu_processor_menu_title1 ; YES - screen type 3 has no backlight | |
| 98 clrf CCP1CON ; stop PWM | 100 clrf CCP1CON ; stop PWM |
| 99 bcf PORTC,2 ; fade out backlight | 101 bcf PORTC,2 ; fade out backlight |
| 102 menu_processor_menu_title1: | |
| 100 call TFT_ClearScreen ; clear screen | 103 call TFT_ClearScreen ; clear screen |
| 101 | 104 |
| 102 ; draw menu title | 105 ; draw menu title |
| 103 WIN_BOX_BLACK .2,.23,.0,.159 ; clear menu title area | 106 WIN_BOX_BLACK .2,.23,.0,.159 ; clear menu title area |
| 104 WIN_STD .0, .2 ; set menu title font and position | 107 WIN_STD .0, .2 ; set menu title font and position |
| 250 movf selected_item,W ; get cursor position into WREG | 253 movf selected_item,W ; get cursor position into WREG |
| 251 rcall menu_read_menu_item_data ; read menu item data | 254 rcall menu_read_menu_item_data ; read menu item data |
| 252 movf item_funct_addr+0,W ; check if execute function call address is NULL | 255 movf item_funct_addr+0,W ; check if execute function call address is NULL |
| 253 iorwf item_funct_addr+1,W ; ... | 256 iorwf item_funct_addr+1,W ; ... |
| 254 bz next_line_menu ; YES - not selectable, step cursor to next menu item | 257 bz next_line_menu ; YES - not selectable, step cursor to next menu item |
| 255 btfss divemode ; NO - in dive mode? | 258 btfsc divemode ; NO - in dive mode? |
| 259 bra menu_line_loop_pre1 ; YES - skip next | |
| 256 rcall menu_draw_cursor_surf ; NO - draw the cursor (main menu style) | 260 rcall menu_draw_cursor_surf ; NO - draw the cursor (main menu style) |
| 257 btfss imprint_time_date ; - currently imprinting the current time & date? | 261 btfss imprint_time_date ; - currently imprinting the current time & date? |
| 258 bra menu_line_loop_pre1 ; NO - skip | |
| 259 btfss switch_right ; YES - right button pressed, i.e. time or date changed? | |
| 260 bra menu_line_loop_pre1 ; NO - skip | 262 bra menu_line_loop_pre1 ; NO - skip |
| 261 call TFT_imprint_time_date_fast ; YES - show a fast response on the screen (may momentarily show an illegal day/month combination) | 263 btfss switch_right ; YES - right button pressed, i.e. time or date changed? |
| 262 call rtc_set_rtc ; - update time and date on RTC module (corrects illegal day/month combinations) | 264 bra menu_line_loop_pre1 ; NO - skip |
| 265 call TFT_imprint_time_date_fast ; YES - show a fast response on the screen (may momentarily show an illegal day/month combination) | |
| 266 call rtc_set_rtc ; - update time and date on RTC module (corrects illegal day/month combinations) | |
| 263 | 267 |
| 264 menu_line_loop_pre1: | 268 menu_line_loop_pre1: |
| 265 bcf switch_right ; clear left-over right button event | 269 bcf switch_right ; clear left-over right button event |
| 266 bcf switch_left ; clear left-over left button event | 270 bcf switch_left ; clear left-over left button event |
| 267 | 271 |
| 268 menu_line_loop_pre2: | 272 menu_line_loop_pre2: |
| 269 btfsc divemode ; in dive mode? | 273 btfsc divemode ; in dive mode? |
| 270 goto divemode_option_divemenu_return ; YES - return to it | 274 goto divemode_option_divemenu_return ; YES - return to it |
| 271 call reset_timeout_surfmode ; NO - reset timeout | 275 call reset_timeout_surfmode ; NO - reset timeout |
| 276 ;bra menu_line_loop ; - operate menu HMI | |
| 272 | 277 |
| 273 menu_line_loop: | 278 menu_line_loop: |
| 274 call housekeeping ; - handle data imprinting, screen dump request, timeout and entering dive mode | 279 call housekeeping ; handle data imprinting, screen dump request, timeout and entering dive mode |
| 275 btfsc switch_right ; - right button pressed? | 280 btfsc switch_right ; right button pressed? |
| 276 bra do_line_menu ; YES - execute menu item function | 281 bra do_line_menu ; YES - execute menu item function |
| 277 btfss switch_left ; NO - left button pressed? | 282 btfss switch_left ; NO - left button pressed? |
| 278 bra menu_line_loop ; NO - loop | 283 bra menu_line_loop ; NO - loop |
| 279 next_line_menu: ; YES - step cursor to next menu item | 284 next_line_menu: ; YES - step cursor to next menu item |
| 280 bcf switch_left ; - clear button event | 285 bcf switch_left ; - clear button event |
| 281 incf selected_item,F ; - increment cursor position to next item | 286 incf selected_item,F ; - increment cursor position to next item |
| 282 movf selected_item,W ; - copy new item number to WREG | 287 movf selected_item,W ; - copy new item number to WREG |
| 283 cpfseq menu_item_count ; - new item number beyond number of menu items? | 288 cpfseq menu_item_count ; - new item number beyond number of menu items? |
| 284 bra menu_vertical_loop ; NO - redraw cursor | 289 bra menu_vertical_loop ; NO - redraw cursor |
| 285 clrf selected_item ; YES - reset cursor position to first item | 290 clrf selected_item ; YES - reset cursor position to first item |
| 286 bra menu_vertical_loop ; - redraw cursor | 291 bra menu_vertical_loop ; - redraw cursor |
| 287 | 292 |
| 288 | 293 |
| 289 ;----------------------------------------------------------------------------- | 294 ;----------------------------------------------------------------------------- |
| 290 ; Execute Menu Item Function | 295 ; Execute Menu Item Function |
| 291 ; | 296 ; |
| 332 bra menu_draw_lines_surfmode ; NO | 337 bra menu_draw_lines_surfmode ; NO |
| 333 ;bra menu_draw_lines_divemode ; YES | 338 ;bra menu_draw_lines_divemode ; YES |
| 334 | 339 |
| 335 global menu_draw_lines_divemode | 340 global menu_draw_lines_divemode |
| 336 menu_draw_lines_divemode: | 341 menu_draw_lines_divemode: |
| 337 movlw dm_menu_item1_row ; get row position for 1st item | 342 movff menu_item_count,menu_pos_max ; copy number of item in menu block to menu_pos_max (used by divemode instead of menu_item_count for no reason) |
| 338 movwf win_top ; set vertical output position | 343 |
| 339 movlw dm_menu_item1_column ; get column position for 1st item | 344 IFDEF _big_divemenu |
| 340 movwf win_leftx2 ; set horizontal output position | 345 |
| 346 btfss alt_layout_active ; big menu selected? | |
| 347 bra menu_draw_lines_divemode_small ; NO | |
| 348 ;bra menu_draw_lines_divemode_big ; YES | |
| 349 | |
| 350 menu_draw_lines_divemode_big: | |
| 351 WIN_STD dm_menu_item1_column+.16,dm_menu_item1_row+.22 | |
| 352 decf menu_pos_cur,W ; get selected item as 0..5 into WREG | |
| 353 movwf menu_item_start ; set first item to draw = selected item | |
| 354 bra menu_draw_menu_items_common ; continue with common part | |
| 355 | |
| 356 ENDIF ; _big_divemenu | |
| 357 | |
| 358 menu_draw_lines_divemode_small: | |
| 359 WIN_SMALL dm_menu_item1_column,dm_menu_item1_row | |
| 341 clrf menu_item_start ; set first item in menu block as first item to draw | 360 clrf menu_item_start ; set first item in menu block as first item to draw |
| 342 movff menu_item_count,menu_pos_max ; copy number of item in menu block to menu_pos_max | |
| 343 bra menu_draw_menu_items_common ; continue with common part | 361 bra menu_draw_menu_items_common ; continue with common part |
| 344 | 362 |
| 345 menu_draw_lines_surfmode: | 363 menu_draw_lines_surfmode: |
| 346 WIN_SMALL MENU_LEFT, 0 ; initialize start position and font | 364 WIN_SMALL MENU_LEFT, 0 ; initialize start position and font |
| 347 movff menu_vertical_start,win_top ; set vertical output position | 365 movff menu_vertical_start,win_top ; set vertical output position |
| 349 | 367 |
| 350 IFDEF scrolling_menu_enabled | 368 IFDEF scrolling_menu_enabled |
| 351 ; does the menu have more than 7 item ? | 369 ; does the menu have more than 7 item ? |
| 352 movf menu_item_count,W ; get number of menu items | 370 movf menu_item_count,W ; get number of menu items |
| 353 addlw -(MENU_LINES_MAX+1) ; more than 7 item? | 371 addlw -(MENU_LINES_MAX+1) ; more than 7 item? |
| 354 bn menu_draw_menu_items_common ; NO - continue with common part | 372 bn menu_draw_menu_items_common ; NO - continue with common part |
| 355 movf selected_item,W ; YES - compute first item to be drawn as current cursor position - 6 | 373 movf selected_item,W ; YES - compute first item to be drawn as current cursor position - 6 |
| 356 addlw -(MENU_LINES_MAX-1) ; - ... | 374 addlw -(MENU_LINES_MAX-1) ; - ... |
| 357 btfsc STATUS,N ; - is this < 0 ? | 375 btfsc STATUS,N ; - is this < 0 ? |
| 358 clrf WREG ; YES - revert to starting from first item | 376 clrf WREG ; YES - revert to starting from first item |
| 359 movwf menu_item_start ; - set first item to be drawn | 377 movwf menu_item_start ; - set first item to be drawn |
| 360 ENDIF ; scrolling_menu_enabled | 378 ENDIF ; scrolling_menu_enabled |
| 361 | 379 |
| 362 menu_draw_menu_items_common: | 380 menu_draw_menu_items_common: |
| 363 movff menu_item_start,menu_item_curr ; initialize menu item counter | 381 movff menu_item_start,menu_item_curr ; initialize menu item counter |
| 364 FONT_SIZE FT_SMALL ; set font size | |
| 365 | 382 |
| 366 menu_draw_menu_items_loop: | 383 menu_draw_menu_items_loop: |
| 367 FONT_COLOR_MEMO ; set default font color (may be changed by dynamic titles) | 384 FONT_COLOR_MEMO ; set default font color (may had been changed by a dynamic title) |
| 385 REINIT_BUFFER ; initialize output buffer again | |
| 368 movf menu_item_curr,W ; get menu item to draw | 386 movf menu_item_curr,W ; get menu item to draw |
| 369 rcall menu_read_menu_item_data ; read menu item data | 387 rcall menu_read_menu_item_data ; read menu item data |
| 370 movf item_type,W ; switch on menu item type: | 388 movf item_type,W ; switch on menu item type: |
| 371 bz menu_draw_menu_item_dynamic ; -> 0: call with dynamic title | 389 bz menu_draw_menu_item_dynamic ; -> 0: call with dynamic title |
| 372 dcfsnz WREG ; | 390 dcfsnz WREG ; |
| 373 bra menu_draw_menu_item_call ; -> 1: call with fixed title | 391 bra menu_draw_menu_item_call ; -> 1: call with fixed title |
| 374 dcfsnz WREG ; | 392 dcfsnz WREG ; |
| 375 bra menu_draw_menu_item_option ; -> 2: option increment | 393 bra menu_draw_menu_item_option ; -> 2: option increment |
| 376 bra menu_draw_menu_item_print ; no output in case of illegal type | 394 bra menu_draw_menu_item_print ; no output in case of illegal type |
| 377 | 395 |
| 378 menu_draw_menu_item_dynamic: | 396 menu_draw_menu_item_dynamic: |
| 379 | |
| 380 movf item_title_addr+0,W ; check if call address is NULL | 397 movf item_title_addr+0,W ; check if call address is NULL |
| 381 iorwf item_title_addr+1,W ; ... | 398 iorwf item_title_addr+1,W ; ... |
| 382 btfsc STATUS,Z ; is null? | 399 btfsc STATUS,Z ; is null? |
| 383 bra menu_draw_menu_item_no_print ; YES - no printing on this menu line | 400 bra menu_draw_menu_item_after_print ; YES - no printing on this menu line |
| 384 INIT_BUFFER ; NO - initialize buffer | 401 movff menu_item_curr,PRODL ; NO - pass menu item position to call function |
| 385 movff menu_item_curr,PRODL ; - pass menu item position to call function | |
| 386 rcall menu_text_call ; - call dynamic title function | 402 rcall menu_text_call ; - call dynamic title function |
| 387 bra menu_draw_menu_item_print ; - print menu item | 403 bra menu_draw_menu_item_print ; - print menu item |
| 388 | 404 |
| 389 menu_draw_menu_item_call: | 405 menu_draw_menu_item_call: |
| 390 movff item_title_addr+0,FSR1L ; point to multi-lingual text | 406 movff item_title_addr+0,FSR1L ; point to multi-lingual text |
| 391 movff item_title_addr+1,FSR1H ; ... | 407 movff item_title_addr+1,FSR1H ; ... |
| 392 call strcpy_text_FSR ; copy translated text to buffer | 408 call strcat_text_FSR ; copy translated text to buffer |
| 393 bra menu_draw_menu_item_print ; print menu item | 409 bra menu_draw_menu_item_print ; print menu item |
| 394 | 410 |
| 395 menu_draw_menu_item_option: | 411 menu_draw_menu_item_option: |
| 396 movff item_title_addr+0,FSR1L ; point to multi-lingual text | 412 movff item_title_addr+0,FSR1L ; point to multi-lingual text |
| 397 movff item_title_addr+1,FSR1H ; ... | 413 movff item_title_addr+1,FSR1H ; ... |
| 398 call strcpy_text_FSR ; copy translated text to buffer | 414 call strcat_text_FSR ; copy translated text to buffer |
| 399 movff option_addr+0,FSR0L ; hand over address of option definition data | 415 movff option_addr+0,FSR0L ; hand over address of option definition data |
| 400 movff option_addr+1,FSR0H ; ... | 416 movff option_addr+1,FSR0H ; ... |
| 401 btfsc option_addr+1,6 ; is the selected option an option group member? | 417 btfsc option_addr+1,6 ; is the selected option an option group member? |
| 402 call option_adjust_group_member ; YES - adjust address to selected group member | 418 call option_adjust_group_member ; YES - adjust address to selected group member |
| 403 btfss block_option_value ; displaying of option value suspended? | 419 btfss block_option_value ; displaying of option value suspended? |
| 408 movlw MAX_LINE_LENGTH_SURF ; load maximum length for a surface menu item | 424 movlw MAX_LINE_LENGTH_SURF ; load maximum length for a surface menu item |
| 409 btfsc divemode ; in dive mode? | 425 btfsc divemode ; in dive mode? |
| 410 movlw MAX_LINE_LENGTH_DIVE ; YES - replace with maximum length for a dive mode menu item | 426 movlw MAX_LINE_LENGTH_DIVE ; YES - replace with maximum length for a dive mode menu item |
| 411 call TFT_buffer_trim_length ; fill up or cut buffer to max length | 427 call TFT_buffer_trim_length ; fill up or cut buffer to max length |
| 412 PRINT ; print menu item to screen | 428 PRINT ; print menu item to screen |
| 413 ;bra menu_draw_menu_item_no_print ; continue with after-print actions | 429 ;bra menu_draw_menu_item_after_print ; continue with after-print actions |
| 414 | 430 |
| 415 menu_draw_menu_item_no_print: | 431 menu_draw_menu_item_after_print: |
| 416 movlw MENU_HEIGHT_SURF ; get menu items vertical spacing for surface mode | |
| 417 btfsc divemode ; in dive mode? | |
| 418 movlw MENU_HEIGHT_DIVE ; YES - replace with vertical spacing for dive mode | |
| 419 | |
| 420 addwf win_top,F ; adjust vertical output position | |
| 421 incf menu_item_curr,F ; go to next menu item | |
| 422 | |
| 423 btfss divemode ; in dive mode? | 432 btfss divemode ; in dive mode? |
| 424 bra menu_draw_menu_item_surfmode ; NO | 433 bra menu_draw_menu_item_common ; NO |
| 425 ;bra menu_draw_menu_item_divemode ; YES | 434 ;bra menu_draw_menu_item_divemode ; YES |
| 426 | 435 |
| 427 menu_draw_menu_item_divemode: | 436 menu_draw_menu_item_divemode: |
| 428 movlw .3 ; load a 3 | 437 IFDEF _big_divemenu |
| 429 cpfseq menu_item_curr ; just done menu item 3 ? | 438 btfsc alt_layout_active ; big menu selected? |
| 439 return ; YES - done | |
| 440 ENDIF | |
| 441 | |
| 442 movlw .2 ; load a 2 | |
| 443 cpfseq menu_item_curr ; just done menu item 2 (last item in left column) ? | |
| 430 bra menu_draw_menu_item_common ; NO - continue with common part | 444 bra menu_draw_menu_item_common ; NO - continue with common part |
| 431 movlw dm_menu_item4_row ; YES - set vertical position for 2nd column | 445 movlw dm_menu_item4_row ; YES - set vertical position for 2nd column |
| 432 movff WREG,win_top ; - ... | 446 movff WREG,win_top ; - ... |
| 433 movlw dm_menu_item4_column ; - set horizontal position for 2nd column | 447 movlw dm_menu_item4_column ; - set horizontal position for 2nd column |
| 434 movff WREG,win_leftx2 ; - ... | 448 movff WREG,win_leftx2 ; - ... |
| 435 bra menu_draw_menu_item_common ; - continue with common part | 449 bra menu_draw_menu_item_common_1 ; - continue in common part |
| 436 | 450 |
| 437 menu_draw_menu_item_surfmode: | 451 menu_draw_menu_item_common: |
| 452 movlw MENU_HEIGHT_SURF ; get menu items vertical spacing for surface mode | |
| 453 btfsc divemode ; in dive mode? | |
| 454 movlw MENU_HEIGHT_DIVE ; YES - replace with vertical spacing for dive mode | |
| 455 addwf win_top,F ; adjust vertical output position | |
| 456 | |
| 457 menu_draw_menu_item_common_1: | |
| 458 incf menu_item_curr,F ; increment menu item number | |
| 459 | |
| 438 IFDEF scrolling_menu_enabled | 460 IFDEF scrolling_menu_enabled |
| 439 movf menu_item_start,W ; get the number of the menu item that menu drawing started with | 461 btfsc divemode ; in dive mode? |
| 440 subwf menu_item_curr,W ; compute how many item have been drawn already | 462 bra menu_draw_menu_item_common_2 ; YES - skip |
| 441 xorlw MENU_LINES_MAX ; compare with how max item fit the screen | 463 movf menu_item_start,W ; NO - get the number of the menu item that menu drawing started with |
| 442 btfsc STATUS,Z ; screen full? | 464 subwf menu_item_curr,W ; - compute how many item have been drawn already |
| 443 return ; YES - done | 465 xorlw MENU_LINES_MAX ; - compare with how max item fit the screen |
| 444 ;bra menu_draw_menu_item_common ; NO - continue with common part | 466 btfsc STATUS,Z ; - screen full? |
| 467 return ; - YES - done | |
| 468 ;bra menu_draw_menu_item_common_2 ; NO - continue | |
| 445 ENDIF ; scrolling_menu_enabled | 469 ENDIF ; scrolling_menu_enabled |
| 446 | 470 |
| 447 menu_draw_menu_item_common: | 471 menu_draw_menu_item_common_2: |
| 448 movf menu_item_curr,W ; get current menu item | 472 movf menu_item_curr,W ; get current menu item |
| 449 xorwf menu_item_count,W ; compare with total number of menu items, more item to do? | 473 xorwf menu_item_count,W ; compare with total number of menu items, more item to do? |
| 450 bnz menu_draw_menu_items_loop ; YES - loop | 474 bnz menu_draw_menu_items_loop ; YES - loop |
| 451 return ; NO - done | 475 return ; NO - done |
| 452 | 476 |
| 463 | 487 |
| 464 ;----------------------------------------------------------------------------- | 488 ;----------------------------------------------------------------------------- |
| 465 ; Draw the Cursor (Main Menu Style) | 489 ; Draw the Cursor (Main Menu Style) |
| 466 ; | 490 ; |
| 467 menu_draw_cursor_surf: | 491 menu_draw_cursor_surf: |
| 468 WIN_LEFT MENU_LEFT-8 ; set horizontal start of cursor column | 492 WIN_LEFT MENU_LEFT-8 ; set horizontal start of cursor column |
| 469 WIN_WIDTH .6 ; set width of cursor column | 493 WIN_WIDTH .6 ; set width of cursor column |
| 470 WIN_HEIGHT .223 ; set preliminary hight of cursor column | 494 WIN_HEIGHT .223 ; set preliminary hight of cursor column |
| 471 | 495 |
| 472 movf menu_vertical_start,W ; get vertical start of menu items | 496 movf menu_vertical_start,W ; get vertical start of menu items |
| 473 movwf win_top ; set vertical start of cursor column | 497 movwf win_top ; set vertical start of cursor column |
| 474 subwf win_height,F ; final hight = prelim.height - vertical start | 498 subwf win_height,F ; final hight = prelim.height - vertical start |
| 475 | 499 |
| 476 clrf WREG ; set color to black | 500 clrf WREG ; set color to black |
| 477 BOX_COLOR ; clear cursor area | 501 BOX_COLOR ; clear cursor area |
| 502 | |
| 503 FONT_SIZE FT_SMALL ; set font size | |
| 478 | 504 |
| 479 movf menu_item_start,W ; get number of menu item that is on the first line | 505 movf menu_item_start,W ; get number of menu item that is on the first line |
| 480 subwf selected_item,W ; compute line number of current menu item | 506 subwf selected_item,W ; compute line number of current menu item |
| 481 | 507 |
| 482 mullw MENU_HEIGHT_SURF ; multiply line number with vertical menu items spacing | 508 mullw MENU_HEIGHT_SURF ; multiply line number with vertical menu items spacing |
| 483 movf PRODL,W ; get computed vertical offset | 509 movf PRODL,W ; get computed vertical offset |
| 484 addwf menu_vertical_start,W ; add offset to vertical start position | 510 addwf menu_vertical_start,W ; add offset to vertical start position |
| 485 movwf win_top ; set final vertical position | 511 movwf win_top ; set final vertical position |
| 486 bra menu_draw_cursor_common ; print cursor and return | 512 bra menu_draw_cursor_common ; print cursor |
| 487 | 513 |
| 488 | 514 |
| 489 ;----------------------------------------------------------------------------- | 515 ;----------------------------------------------------------------------------- |
| 490 ; Draw the Cursor (Dive Mode Style) | 516 ; Draw the Cursor (Dive Mode Style) |
| 491 ; | 517 ; |
| 492 global menu_draw_cursor_dive | 518 global menu_draw_cursor_dive |
| 493 menu_draw_cursor_dive: | 519 menu_draw_cursor_dive: |
| 520 IFDEF _big_divemenu | |
| 521 btfss alt_layout_active ; big menu selected? | |
| 522 bra menu_draw_cursor_dive_small ; NO | |
| 523 ;bra menu_draw_cursor_dive_big ; YES | |
| 524 | |
| 525 menu_draw_cursor_dive_big: | |
| 526 WIN_STD dm_menu_item1_column,dm_menu_item1_row+.20 | |
| 527 bra menu_draw_cursor_common ; print cursor | |
| 528 ENDIF ; _big_divemenu | |
| 529 | |
| 530 menu_draw_cursor_dive_small: | |
| 494 ; clear cursor areas | 531 ; clear cursor areas |
| 495 WIN_BOX_BLACK dm_menu_row+.1, dm_menu_lower-.1, dm_menu_item1_column-.8, dm_menu_item1_column-.1 | 532 WIN_BOX_BLACK dm_menu_row+.1, dm_menu_lower-.1, dm_menu_item1_column-.8, dm_menu_item1_column-.1 |
| 496 WIN_BOX_BLACK dm_menu_row+.1, dm_menu_lower-.1, dm_menu_item4_column-.8, dm_menu_item4_column-.1 | 533 WIN_BOX_BLACK dm_menu_row+.1, dm_menu_lower-.1, dm_menu_item4_column-.8, dm_menu_item4_column-.1 |
| 534 | |
| 535 FONT_SIZE FT_SMALL ; set font size | |
| 497 | 536 |
| 498 movlw dm_menu_item1_column-.8 ; load position of left column | 537 movlw dm_menu_item1_column-.8 ; load position of left column |
| 499 btfsc menu_pos_cur,2 ; cursor at menu item 4..6 ? | 538 btfsc menu_pos_cur,2 ; cursor at menu item 4..6 ? |
| 500 movlw dm_menu_item4_column-.8 ; YES - replace with position of right column | 539 movlw dm_menu_item4_column-.8 ; YES - replace with position of right column |
| 501 movwf win_leftx2 ; set horizontal position | 540 movwf win_leftx2 ; set horizontal position |
| 502 | 541 |
| 503 decf menu_pos_cur,W ; get cursor position as 0..5 into WREG | 542 decf menu_pos_cur,W ; get cursor position as 0..5 into WREG |
| 504 btfsc menu_pos_cur,2 ; cursor at menu item 4..6 ? | 543 btfsc menu_pos_cur,2 ; cursor at menu item 4..6 ? |
| 505 addlw -.3 ; YES - subtract 3 to get line number in right column | 544 addlw -.3 ; YES - subtract 3 to get line number in right column |
| 506 | 545 |
| 507 mullw MENU_HEIGHT_DIVE ; multiply line number with vertical menu items spacing | 546 mullw MENU_HEIGHT_DIVE ; multiply line number (0..2) with vertical menu items spacing |
| 508 movf PRODL,W ; get computed vertical offset | 547 movf PRODL,W ; get computed vertical offset |
| 509 addlw dm_menu_item1_row ; add offset to vertical start position | 548 addlw dm_menu_item1_row ; add offset to vertical start position |
| 510 movwf win_top ; set final vertical position | 549 movwf win_top ; set final vertical position |
| 511 ;bra menu_draw_cursor_common ; print cursor and return | 550 ;bra menu_draw_cursor_common ; print cursor |
| 512 | 551 |
| 513 | 552 |
| 514 ;----------------------------------------------------------------------------- | 553 ;----------------------------------------------------------------------------- |
| 515 ; Helper Function - common Part of drawing the Cursor | 554 ; Helper Function - common Part of drawing the Cursor |
| 516 ; | 555 ; |
| 517 menu_draw_cursor_common: | 556 menu_draw_cursor_common: |
| 518 FONT_COLOR_MEMO ; set font color | 557 FONT_COLOR_MEMO ; set font color (may have changed in-between) |
| 519 FONT_SIZE FT_SMALL ; set font size | |
| 520 STRCPY_PRINT "\xb7" ; print cursor | 558 STRCPY_PRINT "\xb7" ; print cursor |
| 521 return ; done | 559 return ; done |
| 522 | 560 |
| 523 ;----------------------------------------------------------------------------- | 561 ;----------------------------------------------------------------------------- |
| 524 | 562 |
