It is currently Sun Oct 22, 2017 7:00 am

All times are UTC - 7 hours



Forum rules


Related:



Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Wed Jun 29, 2016 9:57 am 
Offline
User avatar

Joined: Mon Sep 15, 2014 4:35 pm
Posts: 3074
Location: Nacogdoches, Texas
I had noticed that with my metasprite routine, the value of the address of the metasprite is a 16 bit value, and while I certainly believe that I can fit all my metasprite information in one bank, I don't know if the assembler will put it all there. Similarly, many times, if the identity of something in a slot is 0, then it counts as the thing not existing, the address of the thing could actually start at 0, if that makes sense. Is there a way to solve these issues?


Top
 Profile  
 
PostPosted: Wed Jun 29, 2016 10:56 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19115
Location: NE Indiana, USA (NTSC)
To put everything of a particular type in the same bank, make a separate SEGMENT for that bank (see ld65 Users Guide) and then put everything of that type in that .segment (see ca65 Users Guide). At what level of detail would you like one of us to describe the means of doing so?


Top
 Profile  
 
PostPosted: Wed Jun 29, 2016 5:37 pm 
Offline
User avatar

Joined: Mon Sep 15, 2014 4:35 pm
Posts: 3074
Location: Nacogdoches, Texas
Yeah, I have absolutely no clue how you do that. Is it just something like this?

Code:
.segment

;stuff...

.endsegmet


I'm guessing it would put it in any bank where it would fit, or do you have to specify which one?

Also, should I be concerned about this? It's part of "snes.cfg".

Code:
# ca65 linker config for 256 KiB (2 Mbit) sfc file

# Physical areas of memory
MEMORY {
  ZEROPAGE:   start =  $000000, size =  $0100;   # $0000-00ff -- zero page
                                                 # $0100-01ff -- stack
  BSS:        start =  $000200, size =  $1e00;   # $0200-1fff -- RAM
  BSS7E:      start =  $7e2000, size =  $e000;   # SNES work RAM, $7e2000-7effff
  BSS7F:      start =  $7f0000, size = $10000;   # SNES work RAM, $7f0000-$7ffff
  ROM0:       start =  $008000, size =  $8000, fill = yes;
  ROM1:       start =  $018000, size =  $8000, fill = yes;
  ROM2:       start =  $028000, size =  $8000, fill = yes;
  ROM3:       start =  $038000, size =  $8000, fill = yes;
  ROM4:       start =  $048000, size =  $8000, fill = yes;
  ROM5:       start =  $058000, size =  $8000, fill = yes;
  ROM6:       start =  $068000, size =  $8000, fill = yes;
  ROM7:       start =  $078000, size =  $8000, fill = yes;
}

# Logical areas code/data can be put into.
SEGMENTS {
  CODE:       load = ROM0, align =  $100;
  RODATA:     load = ROM0, align =  $100;
  SNESHEADER: load = ROM0, start = $ffc0;
  CODE1:      load = ROM1, align =  $100, optional = yes;
  RODATA1:    load = ROM1, align =  $100, optional = yes;
  CODE2:      load = ROM2, align =  $100, optional = yes;
  RODATA2:    load = ROM2, align =  $100, optional = yes;
  CODE3:      load = ROM3, align =  $100, optional = yes;
  RODATA3:    load = ROM3, align =  $100, optional = yes;
  CODE4:      load = ROM4, align =  $100, optional = yes;
  RODATA4:    load = ROM4, align =  $100, optional = yes;
  CODE5:      load = ROM5, align =  $100, optional = yes;
  RODATA5:    load = ROM5, align =  $100, optional = yes;
  CODE6:      load = ROM6, align =  $100, optional = yes;
  RODATA6:    load = ROM6, align =  $100, optional = yes;
  CODE7:      load = ROM7, align =  $100, optional = yes;
  RODATA7:    load = ROM7, align =  $100, optional = yes;

  ZEROPAGE:   load = ZEROPAGE, type = zp;
  BSS:        load = BSS,   type = bss, align = $100, optional = yes;
  BSS7E:      load = BSS7E, type = bss, align = $100, optional = yes;
  BSS7F:      load = BSS7F, type = bss, align = $100, optional = yes;
}


Top
 Profile  
 
PostPosted: Wed Jun 29, 2016 5:41 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19115
Location: NE Indiana, USA (NTSC)
There is no .endsegment. You just have to put .segment "SOMESEGMENT" to change the current segment before the sprite layout tables, and put .segment "OTHERSEGMENT" afterward. If you want behavior like that of .proc and .endproc, use .pushseg, .segment "SOMESEGMENT", and .popseg.

With the linker configuration file you pasted, you can just use, say, .segment "RODATA6" if everything will fit in bank 6.


Top
 Profile  
 
PostPosted: Wed Jun 29, 2016 8:47 pm 
Offline
User avatar

Joined: Mon Sep 15, 2014 4:35 pm
Posts: 3074
Location: Nacogdoches, Texas
tepples wrote:
With the linker configuration file you pasted, you can just use, say, .segment "RODATA6" if everything will fit in bank 6.

Yeah, that's basically what I was looking for. I understand it now. I was a little confused because I thought "CODE" and "RODATA" encompassed everything, not just bank 0, and ca65 just rearranged everything to what banks the information would fit in. I didn't look at it very hard... :lol:


Top
 Profile  
 
PostPosted: Thu Jun 30, 2016 10:18 pm 
Offline
User avatar

Joined: Mon Sep 15, 2014 4:35 pm
Posts: 3074
Location: Nacogdoches, Texas
I just thought of something... If there are two files that are included under RODATA and there are next to each other in the .asm file, shouldn't they also be assembled next to each other?


Top
 Profile  
 
PostPosted: Thu Jun 30, 2016 10:28 pm 
Offline
Site Admin
User avatar

Joined: Mon Sep 20, 2004 6:04 am
Posts: 3470
Location: Indianapolis
Espozo wrote:
I just thought of something... If there are two files that are included under RODATA and there are next to each other in the .asm file, shouldn't they also be assembled next to each other?


Yeah, you can count on that. In that regard, the bytes of an included data file will be treated the same as bytes of code would be.


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

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 5 guests


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