Hi, I'm new to this list and I'm experiencing a problem with the cc65. I have installed the latest version V2.12.0 The workstation is a Windows Vista (I changed the privileges for the binaries and they are set as running as Windows XP compatibility) The program is the following (just a simple test): #include <stdlib.h> #define poke(addr,val) (*(unsigned char*) (addr) = (val)) int main (void) { int i = 0; for(i=0; i<4; i++) { poke(0x8000, 8); } return EXIT_SUCCESS; } We call this test.c and now run the following, cc65 -Oi -t c64 test.c (success) ca65 -t c64 test.s (success) ld65 -t c64 test.o (un-successful, see below) This results in the following error reported by the linker, ld65.exe: Warning: [builtin config](6): Segment `STARTUP' does not exist Unresolved external `incsp2' referenced in: test.s(44) Unresolved external `ldaxysp' referenced in: test.s(36) Unresolved external `pushax' referenced in: test.s(26) Unresolved external `staxysp' referenced in: test.s(28) Unresolved external `toslta0' referenced in: test.s(31) ld65.exe: Error: 5 unresolved external(s) found - cannot create output file Now, removing the for loop, #include <stdlib.h> #define poke(addr,val) (*(unsigned char*) (addr) = (val)) int main (void) { poke(0x8000, 8); return EXIT_SUCCESS; } results in a warning, ld65.exe: Warning: [builtin config](6): Segment `STARTUP' does not exist and the result is a working code [a9 08 8d 00 80 a2 00 8a 60] Now, back to the one with a for-loop. When I look into the ASM source, test.s, I see that there in between are the ' jsr pushax','jsr staxysp','jsr pushax',' jsr toslta0','jsr ldaxysp', what are they for ? Are they macros for swapping between or pushing on stack A,X,Y ? This is what is generated (in the case of the for-program), ; ; File generated by cc65 v 2.12.0 ; .fopt compiler,"cc65 v 2.12.0" .setcpu "6502" .smart on .autoimport on .case on .debuginfo off .importzp sp, sreg, regsave, regbank, tmp1, ptr1, ptr2 .macpack longbranch .export _main ; --------------------------------------------------------------- ; int __near__ main (void) ; --------------------------------------------------------------- .segment "CODE" .proc _main: near .segment "CODE" ldx #$00 txa jsr pushax L0014: ldy #$00 jsr staxysp jsr pushax lda #$04 jsr toslta0 beq L0005 lda #$08 sta $8000 ldy #$01 jsr ldaxysp clc adc #$01 bcc L0014 inx jmp L0014 L0005: ldx #$00 txa jmp incsp2 .endproc and this is the source for the one without a for-loop, ; ; File generated by cc65 v 2.12.0 ; .fopt compiler,"cc65 v 2.12.0" .setcpu "6502" .smart on .autoimport on .case on .debuginfo off .importzp sp, sreg, regsave, regbank, tmp1, ptr1, ptr2 .macpack longbranch .export _main ; --------------------------------------------------------------- ; int __near__ main (void) ; --------------------------------------------------------------- .segment "CODE" .proc _main: near .segment "CODE" lda #$08 sta $8000 ldx #$00 txa rts .endproc I would really appreciate if somebody could have a look at this, I suspect this has something todo with the macros, most probably nothing todo with the ca65, more probably me beeing a newbie here using the cc65 and not seeing something. Best regards, Halldor Karl Hognason ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo@musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.Received on Wed Jan 7 04:31:49 2009
This archive was generated by hypermail 2.1.8 : 2009-01-07 04:31:52 CET