Re: Asteroids Deluxe in an FPGA

From: Graham Toal <gtoal_at_gtoal.com>
Date: Sat Jun 26 2004 - 05:11:21 EDT

> But it's still cool. ;-) I like the creative use of the case statement -
> something I hadn't thought of. Also, there isn't any timing information in
> there, either, and that's required (even for some of the vector games).

    case 0x4807:
        X = A;
    case 0x4808:
        ZN = A = ram[0x02F8 + X];
    case 0x480B:
        if (ZN < 0) { PC = 0x483e; clockticks += 20; return; }
                                   ^^^^^^^^^^^^^^^^

timing information. I just save it up until it's needed. The timer
is compared against the number of ticks per frame in the dispatch
loop when it returns, and an NMI is generated when it crosses the
threshold. With some tweaks I can guarantee that the timing is
within X% of accurate. The larger you can afford to set <X>, the
fewer writes back to 'clockticks' that you need to dump.

Worst case is you update clockticks every instruction and return to
the dispatch loop every instruction. Best case is you execute (for
example) 100 instructions in a row before you update the timing info
and return to the dispatch loop where you check against the timer.

G
---------------------------------------------------------------------------
** Unsubscribe, subscribe, or view the archives at http://www.vectorlist.org
** Please direct other questions, comments, or problems to chris@westnet.com
Received on Sat Jun 26 04:27:02 2004

This archive was generated by hypermail 2.1.8 : Sun Jun 27 2004 - 19:50:01 EDT