Displaying NxM pixel tiles when not divisible by tile scanline height
escher
Posts: 138
My VGA driver is outputting at a resolution of 640x480 @ 60 Hz.
But the image data being displayed is actually (supposed to be) a 10x12 tile map, with each tile being 16x16 pixels for an image resolution of 160x192.
I accomplish this upscaling from 160x192 to 640x480 in the standard way by changing vscl to hold horizontal pixels for 64 screen pixels, and by displaying 40 horizontal lines per tile.
However, with 16x16 tiles, that means each 16-pixel scan line of a tile maps to 40/16=2.5 lines of the frame.
If I change the number of tiles to a number such that (480/num_tiles)%16=0, then there's no issue. For example, @ 15 vertical tiles, each tile is 480/15=32 scan lines tall, so for each 16-pixel row of a tiled image, I just hold it for 2 scan lines for 16*2=32 scan lines.
I'm following along in the the HYDRA manual and the discussion explicitly mentions a 640x480 video resolution @ 10x12 tiles, but it never discusses how one renders 16 vertical lines worth of tile in 480/12=40 scan lines.
But the image data being displayed is actually (supposed to be) a 10x12 tile map, with each tile being 16x16 pixels for an image resolution of 160x192.
I accomplish this upscaling from 160x192 to 640x480 in the standard way by changing vscl to hold horizontal pixels for 64 screen pixels, and by displaying 40 horizontal lines per tile.
However, with 16x16 tiles, that means each 16-pixel scan line of a tile maps to 40/16=2.5 lines of the frame.
If I change the number of tiles to a number such that (480/num_tiles)%16=0, then there's no issue. For example, @ 15 vertical tiles, each tile is 480/15=32 scan lines tall, so for each 16-pixel row of a tiled image, I just hold it for 2 scan lines for 16*2=32 scan lines.
I'm following along in the the HYDRA manual and the discussion explicitly mentions a 640x480 video resolution @ 10x12 tiles, but it never discusses how one renders 16 vertical lines worth of tile in 480/12=40 scan lines.