DOHIRES • Double-HIRES Library

The Apple made it possible to utilize a graphics mode called “Double Hires” in the Apple //e Rev B, Apple //c, and Apple //gs, but it was more of an afterthought than a smart design decision if you look at it from the programmer’s point of view. A very complicated memory layout with no direct possibility to address even a single pixel makes the use of this graphic mode a real challenge for a developer, until now, with the DOHIRES library written by Mark. Golombeck. He has written a very through and detailed technical blog regarding the library and graphics mode and how it works. Find it in the 8-Bit Shack members area.

Please find the library usage and documentation below.

Command Description of Function
&HGR Enables and switches to full-screen double-hires mode
&M Toggles mixed mode ON/OFF. When ON, there are 4-lines of 80-column text available at the bottom of the screen.
&TEXT Disables double-hires mode, and switches back to the 40-column text mode.
Plotting Commands
&HCOLOR=nn Sets the plotting color. Possible values are 0 through 15)
&HPLOT X,Y[,color] Plots a single pixel at coordinates X,Y. Possible values: X can be 0-139 and Y can be 0-95. An optional color color that will override the previously set plotting color. Possible values are 0 through 15.
&L X1,Y1,X2,Y2[,color] Plots any line starting at coordinates X1,Y1 to X2,Y2 using a fast Bresenham algorithm. Possible values: X can be 0-139 and Y can be 0-95. An optional color color that will override the previously set plotting color. Possible values are 0 through 15.
&C XM,YM,RADIUS[,fillcolor,bordercolor] Plots a circle with midpoint at coordinates XM,YM and a radius of RADIUS. The value of RADIUS should not exceed 70, else strange and unpredictable results may occur. Optional fillcolor and bordercolor parameters can be specified that will override the previously set plotting color. Possible values are 0 through 15. If fillcolor is given, a filled disk is drawn. If bordercolor is given, then the border of the disk will be drawn with the alternate color provided. It is possible to draw circles/disks that exceed the drawing screen, however, the midpoint of the circle/disk must always be a valid screen coordinate. Possible values: XM can be 0-139 and YM can be 0-95.
&R X1,Y1,X2,Y2[,fillcolor,bordercolor] Plots a rectangle with the upper-left corner starting with coordinates X1,Y1 to the bottom-right corner with coordinates X2,Y2. An optional color color that will override the previously set plotting color. Possible values are 0 through 15. Optional fillcolor and bordercolor parameters can be specified that will override the previously set plotting color. Possible values are 0 through 15. If fillcolor is given, a filled rectangle is drawn. If bordercolor is given, then the border of the rectangle will be drawn with the alternate color provided. Possible values: X1,x2 can be 0-139 and Y1,Y2 can be 0-95.
&H Fill the screen with the currently set color. (See &HCOLOR). If the current color is set to 0 (black) then the current drawing screen will be erased.
Miscellaneous Commands
&SCRN(X,Y,C%) This is a function that returns the color value of the pixel at coordinate X,Y. Call the function as: &SCRN(X,Y,C%). The variable C% (integer variable) will contain the color value (0-15), that was read from the MAIN/AUX memory location that corresponds to the coordinate X,Y.
Example usage: 10 C%=0:&SCRN(12,23,C%):PRINT C%
&V Print out version and contact information for the DOHIRES library.

Color
Number

Color Description

Color
Number

Color Description

0

Black

8

Dark Blue

1

Magenta

9

Purple

2

Brown

10

Gray 2

3

Orange

11

Pink

4

Dark Green

12

Medium Blue

5

Gray 1

13

Light Blue

6

Green

14

Aqua

7

Yellow

15

White

 

10  &  HGR
15  REM  LOAD DHCOREAMP FIRST!
20  & M
30  FOR I = 0 TO 15
40  &  HCOLOR= I
50  & R1 + (I * 5),1 + (I * 5),8 + (I * 5),3 + (I * 5),I,I
60  &  SCRN( 1 + (I * 5),1 + (I * 5),C%)
70  PRINT C%;" - ";
80  NEXT I
90  END

Example code, that draws rectangles at various colors, and then uses the SCRN function to retrieve the color of a pixel within the rectangles and display that value.

The output of the &V command, displaying the version and contact information.