Page 75 - Computer_Science_F5
P. 75

Computer Science  (a) Shujaa power activation: The game   compare the car’s position data
                                                         with the positions of obstacles
                allows players to activate “Shujaa
                Power,” which grants a temporary
                                                         stored in an array. How would you
                speed boost.  This activation is
                                                         use addressing modes to efficiently
                triggered by a button press. A
                                                         compare the car’s position with
          FOR ONLINE READING ONLY
                flag value (0 for not pressed, 1
                                                         in memory? Explain your approach
                for pressed) is stored in a specific     multiple obstacle positions stored
                memory location. Which addressing        to a teammate who might be less
                mode would be most efficient for         familiar with addressing modes.
                the instruction that checks this flag   (e) Optimizing performance: The game
                value, and why?                          needs to run smoothly on various
             (b) Car position update: During the         mobile devices. How can your
                race,  the  car’s  position  on  the     understanding of addressing modes
                track is constantly updated based        help you optimise the game code
                on various calculations. The new         for performance? Explain your
                position data needs to be stored in      approach considering the trade-offs
                a specific variable within a complex     between different modes.
                data structure representing the car   (f)  Research another addressing mode
                object. Which addressing mode            not covered in this section (such
                would be suitable for the instruction    as, base displacement addressing).
                that stores the new position, and        Explain a scenario in the game
                how would you communicate this           engine where this addressing mode
                addressing mode choice to another        might be useful and why.
                programmer working on the same
                code?
             (c) Dynamic difficulty adjustment: The   Register Transfer Language
                game can adjust difficulty based on   Register Transfer Language (RTL) is
                player performance. An array stores   a symbolic notation used to describe
                pre-defined difficulty settings.     the flow of data between registers and
                Based on the player’s score, the     other functional units within a digital
                program needs to access a specific   system,  like a CPU. It acts as an
                difficulty setting within the array.   intermediate representation (IR) between
                Which addressing mode would be       high-level programming. languages and
                appropriate, and how could you       the actual machine code instructions
                modify the code to dynamically       executed by the processor. RTL helps us
                adjust the difficulty based on an    understand how data is manipulated within
                external factor (player score)?      the CPU at a register level, providing a
             (d) Collision detection: To  check      more detailed view compared to machine
                for collisions, the game needs to    code. RTL uses the common addressing
                                                     modes discussed in the previous sections.

                                                  66
                                                                for Advanced Secondary Schools



     Computer Science Form 5.indd   66                                                      23/07/2024   12:32
   70   71   72   73   74   75   76   77   78   79   80