BOSTON — He returned to his South Boston neighborhood after seven years in prison for armed robbery to a warm greeting from James "Whitey" Bulger.

"Welcome home," the reputed gangster told William Shea when they met on a street corner. Then he passed him $500 cash.

During the next decade, Shea worked with Bulger to build a booming cocaine-dealing business, Shea testified Tuesday at Bulger's trial.

But, he said, Bulger created a charade to make it look like he wasn't involved in the operation in order to protect his local reputation. Shea also said his friendly relationship with Bulger took an icy turn after Shea said he wanted out.

"You remember what happened to Bucky Barrett?" Shea said Bulger told him, referring to a safecracker whom prosecutors say Bulger killed.

Bulger has pleaded not guilty to charges against him, which include participating in 19 slayings in the 1970s and '80s while he was allegedly running the notorious Winter Hill Gang. The 83-year-old fled Boston in 1994 and wasn't captured until 2011.

During Tuesday's proceedings, the last day of testimony until Monday, prosecutors also played recorded jailhouse conversations.

During one of the three recordings, Bulger mimics the "rat-tat-tat" sound of a machine gun when speaking about a local bar owner, Edward Connors. Prosecutors say Bulger and his partner, Stephen "The Rifleman" Flemmi, gunned down Connors in a phone booth because they were afraid he'd tie them to the killing of a Bulger rival.

"The guy in the phone booth. Rat-tat-tat!" Bulger says during the 2012 conversation with a relative. He also remarks that someone threw his name "into the mix" about that murder, before making the "rat-tat-tat" sound again.

Earlier Tuesday, Connors' daughter, Karen Smith, who was 7 when her father was killed, gave emotional testimony during which she recalled learning her father was dead by seeing the picture of his sprawled body on TV.

Shea's testimony, by contrast, was at times light-hearted and even nostalgic. Shea was asked to point out Bulger and identified him as "the young fella there," causing Bulger to chuckle.

Shea said he thinks Bulger reached out to him when he got out of prison in 1977 because he was in the 5th Street Crew, a violent South Boston outfit that had tensions with Bulger.

"He was making a sincere effort ... to absorb us," Shea said.

Shea said he later saw a money-making opportunity by reining in drug dealers who were operating independently and taking a cut of their earnings. He approached Bulger, who agreed to the plan, but didn't want to be linked to dealing.

Instead, Shea testified, Bulger would tell people being intimidated by Shea's group to just deal with it, and they'd capitulate.

Bulger later helped him find suppliers as they moved from dealing low-grade marijuana to high-quality cocaine. By the mid-1980s, Shea said, they were making $100,000 a week, and Bulger was getting a $10,000 weekly cut.

Shea said he wanted to get out of operation by 1986 or so, believing he'd earned enough and police were on to him. Bulger objected, saying Shea was essential to the operation. But Shea would leave for Florida for weeks at time, trying to show Bulger things could run without him. After one trip, an agitated Bulger mentioned Barrett.

During one of their last meetings, Bulger, Flemmi and another gang member drove Shea to an empty housing project, where Bulger directed him to a concrete basement.

"I'm thinking he took me down there to frighten me, or whack me, either one," Shea testified.

But after a conversation, Bulger seemed satisfied he could trust Shea, and they walked back upstairs. When Bulger and his crew offered to drive him home, Shea politely declined.

"I said, 'No, I can walk.'"