I did the same thing. It was allowed in general, with the correct thought, “if you can code it yourself, you know the content”
I had another “program” that would fail to run but that’s because I wrote notes into it. Doubt that was allowed.
Here in NZ they do a factory reset on your calculator at the start of every exam.
Oh I would have been so pissed. I was programming on my calculator 24/7 instead of my classes.
I wrote a sudoku “editor”
I put that in quotes because I had a grid that could be navigated, arrows moved, storing the numbers, had number entry down. And when it was time to implement the solver, I learned the hard way what p vs np is.