Earlier quoted context omitted.
How do you know it is even close to correct? When I’ve asked it for code, it has been subtly wrong, or worse, correct but missing important edge cases that it doesn’t even seem to be aware of.
Always mention your stack before writing stuff like this - people who write js/ts where every problem that could be done has been done will get very different mileage than, say, people who write C and assembly for some obscure architecture
But out of curiosity, to give it something harder, I asked ChatGPT w/GPT3.5 to write me an interrupt handler for a simple raster effect for the Commodore 64 in 6502 assembly, and it got tantalisingly close while being oh-so-wrong in relatively basic ways which suggests that it hasn't "grasped" how to handle control flow in a language without clearly delineated units.
GPT4 appears to have gotten it right (it's ~30 years since I've done this myself), though the code it wrote was a weird mix of hacks to save the odd cycle followed by blatant cycle wasting stuff that suggest it's still not seen quite enough "proper" C64 demo code.