[cc65] rebuilding libraries - generated program crashes

Date view Thread view Subject view

From: jimsymolon (jsymolon01_at_attbi.com)
Date: 2003-05-29 12:28:53


I've compiled the helloworld source code and linked using the windows 
tools.  I've loaded the generated code into a DOS 3.3 disk image and 
executed on applewin.  This is ok - I get the "hello world" printout on 
screen.

My build system is Linux 2.4.19 (Mandrake 9.0), gcc 3.2 libc-2.2.5
I've rebuild the tools on this system.

I've been working on ProDOS file IO and when I re-compile the library 
and the helloworld program the executable crashes.  The image is 
different - it has the EXEHDR and the original doesnt.

The emulator bombs on the EXEHDR and I start the program after it.  Then 
it bombs on the zerobss call as it points to something - it isn't the 
zerobss function.  I'm thinking it's the linker.

800 = start
80b: ca             dex
80c: 10 f8         bpl 806
80e:20 eb 0e   jsr  eeb

eeb:ae b2 11   ldx $11b2
eee:60              rts

This is my compile script

u:\cc65\bin\cc65 -I u:\cc65\include -t apple2 $1

This is the linker script

ld65 -t apple2 -o $1 apple2.o $2 $3 apple2.lib



Right now I don't know where to start.  It is the CFG file for the 
linker ?  It is one of the programs not getting the right parameters ?

Here is the map file:

>Modules list:
>-------------
>apple2.o:
>    BSS               Offs = 000000   Size = 000001
>    DATA              Offs = 000000   Size = 00001A
>    EXEHDR            Offs = 000000   Size = 000004
>    STARTUP           Offs = 000000   Size = 000043
>hello.o:
>    CODE              Offs = 000000   Size = 0000BF
>    RODATA            Offs = 000000   Size = 000010
>text.o:
>    CODE              Offs = 0000BF   Size = 00000D
>apple2.lib(cgetc.o):
>    CODE              Offs = 0000CC   Size = 000012
>apple2.lib(chline.o):
>    CODE              Offs = 0000DE   Size = 000018
>apple2.lib(clrscr.o):
>apple2.lib(color.o):
>apple2.lib(cputc.o):
>    CODE              Offs = 0000F6   Size = 000061
>apple2.lib(ctype.o):
>    RODATA            Offs = 000010   Size = 000100
>apple2.lib(cvline.o):
>    CODE              Offs = 000157   Size = 00001B
>apple2.lib(_scrsize.o):
>    RODATA            Offs = 000110   Size = 000002
>apple2.lib(cprintf.o):
>    CODE              Offs = 000172   Size = 00002A
>    BSS               Offs = 000001   Size = 000001
>apple2.lib(_hextab.o):
>    RODATA            Offs = 000112   Size = 000010
>apple2.lib(ltoa.o):
>    CODE              Offs = 00019C   Size = 0000AF
>    RODATA            Offs = 000122   Size = 00000C
>apple2.lib(_printf.o):
>    CODE              Offs = 00024B   Size = 0003A1
>    BSS               Offs = 000002   Size = 00002B
>    DATA              Offs = 00001A   Size = 000003
>apple2.lib(strlen.o):
>    CODE              Offs = 0005EC   Size = 000016
>apple2.lib(strlower.o):
>    CODE              Offs = 000602   Size = 000028
>apple2.lib(vcprintf.o):
>    CODE              Offs = 00062A   Size = 00007E
>    DATA              Offs = 00001D   Size = 000008
>apple2.lib(zerobss.o):
>    CODE              Offs = 0006A8   Size = 000023
>apple2.lib(addysp.o):
>    CODE              Offs = 0006CB   Size = 00000E
>apple2.lib(axlong.o):
>    CODE              Offs = 0006D9   Size = 000012
>apple2.lib(condes.o):
>    CODE              Offs = 0006EB   Size = 000038
>    BSS               Offs = 00002D   Size = 000001
>    DATA              Offs = 000025   Size = 000007
>apple2.lib(decax1.o):
>    CODE              Offs = 000723   Size = 000007
>apple2.lib(decax2.o):
>    CODE              Offs = 00072A   Size = 000007
>apple2.lib(decsp2.o):
>    CODE              Offs = 000731   Size = 00000D
>apple2.lib(decsp4.o):
>    CODE              Offs = 00073E   Size = 00000D
>apple2.lib(decsp6.o):
>    CODE              Offs = 00074B   Size = 00000D
>apple2.lib(incsp2.o):
>    CODE              Offs = 000758   Size = 000019
>apple2.lib(leasp.o):
>    CODE              Offs = 000771   Size = 000009
>apple2.lib(lpush.o):
>    CODE              Offs = 00077A   Size = 00001E
>apple2.lib(popa.o):
>    CODE              Offs = 000798   Size = 00000C
>apple2.lib(push1.o):
>    CODE              Offs = 0007A4   Size = 000005
>apple2.lib(pusha.o):
>    CODE              Offs = 0007A9   Size = 000016
>apple2.lib(pushax.o):
>    CODE              Offs = 0007BF   Size = 00001A
>apple2.lib(pushc0.o):
>    CODE              Offs = 0007D9   Size = 000005
>apple2.lib(pushc1.o):
>    CODE              Offs = 0007DE   Size = 000005
>apple2.lib(return0.o):
>    CODE              Offs = 0007E3   Size = 000004
>apple2.lib(return1.o):
>    CODE              Offs = 0007E7   Size = 000005
>apple2.lib(sub.o):
>    CODE              Offs = 0007EC   Size = 000015
>apple2.lib(zeropage.o):
>    ZEROPAGE          Offs = 000000   Size = 00001A
>apple2.lib(_cursor.o):
>    BSS               Offs = 00002E   Size = 000001
>apple2.lib(cursor.o):
>    CODE              Offs = 000801   Size = 00000A
>apple2.lib(scrsize.o):
>    CODE              Offs = 00080B   Size = 000018
>
>
>Segment list:
>-------------
>Name                  Start   End     Size
>--------------------------------------------
>EXEHDR                000000  000003  000004
>ZEROPAGE              000000  000019  00001A
>STARTUP               000800  000842  000043
>CODE                  000843  001065  000823
>RODATA                001066  001193  00012E
>DATA                  001194  0011BF  00002C
>BSS                   0011C0  0011EE  00002F
>
>
>Exports list:
>-------------
>__BSS_LOAD__              0011C0 RL     __BSS_RUN__               0011C0 RL     
>__BSS_SIZE__              00002F RE     __CONSTRUCTOR_COUNT__     000000 RE     
>__CONSTRUCTOR_TABLE__     001194 RL     __DESTRUCTOR_COUNT__      000000 RE     
>__DESTRUCTOR_TABLE__      001194 RL     __STARTUP_LOAD__          000800 RL     
>__ctype                   001076 RL     __hextab                  001178 RL     
>__printf                  000B81 RL     _bgcolor                  001026 RE     
>_bordercolor              001026 RE     _cgetc                    00090F RL     
>_chline                   000929 RL     _clrscr                   00FC58 RE     
>_cprintf                  0009B5 RL     _cputc                    000941 RL     
>_cursor                   001044 RL     _cvlinexy                 00099A RL     
>_gotoxy                   00098F RL     _ltoa                     0009FB RL     
>_main                     000843 RL     _screensize               00104E RL     
>_strlen                   000E2F RL     _strlower                 000E45 RL     
>_textcolor                00102A RE     _ultoa                    000A52 RL     
>_vcprintf                 000EBB RL     addysp                    000F0F RL     
>addysp1                   000F0E RL     axlong                    000F23 RL     
>axulong                   000F1C RL     cputdirect                00094E RL     
>cursor                    0011EE RL     decax1                    000F66 RL     
>decax2                    000F6D RL     decsp2                    000F74 RL     
>decsp4                    000F81 RL     decsp6                    000F8E RL     
>donelib                   000F37 RL     incsp2                    000FA3 RL     
>initlib                   000F2E RL     leaasp                    000FB4 RL     
>newline                   000979 RL     popa                      000FDB RL     
>popax                     000F9B RL     ptr1                      000008 RLZ    
>ptr2                      00000A RLZ    ptr3                      00000C RLZ    
>push0                     001002 RL     push1                     000FE7 RL     
>pusha                     000FF0 RL     pusha0                    001004 RL     
>pushax                    001006 RL     pushc0                    00101C RL     
>pushc1                    001021 RL     pusheax                   000FC3 RL     
>putchar                   00095E RL     regbank                   000014 RLZ    
>return0                   001026 RL     return1                   00102A RL     
>sp                        000000 RLZ    sreg                      000002 RLZ    
>tmp1                      000010 RLZ    tossubax                  001031 RL     
>xsize                     001176 RL     ysize                     001177 RL     
>zerobss                   000EEB RL     
>
>
>Imports list:
>-------------
>__BSS_LOAD__ ([linker generated]):
>    apple2.o                  crt0.s(10)
>__BSS_RUN__ ([linker generated]):
>    zerobss.o                 zerobss.s(8)
>__BSS_SIZE__ ([linker generated]):
>    zerobss.o                 zerobss.s(8)
>__CONSTRUCTOR_COUNT__ ([linker generated]):
>    condes.o                  condes.s(23)
>__CONSTRUCTOR_TABLE__ ([linker generated]):
>    condes.o                  condes.s(23)
>__DESTRUCTOR_COUNT__ ([linker generated]):
>    condes.o                  condes.s(24)
>__DESTRUCTOR_TABLE__ ([linker generated]):
>    condes.o                  condes.s(24)
>__STARTUP_LOAD__ ([linker generated]):
>    apple2.o                  crt0.s(10)
>__ctype (ctype.o):
>    strlower.o                strlower.s(12)
>__hextab (_hextab.o):
>    ltoa.o                    ltoa.s(10)
>__printf (_printf.o):
>    vcprintf.o                vcprintf.s(9)
>_bgcolor (color.o):
>    hello.o                   hello.s(18)
>_bordercolor (color.o):
>    hello.o                   hello.s(19)
>_cgetc (cgetc.o):
>    hello.o                   hello.s(15)
>_chline (chline.o):
>    hello.o                   hello.s(20)
>_clrscr (clrscr.o):
>    hello.o                   hello.s(11)
>_cprintf (cprintf.o):
>    hello.o                   hello.s(14)
>_cputc (cputc.o):
>    vcprintf.o                vcprintf.s(9)
>    hello.o                   hello.s(13)
>_cursor (cursor.o):
>    hello.o                   hello.s(16)
>_cvlinexy (cvline.o):
>    hello.o                   hello.s(21)
>_gotoxy (cputc.o):
>    cvline.o                  cvline.s(9)
>    chline.o                  chline.s(9)
>    hello.o                   hello.s(12)
>_ltoa (ltoa.o):
>    _printf.o                 _printf.s(11)
>_main (hello.o):
>    apple2.o                  crt0.s(11)
>_screensize (scrsize.o):
>    hello.o                   hello.s(22)
>_strlen (strlen.o):
>    _printf.o                 _printf.s(12)
>    hello.o                   hello.s(10)
>_strlower (strlower.o):
>    _printf.o                 _printf.s(12)
>_textcolor (color.o):
>    hello.o                   hello.s(17)
>_ultoa (ltoa.o):
>    _printf.o                 _printf.s(11)
>_vcprintf (vcprintf.o):
>    cprintf.o                 cprintf.s(8)
>addysp (addysp.o):
>    cprintf.o                 cprintf.s(8)
>addysp1 (addysp.o):
>    sub.o                     sub.s(8)
>axlong (axlong.o):
>    _printf.o                 _printf.s(9)
>axulong (axlong.o):
>    _printf.o                 _printf.s(9)
>cputdirect (cputc.o):
>    chline.o                  chline.s(9)
>cursor (_cursor.o):
>    cursor.o                  cursor.s(8)
>decax1 (decax1.o):
>    hello.o                   hello.s(86)
>decax2 (decax2.o):
>    hello.o                   hello.s(63)
>decsp2 (decsp2.o):
>    hello.o                   hello.s(42)
>decsp4 (decsp4.o):
>    lpush.o                   lpush.s(11)
>decsp6 (decsp6.o):
>    _printf.o                 _printf.s(9)
>donelib (condes.o):
>    apple2.o                  crt0.s(8)
>incsp2 (incsp2.o):
>    hello.o                   hello.s(119)
>initlib (condes.o):
>    apple2.o                  crt0.s(8)
>leaasp (leasp.o):
>    hello.o                   hello.s(53)
>newline (cputc.o):
>    cvline.o                  cvline.s(9)
>popa (popa.o):
>    cvline.o                  cvline.s(9)
>    cputc.o                   cputc.s(12)
>    chline.o                  chline.s(9)
>popax (incsp2.o):
>    ltoa.o                    ltoa.s(9)
>    _printf.o                 _printf.s(9)
>    scrsize.o                 scrsize.s(9)
>    vcprintf.o                vcprintf.s(8)
>ptr1 (zeropage.o):
>    ltoa.o                    ltoa.s(11)
>    strlower.o                strlower.s(13)
>    _printf.o                 _printf.s(13)
>    scrsize.o                 scrsize.s(11)
>    zerobss.o                 zerobss.s(9)
>    vcprintf.o                vcprintf.s(10)
>    strlen.o                  strlen.s(8)
>    cprintf.o                 cprintf.s(9)
>ptr2 (zeropage.o):
>    ltoa.o                    ltoa.s(11)
>    strlower.o                strlower.s(13)
>    _printf.o                 _printf.s(13)
>    scrsize.o                 scrsize.s(11)
>    vcprintf.o                vcprintf.s(10)
>ptr3 (zeropage.o):
>    ltoa.o                    ltoa.s(11)
>    vcprintf.o                vcprintf.s(10)
>push0 (pushax.o):
>    apple2.o                  crt0.s(9)
>push1 (push1.o):
>    _printf.o                 _printf.s(9)
>pusha (pusha.o):
>    pushc1.o                  pushc1.s(8)
>    pushc0.o                  pushc0.s(8)
>    hello.o                   hello.s(87)
>pusha0 (pushax.o):
>    push1.o                   push1.s(8)
>    hello.o                   hello.s(96)
>pushax (pushax.o):
>    _printf.o                 _printf.s(9)
>    vcprintf.o                vcprintf.s(8)
>    cprintf.o                 cprintf.s(8)
>    hello.o                   hello.s(54)
>pushc0 (pushc0.o):
>    hello.o                   hello.s(67)
>pushc1 (pushc1.o):
>    hello.o                   hello.s(68)
>pusheax (lpush.o):
>    _printf.o                 _printf.s(9)
>putchar (cputc.o):
>    cvline.o                  cvline.s(9)
>regbank (zeropage.o):
>    _printf.o                 _printf.s(13)
>return0 (return0.o):
>    color.o                   color.s(10)
>return1 (return1.o):
>    color.o                   color.s(10)
>sp (zeropage.o):
>    decsp4.o                  decsp4.s(8)
>    lpush.o                   lpush.s(12)
>    decsp6.o                  decsp6.s(8)
>    _printf.o                 _printf.s(13)
>    sub.o                     sub.s(9)
>    pushax.o                  pushax.s(8)
>    pusha.o                   pusha.s(8)
>    popa.o                    popa.s(8)
>    leasp.o                   leasp.s(8)
>    incsp2.o                  incsp2.s(8)
>    decsp2.o                  decsp2.s(8)
>    addysp.o                  addysp.s(8)
>    vcprintf.o                vcprintf.s(10)
>    cprintf.o                 cprintf.s(9)
>    hello.o                   hello.s(8)
>    apple2.o                  zeropage.inc(11)
>sreg (zeropage.o):
>    ltoa.o                    ltoa.s(11)
>    lpush.o                   lpush.s(12)
>    axlong.o                  axlong.s(8)
>    _printf.o                 _printf.s(13)
>tmp1 (zeropage.o):
>    ltoa.o                    ltoa.s(11)
>    _printf.o                 _printf.s(13)
>    vcprintf.o                vcprintf.s(10)
>    cvline.o                  cvline.s(10)
>    chline.o                  chline.s(10)
>tossubax (sub.o):
>    hello.o                   hello.s(100)
>xsize (_scrsize.o):
>    scrsize.o                 scrsize.s(10)
>ysize (_scrsize.o):
>    scrsize.o                 scrsize.s(10)
>zerobss (zerobss.o):
>    apple2.o                  crt0.s(9)
>
>  
>


----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2003-05-29 12:40:34 CEST