Re: [cc65] Overlay Demo: C64 Port ?

From: Oliver Schmidt <ol.sc1web.de>
Date: 2009-10-02 21:31:06
Hi Uz,

First of all thanks for your detailed information (incl. the ASCII art
memory map) :-)

> I cannot really see a problem, but this may be my fault:-)

I checked out the C64 crt0.s and found the following lines:

	lda    	#<(__RAM_START__ + __RAM_SIZE__)
	sta	sp
	lda	#>(__RAM_START__ + __RAM_SIZE__)
       	sta	sp+1   		; Set argument stack ptr

So now I see why you see no problem. One can directly control the
stack position from the linker config so there's in fact no problem on
the C64 :-)

> It should even be possible to define a symbol like "OVERLAY_SIZE" and use this
> to determine the boundary between regular and and overlay memory are in the
> linker config. If you make this symbol "weak", it can be specified on the
> command line.

I'll check that out.

> Similar linker scripts should also work for the other platforms.

Certainly not all. The Apple2 crt0.s contains the code below, so
there's no way to change the stack position from the linker config...

Again thanks, Oliver

        ; Check ProDOS system bit map
        lda     $BF6F           ; protection for pages $B8 - $BF
        cmp     #%00000001      ; exactly system global page is protected
        bne     basic

        ; No BASIC.SYSTEM so use addr of ProDOS system global page
        lda     #<$BF00
        ldx     #>$BF00
        bne     :+              ; Branch always

        ; Get highest available mem addr from BASIC interpreter
basic:  lda     HIMEM
        ldx     HIMEM+1

        ; Setup the C stack
:       sta     sp
        stx     sp+1
----------------------------------------------------------------------
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 Oct 2 21:31:14 2009

This archive was generated by hypermail 2.1.8 : 2009-10-02 21:31:16 CEST