UPDATE 2017-10-13 09:00 CET:
Still wasn't detecting F18A properly (or, more accurately, failed to detect absence of F18A. That should be fixed now.
UPDATE 2016-04-20 22:00 CET:
Now properly detects and supports F18A firmware version 1.6 and up, instead of only version 1.6
(Hopefully) fixed a screen tearing issue on the F18A on real hardware reported by Rasmus
UPDATE 2015-10-15 12:30 CET:
Fixed bug that lead to garbled graphics on real tms9918a chips and emulators that correctly adher
Correct, the 4k bit is ignored by the F18A and also by the 9938 and later (which is why the 80 column hack ignores it -- 80-column 9938 software often leaves that bit at 0.)
When you're in 4k mode, it's not just masking off the address bits. The 9918A generates not a linear address to the DRAM, but a row address and a column address -- both of these are affected by the 4k mode setting.
If there really was only 4k attached, then yes, you could just mask the address and it would be right,