Skip to content

VGA: Add fractional pixel scaling #187

@MJoergen

Description

@MJoergen

This issue is about enabling fractional scaling of the display. The idea is to allow easy implementation of almost-3D games like Wolfenstein or to make smooth 3D text scrolling like in the Star Wars intro! This is for you @sy2002 !!

The idea is to add two new registers that contain the ratio of the pixel width in the screen buffer versus the pixel width on the monitor display, i.e.

VGA$PIXEL_X_SCALE
VGA$PIXEL_Y_SCALE

Each register value contains the size of a screen buffer pixel in units of monitor display pixels, scaled by a constant value of 256. So the default value is 0x0100, corresponding to a scaling factor of 1. The value 0x0080 would mean only half the screen buffer is used to fill the entire monitor display. In other words, this leads to a magnification by a factor of 2.

The implementation could be as easy as expanding the module vga_pixel_counters and adding another set of pixel counter outputs. So one set gives the coordinates on the monitor display (and counts by 1 every clock cycle), and the other set gives the coordinates on the screen buffer (and counts by VGA_PIXEL_X_SCALE/256 every clock cycle). The outputs could be called
monitor_pixel_* and buffer_pixel_*, respectively. Then the monitor_pixel_* signals are fed into the vga_sync module, while the buffer_pixel_* signals are fed into vga_text_mode and vga_sprite etc.

This issue includes writing a cool demo!

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions