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

Re: Hires - to - Lores ... Yikes



On 23 Jul 2004 06:42:41 GMT, mjmahon@aol.com (Michael J. Mahon) wrote:

>Bender MX wrote:
>
>>"Bill Garber" <willy46pa@comcast DOT net> wrote in message
>>35CdnbCeQ42tCZ3cRVn-sA@comcast.com">news:35CdnbCeQ42tCZ3cRVn-sA@comcast.com...
>>>
>>> Restore those locations at the end before you RTS.  :o)
>>>
>>> Bill @ GarberStreet Enterprizez };-)
>>> Web Site - http://garberstreet.netfirms.com
>>> Email - willy46pa @ comcast DOT net
>>> Change DOT to a dot to contact me
>>
>>Hehe, Hi Bill,
>>
>>Sure sure, and double the size of my code! :)
>>
>>I'm going to do that tomorrow night.  I'm a serious
>>newbie at Apple 6502 code ... Basic, no problem,
>>6502 code - yipe yipe yipe ...
>>
>>Mental exercise:
>>I'd just have to LDA or LDX with the $40 and $20
>>and STA or STX at $0304 and $0307, correct?
>
>Right.
>
>And the usually preferable way is to initialize variables
>_before_ using them, rather than resetting them after
>use.  That way if someone wants to work, say, on a
>different page, they can just POKE the initializing
>instruction immediate values.
>
>-michael
>
>Check out parallel computing for 8-bit Apples on my
>Home page:  http://members.aol.com/MJMahon/

My 6502 code is a *bit* rusty these days, but I think this would do
the job.  If I'm wrong about the ROL opcode, replacing it with a
simple LDA #$40 would do the job at the expense of being twice the
size (but being more generic).

                                 LDA #$20     ;%00100000
                                 STA $0304
                                 ROL              ;%01000000
                                 STA $0307
300- A2 00                LDX  #$00
302- BD 00 20           LDA $2000,X
305- 9D 00 04           STA $0400,X
308- E8                      INX
309- D0 F7                BNE $0302
30B- EE 04 03           INC $0304
30E- EE 07 03           INC $0307
311- AD 07 03          LDA $0307
314- C9 08               CMP #$08
316- D0 E8               BNE $0300
318- 60                     RTS