It is currently Sat Dec 15, 2018 11:44 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Thu Dec 13, 2018 10:56 pm 
Offline

Joined: Tue Aug 28, 2018 8:54 am
Posts: 111
Location: Edmonton, Canada
I have my boot.asm

Code:
.segment "CODE"
.include "boot_shared.inc"
.segment "VECTORS"
    .word nmi
    .word reset
    .word irq
.segment "BANK0"
.scope b2
    .include "boot_shared.inc"
    .segment "VECTORS0"
        .word nmi
        .word reset
        .word irq
.endscope


And boot_shared.inc

Code:
.import main

reset:
    ...
    lda #0
    jsr lib_SwitchBank
    jmp main

nmi:
    ...
    rti

irq:
    rti

.export lib_SwitchBank
.proc lib_SwitchBank
    and #$0F
    sta $8000
    rts
.endproc


I want somehow to import lib_SwitchBank into any bank, but instead I get "Duplicate external identifier: `lib_SwitchBank'" even though (and I might be wrong) they are on the same address... Scope doesn't seem to have. I should not have too many of those routines, but I need at least a couple. How can I correctly link it?


Top
 Profile  
 
PostPosted: Thu Dec 13, 2018 11:01 pm 
Offline
User avatar

Joined: Thu Mar 31, 2016 11:15 am
Posts: 443
Dunno, but try removing ".export lib_SwitchBank" from boot_shared.inc and moving it to boot.asm at top-level scope.


Top
 Profile  
 
PostPosted: Thu Dec 13, 2018 11:05 pm 
Offline

Joined: Tue Aug 28, 2018 8:54 am
Posts: 111
Location: Edmonton, Canada
Duh... Sorry, should have thought about that... Thank you!


Top
 Profile  
 
PostPosted: Fri Dec 14, 2018 1:22 am 
Offline
User avatar

Joined: Thu Sep 15, 2016 6:29 am
Posts: 833
Location: Denmark (PAL)
Instead of including the same code multiple times in your source, shouldn't it be possible to do this with the linker config? Just define a segment that's included multiple times in the ROM image.


Top
 Profile  
 
PostPosted: Fri Dec 14, 2018 8:01 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 20877
Location: NE Indiana, USA (NTSC)
I don't think the ld65 configuration language allows a single SEGMENT to be copied into multiple MEMORY areas.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group