assemblydcpu-16

Are the I and J registers special in DCPU-16?


DCPU-16 includes 8 general registers named A, B, C, X, Y, Z, I and J. It's a bit of a programmer "trope" to use I and J for loop counters. In DCPU-16, are I and J specialized registers, that should only be used in loops - or do they all end up the same colour in the end?


Solution

  • Everything points out to the DCPU-16's eight main registers being "general purpose": while they are 'intended' for a certain use, programmers can use them as they will. The x86 has a similar architecture for its general registers.

    The only special purpose registers on DCPU-16 are SP, PC and O.

    Edit: The DCPU 1.3 specification introduces a single instruction (MVI) that adds 1 to both I and J after executing, with the intention of being used as a fast memory copy. Notch has expressed disliking this, so it might be eventually dropped, but now I and J are a bit special.