Don't redefine NULL.
Remove the memory trap handler.
All VGA memory reads and writes should already be handled by explicit function calls.