Jump to content
Sign in to follow this  
  • entries
    7
  • comment
    1
  • views
    4,344

ROM Section Headers

walker7

370 views

A good assembler has ROM section headings. These are a way to cleanly divide the source code into settings, so you can definitely figure out at which address each section starts. Think of an assembler as if were like Microsoft Word.

Section headings could appear as solid-colored bars with text on them. The user should have control over what color to make the bar. They also might have control over the font.

For example, your main program header might look like this (note that all images are simulated):
gallery_42566_2054_1287.png
Notice I used the Roco font. Anyone familiar with Sonic The Hedgehog 2 will recognize this, but it's the actual font, not the Sonic 2-rendered one.

Every computer program needs a vertical blank (or "V-Blank") routine. Its header might look like:
gallery_42566_2054_2944.png

One common thing to have in any program are math routines. So, you might include a section like this:
gallery_42566_2054_1055.png

For a hardware/software implementation, fonts could use a bitmap. Up to 96 different character glyphs can be stored. In addition, the numbers could be made a little bit bigger if the user chose to. Each character's bitmap can be stored using 1, 2, or 4 bits per pixel. For each character, the size needs to be specified, as well as where its glyph data can be found.

For file storage, section headers could use this format (each pair of letters represents a byte):
hh ff rr gg bb ll tt tt ...

  • hh = Token for a section header (a fixed value).
  • ff = Flags. If bit 7 is set, restart the numbering at 1. If bit 6 set, toggle whether the number is shown for this and later sections.
  • rr gg bb = Section header color, a 24-bit RGB value.
  • ll = Length of text.
  • tt = The text shown. It doesn't include "Section #". It's in ASCII.



Let's say that the section header token is $00, and I'll use the vertical blank section header as an example. The byte stream in the source file would look like this:
00 C0 00 60 20 0F 56 42 4C 41 4E 4B 20 52 4F 55 54 49 4E 45 53

  • The 00 signals the start of the section header.
  • C0 means to make this section #1, and turn on section numbering (by default, it's off).
  • 00 60 20 is the RGB value. It produces a dark green color.
  • The 0F determines how many characters there will be in the section's name.
  • The rest is the text, in ASCII. The text says "VBLANK ROUTINES".




Section headers are not taken into account when compiling a ROM. They are there to cleanly divide source code. When the file is opened, the number of headers is counted, and section numbers are assigned accordingly.




0 Comments


Recommended Comments

There are no comments to display.

Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...