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

Re: Auxilary Ram card programming info..



Hi Matt,

What I have is reference to the Zram 2c card. AFAIK, the info is
the same for all Applied aux memory cards.

First, Applied cards work by using a bank select switch at $c073
and then using the standard Apple aux bank routines. Basically,
you select the bank you want then treat it like it's the aux 64k
bank of ram. Some things to keep in mind, not all cards have the
full compliment of ram and this should be checked by your program.
There are multiple interrupt vectors and routines which use aux
memory should be prepared to disable or deal with them. It is
recommended that interrupts be disabled in programs not requiring
their use.

You select on of 16 valid bank numbers into the bank select
registers. Data transfers between banks of auxiliary memory must
done in two stages. First swap from the original page to main ram
then switch banks and transfer the data to the new bank. Bank zero
always contains the 80 column display and graphics data for DHR
and must be active whenever the program updates the display
screen.

The bank select register is shared with the system. Writing to the
register will trigger the [addle strobe. To insure proper paddle
reads you must wait at least 3 milliseconds after changing banks.

All programs should start by initializing the bank register to
zero. The software should be able to handle a reset by storing a
zero in the bank register.

This sample intercepts the reset soft vector at $3f2-$3f3 and
changes it to point to the new reset vector. Code taken from zram
manual.

*store off old reset vector
 lda $3f2
 sta $300
 lda $3f3
 sta $301
*set reset vector to point to $302
 lda #$02
 sta $3f2
 lda #$03
 sta $3f3
 eor #$a5
 sta $3f4
*reset routine
 lda #$a9 ;lda #0
 sta $302
 lda #$0
 sta $303
 lda #$8d ;sta $c073
 sta $304
 lda #$73
 sta $305
 lda #$c0
 sta $306
 lda #$6c ;jmp ($300)
 sta $307
 lda #$00
 sta $308
 lda #$30
 sta $309

The next sample will find all valid banks and store the results
in the bank table. Sorry about the formatting, hope this is
readable.

banksel equ $c073
maxmem equ 3*16

*write bank number to each bank
 sta $c009 ;store in alt zp
 ldy #$7f ;valid banks range $00-$7f
findbanks sty banksel
 sty $00 ;first test
 tya
 eor #$ff
 sta $01 ;second test
 dey
 bpl findbanks
*read them back to find valid banks and save in table
 lda #$00
 tay
 tax
findthem sty banksel
 sta banksel+3
 cpy $00
 bne notone
 tya
 eor #$ff
 cmp #$01
 bne notone
 inx
 tya
 sta banktbl,x ;save valid bank
 cpx #maxmem
 bcs done
notone iny
 bpl findthem
*ending routine
done lda #$00 ;reset to video bank
 sta banksel
 sta $c008
 stx banktbl ;size of ramcard
 lda #$ff
 sta banktbl+1,x ;mark end of table
 jmp continue
banktbl ds maxmem+2
continue equ *

This basic info should help get you started. You may find it
better to use Prodos and a ramdisk for a more standard method of
using extra memory.

-- 

Cheers and best wishes,
Phoenyx

Have you fed your Apple today?

Phoenyx's Pages are back online...

It seems the ZIP.TO link was down for a while.
It is now working again. This is the preferred
link to my site. You may also use the direct link.

http://zip.to/Phoenyx_A2
http://www.tinyangeldesigns.com/Apple2