Data counter

From veswiki
Revision as of 21:22, 16 November 2012 by E5frog (talk | contribs) (1 revision)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The data counter is a 16-bit register in the F8 which allows access to data stored in ROM. Unlike other CPUs, like the 6502, the F8 doesn't allow you to directly load and store data into a byte in memory, using a single opcode; the F8 only provides opcodes to load and store data in memory from the address pointed to by the data counter, or DC.

There are two DC's on the F8, called DC0 and DC1. DC1 can't be used by any opcode, but can only be switched with DC0 using XDC. This however is helpful when you want to move portions of data from one location in memory to another. To load data using the DC, you can use the opcode LM, which loads a byte from memory into the accumulator. To store data, use the opcode ST, which stores the accumulator into that address in memory. Alternatively, with the contents of that addres you can add, AND, OR, or XOR it with the accumulator. Each of these operations will increase DC0 when used.

You can manipulate the address stored by DC0 by swapping it with the register Q or H, adding the contents of the accumulator to it, swapping DC0 with DC1, or loading an immediate address using DCI. And as stated before, any opcodes using the DC will increase it after it's finished.