Vertical blank interrupt and horizontal blank interrupt

Source: Internet
Author: User

Reprinted from: http://hi.baidu.com/johnman/blog/item/24086289d68cc3b20e2444c0.html

 

Vertical blank interrupt and horizontal blank interrupt ).

Ndsl hardware is drawn from top to bottom, left to right, and each pixel point on the screen in sequence. For example:

The painting process is to draw a line by line, each time a line is drawn. As indicated by the Black Arrow, a horizontal interruption (hblank
Interrupt ). When all rows are drawn, it is equivalent to completing the path indicated by a red arrow, and the hardware triggers a vertical interruption (vbland
Interrupt ). Of course, to complete these processes, whether or not to cause an interruption, you also need to set the corresponding register.

Why do we need these interruptions? For example:

For example, the leftmost text is the elapsed time. The left-side graph of each line indicates the content that was stored at the time, and the right-side shows the content displayed at the time. In fact, video memory is a linear continuous memory, and each unit (8 bit or 16 bit) corresponds to a point on the screen. However, to be specific, the video memory is abstracted as a rectangle like a screen. Note that NDS creates a screen every 1/60 seconds (2/120 seconds.

The following is a correct explanation:

0 seconds:

The memory content is a square, and the hardware is ready to draw. At this time, there is nothing on the screen.

1/120 seconds:

The hardware draws half of the memory to the screen, and a half square appears on the screen.

After 0.01/120 seconds (that is, 1.01/120 ):

At this time, your program wants to display a triangle, so it will rewrite the entire memory content into a triangle, and in this short period of time, the NDS screen rendering hardware has not stopped, instead, we continue to plot the video content to the screen, that is, the small red block in the third line. However, this does not seem to have much impact.

2/120 seconds:

The drawn hardware completes the painting of the content indicated by the red area in the lower half of the memory. Originally, the program you wrote thought it was going to display a triangle, but it is actually shown as a t-like image in the right figure. This is not the expected result.

The actual program and situation will be more complex and unpredictable than this. Therefore, vertical and horizontal interrupt vectors are introduced to overcome this problem.

When a screen is drawn, a vertical interruption is triggered. By causing this interruption, the screen will not be drawn at this time. You can update the video memory at this time. When the update is complete, set all the content to be displayed, then draw the hardware. This ensures that what is displayed is what you want.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.