Have you thought that when you wanted to print a pattern using user defined graphics on the screen that you were limited to placing that pattern on the screen in multiples of the pixel dimensions (8×8) of the character? True in the horizontal, but in the vertical dimension, the tyranny of the character can be overcome as illustrated by this little program called “EXP II”.
EXP II pokes the value of the UDG start address for the user defined graphics table. The program scrolls the pixel patterns of the USR graphics. By printing characters that are next to each other in the character set on top of each other on the screen, the graphic character changes position a pixel at a time. This allows smoother movement of graphics on the screen.
The graphic character can be any number of characters high. For a that is more than one character in width, a buffer or blank character is placed between the series of characters that are printed on top of each other. Notice the setup of the characters in EXP Il. The small duplicate listing is to show which UDG characters are used in the print statements. This was made by listing line 8200 and then in direct mode, print to the screen and then COPY.
I hope that you find EXP’s principle useful in developing your own moving graphics programs. This one had me scratching my head for days, but every time I thought about it, it became more beautiful.
One other thing this opens up is that you can also have more than one user defined character set. The UDG’s initialize at memory location 65368 and occupy 168 bytes (21×8). Another set could be stored 168 bytes below this starting at 65201. These starting addresses are stored at 23675 and 23676. Initially 23675 holds 88 and 23676 holds 255 (255*256+88=65368) for starting address 65201, POKE 23675 with 177 and 23676 with 254 (254*256+177=65201). To utilize this, all you have to do is keep track of which UDG set you are working with when defining the sets and when you print them. You can make as many UDG sets as you have memory for.