Subject: Re: Newbie Assembly Path: lobby!newstf02.news.aol.com!portc01.blue.aol.com!cpk-news-hub1.bbnplanet.com!news.gtei.net!howland.erols.net!newsfeed.mathworks.com!cyclone.swbell.net!nnrp2.sbc.net.POSTED!not-for-mail Message-ID: <39C4217A.853EEB75@swbell.net> From: Rubywand X-Mailer: Mozilla 4.72 [en] (Win95; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.sys.apple2.programmer,comp.sys.apple2 References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 63 Date: Sat, 16 Sep 2000 20:42:18 -0500 NNTP-Posting-Host: 209.184.83.229 X-Complaints-To: abuse@swbell.net X-Trace: nnrp2.sbc.net 969154999 209.184.83.229 (Sat, 16 Sep 2000 20:43:19 CDT) NNTP-Posting-Date: Sat, 16 Sep 2000 20:43:19 CDT Organization: SBC Internet Services Xref: lobby comp.sys.apple2.programmer:11500 comp.sys.apple2:105964 Simon Biber writes ... > > I'm just starting to learn Apple II assembly using the mini-assembler on my > platinum //e. I'm using the instruction listing, Appendix A of the "Apple II > Reference Manual". > > I've written this program which clears the HGR screen to a colour (white by > default). It works! Can someone help me to see if this is an optimal way of > doing this? > > 300: LDA #FF > 302: LDX #3F > 304: LDY #00 > 306: STX $030E > 309: STY $030D > 30C: STA $0100 > 30F: DEY > 310: BNE $0306 > 312: DEX > 313: CPX #19 > 315: BNE $0304 > > You can change to a different colour by putting the bit-pattern into $0301. > > thanks, > Simon. You could speed things a bit by ... 310: BNE $0309 X is not changed and the value at $030E is still valid. There is no need to STX to $030E. Similarly, you can change 315 to ... 315: BNE $0306 Since Y will be $00 anyway, there is no need to set it to $00 in 304. For even better speed, you can eliminate the Y write to $030D and do a Y-indexed STA at 30C-- i.e. the machine instruction could be 99 00 01. Then rearrange things a little ... 300: LDA #FF 302: LDX #3F 304: LDY #00 306: STY $030D 309: STX $030E 30C: STA $0100,Y 30F: DEY 310: BNE $030C 312: DEX 313: CPX #19 315: BNE $0309 317: RTS Rubywand