Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 864
Mr Speaker Avatar asked Apr 04 '12 13:04

Mr Speaker


2 Answers

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.

like image 67
zaratustra Avatar answered Nov 07 '22 02:11

zaratustra


I'm sure conventions will emerge but the instruction set is completely orthogonal with respect to the registers A, B, C, X, Y, Z, I and J so there is no difference between them inherent in the DCPU-16.

like image 32
James Tauber Avatar answered Nov 07 '22 03:11

James Tauber