The mean streets of Times Square circa 1971. Paul Schiraldi

On a cool but sunny August afternoon, Ashley West and April Hall, amateur historians who worked as consultants on the new HBO drama The Deuce, survey the present-day scene of the show’s Times Square setting. On the northwest corner of 42nd Street and 7th Avenue, a gaggle of costumed performers, Elmo, Hello Kitty, and Iron Man among them, ensnare the occasional tourist, posing for pics and pressing for tips. Across the street, in front of the chain arcade Dave & Buster’s, a young girl pets a police horse while her mother snaps a photo. A traffic cop yells at a family whose toddler is teetering a little too close to the edge of the sidewalk: “Get that baby back!”

Suffice it to say, viewers won’t be seeing many babies in The Deuce’s version of New York’s most notorious urban crossroads. West and Hall have spent the past several years spelunking into the seedy Times Square of the 1970s and ’80s, one of the primary sites of the nascent adult-film industry, a subject The Deuce, which premiered on Sunday, explores with curiosity and delight. Back then, New Yorkers avoided Times Square — not to escape the clutches of a six-foot stuffed toy soliciting for sweaty hugs, but to evade the pimps, prostitutes, and pickpockets who became synonymous with Times Square from the late 1960s until the area began its transformation into a Disneyfied tourist mecca in the mid-1990s. When Hall, a native New Yorker, first read that HBO was planning to set its latest drama in the nitty-gritty Times Square of her adolescence, she had a horrible thought: “Oh my god, what if it ends up being like Vinyl?”

Created by George Pelecanos and David Simon, with a writing team that includes Richard Price, Megan Abbott, and Lisa Lutz, The Deuce is a hard-nosed but nuanced look at the rise of the pornography industry as seen through the eyes of police officers, mafia-adjacent nightlife impresarios, sex workers and their pimps, and the journalists trying to capture it all in print. The drama shrewdly avoids the smug romanticizing and cartoonish nostalgia that doomed Vinyl, HBO’s recent one-season wonder that centered on a fictional New York record label in the 1970s. With the cancellation of that series in 2016 — and the impending conclusion of the cable giant’s flagship drama Game of Thrones — HBO needs a meaty new drama to hook hungry Sunday-night viewers. The Deuce delivers.

Like Simon’s beloved HBO epic The Wire, which focused on the drug trade in Baltimore, The Deuce is an affectionate but no-nonsense depiction of an underground industry. Unlike The Wire, however, The Deuce is also a painstakingly detailed period piece that unearths a neglected history, that of the not-quite-legal sex trade and the development of pornography into an immensely profitable, mainstream business. For Simon, who began his writing career as a reporter for the Baltimore Sun, the show is not about the moral question of whether pornography is good or bad; rather, it’s about the moment when “an industry goes from being worth hundreds of thousands of dollars in illicit profit ­— where it’s in a brown paper bag — to being worth billions once it’s loosed from regulation and can exist in plain sight,” he tells the Voice. “That I’m really interested in.”

Like The Wire and Treme, the post-Katrina New Orleans–set drama Simon created for HBO in 2010, The Deuce is based on real people and events. Its first season takes place between 1971 and 1972, the advent of the so-called golden age of porn, when the business of sex was just starting to emerge from the shadows of subculture. Over the course of eight episodes, the season follows twin brothers Vincent and Frankie Martino, both played by executive producer James Franco, who come to manage a brothel; Candy, an entrepreneurial sex worker played by a revelatory Maggie Gyllenhaal; a pair of decent but compromised cops (Lawrence Gilliard Jr. and Don Harvey); a freewheeling college dropout (Margarita Levieva); and the pimps, including those played with peacocking splendor by rappers Method Man of Wu Tang Clan, and Tariq “Black Thought” Trotter of the Roots. The producers have three seasons mapped out, with the series ending in the mid-1980s, HBO-willing.

Simon and Pelecanos were inspired by the story of twin brothers named Steve and Johnny, who owned several mob-fronted bars in midtown in the 1970s. They became aware of the twins through producer Marc Henry Johnson, who met the late Johnny’s daughter through a mutual friend. Johnson persuaded her to make an introduction to Uncle Steve, and after hearing his stories over a round of drinks at a Halloween party, Johnson knew they would be perfect fodder for TV.

The twins became the Martino brothers, who represent one strand of the show’s narrative: how organized crime recognized and exploited the real-estate potential of a crumbling neighborhood…and the financial potential of the sex trade. Like his real-life counterpart, Vincent proves adept at managing his Times Square bar, which quickly becomes a hangout for all walks of life — sex workers, cops, businessmen, transgender people. The crime syndicate backing the bar enlists his expertise in managing a series of “massage parlors.”

Another strand is the story of Eileen “Candy” Merrell (Gyllenhaal), who finds an alternate career path in the burgeoning adult-film industry — both in front of and behind the camera. As with many of the show’s characters, Candy is a composite of real people, including a barmaid who used to work for the twins and who was briefly involved in porn, and pioneering female porn directors like Candida Royalle.

ILLUSTRATIONS BY MATT ROTA

From the start, the producers were intent on representing the show’s sex-worker characters as accurately as possible. That meant enlisting former denizens of the Deuce — an old slang term for the cinema-lined strip of 42nd Street between 7th and 8th Avenues — to recall the glory days of 25-cent peep shows and sticky theater floors. One of those was a former porn star named Annie Sprinkle, a California native who moved to New York as a young woman in 1974 and who described herself as a “paid con-slut-ant” for The Deuce. Sprinkle spoke with Maggie Gyllenhaal about her experiences in the industry, and when Candida Royalle died of ovarian cancer in September 2015, Sprinkle suggested the show’s producers and actors attend a memorial service for her held that November at a church near Washington Square Park.

Gyllenhaal couldn’t make it, but Simon did, along with several other actors who portray sex workers on the show, including the wonderful Dominique Fishback, who plays a young woman from North Carolina navigating her relationship with a fickle pimp. “I can remember one really insightful conversation I had that night with a former actress named Veronica Hart,” Simon says of Royalle’s memorial. “I presumed, like a lot of people in the straight world would presume, that there’s an awful lot of damage on the part of people that end up in either sex work or pornography. And while I remember she acknowledged that, she also said, ‘Be careful of the stereotype.’ I just remember thinking, ‘If I came here for that conversation alone, it was worth it.’ ”

Indeed, many former porn actors — admittedly, the ones who have lived to tell about it — are eager to dispel the common perception of sex-worker-as-tragic-victim. In addition to reviewing each script of The Deuce’s first season, West and Hall have recorded over two hundred interviews, either in podcast or written form, on their website, Rialto Report, named after one of the longest-running porn theaters on 42nd Street. (Don’t bother looking for the Rialto; since razed, it’s been replaced by a Chase Bank branch.) West and Hall hold down day jobs at a Wall Street bank and a marketing firm, respectively; their interest in the seamy world of early porn grew out of a desire to document and preserve a lode of cultural history that’s gone largely unmined.

Many of the performers they’ve interviewed likened their experiences to adventures, and, no, they didn’t all come from broken homes. The Times Square of the 1970s may be remembered for its grime, but Sprinkle spoke fondly of the bright lights, the movie premieres, the pulse — the sense that anything could happen. “It was pretty freaking glamorous,” she says, “when you weren’t stepping in dog shit.”

Another one-time performer who fondly recalls her days in the porn industry is Long Jeanne Silver. Silver — like many porn actors, she changed her name — hitchhiked to New York City from Arizona in 1976, at the age of sixteen, and went from posing nude for a magazine spread to performing in porn movies. “I had, like, iron balls,” she says. “Stupid, crazy, very adventurous, didn’t want to be told that I couldn’t do anything. Very sexual.” She described the community of porn stars and directors in Times Square in the 1970s as a “family.”

Pioneering porn director Carter Stevens (Lickity-Split, Highway Hookers, Cleopatra’s Bondage Revenge) echoed this sentiment: “We were a merry little band of outlaws,” he explains. “We were in that very limited period of time between the invention of the birth control pill and the beginning of AIDS. Sex was carefree,” he says. “We were all into, I guess you could say, sport-fucking.”

Stevens, Silver, and Sprinkle came to New York for the same reason wide-eyed teenagers come to the city today — for adventure and opportunity. But in the cauldron of midtown in the early 1970s, they discovered an intoxicating brew of free-love ethics, relatively lax obscenity laws, and a surprisingly porous boundary between porn and mainstream entertainment. Some actors who performed in sex films were Broadway hoofers; crew members were often aspiring filmmakers or NYU students eager to get experience behind the camera.

One real-life figure The Deuce briefly depicts is Marty Hodas, the so-called “King of the Peeps,” who West says “changed Times Square overnight” with his signature invention, the peep show. In the mid-1960s, Hodas ran a route managing and repairing vending machines. Played on the show by Saul Stein, Hodas began tinkering with old nickelodeon film machines that played children’s cartoons; in 1966, the modern peep show, for which you would enter a private booth and pay a quarter to watch a minute or so of explicit sex, was born. In his book Tales of Times Square, Josh Alan Friedman — who covered the Times Square beat in the 1970s and ’80s for the porn tabloid magazine Screw and other outlets — writes that in the first two months of 1969, 85 percent of the quarters shipped to the Chemical Bank at 42nd and 8th came from Hodas’s machines.

By 1972, Friedman reports, there were more than a thousand peep machines operating in New York City, most of them clustered in Times Square. Looking back, he recalls the hordes of businessmen who’d slip into the peep shows during lunchtime, hanging their heads in shame: “They’d hide their faces with a newspaper, put their hats down low over their face, god forbid they should be seen or caught. It was a degrading experience.” Over the next decade and a half, peep show operators, dirty bookstore proprietors, mob-backed “massage parlor” owners, and sex workers would cycle through a long-running game of whack-a-mole with local police, who were forever under pressure from city officials and business leaders to “clean up” Times Square. Much of the news coverage of the neighborhood focused on crime and corrupted youth (one memorable headline from an April 1974 issue of the New York Times: “To Get to Times Square, Turn Left at Sodom”). The papers fretted over the “Minnesota Strip,” a stretch of 8th Avenue north of Port Authority where pimps would trawl for young girls, or boys, fresh off the bus from the Midwest. The Deuce features one such young woman, Lori (Emily Meade), who arrives at the bus depot from Minneapolis and surprises her new warden with her street savvy; she’s been around the block before, just not this particular block.

Top: The 24-hour Harem porn theater on 42nd Street, circa 1975 Bottom: The present-day site of the Harem, now a Regal cinema flanked by Starbucks and Dallas BBQ franchises Ads courtesy Rialto Report; Harem Theater: Neal Boenzi/The New York Times/Redux; Regal Cinemas: Courtesy Rialto Report

The Times Square of 2017 bears little resemblance to the world of The Deuce. Because so much of Times Square’s original architecture has been replaced with skyscrapers, the show shot its street scenes uptown, on 164th Street, Amsterdam Avenue, and a few other streets in Washington Heights. Using old photographs, the art department dressed the street level to reflect the time period — they dumped so much extra garbage on the sidewalks, the residents had to be assured it would all be picked up at the end of the day — and used CGI for much of the signage and the upper stories of buildings. Budget constraints meant a lot of tight shots, with just enough wider coverage to establish the Times Square locale. As a result, the street scenes achieve a degree of immediacy and verisimilitude that has eluded other contemporary productions set in mid-century New York.

The Deuce caps off its first season with the 1972 premiere of Deep Throat, the first porn film to go mainstream. Johnny Carson joked about it; the Hollywood glitterati flocked to cinemas to see it; newspapers and magazines gave it breathless coverage, all but ensuring the future of porn as a major subset of the entertainment industry. At the time of its debut, however, there wasn’t much to distinguish Deep Throat from any other porno: While reviewing the script for the season finale, West and Hall made sure to note that the premiere wouldn’t have been anything special, no red carpets or klieg lights. In the episode, a disillusioned pimp (Gary Carr) leaves the theater before the movie begins, grumbling that it’s just “another fuck film.” The theater where the film’s premiere took place, on 49th Street between 6th and 7th, is gone, the building replaced by a 37-story glass skyscraper where Barclays Capital is headquartered. On the ground floor, tourists and office workers spoon soup from paper cups at the chain lunch spot Hale and Hearty.

“Listen, the place got monied over,” Simon says. “And if you’re the cultural and financial capital of the universe, you can kind of do that.” Simon fondly recalls visiting New York as a teenager in the 1970s and ’80s. “You felt vulnerable, and also, everything was electric,” he says. Today, you can comfortably walk through Times Square with your kids on your way to The Lion King or the M&M’s Store; what’s now vulnerable are the remnants of the old Times Square, when sex was dirty and hotels rented by the hour or the month, but rarely the night. Unsurprisingly, the city has not made an effort to preserve this slice of its past: There’s no Tenement Museum version of the old Times Square, where people can pay to see a tourist-friendly version of a grim chapter in New York’s history. The mid-afternoon drinkers at the Playwright Celtic Pub on 8th Avenue have no idea they’re sitting in what used to be a gay porn theater. “You can romanticize it all you want but if you’re the mayor of New York right now, you’re damn glad it’s Disney on 42nd Street and not what it was,” Simon says.

“Pioneers in any industry are the ones who get screwed,” says Carter Stevens, the former porn director. “The first ones in never make the money.” In the past forty years, porn has migrated from rat-infested cinemas in city centers to the pockets of everyone with a smartphone and a decent Wi-Fi signal. It’s a global, multi-billion-dollar industry, and anyone hankering for some soft-core sex need only flip on HBO.

For Friedman, the former Times Square reporter, that’s a mixed legacy. “When the staff of Screw magazine went out to dinner in the 1970s, we all drank a toast to sexual repression,” he says. “The guilt, the shame, the legal battles against sex — where would we be without it? Repression kept it dirty, dangerous, and forbidden, which gave rise to the underworld of pornography and the sex industry. And that’s how we made our living.”

The Deuce airs Sundays at 9 p.m. on HBO.