Contact me | Login | Search | Sitemap | Site Notice

Double LORES Mode (80x48 pixels)

From the Apple //e enhanced onwards a double LORES mode with 80 x 48 pixels in 16 colors is available. Documentation about this mode is rather sparse and ways to access this mode are fairly complicated for AppleSoft programmers and need machine language tricks in order to get things going on an Apple //e.

If you are a lucky owner of an Apple IIc or IIgs things are easier: with some POKE-commands the double LORES mode can be activated and then standard PLOT-commands from AppleSoft can be used for drawing. However, the SCRN-function is reported to yield unrealiable results in this mode.

The double LORES mode was always a great center of attraction for me and I wanted to write my own tools in order to access this "hidden" graphics mode. After some first experiments I was pointed to the idea by some fellow Apple ][ enthusiasts to create a library that makes use of the AppleSoft &-feature (Ampersand) which enables an easy link from AppleSoft Basic to new machine routines. 

The result is a first version of an ampersand-library which enables an easy access to AppleSoft double LORES graphic routines using the &-command. Read more technical details and instructions on how to use the library below!

  • New stable release: DSK-image (Version 11) with new commands:

    • &SAVE FROM,TO: copy a page FROM to another page TO - value range: 1,2,3 (This command supports three graphic pages located at $0400, $0800 and $0C00 - higher values will be ignored). DOS 3.3 vectors and mouse card data located in the LORES screen holes are automatically restored.
    • &M: toggles between mixed mode graphics (four lines of text at the bottom) or fullscreen graphics.
    • &G: retrieve PAGE1 from PAGE3 and set fullscreen
    • &T: switch to text mode and save current PAGE1 graphics to PAGE3, text screen will be blank.

  • Older stable release: Download a DSK-image with version 10 of the double LORES ampersand core (Version 10c - including &LINE- and &SCRN-bugfix, &M for mixed mode display and 80Store-bugfix, DOS re-hook problem solved, limit checking during mixed mode display) and a load of small AppleSoft demo programs showing the features of the library.
  • Web fame: 

How to use the library?

The library is about 5,5 kB in size and is loaded at memory location $8000. Before the library can be used it needs to be BRUNned which sets up the ampersand-vector at $3F5. The address that is stored in this memory location is the jump destination when the &-command is encountered in an AppleSoft program.

Here the vector is set to the address $808B where the small command parser of the library is located. When a &-command is encountered control is transferred to the command parser and the command itself as well as its parameters are checked for valid input values. If an unknown command, missing or out of range parameters are encountered a SYNTAX ERROR or ILLEGAL QUANTITY ERROR is thrown and the AppleSoft program terminates.

Since the library is designed to support three double LORES pages (memory range from $400-$7FF and $800-$BFF, special dump range from $C00-$FFF) with page flipping it is recommended to load your own AppleSoft program to $1000. This can be accomplished by poking to values into memory and loading of your program afterwards. On the supplied DSK-image the HELLO-program performs these and some other important tasks:

  • POKE 104,16: sets the AppleSoft program start adress to $1000
  • POKE 4096,0: required by AppleSoft, sets the value of $1000 to $00, AppleSoft-tokens start from $1001
  • BRUN DLCOREAMP,A$8000: runs the library's init-routine and sets up the ampersand-vector
  • MAXFILES 1: sets the number of DOS 3.3 file buffers to 1, which is required since the lib table data exceeds the limit of $9600 which is the start adress of a DOS file buffer.
  • HIMEM: 32768: needed in order to keep AppleSoft variable data storage out of the way of the library!

As you can see on the DSK-image by using a small startup program the system can be easily prepared to use the double LORES mode.

After installation of the library the following ampersand-commands are available:

  • &GR: switches to double LORES mode and clears the screen
  • &TEXT: returns to 40-column text mode
  • &COLOR=: sets the plotting color (range: 0..15)
  • &PLOT X,Y[,COLOR]:plots a pixel at X,Y. The parameter COLOR is optional.
  • &SCRN(X,Y,C%): reads out MAIN or AUX memory depending on the given coordinates and returns the color value C% of the selected pixel (range: $00..$0F / 0..15)
  • &VLIN Y1,Y2,X[,COLOR]: plots a vertical line from Y1 to Y2 at column X. The parameter COLOR is optional.
  • &HLIN X1,X2,Y[,COLOR]: plots a horizontal line from X1 to X2 at row Y. The parameter COLOR is optional.
  • &L X1,Y1,X2,Y2[,COLOR]: plots an oblique line from X1/Y1 to X2/Y2 using a fast Bresenham algorithm. The parameter COLOR is optional. When the algorithm detects a pure horizontal or vertical line the HLIN/VLIN-algorithms are called automatically.
  • &C XM,YM,RADIUS[,FILLCOLOR,BORDERCOLOR]: plots a circle with midpoint XM/YM and radius RADIUS with the color that was previously set by the &COLOR=-command. If FILLCOLOR is given, a filled disk is drawn, if BORDERCOLOR is set the border of the disk can be drawn in a different color. It is possible to draw circles/disks that exceed the drawing screen. However, the midpoint of the circle/disk has always to be a valid screen coordinate!
  • &R X1,Y1,X2,Y2[,FILLCOLOR,BORDERCOLOR]: plots a rectangle from X1/Y1 to X2/Y2 with the color that was previously set by the &COLOR=-command. If FILLCOLOR is given, a filled rectrangle is drawn, if BORDERCOLOR is set the border of the rectangle can be drawn in a different color.

Enhanced commands:

  • &F XSEED,YSEED[,COLOR]: Flood fills any polygon on the current drawing screen with the currently set color which was set by the command  &COLOR= before or given by COLOR as an optional input parameter. The seed point (XSEED,YSEED) must lie inside the desired polygon to fill. The polygon to fill must be "closed" otherwise the fill routine will result in strange results.
  • &H: Fill the current drawing screen with the currently set color which was set by the command  &COLOR=. If the current color = 0 then the current drawing screen will be erased.
  • &M: toggle between mixed mode double lores / text with 4 lines of text at the bottom of the screen and fullscreen graphics. The cursor is automatically VTABbed to line 21.
  • &S 1/2: Show page 1 or page 2. This command flips display pages and makes most sense in combination with the following command.
  • &D 1/2: Selects the active drawing page 1 or page 2.
  • &SAVE FROM,TO: fast move of graphic page data. FROM and TO need to be in the range of 1..3, other values are ignored.
  • &G: retrieve PAGE1 from PAGE3 and set fullscreen
  • &T: switch to text mode and save current PAGE1 graphics to PAGE3, text screen will be blank.

In standard operation mode after intializing the double LORES via &GR the drawing and display page are set to 1 so the user can see all the drawings as they happen. If you want to draw on the other page as the user can see you need to issue e.g. the following commands: &S1 : &D2 for drawing on page 2 while displaying page 1. Page flipping would be done after the drawing has been finished with the sequence &S2 : &D1 and vice-versa

Allowed values for X are in the range from 0 to 79 and for Y from 0 to 47. Optional values need not to be supplied.

Example Pictures

Some sample pictures showing the screen output of the demo programs on the DSK-image: