News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Bouncing Square Clipping

Started by tda0626, June 09, 2024, 05:37:58 AM

Previous topic - Next topic

_japheth

Quote from: tda0626 on June 13, 2024, 04:11:48 AMThank you. Is the technique you are describing called double buffering?

No - I guess double buffering is closely related to "page flipping" ( changing the start address of the "visible" video memory ).

QuoteWhen you allocate memory with DOS function AH=48, you specify the number of pages of memory needed as 1000h. Why did you specify that and not 4000 decimal, which is 64k/16?

You're right, 4000 would have been the exact value - 1000h wastes 1536 bytes.

Btw., I made some timing tests: your code, with the vsync wait deactivated, needs 86 ms for 600 loops - so < 150 microsecs for one loop - for my understanding that's far too fast to cause "flickering" troubles. Would be interesting to see what's displayed with a true CRT monitor attached - regrettably I don't have one.
Dummheit, gepaart mit Dreistigkeit - eine furchtbare Macht.

tda0626

Quote from: _japheth on June 13, 2024, 08:38:09 PM
Quote from: tda0626 on June 13, 2024, 04:11:48 AMThank you. Is the technique you are describing called double buffering?

No - I guess double buffering is closely related to "page flipping" ( changing the start address of the "visible" video memory ).

QuoteWhen you allocate memory with DOS function AH=48, you specify the number of pages of memory needed as 1000h. Why did you specify that and not 4000 decimal, which is 64k/16?

You're right, 4000 would have been the exact value - 1000h wastes 1536 bytes.

Btw., I made some timing tests: your code, with the vsync wait deactivated, needs 86 ms for 600 loops - so < 150 microsecs for one loop - for my understanding that's far too fast to cause "flickering" troubles. Would be interesting to see what's displayed with a true CRT monitor attached - regrettably I don't have one.


Is that good for a line draw routine? Never benchmarked it. I am sure it could use a little bit of optimization.

When drawing a filled in rectangle or square, is there a preferred method? The way I draw it now is line by line, top to bottom.

NoCforMe

#18
Quote from: tda0626 on June 14, 2024, 05:04:32 AMWhen drawing a filled in rectangle or square, is there a preferred method? The way I draw it now is line by line, top to bottom.
Well, assuming you've drawn a contiguous border, you could use a flood-fill routine, I guess, but that might actually be slower, as well as requiring recursion.

The advantage of using flood-fill is that it will fill any fully-enclosed shape, regular or not.
Assembly language programming should be fun. That's why I do it.

_japheth

Quote from: tda0626 on June 14, 2024, 05:04:32 AMIs that good for a line draw routine? Never benchmarked it. I am sure it could use a little bit of optimization.

Optimization is usually good, but:

  • 86 ms for 600 loops without vsync synchronization
  • 10,000 ms for 600 loops with vsync synchronization
  • conclusion: your prog spends more than 99% of its time waiting for vsync

So it's perhaps a bit moot here...

Dummheit, gepaart mit Dreistigkeit - eine furchtbare Macht.