lis r11, 0x8000
lwz r12, EVAADDRESS (r11) # Loads timer from memory
cmpwi r12, INTERVAL #Checks if it's time
beq- on
off:
rlwinm r0, r0, 0, 30, 28 # Clears the bit for the item input
b end
on:
ori r0, r0, 0x4 # Turns on the bit for the item input
end:
sth r0, 0x002C (r30) # Default instruction (stores the input to memory)
Since this is the default state for off, you should be able to put the bit clear instruction at the top and the code will still work. Like this:
rlwinm r0, r0, 0, 30, 28
lis r11, 0x8000
lwz r12, 0xEVAADDRESSÂ (r11)
cmpwi r12, INTERVAL
bne+ end
ori r0, r0, 0x0004
end:
lwz r12, EVAADDRESS (r11) # Loads timer from memory
cmpwi r12, INTERVAL #Checks if it's time
beq- on
off:
rlwinm r0, r0, 0, 30, 28 # Clears the bit for the item input
b end
on:
ori r0, r0, 0x4 # Turns on the bit for the item input
end:
sth r0, 0x002C (r30) # Default instruction (stores the input to memory)
Since this is the default state for off, you should be able to put the bit clear instruction at the top and the code will still work. Like this:
rlwinm r0, r0, 0, 30, 28
lis r11, 0x8000
lwz r12, 0xEVAADDRESSÂ (r11)
cmpwi r12, INTERVAL
bne+ end
ori r0, r0, 0x0004
end: