The total page count is definitely not ignored, it is even used by programs that don't want all of their file to be loaded initially. They will read the necessary fragments later themselves. The bytes in the last page
field may or may not be ignored, depending on OS version. It could also be rounded up to a paragraph or disk sector boundary. You shouldn't depend on a particular behavior and fill it in properly.
Your test code works because it's small and your particular OS has chosen to load enough of it into memory. If you make your program larger than a single page but still specify 1
in the page count
field, probably your code will not be fully loaded and won't work. I tried:
times (32-$+$$) db 0
times (512) nop
mov dx,message
mov ah,09h ; write string ds:dx to stdout
int 21h
int 20h
This fails if page count
is 1, but works if page count
is 2 (used dosbox
for testing).