Coding Questions and other Quandaries
#47
Ok, I see what I did wrong here (duh!):

mfctr r0
andi. r0, r0, 0xF
cmpwi r0, 4
bne- default_instruction
ori r4, r4, 0x0000
default_instrction:
ori r4, r4, 0x0001

And understand what you did here:

ori r4, r4, 0x0001 #Default Instruction, bit 31 is set high
mfctr r0 #Grab address from CTR
andi. r0, r0, 0xF #Check last digit
cmpwi r0, 4 #Check last digit against value of 4
bne- end_code #If not equal, end code, we want bit 31 kept high
rlwinm r4, r4, 0, 0, 30 #Flip bit 31 low
end_code: #The end



Thanks for your critiques. I'm learning a lot from it.

I was just asking about the "rlwinm" instruction, and here, is a great example of how to use it.
Reply


Messages In This Thread
RE: Coding Questions and other Quandaries - by Hackwiz - 12-16-2021, 04:32 PM

Forum Jump:


Users browsing this thread: 3 Guest(s)