; Justice Unlimited Gadget Microcode ; (C) 2004 Nathan (Acorn) Pooley ; ; gcode.inc ; ;@DOC@ parse and check codes ; ;############################################ ;############### CHECK CODES ################ ;############################################ fn_check_code: ; ; clear screen and display message ; movlw mode_checkcode rcall set_mode ; ; display message for a sec while we pretend to be busy ; (turn light off while doing so) ; ; rcall light_off rcall wait_1sec ; ; compare code to codes in ROM ; rcall setup_progread ; prepare to read flash mem movlw LOW codes ; point to code table (in flash mem) movwf TBLPTRL movlw HIGH codes movwf TBLPTRH chkc_loop: ; ; look for a matching code ; tblrd*+ ; read length of code movf TABLAT,w bz check_code_bad ; no codes matched? movwf v_tmp subwf v_entry_ptr,w bz chkc_compare ; same number of characters? ; ; different length - skip to next code ; chkc_skip: tblrd*+ ; read code byte chkc_bad: decfsz v_tmp bra chkc_skip tblrd*+ ; read param tblrd*+ ; read func ; ; go on to next code ; chkc_next: bra chkc_loop ; ; same length - compare them ; chkc_compare: lfsr FSR0,BUF_ENTRY chkc_compare_loop: tblrd*+ movf TABLAT,w subwf POSTINC0,w bnz chkc_bad ; mismatch - skip this one decfsz v_tmp bra chkc_compare_loop ; ; got a match! - call function ; tblrd*+ ; read param movff TABLAT,v_str_addrhi ; pass param here tblrd*+ ; read func movf TABLAT,w bra main_jump ; ; Unrecognized code was entered!! ; check_code_bad: rcall init_to_main_menu movlw mode_badcode rcall push_mode #if 0 rcall snd_err1 rcall reset_sleep_time rcall snd_err1 rcall reset_sleep_time rcall snd_err1 rcall reset_sleep_time #endif return #if 0 fn_check_code: lfsr FSR0,BUF_ENTRY movf POSTINC0,w addlw LOW -('J') bnz check_code_bad movf POSTINC0,w addlw LOW -('J') bnz check_code_bad movf POSTINC0,w addlw LOW -('O') bnz check_code_bad movf POSTINC0,w addlw LOW -('N') bnz check_code_bad movf POSTINC0,w addlw LOW -('Z') bnz check_code_bad movf POSTINC0,w addlw LOW -('Z') bnz check_code_bad movlw mode_cp1_q1 bra set_mode check_code_bad: movlw mode_goodcode bra set_mode #endif |
This file Copyright (C) 2004 by Nathan (Acorn) Pooley
Go to DRUID Development page
Go to DRUID page
Go to JU Gadgets page
Go to Justice Unlimited homepage
Go to Acorn's personal webpage
Contact Acorn
See comments from others
Post your own comments
File created by do_doc at Wed Aug 4 17:51:46 2004