I am new to MIPS and I have an assignment for uni. I have a program(game) in Mips, and I am trying to write a function to restart the game after finishing. I already have my restart function but the problem is that I have to clear all the registers I've used before. does anyone know how I can do for clearing in the fastest and easiest way?(I have 740lines of code,That's why i am asking for easiest and fastest.)
how to empty all the registers already used, to restart the program in MIPS?
554 Views Asked by Hamed Rahimi At
1
There are 1 best solutions below
Related Questions in ASSEMBLY
- Is there some way to use printf to print a horizontal list of decrementing hex digits in NASM assembly on Linux
- How to call a C language function from x86 assembly code?
- Binary Bomb Phase 2 - Decoding Assembly
- AVR Assembly Clock Cycle
- Understanding the differences between mov and lea instructions in x86 assembly
- ARM Assembly code is not executing in Vitis IDE
- Which version of ARM does the M1 chip run on?
- Why would %rbp not be equal to the value of %rsp, which is 0x28?
- Move immediate 8-bit value into RSI, RDI, RSP or RBP
- Unable to run get .exe file from assembly NASM
- DOSbox automatically freezes and crashes without any prompt warnings
- Load function written in amd64 assembly into memory and call it
- link.exe unresolved external symbol _mainCRTStartup
- x86 Wrote a boot loader that prints a message to the screen but the characters are completely different to what I expected
- running an imf file using dosbox in parallel to a game
Related Questions in MIPS
- My prompt message not working in mips program
- How do I extract ints from an array using MIPS Assembly?
- MIPS Aiken to Binary
- Can anyone help me understand why my MIPS assembly code isn't adding or subtracting correctly?
- MIPS runtime error "line 31: Runtime exception at 0x00400038: address out of range 0x7fbffffc Go: execution terminated with errors."
- Getting the error "Error in : invalid program counter value: 0x00000000 Go: execution terminated with errors. " in MIPS assembly
- MIPS $a_ and $v_ registers producing incorrect output
- MIPS pipeline forwarding
- -- program is finished running (dropped off bottom) --
- Implementing beq instruction to a simple control unit in logisim
- MIPS Assembly Language invalid program counter value error
- Code wont stop running in MIPS assembly simulation
- How to read controle signals from the opcode for a single-clock processor
- "Illegal instruction" appear when try to get PRID by mfc0 instruction on Loongson-3A R4 (MIPS64)?
- Seeking Verification: MIPS Cache Set Update Analysis
Related Questions in CPU-REGISTERS
- Understanding the differences between mov and lea instructions in x86 assembly
- Move immediate 8-bit value into RSI, RDI, RSP or RBP
- Maximum CPU Voltage reading
- Enabling one timer using another
- CMP ESI, -20. This part of code makes no sense to me. How does this magic work?
- Why doesn't this pop instruction restore the register values?
- Configuring timer channel as output
- Setting up Segment Registers, x86
- Why arm64 pass params throught register x8-x17?
- gdbserver and ymm0h register
- Unit tests on registers with bare metal programming
- Performance advantage of 32bit registers in AArch64?
- What is the meaning of "ptr" in assembly?
- What is the meaning of register1:register2 in assembly language?
- The SUB instruction in CPU
Related Questions in MIPS32
- MIPS runtime error "line 31: Runtime exception at 0x00400038: address out of range 0x7fbffffc Go: execution terminated with errors."
- Getting the error "Error in : invalid program counter value: 0x00000000 Go: execution terminated with errors. " in MIPS assembly
- Problem creating a subroutine that converts hexadecimal numbers to corresponding ASCII values
- Understanding MIPS Jump Instruction encoding
- How to add the roman numbers in decimal with a MIPS code?
- How do i go through a binary heap in MIPS?
- Verification of MIPS Assembly Code for Memory-Mapped I/O
- Trying to compile a file for the MIPSEL architecture
- Qtspim mips assembly
- How to print star character in mars mips
- MARS MIPS multiplication of two single-precision IEEE 754 standard floating-point numbers
- I am trying to practice converting C code to MIPS Assembly. How would I go about translating the following collatz function to MIPS?
- Information about mul in MIPS32 (Computer Architecture)
- Loading word into cp1 returns "adress out of range" error
- Floating point comparison in MIPS
Related Questions in SPIM
- Continuous Arithmetic Overflow
- Spim MIPS Simulator not launching (Stanford cs143)
- MIPS lbu doesn't work unless program is run twice
- Floating Point Numbers but the output is always 0
- How would I go about programming the recursive sequence below in QtSpim/MIPS
- using stack frame to push in parameters in order to calculate Fibbonnacci sequence but keep getting a 1 as a return value
- Having trouble printing strings in MIPS using (qtSPIM)
- Why A and B registers are used in multicycle Datapath?
- How do you enter command line arguments in SPIM
- Keep getting an exception 5 [address error in store] followed by unaligned address in store. How can I fix this?
- how to empty all the registers already used, to restart the program in MIPS?
- MIPS - SPIM parser immediate value out of range for bitwise ANDI
- initial stack pointer is not 0x7fffffff in MIPS
- Undefined symbol in MIPS
- Substitution for %hi and %lo in MIPS
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Registers can't be "empty", they always hold some value in their 32 bits. There is no metadata anywhere outside them that indicates which registers have / haven't been written.
You don't need to do anything special. Non-buggy code in the rest of your program should already assume any register holds garbage (not necessarily zeros) if it hasn't written to it. (Or done something like a system call, which would get the simulator to put a useful value in a register.)
Think of registers as being like local variables in C. Like
int a0, a1, t0, t1;notint a0=0, a1=0, etc. That's why you write loops likefor(t0=5 ; t0!=0 ; t0--), where the first access is a write (assigning a5to the variable / register). In asm that meansli $t0, 5before the loop. If you didn't, your loop would run some unknown number of iterations, depending on whatever previous code left in$t0. (In C, it's undefined behaviour or at least an unspecified value to read an uninitialized local variable. In practice you get some garbage from somewhere, because C compiles to asm, and in asm for real CPUs, every register and memory location always has a value.)(In some senses, global variables are a better analogy since all code uses the same registers for different purposes at different times. But since you don't want to read whatever garbage some previous function left in them, it makes equal sense to consider the separate life-times as separate local variables.)
If you did want to zero some registers, obviously you just write instructions like