[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Apple II Graphics Programming (Assembly)



 To: Michael J. Mahon
Michael J. Mahon wrote:
paulrsm wrote:
On Jul 7, 7:40 pm, cerebral_monkey <berkleycame...@gmail.com> wrote:
Am I doing something wrong here? The screen is still filled with
random data after execution. (I wrote a subroutine to clear the
screen, but the built-in version is probably much faster)

My standard way of clearing the hi-res screen is:

 LDA #0 ;FILL BYTE
 LDY #PAGE ;PAGE=$20, $40, or $60
 STY PTR+1
 LDY #0 ;INIT INDEX
 STY PTR
 LDX #$20 ;PAGE COUNT
a STA (PTR),Y
 INY
 BNE a
 INC PTR+1
 DEX
 BNE a
 RTS

If I need speed, then I use

; clear hi-res page 1
 LDA #0 ;FILL BYTE
 LDY #0 ;INIT INDEX
a STA $2000,Y
 STA $2100,Y
 STA $2200,Y
 STA $2300,Y
 ...
 STA $3E00,Y
 STA $3F00,Y
 INY
 BNE a
 RTS

The routine in the Applesoft ROM can be used to clear any screen to
any "color" (including some striped/dithered patterns).  To support
this it complements the low 7 bits of A on each horizontally adjacent
byte to preserve the "color meanings" for both even and odd bytes.

And it does the complementing in a *subroutine* instead of in-line--
a clear case of optimizing for space regardless of speed.

It's also interesting that the capability of "clearing" a screen to
a color other than Black1 (hi-bit off) is not used in Applesoft!

This suggests to me that the incorporation of Woz's Programmer's Aid #1
hi-res routines was done not by Woz, but by some delegate, maybe even
a Microsoft employee.  ;-)

-michael

NadaNet 3.0 for Apple II parallel computing!
Home page:  http://home.comcast.net/~mjmahon/

"The wastebasket is our most important design
tool--and it's seriously underused."


Aha! So my title fight metaphor earlier in this thread may still be valid! I knew it!! ;-)

Cheers,
Mike