I got a ZX81 (16K) in 1981, it was my first computer, when they seemed amazing just to exist at all. I became quite advanced (moderately) at programming machine code at the time, trying to squeeze as much as possible out of it, even programming things like interrupt service routines, etc. But eventually as time went on I lost interest, and moved on, so haven't done any programming on an '81 since about 1984 at the very latest

A couple of days ago I suddenly got a bizarre urge to program the '81 again. Unfortunately I no longer have mine, so for now an emulator will have to do. I've remembered a surprising amount of Z80 and the machine- some addresses and system variable names seemed to have burned into my memory forever(!) but I am still rather rusty of course. I hope I can ask some questions here as I progress.
I've also set myself the task of writing for the 1K (unexpanded) version (even though I had 16K in the 80s) since this seems a great challenge, having to optimise code by size when every byte counts (I even got lazy with that on 16k, which seemed so much RAM then, haha). I've got a project in mind but don't want to say what it is in case I fail

I'm trying to remember the weird hardware and the internet is some help of course. It seems people on this forum have a very good knowledge, so I'll start with a couple of questions-
Firstly, I know that af', ix and iy are off limits due to the hardware, but can I use the alternate registers bc', de' and hl''?
Another thing I am contemplating is that for my idea, I want to have my code do something on each TV frame, then wait for the screen refresh, then continue, etc. I'm not sure if this is possible, I'm wondering if I can end my code with a HALT followed by a jump back to the start of the loop, that will be triggered by the NMI when the screen starts refreshing? I don't know if I'm being clear here, I'm trying to sychronise my code with the display. Is this going to work?
Anyway, if anyone has any answers, thank you. And hello!