[Coco] 8 color coco 2 graphic display

Torsten Dittel OS-9 at TRS-80.CC
Sun Apr 21 08:47:08 EDT 2013


Ben <ben_jimenez at ...> writes:

> Is there some sample code around on how to do this?

Hi Ben, here's what I remember after 30 years:

The trick is switching graphics modes (e.g. Dragonfire: BASICally spoken 
switching between SCREEN1,0 and SCREEN1,1 of PMODE3,1) during the screen 
image is generated line by line by the VDG.

This has to be at least be synchronized with the vertical blank (VSYNC, 
every 16.67ms on NTSC, every 20ms on PAL machines), either by polling the 
corresponding PIA bits or by implementing a corresponding interrupt service 
(on IRQ).

You could then manually count CPU cycles of the code you're executing in 
the mean time, to know where you are on the screen (switching can be done 
as well in the middle of a line, even several times as Dragonfire proves) 
to make sure the switching always takes place at the same point of time 
(and thus point on the screen) after the vertical blank occured, but this 
requires to create symmetrical code if you have conditional branches.

Or you could waste all the CPU cycles by staying in a loop until the 
switching point is reached.

Or you could additionally setup a Fast HSYNC (FIRQ) interrupt service 
routine which counts the scan lines (should be reste by the VSYNC then) and 
triggers the switching at a certain scan line. For the "fine tuning" of the 
horizontal position of the mode change, you would then use opcodes 
like "NOP" (2~) or "BRN" (3~), if there's nothing senseful else to do for 
the interrupt service routine.

It depends on what else you want to do during the "mixed mode" is 
displayed. Each approach has it's advantages and disadvantages. So I assume 
to provide code examples one would need to understand what you're planning 
to do.

> Of course the trick didn't work in the vcc emulator, but I'd like to try 
> and do this on my real coco 2.

Try the latest version of XROAR, should do the trick for both NTSC and PAL 
emulation.

Regards, Torsten




More information about the Coco mailing list