Applesoft BASIC High Resolution Graphics

High Resolution (HiRes) modes

  • HGR and HGR2 both set hi-resolution graphics mode.
  • HGR sets a mixed mode of text and graphics (280x160 pixels).
  • HGR2 sets full-screen graphics mode (280x192 pixels).
  • When the screen is in HGR mixed mode there are four TEXT-mode lines on the bottom of the screen.
HGR  = hires with text, 1st page starting at memory location `$2000`
HGR2 = hires no text, 2nd page starting at memory location `$4000`
POKE 49234,0 = switch to full-page without text
Poke -16299,0 Switch from high-res page 1 to page 2
Poke -16300,0 Switch from high-res page 2 to page 1
Poke -16302,0 Full screen graphics - no text

Memory Locations

  • There are two pages of HiRes graphics.
  • The first page, HGR, starts at $2000
  • The second page, HGR2, starts at $4000
$E000-FFFF - Monitor ROM / Extended RAM 8 / 8 kB 
$D000-DFFF - BASIC ROM / RAM bank 1 and 2 4 / 4 / 4 kB 
$C800-CFFF - Shared slot ROM memory 2 kB 
$C100-C7FF - Permanent Slot ROM memory 256 per slot 
$C000-C0FF - Softswitches 256 bytes
$6000-BFFF - Free memory 24 kB 
$4000-5FFF - Free memory / Hi-Res page 2 8 kB 
$2000-3FFF - Free memory / Hi-Res page 1 8 kB
$0C00-1FFF - Free memory 5 kB 
$0800-0BFF - Free memory / Text page 2 1 kB 
$0400-07FF - Text page 1 1 kB 
$03D0-03FF - Interrupt vectors 48 bytes 
$0300-03CF - Free memory 208 bytes 
$0200-02FF - Input prompt character buffer 256 bytes 
$0100-01FF - CPU stack 256 bytes 
$0000-00FF - Zero page 

High Resolution (HiRes) graphics mode colors

  • Hi-res modes have just eight colors.
0: black 1
1: green
2: magenta
3: white 1
4: black 2
5: red
6: blue
7: white 2

High Resolution (HiRes) graphics mode BASIC commands

HGR Set display to mixed/high resolution ("hires") graphics mode
HCOLOR= aexpr
HPLOT [TO] aexpr, aexpr [ TO aexpr, aexpr ]

HCOLOR=2 : HPLOT 0,0 : CALL 62454 : REM fill screen with last hcolor

HGR Mixed-Mode Screen Dimensions

     ______________________________
    |(0,0)                  (279,0)|
    |                              |
    |                              | GRAPHICS
    |                              |
    |(0,159)              (279,159)|
    |------------------------------|
    |HTAB  1                       | TEXT
    |VTAB 21                       | 4 rows
    |______________________________|


HGR/HGR2 Full-Screen Screen Dimensions

     ______________________________
    |(0,0)                  (279,0)|
    |                              |
    |                              | GRAPHICS
    |                              |
    |                              |
    |                              |
    |                              |
    |(0,192)              (279,192)|
    |______________________________|


0 HGR : HOME

10 HCOLOR=5
20 HPLOT 0,0 TO 279,0
30 HPLOT TO 279,159
40 HPLOT TO 0,159
50 HPLOT TO 0,0

60 HCOLOR=2
70 HPLOT 0,0   TO 279,159
80 HCOLOR=1
90 HPLOT 0,159 TO 279,0

100 HOME : HTAB 1 : VTAB 21
120 PRINT "Press any key to continue"
130 GET ANS$

140 HOME : HTAB 1 : VTAB 21
160 PRINT "Thank you for playing"

210 HCOLOR=6
220 HPLOT 0,0 TO 279,0
230 HPLOT TO 279,159
240 HPLOT TO 0,159
250 HPLOT TO 0,0
260 HPLOT 0,0   TO 279,159
270 HPLOT 0,159 TO 279,0
  • In a not so random way.

0 HGR : POKE 49234,0 : HOME
05 DEF FN RANDOM(X) = (INT(RND(1) * X) + 1)

10 FOR I=1 TO 20

30 LET C = FN RANDOM(7) : HCOLOR=C : LET HPAD= FN RANDOM(250)  : LET VPAD= FN RANDOM(170)  : GOSUB 500
40 LET C = FN RANDOM(7) : HCOLOR=C : LET HPAD= FN RANDOM(250)  : LET VPAD= FN RANDOM(170)  : GOSUB 500
50 LET C = FN RANDOM(7) : HCOLOR=C : LET HPAD= FN RANDOM(250)  : LET VPAD= FN RANDOM(170)  : GOSUB 500
60 LET C = FN RANDOM(7) : HCOLOR=C : LET HPAD= FN RANDOM(250)  : LET VPAD= FN RANDOM(170)  : GOSUB 500
70 LET C = FN RANDOM(7) : HCOLOR=C : LET HPAD= FN RANDOM(250)  : LET VPAD= FN RANDOM(170)  : GOSUB 500

80 NEXT
99 END

500 REM HPAD subroutine
510 IF (C = 0) THEN HCOLOR=1 : REM no black circles
515 IF (C = 4) THEN HCOLOR=5 : REM no black circles
520 HPLOT HPAD + 14,VPAD +  8 TO HPAD + 17,VPAD +  8
525 HPLOT HPAD + 13,VPAD +  9 TO HPAD + 18,VPAD +  9
530 HPLOT HPAD + 12,VPAD + 10 TO HPAD + 19,VPAD + 10
540 HPLOT HPAD + 11,VPAD + 11 TO HPAD + 20,VPAD + 11

550 HPLOT HPAD + 11,VPAD + 12 TO HPAD + 20,VPAD + 12

560 HPLOT HPAD + 11,VPAD + 13 TO HPAD + 20,VPAD + 13
570 HPLOT HPAD + 12,VPAD + 14 TO HPAD + 19,VPAD + 14
580 HPLOT HPAD + 13,VPAD + 15 TO HPAD + 18,VPAD + 15
590 HPLOT HPAD + 14,VPAD + 16 TO HPAD + 17,VPAD + 16
999 RETURN
categories: appleii | appleiie | applesoftbasic | retrocomputing |