Re: [cc65] Romable configuration / run-time library?

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2013-01-18 23:29:06
On Fri, Jan 18, 2013 at 05:20:31PM -0500, Darryl Sokoloski wrote:
> Yup, that's a bug... though I was lucky and $8F (the address) did
> contain a zero!  That load was from my copy/pasting generated
> assembler from memcpy().  It's been a while, slowly starting to
> remember my 6502 :)

Not copying the data segment might explain the error. vcprintf contains the
following structure in DATA:

outdesc:                        ; Static outdesc structure
        .word   0               ; ccount
        .word   out             ; Output function pointer
        .word   0               ; ptr
        .word   0               ; uns

A pointer to this structure is passed to __printf, which will copy the second
word (the point to the output function) into CallOutFunc. So if your data
segment isn't initialized, this vector will contain garbage.

The code that copies the vector looks like this (it's near the start of
__printf if you want to trace it):

        iny
        lda     (OutData),y
        sta     CallOutFunc+1
        iny
        lda     (OutData),y
        sta     CallOutFunc+2

You might want to trace through the function again, and this time check if the
vector stored here is already invalid (which means that the problem is
probably caused by missing data segment initialization), or corrupted later.

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz@musoftware.de
----------------------------------------------------------------------
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 Jan 18 23:29:25 2013

This archive was generated by hypermail 2.1.8 : 2013-01-18 23:29:28 CET