Return to previous page | Return to menu | Go to next page
The input information from the device is determined by comparing the peripheral data described above with the assignment data described below.
The assignment data is defined in the header file “sl_def.h” attached to the system. For example, the assignment corresponding to each input device of Saturn PAD is defined as follows.
Since these assignments are used for collation with peripheral data, they correspond to the peripheral data length of each device. For example, the A button assignment for Saturn PAD is expanded as shown in the following figure (16-bit length). In the assignment data, the bit corresponding to the input device to be identified is set to 1, and the other bits are set to 0.
Note) Only the same bit (10th bit) that operates when the A button is input is 1.
In the case of Saturn PAD, the input device consists of simple switch ON / OFF, so the switch status can be confirmed by logical operation of assignment data and peripheral data.
Figure 9-7 shows an example of checking the input status by AND operation of peripheral data and assignment data. If the input device specified by the assignment data is ON, 0 is output as the operation result.
This method is also adopted in the sample program, and it is designed to display a sprite on the screen if the input device pointed to by the pad assignment is ON.
In this example, data is collated by AND operation of peripheral data and assignment data, but it is not always necessary to adopt this method.