Saturday, July 8, 2017

Fiddling with coco2 graphics

It's interesting to figure out how the coco2 does its graphics.

I got a book on Extended Color Basic to get me started. It's a pretty cool tutorial.

http://www.colorcomputerarchive.com/coco/Documents/Manuals/Hardware/Getting%20Started%20With%20Extended%20Color%20Basic%20(Tandy).pdf


I wrote a little basic program to investigate how it works.


Some stuff I learned:

For some reason, mame gets the shift key stuck and I end up having to hold down SHIFT to invert the shift. I don't understand it exactly.
edit: Actually, I found that SHIFT+0 toggles CAPS lock.

The color basic EDIT command drives me completely insane, especially when the SHIFT key is doing strange things. I've gone to editing programs in a text editor then using paste to paste them into mame (UI Paste seems to be bound to SCROLL LOCK+SHIFT which is less than ideal, I think I'll change it).


INSTR matches an empty string at position 1, I would think that INSTR shouldn't match the empty string at all, giving 0.

You can change the PMODE for the graphics mode, but the screen display doesn't change until you execute a SCREEN command.

If you're in graphics mode and you PRINT anything to the screen, it reverts to text mode and sets the 0 background colors, basically executing a SCREEN 0,0.

Coco 2 graphics memory starts at 0xD00 or 14*256. With Disk Basic it starts at 0xD00, cassette basic starts graphics at 0x600. I wanted to poke into memory and see what happens.

The coordinates for the graphics depend upon the PMODE, and will adjust for the screen mode, where 0,0 is the upper left, and 255,191 is the lower right.




So my program just pokes some random data into the start of graphics memory page 1.

S will toggle to the alternate color set (either 0 or 1)
G will toggle from text to graphics (either 0 text or 1 graphics)
01234 will set the PMODE to that number
QWERTYUI will set the color to 01234567 and draw a rectangle
C will clear the screen
A will draw a line from 0,0 to 255,191 in a random color
Z will print a line of text automatically returning you to text mode



starts up in PMODE 4,1 (256x192 2 colors), note that going to graphics mode doesn't clear the screen



same screen in PMODE 3,1 (128x192 4 colors)


same screen in PMODE 0,1 (128x96, 2 colors)


now if you type C to clear the screen in PMODE 0,1 it will only clear what is visible, and hitting A to draw a diagonal line across:



then switching to PMODE 4,1 gives you:

No comments:

Post a Comment