Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.apple2 > #16594 > unrolled thread

How do I access the HGR screen from Assembly?

Started byep88theman@gmail.com
First post2013-10-27 12:34 -0700
Last post2013-10-29 19:06 -0700
Articles 14 — 9 participants

Back to article view | Back to comp.sys.apple2


Contents

  How do I access the HGR screen from Assembly? ep88theman@gmail.com - 2013-10-27 12:34 -0700
    Re: How do I access the HGR screen from Assembly? Marco Verpelli <mverpelli@libero.it> - 2013-10-27 13:31 -0700
      Re: How do I access the HGR screen from Assembly? Antoine Vignau <antoine.vignau@laposte.net> - 2013-10-27 14:16 -0700
        Re: How do I access the HGR screen from Assembly? gids.rs@sasktel.net - 2013-10-27 17:22 -0700
          Re: How do I access the HGR screen from Assembly? Steve Nickolas <usotsuki@buric.co> - 2013-10-28 00:40 +0000
          Re: How do I access the HGR screen from Assembly? ep88theman@gmail.com - 2013-10-27 18:01 -0700
            Re: How do I access the HGR screen from Assembly? Benoit0123 <bgilon@free.fr> - 2013-10-28 07:20 +0000
            Re: How do I access the HGR screen from Assembly? Benoit0123 <bgilon@free.fr> - 2013-10-28 07:21 +0000
          Re: How do I access the HGR screen from Assembly? gids.rs@sasktel.net - 2013-10-29 21:35 -0700
        Re: How do I access the HGR screen from Assembly? D Finnigan <dog_cow@macgui.com> - 2013-10-28 20:23 +0000
    Re: How do I access the HGR screen from Assembly? D Finnigan <dog_cow@macgui.com> - 2013-10-28 15:40 +0000
    Re: How do I access the HGR screen from Assembly? Cyril Thibout <info@pulsar-informatique.com> - 2013-10-29 09:39 -0700
      Re: How do I access the HGR screen from Assembly? Egan Ford <datajerk@gmail.com> - 2013-10-29 16:10 -0600
    Re: How do I access the HGR screen from Assembly? Antoine Vignau <antoine.vignau@laposte.net> - 2013-10-29 19:06 -0700

#16594 — How do I access the HGR screen from Assembly?

Fromep88theman@gmail.com
Date2013-10-27 12:34 -0700
SubjectHow do I access the HGR screen from Assembly?
Message-ID<039ba9d3-4960-4e48-a416-e0477f426b20@googlegroups.com>
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?

[toc] | [next] | [standalone]


#16598

FromMarco Verpelli <mverpelli@libero.it>
Date2013-10-27 13:31 -0700
Message-ID<9916fe81-6b60-4a02-923f-26c1016839e8@googlegroups.com>
In reply to#16594
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

[toc] | [prev] | [next] | [standalone]


#16599

FromAntoine Vignau <antoine.vignau@laposte.net>
Date2013-10-27 14:16 -0700
Message-ID<bd81a0b6-bb0c-4d5d-bfc8-0cdd2b8eb8ae@googlegroups.com>
In reply to#16598
Learn softswitches

c050
c052/c053
c054/c055
c057

Av

[toc] | [prev] | [next] | [standalone]


#16604

Fromgids.rs@sasktel.net
Date2013-10-27 17:22 -0700
Message-ID<5cebbf91-39f1-4a7b-9b27-10c100f93e3a@googlegroups.com>
In reply to#16599
On Sunday, 27 October 2013 15:16:47 UTC-6, Antoine Vignau  wrote:
> Learn softswitches

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



Better yet.  Learn Applesoft entry points.

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

[toc] | [prev] | [next] | [standalone]


#16607

FromSteve Nickolas <usotsuki@buric.co>
Date2013-10-28 00:40 +0000
Message-ID<alpine.DEB.2.02.1310280040300.92507@localhost>
In reply to#16604
On Sun, 27 Oct 2013, gids.rs@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.

[toc] | [prev] | [next] | [standalone]


#16608

Fromep88theman@gmail.com
Date2013-10-27 18:01 -0700
Message-ID<0925033c-4c17-4242-a209-50e54be0ab48@googlegroups.com>
In reply to#16604
On Sunday, October 27, 2013 5:22:10 PM UTC-7, 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
> 
>  
> 
> > Av
> 
> 
> 
> 
> 
> 
> 
> Better yet.  Learn Applesoft entry points.
> 
> 
> 
> $F3D8 - HGR2
> 
> $F3E2 - HGR
> 
> $F605 - XDRAW
> 
> $F661 - DRAW
> 
> $F6E9 - HCOLOR
> 
> $F6FD - HPLOT
> 
> $F721 - ROT
> 
> $F727 - SCALE


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?

[toc] | [prev] | [next] | [standalone]


#16614

FromBenoit0123 <bgilon@free.fr>
Date2013-10-28 07:20 +0000
Message-ID<benoit0123-1382944810@macgui.com>
In reply to#16608
ep88theman wrote:
> On Sunday, October 27, 2013 5:22:10 PM UTC-7, 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
>> 
>>  
>> 
>> > Av
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> Better yet.  Learn Applesoft entry points.
>> 
>> 
>> 
>> $F3D8 - HGR2
>> 
>> $F3E2 - HGR
>> 
>> $F605 - XDRAW
>> 
>> $F661 - DRAW
>> 
>> $F6E9 - HCOLOR
>> 
>> $F6FD - HPLOT
>> 
>> $F721 - ROT
>> 
>> $F727 - SCALE
> 
> 
> 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?
>
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
 

[toc] | [prev] | [next] | [standalone]


#16615

FromBenoit0123 <bgilon@free.fr>
Date2013-10-28 07:21 +0000
Message-ID<benoit0123-1382944892@macgui.com>
In reply to#16608
ep88theman wrote:
> On Sunday, October 27, 2013 5:22:10 PM UTC-7, 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
>> 
>>  
>> 
>> > Av
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> Better yet.  Learn Applesoft entry points.
>> 
>> 
>> 
>> $F3D8 - HGR2
>> 
>> $F3E2 - HGR
>> 
>> $F605 - XDRAW
>> 
>> $F661 - DRAW
>> 
>> $F6E9 - HCOLOR
>> 
>> $F6FD - HPLOT
>> 
>> $F721 - ROT
>> 
>> $F727 - SCALE
> 
> 
> 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?
>
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


[toc] | [prev] | [next] | [standalone]


#16645

Fromgids.rs@sasktel.net
Date2013-10-29 21:35 -0700
Message-ID<2ec98d20-112a-4acd-ac1c-af68534c8a93@googlegroups.com>
In reply to#16604
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

[toc] | [prev] | [next] | [standalone]


#16619

FromD Finnigan <dog_cow@macgui.com>
Date2013-10-28 20:23 +0000
Message-ID<dog_cow-1382991782@macgui.com>
In reply to#16599
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.

-- 
]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/

[toc] | [prev] | [next] | [standalone]


#16617

FromD Finnigan <dog_cow@macgui.com>
Date2013-10-28 15:40 +0000
Message-ID<dog_cow-1382974847@macgui.com>
In reply to#16594
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/

[toc] | [prev] | [next] | [standalone]


#16641

FromCyril Thibout <info@pulsar-informatique.com>
Date2013-10-29 09:39 -0700
Message-ID<ba2b2ce6-d8fa-42b2-a196-a08f61e93d37@googlegroups.com>
In reply to#16594
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

[toc] | [prev] | [next] | [standalone]


#16643

FromEgan Ford <datajerk@gmail.com>
Date2013-10-29 16:10 -0600
Message-ID<l4pbp3$mdm$1@news.xmission.com>
In reply to#16641
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

[toc] | [prev] | [next] | [standalone]


#16644

FromAntoine Vignau <antoine.vignau@laposte.net>
Date2013-10-29 19:06 -0700
Message-ID<350fb445-d24c-44d8-8f6d-84e6c3f2566e@googlegroups.com>
In reply to#16594
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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.sys.apple2


csiph-web