When I code for hubexec, I use an ORGH $xxxx statement.
Now my code is being compiled for hub. All DJXX/JMP/CALLx instructions will use relative if possible.
I presume when the DJxx/JMP/CALLx instructions are out of relative range, the direct hub address will be used.
Everything seems fine so far.
Has anyone thought about what happens when we want the code to be able to execute in both hubexec and cogexec/lutexec modes ??? We cannot let the compiler use direct mode.
I have found the ## to automatically insert the additional AUGS or AUGD instruction extremely useful. Lots of the extra instructions support the D/# variant.
I have found the ## to automatically insert the additional AUGS or AUGD instruction extremely useful. Lots of the extra instructions support the D/# variant.
That DJNZ x,##y is another nifty use
Yep, a great feature.
Pnut even can do a double AUG insertion like
wrlong ##$1234_5678,##$3_ffb0
An immediate 32 bit value to a immediate hub address, very cool! :cool:
I would have thought the AUGD gets applied to the AUGS, which would be a mess. There must be some special case detection when they get paired ... Has Chip talked about this before?
EDIT: Maybe it's a bit like the SETQ instruction, ie: Internal registers for S and D that are specially preloaded by the AUGx instructions and not used until a non-AUGx instruction is executed. That would mean any number of AUG's can be sequenced... ?
They load up internal registers which get combined at the next "normal" instruction execution, which also resets those registers. There are S and D registers for AUGS and AUGD.
There are also ALTS, ALTD, ALTI and ALTR instructions which can vary the following instructions S, D, I (instruction) and R (result) addresses.
******* is used in subsequent decoding.
For example, the ******* in the SETNIB/GETNIB/ROLNIB/******* is divided into the next line SETBYTE/GETBYTE. So therefore
ff=00 = SETNIB
ff=01 = GETNIB
ff=10 = ROLNIB
ff=11 = SETBYTE if instr[0]=0, GETBYTE if instr[0]=1
<empty> means the opcode if available. ie not used.
Ok, I found this in the old P2-Hot stuff.
Looks like it should be the same in the new P2?
PIXEL MIXER
-----------
Each cog has a pixel mixer called MIX that can combine two pixels in a sum-of-products
operation, where:
inputs:
DA = D pixel A component (8 bits)
DR = D pixel R component (8 bits)
DG = D pixel G component (8 bits)
DB = D pixel B component (8 bits)
SA = S pixel A component or GETPIX A' component (8 bits)
SR = S pixel R component or GETPIX R' component (8 bits)
SG = S pixel G component or GETPIX G' component (8 bits)
SB = S pixel B component or GETPIX B' component (8 bits)
outputs:
A' = ((DA * DAX + SA * SAX + 255) / 256) max 255
R' = ((DR * DRX + SR * SRX + 255) / 256) max 255
G' = ((DG * DGX + SG * SGX + 255) / 256) max 255
B' = ((DB * DBX + SB * SBX + 255) / 256) max 255
The DAX/DRX/DGX/DBX/SAX/SRX/SGX/SBX terms determine the type of mixing that will be done.
The terms are configurable for the MIXPIX/GETPIX instructions, but fixed for the others:
ADDPIX D,S/# - Addand clamp A:R:G:B components into D
DAX = $FF SAX = $FF
DRX = $FF SRX = $FF
DGX = $FF SGX = $FF
DBX = $FF SBX = $FFMULPIX D,S/# - Multiply A:R:G:B components into D
DAX = SA SAX = $00
DRX = SR SRX = $00
DGX = SG SGX = $00
DBX = SB SBX = $00BLNPIX D,S/# - Blend A:R:G:B components by SA into D
DAX = !SA SAX = SA
DRX = !SA SRX = SA
DGX = !SA SGX = SA
DBX = !SA SBX = SA
Here is the general-purpose MIXPIX instruction:
MIXPIX D,S/# - Mix A:R:G:B components according to SETMIX into D
To configure for MIXPIX/GETPIX usage, the SETMIX instruction is used:
SETMIX D/#,S/# - Set MIX configuration to D/#[8..0], S/#[31..0]
D/#[8..0] sets M - initialized to$001 *
S/#[31..24] sets DAB - initialized to$00
S/#[23..16] sets DCB - initialized to$00
S/#[15..8] sets SAB - initialized to$FF *
S/#[7..0] sets SCB - initialized to$00
M[8] = 0 for long mode, where D and S pixels are 8:8:8:8 bit A:R:G:B
M[8] = 1 for word mode, where D and S pixels are 1:5:5:5 bit A:R:G:B
1:5:5:5 pixels are expanded so that %A_BCDEF_GHIJK_LMNOP becomes
%AAAAAAAA_BCDEFBCD_GHIJKGHI_LMNOPLMN for the mixing computation.
When being packed back down to1:5:5:5 bit A:R:G:B, the single A
bit will be 1if the resultant A was not0, and the R:G:B fields
will be set to the top 5 bits of the resultant R:G:B.
In word mode, the low word in D will be operated on and the words
will be swapped, leaving the mixed pixel in the new high wordand
the old high word in the new low word. Also, pixel data from S
will be taken alternately from the low and high word with each
operation, with SETMIX resetting the selector to the low word.
Word mode affects all ADDPIX/MULPIX/BLNPIX/GETMIX/GETPIX.
M field 000001010011100101110111
--------------------------------------------------------------
M[7] DAX = DAB SA
M[6..4] DRX = $00$FF SA !SA DA !DA DCB SR
M[6..4] DGX = $00$FF SA !SA DA !DA DCB SG
M[6..4] DBX = $00$FF SA !SA DA !DA DCB SB
--------------------------------------------------------------
M[3] SAX = SAB DA
M[2..0] SRX = $00$FF SA !SA DA !DA SCB DR
M[2..0] SGX = $00$FF SA !SA DA !DA SCB DG
M[2..0] SBX = $00$FF SA !SA DA !DA SCB DB
* M and SAB are initialized on cog start so that GETPIX will return the
scaled A:R:G:B texture pixel without any blending.
The PIXADD/PIXMUL/PIXBLN/PIXMIX instructions all take 2 clocks, while GETPIX
takes 3 clocks.
The ALTx instructions modify the next instruction whereas SETx modifies the cog ram contents.
The SETx instructions also requires 2 spacer instruction.
Comments
Ahh! That makes sense.
How about SLMBYTE (Shift Left, Move)?
Shift/Rotate D left 1 byte, and/but inserting the new byte 0 from S byte n.
When I code for hubexec, I use an ORGH $xxxx statement.
Now my code is being compiled for hub. All DJXX/JMP/CALLx instructions will use relative if possible.
I presume when the DJxx/JMP/CALLx instructions are out of relative range, the direct hub address will be used.
Everything seems fine so far.
Has anyone thought about what happens when we want the code to be able to execute in both hubexec and cogexec/lutexec modes ??? We cannot let the compiler use direct mode.
I suspect that DJNZ can be augmented with AUGS to extend it's range too.
Edit: Pnut allows DJNZ to use "##" to extend range
orgh $1000 djxx mov count,#55 long 0[$1_0000] '64k of nop's djnz adra,##djxx ret
That DJNZ x,##y is another nifty use
Pnut even can do a double AUG insertion like
wrlong ##$1234_5678,##$3_ffb0
An immediate 32 bit value to a immediate hub address, very cool! :cool:wrlong ##$1234_5678,##$3_ffb0 translates to augd #($1234_5678 >> 9) augs #($3_ffb0 >> 9) wrlong #($1234_5678 & $1FF),#($3_ffb0 & $1FF)
EDIT: Maybe it's a bit like the SETQ instruction, ie: Internal registers for S and D that are specially preloaded by the AUGx instructions and not used until a non-AUGx instruction is executed. That would mean any number of AUG's can be sequenced... ?
There are also ALTS, ALTD, ALTI and ALTR instructions which can vary the following instructions S, D, I (instruction) and R (result) addresses.
Maybe an improved description is in order.
Propeller P16X64A Instructions v10a 17Jun2016 ---------------------------------------------------------------------------------------------------------------------------------------- Cond Opcode CZ I Dest Source Instr00 01 10 11 Operand(s) Flags ---------------------------------------------------------------------------------------------------------------------------------------- CCCC 00000ff CZ I DDDDDDDDD SSSSSSSSS ROR ROL SHR SHL D,S/# CZ CZ CZ CZ CCCC 00001ff CZ I DDDDDDDDD SSSSSSSSS RCR RCL SAR SAL D,S/# CZ CZ CZ CZ CCCC 00010ff CZ I DDDDDDDDD SSSSSSSSS ADD ADDX ADDS ADDSX D,S/# CZ CZ CZ CZ CCCC 00011ff CZ I DDDDDDDDD SSSSSSSSS SUB SUBX SUBS SUBSX D,S/# CZ CZ CZ CZ CCCC 00100ff CZ I DDDDDDDDD SSSSSSSSS CMP CMPX CMPS CMPSX D,S/# CZ CZ CZ CZ CCCC 00101ff CZ I DDDDDDDDD SSSSSSSSS CMPR CMPM SUBR CMPSUB D,S/# CZ CZ CZ CZ CCCC 00110ff CZ I DDDDDDDDD SSSSSSSSS MIN MAX MINS MAXS D,S/# CZ CZ CZ CZ CCCC 00111ff CZ I DDDDDDDDD SSSSSSSSS SUMC SUMNC SUMZ SUMNZ D,S/# CZ CZ CZ CZ CCCC 01000ff CZ I DDDDDDDDD SSSSSSSSS ISOB NOTB CLRB SETB D,S/# CZ CZ CZ CZ CCCC 01001ff CZ I DDDDDDDDD SSSSSSSSS SETBC SETBNC SETBZ SETBNZ D,S/# CZ CZ CZ CZ CCCC 01010ff CZ I DDDDDDDDD SSSSSSSSS ANDN AND OR XOR D,S/# CZ CZ CZ CZ CCCC 01011ff CZ I DDDDDDDDD SSSSSSSSS MUXC MUXNC MUXZ MUXNZ D,S/# CZ CZ CZ CZ CCCC 01100ff CZ I DDDDDDDDD SSSSSSSSS MOV NOT ABS NEG D,S/# CZ CZ CZ CZ CCCC 01101ff CZ I DDDDDDDDD SSSSSSSSS NEGC NEGNC NEGZ NEGNZ D,S/# CZ CZ CZ CZ CCCC 0111000 ff I DDDDDDDDD SSSSSSSSS ALTI ALTR ALTD ALTS D,S/# -- -- -- -- CCCC 0111001 CZ I DDDDDDDDD SSSSSSSSS DECOD D,S/# CZ CCCC 011101f CZ I DDDDDDDDD SSSSSSSSS TOPONE BOTONE D,S/# CZ CZ CCCC 011110f CZ I DDDDDDDDD SSSSSSSSS INCMOD DECMOD D,S/# CZ CZ CCCC 011111f fZ I DDDDDDDDD SSSSSSSSS MUL MULS SCLU SCL D,S/# -Z -Z -Z -Z ---------------------------------------------------------------------------------------------------------------------------------------- CCCC 1000ffn nn I DDDDDDDDD SSSSSSSSS SETNIB GETNIB ROLNIB ******* D,S/#,#n -- -- -- -- CCCC 100011f nn I DDDDDDDDD SSSSSSSSS SETBYTE GETBYTE D,S/#,#n -- -- CCCC 1001000 nn I DDDDDDDDD SSSSSSSSS ROLBYTE D,S/#,#n -- CCCC 1001001 fn I DDDDDDDDD SSSSSSSSS SETWORD GETWORD D,S/#,#n -- -- CCCC 1001010 0n I DDDDDDDDD SSSSSSSSS ROLWORD D,S/#,#n -- CCCC 1001010 1f I DDDDDDDDD SSSSSSSSS SETBYTS MOVBYTS D,S/# -- -- CCCC 1001011 ff I DDDDDDDDD SSSSSSSSS SPLITB MERGEB SPLITW MERGEW D,S/# -- -- -- -- CCCC 1001100 ff I DDDDDDDDD SSSSSSSSS SEUSSF SEUSSR RGBSQZ RGBEXP D,S/# -- -- -- -- CCCC 1001101 ff I DDDDDDDDD SSSSSSSSS REV SETI SETD SETS D,S/# -- -- -- -- CCCC 1001110 ff I DDDDDDDDD SSSSSSSSS DJZ DJNZ DJS DJNS D,S/#rel9 -- -- -- -- CCCC 1001111 ff I DDDDDDDDD SSSSSSSSS TJZ TJNZ TJS TJNS D,S/#rel9 -- -- -- -- CCCC 10100ff CZ I DDDDDDDDD SSSSSSSSS TESTN TEST ANYB TESTB D,S/# CZ CZ CZ CZ CCCC 1010100 ff I DDDDDDDDD SSSSSSSSS ADDCT1 ADDCT2 ADDCT3 WMLONG D,S/#;D,S/#;D,S/#;D,S/#/PTRx -- -- -- -- CCCC 1010101 CZ I DDDDDDDDD SSSSSSSSS CALLD D,S/#rel9 CZ CCCC 101011f CZ I DDDDDDDDD SSSSSSSSS RDPIN RDLUT D,S/# CZ CZ CCCC 10110ff CZ I DDDDDDDDD SSSSSSSSS RDBYTE RDWORD RDLONG ******* D,S/#/PTRx CZ CZ CZ CZ CCCC 1011011 ff I DDDDDDDDD SSSSSSSSS ADDPIX MULPIX BLNPIX MIXPIX D,S/# -- -- -- -- CCCC 101110f fL I DDDDDDDDD SSSSSSSSS <empty> <empty> JP JNP D/#,S/#;D/#,S/#;D/#,S/#rel9;D/#,S/#rel9 -- -- -- -- CCCC 101111f fL I DDDDDDDDD SSSSSSSSS SETPAE SETPAN SETPBE SETPBN D/#,S/# -- -- -- -- CCCC 110000f fL I DDDDDDDDD SSSSSSSSS WRPIN WXPIN WYPIN WRLUT D/#,S/# -- -- -- -- CCCC 110001f fL I DDDDDDDDD SSSSSSSSS WRBYTE WRWORD WRLONG RDFAST D/#,S/#/PTRx;D/#,S/#/PTRx;D/#,S/#/PTRx;D/#,S/# -- -- -- -- CCCC 1100100 fL I DDDDDDDDD SSSSSSSSS WRFAST FBLOCK D/#,S/# -- -- CCCC 1100101 fL I DDDDDDDDD SSSSSSSSS XINIT XZERO D/#,S/# -- -- CCCC 1100110 fL I DDDDDDDDD SSSSSSSSS XCONT REP D/#,S/# -- -- CCCC 1100111 CL I DDDDDDDDD SSSSSSSSS COGINIT D/#,S/# C- CCCC 110100f fL I DDDDDDDDD SSSSSSSSS QMUL QDIV QFRAC QSQRT D/#,S/# -- -- -- -- CCCC 1101010 fL I DDDDDDDDD SSSSSSSSS QROTATE QVECTOR D/#,S/# -- -- ---------------------------------------------------------------------------------------------------------------------------------------- CCCC 1101011 CZ L DDDDDDDDD 0000000ff CLKSET COGID <empty> COGSTOP D/# CZ CZ CZ -- CCCC 1101011 CZ 0 DDDDDDDDD 0000001ff LOCKNEW LOCKRET LOCKCLR LOCKSET D;D/#;D/#;D/# CZ -- C- C- CCCC 1101011 CZ L DDDDDDDDD 0000010ff <empty> <empty> <empty> <empty> D/# CZ CZ CZ CZ CCCC 1101011 CZ L DDDDDDDDD 0000011ff <empty> <empty> QLOG QEXP D/# CZ CZ -- -- CCCC 1101011 CZ 0 DDDDDDDDD 0000100ff RFBYTE RFWORD RFLONG WFBYTE D;D;D;D/# CZ CZ CZ -- CCCC 1101011 00 L DDDDDDDDD 0000101ff WFWORD WFLONG SETQ SETQ2 D/# -- -- -- -- CCCC 1101011 CZ 0 DDDDDDDDD 0000110ff GETQX GETQY GETCT GETRND D CZ CZ -- CZ CCCC 1101011 00 L DDDDDDDDD 0000111ff SETDACS SETXFRQ GETXCOS GETXSIN D/#;D/#;D;D -- -- -- -- CCCC 1101011 00 L DDDDDDDDD 0001000ff SETEDG SETRDL SETWRL SETHLK D/# -- -- -- -- ---------------------------------------------------------------------------------------------------------------------------------------- CCCC 1101011 C0 0 0000000ff 000100100 POLLINT POLLCT1 POLLCT2 POLLCT3 C- C- C- C- CCCC 1101011 C0 0 0000001ff 000100100 POLLEDG POLLPAT POLLRDL POLLWRL C- C- C- C- CCCC 1101011 C0 0 0000010ff 000100100 POLLXMT POLLXFI POLLXRO POLLXRL C- C- C- C- CCCC 1101011 C0 0 0000011ff 000100100 POLLFBW POLLHLK POLLATN POLLQMT C- C- C- C- CCCC 1101011 C0 0 0000100ff 000100100 WAITINT WAITCT1 WAITCT2 WAITCT3 C- C- C- C- CCCC 1101011 C0 0 0000101ff 000100100 WAITEDG WAITPAT WAITRDL WAITWRL C- C- C- C- CCCC 1101011 C0 0 0000110ff 000100100 WAITXMT WAITXFI WAITXRO WAITXRL C- C- C- C- CCCC 1101011 C0 0 0000111ff 000100100 WAITFBW WAITHLK WAITATN <empty> C- C- C- CZ CCCC 1101011 00 0 0001000ff 000100100 ALLOWI STALLI <empty> <empty> -- -- CZ CZ CCCC 1101011 CZ 0 0001001ff 000100100 <empty> <empty> <empty> <empty> CZ CZ CZ CZ ---------------------------------------------------------------------------------------------------------------------------------------- CCCC 1101011 00 L DDDDDDDDD 0001001ff ******* SETINT1 SETINT2 SETINT3 -;D/#;D/#;D/# -- -- -- -- CCCC 1101011 00 L DDDDDDDDD 0001010ff WAITX SETCZ PUSH POP D/#;D/#;D/#;D -- CZ -- CZ CCCC 1101011 CZ 0 DDDDDDDDD 0001011ff JMP CALL CALLA CALLB D CZ CZ CZ CZ CCCC 1101011 00 L DDDDDDDDD 0001100ff JMPREL RET RETA RETB D/#;-;-;- -- CZ CZ CZ CCCC 1101011 00 0 DDDDDDDDD 0001101ff GETPTR GETINT SETBRK SETLUT D;D;D/#;D/# -- -- -- -- CCCC 1101011 00 L DDDDDDDDD 0001110ff SETCY SETCI SETCQ SETCFRQ D/# -- -- -- -- CCCC 1101011 00 L DDDDDDDDD 0001111ff SETCMOD SETPIX SETPIV COGATN D/# -- -- -- -- ---------------------------------------------------------------------------------------------------------------------------------------- CCCC 11011ff Rn n nnnnnnnnn nnnnnnnnn JMP CALL CALLA CALLB #abs/#rel -- -- -- -- CCCC 1110fww Rn n nnnnnnnnn nnnnnnnnn CALLD LOC reg,#abs/#rel -- -- CCCC 1111fnn nn n nnnnnnnnn nnnnnnnnn AUGS AUGD #23bits -- -- ---------------------------------------------------------------------------------------------------------------------------------------- COG REGISTERS ------------------------------------------------- _IJMP3 = $1F0 '' COG Interrupt Jump 3 _IRET3 = $1F1 '' COG Interrupt Return 3 _IJMP2 = $1F2 '' COG Interrupt Jump 2 _IRET2 = $1F3 '' COG Interrupt Return 2 _IJMP1 = $1F4 '' COG Interrupt Jump 1 _IRET1 = $1F5 '' COG Interrupt Return 1 _ADDRA = $1F6 '' COG ADDR A _ADDRB = $1F7 '' COG ADDR B _PTRA = $1F8 '' COG PTR A _PTRB = $1F9 '' COG PTR B _DIRA = $1FA '' COG DIR A _DIRB = $1FB '' COG DIR B _OUTA = $1FC '' COG OUT A _OUTB = $1FD '' COG OUT B _INA = $1FE '' COG IN A / Debug JMP _INB = $1FF '' COG IN B / Debug RET -------------------------------------------------
Below are some further instruction opcode suggestions (includes those from above again)...
Propeller P16X64A Instruction Suggestions v10a 17Jun2016 Mod1 ---------------------------------------------------------------------------------------------------------------------------------------- Cond Opcode CZ I Dest Source Instr00 01 10 11 Operand(s) Flags ======================================================================================================================================== CCCC 0111000 ff I DDDDDDDDD SSSSSSSSS ALTI ALTR ALTD ALTS D,S/# -- -- -- -- CCCC 0111001 CZ I DDDDDDDDD SSSSSSSSS DECOD D,S/# CZ CCCC 011101f CZ I DDDDDDDDD SSSSSSSSS TOPONE BOTONE D,S/# CZ CZ CCCC 011110f CZ I DDDDDDDDD SSSSSSSSS INCMOD DECMOD D,S/# CZ CZ CCCC 011111f fZ I DDDDDDDDD SSSSSSSSS MUL MULS SCLU SCL D,S/# -Z -Z -Z -Z replace with CCCC 01110ff CZ I DDDDDDDDD SSSSSSSSS TOPONE BOTONE INCMOD DECMOD D,S/# CZ CZ CZ CZ CCCC 01111ff CZ I DDDDDDDDD SSSSSSSSS TESTN TEST ANYB TESTB D,S/# CZ CZ CZ CZ ======================================================================================================================================== CCCC 10100ff CZ I DDDDDDDDD SSSSSSSSS TESTN TEST ANYB TESTB D,S/# CZ CZ CZ CZ replace with CCCC 1010000 ff I DDDDDDDDD SSSSSSSSS ALTI ALTR ALTD ALTS D,S/# -- -- -- -- CCCC 1010001 CZ I DDDDDDDDD SSSSSSSSS DECOD D,S/# CZ CCCC 101001f fZ I DDDDDDDDD SSSSSSSSS MUL MULS SCLU SCL D,S/# -Z -Z -Z -Z ======================================================================================================================================== CCCC 1101011 CZ 0 0001001ff 000100100 <empty> <empty> <empty> <empty> CZ CZ CZ CZ CCCC 1101011 00 L DDDDDDDDD 0001100ff JMPREL RET RETA RETB D/#;-;-;- -- CZ CZ CZ replace with CCCC 1101011 CZ 0 0001001ff 000100100 <empty> RET RETA RETB CZ CZ CZ CZ CCCC 1101011 00 L DDDDDDDDD 0001100ff JMPREL <empty> <empty> <empty> D/# -- CZ CZ CZ ======================================================================================================================================== CCCC 1101011 C0 0 0000000ff 000100100 POLLINT POLLCT1 POLLCT2 POLLCT3 C- C- C- C- CCCC 1101011 C0 0 0000001ff 000100100 POLLEDG POLLPAT POLLRDL POLLWRL C- C- C- C- CCCC 1101011 C0 0 0000010ff 000100100 POLLXMT POLLXFI POLLXRO POLLXRL C- C- C- C- CCCC 1101011 C0 0 0000011ff 000100100 POLLFBW POLLHLK POLLATN POLLQMT C- C- C- C- CCCC 1101011 C0 0 0000100ff 000100100 WAITINT WAITCT1 WAITCT2 WAITCT3 C- C- C- C- CCCC 1101011 C0 0 0000101ff 000100100 WAITEDG WAITPAT WAITRDL WAITWRL C- C- C- C- CCCC 1101011 C0 0 0000110ff 000100100 WAITXMT WAITXFI WAITXRO WAITXRL C- C- C- C- CCCC 1101011 C0 0 0000111ff 000100100 WAITFBW WAITHLK WAITATN <empty> C- C- C- CZ CCCC 1101011 00 0 0001000ff 000100100 ALLOWI STALLI <empty> <empty> -- -- CZ CZ CCCC 1101011 CZ 0 0001001ff 000100100 <empty> RET RETA RETB CZ CZ CZ CZ replace with CCCC 1101011 C0 0 0000000ff 001000000 POLLINT POLLCT1 POLLCT2 POLLCT3 C- C- C- C- CCCC 1101011 C0 0 0000001ff 001000000 POLLEDG POLLPAT POLLRDL POLLWRL C- C- C- C- CCCC 1101011 C0 0 0000010ff 001000000 POLLXMT POLLXFI POLLXRO POLLXRL C- C- C- C- CCCC 1101011 C0 0 0000011ff 001000000 POLLFBW POLLHLK POLLATN POLLQMT C- C- C- C- CCCC 1101011 C0 0 0000100ff 001000000 WAITINT WAITCT1 WAITCT2 WAITCT3 C- C- C- C- CCCC 1101011 C0 0 0000101ff 001000000 WAITEDG WAITPAT WAITRDL WAITWRL C- C- C- C- CCCC 1101011 C0 0 0000110ff 001000000 WAITXMT WAITXFI WAITXRO WAITXRL C- C- C- C- CCCC 1101011 C0 0 0000111ff 001000000 WAITFBW WAITHLK WAITATN <empty> C- C- C- CZ CCCC 1101011 00 0 0001000ff 001000000 ALLOWI STALLI <empty> <empty> -- -- CZ CZ CCCC 1101011 CZ 0 0001001ff 001000000 <empty> RET RETA RETB CZ CZ CZ CZ and CCCC 1101011 00 L DDDDDDDDD 0001001ff ******* SETINT1 SETINT2 SETINT3 -;D/#;D/#;D/# -- -- -- -- becomes CCCC 1101011 00 L DDDDDDDDD 0001001ff <empty> SETINT1 SETINT2 SETINT3 D/# -- -- -- -- ========================================================================================================================================
The result is in the following post.Propeller P16X64A Instruction Suggestions v10a 17Jun2016 Mod1 ---------------------------------------------------------------------------------------------------------------------------------------- Cond Opcode CZ I Dest Source Instr00 01 10 11 Operand(s) Flags ---------------------------------------------------------------------------------------------------------------------------------------- CCCC 00000ff CZ I DDDDDDDDD SSSSSSSSS ROR ROL SHR SHL D,S/# CZ CZ CZ CZ CCCC 00001ff CZ I DDDDDDDDD SSSSSSSSS RCR RCL SAR SAL D,S/# CZ CZ CZ CZ CCCC 00010ff CZ I DDDDDDDDD SSSSSSSSS ADD ADDX ADDS ADDSX D,S/# CZ CZ CZ CZ CCCC 00011ff CZ I DDDDDDDDD SSSSSSSSS SUB SUBX SUBS SUBSX D,S/# CZ CZ CZ CZ CCCC 00100ff CZ I DDDDDDDDD SSSSSSSSS CMP CMPX CMPS CMPSX D,S/# CZ CZ CZ CZ CCCC 00101ff CZ I DDDDDDDDD SSSSSSSSS CMPR CMPM SUBR CMPSUB D,S/# CZ CZ CZ CZ CCCC 00110ff CZ I DDDDDDDDD SSSSSSSSS MIN MAX MINS MAXS D,S/# CZ CZ CZ CZ CCCC 00111ff CZ I DDDDDDDDD SSSSSSSSS SUMC SUMNC SUMZ SUMNZ D,S/# CZ CZ CZ CZ CCCC 01000ff CZ I DDDDDDDDD SSSSSSSSS ISOB NOTB CLRB SETB D,S/# CZ CZ CZ CZ CCCC 01001ff CZ I DDDDDDDDD SSSSSSSSS SETBC SETBNC SETBZ SETBNZ D,S/# CZ CZ CZ CZ CCCC 01010ff CZ I DDDDDDDDD SSSSSSSSS ANDN AND OR XOR D,S/# CZ CZ CZ CZ CCCC 01011ff CZ I DDDDDDDDD SSSSSSSSS MUXC MUXNC MUXZ MUXNZ D,S/# CZ CZ CZ CZ CCCC 01100ff CZ I DDDDDDDDD SSSSSSSSS MOV NOT ABS NEG D,S/# CZ CZ CZ CZ CCCC 01101ff CZ I DDDDDDDDD SSSSSSSSS NEGC NEGNC NEGZ NEGNZ D,S/# CZ CZ CZ CZ CCCC 01110ff CZ I DDDDDDDDD SSSSSSSSS TOPONE BOTONE INCMOD DECMOD D,S/# CZ CZ CZ CZ CCCC 01111ff CZ I DDDDDDDDD SSSSSSSSS TESTN TEST ANYB TESTB D,S/# CZ CZ CZ CZ ---------------------------------------------------------------------------------------------------------------------------------------- CCCC 1000ffn nn I DDDDDDDDD SSSSSSSSS SETNIB GETNIB ROLNIB ******* D,S/#,#n -- -- -- -- CCCC 100011f nn I DDDDDDDDD SSSSSSSSS SETBYTE GETBYTE D,S/#,#n -- -- CCCC 1001000 nn I DDDDDDDDD SSSSSSSSS ROLBYTE D,S/#,#n -- CCCC 1001001 fn I DDDDDDDDD SSSSSSSSS SETWORD GETWORD D,S/#,#n -- -- CCCC 1001010 0n I DDDDDDDDD SSSSSSSSS ROLWORD D,S/#,#n -- CCCC 1001010 1f I DDDDDDDDD SSSSSSSSS SETBYTS MOVBYTS D,S/# -- -- CCCC 1001011 ff I DDDDDDDDD SSSSSSSSS SPLITB MERGEB SPLITW MERGEW D,S/# -- -- -- -- CCCC 1001100 ff I DDDDDDDDD SSSSSSSSS SEUSSF SEUSSR RGBSQZ RGBEXP D,S/# -- -- -- -- CCCC 1001101 ff I DDDDDDDDD SSSSSSSSS REV SETI SETD SETS D,S/# -- -- -- -- CCCC 1001110 ff I DDDDDDDDD SSSSSSSSS DJZ DJNZ DJS DJNS D,S/#rel9 -- -- -- -- CCCC 1001111 ff I DDDDDDDDD SSSSSSSSS TJZ TJNZ TJS TJNS D,S/#rel9 -- -- -- -- CCCC 1010000 ff I DDDDDDDDD SSSSSSSSS ALTI ALTR ALTD ALTS D,S/# -- -- -- -- CCCC 1010001 CZ I DDDDDDDDD SSSSSSSSS DECOD D,S/# CZ CCCC 101001f fZ I DDDDDDDDD SSSSSSSSS MUL MULS SCLU SCL D,S/# -Z -Z -Z -Z CCCC 1010100 ff I DDDDDDDDD SSSSSSSSS ADDCT1 ADDCT2 ADDCT3 WMLONG D,S/#;D,S/#;D,S/#;D,S/#/PTRx -- -- -- -- CCCC 1010101 CZ I DDDDDDDDD SSSSSSSSS CALLD D,S/#rel9 CZ CCCC 101011f CZ I DDDDDDDDD SSSSSSSSS RDPIN RDLUT D,S/# CZ CZ CCCC 10110ff CZ I DDDDDDDDD SSSSSSSSS RDBYTE RDWORD RDLONG ******* D,S/#/PTRx CZ CZ CZ -- CCCC 1011011 ff I DDDDDDDDD SSSSSSSSS ADDPIX MULPIX BLNPIX MIXPIX D,S/# -- -- -- -- CCCC 101110f fL I DDDDDDDDD SSSSSSSSS <empty> <empty> JP JNP D/#,S/#;D/#,S/#;D/#,S/#rel9;D/#,S/#rel9 -- -- -- -- CCCC 101111f fL I DDDDDDDDD SSSSSSSSS SETPAE SETPAN SETPBE SETPBN D/#,S/# -- -- -- -- CCCC 110000f fL I DDDDDDDDD SSSSSSSSS WRPIN WXPIN WYPIN WRLUT D/#,S/# -- -- -- -- CCCC 110001f fL I DDDDDDDDD SSSSSSSSS WRBYTE WRWORD WRLONG RDFAST D/#,S/#/PTRx;D/#,S/#/PTRx;D/#,S/#/PTRx;D/#,S/# -- -- -- -- CCCC 1100100 fL I DDDDDDDDD SSSSSSSSS WRFAST FBLOCK D/#,S/# -- -- CCCC 1100101 fL I DDDDDDDDD SSSSSSSSS XINIT XZERO D/#,S/# -- -- CCCC 1100110 fL I DDDDDDDDD SSSSSSSSS XCONT REP D/#,S/# -- -- CCCC 1100111 CL I DDDDDDDDD SSSSSSSSS COGINIT D/#,S/# C- CCCC 110100f fL I DDDDDDDDD SSSSSSSSS QMUL QDIV QFRAC QSQRT D/#,S/# -- -- -- -- CCCC 1101010 fL I DDDDDDDDD SSSSSSSSS QROTATE QVECTOR D/#,S/# -- -- ---------------------------------------------------------------------------------------------------------------------------------------- CCCC 1101011 CZ L DDDDDDDDD 0000000ff CLKSET COGID <empty> COGSTOP D/# CZ CZ CZ -- CCCC 1101011 CZ 0 DDDDDDDDD 0000001ff LOCKNEW LOCKRET LOCKCLR LOCKSET D;D/#;D/#;D/# CZ -- C- C- CCCC 1101011 CZ L DDDDDDDDD 0000010ff <empty> <empty> <empty> <empty> D/# CZ CZ CZ CZ CCCC 1101011 CZ L DDDDDDDDD 0000011ff <empty> <empty> QLOG QEXP D/# CZ CZ -- -- CCCC 1101011 CZ 0 DDDDDDDDD 0000100ff RFBYTE RFWORD RFLONG WFBYTE D;D;D;D/# CZ CZ CZ -- CCCC 1101011 00 L DDDDDDDDD 0000101ff WFWORD WFLONG SETQ SETQ2 D/# -- -- -- -- CCCC 1101011 CZ 0 DDDDDDDDD 0000110ff GETQX GETQY GETCT GETRND D CZ CZ -- CZ CCCC 1101011 00 L DDDDDDDDD 0000111ff SETDACS SETXFRQ GETXCOS GETXSIN D/#;D/#;D;D -- -- -- -- CCCC 1101011 00 L DDDDDDDDD 0001000ff SETEDG SETRDL SETWRL SETHLK D/# -- -- -- -- CCCC 1101011 00 L DDDDDDDDD 0001001ff <empty> SETINT1 SETINT2 SETINT3 D/# -- -- -- -- CCCC 1101011 00 L DDDDDDDDD 0001010ff WAITX SETCZ PUSH POP D/#;D/#;D/#;D -- CZ -- CZ CCCC 1101011 CZ 0 DDDDDDDDD 0001011ff JMP CALL CALLA CALLB D CZ CZ CZ CZ CCCC 1101011 00 L DDDDDDDDD 0001100ff JMPREL <empty> <empty> <empty> D/# -- CZ CZ CZ CCCC 1101011 00 0 DDDDDDDDD 0001101ff GETPTR GETINT SETBRK SETLUT D;D;D/#;D/# -- -- -- -- CCCC 1101011 00 L DDDDDDDDD 0001110ff SETCY SETCI SETCQ SETCFRQ D/# -- -- -- -- CCCC 1101011 00 L DDDDDDDDD 0001111ff SETCMOD SETPIX SETPIV COGATN D/# -- -- -- -- ---------------------------------------------------------------------------------------------------------------------------------------- CCCC 1101011 C0 0 0000000ff 001000000 POLLINT POLLCT1 POLLCT2 POLLCT3 C- C- C- C- CCCC 1101011 C0 0 0000001ff 001000000 POLLEDG POLLPAT POLLRDL POLLWRL C- C- C- C- CCCC 1101011 C0 0 0000010ff 001000000 POLLXMT POLLXFI POLLXRO POLLXRL C- C- C- C- CCCC 1101011 C0 0 0000011ff 001000000 POLLFBW POLLHLK POLLATN POLLQMT C- C- C- C- CCCC 1101011 C0 0 0000100ff 001000000 WAITINT WAITCT1 WAITCT2 WAITCT3 C- C- C- C- CCCC 1101011 C0 0 0000101ff 001000000 WAITEDG WAITPAT WAITRDL WAITWRL C- C- C- C- CCCC 1101011 C0 0 0000110ff 001000000 WAITXMT WAITXFI WAITXRO WAITXRL C- C- C- C- CCCC 1101011 C0 0 0000111ff 001000000 WAITFBW WAITHLK WAITATN <empty> C- C- C- CZ CCCC 1101011 00 0 0001000ff 001000000 ALLOWI STALLI <empty> <empty> -- -- CZ CZ CCCC 1101011 CZ 0 0001001ff 001000000 <empty> RET RETA RETB CZ CZ CZ CZ ---------------------------------------------------------------------------------------------------------------------------------------- CCCC 11011ff Rn n nnnnnnnnn nnnnnnnnn JMP CALL CALLA CALLB #abs/#rel -- -- -- -- CCCC 1110fww Rn n nnnnnnnnn nnnnnnnnn CALLD LOC reg,#abs/#rel -- -- CCCC 1111fnn nn n nnnnnnnnn nnnnnnnnn AUGS AUGD #23bits -- -- ----------------------------------------------------------------------------------------------------------------------------------------
What's the diff between ******* and <empty>?
For example, the ******* in the SETNIB/GETNIB/ROLNIB/******* is divided into the next line SETBYTE/GETBYTE. So therefore
ff=00 = SETNIB
ff=01 = GETNIB
ff=10 = ROLNIB
ff=11 = SETBYTE if instr[0]=0, GETBYTE if instr[0]=1
<empty> means the opcode if available. ie not used.
The second group (SETNIB...QVECTOR)
---------------------------------------------------------------------------------------------------------------------------------------- Cond Opcode CZ I Dest Source Instr00 01 10 11 Operand(s) Flags ======================================================================================================================================== CCCC 1000ffn nn I DDDDDDDDD SSSSSSSSS SETNIB GETNIB ROLNIB ******* D,S/#,#n -- -- -- -- CCCC 100011f nn I DDDDDDDDD SSSSSSSSS SETBYTE GETBYTE D,S/#,#n -- -- CCCC 1001000 nn I DDDDDDDDD SSSSSSSSS ROLBYTE D,S/#,#n -- CCCC 1001001 fn I DDDDDDDDD SSSSSSSSS SETWORD GETWORD D,S/#,#n -- -- CCCC 1001010 0n I DDDDDDDDD SSSSSSSSS ROLWORD D,S/#,#n -- CCCC 1001010 1f I DDDDDDDDD SSSSSSSSS SETBYTS MOVBYTS D,S/# -- -- CCCC 1001011 ff I DDDDDDDDD SSSSSSSSS SPLITB MERGEB SPLITW MERGEW D,S/# -- -- -- -- CCCC 1001100 ff I DDDDDDDDD SSSSSSSSS SEUSSF SEUSSR RGBSQZ RGBEXP D,S/# -- -- -- -- CCCC 1001101 ff I DDDDDDDDD SSSSSSSSS REV SETI SETD SETS D,S/# -- -- -- -- CCCC 1001110 ff I DDDDDDDDD SSSSSSSSS DJZ DJNZ DJS DJNS D,S/#rel9 -- -- -- -- CCCC 1001111 ff I DDDDDDDDD SSSSSSSSS TJZ TJNZ TJS TJNS D,S/#rel9 -- -- -- -- CCCC 1010000 ff I DDDDDDDDD SSSSSSSSS ALTI ALTR ALTD ALTS D,S/# -- -- -- -- CCCC 1010001 CZ I DDDDDDDDD SSSSSSSSS DECOD D,S/# CZ CCCC 101001f fZ I DDDDDDDDD SSSSSSSSS MUL MULS SCLU SCL D,S/# -Z -Z -Z -Z CCCC 1010100 ff I DDDDDDDDD SSSSSSSSS ADDCT1 ADDCT2 ADDCT3 WMLONG D,S/#;D,S/#;D,S/#;D,S/#/PTRx -- -- -- -- CCCC 1010101 CZ I DDDDDDDDD SSSSSSSSS CALLD D,S/#rel9 CZ CCCC 101011f CZ I DDDDDDDDD SSSSSSSSS RDPIN RDLUT D,S/# CZ CZ CCCC 10110ff CZ I DDDDDDDDD SSSSSSSSS RDBYTE RDWORD RDLONG ******* D,S/#/PTRx CZ CZ CZ -- CCCC 1011011 ff I DDDDDDDDD SSSSSSSSS ADDPIX MULPIX BLNPIX MIXPIX D,S/# -- -- -- -- CCCC 101110f fL I DDDDDDDDD SSSSSSSSS <empty> <empty> JP JNP D/#,S/#;D/#,S/#;D/#,S/#rel9;D/#,S/#rel9 -- -- -- -- CCCC 101111f fL I DDDDDDDDD SSSSSSSSS SETPAE SETPAN SETPBE SETPBN D/#,S/# -- -- -- -- CCCC 110000f fL I DDDDDDDDD SSSSSSSSS WRPIN WXPIN WYPIN WRLUT D/#,S/# -- -- -- -- CCCC 110001f fL I DDDDDDDDD SSSSSSSSS WRBYTE WRWORD WRLONG RDFAST D/#,S/#/PTRx;D/#,S/#/PTRx;D/#,S/#/PTRx;D/#,S/# -- -- -- -- CCCC 1100100 fL I DDDDDDDDD SSSSSSSSS WRFAST FBLOCK D/#,S/# -- -- CCCC 1100101 fL I DDDDDDDDD SSSSSSSSS XINIT XZERO D/#,S/# -- -- CCCC 1100110 fL I DDDDDDDDD SSSSSSSSS XCONT REP D/#,S/# -- -- CCCC 1100111 CL I DDDDDDDDD SSSSSSSSS COGINIT D/#,S/# C- CCCC 110100f fL I DDDDDDDDD SSSSSSSSS QMUL QDIV QFRAC QSQRT D/#,S/# -- -- -- -- CCCC 1101010 fL I DDDDDDDDD SSSSSSSSS QROTATE QVECTOR D/#,S/# -- -- ========================================================================================================================================
Could be re-ordered to something like the following. Whether it is worth doing is questionable.---------------------------------------------------------------------------------------------------------------------------------------- Cond Opcode CZ I Dest Source Instr00 01 10 11 Operand(s) Flags ---------------------------------------------------------------------------------------------------------------------------------------- CCCC 1000ffn nn I DDDDDDDDD SSSSSSSSS SETNIB GETNIB ROLNIB ******* D,S/#,#n -- -- -- -- CCCC 100011f nn I DDDDDDDDD SSSSSSSSS SETBYTE GETBYTE D,S/#,#n -- -- CCCC 1001000 nn I DDDDDDDDD SSSSSSSSS ROLBYTE D,S/#,#n -- CCCC 1001001 fn I DDDDDDDDD SSSSSSSSS SETWORD GETWORD D,S/#,#n -- -- CCCC 1001010 0n I DDDDDDDDD SSSSSSSSS ROLWORD D,S/#,#n -- CCCC 1001010 1f I DDDDDDDDD SSSSSSSSS SETBYTS MOVBYTS D,S/# -- -- CCCC 1001011 CZ I DDDDDDDDD SSSSSSSSS DECOD D,S/# CZ CCCC 1001100 CZ I DDDDDDDDD SSSSSSSSS CALLD D,S/#rel9 CZ CCCC 1001101 CL I DDDDDDDDD SSSSSSSSS COGINIT D/#,S/# C- CCCC 100111f CZ I DDDDDDDDD SSSSSSSSS RDPIN RDLUT D,S/# CZ CZ CCCC 1010000 ff I DDDDDDDDD SSSSSSSSS REV SETI SETD SETS D,S/# -- -- -- -- CCCC 1010001 ff I DDDDDDDDD SSSSSSSSS ALTI ALTR ALTD ALTS D,S/# -- -- -- -- CCCC 1010010 ff I DDDDDDDDD SSSSSSSSS SPLITB MERGEB SPLITW MERGEW D,S/# -- -- -- -- CCCC 1010011 ff I DDDDDDDDD SSSSSSSSS SEUSSF SEUSSR RGBSQZ RGBEXP D,S/# -- -- -- -- CCCC 1010100 ff I DDDDDDDDD SSSSSSSSS ADDPIX MULPIX BLNPIX MIXPIX D,S/# -- -- -- -- CCCC 1010101 ff I DDDDDDDDD SSSSSSSSS ADDCT1 ADDCT2 ADDCT3 WMLONG D,S/#;D,S/#;D,S/#;D,S/#/PTRx -- -- -- -- CCCC 1010110 ff I DDDDDDDDD SSSSSSSSS DJZ DJNZ DJS DJNS D,S/#rel9 -- -- -- -- CCCC 1010111 ff I DDDDDDDDD SSSSSSSSS TJZ TJNZ TJS TJNS D,S/#rel9 -- -- -- -- CCCC 101100f fL I DDDDDDDDD SSSSSSSSS JP JNP <empty> <empty> D/#,S/#rel9 -- -- -- -- CCCC 101101f fL I DDDDDDDDD SSSSSSSSS SETPAE SETPAN SETPBE SETPBN D/#,S/# -- -- -- -- CCCC 101110f fL I DDDDDDDDD SSSSSSSSS WRPIN WXPIN WYPIN WRLUT D/#,S/# -- -- -- -- CCCC 101111f fL I DDDDDDDDD SSSSSSSSS WRBYTE WRWORD WRLONG RDFAST D/#,S/#/PTRx;D/#,S/#/PTRx;D/#,S/#/PTRx;D/#,S/# -- -- -- -- CCCC 110000f fL I DDDDDDDDD SSSSSSSSS WRFAST FBLOCK QROTATE QVECTOR D/#,S/# -- -- -- -- CCCC 110001f fL I DDDDDDDDD SSSSSSSSS QMUL QDIV QFRAC QSQRT D/#,S/# -- -- -- -- CCCC 110010f fL I DDDDDDDDD SSSSSSSSS XINIT XZERO XCONT REP D/#,S/# -- -- -- -- CCCC 110011f fZ I DDDDDDDDD SSSSSSSSS MUL MULS SCLU SCL D,S/# -Z -Z -Z -Z CCCC 11010ff CZ I DDDDDDDDD SSSSSSSSS RDBYTE RDWORD RDLONG ******* D,S/#/PTRx CZ CZ CZ -- ----------------------------------------------------------------------------------------------------------------------------------------
The remaining sections seem fine.Any chance on getting some documentation on the following instructions.
CCCC 1011011 00I DDDDDDDDD SSSSSSSSS ADDPIX D,S/# CCCC 1011011 01I DDDDDDDDD SSSSSSSSS MULPIX D,S/# CCCC 1011011 10I DDDDDDDDD SSSSSSSSS BLNPIX D,S/# CCCC 1011011 11I DDDDDDDDD SSSSSSSSS MIXPIX D,S/# CCCC 1101011 00L DDDDDDDDD 000111101 SETPIX D/# CCCC 1101011 00L DDDDDDDDD 000111110 SETPIV D/#
I tried a few experiments attempting to work out how they work and this is what I found so far.
ADDPIX seems to add the pixel bytes together and if the 8 bit add overflows the resultant pixel byte is set to $FF
MULPIX appears to multiply the pixel bytes and stores the scaled pixel bytes.
MIXPIX and BLNPIX seem to be affected by the contents of the SETPIX value?
Any other pixel freaks out there played with these yet?
Looks like it should be the same in the new P2?
PIXEL MIXER ----------- Each cog has a pixel mixer called MIX that can combine two pixels in a sum-of-products operation, where: inputs: DA = D pixel A component (8 bits) DR = D pixel R component (8 bits) DG = D pixel G component (8 bits) DB = D pixel B component (8 bits) SA = S pixel A component or GETPIX A' component (8 bits) SR = S pixel R component or GETPIX R' component (8 bits) SG = S pixel G component or GETPIX G' component (8 bits) SB = S pixel B component or GETPIX B' component (8 bits) outputs: A' = ((DA * DAX + SA * SAX + 255) / 256) max 255 R' = ((DR * DRX + SR * SRX + 255) / 256) max 255 G' = ((DG * DGX + SG * SGX + 255) / 256) max 255 B' = ((DB * DBX + SB * SBX + 255) / 256) max 255 The DAX/DRX/DGX/DBX/SAX/SRX/SGX/SBX terms determine the type of mixing that will be done. The terms are configurable for the MIXPIX/GETPIX instructions, but fixed for the others: ADDPIX D,S/# - Add and clamp A:R:G:B components into D DAX = $FF SAX = $FF DRX = $FF SRX = $FF DGX = $FF SGX = $FF DBX = $FF SBX = $FF MULPIX D,S/# - Multiply A:R:G:B components into D DAX = SA SAX = $00 DRX = SR SRX = $00 DGX = SG SGX = $00 DBX = SB SBX = $00 BLNPIX D,S/# - Blend A:R:G:B components by SA into D DAX = !SA SAX = SA DRX = !SA SRX = SA DGX = !SA SGX = SA DBX = !SA SBX = SA Here is the general-purpose MIXPIX instruction: MIXPIX D,S/# - Mix A:R:G:B components according to SETMIX into D To configure for MIXPIX/GETPIX usage, the SETMIX instruction is used: SETMIX D/#,S/# - Set MIX configuration to D/#[8..0], S/#[31..0] D/#[8..0] sets M - initialized to $001 * S/#[31..24] sets DAB - initialized to $00 S/#[23..16] sets DCB - initialized to $00 S/#[15..8] sets SAB - initialized to $FF * S/#[7..0] sets SCB - initialized to $00 M[8] = 0 for long mode, where D and S pixels are 8:8:8:8 bit A:R:G:B M[8] = 1 for word mode, where D and S pixels are 1:5:5:5 bit A:R:G:B 1:5:5:5 pixels are expanded so that %A_BCDEF_GHIJK_LMNOP becomes %AAAAAAAA_BCDEFBCD_GHIJKGHI_LMNOPLMN for the mixing computation. When being packed back down to 1:5:5:5 bit A:R:G:B, the single A bit will be 1 if the resultant A was not 0, and the R:G:B fields will be set to the top 5 bits of the resultant R:G:B. In word mode, the low word in D will be operated on and the words will be swapped, leaving the mixed pixel in the new high word and the old high word in the new low word. Also, pixel data from S will be taken alternately from the low and high word with each operation, with SETMIX resetting the selector to the low word. Word mode affects all ADDPIX/MULPIX/BLNPIX/GETMIX/GETPIX. M field 000 001 010 011 100 101 110 111 -------------------------------------------------------------- M[7] DAX = DAB SA M[6..4] DRX = $00 $FF SA !SA DA !DA DCB SR M[6..4] DGX = $00 $FF SA !SA DA !DA DCB SG M[6..4] DBX = $00 $FF SA !SA DA !DA DCB SB -------------------------------------------------------------- M[3] SAX = SAB DA M[2..0] SRX = $00 $FF SA !SA DA !DA SCB DR M[2..0] SGX = $00 $FF SA !SA DA !DA SCB DG M[2..0] SBX = $00 $FF SA !SA DA !DA SCB DB * M and SAB are initialized on cog start so that GETPIX will return the scaled A:R:G:B texture pixel without any blending. The PIXADD/PIXMUL/PIXBLN/PIXMIX instructions all take 2 clocks, while GETPIX takes 3 clocks.
The SETx instructions also requires 2 spacer instruction.
Edit: See here