comparison code_part1/OSTC_code_asm_part1/menu_custom.asm @ 84:0f4c175ef824

FIX flickering in new CF menus
author JeanDo
date Wed, 08 Dec 2010 02:03:11 +0100
parents 3e351e25f5d1
children b40a0a6284da
comparison
equal deleted inserted replaced
83:3e351e25f5d1 84:0f4c175ef824
161 161
162 menu_custom_functions11: 162 menu_custom_functions11:
163 WIN_INVERT .0 ; Init new Wordprocessor 163 WIN_INVERT .0 ; Init new Wordprocessor
164 164
165 menu_custom_functions1: 165 menu_custom_functions1:
166
167 #ifndef NO_CF_TYPES
168 ;---- Clear color swatches area ------------------------------------------
169 ; BEWARE: PLED_box reset the EEADRH register, so t should be
170 ; be done before setting CF page I/II...
171 clrf WREG ; Black background
172 movff WREG,box_temp+0 ; Set color
173 movlw .125
174 movff WREG,box_temp+1 ; row top (0-239)
175 movlw .178
176 movff WREG,box_temp+2 ; row bottom (0-239)
177 movlw .75
178 movff WREG,box_temp+3 ; column left (0-159)
179 movlw .150
180 movff WREG,box_temp+4 ; column right (0-159)
181 call PLED_box
182 #endif
183 call PLED_standard_color 166 call PLED_standard_color
184 167
185 movlw d'1' 168 movlw d'1'
186 btfss customfunction_page ; Use Page II... 169 btfss customfunction_page ; Use Page II...
187 movlw d'0' 170 movlw d'0'
260 setf apnoe_mins ; Yes, set apnoe_mins to 0xFF 243 setf apnoe_mins ; Yes, set apnoe_mins to 0xFF
261 244
262 WIN_LEFT .20 245 WIN_LEFT .20
263 WIN_TOP .65 246 WIN_TOP .65
264 lfsr FSR2,letter ; Make a string of 8 spaces 247 lfsr FSR2,letter ; Make a string of 8 spaces
265 movlw ' ' 248 call cf_fill_line
266 movwf POSTINC2
267 movwf POSTINC2
268 movwf POSTINC2
269 movwf POSTINC2
270 movwf POSTINC2
271 movwf POSTINC2
272 movwf POSTINC2
273 movwf POSTINC2
274 call word_processor ; Clear +/- line 249 call word_processor ; Clear +/- line
275 250
276 WIN_TOP .95 251 WIN_TOP .95
277 call word_processor ; Clear 1/10 line 252 call word_processor ; Clear 1/10 line
253
278 bra menu_custom_functions10b 254 bra menu_custom_functions10b
279 255
280 menu_custom_functions10a: 256 menu_custom_functions10a:
281 clrf apnoe_mins ; Yes, clear apnoe_mins 257 clrf apnoe_mins ; Yes, clear apnoe_mins
282 258
391 367
392 bra customfunctions_loop 368 bra customfunctions_loop
393 369
394 customfunctions2: 370 customfunctions2:
395 incf menupos,F 371 incf menupos,F
372 btfss apnoe_mins,0 ; Are we editing a boolean value ?
373 bra customfunctions2a ; NO : don't skip lines 2/3.
374
375 movlw d'4' ; Just after increment,
376 cpfsgt menupos ; Is current position < 4 ?
377 movwf menupos ; NO: skip set to 4.
378
379 customfunctions2a:
396 movlw d'7' 380 movlw d'7'
397 cpfseq menupos ; =7? 381 cpfseq menupos ; =7?
398 bra customfunctions3 ; No 382 bra customfunctions3 ; No
399 movlw d'1' 383 movlw d'1'
400 movwf menupos 384 movwf menupos
442 426
443 cf_type_01: ; Type == 1 is percent mode 427 cf_type_01: ; Type == 1 is percent mode
444 output_16dp 0 ; NOTE : hi is already reseted... 428 output_16dp 0 ; NOTE : hi is already reseted...
445 movlw '%' 429 movlw '%'
446 movwf POSTINC2 430 movwf POSTINC2
447 bra cf_done 431 bra cf_do_wp
448 432
449 cf_type_02: ; Type == 2 is deci mode. 433 cf_type_02: ; Type == 2 is deci mode.
450 output_16dp 4 434 output_16dp 4
451 bra cf_done 435 bra cf_do_wp
452 436
453 cf_type_03: ; Type == 3 is centi mode. 437 cf_type_03: ; Type == 3 is centi mode.
454 output_16dp 3 438 output_16dp 3
455 bra cf_done 439 bra cf_do_wp
456 440
457 cf_type_04: ; Type == 4 is mili mode 441 cf_type_04: ; Type == 4 is mili mode
458 output_16dp 2 442 output_16dp 2
459 bra cf_done 443 bra cf_do_wp
460 444
461 cf_type_05: ; Type == 5 is on/off mode. 445 cf_type_05: ; Type == 5 is on/off mode.
462 movf lo,W ; Get flag value... 446 movf lo,W ; Get flag value...
463 bz cf_type_off 447 bz cf_type_off
464 OUTPUTTEXT d'130' ; ON 448 OUTPUTTEXT d'130' ; ON
465 bra cf_done 449 bra cf_do_wp
466 cf_type_off: 450 cf_type_off:
467 OUTPUTTEXT d'131' ; OFF 451 OUTPUTTEXT d'131' ; OFF
468 bra cf_done 452 bra cf_do_wp
469 453
470 cf_type_06: ; Type == 6 is mm:ss mode (... or hh:mm) 454 cf_type_06: ; Type == 6 is mm:ss mode (... or hh:mm)
471 call convert_time ; Convert to min:sec into hi:low. 455 call convert_time ; Convert to min:sec into hi:low.
472 movff lo,wp_temp ; Save seconds, 456 movff lo,wp_temp ; Save seconds,
473 movff hi,lo ; Get minutes 457 movff hi,lo ; Get minutes
474 output_8 ; Print them 458 output_8 ; Print them
475 movlw ':' ; Separator 459 movlw ':' ; Separator
476 movwf POSTINC2 460 movwf POSTINC2
477 movff wp_temp,lo ; Get back seconds 461 movff wp_temp,lo ; Get back seconds
478 output_99x ; lo in 2 digits with trailing zeros. 462 output_99x ; lo in 2 digits with trailing zeros.
479 bra cf_done 463 bra cf_do_wp
480 464
481 cf_type_07: ; Type == 7 is Color swatch. 465 cf_type_07: ; Type == 7 is Color swatch.
482 output_8 466 output_8
467
468 call cf_fill_line ; it does less flickering when editing colors...
469 call word_processor
483 470
484 movf lo,W ; Get color. 471 movf lo,W ; Get color.
485 movff WREG,box_temp+0 ; Set color 472 movff WREG,box_temp+0 ; Set color
486 movff win_top,WREG ; BEWARE : this is a bank0 variable ! 473 movff win_top,WREG ; BEWARE : this is a bank0 variable !
487 movff WREG,box_temp+1 ; row top (0-239) 474 movff WREG,box_temp+1 ; row top (0-239)
491 movff WREG,box_temp+3 ; column left (0-159) 478 movff WREG,box_temp+3 ; column left (0-159)
492 movlw .140 479 movlw .140
493 movff WREG,box_temp+4 ; column right (0-159) 480 movff WREG,box_temp+4 ; column right (0-159)
494 481
495 call PLED_box 482 call PLED_box
496 bra cf_done ; W/o trailling spaces... 483 bra cf_done ; wp already done. Skip it...
497 484
498 cf_type_99: ; 8bit mode. Or unrecognized type... 485 cf_type_99: ; 8bit mode. Or unrecognized type...
499 clrf hi 486 clrf hi
500 487
501 cf_type_0: ; 15bit mode. 488 cf_type_0: ; 15bit mode.
502 bcf hi,7 489 bcf hi,7
503 output_16 490 output_16
504 491
492 cf_do_wp: ; Process by calling wordprocessor
493 call cf_fill_line
494 call word_processor
495
505 cf_done: 496 cf_done:
506 movff FSR1L, hi ; Restore saved registers... 497 movff FSR1L, hi ; And restore saved registers before return.
507 movff FSR1H, EEADRH 498 movff FSR1H, EEADRH
499 return
500
501 cf_fill_line: ; Mattias: No flicker if u clear just what you need...
502 movf FSR2L,W ; How many chars lefts ?
503 sublw (LOW letter) + .17 ; Remaining chars to fill: (letter + 21) - PTR
504 btfsc STATUS,N ; Add chars until none left...
505 return
506 movlw ' '
507 movwf POSTINC2
508 bra cf_fill_line
509
508 #else 510 #else
509 bcf hi,7 ; clear Bit 7 of value 511 bcf hi,7 ; clear Bit 7 of value
510 output_16 512 output_16
511 513
512 movff win_top,WREG ; Get "Default:" line position (BANK0 !) 514 movff win_top,WREG ; Get "Default:" line position (BANK0 !)
532 cf_no_bits: 534 cf_no_bits:
533 movlw ' ' 535 movlw ' '
534 movwf POSTINC2 536 movwf POSTINC2
535 movwf POSTINC2 537 movwf POSTINC2
536 movwf POSTINC2 538 movwf POSTINC2
539 goto word_processor
537 #endif 540 #endif
538 goto word_processor
539 541
540 ;----------------------------------------------------------------------------- 542 ;-----------------------------------------------------------------------------
541 543
542 do_customfunction: 544 do_customfunction:
543 CLRF EEADRH 545 CLRF EEADRH
553 bra toggle_oneorten 555 bra toggle_oneorten
554 dcfsnz menupos,F 556 dcfsnz menupos,F
555 bra restore_cfn_value 557 bra restore_cfn_value
556 dcfsnz menupos,F 558 dcfsnz menupos,F
557 bra adjust_cfn_value 559 bra adjust_cfn_value
560
558 exit_customfunctions: 561 exit_customfunctions:
559 movlw d'2' ; Return to correct list entry 562 movlw d'2' ; Return to correct list entry
560 btfss customfunction_page 563 btfss customfunction_page
561 movlw d'1' 564 movlw d'1'
562 movwf menupos ; 565 movwf menupos ;
563 clrf EEADRH ; Clear EEADRH ! 566 clrf EEADRH ; Clear EEADRH !
564 goto setup_menu2 ; exit... 567 goto setup_menu2 ; exit...
565
566 568
567 next_customfunction: 569 next_customfunction:
568 incf decodata+0 570 incf decodata+0
569 btfsc decodata+0,5 ;>31? 571 btfsc decodata+0,5 ;>31?
570 clrf decodata+0 ;Yes, so reset to zero 572 clrf decodata+0 ;Yes, so reset to zero