Close

Design: Populating bitwise registers from the format string

A project log for reprint: modern printf

reprint is printf redone with decades of hindsight, revamping the semantics and syntax to make a function worthy of Hello World.

analog-twoAnalog Two 03/31/2016 at 13:560 Comments

The Output Control Register, Input Control Register and Input Size Register are populated from the lower bits of the characters in the format string, streamlining the parsing procedure:

  1. Upon parsing a Field Header, set Output Control Register Bit 13
  2. A packing directive may immediately follow and set Input Control Register Bit 7
  3. In general, the Output Control and Input Control registers are set by the lower bits of the character data in the format field string.
  4. The Flag characters each correspond to a single bit in the Output Control Register.
  5. Output Control Register Bits 2, 5, 8 toggle to 1 if a corresponding Selector character appears in the conversion specifier. They are 0 otherwise.
  6. A final Input Size sets the lower 4 bits of the Input Size Register.

Discussions