// r0 = target fizzbuzz value; in this code it is set to 0x41 movi R0, #0x41 movi R1, #0xfd movis R1, #0xff movi R2, #0xfe movis R2, #0xff movi R6, #0 movis R6, #0xe0 addi. R6, R6, #-1 stwi R2, R6, #1 bl R7, fizzbuzz /* * If your PART 1 code works, then data memory will contain: * - at address 0xfffd is the number of fizzes (should be 0x15) * - at address 0xfffe is the number of buzzes (should be 0x0d) * - at address 0xffff the value 0xffff */ halt #0x7ff /*** --- DO NOT EDIT THIS LINE OR ANYTHING ABOVE THIS LINE --- ***/ /* YOUR FILE-HEADER COMMENT HERE */ fizzbuzz: /* * Implement assembly code for this C function: * void fizzbuzz(int target, int *num_fizz, int *num_buzz); * * This function calculates the number of fizzes and the number of * buzzes for a target value. You have your choice of implementation * (iterative or recursive). Recall that a "fizz" is when the value is * evenly divisible by three, a "buzz" is a value evenly divisible by * five. * * As a reminder, ULNAv2-B uses this calling convention: * R0 - holds first function parameter, and holds return value * R1 - holds second function parameter * R2-R5 - callee saved * R6 - stack pointer * R7 - link register (holds return address) * You are responsible for preserving registers R2-R5, and restoring * the stack when you are done. * * Because this function needs a third function parameter, that value * will be at the memory location R6 + 1. Observe that the second and * third parameters are pointers. In other words, store the number of * fizzes to *R1, and the number of buzzes to *(R6 + 1). */ /* YOUR PART 1 CODE HERE */ br R7