graphicsbasicretro-computing

Is there a way to access DHR on the Apple 2 from Applesoft Basic


When using Applesoft Basic on the Apple 2 with an 80 column card, is there a way to create DHR graphics using only POKE?

I have found a number of solutions using third party extensions such as Beagle Graphics, but I really want to implement it myself. I've searched my Nibble magazine collection, and basic books, but have been unable to find any detailed information.

Wikipedia:

Double High-Resolution The composition of the Double Hi-Res screen is very complicated. In addition to the 64:1 interleaving, the pixels in the individual rows are stored in an unusual way: each pixel was half its usual width and each byte of pixels alternated between the first and second bank of 64KB memory. Where three consecutive on pixels were white, six were now required in double high-resolution. Effectively, all pixel patterns used to make color in Lo-Res graphics blocks could be reproduced in Double Hi-Res graphics. The ProDOS implementation of its RAM disk made access to the Double Hi-Res screen easier by making the first 8 KB file saved to /RAM store its data at 0x012000 to 0x013fff by design. Also, a second page was possible, and a second file (or a larger first file) would store its data at 0x014000 to 0x015fff. However, access via the ProDOS file system was slow and not well suited to page-flipping animation in Double Hi-Res, beyond the memory requirements.

Wikipedia says that DHR uses 64:1 interlacing, but gives no reference to the implementation. Additionally Wikipedia says you can use the /RAM disk to access, but again gives no reference to the implementation.

I am working an small program that plots a simple version of Connet's Circle Pattern. Speed isn't really as important as resolution.


Solution

  • A member of the comp.sys.apple2.programmer answered my question at: http://groups.google.com/group/comp.sys.apple2.programmer/browse_thread/thread/b0e8ec8911b8723b/78cd953bca521d8f

    Basically you map in the Auxiliary memory from the 80 column card. Then plot on the HR screen and poke to the DHR memory location for the pixel you are trying to light/darken.

    The best full example routine is:

      5 HGR : POKE 49237,0 : CALL 62450 : REM clear hires then hires.aux 
      6 POKE 49246,0 : PG = 49236 
      7 SVN = 7 : HCOLOR= SVN : P5 = .5 
      9 GOTO 100 
     10 X2 = X * 4 : CL = CO : TMP = 8 : FOR I = 3 TO 0 STEP -1 : BIT = CL >= TMP: 
        CL = CL - BIT * TMP : TMP = TMP * P5 
     20 X1 = X + I: HCOLOR= SVN * BIT 
     30 XX = INT (X1 / SVN): H = XX * P5: POKE PG + (H= INT (H)),0 
     40 XX = INT (( INT (H) + (( X1 / SVN) - XX)) * SVN + P5) 
     50 HPLOT XX,Y: POKE PG, 0: NEXT : RETURN 
    100 FOR CO = 0 TO 15 : C8 = CO * 8 
    110 FOR X = C8 TO C8 + SVN: FOR Y = 0 TO 10 : GOSUB 10 : NEXT : NEXT 
    120 NEXT 
    130 REM color is 0 to 15 
    140 REM X coordinate is from 0 to 139 
    150 REM Y coordinate is from 0 to 191