Only 1 master per RS485 bus, hardwired and impossible to change after network setup.
Multi master RS485 are theoretically possible, but very hard to implement and is much cheaper to go for another multi master bus.
Basically RS485 works like this:
- master addresses a slave;
- slave responds;
- master addresses another slave;
...
You need to implement addressing in your protocol.
PS: this sounds like a homework, especially because you need 8051 assembly code