Sunday, 18 November 2018

Baby Steps

The lack of activity after my last optimistic post has actually been due more to a hectic work schedule than anything else.

A few nights ago I started looking at Asteroids (CoCo3) again, trying to understand where I got to, and also battle a very uncooperative revision control system (which still isn't working).

And tonight I actually did a few simple optimisations to the erase routines. Nothing particularly spectacular, and partly temporary, but at least it got the juices flowing again.

Hopefully more to follow soon...

[UPDATE]

Here's a snippet of the code to erase an object. Originally I had a simple loop, which I unrolled last night. But looking at the cycle counts, I noticed that 16-bit offsets require 8/9 cycles as opposed to 5/6 for 8-bit offsets. Doing the math, I found it was quicker to adjust Y (8 cycles) so that only 8-bit offsets were required. And somewhat annoyingly, coding an instruction with a '0' offset was assembled into a (slower) 5-bit constant-offset instruction, rather than a zero-offset.

ldd #0
std     ,y
sta     2,y
std     1*32,y
sta     1*32+2,y
std     2*32,y
sta     2*32+2,y
std     3*32,y
sta     3*32+2,y
leay    4*32,y
std     ,y
sta     2,y
std     1*32,y
sta     1*32+2,y
std     2*32,y
sta     2*32+2,y
std     3*32,y
sta     3*32+2,y
leay    4*32,y
std     ,y
sta     2,y
std     1*32,y
sta     1*32+2,y
std     2*32,y
sta     2*32+2,y
std     3*32,y
sta     3*32+2,y
leay    4*32,y
std     ,y
sta     2,y
std     1*32,y
sta     1*32+2,y
std     2*32,y
sta     2*32+2,y
std     3*32,y
sta     3*32+2,y

No comments:

Post a Comment