Can't set port 2 output of lpc2387

After trying for 2 days I have exhausted all my ideas on why I can’t get port 2 of my lpc2387 to change. I am just trying to set port 2 to a simple ascii character on p0.0 to p0.7. The instructions work for fast port 0 but not on fast port 2. The instructions are just things I attempted to do that didnot make any diffference. At the end of this code a = the proper 0x1b but z always = 0x0e. And the physical pins show output of 0x0e.

This code is near the start of the program and no other programs have messed with the port set-ups. I also tried using 32 bit instructions but still with the same result.

If anyone can see anything I missed, I would be very appreciative.

regards to all;

SCS = 0x21; //fast io0&1 enabled external clock started

// IO0DIR |= (1<<4); //led to output

FIO0DIR |= (1<<4); //led to output

FIO0CLR0 = (0x10); //LED ON ATEST

FIO0SET0 = (0x10); //BYTE INSTRUCTION works great!

//FIO0CLR = (1<<4); //LED ON ATEST

//FIO0SET = (1<<4); //BYTE INSTRUCTION

// FIO0PIN0 = d; //BYTE INSTRUCTION

// PINSEL4 = 0; //PORT 2 IS GPIO

// FIO2MASK = 0; //ENABLE ALL BITS

// PINMODE4 = 0xaaaaaaaa;

FIO2DIR |= 0x000000ff; //BYTE INSTRUCTION

FIO2CLR0 = 0xFF; //port2 bits 0-7 BYTE INSTRUCTION

FIO2SET0 = 0x1b; //test BYTE INSTRUCTION

//FIO2PIN0 = 0x1b; //BYTE INSTRUCTION

a= FIO2SET0;

z = FIO2PIN0; //TEMP TEST no good

I found my problem. It was caused by my new hardware board. When I switched from the 2148 to the 2387 I failed to realize that the RTCK bit on the 2387 did not just enable the basic jtag like the 2148 but the full trace which was taking over the port 2. Removing my pull down on RTCK still allowed the jtag to function and port 2 to operate in the non-trace mode.