Max 7456, NTSC, 390 character OSD programming bugs.

Hello Arduino Forum,

I am using an Arduino MEGA 2560 with a MAX7456 (https://www.sparkfun.com/datasheets/BreakoutBoards/MAX7456.pdf) on an overlay shield to display custom characters on a Pyle PLHR79 screen. The screen holds 13 rows of 30 characters.
I have built 18 characters, each character being a one pixel thick horizontal line. I have done this with 18 different Arduino functions.
Using the serial port in lieu of a potentiometer, I am inputting a value 0-1023. A giant function “readPotentiometer” will take the given input, and decide which character to use. This character information is then send to a display function “write_line.”

TWO BUGS:
Functions “write_pixrow13()” “write_pixrow6()” and “write_pixrow12()” do not produce one line of uniform characters. They produce two lines of uniform characters. This doesn’t make sense since the functions were written via copy/paste, so if one is wrong, they all should be wrong.

In “readPotentiometer,” I have commented out several for loops. These for loops simply increment the variable, disp_address_hi, by one to allow the opposite characters to be written on the bottom half of the screen. When these for loops are implemented, the function “write_line,” the display function, executes more than twice. Why would an incremented for loop execute more than it is specified to?

FINALdrawCHAR1_16.txt (80.4 KB)