Monday, August 10, 2009

Upside - Down or Downside - Up?

One major design issue for Haywire has to do with how memory is depicted vertically. Is address zero at the top of the screen, at the bottom, or somewhere else?

Zero at the bottom makes metaphorical sense - down = less, up = more. It is how my high-school math teachers explained trigonometry and Descartes' coordinates. Its seen in many manuals with memory layout diagrams in them too.

On the other hand, most computer frame buffers put zero at the top, as do their graphics APIs. (Its an easy matter to convert between these two schemes by scaling Y by -1). Microsoft does this too, with the added twist of having the topmost line of the image begin at the highest memory address, using what is called a "bottom-up stride".

This means that the program as it is now shows many images upside-down. So I added a flip button, which does not flip everything.

Just what and how I flip has all kinds of implications. The menu is at the top, and mouse motion should be economical, so we want to not have to move the controls. We also want the spectrogram spikes to point up rather than down, and the vertical control to flip.

If I want to, I can have several "skins" built with dialog templates and can move controls around, etc. A related nagging issue has to do with "when I set the controls to an address, how does the screen line-up with that choice? Its like map navigation, you want to jump from one resolution to another and not get lost, which is easiest if you work from the centers of things. Right now the program keeps track of the upper-left-hand-corner location, and an X and Y offset from that, which is where the setting matches. The math for this is shown in the upper left hand corner, with the three major components laid-out as line-items: page Table, Page number, and page Offset ( T.P.O.) These represent the course, normal, and fine parts of the address, which roughly correspond to the frame, horizontal line, and pixel. The pageTable slider is on the left, the Page number on the right, and the Offset is along the top. Page number and Offset can be dragged by touching any part of the strip, and they increase/decrease continuously, by "tugging" and nudging". All three controls allow access to the full ranage of the system, although your hand will get tired if you attempt to climb up 4 Gb of address space 200 bytes at a time.

No comments:

Post a Comment