Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How do I access the HGR screen from Assembly?

615 views
Skip to first unread message

ep88t...@gmail.com

unread,
Oct 27, 2013, 3:34:43 PM10/27/13
to
Hey,

I'm new to 6502 programming. The book I'm reading talks briefly about using the lo-res routine and the plot location $F800 like below:

ORG $300
OBJ $300
JSR $FB40 ;LORES GR
LDA #44 ;COLOR15
STA $0030
LDY #15 ;COL
LDA #05 ;ROW
JSR $F800 ;PLOT
RTS

But how the heck do I enter HGR or HGR2? I'm assuming color is still stored in $0030 and row and column are stored in the accumulator and y-register. It would be a huge help if someone could write out the listing similar to the GR I posted with a single plot made. Also any recommended books or sites I should visit?

Marco Verpelli

unread,
Oct 27, 2013, 4:31:37 PM10/27/13
to
High resolution graphics is the hardest thing in the Apple //.

You can call the AppleSoft routine from your code.
Accessing the screen directly require a lot of work: index tables, pre-shifted shapes,...

Maybe is better learning a bit more ML before start writing graphic program.

ftp://ftp.apple.asimov.net/pub/apple_II/documentation/programming/6502assembly/

is the place to look for documentation.

Marco

Antoine Vignau

unread,
Oct 27, 2013, 5:16:47 PM10/27/13
to
Learn softswitches

c050
c052/c053
c054/c055
c057

Av

gid...@sasktel.net

unread,
Oct 27, 2013, 8:22:10 PM10/27/13
to
Better yet. Learn Applesoft entry points.

$F3D8 - HGR2
$F3E2 - HGR
$F605 - XDRAW
$F661 - DRAW
$F6E9 - HCOLOR
$F6FD - HPLOT
$F721 - ROT
$F727 - SCALE

Steve Nickolas

unread,
Oct 27, 2013, 8:40:54 PM10/27/13
to
On Sun, 27 Oct 2013, gid...@sasktel.net wrote:

> Better yet. Learn Applesoft entry points.
>
> $F3D8 - HGR2
> $F3E2 - HGR
> $F605 - XDRAW
> $F661 - DRAW
> $F6E9 - HCOLOR
> $F6FD - HPLOT
> $F721 - ROT
> $F727 - SCALE

That won't help you on an Integer ][. =p

-uso.

ep88t...@gmail.com

unread,
Oct 27, 2013, 9:01:05 PM10/27/13
to
Just realized there's a programmers group as well, probably should have posted this there.

So the applesoft HGR routine worked to clear the HGR screen, but how do I use the HPLOT routine example. Do I load the column value to Y (e.g. LDY #$0004) and the row to the accumulator and then "JRE $F6FD "? Cause that didn't work. Tried different colors. What's the secret to plotting on the HGR screen from assembly?

Benoit0123

unread,
Oct 28, 2013, 3:20:12 AM10/28/13
to
Have you tried
MYCOLOR = 7
COORDXFROM = 260
COORDYFROM = 100
JSR $F3E2 ;Set HGR page 1, displays page 1, draws into page 1
LDX #MYCOLOR
JSR $F6F0 ;Calls HCOLOR with color index in X reg.
LDX #COORDXFROM
LDY #>COORDXFROM
LDA #COORDYFROM
JSR $F457 ;Calls HPLOT to plot pixel on current page
LDA #COORDXTO
LDX #>COORDXTO
LDY #COORDYTO
JSR $F53A ;Calls HLINE to plot a line to "TO" pixel coordinates

Applesoft ROM being selected in bank $E0-$FF
Otherwise for details upon hires graphics "from the author's mouth", here is
a link to reference data:
http://www.lulu.com/shop/bill-martens-and-brian-wiser/the-wozpak-special-edition-steve-wozniaks-apple-1-apple-computers/paperback/product-21145348.html#ratingsReview
Otherwise I believe that there is an archive of "call apple: all about
applesoft" which gives details upon Hires plotting routines within Applesoft
and thus to help authors optimize the calls for graphic primitives within
the ROM.

HTHATS,
Benoît


Benoit0123

unread,
Oct 28, 2013, 3:21:33 AM10/28/13
to
One last thing: I think that comp.sys.apple.programmer is the best place to
post such query instead of to this place..
Benoît



D Finnigan

unread,
Oct 28, 2013, 11:40:49 AM10/28/13
to
ep88theman wrote:
> Hey,
>
> I'm new to 6502 programming. The book I'm reading talks briefly about
> using the lo-res routine and the plot location $F800 like below:

What book are you reading?

>
> But how the heck do I enter HGR or HGR2?

You need to access the screen soft-switches. These are memory locations that
affect what mode the Apple II is in. When it comes to showing information on
the screen, the Apple II has two main modes:

1.) Text
2.) Graphics

Text mode is split into sub-modes of 40 and 80 columns.
For graphics, there is Low-resolution and High-resolution graphics modes.

It is possible to show graphics at the top portion of the screen with room
below for four lines of text. Each of these two modes has variants, such as
80-columns text, or low-resolution graphics with 4 lines for text at the
bottom. Or you can have the entire screen be composed of low-res or high-res
graphics.

To enter graphics mode, access memory location $C050.

Assembly programmers typically use LDA $C050. The contents of the
accumulator don't matter.
To get back to text mode, use $C051.

When you first boot the Apple and use $C050, you will see the low-resolution
screen. Since it shares space with the text screen, it will be the blocky
outlines of what characters had been on the screen.

To get to high-resolution mode, use $C055.

For all of these soft-switches, you could consult the Apple II reference
manuals, which I mention down below.

As for programming the graphics displays on your own, the low-resolution
display is fairly simple, but- high-resolution is notably complex. There is
further complication in that the memory for these displays is not linear.
Again, read the Apple II books which I mention below for more explanation.

> Also any recommended
> books or sites I should visit?
>

1.) The white spiral-bound Apple II Reference Manual is preferable for the
II and II Plus, or the appropriate Apple reference manual for the later
models. This will give you:

- Monitor ROM listing
- Entry points to useful routines in the Monitor ROM and how to use them
- Charts that will show you the 6502 Mnemonics and opcodes
- Information on how to use the various screen modes: text, lo-res, and
hi-res
- Soft-switches and what they do


2.) Hi-res graphics and animation using assembly language: The guide for
Apple II programmers
by Leonard Malkin
ISBN-10: 0810467585

I think this is a pretty good book since it starts with the basics of
assembly language programming, then moves on to showing how to plot shapes
on the screen, then proceeds to animating the shapes, then finishes with an
action game using sound, joystick, and the other concepts that had been
presented in earlier chapters. If you are using a IIe or later model, it has
a chapter showing how to program double-high-resolution graphics.

--
]DF$
Apple II Book: http://macgui.com/newa2guide/
Usenet: http://macgui.com/usenet/ <-- get posts by email!
Apple II Web & Blog hosting: http://a2hq.com/

D Finnigan

unread,
Oct 28, 2013, 4:23:04 PM10/28/13
to
Here is a big list of soft-switches:

http://macgui.com/usenet/?group=2&id=5291#msg

This came from the Apple IIgs reference, so the older Apple models won't
necessarily have them all.

Cyril Thibout

unread,
Oct 29, 2013, 12:39:44 PM10/29/13
to
Hi

"Apple_Graphics_&_Arcade_Game_Design" from JEffrey Stanton is a great book too on graphics and ASM with many real case examples.

I have the real book + the PDF version (I could upload it somewhere?)
thanks

cyril

Egan Ford

unread,
Oct 29, 2013, 6:10:43 PM10/29/13
to
On 10/29/13 10:39 AM, Cyril Thibout wrote:
> (I could upload it somewhere?)

No need.

https://archive.org/details/Apple_Graphics_Arcade_Game_Design

Antoine Vignau

unread,
Oct 29, 2013, 10:06:00 PM10/29/13
to
Another good book:

Assembly language for the Applesoft programmer
by C. W. Finley, Jr. and Roy E. Myers
Published by Addison Wesley
Ref 5209
ISBN 0-201-05209-1

Frankly, that book is a wonder!
Antoine

gid...@sasktel.net

unread,
Oct 30, 2013, 12:35:57 AM10/30/13
to
On Sunday, October 27, 2013 6:22:10 PM UTC-6, gid...@sasktel.net wrote:
> On Sunday, 27 October 2013 15:16:47 UTC-6, Antoine Vignau wrote:
>
> > Learn softswitches

> > c050
> > c052/c053
> > c054/c055
> > c057

> $F3D8 - HGR2
> $F3E2 - HGR
> $F605 - XDRAW
> $F661 - DRAW
> $F6E9 - HCOLOR
> $F6FD - HPLOT
> $F721 - ROT
> $F727 - SCALE



The beagle bros poster will also help with a lot of the calls

http://beagle.applearchives.com/the_posters/poster_2.html
0 new messages