Page 1 of 1
Screenshot feature repeats pattern
Posted: Tue Mar 17, 2026 4:11 am
by ihateassembly
So I'm currently trying to implement a screenshotting feature for my operating system, however for some reason, every bmp screenshot comes out in a way where the taskbar and the watermark on the desktop get screenshotted fine, but then it proceeds to repeat a segment of the image over and over from the bottom to the top, until that segment fills up the rest of the image.
I'll attach screenshots if needed.
Re: Screenshot feature repeats pattern
Posted: Tue Mar 17, 2026 9:44 am
by Octocontrabass
Is this a problem with reading from the framebuffer, writing to the disk, or something that happens between such as allocating memory?
Also this question has nothing to do with the wiki so I've moved it somewhere more appropriate.
Re: Screenshot feature repeats pattern
Posted: Tue Mar 17, 2026 12:21 pm
by ihateassembly
I'm suspecting that it might be an MMIO issue. It's also weird how it just loops a certain part of the screenshot instead of it being corrupted. I tried doing it from top to bottom too, but it just flipped the image and the effect too, so it went from top to bottom
Re: Screenshot feature repeats pattern
Posted: Tue Mar 17, 2026 1:01 pm
by Octocontrabass
Given that the corruption perfectly lines up with 63-sector boundaries I'd say the problem is most likely related to writing the file to the disk.
Have you tried writing any other files of this size to the disk? Are those files also corrupted?
Re: Screenshot feature repeats pattern
Posted: Tue Mar 17, 2026 1:53 pm
by ihateassembly
Not yet. Also how do I figure out if an issue like this perfectly aligns with any sector boundaries for next time this happens?
Re: Screenshot feature repeats pattern
Posted: Tue Mar 17, 2026 2:45 pm
by Octocontrabass
I figured it out by looking at the corrupted file in a hex editor. The addresses where the data repeats all divide evenly by 0x7E00, which happens to also be the number of bytes in 63 sectors.
Re: Screenshot feature repeats pattern
Posted: Wed Mar 18, 2026 9:10 am
by ihateassembly
Octocontrabass wrote: ↑Tue Mar 17, 2026 2:45 pm
I figured it out by looking at the corrupted file in a hex editor. The addresses where the data repeats all divide evenly by 0x7E00, which happens to also be the number of bytes in 63 sectors.
Yeah, it was breaking it into 63 sector chunks, and something in the disk handling was writing over values in registers, I've made it so that it stores the stack pointer in a dedicated memory location. Now just onto merging the screenshot capture and write into one function.