Jump to content


Jumping in Head First

development timing assembly

4 replies to this topic

#1 codernator OFFLINE  


    Combat Commando

  • 8 posts
  • I Implement I Work
  • Location:Jacksonville, FL

Posted Fri May 24, 2013 7:03 AM

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!


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.

Attached Files

#2 Thomas Jentzsch OFFLINE  

Thomas Jentzsch

    Thrust, Jammed, SWOOPS!, Boulder Dash, THREE·S, Star Castle

  • 23,937 posts
  • Always left from right here!
  • Location:Düsseldorf, Germany, Europe, Earth

Posted Fri May 24, 2013 1:01 PM

  • 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.

#3 codernator OFFLINE  


    Combat Commando

  • Topic Starter
  • 8 posts
  • I Implement I Work
  • Location:Jacksonville, FL

Posted Fri May 24, 2013 3:12 PM

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.

#4 codernator OFFLINE  


    Combat Commando

  • Topic Starter
  • 8 posts
  • I Implement I Work
  • Location:Jacksonville, FL

Posted Sat May 25, 2013 9:42 AM

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?

Attached Files

#5 Godzilla OFFLINE  



  • 6,794 posts
  • Location:Jacksonville, Fl

Posted Sat May 25, 2013 11:19 AM

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 by Godzilla, Sat May 25, 2013 11:19 AM.

Also tagged with one or more of these keywords: development, timing, assembly

0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users