login | register
Fri 18 of May, 2012 (00:23 UTC)

V6Z80P Documentation

Similar PagesHistorys5 slideshowPrint

LineCop

Created by: phil, Last modification: Tue 11 of Aug, 2009 (18:24 UTC)

The LineCop is simple co-processor that allows changes to be made to the display at specific scan lines without having to use manual CPU interrupts (it operates using DMA cycle-stealing in a similar manner to the sound system). The LineCop system follows a program - much like the Amiga's Copper unit - there are 3 main instructions and each instruction is two bytes long. The upper bits of the MSB indicates what kind of instruction it is:

Bit:
15141312111009080706050403020100
1 1 x x x x x L L L L L L L L L = Wait for line L
1 0 x x x R R R R R R R R R R R = Select Register R
0 a b c x x x x D D D D D D D D = Write D to Register


x = Dont care
L = Line to wait for
R = Register to update ($0-$7FF)
D = Data byte to write to selected register
a = If set: After Write, increment selected register
b = If set: After write, increment wait line (and wait)
c = If set: After write, reload LineCop Program Counter from Start Location Registers

Wait and Register Select instructions take 2 clock cycles, Register Writes take 3 cycles.

The LineCop Program can be 64KB max (32768 instructions), and must be located at $70000-$7FFFF in system memory (IE: The highest two upper 32KB banks). The start address of the program is held in vreg_linecop_lo ($20D) and vreg_linecop_hi ($20E) - this address must be even, but note that the least significant bit of vreg_linecop_lo is the LineCop enable bit. The LineCop's Program Counter is reloaded from the address held in these registers at the end of every frame and also when forced by a LineCop write where bit 12 is set. As the LineCop can write to its location pointers and restart itself, automatic list cycling / page flipping can be achieved. Linecop programs should end with a wait for a line that is never reached, usually $1FF (EG: The instruction code $C1FF)

Notes:

  • The LineCop steals time from the CPU at the start of each scan line if the previously set wait line is reached. The cycle stealing continues along the line until the next Wait instruction. (Note: if the end of the scanline is reached, the Linecop becomes inactive until the next frame as it will be waiting for the same line..)

  • Whilst writes to the palette etc have immediate effect, some video register changes will not take effect until the start of the next scanline, or sometimes the line following that. This is due to the way the internal scanline buffers are generated. It is advisable to use the double-buffered registers whilst making changes to the sprites or bitmap locations as the write will occur some time during the linebuffer generation period.

  • As the LineCop can access all the video registers including blitter etc, beware of malformed LineCop programs causing undesired effects.

Search


Last modif pages