Prof. Dr. rer. nat. Peer Johannsen

Weird Science - Tales from the Vectrex Academy Lab

Vectrex Project Title

  • DRAW_GRID_VL

Project Status

  • Completed

Synopsis

  • An investigation of the Vectrex BIOS routine Draw_Grid_VL / NIBBY ($FF9F)
  • Some interesting, yet probably utterly useless findings...

Results

  • In contrast to all other BIOS routines, Draw_Grid_VL is not listed in the official GCE Vectrex Programming Manuals Part 1 and Part 2.
  • Draw_Grid_VL is the only BIOS routine which is located at the very end of the ROM, after the ROM data sections (lookup tables, music, etc.).
  • I strongly suspect that this routine is not at all intended for drawing grids. It is rather a drawing routine for vector lists that use a simplified but memory-saving compressed format where each vector coordinate is encoded by a nibble (i.e. only 4 bits). A y/x coordinate pair is thus condensed in a single byte. This format is called a "NIBBY STYLE LIST".
  • I think this routine is some sort of experimental code that somehow survived in the BIOS.
  • The implementation code significantly differs between BIOS versions (B796) and (7931 + 7ADB).
  • Also the semantics of the vector list encodings differs (e.g. the way how "moves" and "draws" are encoded).
  • Let us call these encodings "nibby style 0" (B796) and "nibby style 1" (other versions). For further explanations of the encodings, an annotated C source code example is available below.
  • The whole thing constitutes an incompatibility between those BIOS versions, and code working on the one version will not work on the other versions (or rather produce a different result on the screen).
  • I also presume that Draw_Grid_VL requires just one parameter, which is the base address of the nibby style list, passed to the routine in the y register. The x register is not used in a meaningful way and is modified internally only as a side effect of the subroutines used by Draw_Grid_VL.

Trivia

  • Draw_Grid_VL internally writes to $C880, using it as a temporal storage. Since $C880 is usually considered as the beginning of the user RAM, using Draw_Grid_VL is a bit dangerous.

Author

  • Peer Johannsen

Screenshots

  • nibby style 0 on BIOS version B796 (left), and on different versions(right)

Screenshots

  • nibby style 1 on BIOS version B796 (left), and on different versions(right)

Downloads

  • Downloads are free and for non commercial use only. Use at your own risk.
  • Please respect the copyright and credit the author and the origin of this project.

Latest modification on 05/10/2024, 19:00
  • Analysis updated