First page Back Continue Last page Overview Graphics

Laboratory 4.2 Search in a table


The data in the table should be stored as a list of bytes as shown above. Use indexed addressing and start the index at 0. Your program should loop and compare the value stored in val with the values in the table. If a match is found, it should drop out of the loop and put the number of the index in accumulator A. For example if a $dd is in val a 9 should be put into accumulator A. Your program must stop searching when the last entry in the table is checked. If no match is found, put an $ff in the accumulator. Use the debugger and try various values for val to verify that the program works properly.

Save this project. This module will be used later in a program to read a keypad.