Screenshot feature repeats pattern

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
ihateassembly
Posts: 5
Joined: Sun Mar 15, 2026 2:37 pm

Screenshot feature repeats pattern

Post 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.
Octocontrabass
Member
Member
Posts: 6249
Joined: Mon Mar 25, 2013 7:01 pm

Re: Screenshot feature repeats pattern

Post 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.
ihateassembly
Posts: 5
Joined: Sun Mar 15, 2026 2:37 pm

Re: Screenshot feature repeats pattern

Post 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
Attachments
This is how it looks like
This is how it looks like
Octocontrabass
Member
Member
Posts: 6249
Joined: Mon Mar 25, 2013 7:01 pm

Re: Screenshot feature repeats pattern

Post 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?
ihateassembly
Posts: 5
Joined: Sun Mar 15, 2026 2:37 pm

Re: Screenshot feature repeats pattern

Post 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?
Octocontrabass
Member
Member
Posts: 6249
Joined: Mon Mar 25, 2013 7:01 pm

Re: Screenshot feature repeats pattern

Post 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.
ihateassembly
Posts: 5
Joined: Sun Mar 15, 2026 2:37 pm

Re: Screenshot feature repeats pattern

Post 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.
Attachments
The OS, in all its glory
The OS, in all its glory
Post Reply