nesdev.com
http://forums.nesdev.com/

AMS6 Include Across Folders
http://forums.nesdev.com/viewtopic.php?f=10&t=16926
Page 1 of 1

Author:  Lucradan [ Thu Jan 11, 2018 5:41 pm ]
Post subject:  AMS6 Include Across Folders

I want to better organize my game assets so I placed them into directories. However, I cant seem to get ASM6 to access the files. Any advice?

Here is what I was hoping ASM6 would let me do...

Code:
DAT.TITLE.Background.Tiles:
  incbin "/TILE/TITLE.chr"
DAT.TITLE.Background.Nametable:
  incbin "/TILE/TITLE.nam"
DAT.TITLE.Background.Palette:
  incbin "/TILE/TITLE.pal"
DAT.TITLE.Sprites.Palette:
  incbin "/TILE/TITLE_SPRITES.pal" 
DAT.TITLE.Sprites.Tiles:
  incbin "/TILE/TITLE_SPRITES.chr"
 
DAT.CUTSCENE1.Background.Tiles:
  incbin "/CUTSCENE1/CUTSCENE1.chr"
DAT.CUTSCENE1.Background.Nametable:
  incbin "/CUTSCENE1/CUTSCENE1.nam" 
DAT.CUTSCENE1.Background.Palette:
  incbin "/CUTSCENE1/CUTSCENE1.pal" 
DAT.CUTSCENE1.Sprites.Palette:
  incbin "/CUTSCENE1/CUTSCENE1_SPRITES.pal" 
DAT.CUTSCENE1.Sprites.Tiles:
  incbin "/CUTSCENE1/CUTSCENE1_SPRITES.chr"

DAT.Scroll.Tiles:
  incbin "/CUTSCENE1/TILES_Scroll.chr"
 
DAT.Font.Tiles:
  incbin "/FONTS/Font.chr"

Author:  loopy [ Thu Jan 11, 2018 6:12 pm ]
Post subject:  Re: AMS6 Include Across Folders

Try removing the first slash, e.g. "TILE/TITLE.chr"

Author:  unregistered [ Fri Jan 12, 2018 10:47 am ]
Post subject:  Re: AMS6 Include Across Folders

Do what loopy said (he made asm6!! Thank you so much loopy!! :D ) and reverse your slashes. Webpage urls use "/"; but, directory paths use "\", at least in Windows OS, what we use.
(was blessed to figure this out after opening command prompt :mrgreen: :))

Also, my sister created our "nametable" files with .db statements so we must use .incsrc for those. :)

Author:  dougeff [ Fri Jan 12, 2018 1:54 pm ]
Post subject:  Re: AMS6 Include Across Folders

To quote wikipedia...

"Contrary to popular belief, the Windows system API accepts slash, and thus all the above Unix examples should work. But many applications on Windows interpret a slash for other purposes or treat it as an invalid character, and thus require you to enter backslash — notably the cmd.exe shell"

That being said, I think I use forward slashes even on Windows, except in the command line.

Author:  Pokun [ Mon Jan 15, 2018 7:36 am ]
Post subject:  Re: AMS6 Include Across Folders

I also use normal slashes wherever I can as backslash is a pain to enter (AltGr). I'm pretty sure I use slash in ASM6 include statements without problems.

Author:  unregistered [ Mon Jan 15, 2018 11:21 am ]
Post subject:  Re: AMS6 Include Across Folders

Lucradan, sorry, like dougeff and Pokun said, normal slashes / do work just fine in ASM6. But, after being blessed with discovering that Command Prompt uses backslashes \ and changing all of the normal slashes, for directory paths, to backslashes in our game, its random spastic color flickering (normal/bright/normal) was reduced greatly. :mrgreen: :) However, I forgot that and just checked my code and found a bunch of "\"s and made a mistake. :oops: :(

Author:  Lucradan [ Tue Jan 16, 2018 9:35 am ]
Post subject:  Re: AMS6 Include Across Folders

Removing the first slash fixed the problem, thanks.

Author:  Pokun [ Tue Jan 16, 2018 9:29 pm ]
Post subject:  Re: AMS6 Include Across Folders

Good to hear.

unregistered wrote:
after being blessed with discovering that Command Prompt uses backslashes \ and changing all of the normal slashes, for directory paths, to backslashes in our game, its random spastic color flickering (normal/bright/normal) was reduced greatly. :mrgreen: :) However, I forgot that and just checked my code and found a bunch of "\"s and made a mistake. :oops: :(
The Unix world uses normal slashes in directory paths while AFAIK only DOS/Windows are using backslashes (slash was already used for options to commands instead of a dash like in Unix). Modern programs may accept both though as someone already mentioned, but the command prompt probably don't.
I highly doubt what type of slash you used has anything to do with any glitches in your game unless there's some serious bug in asm6.

Author:  Dwedit [ Tue Jan 16, 2018 10:25 pm ]
Post subject:  Re: AMS6 Include Across Folders

The first slash indicates a rooted path.

So let's say your project directory was C:\development\myproject\source, and you included /data/something.h. The first slash turns the path back to C:\, then it looks in C:\data, which fails.

You can also put a dot before the slash, that will also fix the path.

Forward vs Backslash isn't an issue here, Windows accepts both as long as you aren't at the cmd prompt.

Author:  tokumaru [ Tue Jan 16, 2018 11:10 pm ]
Post subject:  Re: AMS6 Include Across Folders

Yeah, the problem is that a path starting with a slash or backslash is relative to the root, in this case, the root of the drive where your project is. If you start the path with a folder's name, then that's relative to the current path.

A single dot means "the current path", which's why it could also have fixed your problem (e.g. incbin "./TILE/TITLE.chr"). If you use two dots, that means "the parent path", which you can use to reference folders that come before the one you're in. For example, if you're currently in "c:\my-name\projects\platformer" you can use "..\..\asm6\asm6.exe" to call "c:\my-name\asm6\asm6.exe", but without using an absolute path, meaning you can even move "my-name" and everything it contains to some other folder/drive and the references will keep working.

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/