A two-dimensional PIC code aimed at the investigation of electron-cyclotron beam instabilities in gyrotrons and their effects on the beam quality is presented, The code is based on recently developed techniques for handling charge conservation and open boundaries and uses an electromagnetic field which is decomposed in its transverse magnetic (TM) and electric (TE) components, The code has been implemented on the massively parallel computer CRAY T3D, but can also be run on a single processor of the CRAY Y-MP. (C) 1997 Elsevier Science B.V.