This is a cache of https://vccplus.brianholman.com/manuals/assembly-language-programming/graphics/. It is a snapshot of the page as it appeared on 2026-11-21T00:01:08.290+0000.
Draw on the page you cannot see · Assembly Language Programming for the VCC Plus CoCo 3 · VCC Plus
← Manual LibraryVCC Plus 3.7.1 · Reading on the web

Try the exercises in VCC Plus. Example links download files here; open them in the app to work beside the emulator.

The complete book · PDF editionBook 9: Assembly Language Programming for the VCC Plus CoCo 3

87 pages · VCC Plus 3.7.1 · Keep a copy to read or print.

Download PDF
Contents

Chapter 5 of 8

Draw on the page you cannot see

A display is a reader of memory. Let BASIC allocate two pictures, draw a mark in each, and leave the monitor on the first. The machine debugger can then show you a picture that nobody looking at the CoCo monitor can see. Afterward, use assembly to change a color without rewriting the letters on the screen.

Stop with both pictures in RAM

Choose fresh Disk BASIC, 512 KB, and RGB in Settings → Video Signal. Open PAGES.bas from Book 3 in BASIC Development, set a breakpoint at line 50, and Run. The source starts in 32-column text, selects PMODE 1 and shows its first page. The filled square lands on the left. It then selects page 3 for drawing, clears it and draws a smaller square on the right. At the breakpoint the second page is complete. BASIC has yet to show it.

In Debug → Show Debugger → Graphics Preview, select Current Video Page. Next choose At Address, Mapped CPU, hexadecimal 1A00, Go, PMODE 1 and Set 0. Here are both preview buffers captured at the same stopped instruction:

Current Video Page from the paused Disk BASIC guest. Its filled square is on the left.
At Address, mapped CPU $1A00, from that same pause. Its filled square is on the right.

PMODE 1 stores 128 × 96 pixels with four two-bit pixels per byte. A row therefore occupies 32 bytes and a picture occupies 3,072 bytes ($0C00). On this setup the first picture corresponds to mapped $0E00 and the second to mapped $1A00. The Current Video Page inspector reported the first one in physical RAM at $70E00. Those numbers describe two different address spaces. In BASIC's page numbering this picture occupies two allocation pages; selecting page 3 leaves room for the whole first picture.

Work backward from pixel 81,32

On the hidden page select X 81, Y 32 in Pixel Inspector. Predict the byte address before using Show in Memory. Row 32 begins $0400 bytes after the start ($20 rows × $20 bytes per row). Pixel 81 is in byte 20 ($14) of the row. Add them: $1A00 + $0400 + $14 = $1E14. Pixel X=80 occupies the highest pair of bits. X=81 occupies bits 5 and 4, with mask $30.

The guest byte is $AA (binary 10101010). Masking with $30 leaves $20. Shifting down four places gives the stored pixel code 2. That code selects a color in the active palette set. BASIC’s drawing coordinates and pen numbers sit a level above these packed bits. Book 3’s graphics lesson gives the original drawing and a native-window view of the inspector. To prove that you have isolated a single pixel, erase one beacon in hidden RAM and restore it.

Remove the line-50 breakpoint and Continue. Give the CoCo display keyboard focus. Tap and release a letter. The picture you found in RAM is now on the monitor. Another tap brings back the first square, and a third returns to 40-column text with BOTH PAGES ARE HOME. Swapping which page is visible saved redrawing the first square.

Change the paint used by a text cell

Open Earth or Mars in assembly. This time use its CoCo 3 40-column text screen. Locate greet, set a source stop on STB BG6, and Run. Give the CoCo window focus and press 2. At the stop the source has chosen the Mars string. In the supplied build PC is $3F22, X is $3F8E and B holds $25. Inspect the palette byte at $FFB6 in mapped memory. Its six color bits were $09 on the fresh setup.

Step one instruction. PC advances to $3F25 and the six color bits now read $25. On a repeat with 1, B holds $0A at the same instruction and the write changes those bits to $0A. This is a change to GIME palette slot 6. The following instructions set BASIC’s text attribute so its character-output routine draws the greeting with that background slot. The output routine still receives ordinary character codes. Changing the palette entry can alter how an existing pixel or cell using that slot looks without changing the byte containing its pixel code.

Continue. Read the colored greeting and the BASIC prompt beneath it. The starter clears the text attribute before returning. Its palette write persists; the return restores the text-writing convention, not every palette register. The two guest captures show the rendered choices. For CoCo 3 native high-resolution graphics rather than PMODE or text, Star Chart draws a CoCo 3 HSCREEN with separately defined palette slots.

Original VCC Plus manuals © 2026 Brian K. Holman. Third-party references retain their authors’ copyrights and licenses. Artwork notices. Edition 3.7.1; source and export identity. Printable edition: PDF source and export identity.

A closer look

Open original