- AtariAge Forums
- → Viewing Profile: Posts: Avram
Male
Avram hasn't added any friends yet.
Fri Jan 20, 2012 8:48 AM
Fri Jan 20, 2012 7:45 AM
Wed Aug 17, 2011 8:06 AM
*=$4000 loop lda $14 sta 710 cmp #100 bne loop lda 53770 sta 712 jmp loop
*=$4000Every piece of code has to be stored somewhere in memory. $4000, the hexadecimal of 16384, is a good place. I should state that hex is very common but is a numbering system I still don't use as often as possible. If you read Mapping the Atari, for instance (or many other Atari assembly books), you'll notice that the author usually lists both the hex and decimal equivalents of a memory location. If you're working on a PC then load up the built in calculator, go to View in the menu bar, and then choose Scientific. That way you'll be able to easily switch from dec to hex.
loopThe software will go back to this marker or label later.
lda $14Another piece of hex. What happens here is that the accumulator is loaded with whatever is in memory location $14/20, the real-time clock. This changes 50/60 times a second (depending on whether you're using a NTSC or PAL machine).
sta 710Whatever is stored in the accumulator is now put into memory location 710, the color of the screen. Because we just loaded $14/20, the clock location, a number between 0-255 will go here.
cmp #100Now we CoMPare the value stored in the accumulator (whatever the clock read) with the value #100. If they don't match then...
bne loop... return to loop. "Branch Not Equal" to "loop".
lda 53770But if the accumulator WAS equal to 100 then we'll load the accumulator with a random number that has been generated automatically at location 53770.
sta 712Which we'll store as a border color.
jmp loopAnd then finally go back to loop, repeating the process.
Sun Jul 24, 2011 4:56 PM
Sun Jul 24, 2011 2:09 PM

Find content