I try to understand...
Surac
Posts: 176
Reading the Instruction set of the P2 i have found something i can't find any documentation about
EEEE 0100000 CZI DDDDDDDDD SSSSSSSSS TESTB D,S/# WC/WZ EEEE 0100001 CZI DDDDDDDDD SSSSSSSSS TESTBN D,S/# WC/WZ EEEE 0100010 CZI DDDDDDDDD SSSSSSSSS TESTB D,S/# ANDC/ANDZ EEEE 0100011 CZI DDDDDDDDD SSSSSSSSS TESTBN D,S/# ANDC/ANDZ EEEE 0100100 CZI DDDDDDDDD SSSSSSSSS TESTB D,S/# ORC/ORZ EEEE 0100101 CZI DDDDDDDDD SSSSSSSSS TESTBN D,S/# ORC/ORZ EEEE 0100110 CZI DDDDDDDDD SSSSSSSSS TESTB D,S/# XORC/XORZ EEEE 0100111 CZI DDDDDDDDD SSSSSSSSS TESTBN D,S/# XORC/XORZ
So, if i write TESTB or TESTBN, how does the compiler determine which to use?
EEEE 1101011 CZL DDDDDDDDD 001000000 TESTP D/# WC/WZ EEEE 1101011 CZL DDDDDDDDD 001000001 TESTPN D/# WC/WZ EEEE 1101011 CZL DDDDDDDDD 001000010 TESTP D/# ANDC/ANDZ EEEE 1101011 CZL DDDDDDDDD 001000011 TESTPN D/# ANDC/ANDZ EEEE 1101011 CZL DDDDDDDDD 001000100 TESTP D/# ORC/ORZ EEEE 1101011 CZL DDDDDDDDD 001000101 TESTPN D/# ORC/ORZ EEEE 1101011 CZL DDDDDDDDD 001000110 TESTP D/# XORC/XORZ EEEE 1101011 CZL DDDDDDDDD 001000111 TESTPN D/# XORC/XORZ
- shouldn't WC/WZ be written as {WC/WZ}?
- How does the compiler determine how to encode the instruction?
Do i have to write something special behind the instruction to tell if i want AND OR, XOR?
Does it work like wc wz wcz behind the instruction?
Comments
Yes, for those instructions, the WC/ANDC/ORC/XORC encodings are all the same "C" bit (#20) and WZ/ANDZ/ORZ/XORZ are all the same "Z" bit (#19).
The reason why there is no {} braces is because it is mandatory to use exactly one option. Most instructions it is optional to use any.
TESTBx and BITx share the same opcodes, except for C & Z bits. Similarly for TESTPx and DIRx.
Here's a complete list of the TESTP/n encodings.
Edit: Corrected DIRNC typos
Ahh,
Thank you for enlighten me
hmm i think there should not be a {WCZ}
and here it should say WCZ not {WCZ}
right?
Correct. Oz missed a couple.
Oops!
I corrected the error, thanks guys.