-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VGA: Add fractional pixel scaling #187
Comments
@MJoergen Great job! I could not resist to quickly trying your latest commit in branch
And then everything starts to look totally smooth and pretty. I made a small video. Download, unpack and look at this: Now it is a bit too fast. The solution: I think what we (reads "you?" :-)) might want to add to the monitor (misc library) and then also via Simple and synchroneous means that we do not need the timer interrupt for that. Since we have switched on the cycle-counter be default, it is as easy as counting some cycles (and making sure that we cover wrap arounds). The counters are 48bit or so, so that wrap arounds would only happen every ~65 days if I calculated correctly ;-) And then we could do a P.S. As your new fractional pixel scaling is not breaking anything, you might want to get rid of the branch and put everything in develop? |
I'm updated the scrolling to make it more smooth, and I've merged into the develop branch. Still missing is to update documentation. It would be nice to make a port of the Wolfenstein game using this new fractional scaling, but I'll leave that to you @sy2002 :-D |
Regarding the delay, that would be a nice function to have, but I don't see how it can be used in the little demo program. The point is that the demo program is running entirely synchronuous with the VGA scan line. It could be possible to rewrite the demo program using interrupts to control the VGA port, and then have a main loop with delays controlling the parameters for the interrupt. That would probably - in some sense at least - be more cleaner code. |
@MJoergen I just quickly tried it on hardware: Great job! I love it! ❤️
|
TODO:
|
WOW - that sounds great! Can't wait to see that! :-) |
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.
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 value0x0080
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 byVGA_PIXEL_X_SCALE/256
every clock cycle). The outputs could be calledmonitor_pixel_*
andbuffer_pixel_*
, respectively. Then themonitor_pixel_*
signals are fed into thevga_sync
module, while thebuffer_pixel_*
signals are fed intovga_text_mode
andvga_sprite
etc.This issue includes writing a cool demo!
The text was updated successfully, but these errors were encountered: