2 ms·
I had a very similar experience. I was filling the screen with white pixels with PSET in Basic. Just a tight loop setting each pixel. It took a handful of secon
by bajsejohannes 14y ago
I had a very similar experience. I was filling the screen with white pixels with PSET in Basic. Just a tight loop setting each pixel. It took a handful of seconds.
When I rewrote it in assembly and the screen was instantly filled with white pixels, I couldn't believe it was true. You just can't set pixels that fast! I went back to "debug" my assembly code by setting the pixels to different colors to convince myself that the assembler didn't somehow "cheat" by just setting the background color to white. And sure enough, assembly just turned out to be orders of magnitude faster.
- NewAccnt 14y agoExact same experience here. QBASIC allowed you to put ASM code in line with BASIC, like so. y=199 x=319 c=15 def seg = &ha000 + (&h14 * y) poke x, c Of course, functions like CIRCLE were already much faster since the entire function was already in ASM, instead of having to go in and out of the interpreter for each pixel. You'd wrap the above code in a SUB routine and replace all your PSETs with it. I even coded my own sprite maker that used the mouse in a similar manner and made a pretty impressive looking Mario clone with the appropriate functions I learned in math class. Pythagorean theorem was very useful when working with grids. I didn't understand why everyone wasn't doing the same thing and why everyone hated math. Imagine the teachers surprise when on the first day everyone is learning FOR loops and I'm making a RND bump map with directional lighting. This was 1997 so we were still using Yahoo to look up the ASM offset codes, which worked just fine, you'd just have to be good at making your queries or you'd have to dig through a couple of pages of results.