News:

11 March 2016 - Forum Rules

Main Menu

NES/6502 fixed-cycle delay code vending machine

Started by Bisqwit, April 20, 2016, 12:00:01 PM

Previous topic - Next topic

Bisqwit

Hello! I decided to share some code that I used in my Simon's Quest retranslation/improvement project.

This "vending machine" is a front-end to a generator, that generates a macro, that gives you the shortest possible instruction sequence on the NES CPU, for producing a specified amount of cycles of delay. I am using it in various situations for precisely-timed split-screen / scanline effects. Advantages over handwritten code include that the number of cycles to delay can be any compile-time numeric expression, as is needed in my project, where the number of splits & delays per screen can be large, especially with the map screen that is split into four slices, and the number of cycles to delay depends on various factors: The NTSC/PAL selection, and the mapper, as page-switches in each mapper consume a different number of cycles. Using generated code thus helps keep small not only the binary size, but the source code size as well.

http://bisqwit.iki.fi/utils/nesdelay.php

Please report to me if there are any problems with the vending machine or with the code it generates. Be sure to read the "Watch out for..." section of that page first.

DackR