Re: [cc65] Atari Extended Memory Driver Anybody?

From: Oliver Schmidt <ol.sc1web.de>
Date: 2012-08-10 15:55:55
Hi Shawn,

First of all thanks for looking into this :-)

> Ok, looking at the apple2auxmem.s file, and it looks pretty
> straight-forward, but here are some problems I see right off the bat, all
> caused by the issue of the HUGE memory banking window for the Atari memory
> expansion ($4000-7FFF).

On the Apple II the memory is even much larger - furtunately Apple
provided a copy routine in ROM as about everything else is banked...

> 1. The driver needs to avoid this memory window, so what memory segment do
> you load it into?  It would basically need to be in LOWCODE.  BSS probably
> will not work, as that's going to be smack in the middle of the banking
> window usually.
>
> 2. You have to define a 256-byte "window" to use with the EM driver.  This
> also is in BSS... same problem as above, how do we avoid the banking window?
>
> Now I'm starting to remember why I gave up... :)

That LOWCODE thingy doesn't really lead to anything as the driver is
generally supposed to be loaded dynamically - meaning on the heap. If
I get your scenario right I'd approach it like this:

- Have a 256 byte "soft window" inside the driver like the Apple driver:
.bss
window:		.res	256		; Memory "window"

- Dynamically create a short asm routine on the cpu stack. The address
of the "soft window" and the address in the extended memory are
written as constants into the routine.

- The routine hits $D301 twice for every single byte implementing a
byte-per-byte transfer from/to the "soft window". Something like the
below (using 19 bytes)

1:ldy #$..
sty $D301
lda $....,x
ldy #$..
sty $D301
sta $....,x
dex
bne 1
rts

- Call the routine with X = 0.

- Implement copyfrom/copyto by creating a new asm routine on the stack
for every 256 bytes to copy. The routine is similar to the one above
but instead of using the "soft window" it is using the current final
source/target address. For the last bytes left probably less than 256
call the routine with X != 0.

Just my two cents,
Oliver
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Fri Aug 10 15:56:19 2012

This archive was generated by hypermail 2.1.8 : 2012-08-10 15:56:22 CEST