When I use the code
times 1024-$ db 0
it's supposed to fill the remainder of the output file in question with the value 0x00. For example, if there were 1000 bytes of code before it, then it only needs to write 24 bytes of 0x00, to make the total file size 1024 bytes. But this isn't doing that. It's saying there's an error because it's a non-constant expression. But it IS constant. $ is not something that will change at runtime. It will change as code is written, but it becomes fixed (constant) at the moment of compiling. I can even use this alternative that DOES work
times 1024-$+start db 0
where "start" is the label at the start of my program, and thus has an offset of 0 (making the expression mathematically equivalent to doing 1024-$+0, but guess what literally using 1024-$+0 doesn't work again). I had assumed that numbers and labels were BOTH treated as numeric constants internally by the assembler (and thus any expression consisting of arithmetic involving only constants would itself be a constant), but it seems they aren't. This seems like a bug.