Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MARS, MIPS assembler, linking two files together?

I have a quick question. I am using MARS assembler (programming in the MIPS instruction set) and I have two MIPS files. One file contains my main method to be run and it calls a function in the other file. My function has the .globl directive before it, but every time I try and compile my program it says

Symbol "print_hex" not found in symbol table.

Here is a screen shot for more context: enter image description here

The label print_hex is located in the file called print_hex.s.

enter image description here

How can I link these two files together? Lastly, how can I tell MARS to call a specific label at the start of execution, for example I want it to call main.

like image 853
Code Doggo Avatar asked Jul 30 '26 20:07

Code Doggo


1 Answers

  1. Put the files in the same directory
  2. Enable the MARS option Settings->Assemble all files in directory
  3. Assemble the file you want to start execution at.

And then all the files in the directory should get assembled and linked together.

To always have execution start at your main label, you can enable Settings->Initialize program counter to global 'main'.

like image 128
countunique Avatar answered Aug 01 '26 14:08

countunique



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!