Jump to content

Photo

Separating bank code into files


4 replies to this topic

#1 mksmith OFFLINE  

mksmith

    Space Invader

  • 39 posts
  • Location:Melbourne, Australia

Posted Sun Jan 6, 2019 11:55 PM

Hi,

 

I'm working on my DPC+ game and it's all starting to get a bit large to easily edit. Can you separate each bank's code into it's own files and merge it back together on compile? I've looked at include, includesfile and inline and these don't appear to work in this situation. Any suggestions?

 

Thanks!



#2 Muddyfunster ONLINE  

Muddyfunster

    Chopper Commander

  • 237 posts

Posted Mon Jan 7, 2019 9:11 AM

are you using Visual bB? You can set bookmarks to switch between areas of code you edit often.



#3 RevEng ONLINE  

RevEng

    Bit Player

  • 5,083 posts
  • Location:bottom of the stack

Posted Mon Jan 7, 2019 10:00 AM

[...]Can you separate each bank's code into it's own files and merge it back together on compile?


A bB program can only include assembly programs, not other bB programs. This functionality isn't impossible, but would require a fair bit of restructure for bB to accomplish.

As Muddyfunster suggests, you can use vbb or whatever editor supports bookmarks. I use "section descriptions" that are easily searched in my editor of choice. (vi) Or you could split your source apart into separate files, and combine it right before compiling with a custom batch-file/shell-script.

#4 Lillapojkenpćön OFFLINE  

Lillapojkenpćön

    Chopper Commander

  • 156 posts

Posted Mon Jan 7, 2019 12:02 PM

I saw your request for a way to easily change what sprite data is pointed to yesterday, I have made a nice and simple example (with alot of help) that does that, and color data to, I will post it soon.



#5 mksmith OFFLINE  

mksmith

    Space Invader

  • Topic Starter
  • 39 posts
  • Location:Melbourne, Australia

Posted Mon Jan 7, 2019 2:10 PM

Thanks guys - yeah using VbB so will check out bookmarks. Would be great to have that ability though.

 

@Lillapojkenpåön  - I've got a bit of a process built now (see here) but would love to see any other examples of the sprite/color stuff.  bB has some interesting things you can do but also what you have to work around. The biggie for me now is the 256b limit for data tables and whether there is a way to work around that - otherwise there is a bit of if then checking to work out the data pointers. I did find a macro can give a bit of flexibility around setting stuff from pointers:

 macro SetPlayer0Frame
 rem {1}=datapointer {2}=frame

 rem set data pointer
 asm
  LDX #<{1}
  STX temp5
end
 rem set frame
 player0pointerlo = temp5+({2}*Height)
 asm
  LDA #((>{1}) & $0f) | (((>{1}) / 2) & $70) 
  STA player0pointerhi 
end
end

 macro SetPlayer1To9Frame
 rem {1}=datapointer {2}=spritenumber {3}=frame

 rem set datapointer
 asm
  LDX #<{1}
  STX temp5
end
 rem load sprite pointer
 asm
  LDA #<(playerpointers+({2}*2))
  STA DF0LOW
  LDA #(>(playerpointers+({2}*2))) & $0F
  STA DF0HI
end
 rem set frame
 DF0WRITE = temp5+({3}*Height)
 asm
  LDA #((>{1}) & $0f) | (((>{1}) / 2) & $70) 
  STA DF0WRITE
end
end

Edited by mksmith, Mon Jan 7, 2019 2:12 PM.





0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users