<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Wed, 16 Nov 2005 09:14:05 +0000
From   : Richard Gellman <splodge@...>
Subject: Re:: Master Shadow RAM access?

Best bet is to compile a little machine code routine in low memory to do 
this:

FOR I%=0 to 3 STEP 2:P%=&900:[ OPT I%
lda #0: sta &70: sta &72
lda #&30:sta &71: lda #&80: sta &73
lda #108:ldx #1:jsr &fff4
sei
lda &f4: sta &74
lda #4: sta &fe30
.loop
lda (&70):sta (&72)
lda &70:clc:adc #1:sta &70
lda &71:adc #0:sta &71
lda &72:clc:adc #1:sta &72
lda &73:adc #0:sta &73
lda &71
cmp #&80
beq exit
lda &71
cmp #&70
bne loop
lda #5: sta &fe30
lda &80
sta &72
jmp loop
.exit
lda &74:sta &fe30
cli
lda #108:ldx#0:jmp &fff4
] NEXT

This stores the first 16K in bank 4, then the rest in bank 5 (check this 
for errors first please...). The code also assumes that youwant to 
switch the main memory back in afterwards (*FX108,0). You could modify 
the start and end to get the current shadow memory state using OSBYTE 
108, and reinstate it at the end.

The code disables interrupts before starting, and re-enables them when 
done, so there should be no interruption to memory or crashing while it 
modifies ROMSEL. In case your curious as to what location &f4 is for, 
its the MOS' copy of ROMSEL (since ROMSEL is write only, at least on a 
Master) which we use to restore the current ROM (probably BASIC) when 
we're done.

-- Richard

Peter Craven wrote:

> Richard
>
> I'm looking at making a M/Code program (that saves screen memory to 
> sideway RAM)  located underneath any BASIC program. The M/Code program 
> would cater for the possibility that the BASIC program is using SHADOW 
> mode and the BASIC program extends beyond &3000.
>
> So when the BASIC program calls the M/Code program, I want the code to 
> save the screen memory to sideways RAM, but not lose the BASIC program.
>
> I guess I am basically asking Is there a direct way of access the 
> SHADOW RAM without paging the RAM into Main Memory? I just cannot see 
> a way. Considered using unknown plot commands, but I think this does 
> page the SHADOW RAM in anyway??
>
> Cheers
>
> Pete
>
> */Richard Gellman <splodge@...>/* wrote:
>
>
>     *FX 108,1
>     *SRWRITE 3000+5000 8000 ! 4
>     *FX 108,0
>
>     Job's a good'un :)
>
>     (obviously do this from a BASIC proggy, else screen corruption, etc.)
>
>     -- Richard
>
>     Peter Craven wrote:
>
>     > Is anyone aware of a way to transfer the Shadow RAM to Sideways RAM
>     > on the Master other than byte-by-byte access using JSR&C000?
>     >
>     > Cheers
>     >
>     > Pete
>     >
>     >
>     >
>     > Dr Peter Craven (MBBS Uni. of Qld)
>     > 12 Treacher St
>     > Mt Gravatt
>     > QLD 4122
>     > Ph (H): (07) 3349 0820
>     >
>     >
>     ------------------------------------------------------------------------
>     > ____________________________________________________
>     >
>     ------------------------------------------------------------------------
>     > Do you Yahoo!?
>     > Never miss an Instant Message - Yahoo! Messenger for SMS
>     >
>
>
>
>
>
>
>
> Dr Peter Craven (MBBS Uni. of Qld)
> 12 Treacher St
> Mt Gravatt
> QLD 4! 122
> Ph (H): (07) 3349 0820
>
> ------------------------------------------------------------------------
> ____________________________________________________
> ------------------------------------------------------------------------
> Do you Yahoo!?
> Never miss an Instant Message - Yahoo! Messenger for SMS 
> <http://rd.yahoo.com/mail/au/mailsms/*http://au.mobile.yahoo.com/sms/msgr/> 
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>