codernator Posted May 24, 2013 Share Posted May 24, 2013 Greetings Starfighter, You have been recruited by the Star League to defend the frontier against Xur and the Ko-Dan armada. --- Sorry, wrong topic. I loved that movie, though. Greetings Atari Fans and Developers! I am a computer programmer, no stranger to assembly language, yet I am new to the 6502 (or 6507, as it were) chip and - more to the point - cpu cycle counting. As such, my first Atari program is an exercise in timing. I have attached my first program for your critiquing pleasure. Basically, the program displays colored lines in the background, each based on the current descending line count. However, that being only marginally interesting, it also changes the color as frequently as possible on the current scan line. Finally, just for fun, it tracks a cycle counter that is added to the current line number. The final effect is 11 scrolling color bands. I have executed this program both in Z26 and Stella, and observed a couple of bugs that I am having trouble tracking down: * At regular intervals there is a short period of increased velocity, as if the program is "catching up". * There is a minor visual anomaly that results in the horizontal seems between scan lines being slightly crooked at times. This is probably related to the previous issue, and could very well be simply due to a limitation of the EMUs. * The first color band is shorter than all the others, while the last is longer. I feel like this is just the nature of the alignment of the cycles, but I am curious if it can be fixed. I haven't the means to dump this to a cart, but I do wonder if those behaviors would be the same on the actual device. If any devs out there have some insight or general advice, I'd be glad to have it! Thanks, Grif PS: This was part of the alphabet would look like if Q and R were eliminated. PPS: I love the Topics Tags. We need more adoption of tags on the internet. student.asm Quote Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted May 24, 2013 Share Posted May 24, 2013 The increased (actually: doubled) velocity is the result of a set carry flag when increasing the ColorRotator. This happens during 32 frames. Same problem with the 2nd issue. When the carry flag is set from the previous adc #32 twice, one color entry is skipped. Just add a few cycles at the beginning of the loop and the first band becomes longer. 1 Quote Link to comment Share on other sites More sharing options...
codernator Posted May 24, 2013 Author Share Posted May 24, 2013 Hah. It all seems so obvious. Had I been doing this an a high-level language, I would have written something like "color = (color + increment) % MAX_COLOR". It didn't occur to me to do that here. I'll fix that tonight and see how things stand. Quote Link to comment Share on other sites More sharing options...
codernator Posted May 25, 2013 Author Share Posted May 25, 2013 I have dealt with the carry bit issue, which ate up alot of CPU. I imagine with some clever math I could tighten things up more, but I am not going to obsess more over this project. The display is alot more solid, although one little anomaly remains. It appears I'm getting an extra scan line at intervals that is rendered with the last background color. Any ideas? student.asm Quote Link to comment Share on other sites More sharing options...
Godzilla Posted May 25, 2013 Share Posted May 25, 2013 (edited) Think it's damn impressive how far you've come in such a short time. When I tackled an assembler book and info on coding stella ages ago, I got a LOT -less- further in a -LOT- more time excuse my horrendous english there. it's 'net speak' Edited May 25, 2013 by Godzilla Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.