Path: blue.weeg.uiowa.edu!news.uiowa.edu!uunet!salliemae!europa.eng.gtefsd.com!howland.reston.ans.net!vixen.cso.uiuc.edu!news.uoregon.edu!cie-2.uoregon.edu!nparker
From: nparker@cie-2.uoregon.edu (Neil Parker)
Newsgroups: comp.sys.apple2.programmer
Subject: Re: HiRes SCRN
Date: 19 Nov 1994 01:19:48 GMT
Organization: University of Oregon Campus Information Exchange
Lines: 51
Message-ID: <3ajjrk$nfq@pith.uoregon.edu>
References: <Pine.3.07.9411172342.A2979-c100000@acme> <CzGsyE.2p9@actrix.gen.nz>
NNTP-Posting-Host: cie-2.uoregon.edu

In article <CzGsyE.2p9@actrix.gen.nz> dempson@atlantis.actrix.gen.nz (David
Empson) writes:
>[...munch, crunch, chomp, yum, yum...]
>         I don't know off-hand if Applesoft has a convenient HBASCALC
>routine (it must have one somewhere), as I've never used Applesoft's
>Hi-res routines from assembly language.

Yes, Applesoft has an HBASCALC routine that machine-language programs can
call.

HPOSN	EQU	$F411
Inputs: A = Y coordinate
        X = low byte of X coordinate
        Y = hi byte of X coordinate
        HCOLOR ($E4) = color mask
	HPAG ($E6) = page to plot on ($20=page 1, $40=page 2)
Outputs: HBASL, HBASH ($26,27) = base address of line
         HNDX ($E5) = offset to byte containing pixel
         HMASK ($30) = mask byte for pixel
         HCOLOR1 ($1C) = shifted color mask
         X0L ($E0) = low byte of X-coordinate
         X0H ($E1) = hi byte of X-coordinate
         Y0 ($E2) = Y-coordinate

In addition to returning the address of the specified row, this also computes
the offset from the beginning of the row to the byte containing the requested
pixel, and a mask that can be used to pick out the pixel's bit from the
byte.  It also fixes the color mask to account for the even/odd-byte color
shift, but if all you want is to find the address of a pixel, you can just
ignore all the color information.

There's also an inverse function that goes from memory address to X,Y
coordinates.

HFIND	EQU	$F5CB
Inputs: HBASL, HBASH ($26,27) = base address of line
        HNDX ($E5) = offset to byte containing pixel
        HMASK ($30) = mask byte for pixel
Outputs: X0L ($E0) = low byte of X-coordinate
         X0H ($E1) = hi byte of X-coordinate
         Y0 ($E2) = Y-coordinate



(I have a fairly complete list of hi-res entry points, if anybody's
interested.)

               - Neil Parker
--
     Neil Parker *** nparker@cie-2.uoregon.edu *** nparker@cie.uoregon.edu
                     "Ooh!  Bad move, Neil!"  -- The Tick
