Mercurial > public > mk2
comparison code_part1/OSTC_code_asm_part1/menu_custom.asm @ 123:6a94f96e9cea
The big cleanup, again.
author | JeanDo |
---|---|
date | Thu, 30 Dec 2010 23:45:20 +0100 |
parents | db4a20b413df |
children | 999abb01c78f |
comparison
equal
deleted
inserted
replaced
122:3003a8040b78 | 123:6a94f96e9cea |
---|---|
176 | 176 |
177 menu_custom_functions11: | 177 menu_custom_functions11: |
178 WIN_INVERT .0 ; Init new Wordprocessor | 178 WIN_INVERT .0 ; Init new Wordprocessor |
179 | 179 |
180 menu_custom_functions1: | 180 menu_custom_functions1: |
181 call PLED_standard_color | 181 call PLED_standard_color ; Trash EEADRH... |
182 | 182 |
183 movlw d'1' | 183 movlw d'1' ; So restore it ! |
184 btfss customfunction_page ; Use Page II... | 184 btfss customfunction_page ; Use Page II ? |
185 movlw d'0' | 185 movlw d'0' ; NO: this is page 1. |
186 movwf EEADRH | 186 movwf EEADRH |
187 | 187 |
188 clrf timeout_counter2 | 188 clrf timeout_counter2 |
189 bcf menubit2 | 189 bcf menubit2 |
190 bcf menubit3 | 190 bcf menubit3 |
197 btfsc customfunction_page ; Add offset for display in CF menu II | 197 btfsc customfunction_page ; Add offset for display in CF menu II |
198 movlw d'32' | 198 movlw d'32' |
199 addwf lo,F | 199 addwf lo,F |
200 | 200 |
201 output_99x | 201 output_99x |
202 movlw ':' | 202 STRCAT_PRINT ": " |
203 movwf POSTINC2 | |
204 movlw ' ' | |
205 movwf POSTINC2 | |
206 call word_processor | |
207 | 203 |
208 movf customfunction_temp1,W ; start of custom function descriptors | 204 movf customfunction_temp1,W ; start of custom function descriptors |
209 addwf decodata+0,W ; add # of current custom function, place result in wreg | 205 addwf decodata+0,W ; add # of current custom function, place result in wreg |
210 call displaytext1 ; shows descriptor | 206 call displaytext1 ; shows descriptor |
211 | 207 |
230 bra menu_custom_functions10b | 226 bra menu_custom_functions10b |
231 | 227 |
232 menu_custom_functions10a: | 228 menu_custom_functions10a: |
233 WIN_LEFT .20 | 229 WIN_LEFT .20 |
234 WIN_TOP .65 | 230 WIN_TOP .65 |
235 lfsr FSR2,letter | 231 STRCPY "+/-: " |
236 movlw '+' | |
237 movwf POSTINC2 | |
238 movlw '/' | |
239 movwf POSTINC2 | |
240 movlw '-' | |
241 movwf POSTINC2 | |
242 movlw ':' | |
243 movwf POSTINC2 | |
244 movlw ' ' | |
245 movwf POSTINC2 | |
246 movlw '+' | 232 movlw '+' |
247 btfsc first_FA | 233 btfsc first_FA |
248 movlw '-' | 234 movlw '-' |
249 movwf POSTINC2 | 235 movwf POSTINC2 |
250 call word_processor | 236 call word_processor |
251 | 237 |
252 WIN_LEFT .20 | |
253 WIN_TOP .95 | 238 WIN_TOP .95 |
254 lfsr FSR2,letter | 239 STRCPY "1/10: 1" |
255 movlw '1' | |
256 movwf POSTINC2 | |
257 movlw '/' | |
258 movwf POSTINC2 | |
259 movlw '1' | |
260 movwf POSTINC2 | |
261 movlw '0' | |
262 movwf POSTINC2 | |
263 movlw ':' | |
264 movwf POSTINC2 | |
265 movlw ' ' | |
266 movwf POSTINC2 | |
267 movlw '1' | |
268 movwf POSTINC2 | |
269 movlw '0' | 240 movlw '0' |
270 btfsc second_FA | 241 btfsc second_FA |
271 movwf POSTINC2 | 242 movwf POSTINC2 |
272 movlw ' ' | 243 STRCAT_PRINT " " |
273 movwf POSTINC2 | |
274 call word_processor | |
275 | 244 |
276 menu_custom_functions10b: | 245 menu_custom_functions10b: |
277 WIN_LEFT .20 | 246 WIN_LEFT .20 |
278 WIN_TOP .125 | 247 WIN_TOP .125 |
279 lfsr FSR2,letter | 248 lfsr FSR2,letter |
297 addlw 0x83 | 266 addlw 0x83 |
298 movwf EEADR | 267 movwf EEADR |
299 call read_eeprom ; Highbyte | 268 call read_eeprom ; Highbyte |
300 movff EEDATA,hi | 269 movff EEDATA,hi |
301 | 270 |
271 call PLED_standard_color ; Changed by color swatches, but trash EEADRH... | |
302 call display_customfunction | 272 call display_customfunction |
303 | 273 |
304 ; End of mask: min/max and the exit line... | 274 ; End of mask: min/max and the exit line... |
305 rcall display_minmax | 275 rcall display_minmax |
306 DISPLAYTEXT .11 ; Exit | 276 DISPLAYTEXT .11 ; Exit |
409 | 379 |
410 display_customfunction: | 380 display_customfunction: |
411 movff EEADRH, FSR1H ; Backup... | 381 movff EEADRH, FSR1H ; Backup... |
412 | 382 |
413 rcall display_formated | 383 rcall display_formated |
384 incf WREG ; Color swatch drawn ? | |
385 bz display_customfunction_1 ; YES: skip line fill... | |
386 | |
414 rcall cf_fill_line | 387 rcall cf_fill_line |
415 call word_processor | 388 call word_processor |
416 | 389 |
390 display_customfunction_1: | |
417 movff FSR1H, EEADRH | 391 movff FSR1H, EEADRH |
418 return | 392 return |
419 | 393 |
420 ;----------------------------------------------------------------------------- | 394 ;----------------------------------------------------------------------------- |
421 ; Display optional min/max values. | 395 ; Display optional min/max values. |
441 bc cf_min_passed ; Ok if CARRY, ie. min >= lo | 415 bc cf_min_passed ; Ok if CARRY, ie. min >= lo |
442 call PLED_warnings_color | 416 call PLED_warnings_color |
443 WIN_INVERT 1 | 417 WIN_INVERT 1 |
444 cf_min_passed: | 418 cf_min_passed: |
445 | 419 |
446 movlw '>' ; A min value follows | 420 STRCAT "> " ; A min value follows |
447 movwf POSTINC2 | |
448 movlw ' ' | |
449 movwf POSTINC2 | |
450 movff cf_min, lo | 421 movff cf_min, lo |
451 rcall display_formated | 422 rcall display_formated |
452 | 423 |
453 cf_no_min: | 424 cf_no_min: |
454 rcall cf_fill_line ; Fill buffer | 425 rcall cf_fill_line ; Fill buffer |
472 bc cf_max_passed ; Ok if no carry, ie. max <= lo | 443 bc cf_max_passed ; Ok if no carry, ie. max <= lo |
473 call PLED_warnings_color | 444 call PLED_warnings_color |
474 WIN_INVERT 1 | 445 WIN_INVERT 1 |
475 cf_max_passed: | 446 cf_max_passed: |
476 | 447 |
477 movlw '<' ; A max value follows | 448 STRCAT "< " ; A max value follows |
478 movwf POSTINC2 | |
479 movlw ' ' | |
480 movwf POSTINC2 | |
481 movff cf_max, lo | 449 movff cf_max, lo |
482 rcall display_formated | 450 rcall display_formated |
483 | 451 |
484 cf_no_max: | 452 cf_no_max: |
485 rcall cf_fill_line ; Fill buffer | 453 rcall cf_fill_line ; Fill buffer |
524 bra cf_type_00 ; Default to 8bit mode... | 492 bra cf_type_00 ; Default to 8bit mode... |
525 | 493 |
526 cf_type_01: ; Type == 1 is CF_PERCENT mode | 494 cf_type_01: ; Type == 1 is CF_PERCENT mode |
527 bcf leftbind | 495 bcf leftbind |
528 output_8 | 496 output_8 |
529 movlw '%' | 497 PUTC '%' |
530 movwf POSTINC2 | |
531 retlw 0 | 498 retlw 0 |
532 | 499 |
533 cf_type_02: ; Type == 2 is CF_DECI mode. | 500 cf_type_02: ; Type == 2 is CF_DECI mode. |
534 clrf hi | 501 clrf hi |
535 bsf leftbind | 502 bsf leftbind |
557 retlw 0 | 524 retlw 0 |
558 | 525 |
559 cf_type_06: ; Type == 6 is CF_SECS mode (mm:ss or hh:mm) | 526 cf_type_06: ; Type == 6 is CF_SECS mode (mm:ss or hh:mm) |
560 clrf hi | 527 clrf hi |
561 call convert_time ; Convert to min:sec into hi:low. | 528 call convert_time ; Convert to min:sec into hi:low. |
562 movff lo,wp_temp ; Save seconds, | 529 movff lo,TABLAT ; Save seconds for later. |
563 movff hi,lo ; Get minutes | 530 movff hi,lo ; Get minutes |
564 bsf leftbind ; Skip leading space(s). | 531 bsf leftbind ; Skip leading space(s). |
565 output_8 ; Print them | 532 output_8 ; Print them |
566 movlw ':' ; Separator | 533 PUTC ':' ; Separator |
567 movwf POSTINC2 | 534 movff TABLAT,lo ; Get back seconds |
568 movff wp_temp,lo ; Get back seconds | |
569 output_99x ; lo in 2 digits with trailing zeros. | 535 output_99x ; lo in 2 digits with trailing zeros. |
570 retlw 0 | 536 retlw 0 |
571 | 537 |
572 cf_type_07: ; Type == 7 is CF_COLOR swatch. | 538 cf_type_07: ; Type == 7 is CF_COLOR swatch. |
573 bcf leftbind ; Keep leading space (better alignement) | 539 bcf leftbind ; Keep leading space (better alignement) |
574 output_8 | 540 output_8 |
575 movlw ' ' | 541 STRCAT_PRINT " " |
576 movwf POSTINC2 | |
577 call word_processor | |
578 | 542 |
579 movf lo,W ; Get color. | 543 movf lo,W ; Get color. |
580 movff WREG,box_temp+0 ; Set color | 544 call PLED_set_color |
581 movff win_top,WREG ; BEWARE : this is a bank0 variable ! | 545 movlw .23 |
582 movff WREG,box_temp+1 ; row top (0-239) | 546 movff WREG,win_height ; row bottom (0-239) |
583 addlw .23 | |
584 movff WREG,box_temp+2 ; row bottom (0-239) | |
585 movlw .110 | 547 movlw .110 |
586 movff WREG,box_temp+3 ; column left (0-159) | 548 movff WREG,win_leftx2 ; column left (0-159) |
587 movlw .148 | 549 movlw .148-.110+1 |
588 movff WREG,box_temp+4 ; column right (0-159) | 550 movff WREG,win_width ; column right (0-159) |
589 | 551 |
590 call PLED_box | 552 call PLED_box |
591 retlw -1 ; wp already done. Skip it... | 553 retlw -1 ; wp already done. Skip it... |
592 | 554 |
593 cf_type_00: ; 8bit mode. Or unrecognized type... | 555 cf_type_00: ; 8bit mode. Or unrecognized type... |
604 cf_fill_line: ; Mattias: No flicker if u clear just what you need... | 566 cf_fill_line: ; Mattias: No flicker if u clear just what you need... |
605 movf FSR2L,W ; How many chars lefts ? | 567 movf FSR2L,W ; How many chars lefts ? |
606 sublw (LOW letter) + .18 ; Remaining chars to fill: (letter + 18) - PTR | 568 sublw (LOW letter) + .18 ; Remaining chars to fill: (letter + 18) - PTR |
607 btfsc STATUS,N ; Add chars until none left... | 569 btfsc STATUS,N ; Add chars until none left... |
608 return | 570 return |
609 movlw ' ' | 571 PUTC ' ' |
610 movwf POSTINC2 | |
611 bra cf_fill_line | 572 bra cf_fill_line |
612 | 573 |
613 ;----------------------------------------------------------------------------- | 574 ;----------------------------------------------------------------------------- |
614 | 575 |
615 do_customfunction: | 576 do_customfunction: |
797 WIN_LEFT .80 - (6*.7)/2 ; Center 8 chars of width 14pix. | 758 WIN_LEFT .80 - (6*.7)/2 ; Center 8 chars of width 14pix. |
798 WIN_FONT FT_SMALL | 759 WIN_FONT FT_SMALL |
799 WIN_INVERT .1 ; Init new Wordprocessor | 760 WIN_INVERT .1 ; Init new Wordprocessor |
800 call PLED_warnings_color | 761 call PLED_warnings_color |
801 | 762 |
802 lfsr FSR2,letter | 763 STRCPY " CF" |
803 movlw ' ' | |
804 movwf POSTINC2 | |
805 movlw 'C' | |
806 movwf POSTINC2 | |
807 movlw 'F' | |
808 movwf POSTINC2 | |
809 movff cf_checker_counter,lo | 764 movff cf_checker_counter,lo |
810 output_99x | 765 output_99x |
811 movlw ' ' | 766 STRCAT_PRINT " " |
812 movwf POSTINC2 | |
813 call word_processor | |
814 | 767 |
815 ; When failed, increment counter modulo 64, to restart checks. | 768 ; When failed, increment counter modulo 64, to restart checks. |
816 incf cf_checker_counter,W | 769 incf cf_checker_counter,W |
817 andlw .63 ; Modulo 64 | 770 andlw .63 ; Modulo 64 |
818 movwf cf_checker_counter | 771 movwf cf_checker_counter |