That is, operation system would notify our application in pre-determined way if a key was pressed for instance. We also have a bit of a problem finding common grounds in how different systems execute the code. Obviously we would need a function opening and closing the output, and since the way to proceed is to make all drawings into an off-screen buffer and then blit it, there must be a routine to take care of that. Now, the output plane itself would either be a hole physical screen or a window allocated by an operation system. Effectively for us the off-screen buffer would be the video memory.
Few assumptions are to be made about it's format.
Different computers would have screen memory and consequently colourmaps having different formats. Most would support several.